1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef SD_DRAW_DOC_SHELL_HXX
29 #define SD_DRAW_DOC_SHELL_HXX
31 #include <sfx2/docfac.hxx>
32 #include <sfx2/objsh.hxx>
34 #include <vcl/jobset.hxx>
41 class SfxStyleSheetBasePool
;
42 class SfxStatusBarManager
;
43 class SdStyleSheetPool
;
49 struct SdrDocumentStreamInfo
;
50 struct SpellCallbackInfo
;
51 class AbstractSvxNameDialog
;
64 class SD_DLLPUBLIC DrawDocShell
: public SfxObjectShell
68 SFX_DECL_INTERFACE(SD_IF_SDDRAWDOCSHELL
)
69 SFX_DECL_OBJECTFACTORY();
72 SfxObjectCreateMode eMode
= SFX_CREATE_MODE_EMBEDDED
,
73 sal_Bool bSdDataObj
=sal_False
,
74 DocumentType
=DOCUMENT_TYPE_IMPRESS
);
77 const sal_uInt64 nModelCreationFlags
,
78 sal_Bool bSdDataObj
=sal_False
,
79 DocumentType
=DOCUMENT_TYPE_IMPRESS
);
83 SfxObjectCreateMode eMode
= SFX_CREATE_MODE_EMBEDDED
,
84 sal_Bool bSdDataObj
=sal_False
,
85 DocumentType
=DOCUMENT_TYPE_IMPRESS
);
86 virtual ~DrawDocShell();
88 void UpdateRefDevice();
89 virtual void Activate( sal_Bool bMDI
);
90 virtual void Deactivate( sal_Bool bMDI
);
91 virtual sal_Bool
InitNew( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
);
92 virtual sal_Bool
ConvertFrom( SfxMedium
&rMedium
);
93 virtual sal_Bool
Save();
94 virtual sal_Bool
SaveAsOwnFormat( SfxMedium
& rMedium
);
95 virtual sal_Bool
ConvertTo( SfxMedium
&rMedium
);
96 virtual sal_Bool
SaveCompleted( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
);
98 virtual sal_Bool
Load( SfxMedium
&rMedium
);
99 virtual sal_Bool
LoadFrom( SfxMedium
& rMedium
);
100 virtual sal_Bool
SaveAs( SfxMedium
&rMedium
);
102 virtual Rectangle
GetVisArea(sal_uInt16 nAspect
) const;
103 virtual void Draw(OutputDevice
*, const JobSetup
& rSetup
, sal_uInt16 nAspect
= ASPECT_CONTENT
);
104 virtual ::svl::IUndoManager
*
106 virtual Printer
* GetDocumentPrinter();
107 virtual void OnDocumentPrinterChanged(Printer
* pNewPrinter
);
108 virtual SfxStyleSheetBasePool
* GetStyleSheetPool();
109 virtual void SetOrganizerSearchMask(SfxStyleSheetBasePool
* pBasePool
) const;
110 virtual Size
GetFirstPageSize();
111 virtual void FillClass(SvGlobalName
* pClassName
, sal_uInt32
* pFormat
, String
* pAppName
, String
* pFullTypeName
, String
* pShortTypeName
, sal_Int32 nFileFormat
, sal_Bool bTemplate
= sal_False
) const;
112 virtual void SetModified( sal_Bool
= sal_True
);
114 using SotObject::GetInterface
;
115 using SfxObjectShell::GetVisArea
;
116 using SfxShell::GetViewShell
;
118 sd::ViewShell
* GetViewShell() { return mpViewShell
; }
119 ::sd::FrameView
* GetFrameView();
120 ::sd::FunctionReference
GetDocShellFunction() const { return mxDocShellFunction
; }
121 void SetDocShellFunction( const ::sd::FunctionReference
& xFunction
);
123 SdDrawDocument
* GetDoc();
124 DocumentType
GetDocumentType() const { return meDocType
; }
126 SfxPrinter
* GetPrinter(sal_Bool bCreate
);
127 void SetPrinter(SfxPrinter
*pNewPrinter
);
128 void UpdateFontList();
130 sal_Bool
IsInDestruction() const { return mbInDestruction
; }
132 void CancelSearching();
134 void Execute( SfxRequest
& rReq
);
135 void GetState(SfxItemSet
&);
137 void Connect(sd::ViewShell
* pViewSh
);
138 void Disconnect(sd::ViewShell
* pViewSh
);
139 void UpdateTablePointers();
141 sal_Bool
GotoBookmark(const String
& rBookmark
);
143 Bitmap
GetPagePreviewBitmap(SdPage
* pPage
, sal_uInt16 nMaxEdgePixel
);
145 /** checks, if the given name is a valid new name for a slide
147 <p>If the name is invalid, an <type>SvxNameDialog</type> pops up that
148 queries again for a new name until it is ok or the user chose
151 @param pWin is necessary to pass to the <type>SvxNameDialog</type> in
152 case an invalid name was entered.
153 @param rName the new name that is to be set for a slide. This string
154 may be set to an empty string (see below).
156 @return sal_True, if the new name is unique. Note that if the user entered
157 a default name of a not-yet-existing slide (e.g. 'Slide 17'),
158 sal_True is returned, but rName is set to an empty string.
160 sal_Bool
CheckPageName(::Window
* pWin
, String
& rName
);
162 void SetSlotFilter(sal_Bool bEnable
= sal_False
, sal_uInt16 nCount
= 0, const sal_uInt16
* pSIDs
= NULL
) { mbFilterEnable
= bEnable
; mnFilterCount
= nCount
; mpFilterSIDs
= pSIDs
; }
163 void ApplySlotFilter() const;
165 sal_uInt16
GetStyleFamily() const { return mnStyleFamily
; }
166 void SetStyleFamily( sal_uInt16 nSF
) { mnStyleFamily
= nSF
; }
168 /** executes the SID_OPENDOC slot to let the framework open a document
169 with the given URL and this document as a referer */
170 void OpenBookmark( const String
& rBookmarkURL
);
172 /** checks, if the given name is a valid new name for a slide
174 <p>This method does not pop up any dialog (like CheckPageName).</p>
176 @param rInOutPageName the new name for a slide that is to be renamed.
177 This string will be set to an empty string if
178 bResetStringIfStandardName is true and the name is of the
179 form of any, possibly not-yet existing, standard slide
182 @param bResetStringIfStandardName if true allows setting rInOutPageName
183 to an empty string, which returns true and implies that the
184 slide will later on get a new standard name (with a free
187 @return true, if the new name is unique. If bResetStringIfStandardName
188 is true, the return value is also true, if the slide name is
189 a standard name (see above)
191 bool IsNewPageNameValid( String
& rInOutPageName
, bool bResetStringIfStandardName
= false );
194 /** Return the reference device for the current document. When the
195 inherited implementation returns a device then this is passed to the
196 caller. Otherwise the returned value depends on the printer
197 independent layout mode and will usually be either a printer or a
198 virtual device used for screen rendering.
200 Returns NULL when the current document has no reference device.
202 virtual OutputDevice
* GetDocumentRefDev (void);
204 DECL_LINK( RenameSlideHdl
, AbstractSvxNameDialog
* );
206 // #91457# ExecuteSpellPopup now handled by DrawDocShell
207 DECL_LINK( OnlineSpellCallback
, SpellCallbackInfo
* );
209 void ClearUndoBuffer();
213 SdDrawDocument
* mpDoc
;
214 SfxUndoManager
* mpUndoManager
;
215 SfxPrinter
* mpPrinter
;
216 ::sd::ViewShell
* mpViewShell
;
217 FontList
* mpFontList
;
218 ::sd::FunctionReference mxDocShellFunction
;
219 DocumentType meDocType
;
220 sal_uInt16 mnStyleFamily
;
221 const sal_uInt16
* mpFilterSIDs
;
222 sal_uInt16 mnFilterCount
;
223 sal_Bool mbFilterEnable
;
224 sal_Bool mbSdDataObj
;
225 sal_Bool mbInDestruction
;
226 sal_Bool mbOwnPrinter
;
227 sal_Bool mbNewDocument
;
229 bool mbOwnDocument
; // if true, we own mpDoc and will delete it in our d'tor
230 void Construct(bool bClipboard
);
231 virtual void InPlaceActivate( sal_Bool bActive
);
234 #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
235 #define SV_DECL_DRAW_DOC_SHELL_DEFINED
236 SV_DECL_REF(DrawDocShell
)
239 SV_IMPL_REF (DrawDocShell
)
241 } // end of namespace sd