From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- sfx2/source/inc/StyleList.hxx | 239 +++++++++++++++++++++++ sfx2/source/inc/alienwarn.hxx | 39 ++++ sfx2/source/inc/appbaslib.hxx | 98 ++++++++++ sfx2/source/inc/appdata.hxx | 148 ++++++++++++++ sfx2/source/inc/appopen.hxx | 36 ++++ sfx2/source/inc/asyncfunc.hxx | 36 ++++ sfx2/source/inc/documentfontsdialog.hxx | 49 +++++ sfx2/source/inc/docundomanager.hxx | 159 +++++++++++++++ sfx2/source/inc/eventsupplier.hxx | 91 +++++++++ sfx2/source/inc/fltoptint.hxx | 62 ++++++ sfx2/source/inc/helper.hxx | 41 ++++ sfx2/source/inc/helpids.h | 49 +++++ sfx2/source/inc/hintpost.hxx | 59 ++++++ sfx2/source/inc/itemdel.hxx | 30 +++ sfx2/source/inc/macroloader.hxx | 88 +++++++++ sfx2/source/inc/nochaos.hxx | 35 ++++ sfx2/source/inc/objshimp.hxx | 153 +++++++++++++++ sfx2/source/inc/openflag.hxx | 33 ++++ sfx2/source/inc/openuriexternally.hxx | 40 ++++ sfx2/source/inc/openurlhint.hxx | 38 ++++ sfx2/source/inc/partwnd.hxx | 63 ++++++ sfx2/source/inc/preview.hxx | 41 ++++ sfx2/source/inc/recfloat.hxx | 61 ++++++ sfx2/source/inc/sfxpicklist.hxx | 42 ++++ sfx2/source/inc/sfxtypes.hxx | 51 +++++ sfx2/source/inc/sfxurlrelocator.hxx | 52 +++++ sfx2/source/inc/slotserv.hxx | 59 ++++++ sfx2/source/inc/splitwin.hxx | 125 ++++++++++++ sfx2/source/inc/statcach.hxx | 154 +++++++++++++++ sfx2/source/inc/templatesearchviewitem.hxx | 28 +++ sfx2/source/inc/templdgi.hxx | 242 +++++++++++++++++++++++ sfx2/source/inc/tplcitem.hxx | 45 +++++ sfx2/source/inc/versdlg.hxx | 95 +++++++++ sfx2/source/inc/workwin.hxx | 300 +++++++++++++++++++++++++++++ 34 files changed, 2881 insertions(+) create mode 100644 sfx2/source/inc/StyleList.hxx create mode 100644 sfx2/source/inc/alienwarn.hxx create mode 100644 sfx2/source/inc/appbaslib.hxx create mode 100644 sfx2/source/inc/appdata.hxx create mode 100644 sfx2/source/inc/appopen.hxx create mode 100644 sfx2/source/inc/asyncfunc.hxx create mode 100644 sfx2/source/inc/documentfontsdialog.hxx create mode 100644 sfx2/source/inc/docundomanager.hxx create mode 100644 sfx2/source/inc/eventsupplier.hxx create mode 100644 sfx2/source/inc/fltoptint.hxx create mode 100644 sfx2/source/inc/helper.hxx create mode 100644 sfx2/source/inc/helpids.h create mode 100644 sfx2/source/inc/hintpost.hxx create mode 100644 sfx2/source/inc/itemdel.hxx create mode 100644 sfx2/source/inc/macroloader.hxx create mode 100644 sfx2/source/inc/nochaos.hxx create mode 100644 sfx2/source/inc/objshimp.hxx create mode 100644 sfx2/source/inc/openflag.hxx create mode 100644 sfx2/source/inc/openuriexternally.hxx create mode 100644 sfx2/source/inc/openurlhint.hxx create mode 100644 sfx2/source/inc/partwnd.hxx create mode 100644 sfx2/source/inc/preview.hxx create mode 100644 sfx2/source/inc/recfloat.hxx create mode 100644 sfx2/source/inc/sfxpicklist.hxx create mode 100644 sfx2/source/inc/sfxtypes.hxx create mode 100644 sfx2/source/inc/sfxurlrelocator.hxx create mode 100644 sfx2/source/inc/slotserv.hxx create mode 100644 sfx2/source/inc/splitwin.hxx create mode 100644 sfx2/source/inc/statcach.hxx create mode 100644 sfx2/source/inc/templatesearchviewitem.hxx create mode 100644 sfx2/source/inc/templdgi.hxx create mode 100644 sfx2/source/inc/tplcitem.hxx create mode 100644 sfx2/source/inc/versdlg.hxx create mode 100644 sfx2/source/inc/workwin.hxx (limited to 'sfx2/source/inc') diff --git a/sfx2/source/inc/StyleList.hxx b/sfx2/source/inc/StyleList.hxx new file mode 100644 index 000000000..f6ba9f318 --- /dev/null +++ b/sfx2/source/inc/StyleList.hxx @@ -0,0 +1,239 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +class SfxObjectShell; +class SfxStyleFamilyItem; +class SfxTemplateItem; +class SfxCommonTemplateDialog_Impl; +class SfxTemplateControllerItem; + +enum class StyleFlags +{ + NONE = 0, + UpdateFamilyList = 1, + UpdateFamily = 2 +}; + +namespace o3tl +{ +template <> struct typed_flags : is_typed_flags +{ +}; +} + +class TreeViewDropTarget; + +constexpr int MAX_FAMILIES = 6; +constexpr int COUNT_BOUND_FUNC = 14; + +class StyleList final : public SfxListener +{ + friend class TreeViewDropTarget; + friend class SfxTemplateControllerItem; + +public: + // Constructor + StyleList(weld::Builder* pBuilder, SfxBindings* pBindings, SfxCommonTemplateDialog_Impl* Parent, + weld::Container* pC, OString treeviewname, OString flatviewname); + + // Destructor + ~StyleList(); + + // This function connects m_xTreeBox, m_xFmtLb and m_pParentDialog with certain LINKs + void Initialize(); + + // It selects the style in treeview + // bIsCallBack is true for the selected style. For eg. if "Addressee" is selected in + // styles, bIsCallBack will be true for it. + void SelectStyle(const OUString& rStr, bool bIsCallback); + // Checks whether a family has a saved state + bool CurrentFamilyHasState() { return nullptr != m_pFamilyState[m_nActFamily - 1]; } + + // This function is a subpart of Dialog's SetFamilyState + // When a new style is selected for use, it resets it. + void SetFamilyState(sal_uInt16 nSlotId, const SfxTemplateItem* pItem); + + // It is used in Dialog's EnableExample_Impl + // When the value of m_bNewbyExampleDisabled is updated there + // while creating a new style by example, + // the corresponding value gets updated here too. + void EnableNewByExample(bool newByExampleDisabled); + + // This function is used to set a hierarchical view. + void SetHierarchical(); + // This function handles the controls while setting a filter except hierarchical + void SetFilterControlsHandle(); + // Return whether treeview is visible + // It is used in StyleList's UpdateStyles_Hdl + // It is used to defaultly set the hierarchical view + bool IsTreeView() const { return m_xTreeBox->get_visible(); } + + // Helper function: Access to the current family item + // Used in Dialog's updateStyleHandler, Execute_Impl etc... + const SfxStyleFamilyItem* GetFamilyItem() const; + // Used to get the current selected entry in treeview + // Used in Dialog's Execute_Impl, Action_Select etc... + OUString GetSelectedEntry() const; + // Returns the Family Item at ith index + // Used in Dialog's ReadResource_Hdl + const SfxStyleFamilyItem& GetFamilyItemByIndex(size_t i) const; + bool IsHierarchical() const { return m_bHierarchical; } + + void Enabledel(bool candel) { m_bCanDel = candel; } + void Enablehide(bool canhide) { m_bCanHide = canhide; } + void Enableshow(bool canshow) { m_bCanShow = canshow; } + void Enablenew(bool cannew) { m_bCanNew = cannew; } + void Enableedit(bool canedit) { m_bCanEdit = canedit; } + // Handles the enabling/Disabling of Preview + void EnablePreview(bool bCustomPreview); + // Used in Dialog's Execute_Impl + // It is a necessary condition to execute a style + bool EnableExecute(); + + void connect_UpdateStyles(const Link& rLink) { m_aUpdateStyles = rLink; } + void connect_ReadResource(const Link& rLink) { m_aReadResource = rLink; } + void connect_ClearResource(const Link& rLink) { m_aClearResource = rLink; } + void connect_LoadFactoryStyleFilter(const Link& rLink); + void connect_SaveSelection(const Link rLink); + void connect_UpdateFamily(const Link rLink) { m_aUpdateFamily = rLink; } + + void FamilySelect(sal_uInt16 nEntry); + void FilterSelect(sal_uInt16 nActFilter, bool bsetFilter); + + DECL_LINK(NewMenuExecuteAction, void*, void); + +private: + void FillTreeBox(SfxStyleFamily eFam); + + void UpdateFamily(); + void UpdateStyles(StyleFlags nFlags); + + OUString getDefaultStyleName(const SfxStyleFamily eFam); + SfxStyleFamily GetActualFamily() const; + void GetSelectedStyle() const; + + sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt, const DropTargetHelper& rHelper); + void DropHdl(const OUString& rStyle, const OUString& rParent); + + void MenuSelect(const OString& rIdent); + void PrepareMenu(const Point& rPos); + void ShowMenu(const CommandEvent& rCEvt); + void CreateContextMenu(); + + void Notify(SfxBroadcaster& rBC, const SfxHint& rHint); + + // In which FamilyState do I have to look, in order to get the + // information of the ith Family in the pStyleFamilies. + sal_uInt16 StyleNrToInfoOffset(sal_uInt16 i); + + DECL_LINK(ReadResource, void*, size_t); + DECL_LINK(Clear, void*, void); + DECL_LINK(Cleanup, void*, void); + DECL_LINK(ExecuteDrop, const ExecuteDropEvent&, sal_Int8); + DECL_LINK(IsSafeForWaterCan, void*, bool); + DECL_LINK(HasSelectedStyle, void*, bool); + DECL_LINK(UpdateStyleDependents, void*, void); + DECL_LINK(TimeOut, Timer*, void); + DECL_LINK(EnableTreeDrag, bool, void); + DECL_LINK(EnableDelete, void*, void); + DECL_LINK(SetWaterCanState, const SfxBoolItem*, void); + DECL_LINK(SetFamily, sal_uInt16, void); + + void InvalidateBindings(); + + void Update(); + Link m_aUpdateStyles; + Link m_aReadResource; + Link m_aClearResource; + Link m_aLoadFactoryStyleFilter; + Link m_aSaveSelection; + Link m_aUpdateFamily; + + void NewHdl(); + void EditHdl(); + void DeleteHdl(); + void HideHdl(); + void ShowHdl(); + + DECL_LINK(DragBeginHdl, bool&, bool); + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString); + DECL_LINK(CustomRenderHdl, weld::TreeView::render_args, void); + DECL_LINK(FmtSelectHdl, weld::TreeView&, void); + DECL_LINK(TreeListApplyHdl, weld::TreeView&, bool); + DECL_LINK(MousePressHdl, const MouseEvent&, bool); + DECL_STATIC_LINK(StyleList, CustomGetSizeHdl, weld::TreeView::get_size_args, Size); + DECL_LINK(PopupFlatMenuHdl, const CommandEvent&, bool); + DECL_LINK(PopupTreeMenuHdl, const CommandEvent&, bool); + DECL_LINK(MenuSelectAsyncHdl, void*, void); + + bool m_bHierarchical : 1; + + bool m_bAllowReParentDrop : 1; + bool m_bNewByExampleDisabled : 1; + bool m_bDontUpdate : 1; + bool m_bTreeDrag : 1; + bool m_bCanEdit : 1; + bool m_bCanHide : 1; + bool m_bCanShow : 1; + bool m_bCanNew : 1; + bool m_bUpdateFamily : 1; + bool m_bCanDel : 1; + bool m_bBindingUpdate : 1; + SfxStyleSheetBasePool* m_pStyleSheetPool; + sal_uInt16 m_nActFilter; + std::unique_ptr m_xFmtLb; + std::unique_ptr m_xTreeBox; + + std::unique_ptr mxMenuBuilder; + std::unique_ptr mxMenu; + + std::optional m_xStyleFamilies; + std::array, MAX_FAMILIES> m_pFamilyState; + SfxObjectShell* m_pCurObjShell; + sal_uInt16 m_nActFamily; + SfxStyleSearchBits m_nAppFilter; // Filter, which has set the application (for automatic) + + std::unique_ptr m_xTreeView1DropTargetHelper; + std::unique_ptr m_xTreeView2DropTargetHelper; + + SfxCommonTemplateDialog_Impl* m_pParentDialog; + SfxBindings* m_pBindings; + std::array, COUNT_BOUND_FUNC> pBoundItems; + + std::unique_ptr pIdle; + + OString sLastItemIdent; + SfxModule* m_Module; + sal_uInt16 m_nModifier; + weld::Container* m_pContainer; +}; diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx new file mode 100644 index 000000000..7c4f8cb36 --- /dev/null +++ b/sfx2/source/inc/alienwarn.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_SOURCE_INC_ALIENWARN_HXX +#define INCLUDED_SFX2_SOURCE_INC_ALIENWARN_HXX + +#include + +class SfxAlienWarningDialog final : public weld::MessageDialogController +{ +private: + std::unique_ptr m_xKeepCurrentBtn; + std::unique_ptr m_xUseDefaultFormatBtn; + std::unique_ptr m_xWarningOnBox; + +public: + SfxAlienWarningDialog(weld::Window* pParent, std::u16string_view _rFormatName, + const OUString& _rDefaultExtension, bool rDefaultIsAlien); + virtual ~SfxAlienWarningDialog() override; +}; + +#endif // INCLUDED_SFX2_SOURCE_INC_ALIENWARN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/appbaslib.hxx b/sfx2/source/inc/appbaslib.hxx new file mode 100644 index 000000000..30473f2af --- /dev/null +++ b/sfx2/source/inc/appbaslib.hxx @@ -0,0 +1,98 @@ +/* -*- 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_SOURCE_INC_APPBASLIB_HXX +#define INCLUDED_SFX2_SOURCE_INC_APPBASLIB_HXX + +#include + +#include +#include +#include + +class BasicManager; + +/** helper class which holds and manipulates a BasicManager +*/ +class SfxBasicManagerHolder final + : public SfxListener +{ +private: + BasicManager* mpBasicManager; + css::uno::Reference< css::script::XStorageBasedLibraryContainer > + mxBasicContainer; + css::uno::Reference< css::script::XStorageBasedLibraryContainer > + mxDialogContainer; + +public: + SfxBasicManagerHolder(); + + enum ContainerType + { + SCRIPTS, DIALOGS + }; + + /** returns if and only if the instance is currently bound to a non- + BasicManager. + */ + bool isValid() const { return mpBasicManager != nullptr; } + + /** returns the BasicManager which this instance is currently bound to + */ + BasicManager* + get() const { return mpBasicManager; } + + /** binds the instance to the given BasicManager + */ + void reset( BasicManager* _pBasicManager ); + + css::script::XLibraryContainer * + getLibraryContainer( ContainerType _eType ); + + /** calls the storeLibraries at both our script and basic library container + */ + void storeAllLibraries(); + + /** calls the setStorage at all our XStorageBasedLibraryContainer. + */ + void setStorage( + const css::uno::Reference< css::embed::XStorage >& _rxStorage + ); + + /** calls the storeLibrariesToStorage at all our XStorageBasedLibraryContainer. + */ + void storeLibrariesToStorage( + const css::uno::Reference< css::embed::XStorage >& _rxStorage + ); + + + /** checks if any modules in the SfxLibraryContainer exceed the binary + limits. + */ + bool LegacyPsswdBinaryLimitExceeded( std::vector< OUString >& sModules ); + + virtual void Notify(SfxBroadcaster& rBC, SfxHint const& rHint) override; + +private: + void impl_releaseContainers(); +}; + +#endif // INCLUDED_SFX2_SOURCE_INC_APPBASLIB_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx new file mode 100644 index 000000000..121ba43f5 --- /dev/null +++ b/sfx2/source/inc/appdata.hxx @@ -0,0 +1,148 @@ +/* -*- 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_SOURCE_INC_APPDATA_HXX +#define INCLUDED_SFX2_SOURCE_INC_APPDATA_HXX + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "sfxpicklist.hxx" + +#include +#include +#include + +class SfxApplication; +class SfxProgress; +class SfxDdeDocTopic_Impl; +class DdeService; +class SfxItemPool; +class SfxFilterMatcher; +class ISfxTemplateCommon; +class SfxStatusDispatcher; +class SfxDdeTriggerTopic_Impl; +class SfxFrame; +class SfxViewFrame; +class SfxInterface; +class BasicManager; +class SfxBasicManagerHolder; +class SfxBasicManagerCreationListener; +namespace sfx2::sidebar { class Theme; } + + + +typedef std::vector SfxDdeDocTopics_Impl; + +class SfxAppData_Impl +{ +public: + IndexBitSet aIndexBitSet; // for counting noname documents + OUString aLastDir; // for IO dialog + + // DDE stuff + std::unique_ptr pDdeService; + std::unique_ptr pDocTopics; + std::unique_ptr pTriggerTopic; + std::unique_ptr pDdeService2; + + // single instance classes + std::vector maFactories; + std::vector vTopFrames; + + // application members + std::optional pMatcher; + std::optional m_pToolsErrorHdl; + std::optional m_pSoErrorHdl; +#if HAVE_FEATURE_SCRIPTING + std::optional m_pSbxErrorHdl; +#endif + rtl::Reference mxAppDispatch; + std::optional mxAppPickList; + std::optional pTemplates; + + // global pointers + SfxItemPool* pPool; + + // "current" functionality + SfxProgress* pProgress; + + sal_uInt16 nDocModalMode; // counts documents in modal mode + sal_uInt16 nRescheduleLocks; + + std::vector + maTbxCtrlFactories; + std::vector + maStbCtrlFactories; + std::vector maViewFrames; + std::vector maViewShells; + std::vector + maObjShells; + std::unique_ptr + pBasicManager; + std::unique_ptr + pBasMgrListener; + SfxViewFrame* pViewFrame; + std::optional pSlotPool; + std::optional + pAppDispat; // Dispatcher if no document + ::rtl::Reference m_pSidebarTheme; + + bool bDowning:1; // sal_True on Exit and afterwards + bool bInQuit : 1; + + SfxAppData_Impl(); + ~SfxAppData_Impl(); + + SfxDocumentTemplates* GetDocumentTemplates(); + void DeInitDDE(); + + o3tl::enumarray> aModules; + + /** called when the Application's BasicManager has been created. This can happen + explicitly in SfxApplication::GetBasicManager, or implicitly if a document's + BasicManager is created before the application's BasicManager exists. + */ + void OnApplicationBasicManagerCreated( BasicManager& _rManager ); +}; + +class SfxDdeTriggerTopic_Impl final : public DdeTopic +{ +#if defined(_WIN32) +public: + SfxDdeTriggerTopic_Impl() + : DdeTopic( "TRIGGER" ) + {} + + virtual bool Execute( const OUString* ) override { return true; } +#endif +}; + +#endif // INCLUDED_SFX2_SOURCE_INC_APPDATA_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/appopen.hxx b/sfx2/source/inc/appopen.hxx new file mode 100644 index 000000000..97a4d7a18 --- /dev/null +++ b/sfx2/source/inc/appopen.hxx @@ -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_SOURCE_INC_APPOPEN_HXX +#define INCLUDED_SFX2_SOURCE_INC_APPOPEN_HXX + +#include +#include + +class SfxItemPool; +class SfxMedium; +class SfxObjectShell; + +ErrCode CheckPasswd_Impl(SfxObjectShell* pDoc, SfxMedium* pFile); + +void SetTemplate_Impl(const OUString&, const OUString&, SfxObjectShell*); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/asyncfunc.hxx b/sfx2/source/inc/asyncfunc.hxx new file mode 100644 index 000000000..708750baa --- /dev/null +++ b/sfx2/source/inc/asyncfunc.hxx @@ -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/. + */ + +#ifndef INCLUDED_SFX2_ASYNCFUNC_HXX +#define INCLUDED_SFX2_ASYNCFUNC_HXX + +#include + +#include +#include +#include + +class AsyncFunc final : public cppu::WeakImplHelper +{ +private: + std::function m_pAsyncFunc; + +public: + AsyncFunc(const std::function&); + virtual ~AsyncFunc() override; + + void Execute(); + + //XUnoTunnel + UNO3_GETIMPLEMENTATION_DECL(AsyncFunc) +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/documentfontsdialog.hxx b/sfx2/source/inc/documentfontsdialog.hxx new file mode 100644 index 000000000..9ce447669 --- /dev/null +++ b/sfx2/source/inc/documentfontsdialog.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX2_SOURCE_INC_DOCUMENTFONTSDIALOG_HXX +#define INCLUDED_SFX2_SOURCE_INC_DOCUMENTFONTSDIALOG_HXX + +#include + +/** + Tab page for document font settings in the document properties dialog. +*/ +class SfxDocumentFontsPage final : public SfxTabPage +{ +public: + SfxDocumentFontsPage(weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet& set); + virtual ~SfxDocumentFontsPage() override; + static std::unique_ptr + Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* set); + +private: + virtual bool FillItemSet(SfxItemSet* set) override; + virtual void Reset(const SfxItemSet* set) override; + + std::unique_ptr embedFontsCheckbox; + std::unique_ptr embedUsedFontsCheckbox; + std::unique_ptr embedLatinScriptFontsCheckbox; + std::unique_ptr embedAsianScriptFontsCheckbox; + std::unique_ptr embedComplexScriptFontsCheckbox; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/docundomanager.hxx b/sfx2/source/inc/docundomanager.hxx new file mode 100644 index 000000000..98bf827fb --- /dev/null +++ b/sfx2/source/inc/docundomanager.hxx @@ -0,0 +1,159 @@ +/* -*- 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_SOURCE_INC_DOCUNDOMANAGER_HXX +#define INCLUDED_SFX2_SOURCE_INC_DOCUNDOMANAGER_HXX + +#include + +#include + +#include +#include + +#include + +/** base class for sub components of an SfxBaseModel, which share their ref count and lifetime with the SfxBaseModel +*/ +class SfxModelSubComponent +{ +public: + /** checks whether the instance is alive, i.e. properly initialized, and not yet disposed + */ + void MethodEntryCheck() + { + m_rModel.MethodEntryCheck( true ); + } + +protected: + SfxModelSubComponent( SfxBaseModel& i_model ) + :m_rModel( i_model ) + { + } + virtual ~SfxModelSubComponent(); + + void acquireModel() { m_rModel.acquire(); } + void releaseModel() { m_rModel.release(); } + +protected: + const SfxBaseModel& getBaseModel() const { return m_rModel; } + SfxBaseModel& getBaseModel() { return m_rModel; } + +private: + SfxBaseModel& m_rModel; +}; + +class SfxModelGuard +{ +public: + enum AllowedModelState + { + // not yet initialized + E_INITIALIZING, + // fully alive, i.e. initialized, and not yet disposed + E_FULLY_ALIVE + }; + + SfxModelGuard( SfxBaseModel const & i_rModel, const AllowedModelState i_eState = E_FULLY_ALIVE ) + : m_aGuard() + { + i_rModel.MethodEntryCheck( i_eState != E_INITIALIZING ); + } + SfxModelGuard( SfxModelSubComponent& i_rSubComponent ) + :m_aGuard() + { + i_rSubComponent.MethodEntryCheck(); + } + + void clear() + { + m_aGuard.clear(); + } + +private: + SolarMutexClearableGuard m_aGuard; +}; + +namespace sfx2 +{ + //= DocumentUndoManager + + struct DocumentUndoManager_Impl; + class DocumentUndoManager final : public ::cppu::WeakImplHelper + ,public SfxModelSubComponent + { + friend struct DocumentUndoManager_Impl; + + public: + DocumentUndoManager( SfxBaseModel& i_document ); + virtual ~DocumentUndoManager() override; + DocumentUndoManager(const DocumentUndoManager&) = delete; + DocumentUndoManager& operator=(const DocumentUndoManager&) = delete; + + void disposing(); + + // non-UNO API for our owner + /** determines whether we have an open Undo context. No mutex locking within this method, no disposal check - this + is the responsibility of the owner. + */ + bool isInContext() const; + + // XInterface + virtual void SAL_CALL acquire( ) noexcept override; + virtual void SAL_CALL release( ) noexcept override; + + // XUndoManager + virtual void SAL_CALL enterUndoContext( const OUString& i_title ) override; + virtual void SAL_CALL enterHiddenUndoContext( ) override; + virtual void SAL_CALL leaveUndoContext( ) override; + virtual void SAL_CALL addUndoAction( const css::uno::Reference< css::document::XUndoAction >& i_action ) override; + virtual void SAL_CALL undo( ) override; + virtual void SAL_CALL redo( ) override; + virtual sal_Bool SAL_CALL isUndoPossible( ) override; + virtual sal_Bool SAL_CALL isRedoPossible( ) override; + virtual OUString SAL_CALL getCurrentUndoActionTitle( ) override; + virtual OUString SAL_CALL getCurrentRedoActionTitle( ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getAllUndoActionTitles( ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getAllRedoActionTitles( ) override; + virtual void SAL_CALL clear( ) override; + virtual void SAL_CALL clearRedo( ) override; + virtual void SAL_CALL reset( ) override; + virtual void SAL_CALL addUndoManagerListener( const css::uno::Reference< css::document::XUndoManagerListener >& i_listener ) override; + virtual void SAL_CALL removeUndoManagerListener( const css::uno::Reference< css::document::XUndoManagerListener >& i_listener ) override; + + // XLockable, base of XUndoManager + virtual void SAL_CALL lock( ) override; + virtual void SAL_CALL unlock( ) override; + virtual sal_Bool SAL_CALL isLocked( ) override; + + // XChild, base of XUndoManager + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override; + virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override; + + private: + std::unique_ptr< DocumentUndoManager_Impl > m_pImpl; + }; + + +} // namespace sfx2 + + +#endif // INCLUDED_SFX2_SOURCE_INC_DOCUNDOMANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx new file mode 100644 index 000000000..56aa8f95e --- /dev/null +++ b/sfx2/source/inc/eventsupplier.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_SOURCE_INC_EVENTSUPPLIER_HXX +#define INCLUDED_SFX2_SOURCE_INC_EVENTSUPPLIER_HXX + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace comphelper +{ + class NamedValueCollection; +} + +class SfxObjectShell; +class SvxMacro; + + +class SfxEvents_Impl final : public ::cppu::WeakImplHelper< css::container::XNameReplace, css::document::XDocumentEventListener > +{ + css::uno::Sequence< OUString > maEventNames; + std::vector< css::uno::Sequence < css::beans::PropertyValue > > maEventData; + css::uno::Reference< css::document::XDocumentEventBroadcaster > mxBroadcaster; + std::mutex maMutex; + SfxObjectShell *mpObjShell; + +public: + SfxEvents_Impl( SfxObjectShell* pShell, + css::uno::Reference< css::document::XDocumentEventBroadcaster > const & xBroadcaster ); + virtual ~SfxEvents_Impl() override; + + // --- XNameReplace --- + virtual void SAL_CALL replaceByName( const OUString & aName, const css::uno::Any & aElement ) override; + + // --- XNameAccess ( parent of XNameReplace ) --- + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; + + // --- XElementAccess ( parent of XNameAccess ) --- + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // --- ::document::XDocumentEventListener --- + virtual void SAL_CALL documentEventOccured(const css::document::DocumentEvent& aEvent) override; + + // --- ::lang::XEventListener --- + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // convert and normalize + static std::unique_ptr ConvertToMacro( const css::uno::Any& rElement, SfxObjectShell* pDoc ); + static void NormalizeMacro( const css::uno::Any& rIn, css::uno::Any& rOut, SfxObjectShell* pDoc ); + static void NormalizeMacro( + const ::comphelper::NamedValueCollection& i_eventDescriptor, + ::comphelper::NamedValueCollection& o_normalizedDescriptor, + SfxObjectShell* i_document ); + static void Execute( css::uno::Sequence < css::beans::PropertyValue > const & aEventData, const css::document::DocumentEvent& aTrigger, SfxObjectShell* pDoc ); + +private: + /// Check if script URL whitelist exists, and if so, if current script url is part of it + static bool isScriptURLAllowed(const OUString& aScriptURL); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/fltoptint.hxx b/sfx2/source/inc/fltoptint.hxx new file mode 100644 index 000000000..ca9537bfe --- /dev/null +++ b/sfx2/source/inc/fltoptint.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX2_SOURCE_INC_FLTOPTINT_HXX +#define INCLUDED_SFX2_SOURCE_INC_FLTOPTINT_HXX + +#include +#include +#include +#include +#include + +class FilterOptionsContinuation final : public comphelper::OInteraction< css::document::XInteractionFilterOptions > +{ + css::uno::Sequence< css::beans::PropertyValue > rProperties; + +public: + virtual void SAL_CALL setFilterOptions( const css::uno::Sequence< css::beans::PropertyValue >& rProp ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getFilterOptions( ) override; +}; + +class RequestFilterOptions final : public ::cppu::WeakImplHelper< css::task::XInteractionRequest > +{ + css::uno::Any m_aRequest; + + rtl::Reference m_xAbort; + rtl::Reference m_xOptions; + +public: + RequestFilterOptions( css::uno::Reference< css::frame::XModel > const & rModel, + const css::uno::Sequence< css::beans::PropertyValue >& rProperties ); + + bool isAbort() const { return m_xAbort->wasSelected(); } + + css::uno::Sequence< css::beans::PropertyValue > getFilterOptions() + { + return m_xOptions->getFilterOptions(); + } + + virtual css::uno::Any SAL_CALL getRequest() override; + + virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > + > SAL_CALL getContinuations() override; +}; + +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/helper.hxx b/sfx2/source/inc/helper.hxx new file mode 100644 index 000000000..b2787a3ad --- /dev/null +++ b/sfx2/source/inc/helper.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/. + * + * 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_SOURCE_INC_HELPER_HXX +#define INCLUDED_SFX2_SOURCE_INC_HELPER_HXX + +#include + +#include + +// class SfxContentHelper ------------------------------------------------ + +class SfxContentHelper +{ +public: + static std::vector GetResultSet(const OUString& rURL); + static std::vector GetHelpTreeViewContents(const OUString& rURL); + static OUString GetActiveHelpString(const OUString& rURL); + static bool IsHelpErrorDocument(std::u16string_view rURL); + + static sal_Int64 GetSize(std::u16string_view rContent); +}; + +#endif // INCLUDED_SFX2_SOURCE_INC_HELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/helpids.h b/sfx2/source/inc/helpids.h new file mode 100644 index 000000000..91248f469 --- /dev/null +++ b/sfx2/source/inc/helpids.h @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX2_SOURCE_INC_HELPIDS_H +#define INCLUDED_SFX2_SOURCE_INC_HELPIDS_H + +#include + +inline constexpr OStringLiteral HID_TEMPLATE_FMT = "SFX2_HID_TEMPLATE_FMT"; +inline constexpr OStringLiteral HID_TEMPLATE_FILTER = "SFX2_HID_TEMPLATE_FILTER"; +inline constexpr OStringLiteral HID_TEMPLDLG_NEWBYEXAMPLE = "SFX2_HID_TEMPLDLG_NEWBYEXAMPLE"; +inline constexpr OStringLiteral HID_TEMPLDLG_UPDATEBYEXAMPLE = "SFX2_HID_TEMPLDLG_UPDATEBYEXAMPLE"; +inline constexpr OStringLiteral HID_TEMPLDLG_WATERCAN = "SFX2_HID_TEMPLDLG_WATERCAN"; +inline constexpr OStringLiteral HID_NAVIGATOR_WINDOW = "SFX2_HID_NAVIGATOR_WINDOW"; +inline constexpr OStringLiteral HID_TABDLG_RESET_BTN = "SFX2_HID_TABDLG_RESET_BTN"; +inline constexpr OStringLiteral HID_TABDLG_STANDARD_BTN = "SFX2_HID_TABDLG_STANDARD_BTN"; +inline constexpr OStringLiteral HID_TEMPLDLG_TOOLBOX_LEFT = "SFX2_HID_TEMPLDLG_TOOLBOX_LEFT"; +inline constexpr OStringLiteral HID_HELP_WINDOW = "SFX2_HID_HELP_WINDOW"; +inline constexpr OStringLiteral HID_HELP_TOOLBOX = "SFX2_HID_HELP_TOOLBOX"; +inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_INDEX = "SFX2_HID_HELP_TOOLBOXITEM_INDEX"; +inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_START = "SFX2_HID_HELP_TOOLBOXITEM_START"; +inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_BACKWARD = "SFX2_HID_HELP_TOOLBOXITEM_BACKWARD"; +inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_FORWARD = "SFX2_HID_HELP_TOOLBOXITEM_FORWARD"; +inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_PRINT = "SFX2_HID_HELP_TOOLBOXITEM_PRINT"; +inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_BOOKMARKS = "SFX2_HID_HELP_TOOLBOXITEM_BOOKMARKS"; +inline constexpr OStringLiteral HID_HELP_TOOLBOXITEM_SEARCHDIALOG = "SFX2_HID_HELP_TOOLBOXITEM_SEARCHDIALOG"; + +inline constexpr OStringLiteral HID_QUERY_LOAD_TEMPLATE = "SFX2_HID_QUERY_LOAD_TEMPLATE"; + +inline constexpr OStringLiteral HID_SIDEBAR_WINDOW = "SFX2_HID_SIDEBAR_WINDOW"; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/hintpost.hxx b/sfx2/source/inc/hintpost.hxx new file mode 100644 index 000000000..0a72aa661 --- /dev/null +++ b/sfx2/source/inc/hintpost.hxx @@ -0,0 +1,59 @@ +/* -*- 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_HINTPOST_HXX +#define INCLUDED_SFX2_HINTPOST_HXX + +#include +#include +#include +#include + + +class SfxRequest; + +/** [Description] + + This class allows sending unique events via VCL's + Application::PostUserEvent(). When the User-Event is dispatched, + the handler is called, which calls the Link provided with + SetEventHdl(). + + The instances are held via Ref-Count until a possibly sent + event has arrived. If the target dies before delivery, + the connection must be severed with SetEventHdl(Link()). +*/ +class SfxHintPoster final : public SvRefBase +{ +private: + std::function)> m_Link; + + DECL_LINK( DoEvent_Impl, void*, void ); + + virtual ~SfxHintPoster() override; + +public: + SfxHintPoster(const std::function)>& rLink); + + void Post( std::unique_ptr pHint ); + void SetEventHdl(const std::function)>& rLink); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/itemdel.hxx b/sfx2/source/inc/itemdel.hxx new file mode 100644 index 000000000..b8ea32501 --- /dev/null +++ b/sfx2/source/inc/itemdel.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_ITEMDEL_HXX +#define INCLUDED_SFX2_ITEMDEL_HXX + +#include + +class SfxPoolItem; + +void DeleteItemOnIdle(std::unique_ptr pItem); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/macroloader.hxx b/sfx2/source/inc/macroloader.hxx new file mode 100644 index 000000000..250a07cd8 --- /dev/null +++ b/sfx2/source/inc/macroloader.hxx @@ -0,0 +1,88 @@ +/* -*- 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_SOURCE_INC_MACROLOADER_HXX +#define INCLUDED_SFX2_SOURCE_INC_MACROLOADER_HXX + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +class SfxObjectShell; + +class SfxMacroLoader final : public cppu::WeakImplHelper< + css::frame::XDispatchProvider, + css::frame::XNotifyingDispatch, + css::frame::XSynchronousDispatch, + css::lang::XServiceInfo> +{ + css::uno::WeakReference < css::frame::XFrame > m_xFrame; + SfxObjectShell* GetObjectShell_Impl(); + +public: + /// @throws css::uno::Exception + /// @throws css::uno::RuntimeException + SfxMacroLoader(const css::uno::Sequence< css::uno::Any >& aArguments); + + virtual OUString SAL_CALL getImplementationName() override; + + virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; + + virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override; + + /// @throws css::uno::RuntimeException + /// @throws css::ucb::ContentCreationException + static ErrCode loadMacro( const OUString& aURL, css::uno::Any& rRetval, SfxObjectShell* pDoc ); + + virtual css::uno::Reference < css::frame::XDispatch > SAL_CALL queryDispatch( + const css::util::URL& aURL, const OUString& sTargetFrameName, + sal_Int32 eSearchFlags ) override; + + virtual css::uno::Sequence< css::uno::Reference < css::frame::XDispatch > > SAL_CALL queryDispatches( + const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescriptor ) override; + + virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArgs, const css::uno::Reference< css::frame::XDispatchResultListener >& Listener ) override; + + virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArgs ) override; + + virtual css::uno::Any SAL_CALL dispatchWithReturnValue( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArgs ) override; + + virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) override; + + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) override; + + static SfxObjectShell* GetObjectShell(const css::uno::Reference& xFrame); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/nochaos.hxx b/sfx2/source/inc/nochaos.hxx new file mode 100644 index 000000000..4baee35fc --- /dev/null +++ b/sfx2/source/inc/nochaos.hxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * 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_SOURCE_INC_NOCHAOS_HXX +#define INCLUDED_SFX2_SOURCE_INC_NOCHAOS_HXX + +#include + +class SfxItemPool; + +class NoChaos +{ +public: + static SfxItemPool* GetItemPool(); + static sal_uInt16 ReleaseItemPool(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx new file mode 100644 index 000000000..46db15898 --- /dev/null +++ b/sfx2/source/inc/objshimp.hxx @@ -0,0 +1,153 @@ +/* -*- 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_SOURCE_INC_OBJSHIMP_HXX +#define INCLUDED_SFX2_SOURCE_INC_OBJSHIMP_HXX + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "appbaslib.hxx" + +namespace svtools { class AsynchronLink; } + +class SfxViewFrame; + +class SfxBasicManagerHolder; + +class AutoReloadTimer_Impl final : public Timer +{ + OUString aUrl; + SfxObjectShell* pObjSh; + +public: + AutoReloadTimer_Impl( const OUString& rURL, sal_uInt32 nTime, + SfxObjectShell* pSh ); + virtual void Invoke() override; +}; + +struct SfxObjectShell_Impl final : public ::sfx2::IMacroDocumentAccess +{ + std::unique_ptr<::comphelper::EmbeddedObjectContainer> mxObjectContainer; + SfxBasicManagerHolder aBasicManager; + SfxObjectShell& rDocShell; + css::uno::Reference< css::script::XLibraryContainer > + xBasicLibraries; + css::uno::Reference< css::script::XLibraryContainer > + xDialogLibraries; + ::sfx2::DocumentMacroMode + aMacroMode; + SfxProgress* pProgress; + OUString aTitle; + OUString aTempName; + DateTime nTime; + sal_uInt16 nVisualDocumentNumber; + SignatureState nDocumentSignatureState; + SignatureState nScriptingSignatureState; + bool bClosing:1, // sal_True while Close(), to prevent recurrences Notification + bIsSaving:1, + bIsNamedVisible:1, + bIsAbortingImport:1, // Import operation should be canceled. + bInPrepareClose : 1, + bPreparedForClose : 1, + bForbidReload : 1, + bBasicInitialized :1, + bIsPrintJobCancelable :1, // Stampit disable/enable cancel button for print jobs ... default = true = enable! + bOwnsStorage:1, + bInitialized:1, + bModelInitialized:1, // whether the related model is initialized + bPreserveVersions:1, + m_bMacroSignBroken:1, // whether the macro signature was explicitly broken + m_bNoBasicCapabilities:1, + m_bDocRecoverySupport:1, + bQueryLoadTemplate:1, + bLoadReadonly:1, + bUseUserData:1, + bUseThumbnailSave:1, + bSaveVersionOnClose:1, + m_bSharedXMLFlag:1, // whether the document should be edited in shared mode + m_bAllowShareControlFileClean:1, // whether the flag should be stored in xml file + m_bConfigOptionsChecked:1, // whether or not the user options are checked after the Options dialog is closed. + m_bMacroCallsSeenWhileLoading:1; // whether or not the user options are checked after the Options dialog is closed. + + IndexBitSet aBitSet; + ErrCode lErr; + SfxEventHintId nEventId; // If Open/Create as to be sent + // before Activate + std::unique_ptr pReloadTimer; + SfxLoadedFlags nLoadedFlags; + SfxLoadedFlags nFlagsInProgress; + bool bModalMode; + bool bRunningMacro; + bool bReadOnlyUI; + tools::SvRef xHeaderAttributes; + ::rtl::Reference< SfxBaseModel > + pBaseModel; + sal_uInt16 nStyleFilter; + + bool m_bEnableSetModified; + bool m_bIsModified; + + tools::Rectangle m_aVisArea; + MapUnit m_nMapUnit; + + bool m_bCreateTempStor; + css::uno::Reference< css::embed::XStorage > m_xDocStorage; + + bool m_bIsInit; + + OUString m_aSharedFileURL; + + bool m_bIncomplEncrWarnShown; + + // TODO/LATER: m_aModifyPasswordInfo should completely replace m_nModifyPasswordHash in future + sal_uInt32 m_nModifyPasswordHash; + css::uno::Sequence< css::beans::PropertyValue > m_aModifyPasswordInfo; + bool m_bModifyPasswordEntered; + /// If true, then this is not a real save, just the signatures change. + bool m_bSavingForSigning; + bool m_bAllowModifiedBackAfterSigning; + + /// Holds Infobars until View is fully loaded + std::vector m_aPendingInfobars; + + SfxObjectShell_Impl( SfxObjectShell& _rDocShell ); + virtual ~SfxObjectShell_Impl(); + + // IMacroDocumentAccess overridables + virtual sal_Int16 getCurrentMacroExecMode() const override; + virtual void setCurrentMacroExecMode( sal_uInt16 nMacroMode ) override; + virtual OUString getDocumentLocation() const override; + virtual bool documentStorageHasMacros() const override; + virtual bool macroCallsSeenWhileLoading() const override; + virtual css::uno::Reference< css::document::XEmbeddedScripts > getEmbeddedDocumentScripts() const override; + virtual SignatureState getScriptingSignatureState() override; + + virtual bool hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/openflag.hxx b/sfx2/source/inc/openflag.hxx new file mode 100644 index 000000000..11421d8cf --- /dev/null +++ b/sfx2/source/inc/openflag.hxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX2_SOURCE_INC_OPENFLAG_HXX +#define INCLUDED_SFX2_SOURCE_INC_OPENFLAG_HXX + +// Open file for editing, then only the third option (reading a copy) works +#define SFX_STREAM_READWRITE (StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE) +// I work on the original, not a copy +// -> file then can not be opened for editing +#define SFX_STREAM_READONLY (StreamMode::READ | StreamMode::SHARE_DENYWRITE) // + !bDirect +// Someone else is editing the file, a copy it created +// -> the file can then be opened for editing +#define SFX_STREAM_READONLY_MAKECOPY (StreamMode::READ | StreamMode::SHARE_DENYNONE) + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/openuriexternally.hxx b/sfx2/source/inc/openuriexternally.hxx new file mode 100644 index 000000000..cf78d1b71 --- /dev/null +++ b/sfx2/source/inc/openuriexternally.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_SOURCE_INC_OPENURIEXTERNALLY_HXX +#define INCLUDED_SFX2_SOURCE_INC_OPENURIEXTERNALLY_HXX + +#include + +#include + +namespace weld +{ +class Widget; +} + +namespace sfx2 +{ +/** Open a URI via com.sun.star.system.SystemShellExecute + + Handles XSystemShellExecute.execute's IllegalArgumentException (throwing a + RuntimeException if it is unexpected, i.e., not caused by the given sURI not + being an absolute URI reference). + + Handles XSystemShellExecute.execute's SystemShellExecuteException unless the + given bHandleSystemShellExecuteException is false (in which case the + exception is re-thrown). +*/ +void openUriExternally(const OUString& sURI, bool bHandleSystemShellExecuteException, + weld::Widget* pDialogParent); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/openurlhint.hxx b/sfx2/source/inc/openurlhint.hxx new file mode 100644 index 000000000..ea52a44e4 --- /dev/null +++ b/sfx2/source/inc/openurlhint.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_STRINGHINT_HXX +#define INCLUDED_SFX2_STRINGHINT_HXX + +#include +#include + +class SfxOpenUrlHint final : public SfxHint +{ + OUString msDocumentURL; + +public: + SfxOpenUrlHint(const OUString& sDocumentURL); + const OUString& GetDocumentURL() const; + virtual ~SfxOpenUrlHint() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/partwnd.hxx b/sfx2/source/inc/partwnd.hxx new file mode 100644 index 000000000..1d51329f6 --- /dev/null +++ b/sfx2/source/inc/partwnd.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX2_SOURCE_INC_PARTWND_HXX +#define INCLUDED_SFX2_SOURCE_INC_PARTWND_HXX + +#include +#include + + +namespace com::sun::star::frame { class XFrame; } + +// forward --------------------------------------------------------------- + +// class SfxPartChildWnd_Impl ----------------------------------- + +class SfxPartChildWnd_Impl final : public SfxChildWindow +{ +public: + SfxPartChildWnd_Impl( vcl::Window* pParent, sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo ); + + SFX_DECL_CHILDWINDOW(SfxPartChildWnd_Impl); + virtual ~SfxPartChildWnd_Impl() override; + + virtual bool QueryClose() override; +}; + +// class SfxExplorerDockWnd_Impl ----------------------------------------- + +class SfxPartDockWnd_Impl final : public SfxDockingWindow +{ + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + +public: + SfxPartDockWnd_Impl( SfxBindings* pBindings, + SfxChildWindow* pChildWin, + vcl::Window* pParent, + WinBits nBits ); + + bool QueryClose(); + virtual void FillInfo(SfxChildWinInfo&) const override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/preview.hxx b/sfx2/source/inc/preview.hxx new file mode 100644 index 000000000..b1a5621ab --- /dev/null +++ b/sfx2/source/inc/preview.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/. + * + * 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_SOURCE_INC_PREVIEW_HXX +#define INCLUDED_SFX2_SOURCE_INC_PREVIEW_HXX + +#include + +class SfxObjectShell; +class GDIMetaFile; + +class SfxPreviewWin_Impl final : public weld::CustomWidgetController +{ +private: + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; + std::shared_ptr xMetaFile; + +public: + SfxPreviewWin_Impl(); + void SetObjectShell(SfxObjectShell const* pObj); + static void ImpPaint(vcl::RenderContext& rRenderContext, GDIMetaFile* pFile); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/recfloat.hxx b/sfx2/source/inc/recfloat.hxx new file mode 100644 index 000000000..e5720e155 --- /dev/null +++ b/sfx2/source/inc/recfloat.hxx @@ -0,0 +1,61 @@ +/* -*- 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_SOURCE_INC_RECFLOAT_HXX +#define INCLUDED_SFX2_SOURCE_INC_RECFLOAT_HXX + +#include +#include +#include + +class SfxRecordingFloatWrapper_Impl final : public SfxChildWindow +{ + SfxBindings* pBindings; +public: + SfxRecordingFloatWrapper_Impl( vcl::Window* pParent , + sal_uInt16 nId , + SfxBindings* pBindings , + SfxChildWinInfo const * pInfo ); + virtual ~SfxRecordingFloatWrapper_Impl() override; + + SFX_DECL_CHILDWINDOW(SfxRecordingFloatWrapper_Impl); + virtual bool QueryClose() override; +}; + +class SfxRecordingFloat_Impl final : public SfxModelessDialogController +{ + std::unique_ptr m_xToolbar; + std::unique_ptr m_xDispatcher; + ImplSVEvent *mnPostUserEventId; + bool m_bFirstActivate; + + DECL_LINK(PresentParentFrame, void*, void); + +public: + SfxRecordingFloat_Impl(SfxBindings* pBindings, + SfxChildWindow* pChildWin, + weld::Window* pParent); + virtual ~SfxRecordingFloat_Impl() override; + virtual void FillInfo(SfxChildWinInfo& rInfo) const override; + virtual void Activate() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/sfxpicklist.hxx b/sfx2/source/inc/sfxpicklist.hxx new file mode 100644 index 000000000..b8af2310d --- /dev/null +++ b/sfx2/source/inc/sfxpicklist.hxx @@ -0,0 +1,42 @@ +/* -*- 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_SOURCE_INC_SFXPICKLIST_HXX +#define INCLUDED_SFX2_SOURCE_INC_SFXPICKLIST_HXX + +#include + +#define PICKLIST_MAXSIZE 100 + +class SfxApplication; +class SfxPickListImpl; + +class SfxPickList +{ +private: + std::unique_ptr mxImpl; + +public: + SfxPickList(SfxApplication& rApp); + ~SfxPickList(); +}; + +#endif // INCLUDED_SFX2_SOURCE_INC_SFXPICKLIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/sfxtypes.hxx b/sfx2/source/inc/sfxtypes.hxx new file mode 100644 index 000000000..acc17ff9a --- /dev/null +++ b/sfx2/source/inc/sfxtypes.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SFX2_SOURCE_INC_SFXTYPES_HXX +#define INCLUDED_SFX2_SOURCE_INC_SFXTYPES_HXX + +#include +#include + +#if defined(DBG_UTIL) + +class SfxStack +{ + static unsigned nLevel; + +public: + SfxStack(const char* pName) + { + ++nLevel; + SAL_INFO("sfx.control", "STACK: enter " << nLevel << " " << pName); + } + ~SfxStack() + { + SAL_INFO("sfx.control", "STACK: leave " << nLevel); + --nLevel; + } +}; + +#define SFX_STACK(s) SfxStack aSfxStack_(#s) +#else +#define SFX_STACK(s) +#endif + +#endif // INCLUDED_SFX2_SOURCE_INC_SFXTYPES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/sfxurlrelocator.hxx b/sfx2/source/inc/sfxurlrelocator.hxx new file mode 100644 index 000000000..3a1fa7729 --- /dev/null +++ b/sfx2/source/inc/sfxurlrelocator.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SFX2_SOURCE_INC_SFXURLRELOCATOR_HXX +#define INCLUDED_SFX2_SOURCE_INC_SFXURLRELOCATOR_HXX + +#include +#include +#include + +#include +#include + +class SfxURLRelocator_Impl +{ + std::mutex maMutex; + css::uno::Reference< css::uno::XComponentContext > mxContext; + css::uno::Reference< css::util::XOfficeInstallationDirectories > mxOfficeInstDirs; + css::uno::Reference< css::util::XMacroExpander > mxMacroExpander; + +public: + static bool propertyCanContainOfficeDir( std::u16string_view rPropName ); + void initOfficeInstDirs(); + void makeRelocatableURL( OUString & rURL ); + void makeAbsoluteURL( OUString & rURL ); + + SfxURLRelocator_Impl( const css::uno::Reference< css::uno::XComponentContext > & xContext ); + ~SfxURLRelocator_Impl(); + +private: + void implExpandURL( OUString& io_url ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/slotserv.hxx b/sfx2/source/inc/slotserv.hxx new file mode 100644 index 000000000..e5bd07dce --- /dev/null +++ b/sfx2/source/inc/slotserv.hxx @@ -0,0 +1,59 @@ +/* -*- 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_SOURCE_INC_SLOTSERV_HXX +#define INCLUDED_SFX2_SOURCE_INC_SLOTSERV_HXX + +#include + +class SfxSlot; + +class SfxSlotServer +{ +private: + const SfxSlot* _pSlot; + sal_uInt16 _nShellLevel; + +public: + SfxSlotServer(); + + sal_uInt16 GetShellLevel() const; + void SetShellLevel(sal_uInt16 nLevel) { _nShellLevel = nLevel; } + void SetSlot(const SfxSlot* pSlot) { _pSlot = pSlot; } + const SfxSlot* GetSlot() const; +}; + +inline SfxSlotServer::SfxSlotServer(): + _pSlot(nullptr), + _nShellLevel(0) +{ +} + +inline sal_uInt16 SfxSlotServer::GetShellLevel() const +{ + return _nShellLevel; +} + +inline const SfxSlot* SfxSlotServer::GetSlot() const +{ + return _pSlot; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/splitwin.hxx b/sfx2/source/inc/splitwin.hxx new file mode 100644 index 000000000..4b65830b9 --- /dev/null +++ b/sfx2/source/inc/splitwin.hxx @@ -0,0 +1,125 @@ +/* -*- 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_SOURCE_INC_SPLITWIN_HXX +#define INCLUDED_SFX2_SOURCE_INC_SPLITWIN_HXX + +#include +#include +#include + +#include +#include + +class SfxWorkWindow; +class SfxDockingWindow; +class SfxEmptySplitWin_Impl; + +struct SfxDock_Impl +{ + sal_uInt16 nType; + VclPtr pWin; // SplitWindow has this window + bool bNewLine; + bool bHide; // SplitWindow had this window +}; + +class SfxSplitWindow final : public SplitWindow +{ +friend class SfxEmptySplitWin_Impl; + +private: + SfxChildAlignment eAlign; + SfxWorkWindow* pWorkWin; + std::vector > + maDockArr; + bool bPinned; + VclPtr pEmptyWin; + VclPtr pActive; + + void InsertWindow_Impl( SfxDock_Impl const * pDockWin, + const Size& rSize, + sal_uInt16 nLine, + sal_uInt16 nPos, + bool bNewLine ); + + DECL_LINK( TimerHdl, Timer*, void ); + bool CursorIsOverRect() const; + void SetPinned_Impl( bool ); + void SetFadeIn_Impl( bool ); + void SaveConfig_Impl(); + void FadeOut_Impl(); + + virtual void StartSplit() override; + virtual void SplitResize() override; + virtual void Split() override; + virtual void MouseButtonDown ( const MouseEvent& ) override; + +public: + SfxSplitWindow( vcl::Window* pParent, SfxChildAlignment eAl, + SfxWorkWindow *pW, bool bWithButtons ); + + virtual ~SfxSplitWindow() override; + virtual void dispose() override; + + void ReleaseWindow_Impl(SfxDockingWindow const *pWin, bool bSaveConfig=true); + + void InsertWindow( SfxDockingWindow* pDockWin, + const Size& rSize); + + void InsertWindow( SfxDockingWindow* pDockWin, + const Size& rSize, + sal_uInt16 nLine, + sal_uInt16 nPos, + bool bNewLine ); + + void MoveWindow( SfxDockingWindow* pDockWin, + const Size& rSize, + sal_uInt16 nLine, + sal_uInt16 nPos, + bool bNewLine ); + + void RemoveWindow( SfxDockingWindow const * pDockWin, bool bHide=true); + + void Lock( bool bLock=true ) + { + SetUpdateMode( !bLock ); + } + + bool GetWindowPos( const SfxDockingWindow* pWindow, + sal_uInt16& rLine, sal_uInt16& rPos ) const; + bool GetWindowPos( const Point& rTestPos, + sal_uInt16& rLine, sal_uInt16& rPos ) const; + sal_uInt16 GetLineCount() const; + tools::Long GetLineSize( sal_uInt16 ) const; + sal_uInt16 GetWindowCount(sal_uInt16 nLine) const; + sal_uInt16 GetWindowCount() const; + + bool IsPinned() const { return bPinned; } + bool IsFadeIn() const; + bool IsAutoHide( bool bSelf ) const; + SplitWindow* GetSplitWindow(); + + virtual void FadeOut() override; + virtual void FadeIn() override; + void SetActiveWindow_Impl( SfxDockingWindow* pWin ); +}; + +#endif // INCLUDED_SFX2_SOURCE_INC_SPLITWIN_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/statcach.hxx b/sfx2/source/inc/statcach.hxx new file mode 100644 index 000000000..4247037e2 --- /dev/null +++ b/sfx2/source/inc/statcach.hxx @@ -0,0 +1,154 @@ +/* -*- 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_SOURCE_INC_STATCACH_HXX +#define INCLUDED_SFX2_SOURCE_INC_STATCACH_HXX + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "slotserv.hxx" + +class SfxControllerItem; +class SfxDispatcher; +class BindDispatch_Impl final : public ::cppu::WeakImplHelper< css::frame::XStatusListener > +{ +friend class SfxStateCache; + css::uno::Reference< css::frame::XDispatch > xDisp; + css::util::URL aURL; + css::frame::FeatureStateEvent aStatus; + SfxStateCache* pCache; + const SfxSlot* pSlot; + +public: + BindDispatch_Impl( + const css::uno::Reference< css::frame::XDispatch > & rDisp, + const css::util::URL& rURL, + SfxStateCache* pStateCache, const SfxSlot* pSlot ); + + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + const css::frame::FeatureStateEvent& GetStatus() const { return aStatus;} + sal_Int16 Dispatch( const css::uno::Sequence < css::beans::PropertyValue >& aProps, bool bForceSynchron ); + void Release(); +}; + +class SfxStateCache +{ +friend class BindDispatch_Impl; + rtl::Reference + mxDispatch; + sal_uInt16 nId; // Slot-Id + SfxControllerItem* pInternalController; + css::uno::Reference < css::frame::XDispatch > xMyDispatch; + SfxControllerItem* pController; // Pointer to first bound Controller (interlinked with each other) + SfxSlotServer aSlotServ; // SlotServer, SlotPtr = 0 -> not on Stack + SfxPoolItem* pLastItem; // Last sent Item, never -1 + SfxItemState eLastState; // Last sent State + bool bCtrlDirty:1; // Update Controller? + bool bSlotDirty:1; // Present Function, must be updated + bool bItemVisible:1; // item visibility + bool bItemDirty; // Validity of pLastItem + +private: + SfxStateCache( const SfxStateCache& rOrig ) = delete; + void SetState_Impl( SfxItemState, const SfxPoolItem*, bool bMaybeDirty ); + +public: + SfxStateCache( sal_uInt16 nFuncId ); + ~SfxStateCache(); + + sal_uInt16 GetId() const; + + const SfxSlotServer* GetSlotServer( SfxDispatcher &rDispat, const css::uno::Reference< css::frame::XDispatchProvider > & xProv ); + const SfxSlotServer* GetSlotServer( SfxDispatcher &rDispat ) + { return GetSlotServer( rDispat, css::uno::Reference< css::frame::XDispatchProvider > () ); } + css::uno::Reference< css::frame::XDispatch > GetDispatch() const; + sal_Int16 Dispatch( const SfxItemSet* pSet, bool bForceSynchron ); + bool IsControllerDirty() const + { return bCtrlDirty; } + void ClearCache(); + + void SetState( SfxItemState, const SfxPoolItem*, bool bMaybeDirty=false ); + void SetCachedState(bool bAlways); + void Invalidate( bool bWithSlot ); + void SetVisibleState( bool bShow ); + void GetState( boost::property_tree::ptree& ); + + SfxControllerItem* ChangeItemLink( SfxControllerItem* pNewBinding ); + SfxControllerItem* GetItemLink() const; + void SetInternalController( SfxControllerItem* pCtrl ) + { DBG_ASSERT( !pInternalController, "Only one internal controller allowed!" ); pInternalController = pCtrl; } + void ReleaseInternalController() { pInternalController = nullptr; } + SfxControllerItem* GetInternalController() const { return pInternalController; } + const css::uno::Reference < css::frame::XDispatch >& + GetInternalDispatch() const + { return xMyDispatch; } + void SetInternalDispatch( const css::uno::Reference < css::frame::XDispatch >& rDisp ) + { xMyDispatch = rDisp; } +}; + + +// clears Cached-Item + +inline void SfxStateCache::ClearCache() +{ + bItemDirty = true; +} + + +// registers an item representing this function + +inline SfxControllerItem* SfxStateCache::ChangeItemLink( SfxControllerItem* pNewBinding ) +{ + SfxControllerItem* pOldBinding = pController; + pController = pNewBinding; + if ( pNewBinding ) + { + bCtrlDirty = true; + bItemDirty = true; + } + return pOldBinding; +} + + +// returns the func binding which becomes called on spreading states + +inline SfxControllerItem* SfxStateCache::GetItemLink() const +{ + return pController; +} + + +inline sal_uInt16 SfxStateCache::GetId() const +{ + return nId; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/templatesearchviewitem.hxx b/sfx2/source/inc/templatesearchviewitem.hxx new file mode 100644 index 000000000..e9ba57f1c --- /dev/null +++ b/sfx2/source/inc/templatesearchviewitem.hxx @@ -0,0 +1,28 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SFX2_SOURCE_INC_TEMPLATESEARCHVIEWITEM_HXX +#define INCLUDED_SFX2_SOURCE_INC_TEMPLATESEARCHVIEWITEM_HXX + +#include + +struct TemplateSearchViewItem final : public TemplateViewItem +{ + TemplateSearchViewItem(ThumbnailView& rView, sal_uInt16 nId) + : TemplateViewItem(rView, nId) + , mnAssocId(0) + { + } + + sal_uInt16 mnAssocId; //Associated item id to the TemplateViews +}; + +#endif // INCLUDED_SFX2_SOURCE_INC_TEMPLATESEARCHVIEWITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx new file mode 100644 index 000000000..6c72de1ca --- /dev/null +++ b/sfx2/source/inc/templdgi.hxx @@ -0,0 +1,242 @@ +/* -*- 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_SOURCE_INC_TEMPLDGI_HXX +#define INCLUDED_SFX2_SOURCE_INC_TEMPLDGI_HXX + +#include + +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include "StyleList.hxx" + +class SfxTemplateControllerItem; +class SfxStyleFamilyItem; +class SfxTemplateItem; +class SfxBindings; +class SfxStyleSheetBase; +class SfxStyleSheetBasePool; +class StyleTreeListBox_Impl; +class SfxTemplateDialog_Impl; +class SfxCommonTemplateDialog_Impl; +namespace com::sun::star::frame { + class XModuleManager2; +} + +class SfxCommonTemplateDialog_Impl +{ +private: + class DeletionWatcher; + friend class DeletionWatcher; + + DeletionWatcher* impl_setDeletionWatcher(DeletionWatcher* pNewWatcher); + +protected: +#define MAX_FAMILIES 6 +#define COUNT_BOUND_FUNC 14 + + friend class SfxTemplateControllerItem; + + SfxBindings* pBindings; + + weld::Container* mpContainer; + + css::uno::Reference xModuleManager; + DeletionWatcher* m_pDeletionWatcher; + + StyleList m_aStyleList; + std::unique_ptr mxPreviewCheckbox; + std::unique_ptr mxFilterLb; + + sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1 + sal_uInt16 nActFilter; // FilterIdx + + bool bIsWater :1; + bool bUpdate :1; + bool bWaterDisabled :1; + bool bNewByExampleDisabled :1; + bool bUpdateByExampleDisabled :1; + bool m_bWantHierarchical :1; + + Link m_aStyleListReadResource; + Link m_aStyleListClear; + Link m_aStyleListCleanup; + Link m_aStyleListExecuteDrop; + Link m_aStyleListNewMenu; + Link m_aStyleListWaterCan; + Link m_aStyleListHasSelectedStyle; + Link m_aStyleListUpdateFamily; + Link m_aStyleListUpdateStyleDependents; + Link m_aStyleListEnableTreeDrag; + Link m_aStyleListEnableDelete; + Link m_aStyleListSetWaterCanState; + Link m_aStyleListSetFamily; + + DECL_LINK(FilterSelectHdl, weld::ComboBox&, void ); + DECL_LINK(PreviewHdl, weld::Toggleable&, void); + + virtual void InsertFamilyItem(sal_uInt16 nId, const SfxStyleFamilyItem& rItem) = 0; + virtual void EnableFamilyItem(sal_uInt16 nId, bool bEnabled) = 0; + virtual void ClearFamilyList() = 0; + virtual void ReplaceUpdateButtonByMenu(); + + void Initialize(); + void EnableHierarchical(bool, StyleList& rStyleList); + + void FilterSelect( sal_uInt16 nFilterIdx, bool bForce ); + void SetFamilyState( sal_uInt16 nSlotId, const SfxTemplateItem* ); + void SetWaterCanState( const SfxBoolItem* pItem ); + bool IsSafeForWaterCan() const; + + void SetFamily(SfxStyleFamily nFamily); + void ActionSelect(const OString& rId, StyleList& rStyleList); + + void SaveFactoryStyleFilter(SfxObjectShell const* i_pObjSh, sal_Int32 i_nFilter); + + DECL_LINK(ReadResource_Hdl, StyleList&, void); + DECL_LINK(ClearResource_Hdl, void*, void); + DECL_LINK(SaveSelection_Hdl, StyleList&, SfxObjectShell*); + DECL_LINK(LoadFactoryStyleFilter_Hdl, SfxObjectShell const*, sal_Int32); + DECL_LINK(UpdateStyles_Hdl, StyleFlags, void); + DECL_LINK(UpdateFamily_Hdl, StyleList&, void); + DECL_LINK(UpdateStyleDependents_Hdl, void*, void); + +public: + // Used in StyleList::NewMenuExecuteAction, StyleList::UpdateStyleDependents, StyleList::NewHdl, EditHdl... + // It comes into action whenever an existing style is selected for use, or a new style is created etc.. + bool Execute_Impl(sal_uInt16 nId, const OUString& rStr, const OUString& rRefStr, + sal_uInt16 nFamily, StyleList& rStyleList, SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto, + sal_uInt16* pIdx = nullptr, const sal_uInt16* pModifier = nullptr); + + // This function handles drop of content into the treeview to create a new style + sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt); + // This function is used when a newstyle is created + DECL_LINK(OnAsyncExecuteDrop, void*, void); + + // Used in StyleList::UpdateStyles, StyleList::Update + // Whenever a new family(Eg. Character, List etc.) is selected it comes into action + void FamilySelect(sal_uInt16 nId, StyleList& rStyleList, bool bPreviewRefresh = false); + + // Constructor + SfxCommonTemplateDialog_Impl(SfxBindings* pB, weld::Container*, weld::Builder* pBuilder); + + // Destructor + virtual ~SfxCommonTemplateDialog_Impl(); + + // Used in StyleList::SelectStyle, StyleList::Notify, IMPL_LINK(PopupFlatMenuHdl) + // These functions are used when a style is edited, deleted, created etc.. + virtual void EnableEdit(bool b, StyleList* rStyleList); + void EnableDel(bool b, const StyleList* rStyleList); + void EnableNew(bool b, const StyleList* rStyleList); + void EnableHide(bool b, const StyleList* rStyleList); + void EnableShow(bool b, const StyleList* rStyleList); + + // Used in TreeDrag + void EnableTreeDrag(bool b); + // It comes into action when a style is created or updated or newmenu is created + void EnableExample_Impl(sal_uInt16 nId, bool bEnable); + + // This comes into action when a family is selected or a style is applied for use + virtual void CheckItem(const OString& /*rMesId*/, bool /*bCheck*/ = true) {} + // This is used for watercan or when newmenu or watercan is enabled or updated + virtual void EnableItem(const OString& /*rMesId*/, bool /*bCheck*/ = true) {} + // This is used for watercan + virtual bool IsCheckedItem(const OString& /*rMesId*/) { return true; } + + // This is used when a style is selected + void SelectStyle(const OUString& rStyle, bool bIsCallback, StyleList& rStyleList); + + //When a new document is created, it comes into action + void IsUpdate(StyleList&); + + // This function return the value of bUpdate in Stylelist + // This value is used in StyleList's Notify + bool GetNotifyUpdate() const { return bUpdate; } + // This function sets the value of bUpdate in Dialog + // This function is used in StyleList's Notify to update the value of bUpdate when required + void SetNotifyupdate(bool b) { bUpdate = b; } + + void connect_stylelist_read_resource(const Link& rLink) { m_aStyleListReadResource = rLink; } + void connect_stylelist_clear(const Link& rLink) { m_aStyleListClear = rLink; } + void connect_stylelist_cleanup(const Link& rLink) { m_aStyleListCleanup = rLink; } + void connect_stylelist_execute_drop(const Link& rLink); + void connect_stylelist_execute_new_menu(const Link& rLink) { m_aStyleListNewMenu = rLink; } + void connect_stylelist_for_watercan(const Link& rLink) { m_aStyleListWaterCan = rLink; } + void connect_stylelist_has_selected_style(const Link& rLink); + void connect_stylelist_update_style_dependents(const Link& rLink); + void connect_stylelist_enable_tree_drag(const Link rLink); + void connect_stylelist_enable_delete(const Link rLink); + void connect_stylelist_set_water_can_state(const Link rLink); + void connect_set_family(const Link rLink) { m_aStyleListSetFamily = rLink; } +}; + +class ToolbarDropTarget; +class DropTargetHelper; + +class SfxTemplateDialog_Impl final : public SfxCommonTemplateDialog_Impl +{ +private: + friend class SfxTemplateControllerItem; + friend class SfxTemplatePanelControl; + + std::unique_ptr m_xToolbarDropTargetHelper; + std::unique_ptr m_xActionTbL; + std::unique_ptr m_xActionTbR; + std::unique_ptr m_xToolMenu; + int m_nActionTbLVisible; + + void FillToolMenu(); + + DECL_LINK(ToolBoxLSelect, const OString&, void); + DECL_LINK(ToolBoxRSelect, const OString&, void); + DECL_LINK(ToolMenuSelectHdl, const OString&, void); + + virtual void EnableEdit( bool, StyleList* rStyleList) override; + virtual void EnableItem(const OString& rMesId, bool bCheck = true) override; + virtual void CheckItem(const OString& rMesId, bool bCheck = true) override; + virtual bool IsCheckedItem(const OString& rMesId) override; + virtual void InsertFamilyItem(sal_uInt16 nId, const SfxStyleFamilyItem& rItem) override; + virtual void EnableFamilyItem(sal_uInt16 nId, bool bEnabled) override; + virtual void ClearFamilyList() override; + virtual void ReplaceUpdateButtonByMenu() override; + +public: + friend class SfxTemplateDialog; + + SfxTemplateDialog_Impl( SfxBindings*, SfxTemplatePanelControl* pDlgWindow ); + virtual ~SfxTemplateDialog_Impl() override; + + sal_Int8 AcceptToolbarDrop(const AcceptDropEvent& rEvt, const DropTargetHelper& rHelper); + + void Initialize(); +}; + +#endif // INCLUDED_SFX2_SOURCE_INC_TEMPLDGI_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/tplcitem.hxx b/sfx2/source/inc/tplcitem.hxx new file mode 100644 index 000000000..9c532fbc8 --- /dev/null +++ b/sfx2/source/inc/tplcitem.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_SOURCE_INC_TPLCITEM_HXX +#define INCLUDED_SFX2_SOURCE_INC_TPLCITEM_HXX + +#include +#include + +struct ImplSVEvent; +class SfxCommonTemplateDialog_Impl; + +class SfxTemplateControllerItem final : public SfxControllerItem +{ + SfxCommonTemplateDialog_Impl &rTemplateDlg; + sal_uInt8 nWaterCanState; + ImplSVEvent* nUserEventId; + + DECL_LINK(SetWaterCanStateHdl_Impl, void*, void); + + virtual void StateChangedAtToolBoxControl(sal_uInt16, SfxItemState, const SfxPoolItem* pState) override; + +public: + SfxTemplateControllerItem(sal_uInt16 nId, SfxCommonTemplateDialog_Impl& rDialog, SfxBindings& rBindings); + virtual ~SfxTemplateControllerItem() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx new file mode 100644 index 000000000..22513f365 --- /dev/null +++ b/sfx2/source/inc/versdlg.hxx @@ -0,0 +1,95 @@ +/* -*- 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_SOURCE_INC_VERSDLG_HXX +#define INCLUDED_SFX2_SOURCE_INC_VERSDLG_HXX + +#include +#include + +class SfxViewFrame; +struct SfxVersionInfo; + +class SfxVersionTableDtor; +class SfxVersionDialog final : public SfxDialogController +{ + SfxViewFrame* m_pViewFrame; + bool m_bIsSaveVersionOnClose; + std::unique_ptr m_pTable; + std::unique_ptr m_xSaveButton; + std::unique_ptr m_xSaveCheckBox; + std::unique_ptr m_xOpenButton; + std::unique_ptr m_xViewButton; + std::unique_ptr m_xDeleteButton; + std::unique_ptr m_xCompareButton; + std::unique_ptr m_xCmisButton; + std::unique_ptr m_xVersionBox; + + DECL_LINK(DClickHdl_Impl, weld::TreeView&, bool); + DECL_LINK(SelectHdl_Impl, weld::TreeView&, void); + DECL_LINK(ButtonHdl_Impl, weld::Button&, void); + DECL_LINK(ToggleHdl_Impl, weld::Toggleable&, void); + void Init_Impl(); + void Open_Impl(); + +public: + SfxVersionDialog(weld::Window* pParent, SfxViewFrame* pFrame, bool); + virtual ~SfxVersionDialog() override; + bool IsSaveVersionOnClose() const { return m_bIsSaveVersionOnClose; } +}; + +class SfxViewVersionDialog_Impl final : public SfxDialogController +{ +private: + SfxVersionInfo& m_rInfo; + + std::unique_ptr m_xDateTimeText; + std::unique_ptr m_xSavedByText; + std::unique_ptr m_xEdit; + std::unique_ptr m_xOKButton; + std::unique_ptr m_xCancelButton; + std::unique_ptr m_xCloseButton; + + DECL_LINK(ButtonHdl, weld::Button&, void); + +public: + SfxViewVersionDialog_Impl(weld::Window* pParent, SfxVersionInfo& rInfo, bool bEdit); +}; + +class SfxCmisVersionsDialog final : public SfxDialogController +{ + SfxViewFrame* m_pViewFrame; + std::unique_ptr m_pTable; + + std::unique_ptr m_xOpenButton; + std::unique_ptr m_xViewButton; + std::unique_ptr m_xDeleteButton; + std::unique_ptr m_xCompareButton; + std::unique_ptr m_xVersionBox; + + void LoadVersions(); + +public: + SfxCmisVersionsDialog(weld::Window* pParent, SfxViewFrame* pFrame); + virtual ~SfxCmisVersionsDialog() override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx new file mode 100644 index 000000000..350901910 --- /dev/null +++ b/sfx2/source/inc/workwin.hxx @@ -0,0 +1,300 @@ +/* -*- 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_SOURCE_INC_WORKWIN_HXX +#define INCLUDED_SFX2_SOURCE_INC_WORKWIN_HXX + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +class SfxSplitWindow; +class SfxWorkWindow; + + +// This struct makes all relevant Information available of Toolboxes +struct SfxObjectBar_Impl +{ + ToolbarId eId; // ConfigId of Toolbox + SfxVisibilityFlags nMode; // special visibility flags + bool bDestroy; + + SfxObjectBar_Impl() : + eId(ToolbarId::None), + nMode(SfxVisibilityFlags::Invisible), + bDestroy(false) + {} +}; + +// This struct makes all relevant Information available of the status bar + +struct SfxStatBar_Impl +{ + StatusBarId eId; + + SfxStatBar_Impl() : + eId(StatusBarId::None) + {} +}; + +enum class SfxChildVisibility +{ + NOT_VISIBLE = 0, + ACTIVE = 1, // not disabled through HidePopups + NOT_HIDDEN = 2, // not disabled through HideChildWindow + FITS_IN = 4, // not too large for output size of the parent + VISIBLE = 7, // NOT_HIDDEN | ACTIVE | FITS_IN) +}; +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} + + +struct SfxChild_Impl +{ + VclPtr pWin; + std::shared_ptr xController; + Size aSize; + SfxChildAlignment eAlign; + SfxChildVisibility nVisible; + bool bResize; + bool bSetFocus; + + SfxChild_Impl( vcl::Window& rChild, const Size& rSize, + SfxChildAlignment eAlignment, bool bIsVisible ): + pWin(&rChild), aSize(rSize), eAlign(eAlignment), bResize(false), + bSetFocus( false ) + { + nVisible = bIsVisible ? SfxChildVisibility::VISIBLE : SfxChildVisibility::NOT_VISIBLE; + } + + SfxChild_Impl(const std::shared_ptr& rChild, + SfxChildAlignment eAlignment): + pWin(nullptr), xController(rChild), eAlign(eAlignment), bResize(false), + bSetFocus( false ) + { + nVisible = xController->getDialog()->get_visible() ? SfxChildVisibility::VISIBLE : SfxChildVisibility::NOT_VISIBLE; + } +}; + +struct SfxChildWin_Impl +{ + sal_uInt16 nSaveId; // the ChildWindow-Id + sal_uInt16 nId; // current Id + SfxChildWindow* pWin; + bool bCreate; + SfxChildWinInfo aInfo; + SfxChild_Impl* pCli; // != 0 at direct Children + SfxVisibilityFlags nVisibility; + bool bEnable; + + SfxChildWin_Impl( sal_uInt32 nID ) : + nSaveId(static_cast(nID & 0xFFFF) ), + nId(nSaveId), + pWin(nullptr), + bCreate(false), + pCli(nullptr), + nVisibility( SfxVisibilityFlags::Invisible ), + bEnable( true ) + {} +}; + +enum class SfxChildIdentifier +{ + DOCKINGWINDOW, + SPLITWINDOW +}; + +enum class SfxDockingConfig +{ + SETDOCKINGRECTS, + ALIGNDOCKINGWINDOW, + TOGGLEFLOATMODE +}; + + +#define SFX_SPLITWINDOWS_LEFT 0 +#define SFX_SPLITWINDOWS_TOP 2 +#define SFX_SPLITWINDOWS_RIGHT 1 +#define SFX_SPLITWINDOWS_MAX 4 + + +class LayoutManagerListener final : public ::cppu::WeakImplHelper< + css::frame::XLayoutManagerListener, + css::lang::XComponent > +{ + public: + LayoutManagerListener( SfxWorkWindow* pWrkWin ); + virtual ~LayoutManagerListener() override; + + void setFrame( const css::uno::Reference< css::frame::XFrame >& rFrame ); + + + // XComponent + + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; + virtual void SAL_CALL dispose() override; + + + // XEventListener + + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) override; + + + // XLayoutManagerEventListener + + virtual void SAL_CALL layoutEvent( const css::lang::EventObject& aSource, ::sal_Int16 eLayoutEvent, const css::uno::Any& aInfo ) override; + + private: + bool m_bHasFrame; + SfxWorkWindow* m_pWrkWin; + css::uno::WeakReference< css::frame::XFrame > m_xFrame; +}; + +class SfxWorkWindow final +{ + friend class LayoutManagerListener; + + std::vector aSortedList; + SfxStatBar_Impl aStatBar; + std::vector< SfxObjectBar_Impl > aObjBarList; + tools::Rectangle aClientArea; + tools::Rectangle aUpperClientArea; + VclPtr pSplit[SFX_SPLITWINDOWS_MAX]; + std::vector> + aChildren; + std::vector> + aChildWins; + SfxBindings* pBindings; + VclPtr pWorkWin; + VclPtr pActiveChild; + SfxVisibilityFlags nUpdateMode; + sal_uInt16 nChildren; + SfxVisibilityFlags nOrigMode; + bool bSorted : 1; + bool bDockingAllowed : 1; + bool bInternalDockingAllowed : 1; + bool bAllChildrenVisible : 1; + bool bIsFullScreen : 1; + bool bShowStatusBar : 1; + sal_Int32 m_nLock; + css::uno::Reference< css::lang::XComponent > m_xLayoutManagerListener; + SfxFrame* pMasterFrame; + SfxFrame* pFrame; + + void CreateChildWin_Impl(SfxChildWin_Impl*,bool); + void RemoveChildWin_Impl(SfxChildWin_Impl*); + void Sort_Impl(); + SfxChild_Impl* FindChild_Impl( const vcl::Window* rWindow ) const; + bool RequestTopToolSpacePixel_Impl( SvBorder aBorder ); + tools::Rectangle GetTopRect_Impl() const; + SvBorder Arrange_Impl(); + void SaveStatus_Impl(SfxChildWindow*, const SfxChildWinInfo&); + static bool IsPluginMode( SfxObjectShell const * pObjShell ); + + void FlushPendingChildSizes(); + +public: + SfxWorkWindow( vcl::Window* pWin, SfxFrame* pFrm, SfxFrame* pMaster ); + ~SfxWorkWindow(); + SfxBindings& GetBindings() + { return *pBindings; } + vcl::Window* GetWindow() const + { return pWorkWin; } + tools::Rectangle GetFreeArea( bool bAutoHide ) const; + void SetDockingAllowed(bool bSet) + { bDockingAllowed = bSet; } + void SetInternalDockingAllowed(bool bSet) + { bInternalDockingAllowed = bSet; } + bool IsDockingAllowed() const + { return bDockingAllowed; } + bool IsInternalDockingAllowed() const + { return bInternalDockingAllowed; } + + // Methods for all Child windows + void DataChanged_Impl(); + void ReleaseChild_Impl( vcl::Window& rWindow ); + void ReleaseChild_Impl(const SfxDialogController&); + SfxChild_Impl* RegisterChild_Impl( vcl::Window& rWindow, SfxChildAlignment eAlign ); + SfxChild_Impl* RegisterChild_Impl(std::shared_ptr& rController, SfxChildAlignment eAlign); + void ShowChildren_Impl(); + void HideChildren_Impl(); + bool PrepareClose_Impl(); + void ArrangeChildren_Impl( bool bForce = true ); + void DeleteControllers_Impl(); + void HidePopups_Impl(bool bHide, sal_uInt16 nId=0); + void ConfigChild_Impl(SfxChildIdentifier, + SfxDockingConfig, sal_uInt16); + void MakeChildrenVisible_Impl( bool bVis ); + void ArrangeAutoHideWindows( SfxSplitWindow *pSplit ); + bool IsAutoHideMode( const SfxSplitWindow *pSplit ); + void EndAutoShow_Impl( Point aPos ); + void SetFullScreen_Impl( bool bSet ) { bIsFullScreen = bSet; } + + // Methods for Objectbars + void UpdateObjectBars_Impl(); + void UpdateObjectBars_Impl2(); + void ResetObjectBars_Impl(); + void SetObjectBar_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFlags, ToolbarId eId); + bool IsVisible_Impl() const; + void MakeVisible_Impl( bool ); + void Lock_Impl( bool ); + + // Methods for ChildWindows + void UpdateChildWindows_Impl(); + void ResetChildWindows_Impl(); + void SetChildWindowVisible_Impl( sal_uInt32, bool, SfxVisibilityFlags ); + void ToggleChildWindow_Impl(sal_uInt16,bool); + bool HasChildWindow_Impl(sal_uInt16); + bool KnowsChildWindow_Impl(sal_uInt16); + void ShowChildWindow_Impl(sal_uInt16, bool bVisible, bool bSetFocus); + void SetChildWindow_Impl(sal_uInt16, bool bOn, bool bSetFocus); + SfxChildWindow* GetChildWindow_Impl(sal_uInt16); + void InitializeChild_Impl(SfxChildWin_Impl*); + SfxSplitWindow* GetSplitWindow_Impl(SfxChildAlignment); + + bool IsVisible_Impl( SfxVisibilityFlags nMode ) const; + bool IsFloating( sal_uInt16 nId ); + void SetActiveChild_Impl( vcl::Window *pChild ); + const VclPtr& GetActiveChild_Impl() const { return pActiveChild; } + + // Methods for StatusBar + void ResetStatusBar_Impl(); + void SetStatusBar_Impl(StatusBarId eResId); + void UpdateStatusBar_Impl(); + css::uno::Reference< css::task::XStatusIndicator > GetStatusIndicator(); + css::uno::Reference< css::frame::XFrame > GetFrameInterface(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3