lok: avoid ILibreOfficeKitNotifier null ptr de-reference on shutdown.
[LibreOffice.git] / sd / inc / sdmod.hxx
blobf37b79771f3e440b4752e3fb10a4cc59621112ee
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SD_INC_SDMOD_HXX
21 #define INCLUDED_SD_INC_SDMOD_HXX
23 #include "glob.hxx"
24 #include "pres.hxx"
26 #include <sot/storage.hxx>
27 #include "sddllapi.h"
28 #include <svl/lstner.hxx>
29 #include <com/sun/star/beans/XPropertySetInfo.hpp>
30 #include <sfx2/app.hxx>
31 #include <sfx2/module.hxx>
32 #include <sal/types.h>
33 #include <vcl/virdev.hxx>
34 #include <map>
35 #include <memory>
37 class SdOptions;
38 class SvxSearchItem;
39 class EditFieldInfo;
40 class SdTransferable;
41 class SvNumberFormatter;
42 class SfxErrorHandler;
43 class SfxFrame;
44 struct SfxItemPropertyMapEntry;
45 class VclSimpleEvent;
46 namespace svtools { class ColorConfig; }
48 namespace com { namespace sun { namespace star { namespace frame {
49 class XFrame;
50 } } } }
52 enum SdOptionStreamMode
54 SD_OPTION_LOAD = 0,
55 SD_OPTION_STORE = 1
58 typedef std::map< SfxItemPropertyMapEntry const * , css::uno::Reference<css::beans::XPropertySetInfo> > SdExtPropertySetInfoCache;
59 typedef std::map< sal_uInt32, css::uno::Sequence< css::uno::Type> > SdTypesCache;
63 This subclass of <SfxModule> (which is a subclass of <SfxShell>) is
64 linked to the DLL. One instance of this class exists while the DLL is
65 loaded.
67 SdModule is like to be compared with the <SfxApplication>-subclass.
69 Remember: Don`t export this class! It uses DLL-internal symbols.
73 class SAL_DLLPUBLIC_RTTI SdModule final : public SfxModule, public SfxListener
75 public:
76 SFX_DECL_INTERFACE(SD_IF_SDAPP)
77 DECL_LINK( CalcFieldValueHdl, EditFieldInfo*, void );
79 private:
80 /// SfxInterface initializer.
81 static void InitInterface_Impl();
83 public:
84 SdModule(SfxObjectFactory* pDrawObjFact, SfxObjectFactory* pGraphicObjFact);
85 virtual ~SdModule() override;
87 SdTransferable* pTransferClip;
88 SdTransferable* pTransferDrag;
89 SdTransferable* pTransferSelection;
91 void Execute(SfxRequest& rReq);
92 void GetState(SfxItemSet&);
94 SdOptions* GetSdOptions(DocumentType eDocType);
95 SD_DLLPUBLIC tools::SvRef<SotStorageStream> GetOptionStream( const OUString& rOptionName, SdOptionStreamMode eMode );
97 bool GetWaterCan() const { return bWaterCan; }
98 void SetWaterCan( bool bWC ) { bWaterCan = bWC; }
100 SvxSearchItem* GetSearchItem() { return pSearchItem.get(); }
101 void SetSearchItem(std::unique_ptr<SvxSearchItem> pItem);
103 /** Return the virtual device that can be used for printer independent
104 layout.
105 @return
106 The returned pointer is NULL when the device could not be
107 created when this modules was instantiated.
109 OutputDevice* GetVirtualRefDevice() { return mpVirtualRefDevice;}
111 SD_DLLPUBLIC SvNumberFormatter* GetNumberFormatter();
113 // virtual methods for the option dialog
114 virtual std::unique_ptr<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override;
115 virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override;
116 virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId, weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet ) override;
117 virtual std::unique_ptr<SfxStyleFamilies> CreateStyleFamilies() override;
119 SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
120 SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
121 SdTypesCache gImplTypesCache;
123 svtools::ColorConfig& GetColorConfig();
125 private:
127 SdOptions* pImpressOptions;
128 SdOptions* pDrawOptions;
129 std::unique_ptr<SvxSearchItem> pSearchItem;
130 std::unique_ptr<SvNumberFormatter> pNumberFormatter;
131 tools::SvRef<SotStorage> xOptionStorage;
132 bool bWaterCan;
133 std::unique_ptr<SfxErrorHandler> mpErrorHdl;
134 /** This device is used for printer independent layout. It is virtual
135 in the sense that it does not represent a printer. The pointer may
136 be NULL when the virtual device could not be created.
138 VclPtr< VirtualDevice > mpVirtualRefDevice;
140 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
142 SfxFrame* ExecuteNewDocument( SfxRequest const & rReq );
144 static SfxFrame* CreateEmptyDocument( const css::uno::Reference< css::frame::XFrame >& i_rFrame );
145 static SfxFrame* CreateFromTemplate( const OUString& rTemplatePath, const css::uno::Reference< css::frame::XFrame >& i_rFrame );
147 bool mbEventListenerAdded;
149 /** Take an outline from a text document and create a new impress
150 document according to the structure of the outline.
151 @param rRequest
152 This typically is the unmodified request from an execute()
153 function from where this function is called.
155 static bool OutlineToImpress(SfxRequest const & rRequest);
157 /** Add an eventlistener as soon as possible in sd, allows to use
158 remote devices to start the slideshow elegantly, and respecting
159 portability
160 @EventListenerHdl
161 The event listener handler
162 @VclSimpleEvent *
163 a pointer to a VCLSimpleEvent (see vcl/vclevent.hxx )
165 DECL_STATIC_LINK( SdModule, EventListenerHdl, VclSimpleEvent&, void );
167 std::unique_ptr<svtools::ColorConfig> mpColorConfig;
170 #define SD_MOD() ( static_cast<SdModule*>(SfxApplication::GetModule(SfxToolsModule::Draw)) )
172 #endif // INCLUDED_SD_INC_SDMOD_HXX
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */