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