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