diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /sfx2/inc | |
parent | Initial commit. (diff) | |
download | libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sfx2/inc')
53 files changed, 3972 insertions, 0 deletions
diff --git a/sfx2/inc/SfxRedactionHelper.hxx b/sfx2/inc/SfxRedactionHelper.hxx new file mode 100644 index 000000000..86d563f76 --- /dev/null +++ b/sfx2/inc/SfxRedactionHelper.hxx @@ -0,0 +1,145 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_CUI_SOURCE_INC_SFXREDACTIONHELPER_HXX +#define INCLUDED_CUI_SOURCE_INC_SFXREDACTIONHELPER_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> + +#include <vector> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; + +class SfxRequest; +class SfxStringItem; +class GDIMetaFile; +class DocumentToGraphicRenderer; +class SfxViewFrame; +struct RedactionTarget; + +namespace i18nutil +{ +struct SearchOptions2; +} + +struct PageMargins +{ + // Page margins in mm100th + sal_Int32 nTop; + sal_Int32 nBottom; + sal_Int32 nLeft; + sal_Int32 nRight; +}; + +/* + * Mostly a bunch of static methods to handle the redaction functionality at + * different points of the process. + **/ +class SfxRedactionHelper +{ +public: + /// Checks to see if the request has a parameter of IsRedactMode:bool=true + static bool isRedactMode(const SfxRequest& rReq); + /* + * Returns the value of the given string param as an OUString + * Returns empty OUString if no param + * */ + static OUString getStringParam(const SfxRequest& rReq, sal_uInt16 nParamId); + /* + * Creates metafiles from the pages of the given document, + * and pushes into the given vector. + * */ + static void getPageMetaFilesFromDoc(std::vector<GDIMetaFile>& aMetaFiles, + std::vector<::Size>& aPageSizes, sal_Int32 nPages, + DocumentToGraphicRenderer& aRenderer); + /* + * Creates one shape and one draw page for each gdimetafile, + * and inserts the shapes into the newly created draw pages. + * */ + static void + addPagesToDraw(const uno::Reference<XComponent>& xComponent, sal_Int32 nPages, + const std::vector<GDIMetaFile>& aMetaFiles, + const std::vector<::Size>& aPageSizes, const PageMargins& aPageMargins, + const std::vector<std::pair<RedactionTarget*, OUString>>& r_aTableTargets, + bool bIsAutoRedact); + /* + * Makes the Redaction toolbar visible to the user. + * Meant to be called after converting a document to a Draw doc + * for redaction purposes. + * */ + static void showRedactionToolbar(const SfxViewFrame* pViewFrame); + + /* + * Used to get the page margins from the original/source Writer document. Then we apply these values to the + * pages inserted into Draw for redaction. + * */ + static PageMargins + getPageMarginsForWriter(const css::uno::Reference<css::frame::XModel>& xModel); + + /* + * Used to get the page margins from the original/source Calc document. Then we apply these values to the + * pages inserted into Draw for redaction. + * */ + static PageMargins getPageMarginsForCalc(const css::uno::Reference<css::frame::XModel>& xModel); + + /* + * Used to find the text portions to be redacted. Returns a list of rectangles to cover those + * areas to be redacted. Probably the most crucial part of the auto-redaction process. + * */ + static void searchInMetaFile(const RedactionTarget* pRedactionTarget, const GDIMetaFile& rMtf, + std::vector<tools::Rectangle>& aRedactionRectangles, + const uno::Reference<XComponent>& xComponent); + + /* + * Draws a redaction rectangle on the draw page referenced with its page number (0-based) + * */ + static void addRedactionRectToPage(const uno::Reference<XComponent>& xComponent, + const uno::Reference<drawing::XDrawPage>& xPage, + const std::vector<tools::Rectangle>& aNewRectangles); + + /* + * Search for the given term through the gdimetafile, which has the whole content of a draw page, + * and draw redaction rectangles to the appropriate positions with suitable sizes. + * */ + static void autoRedactPage(const RedactionTarget* pRedactionTarget, + const GDIMetaFile& rGDIMetaFile, + const uno::Reference<drawing::XDrawPage>& xPage, + const uno::Reference<XComponent>& xComponent); + + /// Fill the search options based on the given redaction target + static void fillSearchOptions(i18nutil::SearchOptions2& rSearchOpt, + const RedactionTarget* pTarget); + +private: + static constexpr OUStringLiteral m_aPredefinedTargets[6] = { + "\\b(?:\\d[ -]*?){13,16}\\b", //Credit card numbers + "\\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\\b", //Email addresses + "\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" + "\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" + "\\b", //IP addresses + "([12]\\d{3}[./-](0[1-9]|1[0-2])[./" + "-](0[1-9]|[12]\\d|3[01]))|((0[1-9]|[12]\\d|3[01])[./-](0[1-9]|1[0-2])[./" + "-][12]\\d{3})", //Dates (numerical) + "\\s*[a-zA-Z]{2}(?:\\s*\\d\\s*){6}[a-zA-Z]?\\s*", //National Insurance Number (UK) + "([1-9])(?!\\1{2}-\\1{2}-\\1{4})[1-9]{2}-[1-9]{2}-[1-9]{4}" //Social Security Number (US) + }; +}; + +#endif // INCLUDED_CUI_SOURCE_INC_SFXREDACTIONHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sfx2/inc/arrdecl.hxx b/sfx2/inc/arrdecl.hxx new file mode 100644 index 000000000..b777fad7a --- /dev/null +++ b/sfx2/inc/arrdecl.hxx @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX2_INC_ARRDECL_HXX +#define INCLUDED_SFX2_INC_ARRDECL_HXX + +#include <vector> +#include <memory> + +class SfxFilter; +typedef ::std::vector<std::shared_ptr<const SfxFilter>> SfxFilterList_Impl; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/autoredactdialog.hxx b/sfx2/inc/autoredactdialog.hxx new file mode 100644 index 000000000..d43d88e77 --- /dev/null +++ b/sfx2/inc/autoredactdialog.hxx @@ -0,0 +1,177 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SFX2_INC_AUTOREDACTDIALOG_HXX +#define INCLUDED_SFX2_INC_AUTOREDACTDIALOG_HXX + +#include <memory> +#include <sal/config.h> +#include <sfx2/basedlgs.hxx> +#include <sfx2/objsh.hxx> + +namespace weld +{ +class Button; +} +namespace weld +{ +class ComboBox; +} +namespace weld +{ +class Label; +} +namespace weld +{ +class Window; +} +namespace weld +{ +class TreeView; +} + +enum RedactionTargetType +{ + REDACTION_TARGET_TEXT, + REDACTION_TARGET_REGEX, + REDACTION_TARGET_PREDEFINED, + REDACTION_TARGET_UNKNOWN +}; + +/// Keeps information for a single redaction target +struct RedactionTarget +{ + OUString sName; + RedactionTargetType sType; + OUString sContent; + bool bCaseSensitive; + bool bWholeWords; + sal_uInt32 nID; +}; + +/// Used to display the targets list +class TargetsTable +{ + std::unique_ptr<weld::TreeView> m_xControl; + int GetRowByTargetName(const OUString& sName); + +public: + TargetsTable(std::unique_ptr<weld::TreeView> xControl); + void InsertTarget(RedactionTarget* pTarget); + void SelectByName(const OUString& sName); + RedactionTarget* GetTargetByName(const OUString& sName); + OUString GetNameProposal() const; + + void unselect_all() { m_xControl->unselect_all(); } + bool has_focus() const { return m_xControl->has_focus(); } + int n_children() const { return m_xControl->n_children(); } + int get_selected_index() const { return m_xControl->get_selected_index(); } + std::vector<int> get_selected_rows() const { return m_xControl->get_selected_rows(); } + void clear() { m_xControl->clear(); } + void remove(int nRow) { m_xControl->remove(nRow); } + void select(int nRow) { m_xControl->select(nRow); } + OUString get_id(int nRow) const { return m_xControl->get_id(nRow); } + + // Sync data on the targets box with the data on the target + void setRowData(int nRowIndex, const RedactionTarget* pTarget); + + //void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xControl->connect_changed(rLink); } + //void connect_row_activated(const Link<weld::TreeView&, void>& rLink) { m_xControl->connect_row_activated(rLink); } +}; + +namespace sfx2 +{ +class FileDialogHelper; +} + +enum class StartFileDialogType +{ + Open, + SaveAs +}; + +class SfxAutoRedactDialog final : public SfxDialogController +{ + SfxObjectShellLock m_xDocShell; + std::vector<std::pair<RedactionTarget*, OUString>> m_aTableTargets; + std::unique_ptr<sfx2::FileDialogHelper> m_pFileDlg; + bool m_bIsValidState; + bool m_bTargetsCopied; + + std::unique_ptr<weld::Label> m_xRedactionTargetsLabel; + std::unique_ptr<TargetsTable> m_xTargetsBox; + std::unique_ptr<weld::Button> m_xLoadBtn; + std::unique_ptr<weld::Button> m_xSaveBtn; + std::unique_ptr<weld::Button> m_xAddBtn; + std::unique_ptr<weld::Button> m_xEditBtn; + std::unique_ptr<weld::Button> m_xDeleteBtn; + + DECL_LINK(Load, weld::Button&, void); + DECL_LINK(Save, weld::Button&, void); + DECL_LINK(AddHdl, weld::Button&, void); + DECL_LINK(EditHdl, weld::Button&, void); + DECL_LINK(DeleteHdl, weld::Button&, void); + + DECL_LINK(LoadHdl, sfx2::FileDialogHelper*, void); + DECL_LINK(SaveHdl, sfx2::FileDialogHelper*, void); + + void StartFileDialog(StartFileDialogType nType, const OUString& rTitle); + /// Carry out proper addition both to the targets box, and to the tabletargets vector. + void addTarget(RedactionTarget* pTarget); + /// Clear all targets both visually and from the targets vector + void clearTargets(); + +public: + SfxAutoRedactDialog(weld::Window* pParent); + virtual ~SfxAutoRedactDialog() override; + + /// Check if the dialog has any valid redaction targets. + bool hasTargets() const; + /// Check if the dialog is in a valid state. + bool isValidState() const { return m_bIsValidState; } + /** Copies targets vector + * Does a shallow copy. + * Returns true if successful. + */ + bool getTargets(std::vector<std::pair<RedactionTarget*, OUString>>& r_aTargets); +}; + +class SfxAddTargetDialog final : public weld::GenericDialogController +{ +private: + std::unique_ptr<weld::Entry> m_xName; + std::unique_ptr<weld::ComboBox> m_xType; + std::unique_ptr<weld::Label> m_xLabelContent; + std::unique_ptr<weld::Entry> m_xContent; + std::unique_ptr<weld::Label> m_xLabelPredefContent; + std::unique_ptr<weld::ComboBox> m_xPredefContent; + std::unique_ptr<weld::CheckButton> m_xCaseSensitive; + std::unique_ptr<weld::CheckButton> m_xWholeWords; + + DECL_LINK(SelectTypeHdl, weld::ComboBox&, void); + +public: + SfxAddTargetDialog(weld::Window* pWindow, const OUString& rName); + SfxAddTargetDialog(weld::Window* pWindow, const OUString& sName, + const RedactionTargetType& eTargetType, const OUString& sContent, + bool bCaseSensitive, bool bWholeWords); + + OUString getName() const { return m_xName->get_text(); } + RedactionTargetType getType() const; + OUString getContent() const; + bool isCaseSensitive() const + { + return m_xCaseSensitive->get_state() == TriState::TRISTATE_TRUE; + } + bool isWholeWords() const { return m_xWholeWords->get_state() == TriState::TRISTATE_TRUE; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sfx2/inc/bitmaps.hlst b/sfx2/inc/bitmaps.hlst new file mode 100644 index 000000000..7e97d1219 --- /dev/null +++ b/sfx2/inc/bitmaps.hlst @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SFX2_INC_BITMAPS_HRC +#define INCLUDED_SFX2_INC_BITMAPS_HRC + +#define BMP_HELP_TOOLBOX_INDEX_ON "sfx2/res/indexon_small.png" +#define BMP_HELP_TOOLBOX_INDEX_OFF "sfx2/res/indexoff_small.png" +#define BMP_HELP_TOOLBOX_START "res/sc06303.png" +#define BMP_HELP_TOOLBOX_PREV "res/sc06301.png" +#define BMP_HELP_TOOLBOX_NEXT "res/sc06300.png" +#define BMP_HELP_TOOLBOX_PRINT "res/sc05504.png" +#define BMP_HELP_TOOLBOX_BOOKMARKS "sfx2/res/favourite.png" +#define BMP_HELP_TOOLBOX_SEARCHDIALOG "sfx2/res/sc05961.png" +#define BMP_HELP_TOOLBOX_COPY "sfx2/res/sc05711.png" +#define BMP_HELP_CONTENT_BOOK_OPEN "sfx2/res/hlpbookopen.png" +#define BMP_HELP_CONTENT_BOOK_CLOSED "sfx2/res/hlpbookclosed.png" +#define BMP_HELP_CONTENT_DOC "sfx2/res/hlpdoc.png" +#define BMP_HELP_TOOLBOX_L_INDEX_ON "sfx2/res/indexon_big.png" +#define BMP_HELP_TOOLBOX_L_INDEX_OFF "sfx2/res/indexoff_big.png" +#define BMP_HELP_TOOLBOX_L_START "res/lc06303.png" +#define BMP_HELP_TOOLBOX_L_PREV "res/lc06301.png" +#define BMP_HELP_TOOLBOX_L_NEXT "res/lc06300.png" +#define BMP_HELP_TOOLBOX_L_PRINT "res/lc05504.png" +#define BMP_HELP_TOOLBOX_L_BOOKMARKS "sfx2/res/favourite_big.png" +#define BMP_HELP_TOOLBOX_L_SEARCHDIALOG "res/lc05961.png" + +//start, sfx2/source/sidebar/Theme.cxx +#define CHEVRON "sfx2/res/chevron.png" +#define CLOSEDOC "sfx2/res/closedoc.png" +#define GRIP "sfx2/res/grip.png" +#define OPEN_MORE "sfx2/res/symphony/open_more.png" +#define MOREBUTTON "sfx2/res/symphony/morebutton.png" +#define SIDEBAR_3D_LARGE "sfx2/res/symphony/sidebar-3d-large.png" +#define SIDEBAR_3D_SMALL "sfx2/res/symphony/sidebar-3d-small.png" +#define SIDEBAR_ANIMATION_LARGE "sfx2/res/symphony/sidebar-animation-large.png" +#define SIDEBAR_ANIMATION_SMALL "sfx2/res/symphony/sidebar-animation-small.png" +#define SIDEBAR_COLORS_LARGE "sfx2/res/symphony/sidebar-colors-large.png" +#define SIDEBAR_COLORS_SMALL "sfx2/res/symphony/sidebar-colors-small.png" +#define SIDEBAR_EYEDROPPER_LARGE "sfx2/res/symphony/sidebar-eyedropper-large.png" +#define SIDEBAR_EYEDROPPER_SMALL "sfx2/res/symphony/sidebar-eyedropper-small.png" +#define SIDEBAR_GALLERY_LARGE "sfx2/res/symphony/sidebar-gallery-large.png" +#define SIDEBAR_GALLERY_SMALL "sfx2/res/symphony/sidebar-gallery-small.png" +#define SIDEBAR_IMGANIM_LARGE "sfx2/res/symphony/sidebar-imganim-large.png" +#define SIDEBAR_IMGANIM_SMALL "sfx2/res/symphony/sidebar-imganim-small.png" +#define SIDEBAR_NAVIGATOR_LARGE "sfx2/res/symphony/sidebar-navigator-large.png" +#define SIDEBAR_NAVIGATOR_SMALL "sfx2/res/symphony/sidebar-navigator-small.png" +#define SIDEBAR_PROPERTY_LARGE "sfx2/res/symphony/sidebar-property-large.png" +#define SIDEBAR_PROPERTY_SMALL "sfx2/res/symphony/sidebar-property-small.png" +#define SIDEBAR_STYLE_LARGE "sfx2/res/symphony/sidebar-style-large.png" +#define SIDEBAR_STYLE_SMALL "sfx2/res/symphony/sidebar-style-small.png" +#define SIDEBAR_TEMPLATE_LARGE "sfx2/res/symphony/sidebar-template-large.png" +#define SIDEBAR_TEMPLATE_SMALL "sfx2/res/symphony/sidebar-template-small.png" +#define SIDEBAR_TRANSITION_LARGE "sfx2/res/symphony/sidebar-transition-large.png" +#define SIDEBAR_TRANSITION_SMALL "sfx2/res/symphony/sidebar-transition-small.png" +#define SIDEBAR_FUNCTIONS_LARGE "sfx2/res/symphony/sidebar-functions-large.png" +#define SIDEBAR_FUNCTIONS_SMALL "sfx2/res/symphony/sidebar-functions-small.png" +//end, sfx2/source/sidebar/Theme.cxx + +#define SFX_THUMBNAIL_TEXT "res/ott_96_8.png" +#define SFX_THUMBNAIL_SHEET "res/ots_96_8.png" +#define SFX_THUMBNAIL_PRESENTATION "res/otp_96_8.png" +#define SFX_THUMBNAIL_DRAWING "res/otg_96_8.png" +#define SFX_FILE_THUMBNAIL_TEXT "res/odt_48_8.png" +#define SFX_FILE_THUMBNAIL_SHEET "res/ods_48_8.png" +#define SFX_FILE_THUMBNAIL_PRESENTATION "res/odp_48_8.png" +#define SFX_FILE_THUMBNAIL_DRAWING "res/odg_48_8.png" +#define SFX_FILE_THUMBNAIL_DATABASE "res/odb_48_8.png" +#define SFX_FILE_THUMBNAIL_MATH "res/odf_48_8.png" +#define SFX_FILE_THUMBNAIL_DEFAULT "res/mainapp_48_8.png" + +#define BMP_RECENTDOC_REMOVE "res/recentdoc_remove.png" +#define BMP_RECENTDOC_REMOVE_HIGHLIGHTED "res/recentdoc_remove_highlighted.png" +#define BMP_DEFAULT "res/templatestar.png" +#define BMP_ACTION_REFRESH "res/reload.png" + +#define BMP_128X128_CALC_DOC "sfx2/res/128x128_calc_doc-p.png" +#define BMP_128X128_DRAW_DOC "sfx2/res/128x128_draw_doc-p.png" +#define BMP_128X128_IMPRESS_DOC "sfx2/res/128x128_impress_doc-p.png" +#define BMP_128X128_MATH_DOC "sfx2/res/128x128_math_doc-p.png" +#define BMP_128X128_WRITER_DOC "sfx2/res/128x128_writer_doc-p.png" + +#define SFX_BMP_CLOSE_DOC "sfx2/res/closedoc.png" + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sfx2/inc/bitset.hxx b/sfx2/inc/bitset.hxx new file mode 100644 index 000000000..3573e9c23 --- /dev/null +++ b/sfx2/inc/bitset.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX2_INC_BITSET_HXX +#define INCLUDED_SFX2_INC_BITSET_HXX + +#include <sal/types.h> + +#include <memory> + +class IndexBitSet +{ +private: + sal_uInt16 nBlocks; + std::unique_ptr<sal_uInt32[]> pBitmap; + + IndexBitSet& operator|=( sal_uInt16 nBit ); + IndexBitSet& operator-=( sal_uInt16 nBit ); + bool Contains( sal_uInt16 nBit ) const; + + IndexBitSet(IndexBitSet const &) = delete; + void operator =(IndexBitSet const &) = delete; + +public: + IndexBitSet(); + ~IndexBitSet(); + + sal_uInt16 GetFreeIndex(); + void ReleaseIndex(sal_uInt16 i){*this-=i;} +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/bluthsndapi.hxx b/sfx2/inc/bluthsndapi.hxx new file mode 100644 index 000000000..c95bccf89 --- /dev/null +++ b/sfx2/inc/bluthsndapi.hxx @@ -0,0 +1,28 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SFX2_INC_BLUTHSNDAPI_HXX +#define INCLUDED_SFX2_INC_BLUTHSNDAPI_HXX + +#include <com/sun/star/frame/XFrame.hpp> +#include <sfx2/mailmodelapi.hxx> + + +// class SfxBluetoothModel_Impl ----------------------------------------------- + +class SfxBluetoothModel:public SfxMailModel +{ +public: + SendMailResult SaveAndSend( const css::uno::Reference< css::frame::XFrame >& xFrame ); + SendMailResult Send(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/charmapcontrol.hxx b/sfx2/inc/charmapcontrol.hxx new file mode 100644 index 000000000..0902f17fa --- /dev/null +++ b/sfx2/inc/charmapcontrol.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <sal/config.h> +#include <sfx2/dllapi.h> +#include <sfx2/charwin.hxx> +#include <svtools/toolbarmenu.hxx> +#include <deque> + +class CharmapPopup; + +namespace com::sun::star::frame { class XFrame; } + +class SfxCharmapCtrl final : public WeldToolbarPopup +{ +public: + explicit SfxCharmapCtrl(CharmapPopup* pControl, weld::Widget* pParent); + virtual ~SfxCharmapCtrl() override; + + virtual void GrabFocus() override; + +private: + rtl::Reference<CharmapPopup> m_xControl; + + ScopedVclPtr<VirtualDevice> m_xVirDev; + + std::deque<OUString> m_aRecentCharList; + std::deque<OUString> m_aRecentCharFontList; + std::deque<OUString> m_aFavCharList; + std::deque<OUString> m_aFavCharFontList; + + SvxCharView m_aRecentCharView[16]; + SvxCharView m_aFavCharView[16]; + std::unique_ptr<weld::Button> m_xDlgBtn; + std::unique_ptr<weld::CustomWeld> m_xRecentCharView[16]; + std::unique_ptr<weld::CustomWeld> m_xFavCharView[16]; + + DECL_LINK(CharClickHdl, SvxCharView*, void); + DECL_LINK(OpenDlgHdl, weld::Button&, void); + + void getFavCharacterList(); + void updateFavCharControl(); + + void getRecentCharacterList(); //gets both recent char and recent char font list + void updateRecentCharControl(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/checkin.hxx b/sfx2/inc/checkin.hxx new file mode 100644 index 000000000..78535f7aa --- /dev/null +++ b/sfx2/inc/checkin.hxx @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <vcl/weld.hxx> + +class SfxCheckinDialog final : public weld::GenericDialogController +{ +private: + std::unique_ptr<weld::TextView> m_xCommentED; + std::unique_ptr<weld::CheckButton> m_xMajorCB; + std::unique_ptr<weld::Button> m_xOKBtn; + + DECL_LINK(OKHdl, weld::Button&, void); + +public: + SfxCheckinDialog(weld::Window* pParent); + virtual ~SfxCheckinDialog() override; + + OUString GetComment() const; + bool IsMajor() const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/dinfdlg.hrc b/sfx2/inc/dinfdlg.hrc new file mode 100644 index 000000000..a99ead5b6 --- /dev/null +++ b/sfx2/inc/dinfdlg.hrc @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SFX2_INC_DINFDLG_HRC +#define INCLUDED_SFX2_INC_DINFDLG_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +const char* SFX_CB_PROPERTY_STRINGARRAY[] = +{ + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Checked by"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Client"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Date completed"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Department"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Destinations"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Disposition"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Division"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Document number"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Editor"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Email"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Forward to"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Group"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Info"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Language"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Mailstop"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Matter"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Office"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Owner"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Project"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Publisher"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Purpose"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Received from"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Recorded by"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Recorded date"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Reference"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Source"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Status"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Telephone number"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "Typist"), + NC_("SFX_CB_PROPERTY_STRINGARRAY", "URL") +}; + +#define CUSTOM_TYPE_UNKNOWN 0 +#define CUSTOM_TYPE_TEXT 1 +#define CUSTOM_TYPE_NUMBER 2 +#define CUSTOM_TYPE_DATE 3 +#define CUSTOM_TYPE_BOOLEAN 4 +#define CUSTOM_TYPE_DURATION 5 +#define CUSTOM_TYPE_DATETIME 6 + +const std::pair<const char*, int> SFX_LB_PROPERTY_STRINGARRAY[] = +{ + { NC_("SFX_CB_PROPERTY_STRINGARRAY", "Text") , CUSTOM_TYPE_TEXT }, + { NC_("SFX_CB_PROPERTY_STRINGARRAY", "DateTime") , CUSTOM_TYPE_DATETIME }, + { NC_("SFX_CB_PROPERTY_STRINGARRAY", "Date") , CUSTOM_TYPE_DATE }, + { NC_("SFX_CB_PROPERTY_STRINGARRAY", "Duration") , CUSTOM_TYPE_DURATION }, + { NC_("SFX_CB_PROPERTY_STRINGARRAY", "Number") , CUSTOM_TYPE_NUMBER }, + { NC_("SFX_CB_PROPERTY_STRINGARRAY", "Yes or no") , CUSTOM_TYPE_BOOLEAN } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/doctempl.hrc b/sfx2/inc/doctempl.hrc new file mode 100644 index 000000000..46773035e --- /dev/null +++ b/sfx2/inc/doctempl.hrc @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SFX2_INC_DOCTEMPL_HRC +#define INCLUDED_SFX2_INC_DOCTEMPL_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) + +const char* TEMPLATE_LONG_NAMES_ARY[] = +{ + NC_("TEMPLATE_LONG_NAMES_ARY", "My Templates"), + NC_("TEMPLATE_LONG_NAMES_ARY", "Styles"), + NC_("TEMPLATE_LONG_NAMES_ARY", "Business Correspondence"), + NC_("TEMPLATE_LONG_NAMES_ARY", "Other Business Documents"), + NC_("TEMPLATE_LONG_NAMES_ARY", "Personal Correspondence and Documents"), + NC_("TEMPLATE_LONG_NAMES_ARY", "Forms and Contracts"), + NC_("TEMPLATE_LONG_NAMES_ARY", "Finances"), + NC_("TEMPLATE_LONG_NAMES_ARY", "Education"), + NC_("TEMPLATE_LONG_NAMES_ARY", "Presentation Backgrounds"), + NC_("TEMPLATE_LONG_NAMES_ARY", "Presentations"), + NC_("TEMPLATE_LONG_NAMES_ARY", "Miscellaneous"), + NC_("TEMPLATE_LONG_NAMES_ARY", "Labels") +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/emojicontrol.hxx b/sfx2/inc/emojicontrol.hxx new file mode 100644 index 000000000..33d0e021b --- /dev/null +++ b/sfx2/inc/emojicontrol.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SFX2_INC_EMOJICONTROL_HXX +#define INCLUDED_SFX2_INC_EMOJICONTROL_HXX + +#include <sal/config.h> +#include <sfx2/dllapi.h> +#include <vcl/tabctrl.hxx> +#include <svtools/toolbarmenu.hxx> + +#define TAB_FONT_SIZE 15 + +namespace com::sun::star::frame { class XFrame; } + +class EmojiPopup; +class EmojiView; +class ThumbnailViewItem; +enum class FILTER_CATEGORY; + +class SfxEmojiControl final : public svtools::ToolbarPopup +{ +public: + explicit SfxEmojiControl(EmojiPopup* pControl, vcl::Window* pParent); + + virtual ~SfxEmojiControl() override; + + virtual void dispose() override; + +private: + void ConvertLabelToUnicode(sal_uInt16 nPageId); + + /// Return filter according to the currently selected tab page. + FILTER_CATEGORY getCurrentFilter() const; + + DECL_LINK(ActivatePageHdl, TabControl*, void); + DECL_STATIC_LINK(SfxEmojiControl, InsertHdl, ThumbnailViewItem*, void); + + VclPtr<TabControl> mpTabControl; + VclPtr<EmojiView> mpEmojiView; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/emojiview.hxx b/sfx2/inc/emojiview.hxx new file mode 100644 index 000000000..4ee37ac6f --- /dev/null +++ b/sfx2/inc/emojiview.hxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <sfx2/thumbnailview.hxx> + +//unicode item defines +#define ITEM_MAX_WIDTH 30 +#define ITEM_MAX_HEIGHT 30 +#define ITEM_PADDING 5 +#define ITEM_MAX_TEXT_LENGTH 10 + +enum class FILTER_CATEGORY +{ + PEOPLE, + NATURE, + FOOD, + ACTIVITY, + TRAVEL, + OBJECTS, + SYMBOLS, + FLAGS, + UNICODE9 +}; + +// Display unicode emojis depending on the category +class ViewFilter_Category final +{ +public: + + ViewFilter_Category (FILTER_CATEGORY rCategory) + : mCategory(rCategory) + {} + + bool operator () (const ThumbnailViewItem *pItem); + + static bool isFilteredCategory(FILTER_CATEGORY filter, const OUString &rCategory); + +private: + + FILTER_CATEGORY mCategory; +}; + + +class EmojiView final : public ThumbnailView +{ +public: + EmojiView ( vcl::Window* pParent); + + virtual ~EmojiView () override; + + // Fill view with emojis + void Populate (); + + void setInsertEmojiHdl (const Link<ThumbnailViewItem*, void> &rLink); + + void AppendItem(const OUString &rTitle, const OUString &rCategory, const OUString &rName ); + +private: + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + + virtual void KeyInput( const KeyEvent& rKEvt ) override; + + virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; + + std::string msJSONData; + + Link<ThumbnailViewItem*, void> maInsertEmojiHdl; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/emojiviewitem.hxx b/sfx2/inc/emojiviewitem.hxx new file mode 100644 index 000000000..bbdcf329f --- /dev/null +++ b/sfx2/inc/emojiviewitem.hxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "thumbnailviewitem.hxx" + +class EmojiViewItem final : public ThumbnailViewItem +{ +public: + EmojiViewItem (ThumbnailViewBase &rView, sal_uInt16 nId); + + virtual ~EmojiViewItem () override; + + void setCategory (const OUString &rCategory) { msCategory = rCategory; } + + const OUString& getCategory () const { return msCategory; } + + virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor, + const ThumbnailItemAttributes *pAttrs) override; + + virtual void calculateItemsPosition (const long nThumbnailHeight, + const long nPadding, sal_uInt32 nMaxTextLength, + const ThumbnailItemAttributes *pAttrs) override; +private: + OUString msCategory; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/fwkhelper.hxx b/sfx2/inc/fwkhelper.hxx new file mode 100644 index 000000000..bd1aa5a8b --- /dev/null +++ b/sfx2/inc/fwkhelper.hxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SFX2_INC_FWKHELPER_HXX +#define INCLUDED_SFX2_INC_FWKHELPER_HXX + +#include <sal/config.h> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/frame/XFrame.hpp> + +void RefreshToolbars( + css::uno::Reference< css::frame::XFrame > const & rFrame +); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/guisaveas.hxx b/sfx2/inc/guisaveas.hxx new file mode 100644 index 000000000..9ccd33436 --- /dev/null +++ b/sfx2/inc/guisaveas.hxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SFX2_INC_GUISAVEAS_HXX +#define INCLUDED_SFX2_INC_GUISAVEAS_HXX + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XContainerQuery.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> + +#include <sfx2/signaturestate.hxx> + + +namespace com::sun::star::document { class XDocumentProperties; } + +namespace weld { class Window; } +class ModelData_Impl; + +class SfxStoringHelper +{ + friend class ModelData_Impl; + +private: + css::uno::Reference< css::container::XNameAccess > m_xFilterCFG; + css::uno::Reference< css::container::XContainerQuery > m_xFilterQuery; + css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager; + + css::uno::Reference< css::container::XNameAccess > const & GetFilterConfiguration(); + css::uno::Reference< css::container::XContainerQuery > const & GetFilterQuery(); + css::uno::Reference< css::frame::XModuleManager2 > const & GetModuleManager(); + +public: + SfxStoringHelper(); + + bool GUIStoreModel( + const css::uno::Reference< css::frame::XModel >& xModel, + const OUString& aSlotName, + css::uno::Sequence< css::beans::PropertyValue >& aArgsSequence, + bool bPreselectPassword, + SignatureState nDocumentSignatureState ); + + static bool CheckFilterOptionsAppearance( + const css::uno::Reference< css::container::XNameAccess >& xFilterCFG, + const OUString& aFilterName ); + + + static void SetDocInfoState( + const css::uno::Reference< css::frame::XModel >& xModel, + const css::uno::Reference< css::document::XDocumentProperties>& i_xOldDocInfo ); + + static bool WarnUnacceptableFormat( + const css::uno::Reference< css::frame::XModel >& xModel, + const OUString& aOldUIName, + const OUString& aDefExtension, + bool rDefaultIsAlien ); + + static css::uno::Reference<css::awt::XWindow> GetModelXWindow(const css::uno::Reference<css::frame::XModel>& rModel); + static weld::Window* GetModelWindow( const css::uno::Reference< css::frame::XModel >& xModel ); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/inettbc.hxx b/sfx2/inc/inettbc.hxx new file mode 100644 index 000000000..9e0bbac85 --- /dev/null +++ b/sfx2/inc/inettbc.hxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SFX2_INC_INETTBC_HXX +#define INCLUDED_SFX2_INC_INETTBC_HXX + +#include <rtl/ustring.hxx> +#include <sfx2/tbxctrl.hxx> + +namespace weld { class ComboBox; }; +class URLBoxItemWindow; +class SvtURLBox; + +class SfxURLToolBoxControl_Impl final : public SfxToolBoxControl +{ +private: + bool m_bModified; + + SvtURLBox* GetURLBox() const; + URLBoxItemWindow* GetURLBoxItemWindow() const; + void OpenURL( const OUString& rName ) const; + + DECL_LINK(OpenHdl, weld::ComboBox&, bool); + DECL_LINK(SelectHdl, weld::ComboBox&, void); + + struct ExecuteInfo + { + css::uno::Reference< css::frame::XDispatch > xDispatch; + css::util::URL aTargetURL; + css::uno::Sequence< css::beans::PropertyValue > aArgs; + }; + + DECL_STATIC_LINK( SfxURLToolBoxControl_Impl, ExecuteHdl_Impl, void*, void ); + +public: + + SFX_DECL_TOOLBOX_CONTROL(); + + SfxURLToolBoxControl_Impl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ); + virtual ~SfxURLToolBoxControl_Impl() override; + + virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override; + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/notebookbar/NotebookbarTabControl.hxx b/sfx2/inc/notebookbar/NotebookbarTabControl.hxx new file mode 100644 index 000000000..c793480f5 --- /dev/null +++ b/sfx2/inc/notebookbar/NotebookbarTabControl.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <sfx2/dllapi.h> +#include <vcl/tabctrl.hxx> + +namespace com::sun::star::ui { class XUIConfigurationListener; } +namespace com::sun::star::uno { class XComponentContext; } + +class NotebookbarTabControl final : public NotebookbarTabControlBase +{ +friend class ChangedUIEventListener; + +public: + NotebookbarTabControl( Window* pParent ); + ~NotebookbarTabControl() override; + + virtual void KeyInput( const KeyEvent& rKEvt ) override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual void StateChanged(StateChangedType nStateChange) override; + virtual Size calculateRequisition() const override; + +private: + static void FillShortcutsToolBox(css::uno::Reference<css::uno::XComponentContext> const & xContext, + const css::uno::Reference<css::frame::XFrame>& xFrame, + const OUString& aModuleName, + ToolBox* pShortcuts + ); + void ArrowStops( sal_uInt16 nCode ); + + DECL_LINK(OpenNotebookbarPopupMenu, NotebookBar*, void); + + css::uno::Reference<css::ui::XUIConfigurationListener> m_pListener; + css::uno::Reference<css::frame::XFrame> m_xFrame; + bool m_bInitialized; + bool m_bInvalidate; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/pch/precompiled_sfx.cxx b/sfx2/inc/pch/precompiled_sfx.cxx new file mode 100644 index 000000000..b741a11c2 --- /dev/null +++ b/sfx2/inc/pch/precompiled_sfx.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "precompiled_sfx.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/pch/precompiled_sfx.hxx b/sfx2/inc/pch/precompiled_sfx.hxx new file mode 100644 index 000000000..d713ff85f --- /dev/null +++ b/sfx2/inc/pch/precompiled_sfx.hxx @@ -0,0 +1,481 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* + This file has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2020-05-21 16:43:16 using: + ./bin/update_pch sfx2 sfx --cutoff=3 --exclude:system --exclude:module --exclude:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./sfx2/inc/pch/precompiled_sfx.hxx "make sfx2.build" --find-conflicts +*/ + +#if PCH_LEVEL >= 1 +#include <algorithm> +#include <assert.h> +#include <cassert> +#include <cstddef> +#include <functional> +#include <initializer_list> +#include <map> +#include <memory> +#include <new> +#include <optional> +#include <ostream> +#include <set> +#include <stddef.h> +#include <stdlib.h> +#include <string.h> +#include <string_view> +#include <type_traits> +#include <unordered_map> +#include <utility> +#include <vector> +#include <boost/logic/tribool.hpp> +#include <boost/property_tree/json_parser.hpp> +#include <boost/property_tree/ptree.hpp> +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#include <osl/conditn.hxx> +#include <osl/diagnose.h> +#include <osl/endian.h> +#include <osl/file.hxx> +#include <osl/interlck.h> +#include <osl/module.h> +#include <osl/module.hxx> +#include <osl/mutex.hxx> +#include <osl/process.h> +#include <osl/security.hxx> +#include <osl/thread.h> +#include <osl/thread.hxx> +#include <osl/time.h> +#include <rtl/alloc.h> +#include <rtl/bootstrap.hxx> +#include <rtl/byteseq.hxx> +#include <rtl/character.hxx> +#include <rtl/instance.hxx> +#include <rtl/malformeduriexception.hxx> +#include <rtl/math.hxx> +#include <rtl/ref.hxx> +#include <rtl/strbuf.hxx> +#include <rtl/string.h> +#include <rtl/string.hxx> +#include <rtl/stringconcat.hxx> +#include <rtl/stringutils.hxx> +#include <rtl/tencinfo.h> +#include <rtl/textcvt.h> +#include <rtl/textenc.h> +#include <rtl/uri.hxx> +#include <rtl/ustrbuf.hxx> +#include <rtl/ustring.h> +#include <rtl/ustring.hxx> +#include <rtl/uuid.h> +#include <sal/config.h> +#include <sal/log.hxx> +#include <sal/macros.h> +#include <sal/saldllapi.h> +#include <sal/types.h> +#include <vcl/EnumContext.hxx> +#include <vcl/InterimItemWindow.hxx> +#include <vcl/Scanline.hxx> +#include <vcl/alpha.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/builder.hxx> +#include <vcl/builderfactory.hxx> +#include <vcl/button.hxx> +#include <vcl/commandevent.hxx> +#include <vcl/commandinfoprovider.hxx> +#include <vcl/ctrl.hxx> +#include <vcl/dibtools.hxx> +#include <vcl/dllapi.h> +#include <vcl/errcode.hxx> +#include <vcl/event.hxx> +#include <vcl/fixed.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/graph.hxx> +#include <vcl/graphicfilter.hxx> +#include <vcl/help.hxx> +#include <vcl/idle.hxx> +#include <vcl/image.hxx> +#include <vcl/imapobj.hxx> +#include <vcl/keycod.hxx> +#include <vcl/keycodes.hxx> +#include <vcl/layout.hxx> +#include <vcl/menu.hxx> +#include <vcl/outdev.hxx> +#include <vcl/ptrstyle.hxx> +#include <vcl/scrbar.hxx> +#include <vcl/settings.hxx> +#include <vcl/svapp.hxx> +#include <vcl/syswin.hxx> +#include <vcl/taskpanelist.hxx> +#include <vcl/timer.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/vclenum.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/virdev.hxx> +#include <vcl/weld.hxx> +#include <vcl/window.hxx> +#include <vcl/wrkwin.hxx> +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basic/basicdllapi.h> +#include <basic/basicmanagerrepository.hxx> +#include <basic/basmgr.hxx> +#include <basic/sbdef.hxx> +#include <basic/sberrors.hxx> +#include <basic/sbstar.hxx> +#include <basic/sbxdef.hxx> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/XWindowPeer.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/beans/PropertyExistException.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/StringPair.hpp> +#include <com/sun/star/beans/XPropertyContainer.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/container/XContainerQuery.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#include <com/sun/star/document/DocumentProperties.hpp> +#include <com/sun/star/document/MacroExecMode.hpp> +#include <com/sun/star/document/UpdateDocMode.hpp> +#include <com/sun/star/document/XCmisDocument.hpp> +#include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XEmbeddedScripts.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XScriptInvocationContext.hpp> +#include <com/sun/star/document/XTypeDetection.hpp> +#include <com/sun/star/document/XViewDataSupplier.hpp> +#include <com/sun/star/embed/Aspects.hpp> +#include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/embed/EmbedStates.hpp> +#include <com/sun/star/embed/XEmbeddedObject.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/embed/XTransactedObject.hpp> +#include <com/sun/star/frame/Desktop.hpp> +#include <com/sun/star/frame/DispatchResultState.hpp> +#include <com/sun/star/frame/Frame.hpp> +#include <com/sun/star/frame/FrameSearchFlag.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> +#include <com/sun/star/frame/UnknownModuleException.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/frame/XLoadable.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/frame/XSynchronousFrameLoader.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/frame/XTitle.hpp> +#include <com/sun/star/frame/XToolbarController.hpp> +#include <com/sun/star/frame/status/ItemStatus.hpp> +#include <com/sun/star/frame/status/Visibility.hpp> +#include <com/sun/star/frame/theGlobalEventBroadcaster.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/io/IOException.hpp> +#include <com/sun/star/io/WrongFormatException.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/lang/NoSupportException.hpp> +#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/security/DocumentDigitalSignatures.hpp> +#include <com/sun/star/security/DocumentSignatureInformation.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/system/SystemShellExecute.hpp> +#include <com/sun/star/system/SystemShellExecuteFlags.hpp> +#include <com/sun/star/task/ErrorCodeIOException.hpp> +#include <com/sun/star/task/ErrorCodeRequest.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/XInteractionRequest.hpp> +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/ucb/CommandAbortedException.hpp> +#include <com/sun/star/ucb/ContentCreationException.hpp> +#include <com/sun/star/ucb/NameClash.hpp> +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#include <com/sun/star/ucb/XContent.hpp> +#include <com/sun/star/ucb/XContentAccess.hpp> +#include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> +#include <com/sun/star/ui/XSidebarPanel.hpp> +#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> +#include <com/sun/star/ui/dialogs/ControlActions.hpp> +#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/ui/dialogs/XFilePicker3.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Exception.hpp> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Type.h> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> +#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> +#include <com/sun/star/util/CloseVetoException.hpp> +#include <com/sun/star/util/RevisionTag.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/util/URLTransformer.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/util/XModifiable.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/xml/sax/Parser.hpp> +#include <comphelper/comphelperdllapi.h> +#include <comphelper/dispatchcommand.hxx> +#include <comphelper/docpasswordhelper.hxx> +#include <comphelper/documentconstants.hxx> +#include <comphelper/fileformat.h> +#include <comphelper/fileurl.hxx> +#include <comphelper/interaction.hxx> +#include <comphelper/interfacecontainer2.hxx> +#include <comphelper/lok.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/propertysequence.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/sequenceashashmap.hxx> +#include <comphelper/servicehelper.hxx> +#include <comphelper/storagehelper.hxx> +#include <comphelper/string.hxx> +#include <comphelper/types.hxx> +#include <cppu/unotype.hxx> +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/compbase_ex.hxx> +#include <cppuhelper/cppuhelperdllapi.h> +#include <cppuhelper/exc_hlp.hxx> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/interfacecontainer.h> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> +#include <drawinglayer/attribute/fillgraphicattribute.hxx> +#include <drawinglayer/drawinglayerdllapi.h> +#include <drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx> +#include <drawinglayer/primitive2d/PolyPolygonSelectionPrimitive2D.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/textlayoutdevice.hxx> +#include <drawinglayer/processor2d/baseprocessor2d.hxx> +#include <framework/fwedllapi.h> +#include <framework/interaction.hxx> +#include <i18nlangtag/lang.h> +#include <i18nlangtag/languagetag.hxx> +#include <o3tl/cow_wrapper.hxx> +#include <o3tl/safeint.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <officecfg/Office/Common.hxx> +#include <officecfg/Setup.hxx> +#include <salhelper/simplereferenceobject.hxx> +#include <sot/exchange.hxx> +#include <sot/formats.hxx> +#include <sot/storage.hxx> +#include <svl/SfxBroadcaster.hxx> +#include <svl/eitem.hxx> +#include <svl/hint.hxx> +#include <svl/intitem.hxx> +#include <svl/itemiter.hxx> +#include <svl/itempool.hxx> +#include <svl/itemset.hxx> +#include <svl/lockfilecommon.hxx> +#include <svl/macitem.hxx> +#include <svl/poolitem.hxx> +#include <svl/slstitm.hxx> +#include <svl/stritem.hxx> +#include <svl/style.hxx> +#include <svl/svdde.hxx> +#include <svl/svldllapi.h> +#include <svl/undo.hxx> +#include <svl/urihelper.hxx> +#include <svl/visitem.hxx> +#include <svl/whiter.hxx> +#include <svtools/ehdl.hxx> +#include <svtools/helpopt.hxx> +#include <svtools/imagemgr.hxx> +#include <svtools/langhelp.hxx> +#include <svtools/miscopt.hxx> +#include <svtools/sfxecode.hxx> +#include <svtools/soerr.hxx> +#include <svtools/svtdllapi.h> +#include <toolkit/helper/convert.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <tools/color.hxx> +#include <tools/datetime.hxx> +#include <tools/debug.hxx> +#include <tools/diagnose_ex.h> +#include <tools/fract.hxx> +#include <tools/gen.hxx> +#include <tools/globname.hxx> +#include <tools/link.hxx> +#include <tools/poly.hxx> +#include <tools/ref.hxx> +#include <tools/solar.h> +#include <tools/stream.hxx> +#include <tools/svborder.hxx> +#include <tools/svlibrary.h> +#include <tools/toolsdllapi.h> +#include <tools/urlobj.hxx> +#include <typelib/typedescription.h> +#include <ucbhelper/content.hxx> +#include <uno/sequence2.h> +#include <unotools/configmgr.hxx> +#include <unotools/confignode.hxx> +#include <unotools/eventcfg.hxx> +#include <unotools/historyoptions.hxx> +#include <unotools/localedatawrapper.hxx> +#include <unotools/mediadescriptor.hxx> +#include <unotools/moduleoptions.hxx> +#include <unotools/options.hxx> +#include <unotools/pathoptions.hxx> +#include <unotools/resmgr.hxx> +#include <unotools/saveopt.hxx> +#include <unotools/securityoptions.hxx> +#include <unotools/streamwrap.hxx> +#include <unotools/tempfile.hxx> +#include <unotools/ucbhelper.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <unotools/unotoolsdllapi.h> +#include <unotools/useroptions.hxx> +#include <unotools/viewoptions.hxx> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#include <appbaslib.hxx> +#include <appdata.hxx> +#include <appopen.hxx> +#include <asyncfunc.hxx> +#include <childwinimpl.hxx> +#include <ctrlfactoryimpl.hxx> +#include <eventsupplier.hxx> +#include <helper.hxx> +#include <helpids.h> +#include <itemdel.hxx> +#include <nochaos.hxx> +#include <objshimp.hxx> +#include <openflag.hxx> +#include <openuriexternally.hxx> +#include <openurlhint.hxx> +#include <sfx2/app.hxx> +#include <sfx2/basedlgs.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/childwin.hxx> +#include <sfx2/classificationhelper.hxx> +#include <sfx2/ctrlitem.hxx> +#include <sfx2/dinfdlg.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/dllapi.h> +#include <sfx2/docfac.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/docfilt.hxx> +#include <sfx2/dockwin.hxx> +#include <sfx2/doctempl.hxx> +#include <sfx2/event.hxx> +#include <sfx2/fcontnr.hxx> +#include <sfx2/filedlghelper.hxx> +#include <sfx2/flatpak.hxx> +#include <sfx2/frame.hxx> +#include <sfx2/frmdescr.hxx> +#include <sfx2/infobar.hxx> +#include <sfx2/inputdlg.hxx> +#include <sfx2/ipclient.hxx> +#include <sfx2/linkmgr.hxx> +#include <sfx2/lnkbase.hxx> +#include <sfx2/lokhelper.hxx> +#include <sfx2/module.hxx> +#include <sfx2/msg.hxx> +#include <sfx2/msgpool.hxx> +#include <sfx2/notebookbar/SfxNotebookBar.hxx> +#include <sfx2/objface.hxx> +#include <sfx2/objitem.hxx> +#include <sfx2/objsh.hxx> +#include <sfx2/passwd.hxx> +#include <sfx2/printer.hxx> +#include <sfx2/progress.hxx> +#include <sfx2/request.hxx> +#include <sfx2/sfxbasecontroller.hxx> +#include <sfx2/sfxbasemodel.hxx> +#include <sfx2/sfxdlg.hxx> +#include <sfx2/sfxhelp.hxx> +#include <sfx2/sfxresid.hxx> +#include <sfx2/sfxuno.hxx> +#include <sfx2/sidebar/Context.hxx> +#include <sfx2/sidebar/Deck.hxx> +#include <sfx2/sidebar/Panel.hxx> +#include <sfx2/sidebar/PanelLayout.hxx> +#include <sfx2/sidebar/ResourceManager.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> +#include <sfx2/sidebar/SidebarController.hxx> +#include <sfx2/sidebar/SidebarDockingWindow.hxx> +#include <sfx2/sidebar/TabBar.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/signaturestate.hxx> +#include <sfx2/stbitem.hxx> +#include <sfx2/styfitem.hxx> +#include <sfx2/tabdlg.hxx> +#include <sfx2/tbxctrl.hxx> +#include <sfx2/templatedlg.hxx> +#include <sfx2/templatelocalview.hxx> +#include <sfx2/thumbnailview.hxx> +#include <sfx2/tplpitem.hxx> +#include <sfx2/viewfac.hxx> +#include <sfx2/viewfrm.hxx> +#include <sfx2/viewsh.hxx> +#include <sfxpicklist.hxx> +#include <sfxtypes.hxx> +#include <shellimpl.hxx> +#include <splitwin.hxx> +#include <statcach.hxx> +#include <workwin.hxx> +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/preventduplicateinteraction.hxx b/sfx2/inc/preventduplicateinteraction.hxx new file mode 100644 index 000000000..edd503d01 --- /dev/null +++ b/sfx2/inc/preventduplicateinteraction.hxx @@ -0,0 +1,338 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_FRAMEWORK_PREVENTDUPLICATEINTERACTION_HXX +#define INCLUDED_FRAMEWORK_PREVENTDUPLICATEINTERACTION_HXX + +#include <vector> + +#include <com/sun/star/frame/Desktop.hpp> +#include <com/sun/star/frame/TerminationVetoException.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/task/XInteractionHandler2.hpp> +#include <com/sun/star/task/XInteractionRequest.hpp> + +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/implbase.hxx> + +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/wrkwin.hxx> +#include <vcl/svapp.hxx> + +namespace com::sun::star::uno { + class XComponentContext; +} + +namespace sfx2 { + +inline void closedialogs(SystemWindow& rTopLevel, bool bCloseRoot) +{ + for (vcl::Window *pChild = rTopLevel.GetWindow(GetWindowType::FirstTopWindowChild); pChild; pChild = rTopLevel.GetWindow(GetWindowType::NextTopWindowSibling)) + closedialogs(dynamic_cast<SystemWindow&>(*pChild), true); + if (bCloseRoot) + rTopLevel.Close(); +} + +// This is intended to be the parent for any warning dialogs launched +// during the load of a document so that those dialogs are modal to +// this window and don't block any existing windows. +// +// If there are dialog children open on exit then veto termination, +// close the topmost dialog and retry termination. +class WarningDialogsParent final : + public cppu::WeakComponentImplHelper<css::frame::XTerminateListener> +{ +private: + osl::Mutex m_aLock; + VclPtr<WorkWindow> m_xWin; + css::uno::Reference<css::awt::XWindow> m_xInterface; + +private: + + DECL_STATIC_LINK(WarningDialogsParent, TerminateDesktop, void*, void); + + void closewarningdialogs() + { + if (!m_xWin) + return; + SolarMutexGuard aSolarGuard; + closedialogs(dynamic_cast<SystemWindow&>(*m_xWin), false); + } + +public: + + using cppu::WeakComponentImplHelperBase::disposing; + virtual void SAL_CALL disposing(const css::lang::EventObject&) override + { + } + + // XTerminateListener + virtual void SAL_CALL queryTermination(const css::lang::EventObject&) override + { + closewarningdialogs(); + Application::PostUserEvent(LINK(this, WarningDialogsParent, TerminateDesktop)); + throw css::frame::TerminationVetoException(); + } + + virtual void SAL_CALL notifyTermination(const css::lang::EventObject&) override + { + } + +public: + WarningDialogsParent() + : cppu::WeakComponentImplHelper<css::frame::XTerminateListener>(m_aLock) + { + SolarMutexGuard aSolarGuard; + m_xWin = VclPtr<WorkWindow>::Create(nullptr, WB_STDWORK); + m_xWin->SetText("dialog parent for warning dialogs during load"); + m_xInterface = VCLUnoHelper::GetInterface(m_xWin); + } + + virtual ~WarningDialogsParent() override + { + closewarningdialogs(); + m_xWin.disposeAndClear(); + } + + const css::uno::Reference<css::awt::XWindow>& GetDialogParent() const + { + return m_xInterface; + } +}; + +class WarningDialogsParentScope +{ +private: + css::uno::Reference<css::frame::XDesktop> m_xDesktop; + rtl::Reference<WarningDialogsParent> m_xListener; + +public: + WarningDialogsParentScope(const css::uno::Reference<css::uno::XComponentContext>& rContext) + : m_xDesktop(css::frame::Desktop::create(rContext), css::uno::UNO_QUERY_THROW) + , m_xListener(new WarningDialogsParent) + { + m_xDesktop->addTerminateListener(m_xListener.get()); + } + + const css::uno::Reference<css::awt::XWindow>& GetDialogParent() const + { + return m_xListener->GetDialogParent(); + } + + ~WarningDialogsParentScope() + { + m_xDesktop->removeTerminateListener(m_xListener.get()); + } +}; + +/** + @short Prevent us from showing the same interaction more than once during + the same transaction. + + @descr Every interaction provided to this helper will be safed ... handled by the internal + used UUIInteractionHandler (!) and never be handled a second time! + + On the other side there exists some interactions, which allow a retry. + So this helper allow to set a list of interactions combined with a retry value. + */ +struct ThreadHelpBase2 +{ + public: + mutable ::osl::Mutex m_aLock; +}; + +class PreventDuplicateInteraction final : private ThreadHelpBase2 + , public ::cppu::WeakImplHelper<css::lang::XInitialization, css::task::XInteractionHandler2> +{ + + // structs, types etc. + public: + + struct InteractionInfo + { + public: + /// describe the interaction. + css::uno::Type m_aInteraction; + /// after max count was reached this interaction will be blocked. + sal_Int32 m_nMaxCount; + /// count how often this interaction was called. + sal_Int32 m_nCallCount; + /** hold the last intercepted request (matching the set interaction type) alive + so it can be used for further checks */ + css::uno::Reference< css::task::XInteractionRequest > m_xRequest; + + public: + + InteractionInfo(const css::uno::Type& aInteraction) + : m_aInteraction(aInteraction) + , m_nMaxCount (1 ) + , m_nCallCount (0 ) + {} + }; + + typedef ::std::vector< InteractionInfo > InteractionList; + + + // member + private: + + /// Used to create needed uno services at runtime. + css::uno::Reference< css::uno::XComponentContext > m_xContext; + + /** The outside interaction handler, which is used to handle every incoming interaction, + if it's not blocked. */ + css::uno::Reference< css::task::XInteractionHandler > m_xHandler; + + std::unique_ptr<WarningDialogsParentScope> m_xWarningDialogsParent; + + /** This list describe which and how incoming interactions must be handled. + Further it contains all collected information after this interaction + object was used.*/ + InteractionList m_lInteractionRules; + + + // uno interface + public: + + virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override; + + /** + @interface XInteractionHandler + @short called from outside to handle a problem + @descr We filter the incoming interactions. some of them + will be forwarded to the generic UI interaction handler. + So we must not implement it twice. Some other ones + will be aborted only. + + @threadsafe yes + */ + virtual void SAL_CALL handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest) override; + + + /** + @interface XInteractionHandler2 + @short called from outside to handle a problem + @descr We filter the incoming interactions. some of them + will be forwarded to the generic UI interaction handler. + So we must not implement it twice. Some other ones + will be aborted only. + + @threadsafe yes + */ + virtual sal_Bool SAL_CALL handleInteractionRequest( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) override; + + + /** + @interface XInterface + @short called to query another interface of the component + @descr Will allow to query for XInteractionHandler2 if and only if m_xHandler supports this interface, too. + + @threadsafe yes + */ + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + + // c++ interface + public: + + + /** + @short ctor to guarantee right initialized instances of this class + @descr It uses the given uno service manager to create the global + generic UI interaction handler for later internal using. + + @param xSMGR + uno service manager for creating services internally + + @threadsafe not necessary + */ + PreventDuplicateInteraction(const css::uno::Reference< css::uno::XComponentContext >& rxContext); + + + /** + @short dtor to free used memory. + */ + virtual ~PreventDuplicateInteraction() override; + + + /** + @short set the outside interaction handler, which must be used internally + if the interaction will not be blocked by the set list of rules. + + @note This overwrites the settings of e.g. useDefaultUUIHandler()! + + @param xHandler + the new interaction handler + */ + void setHandler(const css::uno::Reference< css::task::XInteractionHandler >& xHandler); + + + /** + @short instead of setting an outside interaction handler, this method + make sure the default UUI interaction handler of the office is used. + + @note This overwrites the settings of e.g. setHandler()! + */ + void useDefaultUUIHandler(); + + + /** + @short add a new interaction to the list of interactions, which + must be handled by this helper. + + @descr This method must be called immediately after a new instance of this helper was + created. Without such list of InteractionRules, this instances does nothing! + On the other side there is no possibility to remove rules. + So the same instance can't be used within different transactions. + It's a OneWay-object .-) + + @param aInteractionInfo + describe the type of interaction, hos often it can be called etcpp. + + @threadsafe yes + */ + void addInteractionRule(const PreventDuplicateInteraction::InteractionInfo& aInteractionInfo); + + + /** + @short return the info struct for the specified interaction. + + @param aInteraction + specify the interaction. + + @param pReturn + provides information about: + - the count how often this interaction was handled during the + lifetime of this helper. + - the interaction itself, so it can be analyzed further + + @return [boolean] + true if the queried interaction could be found. + false otherwise. + + @threadsafe yes + */ + bool getInteractionInfo(const css::uno::Type& aInteraction, + PreventDuplicateInteraction::InteractionInfo* pReturn ) const; +}; + +} // namespace sfx2 + +#endif // INCLUDED_FRAMEWORK_PREVENTDUPLICATEINTERACTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/recentdocsview.hxx b/sfx2/inc/recentdocsview.hxx new file mode 100644 index 000000000..95b9386cd --- /dev/null +++ b/sfx2/inc/recentdocsview.hxx @@ -0,0 +1,99 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <sfx2/thumbnailview.hxx> +#include <vcl/image.hxx> + +#include <o3tl/typed_flags_set.hxx> + +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> + +namespace com::sun::star::frame { class XDispatch; } + +namespace sfx2 +{ + +struct LoadRecentFile +{ + css::util::URL aTargetURL; + css::uno::Sequence< css::beans::PropertyValue > aArgSeq; + css::uno::Reference< css::frame::XDispatch > xDispatch; + VclPtr< ThumbnailView > pView; +}; + +enum class ApplicationType +{ + TYPE_NONE = 0, + TYPE_WRITER = 1 << 0, + TYPE_CALC = 1 << 1, + TYPE_IMPRESS = 1 << 2, + TYPE_DRAW = 1 << 3, + TYPE_DATABASE = 1 << 4, + TYPE_MATH = 1 << 5, + TYPE_OTHER = 1 << 6 +}; + +} // namespace sfx2 + +namespace o3tl { + +template<> struct typed_flags<sfx2::ApplicationType> : is_typed_flags<sfx2::ApplicationType, 0x7f> {}; + +} // namespace o3tl + +namespace sfx2 +{ + +class RecentDocsView final : public ThumbnailView +{ +public: + RecentDocsView( vcl::Window* pParent ); + + void insertItem(const OUString &rURL, const OUString &rTitle, const BitmapEx &rThumbnail, sal_uInt16 nId); + + static bool typeMatchesExtension(ApplicationType type, const OUString &rExt); + static BitmapEx getDefaultThumbnail(const OUString &rURL); + + ApplicationType mnFileTypes; + + virtual void Clear() override; + + /// Update the information in the view. + virtual void Reload() override; + + DECL_STATIC_LINK( RecentDocsView, ExecuteHdl_Impl, void*, void ); + +private: + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + + virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; + + virtual void OnItemDblClicked(ThumbnailViewItem *pItem) override; + + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + + virtual void LoseFocus() override; + + bool isAcceptedFile(const OUString &rURL) const; + + long mnItemMaxSize; + size_t mnLastMouseDownItem; + + /// Image that appears when there is no recent document. + BitmapEx maWelcomeImage; + OUString maWelcomeLine1; + OUString maWelcomeLine2; +}; + +} // namespace sfx2 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/saveastemplatedlg.hxx b/sfx2/inc/saveastemplatedlg.hxx new file mode 100644 index 000000000..a4df61853 --- /dev/null +++ b/sfx2/inc/saveastemplatedlg.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SFX2_INC_SAVEASTEMPLATEDLG_HXX +#define INCLUDED_SFX2_INC_SAVEASTEMPLATEDLG_HXX + +#include <sal/config.h> +#include <sfx2/doctempl.hxx> +#include <vcl/weld.hxx> + +#include <com/sun/star/frame/XModel.hpp> + +// class SfxSaveAsTemplateDialog ------------------------------------------------------------------- +class SfxSaveAsTemplateDialog final : public weld::GenericDialogController +{ +private: + std::unique_ptr<weld::TreeView> m_xLBCategory; + std::unique_ptr<weld::CheckButton> m_xCBXDefault; + std::unique_ptr<weld::Entry> m_xTemplateNameEdit; + std::unique_ptr<weld::Button> m_xOKButton; + + OUString msSelectedCategory; + OUString msTemplateName; + sal_uInt16 mnRegionPos; + + std::vector<OUString> msCategories; + + SfxDocumentTemplates maDocTemplates; + + css::uno::Reference<css::frame::XModel> m_xModel; + +public: + DECL_LINK(OkClickHdl, weld::Button&, void); + DECL_LINK(TemplateNameEditHdl, weld::Entry&, void); + DECL_LINK(SelectCategoryHdl, weld::TreeView&, void); + + void initialize(); + void SetCategoryLBEntries(const std::vector<OUString>& names); + + /*Check whether template name is unique or not in a region*/ + bool IsTemplateNameUnique(); + + bool SaveTemplate(); + +public: + SfxSaveAsTemplateDialog(weld::Window* pParent, + const css::uno::Reference<css::frame::XModel>& rModel); +}; + +#endif // INCLUDED_SFX2_INC_SAVEASTEMPLATEDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sfxbasecontroller_internal.hxx b/sfx2/inc/sfxbasecontroller_internal.hxx new file mode 100644 index 000000000..0de26d5e9 --- /dev/null +++ b/sfx2/inc/sfxbasecontroller_internal.hxx @@ -0,0 +1,19 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SFX2_INC_SFXBASECONTROLLER_INTERNAL_HXX +#define INCLUDED_SFX2_INC_SFXBASECONTROLLER_INTERNAL_HXX + +#include <sal/types.h> + +extern sal_uInt32 Get10ThSec(); + +#endif // INCLUDED_SFX2_INC_SFXBASECONTROLLER_INTERNAL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/Accessible.hxx b/sfx2/inc/sidebar/Accessible.hxx new file mode 100644 index 000000000..3f3d351ed --- /dev/null +++ b/sfx2/inc/sidebar/Accessible.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <com/sun/star/accessibility/XAccessible.hpp> + +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> + +namespace com::sun::star::accessibility { class XAccessibleContext; } + +typedef cppu::WeakComponentImplHelper < + css::accessibility::XAccessible + > AccessibleInterfaceBase; + +namespace sfx2::sidebar { + + +/** Simple implementation of the XAccessible interface. + Its getAccessibleContext() method returns a context object given + to its constructor. +*/ +class Accessible final + : private ::cppu::BaseMutex, + public AccessibleInterfaceBase +{ +public: + explicit Accessible ( + const css::uno::Reference<css::accessibility::XAccessibleContext>& rxContext); + virtual ~Accessible() override; + Accessible(const Accessible&) = delete; + Accessible& operator=( const Accessible& ) = delete; + + virtual void SAL_CALL disposing() override; + // XAccessible + virtual css::uno::Reference<css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext() override; + +private: + css::uno::Reference<css::accessibility::XAccessibleContext> mxContext; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/AccessibleTitleBar.hxx b/sfx2/inc/sidebar/AccessibleTitleBar.hxx new file mode 100644 index 000000000..f2105dabb --- /dev/null +++ b/sfx2/inc/sidebar/AccessibleTitleBar.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + +namespace com::sun::star::accessibility { class XAccessible; } + +namespace sfx2::sidebar { + +class TitleBar; + +class AccessibleTitleBar final + : public VCLXAccessibleComponent +{ +public: + static css::uno::Reference<css::accessibility::XAccessible> Create (TitleBar& rTitleBar); + +private: + virtual void FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet) override; + + explicit AccessibleTitleBar (VCLXWindow* pWindow); + virtual ~AccessibleTitleBar() override; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/ContextChangeBroadcaster.hxx b/sfx2/inc/sidebar/ContextChangeBroadcaster.hxx new file mode 100644 index 000000000..49770da76 --- /dev/null +++ b/sfx2/inc/sidebar/ContextChangeBroadcaster.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX2_INC_SIDEBAR_CONTEXTCHANGEBROADCASTER_HXX +#define INCLUDED_SFX2_INC_SIDEBAR_CONTEXTCHANGEBROADCASTER_HXX + +#include <com/sun/star/frame/XFrame.hpp> + + +namespace sfx2::sidebar { + + +/** This class is a helper for broadcasting context changes that are + tied to shells being activated or deactivated. +*/ +class ContextChangeBroadcaster +{ +public: + ContextChangeBroadcaster(); + ~ContextChangeBroadcaster(); + + void Initialize (const OUString& rsContextName); + + void Activate (const css::uno::Reference<css::frame::XFrame>& rxFrame); + void Deactivate (const css::uno::Reference<css::frame::XFrame>& rxFrame); + + /** Enable or disable the broadcaster. + @param bIsEnabled + The new value of the "enabled" state. + @return + The old value of the "enabled" state is returned. + */ + bool SetBroadcasterEnabled (const bool bIsEnabled); + +private: + OUString msContextName; + bool mbIsBroadcasterEnabled; + + void BroadcastContextChange ( + const css::uno::Reference<css::frame::XFrame>& rxFrame, + const OUString& rsModuleName, + const OUString& rsContextName); + static OUString GetModuleName ( + const css::uno::Reference<css::frame::XFrame>& rxFrame); +}; + + +} // end of namespace ::sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/ContextList.hxx b/sfx2/inc/sidebar/ContextList.hxx new file mode 100644 index 000000000..b3ecafa53 --- /dev/null +++ b/sfx2/inc/sidebar/ContextList.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <sfx2/sidebar/Context.hxx> +#include <rtl/ustring.hxx> + +#include <vector> + +namespace sfx2::sidebar { + +/** Per context data for deck and panel descriptors. +*/ +class ContextList +{ +public: + ContextList(); + + class Entry + { + public: + Context maContext; + bool mbIsInitiallyVisible; + OUString msMenuCommand; + }; + + /** Return <TRUE/> when the given context matches any of the stored contexts. + */ + const Entry* GetMatch ( + const Context& rContext) const; + Entry* GetMatch ( + const Context& rContext); + + void AddContextDescription ( + const Context& rContext, + const bool bIsInitiallyVisible, + const OUString& rsMenuCommand); + + void ToggleVisibilityForContext( const Context& rContext,const bool bIsInitiallyVisible ); + const ::std::vector<Entry>& GetEntries() const {return maEntries;}; + +private: + ::std::vector<Entry> maEntries; + + ::std::vector<Entry>::const_iterator FindBestMatch (const Context& rContext) const; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/ControlFactory.hxx b/sfx2/inc/sidebar/ControlFactory.hxx new file mode 100644 index 000000000..15ae45ef4 --- /dev/null +++ b/sfx2/inc/sidebar/ControlFactory.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX2_SIDEBAR_CONTROLFACTORY_HXX +#define INCLUDED_SFX2_SIDEBAR_CONTROLFACTORY_HXX + +#include <sfx2/dllapi.h> +#include <vcl/vclptr.hxx> + +class CheckBox; +class RadioButton; +namespace vcl { class Window; } + +namespace sfx2::sidebar { + +/** Factory for controls used in sidebar panels. + The reason to use this factory instead of creating the controls + directly is that this way the sidebar has a little more control + over look and feel of its controls. +*/ +class ControlFactory +{ +public: + /** Create the menu button for the task bar. + */ + static VclPtr<CheckBox> CreateMenuButton (vcl::Window* pParentWindow); + + static VclPtr<RadioButton> CreateTabItem (vcl::Window* pParentWindow); +}; + + +} // end of namespace sfx2::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/ControllerFactory.hxx b/sfx2/inc/sidebar/ControllerFactory.hxx new file mode 100644 index 000000000..dbf609775 --- /dev/null +++ b/sfx2/inc/sidebar/ControllerFactory.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <sfx2/dllapi.h> +#include <com/sun/star/uno/Reference.hxx> + +namespace com::sun::star::awt { class XWindow; } +namespace com::sun::star::frame { class XController; } +namespace com::sun::star::frame { class XFrame; } +namespace com::sun::star::frame { class XToolbarController; } + +class ToolBox; + +namespace weld { + class Builder; + class Toolbar; +} + +namespace sfx2::sidebar { + +/** Convenience class for the easy creation of toolbox controllers. +*/ +class ControllerFactory +{ +public: + static css::uno::Reference<css::frame::XToolbarController> CreateToolBoxController( + ToolBox* pToolBox, + const sal_uInt16 nItemId, + const OUString& rsCommandName, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + const css::uno::Reference<css::frame::XController>& rxController, + const css::uno::Reference<css::awt::XWindow>& rxParentWindow, + const sal_Int32 nItemWidth, bool bSideBar); + + static css::uno::Reference<css::frame::XToolbarController> CreateToolBoxController( + weld::Toolbar& rToolbar, + weld::Builder& rBuilder, + const OUString& rsCommandName, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + bool bSideBar); + +private: + static css::uno::Reference<css::frame::XToolbarController> CreateToolBarController( + const css::uno::Reference<css::awt::XWindow>& rToolbar, + const OUString& rsCommandName, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + const css::uno::Reference<css::frame::XController>& rxController, + const sal_Int32 nWidth, bool bSideBar); +}; + + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/DeckDescriptor.hxx b/sfx2/inc/sidebar/DeckDescriptor.hxx new file mode 100644 index 000000000..f1195cd0b --- /dev/null +++ b/sfx2/inc/sidebar/DeckDescriptor.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <sidebar/ContextList.hxx> + +#include <sfx2/sidebar/Deck.hxx> + +namespace sfx2::sidebar { + +class DeckDescriptor +{ +public: + OUString msTitle; + OUString msId; + OUString msIconURL; + OUString msHighContrastIconURL; + OUString msTitleBarIconURL; + OUString msHighContrastTitleBarIconURL; + OUString msHelpText; + ContextList maContextList; + bool mbIsEnabled; + sal_Int32 mnOrderIndex; + bool mbExperimental; + + OUString msNodeName; // some impress deck nodes names are different from their Id + + VclPtr<Deck> mpDeck; + + DeckDescriptor(); + DeckDescriptor (const DeckDescriptor& rOther); + ~DeckDescriptor(); +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/DeckLayouter.hxx b/sfx2/inc/sidebar/DeckLayouter.hxx new file mode 100644 index 000000000..b84496cd6 --- /dev/null +++ b/sfx2/inc/sidebar/DeckLayouter.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <sfx2/sidebar/Panel.hxx> + +class ScrollBar; +namespace vcl { class Window; } +namespace tools { class Rectangle; } + +namespace sfx2::sidebar { + +/** Helper for layouting the direct and indirect children of a + deck like title bars, panels, and scroll bars. +*/ +namespace DeckLayouter +{ + void LayoutDeck ( + const tools::Rectangle& rContentArea, + sal_Int32& rMinimalWidth, + sal_Int32& rMinimalHeight, + SharedPanelContainer& rPanels, + vcl::Window& pDeckTitleBar, + vcl::Window& pScrollClipWindow, + vcl::Window& pScrollContainer, + vcl::Window& pFiller, + ScrollBar& pVerticalScrollBar); +} + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/DeckTitleBar.hxx b/sfx2/inc/sidebar/DeckTitleBar.hxx new file mode 100644 index 000000000..86a71c76a --- /dev/null +++ b/sfx2/inc/sidebar/DeckTitleBar.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <sidebar/TitleBar.hxx> + +namespace sfx2::sidebar { + +class DeckTitleBar final : public TitleBar +{ +public: + DeckTitleBar(const OUString& rsTitle, + vcl::Window* pParentWindow, + const std::function<void()>& rCloserAction); + + void SetCloserVisible(const bool bIsCloserVisible); + static tools::Rectangle GetDragArea(); + + virtual void DataChanged(const DataChangedEvent& rEvent) override; + virtual void MouseMove(const MouseEvent& rMouseEvent) override; + +private: + virtual tools::Rectangle GetTitleArea(const tools::Rectangle& rTitleBarBox) override; + virtual void PaintDecoration(vcl::RenderContext& rRenderContext) override; + virtual sidebar::Paint GetBackgroundPaint() override; + virtual void HandleToolBoxItemClick(const sal_uInt16 nItemIndex) override; + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + + static const sal_uInt16 mnCloserItemIndex = 1; + const std::function<void()> maCloserAction; + bool mbIsCloserVisible; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/DrawHelper.hxx b/sfx2/inc/sidebar/DrawHelper.hxx new file mode 100644 index 000000000..a657ac041 --- /dev/null +++ b/sfx2/inc/sidebar/DrawHelper.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <vcl/outdev.hxx> + +class Color; +class SvBorder; + +namespace sfx2::sidebar { + +class Paint; + +/** Some convenience functions for painting backgrounds and borders. +*/ +class DrawHelper +{ +public: + static void DrawBorder(vcl::RenderContext& rRenderContext, const tools::Rectangle& rBox, const SvBorder& rBorderSize, + const Paint& rHorizontalPaint, const Paint& rVerticalPaint); + static void DrawHorizontalLine(vcl::RenderContext& rRenderContext, const sal_Int32 nLeft, const sal_Int32 nRight, + const sal_Int32 nY, const sal_Int32 nHeight, const Paint& rPaint); + static void DrawVerticalLine(vcl::RenderContext& rRenderContext, const sal_Int32 nTop, const sal_Int32 nBottom, + const sal_Int32 nX, const sal_Int32 nWidth, const Paint& rPaint); + static void DrawRoundedRectangle(vcl::RenderContext& rRenderContext, const tools::Rectangle& rBox, const sal_Int32 nCornerRadius, + const Color& rBorderColor, const Paint& rFillPaint); +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/MenuButton.hxx b/sfx2/inc/sidebar/MenuButton.hxx new file mode 100644 index 000000000..a244a3439 --- /dev/null +++ b/sfx2/inc/sidebar/MenuButton.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <vcl/button.hxx> + +namespace sfx2::sidebar { + +class MenuButton final + : public CheckBox +{ +public: + MenuButton (vcl::Window* pParentWindow); + + virtual void Paint (vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rUpdateArea) override; + virtual void MouseMove (const MouseEvent& rEvent) override; + virtual void MouseButtonDown (const MouseEvent& rMouseEvent) override; + virtual void MouseButtonUp (const MouseEvent& rMouseEvent) override; + +protected: + using CheckBox::FillLayoutData; + +private: + bool mbIsLeftButtonDown; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/Paint.hxx b/sfx2/inc/sidebar/Paint.hxx new file mode 100644 index 000000000..ea2af1d5e --- /dev/null +++ b/sfx2/inc/sidebar/Paint.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <vcl/gradient.hxx> +#include <vcl/wall.hxx> + +#include <boost/variant.hpp> + +namespace sfx2::sidebar { + +/** Abstraction of different ways to fill outlines. + Can be + - none (empty: outline is not filled) + - singular color + - gradient +*/ +class Paint +{ +public: + enum Type + { + NoPaint, + ColorPaint, + GradientPaint + }; + + // Create a Paint object for an Any that may contain a color, a + // awt::Gradient, or nothing. + static Paint Create (const css::uno::Any& rValue); + + // Create paint with type NoPaint. + explicit Paint(); + + // Create a Paint object for the given color. + explicit Paint (const Color& rColor); + + // Create a Paint object for the given gradient. + explicit Paint (const Gradient& rGradient); + + Type GetType() const { return meType;} + const Color& GetColor() const; + const Gradient& GetGradient() const; + + Wallpaper GetWallpaper() const; + +private: + Type meType; + ::boost::variant< + Color, + Gradient + > maValue; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/PanelDescriptor.hxx b/sfx2/inc/sidebar/PanelDescriptor.hxx new file mode 100644 index 000000000..be85911ac --- /dev/null +++ b/sfx2/inc/sidebar/PanelDescriptor.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <sidebar/ContextList.hxx> + +namespace sfx2::sidebar { + +class PanelDescriptor +{ +public: + OUString msTitle; + bool mbIsTitleBarOptional; + OUString msId; + OUString msDeckId; + OUString msTitleBarIconURL; + OUString msHighContrastTitleBarIconURL; + ContextList maContextList; + OUString msImplementationURL; + sal_Int32 mnOrderIndex; + bool mbShowForReadOnlyDocuments; + bool mbWantsCanvas; + bool mbExperimental; + + OUString msNodeName; // some impress panel nodes names are different from their Id + + PanelDescriptor(); + PanelDescriptor (const PanelDescriptor& rPanelDescriptor); + ~PanelDescriptor(); +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/PanelTitleBar.hxx b/sfx2/inc/sidebar/PanelTitleBar.hxx new file mode 100644 index 000000000..b060124b9 --- /dev/null +++ b/sfx2/inc/sidebar/PanelTitleBar.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <sidebar/TitleBar.hxx> + +namespace com::sun::star::frame { class XController; } +namespace com::sun::star::frame { class XFrame; } + +namespace sfx2::sidebar { + +class Panel; + +class PanelTitleBar final + : public TitleBar +{ +public: + PanelTitleBar(const OUString& rsTitle, vcl::Window* pParentWindow, Panel* pPanel); + virtual ~PanelTitleBar() override; + virtual void dispose() override; + + void SetMoreOptionsCommand(const OUString& rsCommandName, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + const css::uno::Reference<css::frame::XController>& rxController); + + virtual void DataChanged(const DataChangedEvent& rEvent) override; + virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override; + virtual void MouseButtonUp(const MouseEvent& rMouseEvent) override; + +private: + virtual tools::Rectangle GetTitleArea(const tools::Rectangle& rTitleBarBox) override; + virtual void PaintDecoration(vcl::RenderContext& rRenderContext) override; + virtual sidebar::Paint GetBackgroundPaint() override; + virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex) override; + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + + bool mbIsLeftButtonDown; + VclPtr<Panel> mpPanel; + static const sal_uInt16 mnMenuItemIndex = 1; + css::uno::Reference<css::frame::XFrame> mxFrame; + OUString msMoreOptionsCommand; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/TabItem.hxx b/sfx2/inc/sidebar/TabItem.hxx new file mode 100644 index 000000000..44e5cf6b5 --- /dev/null +++ b/sfx2/inc/sidebar/TabItem.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <vcl/button.hxx> + +namespace vcl { class Window; } + +namespace sfx2::sidebar { + +/** A single button in the tab bar. +*/ +class TabItem final + : public RadioButton +{ +public: + TabItem (vcl::Window* pParentWindow); + + virtual void Paint (vcl::RenderContext& rRenderContext, const tools::Rectangle& rUpdateArea) override; + virtual void MouseMove (const MouseEvent& rEvent) override; + virtual void MouseButtonDown (const MouseEvent& rMouseEvent) override; + virtual void MouseButtonUp (const MouseEvent& rMouseEvent) override; + +private: + bool mbIsLeftButtonDown; +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/TitleBar.hxx b/sfx2/inc/sidebar/TitleBar.hxx new file mode 100644 index 000000000..69c182825 --- /dev/null +++ b/sfx2/inc/sidebar/TitleBar.hxx @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <sidebar/Paint.hxx> + +#include <sfx2/sidebar/SidebarToolBox.hxx> + +namespace sfx2::sidebar { + +class TitleBar : public vcl::Window +{ +public: + TitleBar (const OUString& rsTitle, + vcl::Window* pParentWindow, + const sidebar::Paint& rInitialBackgroundPaint); + virtual ~TitleBar() override; + virtual void dispose() override; + + void SetTitle (const OUString& rsTitle); + const OUString& GetTitle() const {return msTitle; } + + void SetIcon (const Image& rIcon); + + virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rUpdateArea) override; + virtual void DataChanged (const DataChangedEvent& rEvent) override; + virtual void setPosSizePixel (long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags = PosSizeFlags::All) override; + + ToolBox& GetToolBox() + { + return *maToolBox; + } + const ToolBox& GetToolBox() const + { + return *maToolBox; + } + +protected: + VclPtr<SidebarToolBox> maToolBox; + OUString msTitle; + + virtual tools::Rectangle GetTitleArea (const tools::Rectangle& rTitleBarBox) = 0; + virtual void PaintDecoration (vcl::RenderContext& rRenderContext) = 0; + void PaintFocus(vcl::RenderContext& rRenderContext, const tools::Rectangle& rFocusBox); + virtual sidebar::Paint GetBackgroundPaint() = 0; + virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex); + virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + +private: + Image maIcon; + sidebar::Paint maBackgroundPaint; + + void PaintTitle(vcl::RenderContext& rRenderContext, const tools::Rectangle& rTitleBox); + DECL_LINK(SelectionHandler, ToolBox*, void); +}; + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/Tools.hxx b/sfx2/inc/sidebar/Tools.hxx new file mode 100644 index 000000000..97611a7a6 --- /dev/null +++ b/sfx2/inc/sidebar/Tools.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <vcl/image.hxx> +#include <vcl/gradient.hxx> + +#include <sfx2/dllapi.h> + +#include <com/sun/star/awt/Gradient.hpp> +#include <com/sun/star/util/URL.hpp> + +namespace com::sun::star::frame { class XController; } +namespace com::sun::star::frame { class XDispatch; } +namespace com::sun::star::frame { class XFrame; } + + +namespace sfx2::sidebar { + +class Tools +{ +public: + static Image GetImage ( + const OUString& rsImageURL, + const OUString& rsHighContrastImageURL, + const css::uno::Reference<css::frame::XFrame>& rxFrame); + + static Image GetImage ( + const OUString& rsURL, + const css::uno::Reference<css::frame::XFrame>& rxFrame); + + static css::awt::Gradient VclToAwtGradient (const Gradient& rGradient); + static Gradient AwtToVclGradient (const css::awt::Gradient& rGradient); + + static css::util::URL GetURL (const OUString& rsCommand); + static css::uno::Reference<css::frame::XDispatch> GetDispatch ( + const css::uno::Reference<css::frame::XFrame>& rxFrame, + const css::util::URL& rURL); + + static OUString GetModuleName ( + const css::uno::Reference<css::frame::XController>& rxFrame); +}; + + +} // end of namespace sfx2::sidebar + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/UnoDeck.hxx b/sfx2/inc/sidebar/UnoDeck.hxx new file mode 100644 index 000000000..88497c03a --- /dev/null +++ b/sfx2/inc/sidebar/UnoDeck.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + + +#include <com/sun/star/ui/XDeck.hpp> + +#include <cppuhelper/implbase.hxx> + +#include <sfx2/sidebar/ResourceManager.hxx> + +namespace com::sun::star::frame { class XFrame; } +namespace com::sun::star::ui { class XPanels; } +namespace sfx2::sidebar { class SidebarController; } + +/** get the decks +*/ +class SfxUnoDeck final : public cppu::WeakImplHelper<css::ui::XDeck> +{ + +public: + + SfxUnoDeck(const css::uno::Reference<css::frame::XFrame>& , const OUString&); + + virtual OUString SAL_CALL getId() override; + + virtual OUString SAL_CALL getTitle() override; + virtual void SAL_CALL setTitle( const OUString& newTitle ) override; + + virtual sal_Bool SAL_CALL isActive() override; + virtual void SAL_CALL activate( const sal_Bool bActivate ) override; + + virtual css::uno::Reference<css::ui::XPanels> SAL_CALL getPanels() override; + + virtual sal_Int32 SAL_CALL getOrderIndex() override; + virtual void SAL_CALL setOrderIndex( const sal_Int32 newOrderIndex ) override; + virtual void SAL_CALL moveFirst() override; + virtual void SAL_CALL moveLast() override; + virtual void SAL_CALL moveUp() override; + virtual void SAL_CALL moveDown() override; + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + + const OUString mDeckId; + + sal_Int32 GetMaxOrderIndex(sfx2::sidebar::ResourceManager::DeckContextDescriptorContainer aDecks); + sal_Int32 GetMinOrderIndex(sfx2::sidebar::ResourceManager::DeckContextDescriptorContainer aDecks); + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/UnoDecks.hxx b/sfx2/inc/sidebar/UnoDecks.hxx new file mode 100644 index 000000000..95ce0be62 --- /dev/null +++ b/sfx2/inc/sidebar/UnoDecks.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include <com/sun/star/ui/XDecks.hpp> + +#include <cppuhelper/implbase.hxx> + +namespace com::sun::star::frame { class XFrame; } +namespace sfx2::sidebar { class SidebarController; } + +/** get the decks +*/ +class SfxUnoDecks final : public cppu::WeakImplHelper<css::ui::XDecks> +{ + +public: + + SfxUnoDecks(const css::uno::Reference<css::frame::XFrame>&); + +// XNameAccess + + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; + + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; + +// XIndexAccess + + virtual sal_Int32 SAL_CALL getCount() override; + + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + +// XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/UnoPanel.hxx b/sfx2/inc/sidebar/UnoPanel.hxx new file mode 100644 index 000000000..50d9aba2c --- /dev/null +++ b/sfx2/inc/sidebar/UnoPanel.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#pragma once + +#include <com/sun/star/ui/XPanel.hpp> + + +#include <cppuhelper/implbase.hxx> + +#include <sfx2/sidebar/Panel.hxx> +#include <sfx2/sidebar/Deck.hxx> +#include <sfx2/sidebar/ResourceManager.hxx> + +namespace com::sun::star::awt { class XWindow; } +namespace com::sun::star::frame { class XFrame; } +namespace sfx2::sidebar { class SidebarController; } + + +/** get the Panel +*/ +class SfxUnoPanel final : public cppu::WeakImplHelper<css::ui::XPanel> +{ + +public: + + SfxUnoPanel(const css::uno::Reference<css::frame::XFrame>& , const OUString&, const OUString&); + + virtual OUString SAL_CALL getId() override; + + virtual OUString SAL_CALL getTitle() override; + virtual void SAL_CALL setTitle( const OUString& newTitle ) override; + + virtual sal_Bool SAL_CALL isExpanded() override; + virtual void SAL_CALL expand( const sal_Bool bCollapseOther ) override; + virtual void SAL_CALL collapse( ) override; + + virtual sal_Int32 SAL_CALL getOrderIndex() override; + virtual void SAL_CALL setOrderIndex( const sal_Int32 newOrderIndex ) override; + virtual void SAL_CALL moveFirst() override; + virtual void SAL_CALL moveLast() override; + virtual void SAL_CALL moveUp() override; + virtual void SAL_CALL moveDown() override; + + virtual css::uno::Reference<css::awt::XWindow> SAL_CALL getDialog() override; + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + + const OUString mPanelId; + const OUString mDeckId; + + VclPtr<sfx2::sidebar::Deck> mpDeck; + VclPtr<sfx2::sidebar::Panel> mpPanel; + + sal_Int32 GetMaxOrderIndex(sfx2::sidebar::ResourceManager::PanelContextDescriptorContainer aPanels); + sal_Int32 GetMinOrderIndex(sfx2::sidebar::ResourceManager::PanelContextDescriptorContainer aPanels); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/UnoPanels.hxx b/sfx2/inc/sidebar/UnoPanels.hxx new file mode 100644 index 000000000..487043dee --- /dev/null +++ b/sfx2/inc/sidebar/UnoPanels.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#pragma once + + +#include <com/sun/star/ui/XPanels.hpp> + +#include <cppuhelper/implbase.hxx> + +namespace com::sun::star::frame { class XFrame; } +namespace sfx2::sidebar { class SidebarController; } + +/** get the decks +*/ +class SfxUnoPanels final : public cppu::WeakImplHelper<css::ui::XPanels> +{ + +public: + + SfxUnoPanels(const css::uno::Reference<css::frame::XFrame>& , const OUString&); + +// XPanels + virtual OUString SAL_CALL getDeckId() override; + +// XNameAccess + + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; + + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; + +// XIndexAccess + + virtual sal_Int32 SAL_CALL getCount() override; + + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + +// XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + const OUString& mDeckId; + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sidebar/UnoSidebar.hxx b/sfx2/inc/sidebar/UnoSidebar.hxx new file mode 100644 index 000000000..20ffa22b1 --- /dev/null +++ b/sfx2/inc/sidebar/UnoSidebar.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#ifndef INCLUDED_SFX2_SIDEBAR_SIDEBAR_HXX +#define INCLUDED_SFX2_SIDEBAR_SIDEBAR_HXX + +#include <com/sun/star/ui/XSidebarProvider.hpp> + +#include <cppuhelper/implbase.hxx> + +namespace com::sun::star::frame { class XFrame; } +namespace com::sun::star::ui { class XDecks; } +namespace com::sun::star::ui { class XSidebar; } +namespace sfx2::sidebar { class SidebarController; } + +/** get the sidebar for a given frame +*/ +class SfxUnoSidebar final : public cppu::WeakImplHelper<css::ui::XSidebarProvider> +{ + +private: + + const css::uno::Reference<css::frame::XFrame> xFrame; + sfx2::sidebar::SidebarController* getSidebarController(); + +public: + + SfxUnoSidebar(const css::uno::Reference<css::frame::XFrame>&); + + virtual void SAL_CALL showDecks (const sal_Bool bVisible) override; + + + virtual void SAL_CALL setVisible (const sal_Bool bVisible) override; + + virtual sal_Bool SAL_CALL isVisible() override; + + virtual css::uno::Reference<css::frame::XFrame> SAL_CALL getFrame() override; + + virtual css::uno::Reference<css::ui::XDecks> SAL_CALL getDecks() override; + + virtual css::uno::Reference<css::ui::XSidebar> SAL_CALL getSidebar() override; + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/sorgitm.hxx b/sfx2/inc/sorgitm.hxx new file mode 100644 index 000000000..d67d89062 --- /dev/null +++ b/sfx2/inc/sorgitm.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX2_INC_SORGITM_HXX +#define INCLUDED_SFX2_INC_SORGITM_HXX + +#include <svl/stritem.hxx> + +// class SfxScriptOrganizerItem --------------------------------------------- + +class SfxScriptOrganizerItem final : public SfxStringItem +{ +private: + OUString aLanguage; + +public: + static SfxPoolItem* CreateDefault(); + SfxScriptOrganizerItem(); + + virtual SfxScriptOrganizerItem* Clone( SfxItemPool* pPool = nullptr ) const override; + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; + virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + const OUString& getLanguage() const { return aLanguage; }; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/srchdlg.hxx b/sfx2/inc/srchdlg.hxx new file mode 100644 index 000000000..3d8317477 --- /dev/null +++ b/sfx2/inc/srchdlg.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX2_INC_SRCHDLG_HXX +#define INCLUDED_SFX2_INC_SRCHDLG_HXX + +#include <vcl/weld.hxx> + +namespace sfx2 { + + +// SearchDialog + + +class SearchDialog final : public weld::GenericDialogController +{ +private: + Link<SearchDialog&,void> m_aFindHdl; + Link<LinkParamNone*,void> m_aCloseHdl; + + OUString m_sConfigName; + + std::unique_ptr<weld::ComboBox> m_xSearchEdit; + std::unique_ptr<weld::CheckButton> m_xWholeWordsBox; + std::unique_ptr<weld::CheckButton> m_xMatchCaseBox; + std::unique_ptr<weld::CheckButton> m_xWrapAroundBox; + std::unique_ptr<weld::CheckButton> m_xBackwardsBox; + std::unique_ptr<weld::Button> m_xFindBtn; + + void LoadConfig(); + void SaveConfig(); + + DECL_LINK(FindHdl, weld::Button&, void); + +public: + SearchDialog(weld::Window* pWindow, const OUString& rConfigName); + static void runAsync(const std::shared_ptr<SearchDialog>& rController); + virtual ~SearchDialog() override; + + void SetFindHdl( const Link<SearchDialog&,void>& rLink ) { m_aFindHdl = rLink; } + void SetCloseHdl( const Link<LinkParamNone*,void>& rLink ) { m_aCloseHdl = rLink; } + + OUString GetSearchText() const { return m_xSearchEdit->get_active_text(); } + void SetSearchText( const OUString& _rText ) { m_xSearchEdit->set_entry_text( _rText ); } + bool IsOnlyWholeWords() const { return m_xWholeWordsBox->get_active(); } + bool IsMarchCase() const { return m_xMatchCaseBox->get_active(); } + bool IsWrapAround() const { return m_xWrapAroundBox->get_active(); } + bool IsSearchBackwards() const { return m_xBackwardsBox->get_active(); } + + void SetFocusOnEdit(); +}; + +} // namespace sfx2 + + +#endif // INCLUDED_SFX2_INC_SRCHDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/strings.hxx b/sfx2/inc/strings.hxx new file mode 100644 index 000000000..386f3fdc3 --- /dev/null +++ b/sfx2/inc/strings.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SFX2_INC_STRINGS_HXX +#define INCLUDED_SFX2_INC_STRINGS_HXX + +#define STR_HTML_GENERATOR "%PRODUCTNAME %PRODUCTVERSION%PRODUCTEXTENSION (%1)" + +// Do not translate STR_TEMPLATE_NAME*_DEF names!! +// STR_TEMPLATE_NAME*_DEF strings must EXACTLY fit dc:title tag in meta.xml of each template file +#define STR_TEMPLATE_NAME1_DEF "Alizarin" +#define STR_TEMPLATE_NAME2_DEF "Beehive" +#define STR_TEMPLATE_NAME3_DEF "Blue Curve" +#define STR_TEMPLATE_NAME4_DEF "Blueprint Plans" +#define STR_TEMPLATE_NAME5_DEF "Bright Blue" +#define STR_TEMPLATE_NAME6_DEF "Classy Red" +#define STR_TEMPLATE_NAME7_DEF "DNA" +#define STR_TEMPLATE_NAME8_DEF "Focus" +#define STR_TEMPLATE_NAME9_DEF "Forestbird" +#define STR_TEMPLATE_NAME10_DEF "Impress" +#define STR_TEMPLATE_NAME11_DEF "Inspiration" +#define STR_TEMPLATE_NAME12_DEF "Lights" +#define STR_TEMPLATE_NAME13_DEF "Lush Green" +#define STR_TEMPLATE_NAME14_DEF "Metropolis" +#define STR_TEMPLATE_NAME15_DEF "Midnightblue" +#define STR_TEMPLATE_NAME16_DEF "Nature Illustration" +#define STR_TEMPLATE_NAME17_DEF "Pencil" +#define STR_TEMPLATE_NAME18_DEF "Piano" +#define STR_TEMPLATE_NAME19_DEF "Portfolio" +#define STR_TEMPLATE_NAME20_DEF "Progress" +#define STR_TEMPLATE_NAME21_DEF "Sunset" +#define STR_TEMPLATE_NAME22_DEF "Vintage" +#define STR_TEMPLATE_NAME23_DEF "Vivid" +#define STR_TEMPLATE_NAME24_DEF "CV" +#define STR_TEMPLATE_NAME25_DEF "Resume" +#define STR_TEMPLATE_NAME26_DEF "Default" +#define STR_TEMPLATE_NAME27_DEF "Modern" +#define STR_TEMPLATE_NAME28_DEF "Modern business letter sans-serif" +#define STR_TEMPLATE_NAME29_DEF "Modern business letter serif" +#define STR_TEMPLATE_NAME30_DEF "Businesscard with logo" +#define STR_TEMPLATE_NAME31_DEF "Simple" +#define STR_TEMPLATE_NAME32_DEF "BPMN" + +#define CMIS_TYPE_STRING "String" +#define CMIS_TYPE_INTEGER "Integer" +#define CMIS_TYPE_DECIMAL "Decimal" +#define CMIS_TYPE_DATETIME "Datetime" +#define CMIS_TYPE_BOOL "Bool" + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sfx2/inc/templatecontaineritem.hxx b/sfx2/inc/templatecontaineritem.hxx new file mode 100644 index 000000000..e11e2bd21 --- /dev/null +++ b/sfx2/inc/templatecontaineritem.hxx @@ -0,0 +1,27 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <sfx2/templateproperties.hxx> + +class TemplateContainerItem final +{ +public: + sal_uInt16 mnId; + sal_uInt16 mnRegionId; + OUString maTitle; + std::vector<TemplateItemProperties> maTemplates; + + TemplateContainerItem (sal_uInt16 nId); + + ~TemplateContainerItem (); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/templatedefaultview.hxx b/sfx2/inc/templatedefaultview.hxx new file mode 100644 index 000000000..9020a779b --- /dev/null +++ b/sfx2/inc/templatedefaultview.hxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <sfx2/templatelocalview.hxx> + +class TemplateDefaultView final : public TemplateLocalView +{ +public: + TemplateDefaultView(Window *pParent); + + virtual void reload() override; + + virtual void showAllTemplates () override; + + virtual void KeyInput( const KeyEvent& rKEvt ) override; + + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + + void createContextMenu(); + +private: + long mnItemMaxSize; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/templateviewitem.hxx b/sfx2/inc/templateviewitem.hxx new file mode 100644 index 000000000..536808f47 --- /dev/null +++ b/sfx2/inc/templateviewitem.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "thumbnailviewitem.hxx" + +class TemplateViewItem : public ThumbnailViewItem +{ +public: + + TemplateViewItem (ThumbnailViewBase &rView, sal_uInt16 nId); + + virtual ~TemplateViewItem () override; + + void setPath (const OUString &rPath) { maPath = rPath; } + + const OUString& getPath () const { return maPath; } + + void showDefaultIcon(bool bVal) { mbIsDefaultTemplate = bVal; } + + bool IsDefaultTemplate() const { return mbIsDefaultTemplate; } + + tools::Rectangle getDefaultIconArea() const; + + virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor, + const ThumbnailItemAttributes *pAttrs) override; + + sal_uInt16 mnRegionId; + sal_uInt16 mnDocId; + +private: + + OUString maPath; + BitmapEx maDefaultBitmap; + bool mbIsDefaultTemplate; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/thumbnailviewitem.hxx b/sfx2/inc/thumbnailviewitem.hxx new file mode 100644 index 000000000..dea5e65c1 --- /dev/null +++ b/sfx2/inc/thumbnailviewitem.hxx @@ -0,0 +1,137 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <basegfx/vector/b2dvector.hxx> +#include <drawinglayer/attribute/fontattribute.hxx> +#include <vcl/bitmapex.hxx> +#include <sfx2/dllapi.h> + +namespace com::sun::star::accessibility { class XAccessible; } +namespace drawinglayer::primitive2d { class Primitive2DContainer; } + +#define THUMBNAILVIEW_ITEM_NONEITEM 0xFFFE + +const int THUMBNAILVIEW_ITEM_CORNER = 5; + +class ThumbnailViewBase; +class MouseEvent; + +namespace basegfx { + class B2DPolygon; +} + +namespace drawinglayer { + namespace processor2d { + class BaseProcessor2D; + } + + namespace primitive2d { + class PolygonHairlinePrimitive2D; + } +} + +struct ThumbnailItemAttributes +{ + sal_uInt32 nMaxTextLength; + basegfx::BColor aFillColor; + basegfx::BColor aTextColor; + basegfx::BColor aHighlightColor; + basegfx::BColor aHighlightTextColor; + basegfx::BColor aSelectHighlightColor; + basegfx::BColor aSelectHighlightTextColor; + double fHighlightTransparence; + basegfx::B2DVector aFontSize; + drawinglayer::attribute::FontAttribute aFontAttr; +}; + +class ThumbnailViewItem +{ +public: + + ThumbnailViewBase &mrParent; + sal_uInt16 mnId; + bool mbVisible; + bool mbSelected; + bool mbHover; + BitmapEx maPreview1; + OUString maTitle; + OUString maHelpText; + css::uno::Reference< css::accessibility::XAccessible > mxAcc; + + ThumbnailViewItem (ThumbnailViewBase &rView, sal_uInt16 nId); + + virtual ~ThumbnailViewItem (); + + bool isVisible () const { return mbVisible; } + + void show (bool bVisible); + + bool isSelected () const { return mbSelected; } + + void setSelection (bool state); + + bool isHighlighted () const { return mbHover; } + + void setHighlight (bool state); + + /** Updates own highlight status based on the aPoint position. + + Returns rectangle that needs to be invalidated. + */ + virtual tools::Rectangle updateHighlight(bool bVisible, const Point& rPoint); + + /// Text to be used for the tooltip. + + void setHelpText (const OUString &sText) { maHelpText = sText; } + + virtual OUString getHelpText() const { return maHelpText; }; + OUString const & getTitle() const { return maTitle; }; + + void setTitle (const OUString& rTitle); + + css::uno::Reference< css::accessibility::XAccessible > const & + GetAccessible( bool bIsTransientChildrenDisabled ); + + void setDrawArea (const tools::Rectangle &area); + + const tools::Rectangle& getDrawArea () const { return maDrawArea; } + + virtual void calculateItemsPosition (const long nThumbnailHeight, + const long nPadding, sal_uInt32 nMaxTextLength, + const ThumbnailItemAttributes *pAttrs); + + virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor, + const ThumbnailItemAttributes *pAttrs); + void addTextPrimitives (const OUString& rText, const ThumbnailItemAttributes *pAttrs, Point aPos, drawinglayer::primitive2d::Primitive2DContainer& rSeq); + + static drawinglayer::primitive2d::PolygonHairlinePrimitive2D* + createBorderLine (const basegfx::B2DPolygon &rPolygon); + + virtual void MouseButtonUp(const MouseEvent&) {} + +protected: + + Point maTextPos; + Point maPrev1Pos; + tools::Rectangle maDrawArea; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/unoctitm.hxx b/sfx2/inc/unoctitm.hxx new file mode 100644 index 000000000..c18015032 --- /dev/null +++ b/sfx2/inc/unoctitm.hxx @@ -0,0 +1,145 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <memory> +#include <com/sun/star/frame/XNotifyingDispatch.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weakref.hxx> + +#include <sfx2/ctrlitem.hxx> +#include <osl/mutex.hxx> + +namespace com::sun::star::frame { class XFrame; } +namespace com::sun::star::frame { class XNotifyingDispatch; } +namespace com::sun::star::frame { class XStatusListener; } +namespace com::sun::star::frame { struct FeatureStateEvent; } + +class SfxBindings; +class SfxDispatcher; +class SfxSlot; + +typedef cppu::OMultiTypeInterfaceContainerHelperVar<OUString> + SfxStatusDispatcher_Impl_ListenerContainer; + +class SfxStatusDispatcher : public cppu::WeakImplHelper<css::frame::XNotifyingDispatch> +{ + ::osl::Mutex aMutex; + SfxStatusDispatcher_Impl_ListenerContainer aListeners; + +public: + + SfxStatusDispatcher(); + + // XDispatch + virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL, + const css::uno::Sequence< css::beans::PropertyValue >& aArgs, + const css::uno::Reference< css::frame::XDispatchResultListener >& rListener ) override; + virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs ) override; + virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > & xControl, const css::util::URL& aURL) override; + virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > & xControl, const css::util::URL& aURL) override; + + // Something else + void ReleaseAll(); + SfxStatusDispatcher_Impl_ListenerContainer& GetListeners() + { return aListeners; } +}; + +class SfxSlotServer; +class SfxDispatchController_Impl; +class SfxOfficeDispatch final : public cppu::ImplInheritanceHelper<SfxStatusDispatcher, css::lang::XUnoTunnel> +{ +friend class SfxDispatchController_Impl; + std::unique_ptr<SfxDispatchController_Impl> pImpl; +public: + SfxOfficeDispatch( SfxBindings& rBind, + SfxDispatcher* pDispat, + const SfxSlot* pSlot, + const css::util::URL& rURL ); + SfxOfficeDispatch( SfxDispatcher* pDispat, + const SfxSlot* pSlot, + const css::util::URL& rURL ); + virtual ~SfxOfficeDispatch() override; + + virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL, + const css::uno::Sequence< css::beans::PropertyValue >& aArgs, + const css::uno::Reference< css::frame::XDispatchResultListener >& rListener ) override; + virtual void SAL_CALL dispatch( const css::util::URL& aURL, + const css::uno::Sequence< css::beans::PropertyValue >& aArgs ) override; + virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener > & xControl, + const css::util::URL& aURL) override; + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override ; + static const css::uno::Sequence< sal_Int8 >& impl_getStaticIdentifier(); + + static bool IsMasterUnoCommand( const css::util::URL& aURL ); + static OUString GetMasterUnoCommand( const css::util::URL& aURL ); + + void SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame); + + void SetMasterUnoCommand( bool bSet ); + + SfxDispatcher* GetDispatcher_Impl(); +}; + +class SfxDispatchController_Impl : public SfxControllerItem +{ + css::util::URL aDispatchURL; + SfxDispatcher* pDispatcher; + SfxBindings* pBindings; + const SfxPoolItem* pLastState; + SfxOfficeDispatch* pDispatch; + bool bMasterSlave; + bool bVisible; + css::uno::WeakReference< css::frame::XFrame > xFrame; + + static void addParametersToArgs( const css::util::URL& aURL, + css::uno::Sequence< css::beans::PropertyValue >& rArgs ); + static MapUnit GetCoreMetric( SfxItemPool const & rPool, sal_uInt16 nSlot ); + + void sendStatusChanged(const OUString& rURL, const css::frame::FeatureStateEvent& rEvent); + +public: + SfxDispatchController_Impl( SfxOfficeDispatch* pDisp, + SfxBindings* pBind, + SfxDispatcher* pDispat, + const SfxSlot* pSlot, + const css::util::URL& rURL ); + virtual ~SfxDispatchController_Impl() override; + + static OUString getSlaveCommand( const css::util::URL& rURL ); + + void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState, SfxSlotServer const * pServ ); + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; + void setMasterSlaveCommand( bool bSet ); + /// @throws css::uno::RuntimeException + void dispatch( const css::util::URL& aURL, + const css::uno::Sequence< css::beans::PropertyValue >& aArgs, + const css::uno::Reference< css::frame::XDispatchResultListener >& rListener ); + /// @throws css::uno::RuntimeException + void addStatusListener(const css::uno::Reference< css::frame::XStatusListener > & xControl, const css::util::URL& aURL); + void UnBindController(); + SfxDispatcher* GetDispatcher(); + void SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |