build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / sd / inc / sdmod.hxx
blobc96a1b1749c9e78bf33e86e42a6208b2649e3541
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/itemprop.hxx>
29 #include <svl/lstner.hxx>
30 #include <com/sun/star/text/WritingMode.hpp>
31 #include <sfx2/module.hxx>
32 #include <vcl/vclevent.hxx>
33 #include <vcl/virdev.hxx>
34 #include <sal/types.h>
35 #include <map>
36 #include <memory>
38 class SdOptions;
39 class SvxSearchItem;
40 class EditFieldInfo;
41 class SdTransferable;
42 class SvNumberFormatter;
43 class SfxErrorHandler;
44 class SdDrawDocument;
45 class SfxFrame;
46 namespace svtools { class ColorConfig; }
48 namespace sd {
49 class DrawDocShell;
52 namespace com { namespace sun { namespace star { namespace frame {
53 class XFrame;
54 } } } }
56 enum SdOptionStreamMode
58 SD_OPTION_LOAD = 0,
59 SD_OPTION_STORE = 1
62 typedef std::map< sal_uIntPtr, css::uno::Reference<css::beans::XPropertySetInfo> > SdExtPropertySetInfoCache;
63 typedef std::map< sal_uInt32, css::uno::Sequence< css::uno::Type> > SdTypesCache;
67 This subclass of <SfxModule> (which is a subclass of <SfxShell>) is
68 linked to the DLL. One instance of this class exists while the DLL is
69 loaded.
71 SdModule is like to be compared with the <SfxApplication>-subclass.
73 Remember: Don`t export this class! It uses DLL-internal symbols.
77 class SdModule : public SfxModule, public SfxListener
79 public:
80 SFX_DECL_INTERFACE(SD_IF_SDAPP)
81 DECL_LINK( CalcFieldValueHdl, EditFieldInfo*, void );
83 private:
84 /// SfxInterface initializer.
85 static void InitInterface_Impl();
87 public:
88 SdModule(SfxObjectFactory* pDrawObjFact, SfxObjectFactory* pGraphicObjFact);
89 virtual ~SdModule() override;
91 SdTransferable* pTransferClip;
92 SdTransferable* pTransferDrag;
93 SdTransferable* pTransferSelection;
95 void Execute(SfxRequest& rReq);
96 void GetState(SfxItemSet&);
98 SdOptions* GetSdOptions(DocumentType eDocType);
99 SD_DLLPUBLIC tools::SvRef<SotStorageStream> GetOptionStream( const OUString& rOptionName, SdOptionStreamMode eMode );
101 bool GetWaterCan() const { return bWaterCan; }
102 void SetWaterCan( bool bWC ) { bWaterCan = bWC; }
104 SvxSearchItem* GetSearchItem() { return pSearchItem; }
105 void SetSearchItem(SvxSearchItem* pItem) { pSearchItem = pItem; }
107 /** Return the virtual device that can be used for printer independent
108 layout.
109 @return
110 The returned pointer is NULL when the device could not be
111 created when this modules was instantiated.
113 OutputDevice* GetVirtualRefDevice() { return mpVirtualRefDevice;}
115 /** Deprecated alias to <member>GetVirtualRefDevice</member>.
116 @param rDocShell
117 Unused dummy parameter.
119 OutputDevice* GetRefDevice (::sd::DrawDocShell& rDocShell);
121 SD_DLLPUBLIC SvNumberFormatter* GetNumberFormatter();
123 // virtual methods for the option dialog
124 virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) override;
125 virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override;
126 virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) override;
127 virtual SfxStyleFamilies* CreateStyleFamilies() override;
129 SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
130 SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
131 SdTypesCache gImplTypesCache;
133 svtools::ColorConfig& GetColorConfig();
135 protected:
137 SdOptions* pImpressOptions;
138 SdOptions* pDrawOptions;
139 SvxSearchItem* pSearchItem;
140 SvNumberFormatter* pNumberFormatter;
141 tools::SvRef<SotStorage> xOptionStorage;
142 bool bWaterCan;
143 SfxErrorHandler* mpErrorHdl;
144 /** This device is used for printer independent layout. It is virtual
145 in the sense that it does not represent a printer. The pointer may
146 be NULL when the virtual device could not be created.
148 VclPtr< VirtualDevice > mpVirtualRefDevice;
150 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
152 private:
153 SfxFrame* ExecuteNewDocument( SfxRequest& rReq );
155 static SfxFrame* CreateEmptyDocument( const css::uno::Reference< css::frame::XFrame >& i_rFrame );
156 static SfxFrame* CreateFromTemplate( const OUString& rTemplatePath, const css::uno::Reference< css::frame::XFrame >& i_rFrame );
158 bool mbEventListenerAdded;
160 /** Take an outline from a text document and create a new impress
161 document according to the structure of the outline.
162 @param rRequest
163 This typically is the unmodified request from a execute()
164 function from where this function is called.
166 static bool OutlineToImpress(SfxRequest& rRequest);
168 /** Add an eventlistener as soon as possible in sd, allows to use
169 remote devices to start the slideshow elegantly, and respecting
170 portability
171 @EventListenerHdl
172 The event listener handler
173 @VclSimpleEvent *
174 a pointer to a VCLSimpleEvent (see vcl/vclevent.hxx )
176 DECL_STATIC_LINK( SdModule, EventListenerHdl, VclSimpleEvent&, void );
178 std::unique_ptr<svtools::ColorConfig> mpColorConfig;
181 #define SD_MOD() ( static_cast<SdModule*>(SfxApplication::GetModule(SfxToolsModule::Draw)) )
183 #endif // INCLUDED_SD_INC_SDMOD_HXX
185 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */