xref: /aoo41x/main/sd/source/ui/inc/DrawDocShell.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 SD_DRAW_DOC_SHELL_HXX
29*cdf0e10cSrcweir #define SD_DRAW_DOC_SHELL_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <sfx2/docfac.hxx>
32*cdf0e10cSrcweir #include <sfx2/objsh.hxx>
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #include <vcl/jobset.hxx>
35*cdf0e10cSrcweir #include "glob.hxx"
36*cdf0e10cSrcweir #include "sdmod.hxx"
37*cdf0e10cSrcweir #include "pres.hxx"
38*cdf0e10cSrcweir #include "sddllapi.h"
39*cdf0e10cSrcweir #include "fupoor.hxx"
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir class SfxStyleSheetBasePool;
42*cdf0e10cSrcweir class SfxStatusBarManager;
43*cdf0e10cSrcweir class SdStyleSheetPool;
44*cdf0e10cSrcweir class FontList;
45*cdf0e10cSrcweir class SdDrawDocument;
46*cdf0e10cSrcweir class SvxItemFactory;
47*cdf0e10cSrcweir class SdPage;
48*cdf0e10cSrcweir class SfxPrinter;
49*cdf0e10cSrcweir struct SdrDocumentStreamInfo;
50*cdf0e10cSrcweir struct SpellCallbackInfo;
51*cdf0e10cSrcweir class AbstractSvxNameDialog;
52*cdf0e10cSrcweir class SfxUndoManager;
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir namespace sd {
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir class FrameView;
57*cdf0e10cSrcweir class View;
58*cdf0e10cSrcweir class ViewShell;
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir // ------------------
61*cdf0e10cSrcweir // - DrawDocShell -
62*cdf0e10cSrcweir // ------------------
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir class SD_DLLPUBLIC DrawDocShell : public SfxObjectShell
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir public:
67*cdf0e10cSrcweir     TYPEINFO();
68*cdf0e10cSrcweir     SFX_DECL_INTERFACE(SD_IF_SDDRAWDOCSHELL)
69*cdf0e10cSrcweir     SFX_DECL_OBJECTFACTORY();
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir     DrawDocShell (
72*cdf0e10cSrcweir         SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED,
73*cdf0e10cSrcweir         sal_Bool bSdDataObj=sal_False,
74*cdf0e10cSrcweir         DocumentType=DOCUMENT_TYPE_IMPRESS);
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir     DrawDocShell (
77*cdf0e10cSrcweir         const sal_uInt64 nModelCreationFlags,
78*cdf0e10cSrcweir         sal_Bool bSdDataObj=sal_False,
79*cdf0e10cSrcweir         DocumentType=DOCUMENT_TYPE_IMPRESS);
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 	DrawDocShell (
82*cdf0e10cSrcweir         SdDrawDocument* pDoc,
83*cdf0e10cSrcweir         SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED,
84*cdf0e10cSrcweir         sal_Bool bSdDataObj=sal_False,
85*cdf0e10cSrcweir         DocumentType=DOCUMENT_TYPE_IMPRESS);
86*cdf0e10cSrcweir     virtual ~DrawDocShell();
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir     void                    UpdateRefDevice();
89*cdf0e10cSrcweir 	virtual void	        Activate( sal_Bool bMDI );
90*cdf0e10cSrcweir 	virtual void	        Deactivate( sal_Bool bMDI );
91*cdf0e10cSrcweir     virtual sal_Bool            InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
92*cdf0e10cSrcweir 	virtual sal_Bool	        ConvertFrom( SfxMedium &rMedium );
93*cdf0e10cSrcweir 	virtual sal_Bool	        Save();
94*cdf0e10cSrcweir 	virtual sal_Bool            SaveAsOwnFormat( SfxMedium& rMedium );
95*cdf0e10cSrcweir 	virtual sal_Bool            ConvertTo( SfxMedium &rMedium );
96*cdf0e10cSrcweir     virtual sal_Bool            SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir     virtual sal_Bool        Load( SfxMedium &rMedium  );
99*cdf0e10cSrcweir     virtual sal_Bool        LoadFrom( SfxMedium& rMedium );
100*cdf0e10cSrcweir     virtual sal_Bool        SaveAs( SfxMedium &rMedium  );
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     virtual Rectangle       GetVisArea(sal_uInt16 nAspect) const;
103*cdf0e10cSrcweir 	virtual void        	Draw(OutputDevice*, const JobSetup& rSetup, sal_uInt16 nAspect = ASPECT_CONTENT);
104*cdf0e10cSrcweir     virtual ::svl::IUndoManager*
105*cdf0e10cSrcweir                             GetUndoManager();
106*cdf0e10cSrcweir 	virtual Printer*        GetDocumentPrinter();
107*cdf0e10cSrcweir 	virtual void            OnDocumentPrinterChanged(Printer* pNewPrinter);
108*cdf0e10cSrcweir 	virtual SfxStyleSheetBasePool* GetStyleSheetPool();
109*cdf0e10cSrcweir 	virtual void	        SetOrganizerSearchMask(SfxStyleSheetBasePool* pBasePool) const;
110*cdf0e10cSrcweir 	virtual Size	        GetFirstPageSize();
111*cdf0e10cSrcweir     virtual void            FillClass(SvGlobalName* pClassName, sal_uInt32*  pFormat, String* pAppName, String* pFullTypeName, String* pShortTypeName, sal_Int32 nFileFormat, sal_Bool bTemplate = sal_False ) const;
112*cdf0e10cSrcweir 	virtual void            SetModified( sal_Bool = sal_True );
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir 	using SotObject::GetInterface;
115*cdf0e10cSrcweir 	using SfxObjectShell::GetVisArea;
116*cdf0e10cSrcweir 	using SfxShell::GetViewShell;
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir     sd::ViewShell* GetViewShell() { return mpViewShell; }
119*cdf0e10cSrcweir     ::sd::FrameView* GetFrameView();
120*cdf0e10cSrcweir     ::sd::FunctionReference	GetDocShellFunction() const { return mxDocShellFunction; }
121*cdf0e10cSrcweir 	void SetDocShellFunction( const ::sd::FunctionReference& xFunction );
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     SdDrawDocument*         GetDoc();
124*cdf0e10cSrcweir 	DocumentType            GetDocumentType() const { return meDocType; }
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 	SfxPrinter*             GetPrinter(sal_Bool bCreate);
127*cdf0e10cSrcweir 	void			        SetPrinter(SfxPrinter *pNewPrinter);
128*cdf0e10cSrcweir 	void			        UpdateFontList();
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 	sal_Bool                    IsInDestruction() const { return mbInDestruction; }
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 	void			        CancelSearching();
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 	void			        Execute( SfxRequest& rReq );
135*cdf0e10cSrcweir 	void			        GetState(SfxItemSet&);
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir 	void			        Connect(sd::ViewShell* pViewSh);
138*cdf0e10cSrcweir 	void			        Disconnect(sd::ViewShell* pViewSh);
139*cdf0e10cSrcweir 	void			        UpdateTablePointers();
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 	sal_Bool			        GotoBookmark(const String& rBookmark);
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 	Bitmap                  GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixel);
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir     /** checks, if the given name is a valid new name for a slide
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir         <p>If the name is invalid, an <type>SvxNameDialog</type> pops up that
148*cdf0e10cSrcweir         queries again for a new name until it is ok or the user chose
149*cdf0e10cSrcweir         Cancel.</p>
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir         @param pWin is necessary to pass to the <type>SvxNameDialog</type> in
152*cdf0e10cSrcweir                     case an invalid name was entered.
153*cdf0e10cSrcweir         @param rName the new name that is to be set for a slide.  This string
154*cdf0e10cSrcweir                      may be set to an empty string (see below).
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir         @return sal_True, if the new name is unique.  Note that if the user entered
157*cdf0e10cSrcweir                 a default name of a not-yet-existing slide (e.g. 'Slide 17'),
158*cdf0e10cSrcweir                 sal_True is returned, but rName is set to an empty string.
159*cdf0e10cSrcweir      */
160*cdf0e10cSrcweir 	sal_Bool	                CheckPageName(::Window* pWin, String& rName );
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 	void                    SetSlotFilter(sal_Bool bEnable = sal_False, sal_uInt16 nCount = 0, const sal_uInt16* pSIDs = NULL) { mbFilterEnable = bEnable; mnFilterCount = nCount; mpFilterSIDs = pSIDs; }
163*cdf0e10cSrcweir 	void                    ApplySlotFilter() const;
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 	sal_uInt16	                GetStyleFamily() const { return mnStyleFamily; }
166*cdf0e10cSrcweir 	void	                SetStyleFamily( sal_uInt16 nSF ) { mnStyleFamily = nSF; }
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 	/** executes the SID_OPENDOC slot to let the framework open a document
169*cdf0e10cSrcweir 		with the given URL and this document as a referer */
170*cdf0e10cSrcweir 	void					OpenBookmark( const String& rBookmarkURL );
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir     /** checks, if the given name is a valid new name for a slide
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir         <p>This method does not pop up any dialog (like CheckPageName).</p>
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir         @param rInOutPageName the new name for a slide that is to be renamed.
177*cdf0e10cSrcweir                     This string will be set to an empty string if
178*cdf0e10cSrcweir                     bResetStringIfStandardName is true and the name is of the
179*cdf0e10cSrcweir                     form of any, possibly not-yet existing, standard slide
180*cdf0e10cSrcweir                     (e.g. 'Slide 17')
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir         @param bResetStringIfStandardName if true allows setting rInOutPageName
183*cdf0e10cSrcweir                     to an empty string, which returns true and implies that the
184*cdf0e10cSrcweir                     slide will later on get a new standard name (with a free
185*cdf0e10cSrcweir                     slide number).
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir         @return true, if the new name is unique.  If bResetStringIfStandardName
188*cdf0e10cSrcweir                     is true, the return value is also true, if the slide name is
189*cdf0e10cSrcweir                     a standard name (see above)
190*cdf0e10cSrcweir      */
191*cdf0e10cSrcweir     bool                    IsNewPageNameValid( String & rInOutPageName, bool bResetStringIfStandardName = false );
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir     /** Return the reference device for the current document.  When the
195*cdf0e10cSrcweir         inherited implementation returns a device then this is passed to the
196*cdf0e10cSrcweir         caller.  Otherwise the returned value depends on the printer
197*cdf0e10cSrcweir         independent layout mode and will usually be either a printer or a
198*cdf0e10cSrcweir         virtual device used for screen rendering.
199*cdf0e10cSrcweir         @return
200*cdf0e10cSrcweir             Returns NULL when the current document has no reference device.
201*cdf0e10cSrcweir     */
202*cdf0e10cSrcweir     virtual OutputDevice* GetDocumentRefDev (void);
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir     DECL_LINK( RenameSlideHdl, AbstractSvxNameDialog* );
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir                             // #91457# ExecuteSpellPopup now handled by DrawDocShell
207*cdf0e10cSrcweir 	                        DECL_LINK( OnlineSpellCallback, SpellCallbackInfo* );
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 	void					ClearUndoBuffer();
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir protected:
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 	SdDrawDocument* 		mpDoc;
214*cdf0e10cSrcweir     SfxUndoManager*         mpUndoManager;
215*cdf0e10cSrcweir 	SfxPrinter* 			mpPrinter;
216*cdf0e10cSrcweir 	::sd::ViewShell*		mpViewShell;
217*cdf0e10cSrcweir 	FontList*				mpFontList;
218*cdf0e10cSrcweir 	::sd::FunctionReference	mxDocShellFunction;
219*cdf0e10cSrcweir 	DocumentType            meDocType;
220*cdf0e10cSrcweir 	sal_uInt16					mnStyleFamily;
221*cdf0e10cSrcweir 	const sal_uInt16*           mpFilterSIDs;
222*cdf0e10cSrcweir 	sal_uInt16                  mnFilterCount;
223*cdf0e10cSrcweir 	sal_Bool                    mbFilterEnable;
224*cdf0e10cSrcweir 	sal_Bool					mbSdDataObj;
225*cdf0e10cSrcweir 	sal_Bool                    mbInDestruction;
226*cdf0e10cSrcweir 	sal_Bool 					mbOwnPrinter;
227*cdf0e10cSrcweir     sal_Bool                    mbNewDocument;
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir 	bool					mbOwnDocument;			// if true, we own mpDoc and will delete it in our d'tor
230*cdf0e10cSrcweir     void					Construct(bool bClipboard);
231*cdf0e10cSrcweir     virtual void            InPlaceActivate( sal_Bool bActive );
232*cdf0e10cSrcweir };
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
235*cdf0e10cSrcweir #define SV_DECL_DRAW_DOC_SHELL_DEFINED
236*cdf0e10cSrcweir SV_DECL_REF(DrawDocShell)
237*cdf0e10cSrcweir #endif
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir SV_IMPL_REF (DrawDocShell)
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir } // end of namespace sd
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir #endif
244