Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SD_INC_SDMOD_HXX
21 : #define INCLUDED_SD_INC_SDMOD_HXX
22 :
23 : #include "glob.hxx"
24 : #include "pres.hxx"
25 :
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>
38 :
39 : class SdOptions;
40 : class SvxSearchItem;
41 : class EditFieldInfo;
42 : class SdTransferable;
43 : class SvNumberFormatter;
44 : class SfxErrorHandler;
45 : class SdDrawDocument;
46 : class SfxFrame;
47 :
48 : namespace sd {
49 : class DrawDocShell;
50 : class SdGlobalResourceContainer;
51 : }
52 :
53 : namespace com { namespace sun { namespace star { namespace frame {
54 : class XFrame;
55 : } } } }
56 :
57 : enum SdOptionStreamMode
58 : {
59 : SD_OPTION_LOAD = 0,
60 : SD_OPTION_STORE = 1
61 : };
62 :
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;
65 :
66 : /*
67 :
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.
71 :
72 : SdModule is like to be compared with the <SfxApplication>-subclass.
73 :
74 : Remember: Don`t export this class! It uses DLL-internal symbols.
75 :
76 : */
77 :
78 : class SdModule : public SfxModule, public SfxListener
79 : {
80 : public:
81 : TYPEINFO_OVERRIDE();
82 21 : SFX_DECL_INTERFACE(SD_IF_SDAPP)
83 : DECL_LINK( CalcFieldValueHdl, EditFieldInfo* );
84 :
85 : private:
86 : /// SfxInterface initializer.
87 : static void InitInterface_Impl();
88 :
89 : public:
90 : SdModule(SfxObjectFactory* pDrawObjFact, SfxObjectFactory* pGraphicObjFact);
91 : virtual ~SdModule();
92 :
93 : SdTransferable* pTransferClip;
94 : SdTransferable* pTransferDrag;
95 : SdTransferable* pTransferSelection;
96 :
97 : void Execute(SfxRequest& rReq);
98 : void GetState(SfxItemSet&);
99 :
100 : SdOptions* GetSdOptions(DocumentType eDocType);
101 : SD_DLLPUBLIC tools::SvRef<SotStorageStream> GetOptionStream( const OUString& rOptionName, SdOptionStreamMode eMode );
102 :
103 4642 : bool GetWaterCan() const { return bWaterCan; }
104 0 : void SetWaterCan( bool bWC ) { bWaterCan = bWC; }
105 :
106 3 : SvxSearchItem* GetSearchItem() { return pSearchItem; }
107 3 : void SetSearchItem(SvxSearchItem* pItem) { pSearchItem = pItem; }
108 :
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.
114 : */
115 1018 : OutputDevice* GetVirtualRefDevice() { return mpVirtualRefDevice;}
116 :
117 : /** Deprecated alias to <member>GetVirtualRefDevice</member>.
118 : @param rDocShell
119 : Unused dummy parameter.
120 : */
121 : OutputDevice* GetRefDevice (::sd::DrawDocShell& rDocShell);
122 :
123 : SD_DLLPUBLIC SvNumberFormatter* GetNumberFormatter();
124 :
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;
129 :
130 : SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
131 : SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
132 : SdTypesCache gImplTypesCache;
133 :
134 : protected:
135 :
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.
146 : */
147 : VclPtr< VirtualDevice > mpVirtualRefDevice;
148 :
149 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
150 :
151 : private:
152 : SfxFrame* ExecuteNewDocument( SfxRequest& rReq );
153 :
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 );
157 :
158 : /** The resource container controls the lifetime of some singletons.
159 : */
160 : ::std::unique_ptr< ::sd::SdGlobalResourceContainer> mpResourceContainer;
161 :
162 : bool mbEventListenerAdded;
163 :
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.
173 : */
174 : static void AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument);
175 :
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.
181 : */
182 : static bool OutlineToImpress(SfxRequest& rRequest);
183 :
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 )
191 : */
192 : DECL_STATIC_LINK( SdModule, EventListenerHdl, VclSimpleEvent* );
193 :
194 : };
195 :
196 : #define SD_MOD() ( *reinterpret_cast<SdModule**>(GetAppData(SHL_DRAW)) )
197 :
198 : #endif // INCLUDED_SD_INC_SDMOD_HXX
199 :
200 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|