From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- include/sfx2/AccessibilityCheck.hxx | 40 ++ include/sfx2/AccessibilityIssue.hxx | 62 ++ include/sfx2/DocumentMetadataAccess.hxx | 152 ++++ include/sfx2/DocumentSigner.hxx | 47 ++ include/sfx2/Metadatable.hxx | 170 +++++ include/sfx2/QuerySaveDocument.hxx | 38 + include/sfx2/StyleManager.hxx | 50 ++ include/sfx2/StylePreviewRenderer.hxx | 57 ++ include/sfx2/XmlIdRegistry.hxx | 66 ++ include/sfx2/app.hxx | 235 +++++++ include/sfx2/basedlgs.hxx | 137 ++++ include/sfx2/bindings.hxx | 197 ++++++ include/sfx2/brokenpackageint.hxx | 58 ++ include/sfx2/chalign.hxx | 55 ++ include/sfx2/charmappopup.hxx | 45 ++ include/sfx2/charwin.hxx | 75 ++ include/sfx2/childwin.hxx | 312 +++++++++ include/sfx2/classificationhelper.hxx | 227 ++++++ include/sfx2/ctrlitem.hxx | 91 +++ include/sfx2/dialoghelper.hxx | 41 ++ include/sfx2/dinfdlg.hxx | 565 +++++++++++++++ include/sfx2/dispatch.hxx | 179 +++++ include/sfx2/dllapi.h | 36 + include/sfx2/docfac.hxx | 96 +++ include/sfx2/docfile.hxx | 295 ++++++++ include/sfx2/docfilt.hxx | 124 ++++ include/sfx2/docinf.hxx | 75 ++ include/sfx2/docinsert.hxx | 77 ++ include/sfx2/dockwin.hxx | 131 ++++ include/sfx2/docmacromode.hxx | 302 ++++++++ include/sfx2/docstoragemodifylistener.hxx | 82 +++ include/sfx2/doctempl.hxx | 113 +++ include/sfx2/emojipopup.hxx | 44 ++ include/sfx2/event.hxx | 268 +++++++ include/sfx2/evntconf.hxx | 102 +++ include/sfx2/fcontnr.hxx | 119 ++++ include/sfx2/filedlghelper.hxx | 264 +++++++ include/sfx2/flatpak.hxx | 34 + include/sfx2/frame.hxx | 213 ++++++ include/sfx2/frmdescr.hxx | 102 +++ include/sfx2/frmhtml.hxx | 39 ++ include/sfx2/frmhtmlw.hxx | 76 ++ include/sfx2/groupid.hxx | 74 ++ include/sfx2/htmlmode.hxx | 30 + include/sfx2/infobar.hxx | 124 ++++ include/sfx2/inputdlg.hxx | 32 + include/sfx2/ipclient.hxx | 94 +++ include/sfx2/linkmgr.hxx | 185 +++++ include/sfx2/linksrc.hxx | 118 ++++ include/sfx2/lnkbase.hxx | 177 +++++ include/sfx2/lokcharthelper.hxx | 61 ++ include/sfx2/lokhelper.hxx | 130 ++++ include/sfx2/mailmodelapi.hxx | 103 +++ include/sfx2/mieclip.hxx | 44 ++ include/sfx2/minfitem.hxx | 67 ++ include/sfx2/module.hxx | 105 +++ include/sfx2/msg.hxx | 264 +++++++ include/sfx2/msgpool.hxx | 75 ++ include/sfx2/navigat.hxx | 54 ++ include/sfx2/new.hxx | 108 +++ include/sfx2/newstyle.hxx | 52 ++ include/sfx2/notebookbar/SfxNotebookBar.hxx | 68 ++ include/sfx2/objface.hxx | 121 ++++ include/sfx2/objitem.hxx | 45 ++ include/sfx2/objsh.hxx | 897 ++++++++++++++++++++++++ include/sfx2/opengrf.hxx | 72 ++ include/sfx2/pageids.hxx | 70 ++ include/sfx2/passwd.hxx | 132 ++++ include/sfx2/printer.hxx | 62 ++ include/sfx2/printopt.hxx | 87 +++ include/sfx2/progress.hxx | 63 ++ include/sfx2/request.hxx | 126 ++++ include/sfx2/safemode.hxx | 74 ++ include/sfx2/sfxbasecontroller.hxx | 218 ++++++ include/sfx2/sfxbasemodel.hxx | 749 ++++++++++++++++++++ include/sfx2/sfxdlg.hxx | 150 ++++ include/sfx2/sfxhelp.hxx | 59 ++ include/sfx2/sfxhtml.hxx | 113 +++ include/sfx2/sfxmodelfactory.hxx | 77 ++ include/sfx2/sfxresid.hxx | 29 + include/sfx2/sfxsids.hrc | 710 +++++++++++++++++++ include/sfx2/sfxstatuslistener.hxx | 75 ++ include/sfx2/sfxuno.hxx | 50 ++ include/sfx2/shell.hxx | 591 ++++++++++++++++ include/sfx2/sidebar/AsynchronousCall.hxx | 55 ++ include/sfx2/sidebar/Context.hxx | 61 ++ include/sfx2/sidebar/ControllerItem.hxx | 82 +++ include/sfx2/sidebar/Deck.hxx | 111 +++ include/sfx2/sidebar/FocusManager.hxx | 149 ++++ include/sfx2/sidebar/IContextChangeReceiver.hxx | 42 ++ include/sfx2/sidebar/ILayoutableWindow.hxx | 45 ++ include/sfx2/sidebar/Panel.hxx | 94 +++ include/sfx2/sidebar/PanelLayout.hxx | 48 ++ include/sfx2/sidebar/ResourceManager.hxx | 135 ++++ include/sfx2/sidebar/Sidebar.hxx | 66 ++ include/sfx2/sidebar/SidebarChildWindow.hxx | 49 ++ include/sfx2/sidebar/SidebarController.hxx | 295 ++++++++ include/sfx2/sidebar/SidebarDockingWindow.hxx | 79 +++ include/sfx2/sidebar/SidebarModelUpdate.hxx | 31 + include/sfx2/sidebar/SidebarPanelBase.hxx | 102 +++ include/sfx2/sidebar/SidebarToolBox.hxx | 86 +++ include/sfx2/sidebar/TabBar.hxx | 129 ++++ include/sfx2/sidebar/Theme.hxx | 245 +++++++ include/sfx2/signaturestate.hxx | 54 ++ include/sfx2/stbitem.hxx | 133 ++++ include/sfx2/strings.hrc | 352 ++++++++++ include/sfx2/styfitem.hxx | 61 ++ include/sfx2/styledlg.hxx | 52 ++ include/sfx2/tabdlg.hxx | 246 +++++++ include/sfx2/tbxctrl.hxx | 140 ++++ include/sfx2/templatedlg.hxx | 209 ++++++ include/sfx2/templatelocalview.hxx | 257 +++++++ include/sfx2/templateproperties.hxx | 29 + include/sfx2/templdlg.hxx | 46 ++ include/sfx2/thumbnailview.hxx | 468 +++++++++++++ include/sfx2/titledockwin.hxx | 106 +++ include/sfx2/toolbarids.hxx | 77 ++ include/sfx2/tplpitem.hxx | 50 ++ include/sfx2/userinputinterception.hxx | 82 +++ include/sfx2/viewfac.hxx | 60 ++ include/sfx2/viewfrm.hxx | 270 +++++++ include/sfx2/viewsh.hxx | 390 +++++++++++ include/sfx2/watermarkitem.hxx | 47 ++ include/sfx2/weldutils.hxx | 66 ++ include/sfx2/zoomitem.hxx | 81 +++ 125 files changed, 17206 insertions(+) create mode 100644 include/sfx2/AccessibilityCheck.hxx create mode 100644 include/sfx2/AccessibilityIssue.hxx create mode 100644 include/sfx2/DocumentMetadataAccess.hxx create mode 100644 include/sfx2/DocumentSigner.hxx create mode 100644 include/sfx2/Metadatable.hxx create mode 100644 include/sfx2/QuerySaveDocument.hxx create mode 100644 include/sfx2/StyleManager.hxx create mode 100644 include/sfx2/StylePreviewRenderer.hxx create mode 100644 include/sfx2/XmlIdRegistry.hxx create mode 100644 include/sfx2/app.hxx create mode 100644 include/sfx2/basedlgs.hxx create mode 100644 include/sfx2/bindings.hxx create mode 100644 include/sfx2/brokenpackageint.hxx create mode 100644 include/sfx2/chalign.hxx create mode 100644 include/sfx2/charmappopup.hxx create mode 100644 include/sfx2/charwin.hxx create mode 100644 include/sfx2/childwin.hxx create mode 100644 include/sfx2/classificationhelper.hxx create mode 100644 include/sfx2/ctrlitem.hxx create mode 100644 include/sfx2/dialoghelper.hxx create mode 100644 include/sfx2/dinfdlg.hxx create mode 100644 include/sfx2/dispatch.hxx create mode 100644 include/sfx2/dllapi.h create mode 100644 include/sfx2/docfac.hxx create mode 100644 include/sfx2/docfile.hxx create mode 100644 include/sfx2/docfilt.hxx create mode 100644 include/sfx2/docinf.hxx create mode 100644 include/sfx2/docinsert.hxx create mode 100644 include/sfx2/dockwin.hxx create mode 100644 include/sfx2/docmacromode.hxx create mode 100644 include/sfx2/docstoragemodifylistener.hxx create mode 100644 include/sfx2/doctempl.hxx create mode 100644 include/sfx2/emojipopup.hxx create mode 100644 include/sfx2/event.hxx create mode 100644 include/sfx2/evntconf.hxx create mode 100644 include/sfx2/fcontnr.hxx create mode 100644 include/sfx2/filedlghelper.hxx create mode 100644 include/sfx2/flatpak.hxx create mode 100644 include/sfx2/frame.hxx create mode 100644 include/sfx2/frmdescr.hxx create mode 100644 include/sfx2/frmhtml.hxx create mode 100644 include/sfx2/frmhtmlw.hxx create mode 100644 include/sfx2/groupid.hxx create mode 100644 include/sfx2/htmlmode.hxx create mode 100644 include/sfx2/infobar.hxx create mode 100644 include/sfx2/inputdlg.hxx create mode 100644 include/sfx2/ipclient.hxx create mode 100644 include/sfx2/linkmgr.hxx create mode 100644 include/sfx2/linksrc.hxx create mode 100644 include/sfx2/lnkbase.hxx create mode 100644 include/sfx2/lokcharthelper.hxx create mode 100644 include/sfx2/lokhelper.hxx create mode 100644 include/sfx2/mailmodelapi.hxx create mode 100644 include/sfx2/mieclip.hxx create mode 100644 include/sfx2/minfitem.hxx create mode 100644 include/sfx2/module.hxx create mode 100644 include/sfx2/msg.hxx create mode 100644 include/sfx2/msgpool.hxx create mode 100644 include/sfx2/navigat.hxx create mode 100644 include/sfx2/new.hxx create mode 100644 include/sfx2/newstyle.hxx create mode 100644 include/sfx2/notebookbar/SfxNotebookBar.hxx create mode 100644 include/sfx2/objface.hxx create mode 100644 include/sfx2/objitem.hxx create mode 100644 include/sfx2/objsh.hxx create mode 100644 include/sfx2/opengrf.hxx create mode 100644 include/sfx2/pageids.hxx create mode 100644 include/sfx2/passwd.hxx create mode 100644 include/sfx2/printer.hxx create mode 100644 include/sfx2/printopt.hxx create mode 100644 include/sfx2/progress.hxx create mode 100644 include/sfx2/request.hxx create mode 100644 include/sfx2/safemode.hxx create mode 100644 include/sfx2/sfxbasecontroller.hxx create mode 100644 include/sfx2/sfxbasemodel.hxx create mode 100644 include/sfx2/sfxdlg.hxx create mode 100644 include/sfx2/sfxhelp.hxx create mode 100644 include/sfx2/sfxhtml.hxx create mode 100644 include/sfx2/sfxmodelfactory.hxx create mode 100644 include/sfx2/sfxresid.hxx create mode 100644 include/sfx2/sfxsids.hrc create mode 100644 include/sfx2/sfxstatuslistener.hxx create mode 100644 include/sfx2/sfxuno.hxx create mode 100644 include/sfx2/shell.hxx create mode 100644 include/sfx2/sidebar/AsynchronousCall.hxx create mode 100644 include/sfx2/sidebar/Context.hxx create mode 100644 include/sfx2/sidebar/ControllerItem.hxx create mode 100644 include/sfx2/sidebar/Deck.hxx create mode 100644 include/sfx2/sidebar/FocusManager.hxx create mode 100644 include/sfx2/sidebar/IContextChangeReceiver.hxx create mode 100644 include/sfx2/sidebar/ILayoutableWindow.hxx create mode 100644 include/sfx2/sidebar/Panel.hxx create mode 100644 include/sfx2/sidebar/PanelLayout.hxx create mode 100644 include/sfx2/sidebar/ResourceManager.hxx create mode 100644 include/sfx2/sidebar/Sidebar.hxx create mode 100644 include/sfx2/sidebar/SidebarChildWindow.hxx create mode 100644 include/sfx2/sidebar/SidebarController.hxx create mode 100644 include/sfx2/sidebar/SidebarDockingWindow.hxx create mode 100644 include/sfx2/sidebar/SidebarModelUpdate.hxx create mode 100644 include/sfx2/sidebar/SidebarPanelBase.hxx create mode 100644 include/sfx2/sidebar/SidebarToolBox.hxx create mode 100644 include/sfx2/sidebar/TabBar.hxx create mode 100644 include/sfx2/sidebar/Theme.hxx create mode 100644 include/sfx2/signaturestate.hxx create mode 100644 include/sfx2/stbitem.hxx create mode 100644 include/sfx2/strings.hrc create mode 100644 include/sfx2/styfitem.hxx create mode 100644 include/sfx2/styledlg.hxx create mode 100644 include/sfx2/tabdlg.hxx create mode 100644 include/sfx2/tbxctrl.hxx create mode 100644 include/sfx2/templatedlg.hxx create mode 100644 include/sfx2/templatelocalview.hxx create mode 100644 include/sfx2/templateproperties.hxx create mode 100644 include/sfx2/templdlg.hxx create mode 100644 include/sfx2/thumbnailview.hxx create mode 100644 include/sfx2/titledockwin.hxx create mode 100644 include/sfx2/toolbarids.hxx create mode 100644 include/sfx2/tplpitem.hxx create mode 100644 include/sfx2/userinputinterception.hxx create mode 100644 include/sfx2/viewfac.hxx create mode 100644 include/sfx2/viewfrm.hxx create mode 100644 include/sfx2/viewsh.hxx create mode 100644 include/sfx2/watermarkitem.hxx create mode 100644 include/sfx2/weldutils.hxx create mode 100644 include/sfx2/zoomitem.hxx (limited to 'include/sfx2') diff --git a/include/sfx2/AccessibilityCheck.hxx b/include/sfx2/AccessibilityCheck.hxx new file mode 100644 index 000000000..6de1069e5 --- /dev/null +++ b/include/sfx2/AccessibilityCheck.hxx @@ -0,0 +1,40 @@ +/* -*- 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_ACCESSIBILITYCHECKDIALOG_HXX +#define INCLUDED_SFX2_ACCESSIBILITYCHECKDIALOG_HXX + +#include +#include +#include +#include +#include + +namespace sfx +{ +class SFX2_DLLPUBLIC AccessibilityCheck +{ +protected: + AccessibilityIssueCollection m_aIssueCollection; + +public: + AccessibilityCheck() = default; + virtual ~AccessibilityCheck(); + + virtual void check() = 0; + + AccessibilityIssueCollection& getIssueCollecton(); +}; + +} // end sfx namespace + +#endif // INCLUDED_SFX2_ACCESSIBILITYCHECKDIALOG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/AccessibilityIssue.hxx b/include/sfx2/AccessibilityIssue.hxx new file mode 100644 index 000000000..32522ff63 --- /dev/null +++ b/include/sfx2/AccessibilityIssue.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/. + * + */ + +#ifndef INCLUDED_SFX2_ACCESSIBILITYISSUE_HXX +#define INCLUDED_SFX2_ACCESSIBILITYISSUE_HXX + +#include +#include +#include +#include + +namespace sfx +{ +enum class AccessibilityIssueID +{ + UNSPECIFIED, // TODO: remove - temporary + DOCUMENT_TITLE, + DOCUMENT_LANGUAGE, + STYLE_LANGUAGE, + NO_ALT_OLE, + NO_ALT_GRAPHIC, + NO_ALT_SHAPE, + TABLE_MERGE_SPLIT, + TEXT_FORMATTING, +}; + +class SFX2_DLLPUBLIC AccessibilityIssue +{ +public: + AccessibilityIssue(AccessibilityIssueID eIssueID = AccessibilityIssueID::UNSPECIFIED); + virtual ~AccessibilityIssue(); + + virtual bool canGotoIssue() const = 0; + virtual void gotoIssue() const = 0; + + AccessibilityIssueID m_eIssueID; + OUString m_aIssueText; +}; + +class SFX2_DLLPUBLIC AccessibilityIssueCollection +{ +private: + std::vector> m_aIssues; + +public: + AccessibilityIssueCollection() = default; + + std::vector>& getIssues(); +}; + +} // end sfx namespace + +#endif // INCLUDED_SFX2_ACCESSIBILITYISSUE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/DocumentMetadataAccess.hxx b/include/sfx2/DocumentMetadataAccess.hxx new file mode 100644 index 000000000..196676671 --- /dev/null +++ b/include/sfx2/DocumentMetadataAccess.hxx @@ -0,0 +1,152 @@ +/* -*- 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_DOCUMENTMETADATAACCESS_HXX +#define INCLUDED_SFX2_DOCUMENTMETADATAACCESS_HXX + +#include + +#include + +#include + +#include + +#include + + +/** Implementation of the interface com.sun.star.rdf.XDocumentMetadataAccess + + This is not a service only because it needs some kind of XML ID registry + from the document, and i do not like defining an API for that. + Also, the implementation does _no_ locking, so make sure access is + protected externally. + */ + +namespace com::sun::star::embed { + class XStorage; +} +namespace com::sun::star::frame { + class XModel; +} + +namespace com::sun::star::uno { class XComponentContext; } + +class SfxObjectShell; + +namespace sfx2 { + + +/** create a base URI for loading metadata from an ODF (sub)document. + + @param i_xContext component context + @param i_xModel model of the document (required if no URI is provided) + @param i_rPkgURI the URI for the package + @param i_rSubDocument (optional) path of the subdocument in package + + @return a base URI suitable for XDocumentMetadataAccess::loadFromStorage + */ +css::uno::Reference< css::rdf::XURI> SFX2_DLLPUBLIC +createBaseURI( + css::uno::Reference const & i_xContext, + css::uno::Reference const & i_xModel, + OUString const & i_rPkgURI, + OUString const & i_rSubDocument = OUString()); + + +struct DocumentMetadataAccess_Impl; + +class DocumentMetadataAccess final : + public cppu::WeakImplHelper +{ + DocumentMetadataAccess(const DocumentMetadataAccess&) = delete; + DocumentMetadataAccess& operator=( const DocumentMetadataAccess& ) = delete; +public: + explicit DocumentMetadataAccess(css::uno::Reference< css::uno::XComponentContext > const & i_xContext, + SfxObjectShell const & i_rRegistrySupplier, + OUString const & i_rBaseURI); + // N.B.: in contrast to previous, this constructor does _not_ initialize! + // caller must immediately call loadFromStorage/Medium! + explicit DocumentMetadataAccess(css::uno::Reference< css::uno::XComponentContext > const & i_xContext, + SfxObjectShell const & i_rRegistrySupplier); + virtual ~DocumentMetadataAccess() override; + + // css::rdf::XNode: + virtual OUString SAL_CALL getStringValue() override; + + // css::rdf::XURI: + virtual OUString SAL_CALL getNamespace() override; + virtual OUString SAL_CALL getLocalName() override; + + // css::rdf::XRepositorySupplier: + virtual css::uno::Reference< + css::rdf::XRepository > SAL_CALL getRDFRepository() override; + + // css::rdf::XDocumentMetadataAccess: + virtual css::uno::Reference< + css::rdf::XMetadatable > SAL_CALL + getElementByMetadataReference( + const css::beans::StringPair & i_rReference) override; + virtual css::uno::Reference< css::rdf::XMetadatable > SAL_CALL + getElementByURI(const css::uno::Reference< css::rdf::XURI > & i_xURI) override; + virtual css::uno::Sequence< css::uno::Reference< css::rdf::XURI > > SAL_CALL getMetadataGraphsWithType( + const css::uno::Reference< css::rdf::XURI > & i_xType) override; + virtual css::uno::Reference< css::rdf::XURI> SAL_CALL + addMetadataFile(const OUString & i_rFileName, + const css::uno::Sequence< css::uno::Reference< css::rdf::XURI > > & i_rTypes) override; + virtual css::uno::Reference< css::rdf::XURI> SAL_CALL + importMetadataFile(::sal_Int16 i_Format, + const css::uno::Reference< css::io::XInputStream > & i_xInStream, + const OUString & i_rFileName, + const css::uno::Reference< css::rdf::XURI > & i_xBaseURI, + const css::uno::Sequence< css::uno::Reference< css::rdf::XURI > > & i_rTypes) override; + virtual void SAL_CALL removeMetadataFile( + const css::uno::Reference< + css::rdf::XURI > & i_xGraphName) override; + virtual void SAL_CALL addContentOrStylesFile( + const OUString & i_rFileName) override; + virtual void SAL_CALL removeContentOrStylesFile( + const OUString & i_rFileName) override; + + virtual void SAL_CALL loadMetadataFromStorage( + const css::uno::Reference< + css::embed::XStorage > & i_xStorage, + const css::uno::Reference< + css::rdf::XURI > & i_xBaseURI, + const css::uno::Reference< + css::task::XInteractionHandler> & i_xHandler) override; + virtual void SAL_CALL storeMetadataToStorage( + const css::uno::Reference< + css::embed::XStorage > & i_xStorage) override; + virtual void SAL_CALL loadMetadataFromMedium( + const css::uno::Sequence< + css::beans::PropertyValue > & i_rMedium) override; + virtual void SAL_CALL storeMetadataToMedium( + const css::uno::Sequence< + css::beans::PropertyValue > & i_rMedium) override; + +private: + std::unique_ptr m_pImpl; +}; + +} // namespace sfx2 + +#endif // INCLUDED_SFX2_DOCUMENTMETADATAACCESS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/DocumentSigner.hxx b/include/sfx2/DocumentSigner.hxx new file mode 100644 index 000000000..8059cb9cb --- /dev/null +++ b/include/sfx2/DocumentSigner.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/. + * + */ + +#ifndef INCLUDED_SFX2_DOCUMENTSIGNER_HXX +#define INCLUDED_SFX2_DOCUMENTSIGNER_HXX + +#include +#include +#include + +namespace com::sun::star::security +{ +class XCertificate; +} +namespace com::sun::star::uno +{ +template class Reference; +} + +namespace sfx2 +{ +class SFX2_DLLPUBLIC DocumentSigner +{ +private: + OUString m_aUrl; + +public: + DocumentSigner(OUString const& rUrl) + : m_aUrl(rUrl) + { + } + + bool signDocument(css::uno::Reference const& rxCertificate); +}; + +} // namespace sfx2 + +#endif // INCLUDED_SFX2_DOCUMENTSIGNER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/Metadatable.hxx b/include/sfx2/Metadatable.hxx new file mode 100644 index 000000000..a84bddb89 --- /dev/null +++ b/include/sfx2/Metadatable.hxx @@ -0,0 +1,170 @@ +/* -*- 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_METADATABLE_HXX +#define INCLUDED_SFX2_METADATABLE_HXX + +#include + +#include + +#include +#include + +#include + + +namespace com::sun::star { + namespace frame { class XModel; } +} + +namespace sfx2 { + class IXmlIdRegistry; +} + +namespace sfx2 { + +class XmlIdRegistry; +class MetadatableUndo; + + +// XML ID handling --------------------------------------------------- + + +/// create a sfx2::XmlIdRegistryDocument or a sfx2::XmlIdRegistryClipboard +SFX2_DLLPUBLIC ::sfx2::IXmlIdRegistry * +createXmlIdRegistry(const bool i_DocIsClipboard); + + +/** base class for core objects that may have xml:id. + +

The interface of this class consists of 3 parts: +

  • implementations that are used by the MetadatableMixin + below
  • +
  • hooks to be called by the sw core whenever actions that are + relevant to the uniqueness of xml:ids are taken (copying, + splitting, merging, deletion, undo, etc.)
  • +
  • abstract methods that are called by the implementation of the + previous hooks
+

+ */ +class SFX2_DLLPUBLIC Metadatable +{ +public: + Metadatable() : m_pReg(nullptr) {} + + // destructor calls RemoveMetadataReference + virtual ~Metadatable(); + + // for MetadatableMixin ---------------------------------------------- + + css::beans::StringPair GetMetadataReference() const; + void SetMetadataReference( const css::beans::StringPair & i_rReference); + void EnsureMetadataReference(); + + // hooks ------------------------------------------------------------- + + // called from dtor! + void RemoveMetadataReference(); + + /** register this as a copy of i_rSource */ + void RegisterAsCopyOf(Metadatable const & i_rSource, + const bool i_bCopyPrecedesSource = false); + + /** create an Undo Metadatable, which remembers this' reference */ + std::shared_ptr CreateUndo() const; + std::shared_ptr CreateUndoForDelete(); + + /** restore this from Undo Metadatable */ + void RestoreMetadata(std::shared_ptr const& i_pUndo); + + /** merge this and i_rOther into this */ + void JoinMetadatable(Metadatable const & i_rOther, + const bool i_isMergedEmpty, const bool i_isOtherEmpty); + + // abstract methods -------------------------------------------------- + + /** get the registry from the SwDoc */ + virtual ::sfx2::IXmlIdRegistry& GetRegistry() = 0; + + /** is this in a clipboard document? */ + virtual bool IsInClipboard() const = 0; + + /** is this in undo array? */ + virtual bool IsInUndo() const = 0; + + /** which stream is this in? true: content.xml; false: styles.xml */ + virtual bool IsInContent() const = 0; + + /** create XMetadatable from this. + note: if IsInUndo or IsInClipboard return true, + MakeUnoObject must not be called! + */ + virtual css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() = 0; + +private: + Metadatable(const Metadatable&) = delete; + Metadatable& operator=(const Metadatable&) = delete; + + friend class MetadatableClipboard; + friend class MetadatableUndo; + + // note that Reg may be a XmlIdRegistryDocument or a XmlIdRegistryClipboard + XmlIdRegistry* m_pReg; // null => no XmlId +}; + + +/** base class for UNO objects that implement XMetadatable. + +

An instance of this base class is associated with an instance of + Metadatable.

+ */ +class SFX2_DLLPUBLIC MetadatableMixin : + public cppu::WeakImplHelper +{ + +public: + MetadatableMixin() {}; + + // css::rdf::XNode: + virtual OUString SAL_CALL getStringValue() override; + + // css::rdf::XURI: + virtual OUString SAL_CALL getLocalName() override; + virtual OUString SAL_CALL getNamespace() override; + + // css::rdf::XMetadatable: + virtual css::beans::StringPair SAL_CALL getMetadataReference() override; + virtual void SAL_CALL setMetadataReference( + const css::beans::StringPair & i_rReference) override; + virtual void SAL_CALL ensureMetadataReference() override; + +protected: + /// get the core object corresponding to this UNO object. + virtual Metadatable * GetCoreObject() = 0; + /// get the XModel for the document + virtual css::uno::Reference< css::frame::XModel > + GetModel() = 0; + +}; + +} // namespace sfx2 + +#endif // INCLUDED_SFX2_METADATABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/QuerySaveDocument.hxx b/include/sfx2/QuerySaveDocument.hxx new file mode 100644 index 000000000..00aecfeae --- /dev/null +++ b/include/sfx2/QuerySaveDocument.hxx @@ -0,0 +1,38 @@ +/* -*- 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_QUERYSAVEDOCUMENT_HXX +#define INCLUDED_SFX2_QUERYSAVEDOCUMENT_HXX + +#include +#include + +namespace weld { class Widget; } + +/** Opens the general query save document dialog. + @param _pParent + The parent window. + @_rTitle + The title of the document. +*/ +SFX2_DLLPUBLIC short ExecuteQuerySaveDocument( + weld::Widget* _pParent, const OUString& _rTitle); + +#endif // INCLUDED_SFX2_QUERYSAVEDOCUMENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/StyleManager.hxx b/include/sfx2/StyleManager.hxx new file mode 100644 index 000000000..625c9350b --- /dev/null +++ b/include/sfx2/StyleManager.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/. + */ + +#ifndef INCLUDED_SFX2_STYLEMANAGER_HXX +#define INCLUDED_SFX2_STYLEMANAGER_HXX + +#include + +#include + +#include + +class OutputDevice; +class SfxObjectShell; +namespace sfx2 { class StylePreviewRenderer; } + +namespace sfx2 +{ + +class SFX2_DLLPUBLIC StyleManager +{ +protected: + SfxObjectShell& mrShell; + +public: + StyleManager(SfxObjectShell& rShell) + : mrShell(rShell) + {} + + virtual ~StyleManager() + {} + + SfxStyleSheetBase* Search(const OUString& rStyleName, SfxStyleFamily eFamily); + + virtual std::unique_ptr CreateStylePreviewRenderer( + OutputDevice& rOutputDev, SfxStyleSheetBase* pStyle, + long nMaxHeight) = 0; +}; + +} // end namespace sfx2 + +#endif //INCLUDED_SFX2_STYLEMANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/StylePreviewRenderer.hxx b/include/sfx2/StylePreviewRenderer.hxx new file mode 100644 index 000000000..3065c8b31 --- /dev/null +++ b/include/sfx2/StylePreviewRenderer.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/. + */ + +#ifndef INCLUDED_SFX2_STYLEPREVIEWRENDERER_HXX +#define INCLUDED_SFX2_STYLEPREVIEWRENDERER_HXX + +#include +#include + +class OutputDevice; +class SfxStyleSheetBase; + +namespace sfx2 +{ + +class SFX2_DLLPUBLIC StylePreviewRenderer +{ +protected: + const SfxObjectShell& mrShell; + OutputDevice& mrOutputDev; + SfxStyleSheetBase* mpStyle; + long mnMaxHeight; + +public: + enum class RenderAlign + { + TOP, CENTER + }; + + StylePreviewRenderer(const SfxObjectShell& rShell, + OutputDevice& rOutputDev, + SfxStyleSheetBase* pStyle, + long nMaxHeight) + : mrShell(rShell) + , mrOutputDev(rOutputDev) + , mpStyle(pStyle) + , mnMaxHeight(nMaxHeight) + {} + + virtual ~StylePreviewRenderer() + {} + + virtual bool recalculate() = 0; + virtual bool render(const tools::Rectangle& aRectangle, RenderAlign eRenderAlign = RenderAlign::CENTER) = 0; +}; + +} // end namespace sfx2 + +#endif // INCLUDED_SVX_STYLEPREVIEWRENDERER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/XmlIdRegistry.hxx b/include/sfx2/XmlIdRegistry.hxx new file mode 100644 index 000000000..7cae9df1e --- /dev/null +++ b/include/sfx2/XmlIdRegistry.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 . + */ + +#ifndef INCLUDED_SFX2_XMLIDREGISTRY_HXX +#define INCLUDED_SFX2_XMLIDREGISTRY_HXX + +#include + +#include +#include + +namespace com::sun::star::beans { struct StringPair; } +namespace com::sun::star::uno { template class Reference; } + +namespace com::sun::star::rdf { + class XMetadatable; +} + +namespace sfx2 { + +// XML ID utilities -------------------------------------------------- + +/** is i_rIdref a valid NCName ? */ +bool SFX2_DLLPUBLIC isValidNCName(OUString const & i_rIdref); + +bool SFX2_DLLPUBLIC isValidXmlId(OUString const & i_rStreamName, + OUString const & i_rIdref); + +// XML ID handling --------------------------------------------------- + +/** interface for getElementByMetadataReference; + for use by sfx2::DocumentMetadataAccess + */ +class SFX2_DLLPUBLIC IXmlIdRegistry +{ + +public: + virtual ~IXmlIdRegistry() { } + + virtual css::uno::Reference< css::rdf::XMetadatable > + GetElementByMetadataReference( + const css::beans::StringPair & i_rXmlId) const = 0; + +}; + +} // namespace sfx2 + +#endif // INCLUDED_SFX2_XMLIDREGISTRY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx new file mode 100644 index 000000000..f08855ee8 --- /dev/null +++ b/include/sfx2/app.hxx @@ -0,0 +1,235 @@ +/* -*- 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_APP_HXX +#define INCLUDED_SFX2_APP_HXX + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace com::sun::star::script { class XLibraryContainer; } + +namespace weld { class Window; } + +class BasicManager; +class DdeService; +struct SfxChildWinContextFactory; +class SfxAppData_Impl; +class SfxChildWinFactArr_Impl; +class SfxDispatcher; +class SfxEventHint; +class SfxItemSet; +class SfxObjectShell; +class SfxObjectShellArr_Impl; +class SfxObjectShellLock; +class SfxProgress; +class SfxSlotPool; +class SfxStbCtrlFactArr_Impl; +class SfxTbxCtrlFactArr_Impl; +class SfxViewFrame; +class SfxViewFrameArr_Impl; +class SfxViewShellArr_Impl; +class StarBASIC; +class SfxWorkWindow; +class SfxFilterMatcher; +class SfxModule; +namespace vcl { class Window; } +struct SfxChildWinFactory; +struct SfxStbCtrlFactory; +struct SfxTbxCtrlFactory; +class SbxArray; +class SbxValue; + +namespace sfx2 +{ + namespace sidebar { + class Theme; + } +} + +enum class SfxToolsModule +{ + Math = 0, + Calc = 1, + Draw = 2, + Writer = 3, + Basic = 4, + LAST = Basic +}; + +class SFX2_DLLPUBLIC SfxLinkItem final : public SfxPoolItem +{ + Link aLink; +public: + SfxLinkItem( sal_uInt16 nWhichId, const Link& rValue ) : SfxPoolItem( nWhichId ) + { aLink = rValue; } + + virtual SfxLinkItem* Clone( SfxItemPool* = nullptr ) const override + { return new SfxLinkItem( *this ); } + virtual bool operator==( const SfxPoolItem& rL) const override + { return static_cast(rL).aLink == aLink; } + const Link& + GetValue() const { return aLink; } +}; + +// This is a singleton class. Sad that there apparently is no other +// way than a comment like this to indicate that to the code reader. +class SFX2_DLLPUBLIC SfxApplication final : public SfxShell +{ + std::unique_ptr pImpl; + + DECL_DLLPRIVATE_STATIC_LINK( SfxApplication, GlobalBasicErrorHdl_Impl, StarBASIC*, bool ); + + void Deinitialize(); + +public: + SFX_DECL_INTERFACE(SFX_INTERFACE_SFXAPP) + +private: + /// SfxInterface initializer. + static void InitInterface_Impl(); + SfxApplication(); + +public: + virtual ~SfxApplication() override; + static SfxApplication* GetOrCreate(); + static SfxApplication* Get(); + + // DDE +#if defined(_WIN32) + static long DdeExecute( const OUString& rCmd ); +#endif + bool InitializeDde(); + const DdeService* GetDdeService() const; + DdeService* GetDdeService(); +#if defined(_WIN32) + void AddDdeTopic( SfxObjectShell* ); +#endif + void RemoveDdeTopic( SfxObjectShell const * ); + + // "static" methods + /** + * @param pArgs Takes ownership + */ + ErrCode LoadTemplate( SfxObjectShellLock& xDoc, const OUString& rFileName, std::unique_ptr pArgs ); + vcl::Window* GetTopWindow() const; + + // members + SfxFilterMatcher& GetFilterMatcher(); + SfxProgress* GetProgress() const; + sal_uInt16 GetFreeIndex(); + void ReleaseIndex(sal_uInt16 i); + + // Basic/Scripting + static bool IsXScriptURL( const OUString& rScriptURL ); + static OUString ChooseScript(weld::Window *pParent); + static void MacroOrganizer(weld::Window* pParent, sal_Int16 nTabId); + static ErrCode CallBasic( const OUString&, BasicManager*, SbxArray *pArgs, SbxValue *pRet ); + static ErrCode CallAppBasic( const OUString& i_macroName ) + { return CallBasic( i_macroName, SfxApplication::GetBasicManager(), nullptr, nullptr ); } + static BasicManager* GetBasicManager(); + css::script::XLibraryContainer * GetDialogContainer(); + css::script::XLibraryContainer * GetBasicContainer(); + static StarBASIC* GetBasic(); + void SaveBasicAndDialogContainer() const; + + // misc. + void GetOptions(SfxItemSet &); + void SetOptions(const SfxItemSet &); + virtual void Invalidate(sal_uInt16 nId = 0) override; + void NotifyEvent(const SfxEventHint& rEvent, bool bSynchron = true ); + bool IsDowning() const; + void ResetLastDir(); + + SAL_DLLPRIVATE SfxDispatcher* GetAppDispatcher_Impl(); + SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl(); + + SAL_DLLPRIVATE void SetOptions_Impl(const SfxItemSet &); + SAL_DLLPRIVATE void Initialize_Impl(); + + SAL_DLLPRIVATE SfxAppData_Impl* Get_Impl() const { return pImpl.get(); } + + // Object-Factories/global arrays + SAL_DLLPRIVATE void RegisterChildWindow_Impl(SfxModule*, std::unique_ptr); + SAL_DLLPRIVATE void RegisterChildWindowContext_Impl(SfxModule*, sal_uInt16, std::unique_ptr); + SAL_DLLPRIVATE void RegisterStatusBarControl_Impl(SfxModule*, const SfxStbCtrlFactory&); + SAL_DLLPRIVATE void RegisterToolBoxControl_Impl( SfxModule*, const SfxTbxCtrlFactory&); + SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl& GetTbxCtrlFactories_Impl() const; + SAL_DLLPRIVATE SfxStbCtrlFactArr_Impl& GetStbCtrlFactories_Impl() const; + SAL_DLLPRIVATE SfxChildWinFactArr_Impl& GetChildWinFactories_Impl() const; + SAL_DLLPRIVATE SfxViewFrameArr_Impl& GetViewFrames_Impl() const; + SAL_DLLPRIVATE SfxViewShellArr_Impl& GetViewShells_Impl() const; + SAL_DLLPRIVATE SfxObjectShellArr_Impl& GetObjectShells_Impl() const; + SAL_DLLPRIVATE void SetViewFrame_Impl(SfxViewFrame *pViewFrame); + + // Slot Methods + // TODO/CLEANUP: still needed? + SAL_DLLPRIVATE void NewDocDirectExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void NewDocExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void OpenDocExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void OpenRemoteExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void SignPDFExec_Impl(SfxRequest&); + SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &); + SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &); + SAL_DLLPRIVATE static void PropExec_Impl(SfxRequest const &); + SAL_DLLPRIVATE static void PropState_Impl(SfxItemSet &); + SAL_DLLPRIVATE void OfaExec_Impl(SfxRequest &); + SAL_DLLPRIVATE static void OfaState_Impl(SfxItemSet &); + + SAL_DLLPRIVATE void SetProgress_Impl(SfxProgress *); + SAL_DLLPRIVATE const OUString& GetLastDir_Impl() const; + SAL_DLLPRIVATE void SetLastDir_Impl( const OUString & ); + + SAL_DLLPRIVATE static void Registrations_Impl(); + SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl(const SfxViewFrame *pFrame) const; + + // TODO/CLEANUP: still needed? -- unclear whether this comment + // refers to the GetDisabledSlotList_Impl() method which was + // already removed, or the below methods? + SAL_DLLPRIVATE SfxSlotPool& GetAppSlotPool_Impl() const; + SAL_DLLPRIVATE static SfxModule* GetModule_Impl(); + + static void SetModule(SfxToolsModule nSharedLib, std::unique_ptr pModule); + static SfxModule* GetModule(SfxToolsModule nSharedLib); + + static bool loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWidth); + + /** loads the application logo as used in the impress slideshow pause screen */ + static BitmapEx GetApplicationLogo(long nWidth); + + /** this Theme contains Images so must be deleted before DeInitVCL */ + sfx2::sidebar::Theme & GetSidebarTheme(); +}; + +inline SfxApplication* SfxGetpApp() +{ + return SfxApplication::Get(); +} + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx new file mode 100644 index 000000000..92da31ed1 --- /dev/null +++ b/include/sfx2/basedlgs.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 . + */ +#ifndef INCLUDED_SFX2_BASEDLGS_HXX +#define INCLUDED_SFX2_BASEDLGS_HXX + +#include +#include +#include +#include +#include + +class SfxTabPage; +class SfxBindings; +class SfxChildWindow; +struct SfxChildWinInfo; +class SfxItemSet; +class Timer; + +class SFX2_DLLPUBLIC SfxDialogController : public weld::GenericDialogController +{ +private: + DECL_DLLPRIVATE_STATIC_LINK(SfxDialogController, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*); + + DECL_DLLPRIVATE_LINK(FocusChangeHdl, weld::Widget&, void); + +public: + SfxDialogController(weld::Widget* pParent, const OUString& rUIFile, const OString& rDialogId); + // dialog gets focus + virtual void Activate() {} + // dialog loses focus + virtual void Deactivate() {} + + // when the dialog has an associated SfxChildWin, typically for Modeless interaction + virtual void ChildWinDispose() {} // called from the associated SfxChildWin dtor + virtual void Close() {} // called by the SfxChildWin when the dialog is closed + virtual void EndDialog(); // called by the SfxChildWin to close the dialog +}; + +class SfxModelessDialog_Impl; + +class SFX2_DLLPUBLIC SfxModelessDialogController : public SfxDialogController +{ + SfxBindings* m_pBindings; + std::unique_ptr m_xImpl; + + SfxModelessDialogController(SfxModelessDialogController&) = delete; + void operator =(SfxModelessDialogController&) = delete; + + void Init(SfxBindings *pBindinx, SfxChildWindow *pCW); + +protected: + SfxModelessDialogController(SfxBindings*, SfxChildWindow* pChildWin, + weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID); + +public: + virtual ~SfxModelessDialogController() override; + + void Initialize (SfxChildWinInfo const * pInfo); + bool IsClosing() const; + virtual void Close() override; + virtual void EndDialog() override; + virtual void Activate() override; + virtual void Deactivate() override; + virtual void ChildWinDispose() override; + virtual void FillInfo(SfxChildWinInfo&) const; + SfxBindings& GetBindings() const { return *m_pBindings; } +}; + +typedef const sal_uInt16* (*GetTabPageRanges)(); // provides international Which values + +class SFX2_DLLPUBLIC SfxOkDialogController : public SfxDialogController +{ +public: + SfxOkDialogController(weld::Widget* pParent, const OUString& rUIXMLDescription, + const OString& rID) + : SfxDialogController(pParent, rUIXMLDescription, rID) + { + } + + virtual weld::Button& GetOKButton() const = 0; + virtual const SfxItemSet* GetExampleSet() const = 0; +}; + +class SFX2_DLLPUBLIC SfxSingleTabDialogController : public SfxOkDialogController +{ +private: + std::unique_ptr m_xOutputSet; + const SfxItemSet* m_pInputSet; + +public: + SfxSingleTabDialogController(weld::Widget* pParent, const SfxItemSet* pOptionsSet, + const OUString& rUIXMLDescription = OUString("sfx/ui/singletabdialog.ui"), + const OString& rID = OString("SingleTabDialog")); + + weld::Container* get_content_area() { return m_xContainer.get(); } + + virtual ~SfxSingleTabDialogController() override; + + void SetTabPage(std::unique_ptr xTabPage); + SfxTabPage* GetTabPage() const { return m_xSfxPage.get(); } + + virtual weld::Button& GetOKButton() const override { return *m_xOKBtn; } + virtual const SfxItemSet* GetExampleSet() const override { return nullptr; } + + const SfxItemSet* GetOutputItemSet() const { return m_xOutputSet.get(); } + const SfxItemSet* GetInputItemSet() const { return m_pInputSet; } + +protected: + std::unique_ptr m_xSfxPage; + std::unique_ptr m_xContainer; + std::unique_ptr m_xOKBtn; + std::unique_ptr m_xHelpBtn; + + void CreateOutputItemSet(const SfxItemSet& rInput); + void SetInputSet(const SfxItemSet* pInSet) { m_pInputSet = pInSet; } + DECL_DLLPRIVATE_LINK(OKHdl_Impl, weld::Button&, void); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/bindings.hxx b/include/sfx2/bindings.hxx new file mode 100644 index 000000000..28b4d5248 --- /dev/null +++ b/include/sfx2/bindings.hxx @@ -0,0 +1,197 @@ +/* -*- 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_BINDINGS_HXX +#define INCLUDED_SFX2_BINDINGS_HXX + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace com::sun::star::frame { class XDispatch; } +namespace com::sun::star::frame { class XDispatchProvider; } +namespace com::sun::star::frame { class XDispatchRecorder; } +namespace com::sun::star::frame { class XFrame; } +namespace com::sun::star::util { struct URL; } + +class SfxSlot; +class SfxSlotServer; +class SfxControllerItem; +class SfxStateCache; +class SfxItemSet; +class SfxDispatcher; +class SfxBindings_Impl; +class Timer; +class SfxWorkWindow; +struct SfxFoundCache_Impl; +class SfxFoundCacheArr_Impl; + +enum class SfxCallMode : sal_uInt16 +{ + SLOT = 0x00, // sync/async from Slot + SYNCHRON = 0x01, // synchronously in the same Stackframe + ASYNCHRON = 0x02, // asynchronously via AppEvent + RECORD = 0x04, // take into account while recording + API = 0x08 // API call (silent) +}; + +namespace o3tl { + +template<> struct typed_flags: is_typed_flags +{}; + +} + +class SFX2_DLLPUBLIC SfxBindings: public SfxBroadcaster + +/* [Description] + + In each SFx application one instance of the SfxBindings-Class will + exists from until . + This instance is automatically created and destroyed by SfxApplication. + However these instances will be handled by the Macro + or the associated . + + The SfxBindings manages all of its Slot-Ids bound by the registered + controllers and keeps a cache of the respectively. + (it is what we call the combination of SfxShell instance and SfxSlot). + In the SfxBindings it is stored, if and in this case which controllers + that are dirty and which Slot-Server-Caches are dirty respectively. + It summarizes status queries (calls to the status methods specified + in the IDL) that are served by the same state methods, and handles + the simulation of . +*/ + +{ +friend class SfxApplication; +friend class SfxShell; +friend class SfxBindings_Impl; + + std::unique_ptr< SfxBindings_Impl> pImpl; // Data of the Bindings instance + SfxDispatcher* pDispatcher; // Dispatcher, to be used + sal_uInt16 nRegLevel; // Lock-Level while Reconfig + +private: + SAL_DLLPRIVATE const SfxPoolItem* Execute_Impl( sal_uInt16 nSlot, const SfxPoolItem **pArgs, sal_uInt16 nModi, + SfxCallMode nCall, const SfxPoolItem **pInternalArgs, bool bGlobalOnly=false); + SAL_DLLPRIVATE void SetSubBindings_Impl( SfxBindings* ); + SAL_DLLPRIVATE void UpdateSlotServer_Impl(); // Update SlotServer + SAL_DLLPRIVATE std::unique_ptr CreateSet_Impl(SfxStateCache& rCache, const SfxSlot* &pRealSlot, + const SfxSlotServer**, SfxFoundCacheArr_Impl&); + SAL_DLLPRIVATE std::size_t GetSlotPos( sal_uInt16 nId, std::size_t nStartSearchAt = 0 ); + SAL_DLLPRIVATE void Update_Impl(SfxStateCache& rCache); + static SAL_DLLPRIVATE void UpdateControllers_Impl( + const SfxFoundCache_Impl& rFound, + const SfxPoolItem *pItem, + SfxItemState eItemState ); + SAL_DLLPRIVATE SfxStateCache* GetStateCache( sal_uInt16 nId, std::size_t * pPos); + DECL_DLLPRIVATE_LINK( NextJob, Timer *, void ); + SAL_DLLPRIVATE bool NextJob_Impl(Timer const * pTimer); + +public: + SfxBindings(); + virtual ~SfxBindings() override; + + void HidePopups( bool bHide = true ); + + void SetDispatcher(SfxDispatcher *pDisp); + + void Update( sal_uInt16 nId ); // For example, from Menu::Activate + void Update(); + SAL_DLLPRIVATE void StartUpdate_Impl(bool bComplete=false); + void Invalidate( sal_uInt16 nId ); + void Invalidate( const sal_uInt16* pIds ); + void InvalidateShell( const SfxShell &rSh, bool bDeep = false ); + void InvalidateAll( bool bWithMsg ); + void SetState( const SfxItemSet &rSet ); + void SetState( const SfxPoolItem &rItem ); + void Invalidate( sal_uInt16 nId, bool bWithItem, bool bWithMsg=false); + bool IsInUpdate() const; + void SetVisibleState( sal_uInt16 nId, bool bShow ); + + SfxStateCache* GetStateCache( sal_uInt16 nId); + SAL_DLLPRIVATE SfxStateCache* GetAnyStateCache_Impl( sal_uInt16 nId ); + /** + * @param rpState the caller has to delete the pointer + */ + SfxItemState QueryState( sal_uInt16 nSID, std::unique_ptr &rpState ); + + void QueryControlState ( sal_uInt16 nSID, boost::property_tree::ptree& rState ); + + const SfxPoolItem* ExecuteSynchron( sal_uInt16 nSlot, + const SfxPoolItem **pArgs = nullptr); + bool Execute( sal_uInt16 nSlot, + const SfxPoolItem **pArgs = nullptr, + SfxCallMode nCall = SfxCallMode::SLOT); + + SAL_DLLPRIVATE void SetDispatchProvider_Impl( const css::uno::Reference< css::frame::XDispatchProvider > & rFrame ); + void SetActiveFrame( const css::uno::Reference< css::frame::XFrame > & rFrame ); + css::uno::Reference< css::frame::XFrame > GetActiveFrame() const; + // Reconfig + sal_uInt16 EnterRegistrations(const char *pFile = nullptr, int nLine = 0); + void LeaveRegistrations( const char *pFile = nullptr, int nLine = 0 ); + void Register( SfxControllerItem& rBinding ); + void Release( SfxControllerItem& rBinding ); + SfxDispatcher* GetDispatcher() const + { return pDispatcher; } + const css::uno::Reference< css::frame::XDispatchRecorder >& GetRecorder() const; + css::uno::Reference < css::frame::XDispatch > + GetDispatch( const SfxSlot*, const css::util::URL& aURL, bool bMasterCommand ); + SAL_DLLPRIVATE void ContextChanged_Impl(); + SAL_DLLPRIVATE void Execute_Impl( SfxRequest& rReq, const SfxSlot* pSlot, SfxShell* pShell ); + SAL_DLLPRIVATE void DeleteControllers_Impl(); + SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() { return pDispatcher; } + SAL_DLLPRIVATE void ClearCache_Impl( sal_uInt16 nSlotId ); + SAL_DLLPRIVATE void RegisterInternal_Impl( SfxControllerItem& rBinding ); + SAL_DLLPRIVATE void Register_Impl( SfxControllerItem& rBinding, bool ); + SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const; + SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* ); + SAL_DLLPRIVATE SfxBindings* GetSubBindings_Impl() const; + SAL_DLLPRIVATE void SetRecorder_Impl( css::uno::Reference< css::frame::XDispatchRecorder > const & ); + SAL_DLLPRIVATE void InvalidateSlotsInMap_Impl(); + SAL_DLLPRIVATE void AddSlotToInvalidateSlotsMap_Impl( sal_uInt16 nId ); +}; + +#ifdef DBG_UTIL +#define ENTERREGISTRATIONS() EnterRegistrations(__FILE__, __LINE__) +#define LEAVEREGISTRATIONS() LeaveRegistrations(__FILE__, __LINE__) +#define DENTERREGISTRATIONS() \ + EnterRegistrations( OStringBuffer(__FILE__).append('(').append(reinterpret_cast(this)).append(')').getStr(), __LINE__ ) +#define DLEAVEREGISTRATIONS( ) \ + LeaveRegistrations( OStringBuffer(__FILE__).append('(').append(reinterpret_cast(this)).append(')').getStr(), __LINE__ ) +#else +#define ENTERREGISTRATIONS() EnterRegistrations() +#define LEAVEREGISTRATIONS() LeaveRegistrations() +#define DENTERREGISTRATIONS() EnterRegistrations() +#define DLEAVEREGISTRATIONS() LeaveRegistrations() +#endif + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/brokenpackageint.hxx b/include/sfx2/brokenpackageint.hxx new file mode 100644 index 000000000..8f6b4a580 --- /dev/null +++ b/include/sfx2/brokenpackageint.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/. + * + * 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_BROKENPACKAGEINT_HXX +#define INCLUDED_SFX2_BROKENPACKAGEINT_HXX + +#include +#include +#include + +#include + +namespace com::sun::star::task { class XInteractionRequest; } + +class RequestPackageReparation_Impl; +class SFX2_DLLPUBLIC RequestPackageReparation +{ + rtl::Reference mxImpl; +public: + RequestPackageReparation( const OUString& aName ); + ~RequestPackageReparation(); + RequestPackageReparation( const RequestPackageReparation&) = delete; + RequestPackageReparation& operator=( const RequestPackageReparation&) = delete; + bool isApproved() const; + css::uno::Reference < css::task::XInteractionRequest > GetRequest(); +}; + +class NotifyBrokenPackage_Impl; +class SFX2_DLLPUBLIC NotifyBrokenPackage +{ + rtl::Reference mxImpl; +public: + NotifyBrokenPackage( const OUString& aName ); + ~NotifyBrokenPackage(); + NotifyBrokenPackage( const NotifyBrokenPackage&) = delete; + NotifyBrokenPackage& operator=( const NotifyBrokenPackage&) = delete; + css::uno::Reference < css::task::XInteractionRequest > GetRequest(); +}; + +#endif // INCLUDED_SFX2_BROKENPACKAGEINT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/chalign.hxx b/include/sfx2/chalign.hxx new file mode 100644 index 000000000..d63646ea1 --- /dev/null +++ b/include/sfx2/chalign.hxx @@ -0,0 +1,55 @@ +/* -*- 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_CHALIGN_HXX +#define INCLUDED_SFX2_CHALIGN_HXX + +// New order: first, navigation bar, then vertically docked child windows +// (Explorer!), then horizontally docked child windows (Browser!), +// then the format bar, status bar, and at the end of the toolbar. + +enum class SfxChildAlignment +{ + HIGHESTTOP, // for example Navigation bar + LOWESTBOTTOM, + FIRSTLEFT, + LASTRIGHT, + LEFT, // for example SplitWindow + RIGHT, + LASTLEFT, + FIRSTRIGHT, + TOP, // for example Hyperlink-Builder, SplitWindow + BOTTOM, // for example SplitWindow + TOOLBOXTOP, // for example Object bar + TOOLBOXBOTTOM, + LOWESTTOP, // for example Calc bar + HIGHESTBOTTOM, // for example Status bar + TOOLBOXLEFT, // for example Tool bar + TOOLBOXRIGHT, + NOALIGNMENT // all FloatingWindows +}; + +// Verifies that a valid alignment is used +inline bool SfxChildAlignValid( SfxChildAlignment eAlign ) +{ + return ( eAlign >= SfxChildAlignment::HIGHESTTOP && eAlign <= SfxChildAlignment::NOALIGNMENT ); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/charmappopup.hxx b/include/sfx2/charmappopup.hxx new file mode 100644 index 000000000..e9bb6244b --- /dev/null +++ b/include/sfx2/charmappopup.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 . + */ + +#ifndef INCLUDED_SFX2_INC_CHARMAPPOPUP_HXX +#define INCLUDED_SFX2_INC_CHARMAPPOPUP_HXX + +#include +#include + +class CharmapPopup final : public svt::PopupWindowController +{ +public: + CharmapPopup(const css::uno::Reference& rContext); + virtual ~CharmapPopup() override; + + virtual VclPtr createVclPopupWindow( vcl::Window* pParent ) override; + virtual std::unique_ptr weldPopupWindow() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/charwin.hxx b/include/sfx2/charwin.hxx new file mode 100644 index 000000000..26337be09 --- /dev/null +++ b/include/sfx2/charwin.hxx @@ -0,0 +1,75 @@ +/* -*- 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_CHARWIN_HXX +#define INCLUDED_SFX2_INC_CHARWIN_HXX + +#include +#include +#include +#include + +class SFX2_DLLPUBLIC SvxCharView final : public weld::CustomWidgetController +{ +private: + VclPtr mxVirDev; + long mnY; + Point maPosition; + vcl::Font maFont; + bool maHasInsert; + OUString m_sText; + + Link maMouseClickHdl; + Link maClearClickHdl; + Link maClearAllClickHdl; + + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + virtual void Resize() override; + virtual bool MouseButtonDown(const MouseEvent&) override; + virtual void GetFocus() override; + virtual void LoseFocus() override; + virtual bool KeyInput(const KeyEvent&) override; + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; +public: + SvxCharView(const VclPtr& rVirDev); + + void SetFont( const vcl::Font& rFont ); + vcl::Font const & GetFont() const { return maFont; } + void SetText( const OUString& rText ); + OUString const & GetText() const { return m_sText; } + void SetHasInsert( bool bInsert ); + void InsertCharToDoc(); + + void createContextMenu(); + + Size get_preferred_size() const { return GetDrawingArea()->get_preferred_size(); } + + void connect_focus_in(const Link& rLink); + void connect_focus_out(const Link& rLink); + + void setMouseClickHdl(const Link &rLink); + void setClearClickHdl(const Link &rLink); + void setClearAllClickHdl(const Link &rLink); + + void ContextMenuSelect(const OString& rIdent); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx new file mode 100644 index 000000000..3a945b47b --- /dev/null +++ b/include/sfx2/childwin.hxx @@ -0,0 +1,312 @@ +/* -*- 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_CHILDWIN_HXX +#define INCLUDED_SFX2_CHILDWIN_HXX + +#include +#include + +#include +#include +#include +#include + +#include +#include + +namespace com::sun::star::frame { class XFrame; } + +class SfxWorkWindow; +class SfxModule; +class SfxChildWindow; +class SfxChildWindowContext; +class SfxBindings; +class SfxModelessDialogController; + +enum class SfxChildWindowFlags +{ + NONE = 0x000, + FORCEDOCK = 0x004, // Float forbidden + TASK = 0x010, // ChildWindow inside the Task + CANTGETFOCUS = 0x020, // ChildWindow can not get focus + ALWAYSAVAILABLE = 0x040, // ChildWindow is never disabled + NEVERHIDE = 0x080, // ChildWindow is always visible + NEVERCLONE = 0x100, // ChildWindow is not recreated in new view +}; + +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} + + +#define CHILDWIN_NOPOS USHRT_MAX + +// ChildWindow Configuration +struct SAL_DLLPUBLIC_RTTI SfxChildWinInfo +{ + bool bVisible; + Point aPos; + Size aSize; + SfxChildWindowFlags nFlags; + OUString aExtraString; + OUString aModule; + OString aWinState; + + SfxChildWinInfo() + { + bVisible = false; + nFlags = SfxChildWindowFlags::NONE; + } + bool GetExtraData_Impl( SfxChildAlignment *pAlign ) const; +}; + +// ChildWindow factory methods +typedef std::unique_ptr (*SfxChildWinCtor)( vcl::Window *pParentWindow, + sal_uInt16 nId, + SfxBindings *pBindings, + SfxChildWinInfo *pInfo); + +// ChildWindowsContexts factory methods +typedef std::unique_ptr (*SfxChildWinContextCtor)( vcl::Window *pParentWindow, + SfxBindings *pBindings, + SfxChildWinInfo *pInfo); +struct SfxChildWinContextFactory +{ + SfxChildWinContextCtor pCtor; // Factory method + sal_uInt16 nContextId; // Identifier for SfxInterface + + SfxChildWinContextFactory( SfxChildWinContextCtor pTheCtor, sal_uInt16 nID ) + : pCtor(pTheCtor) + , nContextId(nID) + {} +}; + +class SfxChildWinContextArr_Impl; + +struct SFX2_DLLPUBLIC SfxChildWinFactory +{ + SfxChildWinCtor pCtor; // Factory method + sal_uInt16 nId; // ChildWindow-Id ( SlotId ) + SfxChildWinInfo aInfo; // Configuration + sal_uInt16 nPos; // Position in UI + std::unique_ptr pArr; // Array for Contexts + + SfxChildWinFactory( SfxChildWinCtor pTheCtor, sal_uInt16 nID, sal_uInt16 n ); + ~SfxChildWinFactory(); +}; + +class FloatingWindow; +struct SfxChildWindow_Impl; +class SFX2_DLLPUBLIC SfxChildWindowContext +{ +friend class SfxChildWindow; + VclPtr pWindow; + sal_uInt16 nContextId; + +protected: + SfxChildWindowContext( sal_uInt16 nId ); + +public: + virtual ~SfxChildWindowContext(); + + void SetWindow( vcl::Window* pWin ) + { pWindow=pWin; } + vcl::Window* GetWindow() const + { return pWindow; } + sal_uInt16 GetContextId() const + { return nContextId; } + + static FloatingWindow* GetFloatingWindow(vcl::Window *pParent); + + static void RegisterChildWindowContext(SfxModule*, sal_uInt16, std::unique_ptr); +}; + +class SFX2_DLLPUBLIC SfxChildWindow +{ + VclPtr pParent; // parent window ( Topwindow ) + sal_uInt16 nType; // ChildWindow-Id + VclPtr pWindow; // actual contents + std::shared_ptr xController; // actual contents + SfxChildAlignment eChildAlignment; // Current css::drawing::Alignment + std::unique_ptr< SfxChildWindow_Impl> pImpl; // Implementation data + std::unique_ptr pContext; // With context-sensitive ChildWindows: + // Another window in pWindow + SAL_DLLPRIVATE void ClearWorkwin(); + +protected: + void SetWindow(const VclPtr& p) { pWindow = p; } + SfxChildWindow(vcl::Window *pParentWindow, sal_uInt16 nId); + +public: + virtual ~SfxChildWindow(); + void Destroy(); + vcl::Window* GetWindow() const + { return pWindow; } + void SetController(std::shared_ptr controller) { xController = controller; } + void ClearController() { xController.reset(); } + std::shared_ptr& GetController() { return xController; } + const std::shared_ptr& GetController() const { return xController; } + vcl::Window* GetParent() const + { return pParent; } + SfxChildAlignment GetAlignment() const + { return eChildAlignment; } + void SetAlignment(SfxChildAlignment eAlign); + virtual void Hide(); + virtual void Show( ShowFlags nFlags ); + sal_uInt16 GetPosition() const; + sal_uInt16 GetType() const + { return nType; } + + void CreateContext( sal_uInt16 nContextId, SfxBindings& ); + sal_uInt16 GetContextId() const + { return pContext ? pContext->GetContextId(): 0; } + + vcl::Window* GetContextWindow() const + { return pContext ? pContext->GetWindow(): nullptr; } + + vcl::Window* GetContextWindow( SfxModule const *pModule ) const; + + virtual SfxChildWinInfo GetInfo() const; + void SaveStatus(const SfxChildWinInfo& rInfo); + + static void RegisterChildWindow(SfxModule*, std::unique_ptr); + + static std::unique_ptr CreateChildWindow( sal_uInt16, vcl::Window*, SfxBindings*, SfxChildWinInfo const &); + void SetHideNotDelete( bool bOn ); + bool IsHideNotDelete() const; + bool IsVisible() const; + void SetWantsFocus( bool ); + bool WantsFocus() const; + + virtual bool QueryClose(); + const css::uno::Reference< css::frame::XFrame >& GetFrame() const; + void SetFrame( const css::uno::Reference< css::frame::XFrame > & ); + + SAL_DLLPRIVATE static void InitializeChildWinFactory_Impl(sal_uInt16, SfxChildWinInfo&); + void SetVisible_Impl( bool bVis ); + SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* ); + SAL_DLLPRIVATE void Activate_Impl(); + + SAL_DLLPRIVATE SfxChildWindowContext* + GetContext_Impl() const + { return pContext.get(); } + SAL_DLLPRIVATE void SetFactory_Impl( SfxChildWinFactory* ); +}; + + +//! The Macro of the future ... +#define SFX_DECL_CHILDWINDOWCONTEXT(Class) \ + static std::unique_ptr CreateImpl(vcl::Window *pParent, \ + SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \ + static void RegisterChildWindowContext(sal_uInt16, SfxModule *pMod=nullptr); \ + +//! The Macro of the future ... +// As a parameter and because of ContextId, CreateImpl must be handed the +// factory. As long as Id is set to 0 and patched in +// SfxChildWindow::CreateContext +#define SFX_IMPL_CHILDWINDOWCONTEXT(Class, MyID) \ + std::unique_ptr Class::CreateImpl( vcl::Window *pParent, \ + SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ + { \ + return std::make_unique(pParent,0,pBindings,pInfo);\ + } \ + void Class::RegisterChildWindowContext(sal_uInt16 nId, SfxModule* pMod) \ + { \ + auto pFact = std::make_unique( \ + Class::CreateImpl, nId ); \ + SfxChildWindowContext::RegisterChildWindowContext(pMod, MyID, std::move(pFact)); \ + } + +#define SFX_DECL_CHILDWINDOW(Class) \ + public : \ + static std::unique_ptr CreateImpl(vcl::Window *pParent, sal_uInt16 nId, \ + SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \ + static void RegisterChildWindow (bool bVisible=false, SfxModule *pMod=nullptr, SfxChildWindowFlags nFlags=SfxChildWindowFlags::NONE); \ + virtual SfxChildWinInfo GetInfo() const override + +#define SFX_DECL_CHILDWINDOW_WITHID(Class) \ + SFX_DECL_CHILDWINDOW(Class); \ + static sal_uInt16 GetChildWindowId ()\ + +#define SFX_IMPL_CHILDWINDOW(Class, MyID) \ + SFX_IMPL_POS_CHILDWINDOW(Class, MyID, CHILDWIN_NOPOS) + +#define SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \ + SFX_IMPL_POS_CHILDWINDOW_WITHID(Class, MyID, CHILDWIN_NOPOS) + +#define SFX_IMPL_POS_CHILDWINDOW(Class, MyID, Pos) \ + std::unique_ptr Class::CreateImpl( vcl::Window *pParent, \ + sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \ + { \ + return std::make_unique(pParent, nId, pBindings, pInfo);\ + } \ + void Class::RegisterChildWindow (bool bVis, SfxModule *pMod, SfxChildWindowFlags nFlags) \ + { \ + auto pFact = std::make_unique( \ + Class::CreateImpl, MyID, Pos ); \ + pFact->aInfo.nFlags |= nFlags; \ + pFact->aInfo.bVisible = bVis; \ + SfxChildWindow::RegisterChildWindow(pMod, std::move(pFact)); \ + } + +#define SFX_IMPL_POS_CHILDWINDOW_WITHID(Class, MyID, Pos) \ + SFX_IMPL_POS_CHILDWINDOW(Class, MyID, Pos) \ + sal_uInt16 Class::GetChildWindowId () \ + { return MyID; } \ + +#define SFX_IMPL_MODELESSDIALOGCONTOLLER(Class, MyID) \ + SFX_IMPL_CHILDWINDOW(Class, MyID) \ + SfxChildWinInfo Class::GetInfo() const \ + { \ + SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ + static_cast(GetController().get())->FillInfo( aInfo ); \ + return aInfo; } + +#define SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(Class, MyID) \ + SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \ + SfxChildWinInfo Class::GetInfo() const \ + { \ + SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ + static_cast(GetController().get())->FillInfo( aInfo ); \ + return aInfo; } + +#define SFX_IMPL_DOCKINGWINDOW(Class, MyID) \ + SFX_IMPL_CHILDWINDOW(Class, MyID) \ + SfxChildWinInfo Class::GetInfo() const \ + { \ + SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ + static_cast(GetWindow())->FillInfo( aInfo ); \ + return aInfo; } + +#define SFX_IMPL_DOCKINGWINDOW_WITHID(Class, MyID) \ + SFX_IMPL_CHILDWINDOW_WITHID(Class, MyID) \ + SfxChildWinInfo Class::GetInfo() const \ + { \ + SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ + static_cast(GetWindow())->FillInfo( aInfo ); \ + return aInfo; } + +bool GetPosSizeFromString( const OUString& rStr, Point& rPos, Size& rSize ); + +bool GetSplitSizeFromString( const OUString& rStr, Size& rSize ); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/classificationhelper.hxx b/include/sfx2/classificationhelper.hxx new file mode 100644 index 000000000..777001fd9 --- /dev/null +++ b/include/sfx2/classificationhelper.hxx @@ -0,0 +1,227 @@ +/* -*- 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_CLASSIFICATIONHELPER_HXX +#define INCLUDED_SFX2_CLASSIFICATIONHELPER_HXX + +#include +#include + +#include +#include +#include + +namespace com::sun::star::beans { class XPropertyContainer; } +namespace com::sun::star::document { class XDocumentProperties; } + +class SfxViewFrame; + +/// Return code of SfxClassificationHelper::CheckPaste(). +enum class SfxClassificationCheckPasteResult +{ + None = 1, + TargetDocNotClassified = 2, + DocClassificationTooLow = 3 +}; + +/// Specifies a policy type, to be used with SetBACName(). Getters always use IntellectualProperty for now. +enum class SfxClassificationPolicyType +{ + ExportControl = 1, + NationalSecurity = 2, + IntellectualProperty = 3 +}; + +/// Shared code to handle Business Authorization Identification and Labeling Scheme (BAILS) properties. +class SFX2_DLLPUBLIC SfxClassificationHelper +{ + class SAL_DLLPRIVATE Impl; + std::unique_ptr m_pImpl; + +public: + /// Does the document have any BAILS properties? + static bool IsClassified(const css::uno::Reference& xDocumentProperties); + /// Checks if pasting from xSource to xDestination would leak information. + static SfxClassificationCheckPasteResult CheckPaste(const css::uno::Reference& xSource, + const css::uno::Reference& xDestination); + /// Wrapper around CheckPaste(): informs the user if necessary and finds out if the paste can be continued or not. + static bool ShowPasteInfo(SfxClassificationCheckPasteResult eResult); + + SfxClassificationHelper(const css::uno::Reference& xDocumentProperties, bool bUseLocalizedPolicy = true); + ~SfxClassificationHelper(); + /// Get the currently selected category for eType. + const OUString& GetBACName(SfxClassificationPolicyType eType) const; + /// Return all possible valid category names, based on the policy. + std::vector GetBACNames(); + /// Return all possible valid category identifiers, based on the policy. + std::vector GetBACIdentifiers(); + /// Get the currently selected category abbreviation for eType. Returns full name if no abbreviation defined. + const OUString& GetAbbreviatedBACName(const OUString& sFullName); + /// Get the currently selected category for the identifier. + OUString GetBACNameForIdentifier(const OUString& sIdentifier); + /// Return all possible valid abbreviated category names, based on the policy. + std::vector GetAbbreviatedBACNames(); + /// Setting this sets all the other properties, based on the policy. + void SetBACName(const OUString& rName, SfxClassificationPolicyType eType); + /// Returns the class with the higher priority (based on sensitivity). + OUString GetHigherClass(const OUString& first, const OUString& second); + /// If GetImpactScale() and GetImpactLevel*() will return something meaningful. + bool HasImpactLevel(); + InfobarType GetImpactLevelType(); + /// Larger value means more confidential. + sal_Int32 GetImpactLevel(); + /// Comparing the GetImpactLevel() result is only meaningful when the impact scale is the same. + OUString GetImpactScale(); + OUString GetDocumentWatermark(); + /// The selected category has some content for the document header. + bool HasDocumentHeader(); + /// The selected category has some content for the document footer. + bool HasDocumentFooter(); + void UpdateInfobar(SfxViewFrame& rViewFrame); + + std::vector const & GetMarkings() const; + std::vector const & GetIntellectualPropertyParts() const; + std::vector const & GetIntellectualPropertyPartNumbers() const; + + /// Does a best-effort conversion of rType to SfxClassificationPolicyType. + static SfxClassificationPolicyType stringToPolicyType(const OUString& rType); + /// Returns the string representation of a SfxClassificationPolicyType element. + static const OUString& policyTypeToString(SfxClassificationPolicyType eType); + + /// Brief text located at the top of each document's pages. + static const OUString& PROP_DOCHEADER(); + /// Brief text located at the bottom of each document's pages. + static const OUString& PROP_DOCFOOTER(); + /// Brief text formatted as a watermark on each document's page. + static const OUString& PROP_DOCWATERMARK(); + /// Get the property prefix for the IntellectualProperty policy type. + static const OUString& PROP_PREFIX_INTELLECTUALPROPERTY(); + + static SfxClassificationPolicyType getPolicyType(); +}; + +namespace sfx +{ + +/// Specifies the origin: either defined by the BAF policy or manual via. the advanced classification dialog +enum class ClassificationCreationOrigin +{ + NONE, + BAF_POLICY, + MANUAL +}; + +class ClassificationKeyCreator +{ +private: + const SfxClassificationPolicyType m_ePolicyType; + const OUString m_sPolicy; + sal_Int32 m_nTextNumber; + sal_Int32 m_nIPPartNumber; + sal_Int32 m_nMarkingNumber; + + OUString const & getPolicyKey() const + { + return m_sPolicy; + } +public: + ClassificationKeyCreator(SfxClassificationPolicyType ePolicyType) + : m_ePolicyType(ePolicyType) + , m_sPolicy(SfxClassificationHelper::policyTypeToString(m_ePolicyType)) + , m_nTextNumber(1) + , m_nIPPartNumber(1) + , m_nMarkingNumber(1) + {} + + OUString makeTextKey() const + { + return getPolicyKey() + "Custom:Text"; + } + + OUString makeNumberedTextKey() + { + return makeTextKey() + ":n" + OUString::number(m_nTextNumber++); + } + + bool isMarkingTextKey(OUString const & aKey) const + { + return aKey.startsWith(makeTextKey()); + } + + OUString makeCategoryNameKey() const + { + return getPolicyKey() + "BusinessAuthorizationCategory:Name"; + } + + bool isCategoryNameKey(OUString const & aKey) const + { + return aKey.startsWith(makeCategoryNameKey()); + } + + OUString makeCategoryIdentifierKey() const + { + return getPolicyKey() + "BusinessAuthorizationCategory:Identifier"; + } + + bool isCategoryIdentifierKey(OUString const & aKey) const + { + return aKey.startsWith(makeCategoryIdentifierKey()); + } + + OUString makeMarkingKey() const + { + return getPolicyKey() + "Custom:Marking"; + } + + OUString makeNumberedMarkingKey() + { + return makeMarkingKey() + ":n" + OUString::number(m_nMarkingNumber++); + } + + bool isMarkingKey(OUString const & aKey) const + { + return aKey.startsWith(makeMarkingKey()); + } + + OUString makeIntellectualPropertyPartKey() const + { + return getPolicyKey() + "Custom:IntellectualPropertyPart"; + } + + OUString makeNumberedIntellectualPropertyPartKey() + { + return makeIntellectualPropertyPartKey() + ":n" + OUString::number(m_nIPPartNumber++); + } + + bool isIntellectualPropertyPartKey(OUString const & aKey) const + { + return aKey.startsWith(makeIntellectualPropertyPartKey()); + } + + OUString makeFullTextualRepresentationKey() const + { + return getPolicyKey() + "Custom:FullTexturalRepresentation"; + } + + /// Classification creation origin key + OUString makeCreationOriginKey() const + { + return getPolicyKey() + "CreationOrigin"; + } +}; + +SFX2_DLLPUBLIC sfx::ClassificationCreationOrigin getCreationOriginProperty( + css::uno::Reference const & rxPropertyContainer, + sfx::ClassificationKeyCreator const & rKeyCreator); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/ctrlitem.hxx b/include/sfx2/ctrlitem.hxx new file mode 100644 index 000000000..489fdb946 --- /dev/null +++ b/include/sfx2/ctrlitem.hxx @@ -0,0 +1,91 @@ +/* -*- 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_CTRLITEM_HXX +#define INCLUDED_SFX2_CTRLITEM_HXX + +#include +#include +#include +#include +#include + +class SfxBindings; + +class SFX2_DLLPUBLIC SfxControllerItem +{ +private: + sal_uInt16 nId; + SfxControllerItem* pNext; // to notify next ControllerItem + SfxBindings* pBindings; + +public: + SfxBindings & GetBindings() { + DBG_ASSERT(pBindings, "no Bindings"); + return *pBindings; + } + const SfxBindings & GetBindings() const { + DBG_ASSERT(pBindings, "no Bindings"); + return *pBindings; + } + + SfxControllerItem(); // for arrays + SfxControllerItem( sal_uInt16 nId, SfxBindings & ); + virtual ~SfxControllerItem(); + virtual void dispose(); + + void Bind( sal_uInt16 nNewId, SfxBindings *); // Register in SfxBindings + void UnBind(); + void ReBind(); + bool IsBound() const; + void ClearCache(); + + SfxControllerItem* GetItemLink(); + SfxControllerItem* ChangeItemLink( SfxControllerItem* pNewLink ); + + void SetId( sal_uInt16 nItemId ); + sal_uInt16 GetId() const { return nId; } + + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState ); + + virtual void GetControlState( sal_uInt16 nSID, boost::property_tree::ptree& ); + + MapUnit GetCoreMetric() const; + + static SfxItemState GetItemState( const SfxPoolItem* pState ); + + SAL_DLLPRIVATE void BindInternal_Impl( sal_uInt16 nNewId, SfxBindings* ); +}; + + +class SFX2_DLLPUBLIC SfxStatusForwarder final : public SfxControllerItem +{ + SfxControllerItem* pMaster; + + virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState ) override; + +public: + SfxStatusForwarder( sal_uInt16 nSlotId, + SfxControllerItem&rMaster ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/dialoghelper.hxx b/include/sfx2/dialoghelper.hxx new file mode 100644 index 000000000..c18545a75 --- /dev/null +++ b/include/sfx2/dialoghelper.hxx @@ -0,0 +1,41 @@ +/* -*- 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_DIALOGHELPER_HXX +#define INCLUDED_SFX2_DIALOGHELPER_HXX + +#include +#include +#include + +class DateTime; +class LocaleDataWrapper; +namespace vcl { class Window; } +class OutputDevice; + +//when two tab pages both have the same basic layout with a preview on the +//right, get both of their non-preview areas to request the same size so that +//the preview appears in the same place in each one so flipping between tabs +//isn't distracting as it jumps around + +Size SFX2_DLLPUBLIC getParagraphPreviewOptimalSize(const OutputDevice& rReference); + +Size SFX2_DLLPUBLIC getDrawPreviewOptimalSize(const OutputDevice& rReference); + +Size SFX2_DLLPUBLIC getPreviewStripSize(const OutputDevice& rReference); + +Size SFX2_DLLPUBLIC getPreviewOptionsSize(const OutputDevice& rReference); + +OUString SFX2_DLLPUBLIC getWidestTime(const LocaleDataWrapper& rWrapper); + +OUString SFX2_DLLPUBLIC formatTime(const DateTime& rDateTime, const LocaleDataWrapper& rWrapper); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx new file mode 100644 index 000000000..09e2473b9 --- /dev/null +++ b/include/sfx2/dinfdlg.hxx @@ -0,0 +1,565 @@ +/* -*- 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_DINFDLG_HXX +#define INCLUDED_SFX2_DINFDLG_HXX + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include +#include + +namespace com::sun::star::beans { struct PropertyValue; } + +namespace com::sun::star { + namespace document { + class XDocumentProperties; + } +} + +struct CustomProperty; +class SvtCalendarBox; + +// class SfxDocumentInfoItem --------------------------------------------- + +class UNLESS_MERGELIBS(SFX2_DLLPUBLIC) SfxDocumentInfoItem final : public SfxStringItem +{ +private: + sal_Int32 m_AutoloadDelay; + OUString m_AutoloadURL; + bool m_isAutoloadEnabled; + OUString m_DefaultTarget; + OUString m_TemplateName; + OUString m_Author; + css::util::DateTime m_CreationDate; + OUString m_ModifiedBy; + css::util::DateTime m_ModificationDate; + OUString m_PrintedBy; + css::util::DateTime m_PrintDate; + sal_Int16 m_EditingCycles; + sal_Int32 m_EditingDuration; + OUString m_Description; + OUString m_Keywords; + OUString m_Subject; + OUString m_Title; + bool m_bHasTemplate; + bool m_bDeleteUserData; + bool m_bUseUserData; + bool m_bUseThumbnailSave; + std::vector< std::unique_ptr > m_aCustomProperties; + css::uno::Sequence< css::document::CmisProperty > m_aCmisProperties; + +public: + static SfxPoolItem* CreateDefault(); + SfxDocumentInfoItem(); + SfxDocumentInfoItem( const OUString &rFileName, + const css::uno::Reference< css::document::XDocumentProperties> & i_xDocProps, + const css::uno::Sequence< css::document::CmisProperty> & i_cmisProps, + bool bUseUserData, bool bUseThumbnailSave ); + SfxDocumentInfoItem( const SfxDocumentInfoItem& ); + virtual ~SfxDocumentInfoItem() override; + + /// update i_xDocProps with the data in this object + void UpdateDocumentInfo( + const css::uno::Reference< css::document::XDocumentProperties> & i_xDocProps, + bool i_bDoNotUpdateUserDefined = false) + const; + bool isCmisDocument() const { return m_aCmisProperties.hasElements();} + + bool isAutoloadEnabled() const { return m_isAutoloadEnabled; } + sal_Int32 getAutoloadDelay() const { return m_AutoloadDelay; } + const OUString& getAutoloadURL() const { return m_AutoloadURL; } + const OUString& getDefaultTarget() const { return m_DefaultTarget; } + const OUString& getTemplateName() const { return m_TemplateName; } + const OUString& getAuthor() const { return m_Author; } + + const css::util::DateTime& + getCreationDate() const { return m_CreationDate; } + const OUString& getModifiedBy() const { return m_ModifiedBy; } + + const css::util::DateTime& + getModificationDate() const { return m_ModificationDate; } + const OUString& getPrintedBy() const { return m_PrintedBy; } + const css::util::DateTime& + getPrintDate() const { return m_PrintDate; } + sal_Int16 getEditingCycles() const { return m_EditingCycles; } + sal_Int32 getEditingDuration() const { return m_EditingDuration; } + const OUString& getDescription() const { return m_Description; } + void setDescription(const OUString& i_val) { m_Description = i_val; } + const OUString& getKeywords() const { return m_Keywords; } + void setKeywords(const OUString& i_val) { m_Keywords = i_val; } + const OUString& getSubject() const { return m_Subject; } + void setSubject(const OUString& i_val) { m_Subject = i_val; } + const OUString& getTitle() const { return m_Title; } + void setTitle(const OUString& i_val) { m_Title = i_val; } + + /// reset user-specific data (author, modified-by, ...) + void resetUserData(const OUString & i_rAuthor); + + void SetTemplate( bool b ) { m_bHasTemplate = b; } + bool HasTemplate() const { return m_bHasTemplate; } + void SetDeleteUserData( bool bSet ); + void SetUseUserData( bool bSet ); + void SetUseThumbnailSave( bool bSet ); + bool IsUseUserData() const { return m_bUseUserData;} + bool IsUseThumbnailSave() const { return m_bUseThumbnailSave;} + + + std::vector< std::unique_ptr > GetCustomProperties() const; + void ClearCustomProperties(); + void AddCustomProperty( const OUString& sName, + const css::uno::Any& rValue ); + + const css::uno::Sequence< css::document::CmisProperty >& + GetCmisProperties() const { return m_aCmisProperties;} + + void SetCmisProperties(const css::uno::Sequence< css::document::CmisProperty >& cmisProps ); + virtual SfxDocumentInfoItem* 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; +}; + +// class SfxDocumentPage ------------------------------------------------- + +class SfxDocumentPage final : public SfxTabPage +{ +private: + OUString m_aUnknownSize; + OUString m_aMultiSignedStr; + + bool bEnableUseUserData : 1, + bHandleDelete : 1; + + std::unique_ptr m_xBmp; + std::unique_ptr m_xNameED; + std::unique_ptr m_xChangePassBtn; + + std::unique_ptr m_xShowTypeFT; + std::unique_ptr m_xFileValEd; + std::unique_ptr m_xShowSizeFT; + + std::unique_ptr m_xCreateValFt; + std::unique_ptr m_xChangeValFt; + std::unique_ptr m_xSignedValFt; + std::unique_ptr m_xSignatureBtn; + std::unique_ptr m_xPrintValFt; + std::unique_ptr m_xTimeLogValFt; + std::unique_ptr m_xDocNoValFt; + + std::unique_ptr m_xUseUserDataCB; + std::unique_ptr m_xDeleteBtn; + std::unique_ptr m_xUseThumbnailSaveCB; + + std::unique_ptr m_xTemplFt; + std::unique_ptr m_xTemplValFt; + + DECL_LINK(DeleteHdl, weld::Button&, void); + DECL_LINK(SignatureHdl, weld::Button&, void); + DECL_LINK(ChangePassHdl, weld::Button&, void); + void ImplUpdateSignatures(); + void ImplCheckPasswordState(); + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet* ) override; + +public: + SfxDocumentPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&); + static std::unique_ptr Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* ); + virtual ~SfxDocumentPage() override; + + void EnableUseUserData(); +}; + +// class SfxDocumentDescPage --------------------------------------------- + +class SfxDocumentDescPage final : public SfxTabPage +{ +private: + SfxDocumentInfoItem* m_pInfoItem; + std::unique_ptr m_xTitleEd; + std::unique_ptr m_xThemaEd; + std::unique_ptr m_xKeywordsEd; + std::unique_ptr m_xCommentEd; + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet* ) override; + +public: + SfxDocumentDescPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&); + virtual ~SfxDocumentDescPage() override; + static std::unique_ptr Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* ); +}; + +// class SfxDocumentInfoDialog ------------------------------------------- + +class SFX2_DLLPUBLIC SfxDocumentInfoDialog final : public SfxTabDialogController +{ + virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; + +public: + SfxDocumentInfoDialog(weld::Window* pParent, const SfxItemSet&); + void AddFontTabPage(); +}; + +// class CustomPropertiesRemoveButton ------------------------------------ +struct CustomPropertyLine; + +class CustomPropertiesDateField +{ +private: + std::unique_ptr m_xDateField; +public: + ::std::optional m_TZ; + + CustomPropertiesDateField(SvtCalendarBox* pDateField); + void set_visible(bool bVisible); + Date get_date() const; + void set_date(const Date& rDate); + ~CustomPropertiesDateField(); +}; + +class CustomPropertiesTimeField +{ +public: + std::unique_ptr m_xTimeField; + bool m_isUTC; + + CustomPropertiesTimeField(std::unique_ptr xTimeField); + void set_visible(bool bVisible) { m_xTimeField->set_visible(bVisible); } + tools::Time get_value() const { return m_xTimeField->get_value(); } + void set_value(const tools::Time& rTime) { m_xTimeField->set_value(rTime); } + ~CustomPropertiesTimeField(); +}; + +class CustomPropertiesDurationField +{ + css::util::Duration m_aDuration; + std::unique_ptr m_xEntry; + std::unique_ptr m_xEditButton; + + DECL_LINK(ClickHdl, weld::Button&, void); +public: + CustomPropertiesDurationField(std::unique_ptr xEntry, + std::unique_ptr xEditButton); + + void SetDuration( const css::util::Duration& rDuration ); + const css::util::Duration& GetDuration() const { return m_aDuration; } + + void set_visible(bool bVisible); +}; + +class CustomPropertiesYesNoButton +{ +private: + std::unique_ptr m_xTopLevel; + std::unique_ptr m_xYesButton; + std::unique_ptr m_xNoButton; + +public: + CustomPropertiesYesNoButton(std::unique_ptr, + std::unique_ptr xYesButton, + std::unique_ptr xNoButton); + ~CustomPropertiesYesNoButton(); + + void CheckYes() { m_xYesButton->set_active(true); } + void CheckNo() { m_xNoButton->set_active(true); } + bool IsYesChecked() const { return m_xYesButton->get_active(); } + void set_visible(bool bVisible) { m_xTopLevel->set_visible(bVisible); } +}; + +class CustomPropertiesWindow; + +// struct CustomPropertyLine --------------------------------------------- +struct CustomPropertyLine +{ + CustomPropertiesWindow* m_pParent; + + std::unique_ptr m_xBuilder; + std::unique_ptr m_xLine; + std::unique_ptr m_xNameBox; + std::unique_ptr m_xTypeBox; + std::unique_ptr m_xValueEdit; + std::unique_ptr m_xDateTimeBox; + std::unique_ptr m_xDateField; + std::unique_ptr m_xTimeField; + std::unique_ptr m_xDurationBox; + std::unique_ptr m_xDurationField; + std::unique_ptr m_xYesNoButton; + std::unique_ptr m_xRemoveButton; + + bool m_bTypeLostFocus; + + CustomPropertyLine(CustomPropertiesWindow* pParent, weld::Widget* pContainer); + DECL_LINK(TypeHdl, weld::ComboBox&, void); + DECL_LINK(RemoveHdl, weld::Button&, void); + DECL_LINK(EditLoseFocusHdl, weld::Widget&, void); + DECL_LINK(BoxLoseFocusHdl, weld::Widget&, void); + + void DoTypeHdl(const weld::ComboBox& rBox); + + void Clear(); + void Hide(); +}; + +// class CustomPropertiesWindow ------------------------------------------ + +class CustomPropertiesWindow +{ +private: + sal_Int32 m_nHeight; + sal_Int32 m_nLineHeight; + sal_Int32 m_nScrollPos; + std::vector> m_aCustomProperties; + std::vector> m_aCustomPropertiesLines; + CustomPropertyLine* m_pCurrentLine; + SvNumberFormatter m_aNumberFormatter; + Idle m_aEditLoseFocusIdle; + Idle m_aBoxLoseFocusIdle; + Link m_aRemovedHdl; + + weld::Container& m_rBody; + weld::Label& m_rHeaderAccName; + weld::Label& m_rHeaderAccType; + weld::Label& m_rHeaderAccValue; + + DECL_LINK(EditTimeoutHdl, Timer *, void); + DECL_LINK(BoxTimeoutHdl, Timer *, void); + + bool IsLineValid( CustomPropertyLine* pLine ) const; + void ValidateLine( CustomPropertyLine* pLine, bool bIsFromTypeBox ); + void CreateNewLine(); + void StoreCustomProperties(); + sal_uInt32 GetCurrentDataModelPosition() const { return -1 * m_nScrollPos / m_nLineHeight; } + +public: + CustomPropertiesWindow(weld::Container& rParent, weld::Label& rHeaderAccName, + weld::Label& rHeaderAccType, weld::Label& rHeaderAccValue); + ~CustomPropertiesWindow(); + + sal_uInt16 GetExistingLineCount() const { return m_aCustomPropertiesLines.size(); } + sal_uInt16 GetTotalLineCount() const { return m_aCustomProperties.size(); } + void SetVisibleLineCount(sal_uInt32 nCount); + sal_Int32 GetHeight() const { return m_nHeight; } + void SetHeight(int nHeight) { m_nHeight = nHeight; } + sal_Int32 GetLineHeight() const { return m_nLineHeight; } + void SetLineHeight(sal_Int32 nLineHeight) { m_nLineHeight = nLineHeight; } + void AddLine( const OUString& sName, css::uno::Any const & rAny ); + bool AreAllLinesValid() const; + void ClearAllLines(); + void DoScroll( sal_Int32 nNewPos ); + void ReloadLinesContent(); + + css::uno::Sequence< css::beans::PropertyValue > + GetCustomProperties(); + void SetCustomProperties(std::vector< std::unique_ptr >&& rProperties); + void SetRemovedHdl( const Link& rLink ) { m_aRemovedHdl = rLink; } + + void BoxLoseFocus(CustomPropertyLine* pLine); + void EditLoseFocus(CustomPropertyLine* pLine); + void Remove(const CustomPropertyLine* pLine); +}; + +// class CustomPropertiesControl ----------------------------------------- + +class CustomPropertiesControl +{ +private: + sal_Int32 m_nThumbPos; + + std::unique_ptr m_xBox; + std::unique_ptr m_xBody; + std::unique_ptr m_xVertScroll; + std::unique_ptr m_xPropertiesWin; + std::unique_ptr m_xName; + std::unique_ptr m_xType; + std::unique_ptr m_xValue; + + DECL_LINK( ResizeHdl, const Size&, void ); + DECL_LINK( ScrollHdl, weld::ScrolledWindow&, void ); + DECL_LINK( RemovedHdl, void*, void ); + +public: + CustomPropertiesControl(); + ~CustomPropertiesControl(); + + void AddLine(css::uno::Any const & rAny); + + bool AreAllLinesValid() const { return m_xPropertiesWin->AreAllLinesValid(); } + void ClearAllLines() { m_xPropertiesWin->ClearAllLines(); } + + css::uno::Sequence + GetCustomProperties() const + { return m_xPropertiesWin->GetCustomProperties(); } + void SetCustomProperties(std::vector< std::unique_ptr >&& rProperties); + + void Init(weld::Builder& rParent); +}; + +// class SfxCustomPropertiesPage ----------------------------------------- + +class SfxCustomPropertiesPage final : public SfxTabPage +{ +private: + DECL_LINK(AddHdl, weld::Button&, void); + + std::unique_ptr m_xPropertiesCtrl; + std::unique_ptr m_xAdd; + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet* ) override; + virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; + +public: + SfxCustomPropertiesPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&); + static std::unique_ptr Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* ); + virtual ~SfxCustomPropertiesPage() override; +}; + +struct CmisValue +{ + std::unique_ptr m_xBuilder; + std::unique_ptr m_xFrame; + std::unique_ptr m_xValueEdit; + + CmisValue(weld::Widget* pParent, const OUString& rStr); +}; + +struct CmisDateTime +{ + std::unique_ptr m_xBuilder; + std::unique_ptr m_xFrame; + std::unique_ptr m_xDateField; + std::unique_ptr m_xTimeField; + + CmisDateTime(weld::Widget* pParent, const css::util::DateTime& rDateTime); +}; + +struct CmisYesNo +{ + std::unique_ptr m_xBuilder; + std::unique_ptr m_xFrame; + std::unique_ptr m_xYesButton; + std::unique_ptr m_xNoButton; + + CmisYesNo(weld::Widget* pParent, bool bValue); +}; + +// struct CmisPropertyLine --------------------------------------------- + +struct CmisPropertyLine +{ + std::unique_ptr m_xBuilder; + OUString m_sId; + OUString m_sType; + bool m_bUpdatable; + bool m_bRequired; + bool m_bMultiValued; + bool m_bOpenChoice; + std::unique_ptr m_xFrame; + std::unique_ptr m_xName; + std::unique_ptr m_xType; + std::vector< std::unique_ptr > m_aValues; + std::vector< std::unique_ptr > m_aDateTimes; + std::vector< std::unique_ptr > m_aYesNos; + CmisPropertyLine(weld::Widget* pParent); + ~CmisPropertyLine(); +}; + +// class CmisPropertiesWindow ------------------------------------------ + +class CmisPropertiesWindow +{ +private: + std::unique_ptr m_xBox; + SvNumberFormatter m_aNumberFormatter; + std::vector< std::unique_ptr > m_aCmisPropertiesLines; +public: + CmisPropertiesWindow(std::unique_ptr xParent); + ~CmisPropertiesWindow(); + + void AddLine( const OUString& sId, const OUString& sName, + const OUString& sType, const bool bUpdatable, + const bool bRequired, const bool bMultiValued, + const bool bOpenChoice, + css::uno::Any& aChoices, + css::uno::Any const & rAny ); + void ClearAllLines(); + + css::uno::Sequence< css::document::CmisProperty > + GetCmisProperties() const; +}; + +// class CmisPropertiesControl ----------------------------------------- + +class CmisPropertiesControl +{ +private: + CmisPropertiesWindow m_aPropertiesWin; + std::unique_ptr m_xScrolledWindow; + +public: + CmisPropertiesControl(weld::Builder& rBuilder); + + void AddLine( const OUString& sId, const OUString& sName, + const OUString& sType, const bool bUpdatable, + const bool bRequired, const bool bMultiValude, + const bool bOpenChoice, + css::uno::Any& aChoices, + css::uno::Any const & rAny ); + + void ClearAllLines(); + css::uno::Sequence< css::document::CmisProperty > + GetCmisProperties() const + { return m_aPropertiesWin.GetCmisProperties(); } +}; + +// class SfxCmisPropertiesPage ------------------------------------------------- + +class SfxCmisPropertiesPage final : public SfxTabPage +{ +private: + std::unique_ptr m_xPropertiesCtrl; + + virtual bool FillItemSet( SfxItemSet* ) override; + virtual void Reset( const SfxItemSet* ) override; + virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; + +public: + SfxCmisPropertiesPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&); + virtual ~SfxCmisPropertiesPage() override; + static std::unique_ptr Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet*); +}; + +#endif // #ifndef _ INCLUDED_SFX2_DINFDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx new file mode 100644 index 000000000..ee46d5c89 --- /dev/null +++ b/include/sfx2/dispatch.hxx @@ -0,0 +1,179 @@ +/* -*- 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_DISPATCH_HXX +#define INCLUDED_SFX2_DISPATCH_HXX + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +class SfxSlotServer; +class SfxRequest; +class SfxViewFrame; +class SfxItemSet; +class SfxModule; +class Point; +struct SfxDispatcher_Impl; + +namespace vcl { class Window; } + +enum class SfxDispatcherPopFlags +{ + NONE = 0, + POP_UNTIL = 4, + POP_DELETE = 2, + PUSH = 1, +}; +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} + +enum class SfxSlotFilterState +{ + DISABLED, + ENABLED, + // enabled even if ReadOnlyDoc + ENABLED_READONLY, +}; + + +class SFX2_DLLPUBLIC SfxDispatcher final +{ + std::unique_ptr xImp; + + // Search for temporary evaluated Todos + SAL_DLLPRIVATE bool CheckVirtualStack( const SfxShell& rShell ); + +friend class SfxApplication; +friend class SfxViewFrame; +friend class SfxBindings; +friend class SfxStateCache; +friend class SfxPopupMenuManager; +friend class SfxHelp; + + DECL_DLLPRIVATE_LINK( EventHdl_Impl, Timer *, void ); + void PostMsgHandler(std::unique_ptr); + + SAL_DLLPRIVATE void Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest &rReq, bool bRecord ); + SAL_DLLPRIVATE void Update_Impl_( bool,bool,bool,SfxWorkWindow*); + + + bool FindServer_( sal_uInt16 nId, SfxSlotServer &rServer ); + bool FillState_( const SfxSlotServer &rServer, + SfxItemSet &rState, const SfxSlot *pRealSlot ); + void Execute_( SfxShell &rShell, const SfxSlot &rSlot, + SfxRequest &rReq, + SfxCallMode eCall); + + void FlushImpl(); + +public: + SfxDispatcher(); + SfxDispatcher( SfxViewFrame *pFrame ); + + SAL_DLLPRIVATE void Construct_Impl(); + + ~SfxDispatcher(); + + const SfxPoolItem* Execute( sal_uInt16 nSlot, + SfxCallMode nCall = SfxCallMode::SLOT, + const SfxPoolItem **pArgs = nullptr, + sal_uInt16 nModi = 0, + const SfxPoolItem **pInternalArgs = nullptr); + + const SfxPoolItem* Execute(sal_uInt16 nSlot, + SfxCallMode nCall, + SfxItemSet const * pArgs, + SfxItemSet const * pInternalArgs, + sal_uInt16 nModi); + + const SfxPoolItem* ExecuteList(sal_uInt16 nSlot, + SfxCallMode nCall, + std::initializer_list args, + std::initializer_list internalargs = std::initializer_list()); + + const SfxPoolItem* Execute( sal_uInt16 nSlot, + SfxCallMode nCall, + const SfxItemSet &rArgs ); + + const SfxSlot* GetSlot( const OUString& rCommand ); + + bool IsActive( const SfxShell& rShell ); + sal_uInt16 GetShellLevel( const SfxShell &rShell ); + SfxBindings* GetBindings() const; + + void Push( SfxShell& rShell ); + void Pop( SfxShell& rShell, SfxDispatcherPopFlags nMode = SfxDispatcherPopFlags::NONE ); + + SfxShell* GetShell(sal_uInt16 nIdx) const; + SfxViewFrame* GetFrame() const; + SfxModule* GetModule() const; + + void ExecutePopup( const OUString &rResName, vcl::Window *pWin = nullptr, const Point *pPos = nullptr ); + static void ExecutePopup( vcl::Window *pWin = nullptr, const Point *pPosPixel = nullptr ); + + bool IsAppDispatcher() const; + bool IsFlushed() const; + void Flush(); + void Lock( bool bLock ); + bool IsLocked() const; + void SetSlotFilter( SfxSlotFilterState nEnable = SfxSlotFilterState::DISABLED, + o3tl::span pSIDs = o3tl::span()); + + void HideUI( bool bHide = true ); + ToolbarId GetObjectBarId( sal_uInt16 nPos ) const; + + SfxItemState QueryState( sal_uInt16 nSID, const SfxPoolItem* &rpState ); + SfxItemState QueryState( sal_uInt16 nSID, css::uno::Any& rAny ); + + void SetDisableFlags( SfxDisableFlags nFlags ); + SfxDisableFlags GetDisableFlags() const; + + SAL_DLLPRIVATE void SetMenu_Impl(); + SAL_DLLPRIVATE void Update_Impl( bool bForce = false ); // ObjectBars etc. + SAL_DLLPRIVATE bool IsUpdated_Impl() const; + SAL_DLLPRIVATE bool GetShellAndSlot_Impl( sal_uInt16 nSlot, SfxShell **ppShell, const SfxSlot **ppSlot, + bool bOwnShellsOnly, bool bRealSlot ); + SAL_DLLPRIVATE void SetReadOnly_Impl( bool bOn ); + SAL_DLLPRIVATE bool GetReadOnly_Impl() const; + SAL_DLLPRIVATE SfxSlotFilterState IsSlotEnabledByFilter_Impl( sal_uInt16 nSID ) const; + SAL_DLLPRIVATE void SetQuietMode_Impl( bool bOn ); + SAL_DLLPRIVATE bool IsReadOnlyShell_Impl( sal_uInt16 nShell ) const; + SAL_DLLPRIVATE void RemoveShell_Impl( SfxShell& rShell ); + SAL_DLLPRIVATE void DoActivate_Impl( bool bMDI ); + SAL_DLLPRIVATE void DoDeactivate_Impl( bool bMDI, SfxViewFrame const * pNew ); + SAL_DLLPRIVATE void InvalidateBindings_Impl(bool); + + static boost::property_tree::ptree fillPopupMenu(Menu* pMenu); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/dllapi.h b/include/sfx2/dllapi.h new file mode 100644 index 000000000..a6877f769 --- /dev/null +++ b/include/sfx2/dllapi.h @@ -0,0 +1,36 @@ +/* -*- 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_DLLAPI_H +#define INCLUDED_SFX2_DLLAPI_H + +#include +#include + +#if defined SFX2_DLLIMPLEMENTATION +#define SFX2_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define SFX2_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#define SFX2_DLLPRIVATE SAL_DLLPRIVATE + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docfac.hxx b/include/sfx2/docfac.hxx new file mode 100644 index 000000000..38716ea34 --- /dev/null +++ b/include/sfx2/docfac.hxx @@ -0,0 +1,96 @@ +/* -*- 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_DOCFAC_HXX +#define INCLUDED_SFX2_DOCFAC_HXX + +#include +#include +#include + +#include +#include +#include + +class SfxFilter; +class SfxViewFactory; +struct SfxObjectFactory_Impl; +class SfxFilterContainer; +class SvGlobalName; +class SfxModule; + +typedef void (*SfxVoidFunc)(); + + +class SFX2_DLLPUBLIC SfxObjectFactory +{ +private: + const OUString m_sFactoryName; + std::unique_ptr pImpl; // Additional Data + +public: + SfxObjectFactory( const SvGlobalName &rName, const OUString& sFactoryName ); + ~SfxObjectFactory(); + + const SvGlobalName& GetClassId() const; + OUString GetFactoryURL() const; // shortcut for "private:factory/GetShortName()" + const OUString& GetFactoryName() const { return m_sFactoryName; } + OUString GetModuleName() const; + SfxFilterContainer *GetFilterContainer() const; + + // Views + void RegisterViewFactory(SfxViewFactory &rFactory); + sal_uInt16 GetViewFactoryCount() const; + SfxViewFactory& GetViewFactory(sal_uInt16 i = 0) const; + + /// returns the view factory whose GetAPIViewName or GetLegacyViewName delivers the requested logical name + SfxViewFactory* GetViewFactoryByViewName( const OUString& i_rViewName ) const; + + // Filter + std::shared_ptr GetTemplateFilter() const; + static OUString GetStandardTemplate( const OUString& rServiceName ); + static void SetStandardTemplate( const OUString& rServiceName, const OUString& rTemplateName ); + static void SetSystemTemplate( const OUString& rServiceName, const OUString& rTemplateName ); + + void SetDocumentServiceName( const OUString& rServiceName ); + const OUString& GetDocumentServiceName() const; + + SfxModule* GetModule() const; + + SAL_DLLPRIVATE void SetModule_Impl( SfxModule* ); + SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const SfxInterfaceId i_nViewId, const sal_uInt16 i_nFallback ) const; + +private: + SfxObjectFactory(const SfxObjectFactory&) = delete; + const SfxObjectFactory& operator=(const SfxObjectFactory &) = delete; +}; + +#define SFX_DECL_OBJECTFACTORY() \ +public: \ + static SfxObjectFactory& Factory(); \ + virtual SfxObjectFactory& GetFactory() const override { return Factory(); } + +#define SFX_IMPL_OBJECTFACTORY(ClassName,GlobName,ShortName) \ + SfxObjectFactory& ClassName::Factory() \ + { \ + static SfxObjectFactory aObjectFactory(GlobName, ShortName); \ + return aObjectFactory; \ + } +#endif // INCLUDED_SFX2_DOCFAC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx new file mode 100644 index 000000000..288634808 --- /dev/null +++ b/include/sfx2/docfile.hxx @@ -0,0 +1,295 @@ +/* -*- 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_DOCFILE_HXX +#define INCLUDED_SFX2_DOCFILE_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace com::sun::star::beans { struct PropertyValue; } +namespace com::sun::star::embed { class XStorage; } +namespace com::sun::star::graphic { class XGraphic; } +namespace com::sun::star::io { class XInputStream; } +namespace com::sun::star::security { class XCertificate; } +namespace com::sun::star::task { class XInteractionHandler; } +namespace com::sun::star::ucb { class XCommandEnvironment; } +namespace com::sun::star::ucb { class XContent; } +namespace com::sun::star::util { struct DateTime; } +namespace com::sun::star::util { struct RevisionTag; } +namespace ucbhelper { class Content; } + +class SvKeyValueIterator; +class SfxFilter; +class SfxMedium_Impl; +class INetURLObject; +class SfxFrame; +class DateTime; + +namespace weld +{ + class Window; +} + +class SFX2_DLLPUBLIC SfxMedium final : public SvRefBase +{ + std::unique_ptr< SfxMedium_Impl > pImpl; + + SAL_DLLPRIVATE void SetIsRemote_Impl(); + SAL_DLLPRIVATE void CloseInStream_Impl(bool bInDestruction = false); + SAL_DLLPRIVATE void CloseOutStream_Impl(); + SAL_DLLPRIVATE void CloseStreams_Impl(bool bInDestruction = false); + + SAL_DLLPRIVATE void SetEncryptionDataToStorage_Impl(); + +public: + + SfxMedium(); + SfxMedium( const OUString &rName, + StreamMode nOpenMode, + std::shared_ptr pFilter = nullptr, + const std::shared_ptr& pSet = nullptr ); + SfxMedium( const OUString &rName, + const OUString &rReferer, + StreamMode nOpenMode, + std::shared_ptr pFilter = nullptr, + const std::shared_ptr& pSet = nullptr ); + SfxMedium( const css::uno::Reference< css::embed::XStorage >& xStorage, + const OUString& rBaseURL, + const std::shared_ptr& pSet = nullptr ); + SfxMedium( const css::uno::Reference< css::embed::XStorage >& xStorage, + const OUString& rBaseURL, + const OUString& rTypeName, + const std::shared_ptr& pSet = nullptr ); + SfxMedium( const css::uno::Sequence< css::beans::PropertyValue >& aArgs ); + + virtual ~SfxMedium() override; + + void UseInteractionHandler( bool ); + css::uno::Reference< css::task::XInteractionHandler > + GetInteractionHandler( bool bGetAlways = false ); + + void setStreamToLoadFrom( + const css::uno::Reference& xInputStream, + bool bIsReadOnly); + + void SetLoadTargetFrame(SfxFrame* pFrame ); + SfxFrame* GetLoadTargetFrame() const; + + /** + * Does not take ownership of pFlt but pFlt needs to be around as long as the SfxMedium instance. + */ + void SetFilter(const std::shared_ptr& pFilter); + const std::shared_ptr& GetFilter() const; + const OUString& GetOrigURL() const; + + SfxItemSet * GetItemSet() const; + void SetArgs(const css::uno::Sequence& rArgs); + css::uno::Sequence GetArgs() const; + void Close(bool bInDestruction = false); + void CloseAndRelease(); + void ReOpen(); + void CompleteReOpen(); + const OUString& GetName() const; + const INetURLObject& GetURLObject() const; + + void CheckFileDate( const css::util::DateTime& aInitDate ); + [[nodiscard]] bool DocNeedsFileDateCheck() const; + css::util::DateTime const & GetInitFileDate( bool bIgnoreOldValue ); + + css::uno::Reference< css::ucb::XContent > GetContent() const; + const OUString& GetPhysicalName() const; + [[nodiscard]] bool IsRemote() const; + [[nodiscard]] bool IsOpen() const; // { return aStorage.Is() || pInStream; } + void Download( const Link& aLink = Link()); + void SetDoneLink( const Link& rLink ); + + ErrCode GetErrorCode() const; + ErrCode GetError() const + { return GetErrorCode().IgnoreWarning(); } + ErrCode const & GetLastStorageCreationState() const; + + void SetError(ErrCode nError); + + void CloseInStream(); + void CloseOutStream(); + + void CloseStorage(); + + StreamMode GetOpenMode() const; + void SetOpenMode( StreamMode nStorOpen, bool bDontClose = false ); + + SvStream* GetInStream(); + SvStream* GetOutStream(); + + bool Commit(); + bool IsStorage(); + + enum class LockFileResult + { + Failed, + FailedLockFile, // there was only lock file that prevented success - no syslock or IO error + Succeeded, + }; + LockFileResult LockOrigFileOnDemand(bool bLoading, bool bNoUI, bool bTryIgnoreLockFile = false, + LockFileEntry* pLockData = nullptr); + void DisableUnlockWebDAV( bool bDisableUnlockWebDAV = true ); + void UnlockFile( bool bReleaseLockStream ); + /// Lets Transfer_Impl() not fsync the output file. + void DisableFileSync(bool bDisableFileSync); + + css::uno::Reference< css::embed::XStorage > GetStorage( bool bCreateTempFile = true ); + css::uno::Reference< css::embed::XStorage > GetOutputStorage(); + void ResetError(); + [[nodiscard]] bool IsExpired() const; + void SetName( const OUString& rName, bool bSetOrigURL = false ); + + const css::uno::Sequence < css::util::RevisionTag >& + GetVersionList( bool _bNoReload = false ); + [[nodiscard]] bool IsReadOnly() const; + + // Whether the medium had originally been opened r/o (either because it is + // "physically" r/o, or because it was requested to be opened r/o, + // independent of later changes via SetOpenMode; used to keep track of the + // "true" state of the medium across toggles via SID_EDITDOC (which do + // change SetOpenMode): + [[nodiscard]] bool IsOriginallyReadOnly() const; + + // Whether the medium had originally been requested to be opened r/o, + // independent of later changes via SetOpenMode; used for SID_RELOAD: + [[nodiscard]] bool IsOriginallyLoadedReadOnly() const; + + css::uno::Reference< css::io::XInputStream > const & GetInputStream(); + + void CreateTempFile( bool bReplace = true ); + void CreateTempFileNoCopy(); + OUString SwitchDocumentToTempFile(); + bool SwitchDocumentToFile( const OUString& aURL ); + + OUString GetBaseURL( bool bForSaving=false ); + void SetInCheckIn( bool bInCheckIn ); + bool IsInCheckIn( ) const; + bool IsSkipImages( ) const; + + SAL_DLLPRIVATE bool HasStorage_Impl() const; + + SAL_DLLPRIVATE void StorageBackup_Impl(); + SAL_DLLPRIVATE OUString const & GetBackup_Impl(); + + SAL_DLLPRIVATE css::uno::Reference< css::embed::XStorage > const & GetZipStorageToSign_Impl( bool bReadOnly = true ); + SAL_DLLPRIVATE void CloseZipStorage_Impl(); + + // the storage that will be returned by the medium on GetStorage request + SAL_DLLPRIVATE void SetStorage_Impl( const css::uno::Reference< css::embed::XStorage >& xNewStorage ); + + SAL_DLLPRIVATE void CloseAndReleaseStreams_Impl(); + SAL_DLLPRIVATE void AddVersion_Impl( css::util::RevisionTag& rVersion ); + SAL_DLLPRIVATE bool TransferVersionList_Impl( SfxMedium const & rMedium ); + SAL_DLLPRIVATE void SaveVersionList_Impl(); + SAL_DLLPRIVATE void RemoveVersion_Impl( const OUString& rVersion ); + + SAL_DLLPRIVATE void SetExpired_Impl( const DateTime& rDateTime ); + SAL_DLLPRIVATE SvKeyValueIterator* GetHeaderAttributes_Impl(); + + SAL_DLLPRIVATE void Init_Impl(); + + SAL_DLLPRIVATE void GetLockingStream_Impl(); + SAL_DLLPRIVATE void GetMedium_Impl(); + SAL_DLLPRIVATE bool TryDirectTransfer( const OUString& aURL, SfxItemSet const & aTargetSet ); + SAL_DLLPRIVATE void Transfer_Impl(); + SAL_DLLPRIVATE void CreateFileStream(); + SAL_DLLPRIVATE void SetUpdatePickList(bool); + SAL_DLLPRIVATE bool IsUpdatePickList() const; + + SAL_DLLPRIVATE void SetLongName(const OUString &rName); + SAL_DLLPRIVATE const OUString & GetLongName() const; + SAL_DLLPRIVATE bool IsPreview_Impl() const; + SAL_DLLPRIVATE void ClearBackup_Impl(); + SAL_DLLPRIVATE void SetPhysicalName_Impl(const OUString& rName); + SAL_DLLPRIVATE void CanDisposeStorage_Impl( bool bDisposeStorage ); + SAL_DLLPRIVATE bool WillDisposeStorageOnClose_Impl(); + + SAL_DLLPRIVATE void DoBackup_Impl(); + SAL_DLLPRIVATE void DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent ); + SAL_DLLPRIVATE void DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent, + const OUString& aPrefix, + const OUString& aExtension, + const OUString& aDestDir ); + + SAL_DLLPRIVATE bool UseBackupToRestore_Impl( ::ucbhelper::Content& aOriginalContent, + const css::uno::Reference< css::ucb::XCommandEnvironment >& xComEnv ); + + SAL_DLLPRIVATE bool StorageCommit_Impl(); + + SAL_DLLPRIVATE void TransactedTransferForFS_Impl( const INetURLObject& aSource, + const INetURLObject& aDest, + const css::uno::Reference< css::ucb::XCommandEnvironment >& xComEnv ); + + SAL_DLLPRIVATE bool + SignContents_Impl(weld::Window* pDialogParent, + bool bSignScriptingContent, bool bHasValidDocumentSignature, + const OUString& aSignatureLineId = OUString(), + const css::uno::Reference& xCert + = css::uno::Reference(), + const css::uno::Reference& xValidGraphic + = css::uno::Reference(), + const css::uno::Reference& xInvalidGraphic + = css::uno::Reference(), + const OUString& aComment = OUString()); + + SAL_DLLPRIVATE bool + SignDocumentContentUsingCertificate(bool bHasValidDocumentSignature, + const css::uno::Reference& xCertificate); + + // the following two methods must be used and make sense only during saving currently + // TODO/LATER: in future the signature state should be controlled by the medium not by the document + // in this case the methods will be used generally, and might need to be renamed + SAL_DLLPRIVATE SignatureState GetCachedSignatureState_Impl() const; + SAL_DLLPRIVATE void SetCachedSignatureState_Impl( SignatureState nState ); + + void SetHasEmbeddedObjects(bool bHasEmbeddedObjects); + + static css::uno::Sequence < css::util::RevisionTag > GetVersionList( + const css::uno::Reference< css::embed::XStorage >& xStorage ); + static OUString CreateTempCopyWithExt( const OUString& aURL ); + static bool CallApproveHandler(const css::uno::Reference< css::task::XInteractionHandler >& xHandler, const css::uno::Any& rRequest, bool bAllowAbort); + + static bool SetWritableForUserOnly( const OUString& aURL ); + static sal_uInt32 CreatePasswordToModifyHash( const OUString& aPasswd, bool bWriter ); + +private: + enum class ShowLockResult { NoLock, Succeeded, Try }; + ShowLockResult ShowLockedDocumentDialog(const LockFileEntry& aData, + bool bIsLoading, bool bOwnLock, bool bHandleSysLocked); + enum class MessageDlg { LockFileIgnore, LockFileCorrupt }; + bool ShowLockFileProblemDialog(MessageDlg nWhichDlg); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docfilt.hxx b/include/sfx2/docfilt.hxx new file mode 100644 index 000000000..80bb7734d --- /dev/null +++ b/include/sfx2/docfilt.hxx @@ -0,0 +1,124 @@ +/* -*- 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_DOCFILT_HXX +#define INCLUDED_SFX2_DOCFILT_HXX + +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace com::sun::star::embed { class XStorage; } +namespace com::sun::star::uno { template class Reference; } + +class SotStorage; + +class SFX2_DLLPUBLIC SfxFilter +{ + friend class SfxFilterContainer; + + WildCard aWildCard; + + OUString aTypeName; + OUString aUserData; + OUString aServiceName; + OUString aMimeType; + OUString maFilterName; + OUString aUIName; + OUString aDefaultTemplate; + + /** + * Custom provider name in case the filter is provided via external + * libraries. Empty for conventional filter types. + */ + OUString maProvider; + + SfxFilterFlags nFormatType; + sal_Int32 nVersion; + SotClipboardFormatId lFormat; + bool mbEnabled; + +public: + SfxFilter( const OUString& rProvider, const OUString& rFilterName ); + + SfxFilter( const OUString &rName, + const OUString &rWildCard, + SfxFilterFlags nFormatType, + SotClipboardFormatId lFormat, + const OUString &rTypeName, + const OUString &rMimeType, + const OUString &rUserData, + const OUString& rServiceName, + bool bEnabled = true ); + ~SfxFilter(); + + bool IsAllowedAsTemplate() const { return bool(nFormatType & SfxFilterFlags::TEMPLATE); } + bool IsOwnFormat() const { return bool(nFormatType & SfxFilterFlags::OWN); } + /// If the filter supports digital signatures. + bool GetSupportsSigning() const { return bool(nFormatType & SfxFilterFlags::SUPPORTSSIGNING); } + bool GetGpgEncryption() const { return bool(nFormatType & SfxFilterFlags::GPGENCRYPTION); } + bool IsOwnTemplateFormat() const { return bool(nFormatType & SfxFilterFlags::TEMPLATEPATH); } + /// not our built-in format + bool IsAlienFormat() const { return bool(nFormatType & SfxFilterFlags::ALIEN); } + /// an unusual/legacy file to be loading + bool IsExoticFormat() const { return bool(nFormatType & SfxFilterFlags::EXOTIC); } + bool CanImport() const { return bool(nFormatType & SfxFilterFlags::IMPORT); } + bool CanExport() const { return bool(nFormatType & SfxFilterFlags::EXPORT); } + SfxFilterFlags GetFilterFlags() const { return nFormatType; } + const OUString& GetFilterName() const { return maFilterName; } + const OUString& GetMimeType() const { return aMimeType; } + const OUString& GetName() const { return maFilterName; } + const WildCard& GetWildcard() const { return aWildCard; } + const OUString& GetRealTypeName() const { return aTypeName; } + SotClipboardFormatId GetFormat() const { return lFormat; } + const OUString& GetTypeName() const { return aTypeName; } + const OUString& GetUIName() const { return aUIName; } + const OUString& GetUserData() const { return aUserData; } + const OUString& GetDefaultTemplate() const { return aDefaultTemplate; } + void SetDefaultTemplate( const OUString& rStr ) { aDefaultTemplate = rStr; } + bool UsesStorage() const { return GetFormat() != SotClipboardFormatId::NONE; } + void SetUIName( const OUString& rName ) { aUIName = rName; } + void SetVersion( sal_Int32 nVersionP ) { nVersion = nVersionP; } + sal_Int32 GetVersion() const { return nVersion; } + OUString GetSuffixes() const; + OUString GetDefaultExtension() const; + const OUString& GetServiceName() const { return aServiceName; } + const OUString& GetProviderName() const { return maProvider;} + + static std::shared_ptr GetDefaultFilter( const OUString& rName ); + static std::shared_ptr GetFilterByName( const OUString& rName ); + static std::shared_ptr GetDefaultFilterFromFactory( const OUString& rServiceName ); + + static OUString GetTypeFromStorage( const SotStorage& rStg ); + /// @throws css::beans::UnknownPropertyException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + static OUString GetTypeFromStorage( + const css::uno::Reference& xStorage ); + bool IsEnabled() const { return mbEnabled; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docinf.hxx b/include/sfx2/docinf.hxx new file mode 100644 index 000000000..09ecfff6b --- /dev/null +++ b/include/sfx2/docinf.hxx @@ -0,0 +1,75 @@ +/* -*- 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_DOCINF_HXX +#define INCLUDED_SFX2_DOCINF_HXX + +#include +#include +#include +#include + + +class GDIMetaFile; +class SotStorage; + +namespace com::sun::star { + namespace document { + class XDocumentProperties; + } +} + +namespace com::sun::star::uno { template class Reference; } +namespace com::sun::star::uno { template class Sequence; } + + +namespace sfx2 { + +/** load document meta-data from OLE stream + + @param i_xDocProps Document meta-data + @param i_pStorage OLE Storage + */ +ErrCode SFX2_DLLPUBLIC LoadOlePropertySet( + const css::uno::Reference< css::document::XDocumentProperties>& i_xDocProps, + SotStorage* i_pStorage ); + +/** save document meta-data to OLE stream + + @param i_xDocProps Document meta-data + @param i_pStorage OLE Storage + @param i_pThumb Thumbnail: preview bitmap + @param i_pGuid Blob: Guid blob ("_PID_GUID") + @param i_pHyperlinks Blob: Hyperlink blob ("_PID_HLINKS") + */ +bool SFX2_DLLPUBLIC SaveOlePropertySet( + const css::uno::Reference< css::document::XDocumentProperties>& i_xDocProps, + SotStorage* i_pStorage, + const css::uno::Sequence * i_pThumb = nullptr, + const css::uno::Sequence * i_pGuid = nullptr, + const css::uno::Sequence * i_pHyperlinks = nullptr); + + +css::uno::Sequence SFX2_DLLPUBLIC convertMetaFile( + GDIMetaFile const * i_pThumb); + +} // namespace sfx2 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docinsert.hxx b/include/sfx2/docinsert.hxx new file mode 100644 index 000000000..ab75ddd18 --- /dev/null +++ b/include/sfx2/docinsert.hxx @@ -0,0 +1,77 @@ +/* -*- 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_DOCINSERT_HXX +#define INCLUDED_SFX2_DOCINSERT_HXX + +#include +#include +#include +#include +#include +#include + +namespace sfx2 { class FileDialogHelper; } +namespace weld { class Window; } +class SfxItemSet; +class SfxMedium; +enum class FileDialogFlags; + +typedef ::std::vector< std::unique_ptr > SfxMediumList; + +namespace sfx2 { + +class SFX2_DLLPUBLIC DocumentInserter +{ +private: + weld::Window* m_pParent; + OUString m_sDocFactory; + OUString m_sFilter; + Link m_aDialogClosedLink; + + FileDialogFlags const m_nDlgFlags; + ErrCode m_nError; + + std::unique_ptr + m_pFileDlg; + std::shared_ptr m_xItemSet; + std::vector m_pURLList; + + DECL_LINK(DialogClosedHdl, sfx2::FileDialogHelper*, void); + +public: + enum class Mode { + Insert, + InsertMulti, + Compare, + Merge + }; + DocumentInserter(weld::Window* pParent, const OUString& rFactory, const Mode mode = Mode::Insert); + ~DocumentInserter(); + + void StartExecuteModal( const Link& _rDialogClosedLink ); + std::unique_ptr CreateMedium(char const* pFallbackHack = nullptr); + SfxMediumList CreateMediumList(); +}; + +} // namespace sfx2 + +#endif // INCLUDED_SFX2_DOCINSERT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/dockwin.hxx b/include/sfx2/dockwin.hxx new file mode 100644 index 000000000..217c9f962 --- /dev/null +++ b/include/sfx2/dockwin.hxx @@ -0,0 +1,131 @@ +/* -*- 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_DOCKWIN_HXX +#define INCLUDED_SFX2_DOCKWIN_HXX + +#include +#include +#include +#include + +#include + +#include +#include + +namespace com::sun::star::frame { class XFrame; } + +class SfxDockingWindow_Impl; +enum class SplitWindowItemFlags; + +void SfxDockingWindowFactory( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rDockingWindowName ); +bool IsDockingWindowVisible( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rDockingWindowName ); + +class SFX2_DLLPUBLIC SfxDockingWindow : public DockingWindow +{ +protected: + std::unique_ptr m_xBuilder; + VclPtr m_xVclContentArea; + std::unique_ptr m_xContainer; + +private: + tools::Rectangle aInnerRect; + tools::Rectangle aOuterRect; + SfxBindings* pBindings; + Size aFloatSize; + SfxChildWindow* pMgr; + std::unique_ptr< SfxDockingWindow_Impl > pImpl; + + SfxDockingWindow(SfxDockingWindow const &) = delete; + SfxDockingWindow& operator =(SfxDockingWindow const &) = delete; + +protected: + SfxChildAlignment CalcAlignment(const Point& rPos, tools::Rectangle& rRect ); + virtual Size CalcDockingSize(SfxChildAlignment); + virtual SfxChildAlignment + CheckAlignment(SfxChildAlignment,SfxChildAlignment); + + virtual void Resize() override; + virtual bool PrepareToggleFloatingMode() override; + virtual void ToggleFloatingMode() override; + virtual void StartDocking() override; + virtual bool Docking( const Point& rPos, tools::Rectangle& rRect ) override; + virtual void EndDocking( const tools::Rectangle& rRect, bool bFloatMode ) override; + virtual void Resizing( Size& rSize ) override; + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual bool Close() override; + virtual void Move() override; + + SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl() { return pMgr; } + +public: + SfxDockingWindow( SfxBindings *pBindings, + SfxChildWindow *pCW, + vcl::Window* pParent, + WinBits nWinBits); + SfxDockingWindow( SfxBindings *pBindings, + SfxChildWindow *pCW, + vcl::Window* pParent, + const OString& rID, const OUString& rUIXMLDescription ); + virtual ~SfxDockingWindow() override; + virtual void dispose() override; + + void Initialize (SfxChildWinInfo* pInfo); + virtual void FillInfo(SfxChildWinInfo&) const; + virtual void StateChanged( StateChangedType nStateChange ) override; + + void SetDockingRects(const tools::Rectangle& rOuter, const tools::Rectangle& rInner) + { aInnerRect = rInner; aOuterRect = rOuter; } + const tools::Rectangle& GetInnerRect() const { return aInnerRect; } + const tools::Rectangle& GetOuterRect() const { return aOuterRect; } + SfxBindings& GetBindings() const { return *pBindings; } + sal_uInt16 GetType() const { return pMgr->GetType(); } + SfxChildAlignment GetAlignment() const { return pMgr->GetAlignment(); } + void SetAlignment(SfxChildAlignment eAlign) { pMgr->SetAlignment(eAlign); } + const Size& GetFloatingSize() const { return aFloatSize; } + void SetFloatingSize(const Size& rSize) { aFloatSize=rSize; } + + void SetMinOutputSizePixel( const Size& rSize ); + const Size& GetMinOutputSizePixel() const; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + DECL_LINK(TimerHdl, Timer *, void); + + SAL_DLLPRIVATE void Initialize_Impl(); + SAL_DLLPRIVATE void SetItemSize_Impl( const Size& rSize ); + SAL_DLLPRIVATE void Disappear_Impl(); + SAL_DLLPRIVATE void Reappear_Impl(); + SAL_DLLPRIVATE bool IsAutoHide_Impl() const; + SAL_DLLPRIVATE void AutoShow_Impl(); + SAL_DLLPRIVATE void ReleaseChildWindow_Impl(); +}; + +class SfxDockingWrapper final : public SfxChildWindow +{ + public: + SfxDockingWrapper( vcl::Window* pParent , + sal_uInt16 nId , + SfxBindings* pBindings , + SfxChildWinInfo* pInfo ); + + SFX_DECL_CHILDWINDOW(SfxDockingWrapper); +}; + +#endif // INCLUDED_SFX2_DOCKWIN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docmacromode.hxx b/include/sfx2/docmacromode.hxx new file mode 100644 index 000000000..a15bbbe9b --- /dev/null +++ b/include/sfx2/docmacromode.hxx @@ -0,0 +1,302 @@ +/* -*- 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_DOCMACROMODE_HXX +#define INCLUDED_SFX2_DOCMACROMODE_HXX + +#include +#include + +#include + +#include + +namespace com::sun::star::document { class XEmbeddedScripts; } +namespace com::sun::star::embed { class XStorage; } +namespace com::sun::star::script { class XLibraryContainer; } +namespace com::sun::star::task { class XInteractionHandler; } + + +namespace sfx2 +{ + + + //= IMacroDocumentAccess + + /** provides access to several settings of a document, which are needed by ->DocumentMacroMode + to properly determine the current macro execution mode of this document + */ + class SAL_NO_VTABLE IMacroDocumentAccess + { + public: + /** retrieves the current MacroExecutionMode. + + Usually, this is initialized from the media descriptor used to load the document, + respectively the one passed into the document's XModel::attachResource call. + + If no such mode was passed there, document implementations should return + MacroExecMode::NEVER_EXECUTE. + + @see css::document::MediaDescriptor::MacroExecutionMode + @see css::frame::XComponentLoader::loadComponentFromURL + @see css::frame::XModel::attachResource + + @see setCurrentMacroExecMode + + @todo + Effectively, this is the MacroExecutionMode of the MediaDescriptor of + the document. Thus, this setting could be obtained from the XModel + directly. We should introduce a getDocumentModel method here, which + can be used for this and other purposes. + */ + virtual sal_Int16 + getCurrentMacroExecMode() const = 0; + + /** sets the MacroExecutionMode of the document, as calculated by the DocumentMacroMode + class. + + Effectively, the existence of this method means that the responsibility + to store the current macro execution mode is not with the DocumentMacroMode + instance, but with the document instance itself. + + Usually, a document implementation will simply put the macro execution mode + into its media descriptor, as returned by XModel::getArgs. + + @see css::document::MediaDescriptor::MacroExecutionMode + @see css::frame::XComponentLoader::loadComponentFromURL + @see css::frame::XModel::attachResource + + see getCurrentMacroExecMode + */ + virtual void + setCurrentMacroExecMode( sal_uInt16 ) = 0; + + /** returns the origin of the document + + This usually is the document's location, or, if the document has been + newly created from a template, then the location of the template. Location + here means the complete path of the document, including the file name. + + @todo + This probably can also be obtained from the XModel, by calling getURL + or getLocation. If both are empty, then we need a UNO way to obtain + the URL of the underlying template document - if any. If we have this, + we could replace this method with a newly introduced method + getDocumentModel and some internal code. + */ + virtual OUString + getDocumentLocation() const = 0; + + /** checks whether the document's storage contains sub storages with macros or scripts + + A default implementation of this method will simply call DocumentMacroMode::storageHasMacros + with the document's root storage. However, there might be document types where this + isn't sufficient (e.g. database documents which contain sub documents which can also + contain macro/script storages). + */ + virtual bool + documentStorageHasMacros() const = 0; + + /** checks whether the document's contained calls to macros or scripts after loading + + */ + virtual bool + macroCallsSeenWhileLoading() const = 0; + + /** provides access to the XEmbeddedScripts interface of the document + + Implementations are allowed to return here if and only if they + do not (yet) support embedding scripts. + + @todo + can also be replaced with a call to the (to be introduced) getDocumentModel + method, and a queryInterface. + */ + virtual css::uno::Reference< css::document::XEmbeddedScripts > + getEmbeddedDocumentScripts() const = 0; + + /** returns the state of the signatures for the scripts embedded in the document + + Note: On the medium run, the signature handling of a document should be outsourced + into a dedicated class, instead of being hard-wired into the SfxObjectShell. This + class could then be used outside the SfxObjectShell (e.g. in Base documents), too. + When this happens, this method here becomes should be replaced by a method at this + new class. + + @seealso + */ + virtual SignatureState + getScriptingSignatureState() = 0; + + /** allows to detect whether there is a trusted scripting signature + + Note: On the medium run, the signature handling of a document should be outsourced + into a dedicated class, instead of being hard-wired into the SfxObjectShell. This + class could then be used outside the SfxObjectShell (e.g. in Base documents), too. + When this happens, this method here should be replaced by a method at this + new class. + + @seealso + */ + virtual bool + hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) = 0; + + protected: + ~IMacroDocumentAccess() {} + }; + + + //= DocumentMacroMode + + struct DocumentMacroMode_Data; + + /** encapsulates handling the macro mode of a document + + @see css::document::MacroExecMode + */ + class SFX2_DLLPUBLIC DocumentMacroMode + { + public: + /** creates an instance + + @param _rDocumentAccess + access to the document which this instance works for. Must live as long as the + DocumentMacroMode instance lives, at least + */ + DocumentMacroMode( IMacroDocumentAccess& _rDocumentAccess ); + + /** allows macro execution in the document + + Effectively, the macro mode is set to MacroExecMode::ALWAYS_EXECUTE_NO_WARN. + + @return + , always + */ + bool allowMacroExecution(); + + /** disallows macro execution in the document + + Effectively, the macro mode is set to MacroExecMode::NEVER_EXECUTE. + + @return + , always + */ + bool disallowMacroExecution(); + + /** checks whether the document allows executing contained macros. + + The method transforms the current macro execution mode into either + ALWAYS_EXECUTE_NO_WARN or NEVER_EXECUTE, depending on the current value, + possible configuration settings, and possible user interaction. + + @param _rxInteraction + A handler for interactions which might become necessary. + This includes +
  • Asking the user for confirmation for macro execution.
  • +
  • Telling the user that macro execution is disabled.
  • +
+ + If the user needs to be asked for macro execution confirmation, and if + this parameter is , the most defensive assumptions will be made, + effectively disabling macro execution. + + @return + if and only if macro execution in this document is allowed. + */ + bool adjustMacroMode( + const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction + ); + + /** determines whether macro execution is disallowed + + There's a number of reasons why macro execution could be disallowed: +
  • Somebody called ->disallowMacroExecution
  • +
  • Macro execution is disabled globally, via the security options
  • +
  • Macro execution mode was not defined initially, and the user denied + executing macros for this particular document.
  • +
+ + Note that if this method returns , then subsequent calls of + ->adjustMacroMode can still return . + That is, if the current macro execution mode for the document is not yet known + (and in particular not MacroExecMode::NEVER_EXECUTE), then ->isMacroExecutionDisallowed + will return . + However, a subsequent call to ->adjustMacroMode can result in the user + denying macro execution, in which ->adjustMacroMode will return , + and the next call to isMacroExecutionDisallowed will return . + */ + bool isMacroExecutionDisallowed() const; + + /** determines whether the document actually has a macros library + + Effectively, this method checks the Basic library container (as returned by + IMacroDocumentAccess::getEmbeddedDocumentScripts().getBasicLibraries) for + content. + */ + bool hasMacroLibrary() const; + + /** determines whether the given document storage has sub storages containing scripts + or macros. + + Effectively, the method checks for the presence of a sub-storage name "Scripts" (where + BeanShell-/JavaScript-/Python-Scripts are stored, and a sub storage named "Basic" (where + Basic scripts are stored). + */ + static bool storageHasMacros( const css::uno::Reference< css::embed::XStorage >& _rxStorage ); + + static bool containerHasBasicMacros( const css::uno::Reference< css::script::XLibraryContainer >& xContainter ); + /** checks the macro execution mode while loading the document. + + This must be called when the loading is effectively finished, but before any macro action + happened. + + The method will disallow macro execution for this document if it is disabled + globally (SvtSecurityOptions::IsMacroDisabled). Otherwise, it will check whether + the document contains a macro storage or macro libraries. If so, it will + properly calculate the MacroExecutionMode by calling adjustMacroMode. + + If the document doesn't contain macros, yet, then the macro execution for this + document will be allowed (again: unless disabled globally), since in this case + macros which later are newly created by the user should be allowed, of course. + + @return + if and only if macro execution is allowed in the document + + @see isMacroExecutionDisallowed + @see IMacroDocumentAccess::documentStorageHasMacros + @see IMacroDocumentAccess::macroCallsSeenWhileLoading + @see hasMacroLibrary + @see IMacroDocumentAccess::checkForBrokenScriptingSignatures + */ + bool + checkMacrosOnLoading( + const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction + ); + + private: + std::shared_ptr< DocumentMacroMode_Data > m_xData; + }; + + +} // namespace sfx2 + + +#endif // INCLUDED_SFX2_DOCMACROMODE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/docstoragemodifylistener.hxx b/include/sfx2/docstoragemodifylistener.hxx new file mode 100644 index 000000000..8530711ca --- /dev/null +++ b/include/sfx2/docstoragemodifylistener.hxx @@ -0,0 +1,82 @@ +/* -*- 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_DOCSTORAGEMODIFYLISTENER_HXX +#define INCLUDED_SFX2_DOCSTORAGEMODIFYLISTENER_HXX + +#include + +#include + +#include + +namespace comphelper { class SolarMutex; } + + +namespace sfx2 +{ + + + //= IModifiableDocument + + /** callback for the DocumentStorageModifyListener class + */ + class SAL_NO_VTABLE IModifiableDocument + { + public: + /// indicates the root or a sub storage of the document has been modified + virtual void storageIsModified() = 0; + + protected: + ~IModifiableDocument() {} + }; + + + //= DocumentStorageModifyListener + + class SFX2_DLLPUBLIC DocumentStorageModifyListener final : public cppu::WeakImplHelper + { + IModifiableDocument* m_pDocument; + comphelper::SolarMutex& m_rMutex; + + public: + DocumentStorageModifyListener( IModifiableDocument& _rDocument, comphelper::SolarMutex& _rMutex ); + + void dispose(); + + // XModifyListener + virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + private: + virtual ~DocumentStorageModifyListener() override; + + DocumentStorageModifyListener( const DocumentStorageModifyListener& ) = delete; + DocumentStorageModifyListener& operator=( const DocumentStorageModifyListener& ) = delete; + }; + + +} // namespace sfx2 + + +#endif // INCLUDED_SFX2_DOCSTORAGEMODIFYLISTENER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/doctempl.hxx b/include/sfx2/doctempl.hxx new file mode 100644 index 000000000..6ad16ceb6 --- /dev/null +++ b/include/sfx2/doctempl.hxx @@ -0,0 +1,113 @@ +/* -*- 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_DOCTEMPL_HXX +#define INCLUDED_SFX2_DOCTEMPL_HXX + +#include +#include +#include +#include +#include + +// CLASS ----------------------------------------------------------------- + +class SfxDocTemplate_Impl; + +// class SfxDocumentTemplates -------------------------------------------- + +class SFX2_DLLPUBLIC SfxDocumentTemplates +{ +private: + tools::SvRef pImp; + + SAL_DLLPRIVATE bool CopyOrMove( sal_uInt16 nTargetRegion, sal_uInt16 nTargetIdx, + sal_uInt16 nSourceRegion, sal_uInt16 nSourceIdx, bool bMove ); +public: + SfxDocumentTemplates(); + SfxDocumentTemplates(const SfxDocumentTemplates &); + ~SfxDocumentTemplates(); + + const SfxDocumentTemplates &operator=(const SfxDocumentTemplates &); + + void ReInitFromComponent(); + + sal_uInt16 GetRegionCount() const; + OUString GetRegionName(sal_uInt16 nIdx) const; //dv! + OUString GetFullRegionName(sal_uInt16 nIdx) const; + + sal_uInt16 GetCount(sal_uInt16 nRegion) const; + OUString GetName(sal_uInt16 nRegion, sal_uInt16 nIdx) const; //dv! + OUString GetPath(sal_uInt16 nRegion, sal_uInt16 nIdx) const; + + // Allows to retrieve the target template URL from the UCB + OUString GetTemplateTargetURLFromComponent( const OUString& aGroupName, + const OUString& aTitle ); + + // Convert a resource string - a template name - to its localised pair + // if it exists in sfx2/inc/strings.hxx + static OUString ConvertResourceString(const OUString& rString); + + bool Copy(sal_uInt16 nTargetRegion, + sal_uInt16 nTargetIdx, + sal_uInt16 nSourceRegion, + sal_uInt16 nSourceIdx); + bool Move(sal_uInt16 nTargetRegion, + sal_uInt16 nTargetIdx, + sal_uInt16 nSourceRegion, + sal_uInt16 nSourceIdx); + bool Delete(sal_uInt16 nRegion, sal_uInt16 nIdx); + bool InsertDir(const OUString &rText, sal_uInt16 nRegion); + + bool InsertTemplate (sal_uInt16 nSourceRegion, sal_uInt16 nIdx, const OUString &rName, const OUString &rPath); + + /** Change the name of an entry or a directory + + \param rName + The new name to set + \param nRegion + The id of the region to rename or containing the template to rename + \param nIdx + The id of the template to rename or USHRT_MAX to rename the region. + + \return + sal_True if the action could be performed, sal_False otherwise + + */ + bool SetName(const OUString &rName, sal_uInt16 nRegion, sal_uInt16 nIdx); + + bool CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const OUString &rName) const; + bool CopyFrom(sal_uInt16 nRegion, sal_uInt16 nIdx, OUString &rName); + + bool GetFull( const OUString& rRegion, const OUString& rName, OUString& rPath ); + bool GetLogicNames( const OUString& rPath, OUString& rRegion, OUString& rName ) const; + + /** updates the configuration where the document templates structure is stored. + +

The info about the document templates (which files, which groups etc.) is stored in the + configuration. This means that just by copying files into OOo's template directories, this + change is not reflected in the SfxDocumentTemplates - 'cause the configuration is not synchronous with + the file system. This can be enforced with this method.

+ */ + void Update(); +}; + +#endif // INCLUDED_SFX2_DOCTEMPL_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/emojipopup.hxx b/include/sfx2/emojipopup.hxx new file mode 100644 index 000000000..20d1e493c --- /dev/null +++ b/include/sfx2/emojipopup.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_EMOJIPOPUP_HXX +#define INCLUDED_SFX2_INC_EMOJIPOPUP_HXX + +#include +#include + +class EmojiPopup final : public svt::PopupWindowController +{ +public: + EmojiPopup(const css::uno::Reference& rContext); + virtual ~EmojiPopup() override; + + virtual VclPtr createVclPopupWindow( vcl::Window* pParent ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/event.hxx b/include/sfx2/event.hxx new file mode 100644 index 000000000..9f7cd304a --- /dev/null +++ b/include/sfx2/event.hxx @@ -0,0 +1,268 @@ +/* -*- 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_EVENT_HXX +#define INCLUDED_SFX2_EVENT_HXX + +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include + +namespace com::sun::star::beans { struct PropertyValue; } + +/** + these values get stored in streams in a 16-bit value +*/ +enum class SvMacroItemId : sal_uInt16 { + NONE = 0, + + // used by SwHTMLForm_Impl + HtmlOnSubmitForm, + HtmlOnResetForm, + HtmlOnGetFocus, + HtmlOnLoseFocus, + HtmlOnClick, + HtmlOnClickItem, + HtmlOnChange, + HtmlOnSelect, + + // used by SwHTMLParser + OpenDoc, + PrepareCloseDoc, + ActivateDoc, + DeactivateDoc, + + // Events for Controls etc. + OnMouseOver = 5100, + OnClick = 5101, + OnMouseOut = 5102, + + OnImageLoadDone = 10000, + OnImageLoadCancel = 10001, + OnImageLoadError = 10002, + + SwObjectSelect = 20000, + SwStartInsGlossary = 20001, + SwEndInsGlossary = 20002, + SwFrmKeyInputAlpha = 20004, + SwFrmKeyInputNoAlpha = 20005, + SwFrmResize = 20006, + SwFrmMove = 20007, +}; + +template< typename charT, typename traits > +inline std::basic_ostream & operator <<( + std::basic_ostream & stream, const SvMacroItemId& id ) +{ + switch(id) + { + case SvMacroItemId::NONE: return stream << "NONE"; + case SvMacroItemId::HtmlOnSubmitForm: return stream << "HtmlOnSubmitForm"; + case SvMacroItemId::HtmlOnResetForm: return stream << "HtmlOnResetForm"; + case SvMacroItemId::HtmlOnGetFocus: return stream << "HtmlOnGetFocus"; + case SvMacroItemId::HtmlOnLoseFocus: return stream << "HtmlOnLoseFocus"; + case SvMacroItemId::HtmlOnClick: return stream << "HtmlOnClick"; + case SvMacroItemId::HtmlOnClickItem: return stream << "HtmlOnClickItem"; + case SvMacroItemId::HtmlOnChange: return stream << "HtmlOnChange"; + case SvMacroItemId::HtmlOnSelect: return stream << "HtmlOnSelect"; + case SvMacroItemId::OpenDoc: return stream << "OpenDoc"; + case SvMacroItemId::PrepareCloseDoc: return stream << "PrepareCloseDoc"; + case SvMacroItemId::ActivateDoc: return stream << "ActivateDoc"; + case SvMacroItemId::DeactivateDoc: return stream << "DeactivateDoc"; + case SvMacroItemId::OnMouseOver: return stream << "OnMouseOver"; + case SvMacroItemId::OnClick: return stream << "OnClick"; + case SvMacroItemId::OnMouseOut: return stream << "OnMouseOut"; + case SvMacroItemId::OnImageLoadDone: return stream << "OnImageLoadDone"; + case SvMacroItemId::OnImageLoadCancel: return stream << "OnImageLoadCancel"; + case SvMacroItemId::OnImageLoadError: return stream << "OnImageLoadError"; + case SvMacroItemId::SwObjectSelect: return stream << "SwObjectSelect"; + case SvMacroItemId::SwStartInsGlossary: return stream << "SwStartInsGlossary"; + case SvMacroItemId::SwEndInsGlossary: return stream << "SwEndInsGlossary"; + case SvMacroItemId::SwFrmKeyInputAlpha: return stream << "SwFrmKeyInputAlpha"; + case SvMacroItemId::SwFrmKeyInputNoAlpha: return stream << "SwFrmKeyInputNoAlpha"; + case SvMacroItemId::SwFrmResize: return stream << "SwFrmResize"; + case SvMacroItemId::SwFrmMove: return stream << "SwFrmMove"; + default: return stream << "unk(" << std::to_string(int(id)) << ")"; + } +} + +class SfxObjectShell; + +enum class SfxEventHintId { + NONE = 0, + ActivateDoc, + CloseDoc, + CloseView, + CreateDoc, + DeactivateDoc, + DocCreated, + LoadFinished, + ModifyChanged, + OpenDoc, + PrepareCloseDoc, + PrepareCloseView, + PrintDoc, + SaveAsDoc, + SaveAsDocDone, + SaveAsDocFailed, + SaveDoc, + SaveDocDone, + SaveDocFailed, + SaveToDoc, + SaveToDocDone, + SaveToDocFailed, + StorageChanged, + ViewCreated, + VisAreaChanged, + // SW events + SwMailMerge, + SwMailMergeEnd, + SwEventPageCount, + SwEventFieldMerge, + SwEventFieldMergeFinished, + SwEventLayoutFinished, +}; + +template< typename charT, typename traits > +inline std::basic_ostream & operator <<( + std::basic_ostream & stream, const SfxEventHintId& id ) +{ + switch(id) + { + case SfxEventHintId::NONE: return stream << "NONE"; + case SfxEventHintId::ActivateDoc: return stream << "ActivateDoc"; + case SfxEventHintId::CloseDoc: return stream << "CloseDoc"; + case SfxEventHintId::CloseView: return stream << "CloseView"; + case SfxEventHintId::CreateDoc: return stream << "CreateDoc"; + case SfxEventHintId::DeactivateDoc: return stream << "DeactivateDoc"; + case SfxEventHintId::DocCreated: return stream << "DocCreated"; + case SfxEventHintId::LoadFinished: return stream << "LoadFinished"; + case SfxEventHintId::ModifyChanged: return stream << "ModifyChanged"; + case SfxEventHintId::OpenDoc: return stream << "OpenDoc"; + case SfxEventHintId::PrepareCloseDoc: return stream << "PrepareCloseDoc"; + case SfxEventHintId::PrepareCloseView: return stream << "PrepareCloseView"; + case SfxEventHintId::PrintDoc: return stream << "PrintDoc"; + case SfxEventHintId::SaveAsDoc: return stream << "SaveAsDoc"; + case SfxEventHintId::SaveAsDocDone: return stream << "SaveAsDocDone"; + case SfxEventHintId::SaveAsDocFailed: return stream << "SaveAsDocFailed"; + case SfxEventHintId::SaveDoc: return stream << "SaveDoc"; + case SfxEventHintId::SaveDocDone: return stream << "SaveDocDone"; + case SfxEventHintId::SaveDocFailed: return stream << "SaveDocFailed"; + case SfxEventHintId::SaveToDoc: return stream << "SaveToDoc"; + case SfxEventHintId::SaveToDocDone: return stream << "SaveToDocDone"; + case SfxEventHintId::SaveToDocFailed: return stream << "SaveToDocFailed"; + case SfxEventHintId::StorageChanged: return stream << "StorageChanged"; + case SfxEventHintId::ViewCreated: return stream << "ViewCreated"; + case SfxEventHintId::VisAreaChanged: return stream << "VisAreaChanged"; + case SfxEventHintId::SwMailMerge: return stream << "SwMailMerge"; + case SfxEventHintId::SwMailMergeEnd: return stream << "SwMailMergeEnd"; + case SfxEventHintId::SwEventPageCount: return stream << "SwEventPageCount"; + case SfxEventHintId::SwEventFieldMerge: return stream << "SwEventFieldMerge"; + case SfxEventHintId::SwEventFieldMergeFinished: return stream << "SwEventFieldMergeFinished"; + case SfxEventHintId::SwEventLayoutFinished: return stream << "SwEventLayoutFinished"; + default: return stream << "unk(" << std::to_string(int(id)) << ")"; + } +} + +class SFX2_DLLPUBLIC SfxEventHint : public SfxHint +{ + SfxObjectShell* pObjShell; + OUString aEventName; + SfxEventHintId nEventId; + +public: + SfxEventHint( SfxEventHintId nId, const OUString& aName, SfxObjectShell *pObj ) + : pObjShell(pObj), + aEventName(aName), + nEventId(nId) + {} + + SfxEventHintId GetEventId() const + { return nEventId; } + + const OUString& GetEventName() const + { return aEventName; } + + SfxObjectShell* GetObjShell() const + { return pObjShell; } +}; + + +class SFX2_DLLPUBLIC SfxViewEventHint : public SfxEventHint +{ + css::uno::Reference< css::frame::XController2 > xViewController; + +public: + SfxViewEventHint( SfxEventHintId nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController >& xController ) + : SfxEventHint( nId, aName, pObj ) + , xViewController( xController, css::uno::UNO_QUERY ) + {} + + SfxViewEventHint( SfxEventHintId nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController2 >& xController ) + : SfxEventHint( nId, aName, pObj ) + , xViewController( xController ) + {} + + const css::uno::Reference< css::frame::XController2 >& GetController() const + { return xViewController; } +}; + +class SfxPrintingHint final : public SfxViewEventHint +{ + css::view::PrintableState mnPrintableState; + css::uno::Sequence < css::beans::PropertyValue > aOpts; +public: + SfxPrintingHint( + css::view::PrintableState nState, + const css::uno::Sequence < css::beans::PropertyValue >& rOpts, + SfxObjectShell *pObj, + const css::uno::Reference< css::frame::XController2 >& xController ) + : SfxViewEventHint( + SfxEventHintId::PrintDoc, + GlobalEventConfig::GetEventName( GlobalEventId::PRINTDOC ), + pObj, + xController ) + , mnPrintableState( nState ) + , aOpts( rOpts ) + {} + + SfxPrintingHint( css::view::PrintableState nState ) + : SfxViewEventHint( + SfxEventHintId::PrintDoc, + GlobalEventConfig::GetEventName( GlobalEventId::PRINTDOC ), + nullptr, + css::uno::Reference< css::frame::XController >() ) + , mnPrintableState( nState ) + {} + + css::view::PrintableState GetWhich() const { return mnPrintableState; } + const css::uno::Sequence < css::beans::PropertyValue >& GetOptions() const { return aOpts; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/evntconf.hxx b/include/sfx2/evntconf.hxx new file mode 100644 index 000000000..0233f0810 --- /dev/null +++ b/include/sfx2/evntconf.hxx @@ -0,0 +1,102 @@ +/* -*- 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_EVNTCONF_HXX +#define INCLUDED_SFX2_EVNTCONF_HXX + +#include +#include +#include +#include +#include +#include +#include + +class SfxObjectShell; +class SvxMacro; + +struct SFX2_DLLPUBLIC SfxEventName +{ + SvMacroItemId mnId; + OUString maEventName; + OUString maUIName; + + SfxEventName( SvMacroItemId nId, + const OUString& rEventName, + const OUString& rUIName ) + : mnId( nId ) + , maEventName( rEventName ) + , maUIName( rUIName ) {} +}; + +class SFX2_DLLPUBLIC SfxEventNamesList +{ +private: + ::std::vector< SfxEventName > aEventNamesList; + +public: + SfxEventNamesList() {} + SfxEventNamesList( const SfxEventNamesList &rCpy ) { *this = rCpy; } + ~SfxEventNamesList(); + SfxEventNamesList& operator=( const SfxEventNamesList &rCpy ); + + size_t size() const { return aEventNamesList.size(); }; + + SfxEventName& at( size_t Index ) { return aEventNamesList[ Index ]; } + SfxEventName const & at( size_t Index ) const { return aEventNamesList[ Index ]; } + + void push_back( SfxEventName Item ) { aEventNamesList.push_back( std::move(Item) ); } +}; + +class SFX2_DLLPUBLIC SfxEventNamesItem final : public SfxPoolItem +{ + SfxEventNamesList aEventsList; + +public: + + SfxEventNamesItem ( const sal_uInt16 nId ) : SfxPoolItem( nId ) {} + + virtual bool operator==( const SfxPoolItem& ) const override; + virtual bool GetPresentation( SfxItemPresentation ePres, + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper& ) const override; + virtual SfxEventNamesItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + const SfxEventNamesList& GetEvents() const { return aEventsList;} + void AddEvent( const OUString&, const OUString&, SvMacroItemId ); +}; + + +#define PROP_EVENT_TYPE "EventType" +#define PROP_LIBRARY "Library" +#define PROP_SCRIPT "Script" +#define PROP_MACRO_NAME "MacroName" +#define STAR_BASIC "StarBasic" + +class SFX2_DLLPUBLIC SfxEventConfiguration +{ +public: + static void ConfigureEvent( const OUString& aName, const SvxMacro&, SfxObjectShell const * pObjSh); + static std::unique_ptr ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/fcontnr.hxx b/include/sfx2/fcontnr.hxx new file mode 100644 index 000000000..86f20bf11 --- /dev/null +++ b/include/sfx2/fcontnr.hxx @@ -0,0 +1,119 @@ +/* -*- 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_FCONTNR_HXX +#define INCLUDED_SFX2_FCONTNR_HXX + +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace com::sun::star::beans { struct NamedValue; } +namespace com::sun::star::container { class XNameAccess; } +namespace com::sun::star::uno { template class Sequence; } +namespace com::sun::star::uno { template class Reference; } + +class ErrCode; +class SfxFilter; +class SfxMedium; +class SfxFilterContainer_Impl; + + +class SFX2_DLLPUBLIC SfxFilterContainer +{ + std::unique_ptr pImpl; + +public: + SfxFilterContainer( const OUString& rName ); + ~SfxFilterContainer(); + + + OUString const & GetName() const; + + std::shared_ptr GetAnyFilter( SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + std::shared_ptr GetFilter4EA( const OUString& rEA, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + std::shared_ptr GetFilter4Extension( const OUString& rExt, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + std::shared_ptr GetFilter4FilterName( const OUString& rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + + SAL_DLLPRIVATE static void ReadFilters_Impl( bool bUpdate=false ); + SAL_DLLPRIVATE static void ReadSingleFilter_Impl( const OUString& rName, + const css::uno::Reference< css::container::XNameAccess >& xTypeCFG, + const css::uno::Reference< css::container::XNameAccess >& xFilterCFG, + bool bUpdate ); + SAL_DLLPRIVATE static std::shared_ptr GetDefaultFilter_Impl( const OUString& ); +}; + +class SfxFilterMatcher_Impl; + +class SFX2_DLLPUBLIC SfxFilterMatcher +{ + friend class SfxFilterMatcherIter; + SfxFilterMatcher_Impl &m_rImpl; +public: + SfxFilterMatcher( const OUString& rFact ); + SfxFilterMatcher(); + ~SfxFilterMatcher(); + SfxFilterMatcher(const SfxFilterMatcher&) = delete; + SfxFilterMatcher& operator=( const SfxFilterMatcher& ) = delete; + + SAL_DLLPRIVATE static bool IsFilterInstalled_Impl( const std::shared_ptr& pFilter ); + DECL_DLLPRIVATE_LINK( MaybeFileHdl_Impl, OUString*, bool ); + + ErrCode GuessFilterIgnoringContent( SfxMedium const & rMedium, std::shared_ptr& ) const; + ErrCode GuessFilter( SfxMedium& rMedium, std::shared_ptr& , SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + ErrCode GuessFilterControlDefaultUI( SfxMedium& rMedium, std::shared_ptr&, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + ErrCode DetectFilter( SfxMedium& rMedium, std::shared_ptr& ) const; + + std::shared_ptr GetFilter4Mime( const OUString& rMime, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED) const; + std::shared_ptr GetFilter4ClipBoardId( SotClipboardFormatId nId, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + std::shared_ptr GetFilter4EA( const OUString& rEA, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + std::shared_ptr GetFilter4Extension( const OUString& rExt, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + std::shared_ptr GetFilter4FilterName( const OUString& rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + std::shared_ptr GetFilter4UIName( const OUString& rName, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + std::shared_ptr GetFilterForProps( const css::uno::Sequence < css::beans::NamedValue >& aSeq, SfxFilterFlags nMust = SfxFilterFlags::NONE, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const; + std::shared_ptr GetAnyFilter( SfxFilterFlags nMustg=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED ) const; +}; + +class SFX2_DLLPUBLIC SfxFilterMatcherIter + +{ + SfxFilterFlags nOrMask; + SfxFilterFlags nAndMask; + sal_uInt16 nCurrent; + const SfxFilterMatcher_Impl &m_rMatch; + + SAL_DLLPRIVATE std::shared_ptr Find_Impl(); + +public: + SfxFilterMatcherIter( const SfxFilterMatcher& rMatcher, SfxFilterFlags nMask = SfxFilterFlags::NONE, SfxFilterFlags nNotMask = SFX_FILTER_NOTINSTALLED ); + SfxFilterMatcherIter(const SfxFilterMatcherIter&) = delete; + SfxFilterMatcherIter& operator=( const SfxFilterMatcherIter& ) = delete; + std::shared_ptr First(); + std::shared_ptr Next(); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx new file mode 100644 index 000000000..42d6b53c0 --- /dev/null +++ b/include/sfx2/filedlghelper.hxx @@ -0,0 +1,264 @@ +/* -*- 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_FILEDLGHELPER_HXX +#define INCLUDED_SFX2_FILEDLGHELPER_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace com +{ + namespace sun + { + namespace star + { + namespace ui + { + namespace dialogs + { + class XFilePicker3; + struct FilePickerEvent; + struct DialogClosedEvent; + } + } + } + } +} + +namespace com::sun::star::awt { class XWindow; } +namespace com::sun::star::uno { template class Reference; } +namespace weld { class Window; } + +class Graphic; +class SfxFilter; +class SfxItemSet; + +enum class FileDialogFlags { + NONE = 0x00, + Insert = 0x01, // turn Open into Insert dialog + Export = 0x02, // turn Save into Export dialog + SaveACopy = 0x04, // turn Save into Save a Copy dialog + MultiSelection = 0x08, + Graphic = 0x10, // register graphic formats + /// Sign existing PDF. + SignPDF = 0x20, + InsertCompare = 0x40, /// Special insertion ("Compare" caption) + InsertMerge = 0x80, /// Special insertion ("Merge" caption) +}; +namespace o3tl { + template<> struct typed_flags : is_typed_flags {}; +} + +#define FILEDIALOG_FILTER_ALL "*.*" + +namespace sfx2 { + +class FileDialogHelper_Impl; + +class SFX2_DLLPUBLIC FileDialogHelper +{ +public: + enum Context // context where the FileDialogHelper is used + { + UNKNOWN_CONTEXT, // unknown context + SW_INSERT_GRAPHIC, // insert graphic in writer + SD_EXPORT, // export in draw + SI_EXPORT, // export in impress + SW_EXPORT // export in writer + }; + +private: + Link m_aDialogClosedLink; + ErrCode m_nError; + + rtl::Reference< FileDialogHelper_Impl > mpImpl; + + +public: + FileDialogHelper(sal_Int16 nDialogType, + FileDialogFlags nFlags, + weld::Window* pPreferredParent); + + FileDialogHelper(sal_Int16 nDialogType, + FileDialogFlags nFlags, + const OUString& rFactory, + SfxFilterFlags nMust, + SfxFilterFlags nDont, + weld::Window* pPreferredParent); + + FileDialogHelper(sal_Int16 nDialogType, + FileDialogFlags nFlags, + const OUString& rFactory, + sal_Int16 nDialog, + SfxFilterFlags nMust, + SfxFilterFlags nDont, + const OUString& rStandardDir, + const css::uno::Sequence< OUString >& rBlackList, + weld::Window* pPreferredParent); + + FileDialogHelper(sal_Int16 nDialogType, + FileDialogFlags nFlags, + const OUString& aFilterUIName, + const OUString& aExtName, + const OUString& rStandardDir, + const css::uno::Sequence< OUString >& rBlackList, + weld::Window* pPreferredParent); + + virtual ~FileDialogHelper(); + + FileDialogHelper& operator=(const FileDialogHelper &) = delete; + FileDialogHelper(const FileDialogHelper &) = delete; + + ErrCode Execute(); + void StartExecuteModal( const Link& rEndDialogHdl ); + ErrCode const & GetError() const { return m_nError; } + sal_Int16 GetDialogType() const; + bool IsPasswordEnabled() const; + OUString GetRealFilter() const; + + void SetTitle( const OUString& rNewTitle ); + OUString GetPath() const; + + /** @deprecated: Don't use this method to retrieve the selected files + There are file picker which can provide multiple selected file which belong + to different folders. As this method always provides the root folder for all selected + files this cannot work. + */ + css::uno::Sequence< OUString > GetMPath() const; + + /** Provides the selected files with full path information */ + css::uno::Sequence< OUString > GetSelectedFiles() const; + + void AddFilter( const OUString& rFilterName, const OUString& rExtension ); + void SetCurrentFilter( const OUString& rFilter ); + + /** sets an initial display directory/file name + + @deprecated + don't use this method. It contains a lot of magic in determining whether the + last segment of the given path/URL denotes a file name or a folder, and by + definition, it cannot succeed with this magic *all* the time - there will + always be scenarios where it fails. + + Use SetDisplayFolder and SetFileName. + */ + void SetDisplayDirectory( const OUString& rPath ); + + /** sets a new folder whose content is to be displayed in the file picker + + @param _rURL + specifies the URL of the folder whose content is to be displayed.
+ If the URL doesn't denote a valid (existent and accessible) folder, the + request is silently dropped. + @throws css::uno::RuntimeException + if the invocation of any of the file picker or UCB methods throws a RuntimeException. + */ + void SetDisplayFolder( const OUString& _rURL ); + + /** sets an initial file name to display + + This method is usually used in "save-as" contexts, where the application should + suggest an initial name for the file to save. + + Calling this method is nearly equivalent to calling GetFilePicker().setDefaultName( _rFileName ), + with the following differences: +
  • The FileDialogHelper remembers the given file name, and upon execution, + strips its extension if the dialog is set up for "automatic file name extension".
  • +
  • Exceptions thrown from the XFilePicker3 are caught and silenced.
  • +
+ */ + void SetFileName( const OUString& _rFileName ); + + OUString GetCurrentFilter() const; + OUString GetDisplayDirectory() const; + ErrCode GetGraphic( Graphic& rGraphic ) const; + + const css::uno::Reference < css::ui::dialogs::XFilePicker3 >& GetFilePicker() const; + + // XFilePickerListener methods + void FileSelectionChanged(); + void DirectoryChanged(); + virtual void ControlStateChanged( const css::ui::dialogs::FilePickerEvent& aEvent ); + void DialogSizeChanged(); + static OUString HelpRequested( const css::ui::dialogs::FilePickerEvent& aEvent ); + + // XDialogClosedListener methods + void DialogClosed( const css::ui::dialogs::DialogClosedEvent& _rEvent ); + + /** sets help ids for the controls in the dialog + @param _pControlId + Pointer to a 0-terminated array of control ids. They must be recruited from the + CommonFilePickerElementIds and ExtendedFilePickerElementIds values. + @param _pHelpId + Pointer to an array of help ids. For each element in _pControlId, there must be + a corresponding element herein. + */ + void SetControlHelpIds( const sal_Int16* _pControlId, const char** _pHelpId ); + void CreateMatcher( const OUString& rName ); + + /** sets the context of the dialog and trigger necessary actions e.g. loading config, setting help id + @param _eNewContext + New context for the dialog. + */ + void SetContext( Context _eNewContext ); + + DECL_LINK( ExecuteSystemFilePicker, void*, void ); + + ErrCode Execute( std::vector& rpURLList, + std::unique_ptr& rpSet, + OUString& rFilter, + const OUString& rDirPath ); + ErrCode Execute( std::unique_ptr& rpSet, + OUString& rFilter ); +}; + +#define SFX2_IMPL_DIALOG_CONFIG 0 +#define SFX2_IMPL_DIALOG_SYSTEM 1 +#define SFX2_IMPL_DIALOG_OOO 2 +#define SFX2_IMPL_DIALOG_REMOTE 3 + +ErrCode FileOpenDialog_Impl( weld::Window* pParent, + sal_Int16 nDialogType, + FileDialogFlags nFlags, + std::vector& rpURLList, + OUString& rFilter, + std::unique_ptr& rpSet, + const OUString* pPath, + sal_Int16 nDialog, + const OUString& rStandardDir, + const css::uno::Sequence< OUString >& rBlackList = css::uno::Sequence< OUString >()); + + +ErrCode RequestPassword(const std::shared_ptr& pCurrentFilter, OUString const & aURL, SfxItemSet* pSet, const css::uno::Reference& rParent); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/flatpak.hxx b/include/sfx2/flatpak.hxx new file mode 100644 index 000000000..cb5d758b5 --- /dev/null +++ b/include/sfx2/flatpak.hxx @@ -0,0 +1,34 @@ +/* -*- 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_INCLUDE_SFX2_FLATPAK_HXX +#define INCLUDED_INCLUDE_SFX2_FLATPAK_HXX + +#include + +#include +#include + +// Functionality related to the Flatpak version of LibreOffice. + +namespace flatpak { + +bool isFlatpak(); + +// Must only be called with SolarMutex locked: +bool createTemporaryHtmlDirectory(OUString ** url); + +// Must only be called with SolarMutex locked: +SFX2_DLLPUBLIC void removeTemporaryHtmlDirectory(); + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx new file mode 100644 index 000000000..4eb2c6115 --- /dev/null +++ b/include/sfx2/frame.hxx @@ -0,0 +1,213 @@ +/* -*- 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_FRAME_HXX +#define INCLUDED_SFX2_FRAME_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace com +{ + namespace sun + { + namespace star + { + namespace frame + { + class XFrame; + class XController; + } + } + } +} + +class SvBorder; +class SfxWorkWindow; +namespace vcl { class Window; } +class SfxFrame_Impl; +class SfxObjectShell; +class SfxViewFrame; +class SfxFrameDescriptor; +namespace tools { class Rectangle; } +class SystemWindow; + +typedef ::std::vector TargetList; + + +// SfxFrame is a management class for windows and their content. +// A SfxApplication represent a hierarchy of SfxFrames, with which the actual +// content in the derived classes is defined. The base class SfxFrame +// implements two aspects of frames: naming and control of its lifespan. +// Inside a frame hierarchy the parent frame always controls the lifespan of +// its child frames, even though they usually are not even produced by the +// parent. By calling DoCloser() on any frame in the hierarchy, +// a part of the "framework" can be removed, where frames unsubscribe +// from their parent frames. + + +class SFX2_DLLPUBLIC SfxFrame final : public SvCompatWeakBase +{ + friend class SfxFrameIterator; + friend class SfxFrameWindow_Impl; + +private: + std::unique_ptr< SfxFrame_Impl > pImpl; + VclPtr pWindow; + + virtual ~SfxFrame(); + + SAL_DLLPRIVATE SfxFrame( vcl::Window& i_rContainerWindow ); + +public: + static SfxFrame* Create( const css::uno::Reference< css::frame::XFrame >& xFrame ); + static css::uno::Reference< css::frame::XFrame > + CreateBlankFrame(); + static SfxFrame* CreateHidden( SfxObjectShell const & rDoc, vcl::Window& rWindow, SfxInterfaceId nViewId ); + + vcl::Window& GetWindow() const { return *pWindow;} + void CancelTransfers(); + bool DoClose(); + + void SetPresentationMode( bool bSet ); + SystemWindow* GetSystemWindow() const; + + static SfxFrame* GetFirst(); + static SfxFrame* GetNext( SfxFrame& ); + + SfxObjectShell* GetCurrentDocument() const; + SfxViewFrame* GetCurrentViewFrame() const; + + bool GetHasTitle() const; + static void GetDefaultTargetList( TargetList& ); + void UpdateDescriptor( SfxObjectShell const *pDoc ); + void Resize(); + const css::uno::Reference< css::frame::XFrame >& + GetFrameInterface() const; + void Appear(); + void AppearWithUpdate(); + css::uno::Reference< css::frame::XController > + GetController() const; + + bool IsInPlace() const; + + SAL_DLLPRIVATE void DoClose_Impl(); + SAL_DLLPRIVATE void SetFrameInterface_Impl( const css::uno::Reference< css::frame::XFrame >& rFrame ); + SAL_DLLPRIVATE void ReleasingComponent_Impl(); + SAL_DLLPRIVATE void GetViewData_Impl(); + SAL_DLLPRIVATE void SetHasTitle( bool ); + SAL_DLLPRIVATE bool PrepareClose_Impl( bool bUI ); + SAL_DLLPRIVATE bool DocIsModified_Impl(); + SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* ); + SAL_DLLPRIVATE bool IsClosing_Impl() const; + SAL_DLLPRIVATE void SetIsClosing_Impl(); + + // Methods for accessing the current set + SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const; + + SAL_DLLPRIVATE bool IsAutoLoadLocked_Impl() const; + + SAL_DLLPRIVATE static void InsertTopFrame_Impl( SfxFrame* pFrame ); + SAL_DLLPRIVATE static void RemoveTopFrame_Impl( SfxFrame* pFrame ); + SAL_DLLPRIVATE void SetOwnsBindings_Impl( bool bSet ); + SAL_DLLPRIVATE bool OwnsBindings_Impl() const; + SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl() const; + SAL_DLLPRIVATE void SetToolSpaceBorderPixel_Impl( const SvBorder& ); + SAL_DLLPRIVATE tools::Rectangle GetTopOuterRectPixel_Impl() const; + SAL_DLLPRIVATE void CreateWorkWindow_Impl(); + SAL_DLLPRIVATE void GrabFocusOnComponent_Impl(); + + SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc ); + SAL_DLLPRIVATE void LockResize_Impl( bool bLock ); + SAL_DLLPRIVATE void SetMenuBarOn_Impl( bool bOn ); + SAL_DLLPRIVATE bool IsMenuBarOn_Impl() const; + SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; + SAL_DLLPRIVATE bool IsMarkedHidden_Impl() const; +private: + SAL_DLLPRIVATE void Construct_Impl(); +}; + +typedef SvCompatWeakRef SfxFrameWeakRef; + +class SFX2_DLLPUBLIC SfxFrameItem final : public SfxPoolItem +{ + SfxFrame* pFrame; + SfxFrameWeakRef wFrame; + +public: + + SfxFrameItem( sal_uInt16 nWhich, SfxViewFrame const *p ); + SfxFrameItem( SfxFrame *p ); + SfxFrameItem( sal_uInt16 nWhich, SfxFrame *p ); + + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SfxFrameItem* Clone( SfxItemPool *pPool = nullptr ) 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; + + SfxFrame* GetFrame() const { return wFrame; } +}; + +class SFX2_DLLPUBLIC SfxUnoAnyItem final : public SfxPoolItem +{ + css::uno::Any aValue; +public: + static SfxPoolItem* CreateDefault(); + SfxUnoAnyItem(); + SfxUnoAnyItem( sal_uInt16 nWhich, const css::uno::Any& rAny ); + const css::uno::Any& GetValue() const + { return aValue; } + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SfxUnoAnyItem* Clone( SfxItemPool *pPool = nullptr ) 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; +}; + +class SFX2_DLLPUBLIC SfxUnoFrameItem final : public SfxPoolItem +{ + css::uno::Reference< css::frame::XFrame > + m_xFrame; + +public: + static SfxPoolItem* CreateDefault(); + SfxUnoFrameItem(); + SfxUnoFrameItem( sal_uInt16 nWhich, const css::uno::Reference< css::frame::XFrame >& i_rFrame ); + const css::uno::Reference< css::frame::XFrame >& + GetFrame() const + { return m_xFrame; } + virtual bool operator==( const SfxPoolItem& ) const override; + virtual SfxUnoFrameItem* Clone( SfxItemPool *pPool = nullptr ) 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; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/frmdescr.hxx b/include/sfx2/frmdescr.hxx new file mode 100644 index 000000000..196a2ccc9 --- /dev/null +++ b/include/sfx2/frmdescr.hxx @@ -0,0 +1,102 @@ +/* -*- 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_FRMDESCR_HXX +#define INCLUDED_SFX2_FRMDESCR_HXX + +#include +#include +#include +#include +#include +#include + +// The SfxFrame descriptors build a recursive structure, that covers all the +// required data in-order to display the frame document. +// Through a SfxFrameSetDescriptor access is given to the whole underlying +// structure. Due to the nature of the SfxFrames document, the +// SfxFramesSetDescriptor is not only the content of this document, but also +// describes the view on it. The FrameSet is made up of lines, which in turn, +// contains the actual window . A line can be horizontally or vertically +// aligned, from which also the alignment of the FrameSet is given. + + +enum class ScrollingMode +{ + Yes, + No, + Auto +}; + +#define SIZE_NOT_SET -1L + +class SfxItemSet; + +class SFX2_DLLPUBLIC SfxFrameDescriptor +{ + INetURLObject aURL; + OUString aName; + Size aMargin; + ScrollingMode eScroll; + bool bHasBorder; + bool bHasBorderSet; + std::unique_ptr m_pArgs; + +public: + SfxFrameDescriptor(); + ~SfxFrameDescriptor(); + + // FileName/URL + SfxItemSet* GetArgs(); + const INetURLObject& GetURL() const + { return aURL; } + void SetURL( const OUString& rURL ); + void SetActualURL( const OUString& rURL ); + + // FrameName + const OUString& GetName() const + { return aName; } + void SetName( const OUString& rName ) + { aName = rName; } + + // Margin, Scrolling + const Size& GetMargin() const + { return aMargin; } + void SetMargin( const Size& rMargin ) + { aMargin = rMargin; } + ScrollingMode GetScrollingMode() const + { return eScroll; } + void SetScrollingMode( ScrollingMode eMode ) + { eScroll = eMode; } + + // FrameBorder + bool HasFrameBorder() const + { return bHasBorder; } + bool IsFrameBorderOn() const + { return bHasBorder; } + void SetFrameBorder( bool bBorder ) + { bHasBorder = bBorder; bHasBorderSet = true; } + bool IsFrameBorderSet() const + { return bHasBorderSet; } + void ResetBorder() + { bHasBorder = false; bHasBorderSet = false; } +}; + +#endif // INCLUDED_SFX2_FRMDESCR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/frmhtml.hxx b/include/sfx2/frmhtml.hxx new file mode 100644 index 000000000..c489390ec --- /dev/null +++ b/include/sfx2/frmhtml.hxx @@ -0,0 +1,39 @@ +/* -*- 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_FRMHTML_HXX +#define INCLUDED_SFX2_FRMHTML_HXX + +#include +#include + +#include + +class SfxFrameDescriptor; + +namespace SfxFrameHTMLParser +{ + // These methods can also be used by other parsers. + SFX2_DLLPUBLIC void ParseFrameOptions(SfxFrameDescriptor*, const HTMLOptions&, const OUString& ); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/frmhtmlw.hxx b/include/sfx2/frmhtmlw.hxx new file mode 100644 index 000000000..dfc0d1645 --- /dev/null +++ b/include/sfx2/frmhtmlw.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 . + */ +#ifndef INCLUDED_SFX2_FRMHTMLW_HXX +#define INCLUDED_SFX2_FRMHTMLW_HXX + +#include +#include +#include +#include + +class SvStream; + +namespace com::sun::star { + namespace document { + class XDocumentProperties; + } +} + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::uno { template class Reference; } + +class SFX2_DLLPUBLIC SfxFrameHTMLWriter +{ + SAL_DLLPRIVATE static void OutMeta( SvStream& rStrm, + const char *pIndent, const OUString& rName, + const OUString& rContent, bool bHTTPEquiv, + rtl_TextEncoding eDestEnc, + OUString *pNonConvertableChars = nullptr ); + SAL_DLLPRIVATE inline static void OutMeta( SvStream& rStrm, + const char *pIndent, const char *pName, + const OUString& rContent, bool bHTTPEquiv, + rtl_TextEncoding eDestEnc, + OUString *pNonConvertableChars = nullptr ); + +public: + static void Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, + const css::uno::Reference< css::document::XDocumentProperties>&, + const char *pIndent, + rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, + OUString *pNonConvertableChars = nullptr ); + + static void Out_FrameDescriptor( + SvStream&, const OUString& rBaseURL, const css::uno::Reference < css::beans::XPropertySet >& xSet, + rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, + OUString *pNonConvertableChars = nullptr ); +}; + +inline void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm, + const char *pIndent, const char *pName, + const OUString& rContent, bool bHTTPEquiv, + rtl_TextEncoding eDestEnc, + OUString *pNonConvertableChars ) +{ + OUString sTmp = OUString::createFromAscii(pName); + OutMeta( rStrm, pIndent, sTmp, rContent, bHTTPEquiv, eDestEnc, pNonConvertableChars ); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/groupid.hxx b/include/sfx2/groupid.hxx new file mode 100644 index 000000000..7829fa8c0 --- /dev/null +++ b/include/sfx2/groupid.hxx @@ -0,0 +1,74 @@ +/* -*- 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_GROUPID_HXX +#define INCLUDED_SFX2_GROUPID_HXX + +#include + +#include + +// !! If you add a new group, please change sfxbasecontroller.cxx and +// !! com.sun.star.frame.CommandGroup accordingly! + +enum class SfxGroupId { + NONE = 0, + Intern = 32700, + Application, + Document, + View, + Edit, + Macro, + Options, + Math, + Navigator, + Insert, + Format, + Template, + Text, + Frame, + Graphic, + Table, + Enumeration, + Data, + Special, + Image, + Chart, + Explorer, + Connector, + Modify, + Drawing, + Controls +}; + +// make it hashable for storing in maps +namespace std +{ + template <> + struct hash + { + std::size_t operator()(const SfxGroupId& k) const + { + return std::hash()(static_cast(k)); + } + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/htmlmode.hxx b/include/sfx2/htmlmode.hxx new file mode 100644 index 000000000..4888c48e4 --- /dev/null +++ b/include/sfx2/htmlmode.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_HTMLMODE_HXX +#define INCLUDED_SFX2_HTMLMODE_HXX + +enum { + HTMLMODE_ON = 0x0001, + HTMLMODE_SOME_STYLES = 0x0020, /* mind. MS IE */ + HTMLMODE_FULL_STYLES = 0x0040 /* == SW */ +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/infobar.hxx b/include/sfx2/infobar.hxx new file mode 100644 index 000000000..40a1b1ff9 --- /dev/null +++ b/include/sfx2/infobar.hxx @@ -0,0 +1,124 @@ +/* -*- 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_INFOBAR_HXX +#define INCLUDED_SFX2_INFOBAR_HXX + +#include + +#include + +#include +#include + +class FixedImage; +class FixedText; +class Button; +class PushButton; + +// These must match the values in offapi/com/sun/star/frame/InfobarType.idl +enum class InfobarType +{ + INFO = 0, + SUCCESS = 1, + WARNING = 2, + DANGER = 3 +}; + +class InfobarData +{ +public: + OUString msId; + OUString msPrimaryMessage; + OUString msSecondaryMessage; + InfobarType maInfobarType; + bool mbShowCloseButton; +}; + +/** SfxChildWindow for positioning the InfoBar in the view. + */ +class SFX2_DLLPUBLIC SfxInfoBarContainerChild final : public SfxChildWindow +{ +private: + SfxBindings* m_pBindings; + +public: + SfxInfoBarContainerChild(vcl::Window* pParent, sal_uInt16 nId, SfxBindings* pBindings, + SfxChildWinInfo* pInfo); + virtual ~SfxInfoBarContainerChild() override; + + SFX_DECL_CHILDWINDOW_WITHID(SfxInfoBarContainerChild); + + void Update(); +}; + +/** Class representing a single InfoBar to be added in a SfxInfoBarContainerWindow. + */ +class SFX2_DLLPUBLIC SfxInfoBarWindow final : public vcl::Window +{ +private: + OUString m_sId; + InfobarType m_eType; + VclPtr m_pImage; + VclPtr m_pPrimaryMessage; + VclPtr m_pSecondaryMessage; + VclPtr