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