xref: /trunk/main/sd/inc/sdmod.hxx (revision 67e470da)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SDMOD_HXX
25 #define _SDMOD_HXX
26 
27 
28 #ifndef _SDDLL_HXX
29 #define _SD_DLL             // fuer SD_MOD()
30 #include "sddll.hxx"        // fuer SdModuleDummy
31 #endif
32 #include "glob.hxx"
33 #include "pres.hxx"
34 
35 #include <sot/storage.hxx>
36 #include <tools/shl.hxx>
37 #include "sddllapi.h"
38 #include <svl/lstner.hxx>
39 #include <com/sun/star/text/WritingMode.hpp>
40 #include <sfx2/module.hxx>
41 #include <vcl/vclevent.hxx>
42 
43 #ifndef INCLUDED_MEMORY
44 #include <memory>
45 #define INCLUDED_MEMORY
46 #endif
47 
48 class SdOptions;
49 class BasicIDE;
50 class SvxSearchItem;
51 class SdAppLinkHdl;
52 class SvxErrorHandler;
53 class EditFieldInfo;
54 class SvFactory;
55 class SdTransferable;
56 class SvNumberFormatter;
57 class SfxErrorHandler;
58 class OutputDevice;
59 class SdPage;
60 class SdDrawDocument;
61 class SfxFrame;
62 
63 namespace sd {
64 class DrawDocShell;
65 class SdGlobalResourceContainer;
66 }
67 
68 namespace com { namespace sun { namespace star { namespace frame {
69     class XFrame;
70 } } } }
71 
72 
73 // ----------------------
74 // - SdOptionStreamMode -
75 // ----------------------
76 
77 enum SdOptionStreamMode
78 {
79 	SD_OPTION_LOAD = 0,
80 	SD_OPTION_STORE = 1
81 };
82 
83 /*************************************************************************
84 |*
85 |* This subclass of <SfxModule> (which is a subclass of <SfxShell>) is
86 |* linked to the DLL. One instance of this class exists while the DLL is
87 |* loaded.
88 |*
89 |* SdModule is like to be compared with the <SfxApplication>-subclass.
90 |*
91 |* Remember: Don`t export this class! It uses DLL-internal symbols.
92 |*
93 \************************************************************************/
94 
95 class SdModule : public SfxModule, public SfxListener
96 {
97 public:
98 
99 							TYPEINFO();
100 							SFX_DECL_INTERFACE(SD_IF_SDAPP)
101 							DECL_LINK( CalcFieldValueHdl, EditFieldInfo* );
102 
103 							SdModule(SfxObjectFactory* pDrawObjFact, SfxObjectFactory* pGraphicObjFact);
104 	virtual					~SdModule();
105 
106 	SdTransferable*			pTransferClip;
107 	SdTransferable*			pTransferDrag;
108 	SdTransferable*			pTransferSelection;
109 
110 	void					Execute(SfxRequest& rReq);
111 	void					GetState(SfxItemSet&);
112 
113 	SdOptions*				GetSdOptions(DocumentType eDocType);
114 	SD_DLLPUBLIC SvStorageStreamRef		GetOptionStream( const String& rOptionName, SdOptionStreamMode eMode );
115 
GetWaterCan() const116 	sal_Bool					GetWaterCan() const { return bWaterCan; }
SetWaterCan(sal_Bool bWC)117 	void					SetWaterCan( sal_Bool bWC ) { bWaterCan = bWC; }
118 
GetSearchItem()119 	SvxSearchItem*			GetSearchItem() { return (pSearchItem); }
SetSearchItem(SvxSearchItem * pItem)120 	void					SetSearchItem(SvxSearchItem* pItem) { pSearchItem = pItem; }
121 
122     /** Return the virtual device that can be used for printer independent
123         layout.
124         @return
125             The returned pointer is NULL when the device could not be
126             created when this modules was instantiated.
127     */
128     OutputDevice* GetVirtualRefDevice (void);
129 
130     /** Deprecated alias to <member>GetVirtualRefDevice</member>.
131         @param rDocShell
132             Unused dummy parameter.
133     */
134     OutputDevice* GetRefDevice (::sd::DrawDocShell& rDocShell);
135 
136     SD_DLLPUBLIC SvNumberFormatter*		GetNumberFormatter();
137 
138 	//virtuelle Methoden fuer den Optionendialog
139 	virtual SfxItemSet*	 CreateItemSet( sal_uInt16 nId );
140 	virtual void		 ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
141 	virtual	SfxTabPage*	 CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet );
142 
143 protected:
144 
145 	SdOptions*				pImpressOptions;
146 	SdOptions*				pDrawOptions;
147 	SvxSearchItem*			pSearchItem;
148 	SvNumberFormatter*      pNumberFormatter;
149 	SvStorageRef			xOptionStorage;
150 	sal_Bool					bAutoSave;
151 	sal_Bool					bWaterCan;
152 	SfxErrorHandler*		mpErrorHdl;
153     /** This device is used for printer independent layout.  It is virtual
154         in the sense that it does not represent a printer.  The pointer may
155         be NULL when the virtual device could not be created.
156     */
157     OutputDevice*           mpVirtualRefDevice;
158 
159 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
160 
161 private:
162 	SfxFrame* ExecuteNewDocument( SfxRequest& rReq );
163 
164 	static void ChangeMedium( ::sd::DrawDocShell* pDocShell, SfxViewFrame* pViewFrame, const sal_Int32 eMedium );
165 	static SfxFrame* CreateEmptyDocument( DocumentType eDocType, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
166 	static SfxFrame* CreateFromTemplate( const String& rTemplatePath, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame );
167 
168     /** The resource container controls the lifetime of some singletons.
169     */
170     ::std::auto_ptr< ::sd::SdGlobalResourceContainer> mpResourceContainer;
171 
172     /** Create a new summary page.  When the document has been created in
173         the kiosk mode with automatical transitions then this method adds
174         this kind of transition to the new summary page.
175         @param pViewFrame
176             The view frame that is used to execute the slot for creating the
177             summary page.
178         @param pDocument
179             The document which will contain the summary page and from which
180             the information about the default transition is retrieved.
181     */
182     void AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument);
183 
184     /** Take an outline from a text document and create a new impress
185         document according to the structure of the outline.
186         @param rRequest
187             This typically is the unmodified request from a execute()
188             function from where this function is called.
189     */
190     void OutlineToImpress (SfxRequest& rRequest);
191 
192     /** Add an eventlistener as soon as possible in sd, allows to use
193         remote devices to start the slideshow elegantly, and respecting
194         portability
195         @EventListenerHdl
196             The event listener handler
197         @VclSimpleEvent *
198             a poiter to a VCLSimpleEvent (see vcl/vclevent.hxx )
199     */
200 	DECL_LINK( EventListenerHdl, VclSimpleEvent* );
201 
202 };
203 
204 
205 
206 
207 #ifndef SD_MOD
208 #define SD_MOD() ( *(SdModule**) GetAppData(SHL_DRAW) )
209 #endif
210 
211 #endif                                 // _SDMOD_HXX
212 
213