bump product version to 5.0.4.1
[LibreOffice.git] / sd / inc / sdmod.hxx
blobcfad1699677332157696270f404f6b0ea3826581
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 <tools/shl.hxx>
28 #include "sddllapi.h"
29 #include <svl/itemprop.hxx>
30 #include <svl/lstner.hxx>
31 #include <com/sun/star/text/WritingMode.hpp>
32 #include <sfx2/module.hxx>
33 #include <vcl/vclevent.hxx>
34 #include <vcl/virdev.hxx>
35 #include <sal/types.h>
36 #include <map>
37 #include <memory>
39 class SdOptions;
40 class SvxSearchItem;
41 class EditFieldInfo;
42 class SdTransferable;
43 class SvNumberFormatter;
44 class SfxErrorHandler;
45 class SdDrawDocument;
46 class SfxFrame;
48 namespace sd {
49 class DrawDocShell;
50 class SdGlobalResourceContainer;
53 namespace com { namespace sun { namespace star { namespace frame {
54 class XFrame;
55 } } } }
57 enum SdOptionStreamMode
59 SD_OPTION_LOAD = 0,
60 SD_OPTION_STORE = 1
63 typedef std::map< sal_uIntPtr, css::uno::Reference<css::beans::XPropertySetInfo> > SdExtPropertySetInfoCache;
64 typedef std::map< sal_uInt32, css::uno::Sequence< css::uno::Type> > SdTypesCache;
68 This subclass of <SfxModule> (which is a subclass of <SfxShell>) is
69 linked to the DLL. One instance of this class exists while the DLL is
70 loaded.
72 SdModule is like to be compared with the <SfxApplication>-subclass.
74 Remember: Don`t export this class! It uses DLL-internal symbols.
78 class SdModule : public SfxModule, public SfxListener
80 public:
81 TYPEINFO_OVERRIDE();
82 SFX_DECL_INTERFACE(SD_IF_SDAPP)
83 DECL_LINK( CalcFieldValueHdl, EditFieldInfo* );
85 private:
86 /// SfxInterface initializer.
87 static void InitInterface_Impl();
89 public:
90 SdModule(SfxObjectFactory* pDrawObjFact, SfxObjectFactory* pGraphicObjFact);
91 virtual ~SdModule();
93 SdTransferable* pTransferClip;
94 SdTransferable* pTransferDrag;
95 SdTransferable* pTransferSelection;
97 void Execute(SfxRequest& rReq);
98 void GetState(SfxItemSet&);
100 SdOptions* GetSdOptions(DocumentType eDocType);
101 SD_DLLPUBLIC tools::SvRef<SotStorageStream> GetOptionStream( const OUString& rOptionName, SdOptionStreamMode eMode );
103 bool GetWaterCan() const { return bWaterCan; }
104 void SetWaterCan( bool bWC ) { bWaterCan = bWC; }
106 SvxSearchItem* GetSearchItem() { return pSearchItem; }
107 void SetSearchItem(SvxSearchItem* pItem) { pSearchItem = pItem; }
109 /** Return the virtual device that can be used for printer independent
110 layout.
111 @return
112 The returned pointer is NULL when the device could not be
113 created when this modules was instantiated.
115 OutputDevice* GetVirtualRefDevice() { return mpVirtualRefDevice;}
117 /** Deprecated alias to <member>GetVirtualRefDevice</member>.
118 @param rDocShell
119 Unused dummy parameter.
121 OutputDevice* GetRefDevice (::sd::DrawDocShell& rDocShell);
123 SD_DLLPUBLIC SvNumberFormatter* GetNumberFormatter();
125 // virtual methods for the option dialog
126 virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ) SAL_OVERRIDE;
127 virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
128 virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
130 SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
131 SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
132 SdTypesCache gImplTypesCache;
134 protected:
136 SdOptions* pImpressOptions;
137 SdOptions* pDrawOptions;
138 SvxSearchItem* pSearchItem;
139 SvNumberFormatter* pNumberFormatter;
140 tools::SvRef<SotStorage> xOptionStorage;
141 bool bWaterCan;
142 SfxErrorHandler* mpErrorHdl;
143 /** This device is used for printer independent layout. It is virtual
144 in the sense that it does not represent a printer. The pointer may
145 be NULL when the virtual device could not be created.
147 VclPtr< VirtualDevice > mpVirtualRefDevice;
149 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
151 private:
152 SfxFrame* ExecuteNewDocument( SfxRequest& rReq );
154 static void ChangeMedium( ::sd::DrawDocShell* pDocShell, SfxViewFrame* pViewFrame, const sal_Int32 eMedium );
155 static SfxFrame* CreateEmptyDocument( DocumentType eDocType, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
156 static SfxFrame* CreateFromTemplate( const OUString& rTemplatePath, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
158 /** The resource container controls the lifetime of some singletons.
160 ::std::unique_ptr< ::sd::SdGlobalResourceContainer> mpResourceContainer;
162 bool mbEventListenerAdded;
164 /** Create a new summary page. When the document has been created in
165 the kiosk mode with automatical transitions then this method adds
166 this kind of transition to the new summary page.
167 @param pViewFrame
168 The view frame that is used to execute the slot for creating the
169 summary page.
170 @param pDocument
171 The document which will contain the summary page and from which
172 the information about the default transition is retrieved.
174 static void AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument);
176 /** Take an outline from a text document and create a new impress
177 document according to the structure of the outline.
178 @param rRequest
179 This typically is the unmodified request from a execute()
180 function from where this function is called.
182 static bool OutlineToImpress(SfxRequest& rRequest);
184 /** Add an eventlistener as soon as possible in sd, allows to use
185 remote devices to start the slideshow elegantly, and respecting
186 portability
187 @EventListenerHdl
188 The event listener handler
189 @VclSimpleEvent *
190 a poiter to a VCLSimpleEvent (see vcl/vclevent.hxx )
192 DECL_STATIC_LINK( SdModule, EventListenerHdl, VclSimpleEvent* );
196 #define SD_MOD() ( *reinterpret_cast<SdModule**>(GetAppData(SHL_DRAW)) )
198 #endif // INCLUDED_SD_INC_SDMOD_HXX
200 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */