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