1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DrawDocShell.hxx,v $
10 * $Revision: 1.17.76.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SD_DRAW_DOC_SHELL_HXX
32 #define SD_DRAW_DOC_SHELL_HXX
34 #include <sfx2/docfac.hxx>
35 #include <sfx2/objsh.hxx>
37 #include <vcl/jobset.hxx>
44 class SfxStyleSheetBasePool
;
45 class SfxStatusBarManager
;
46 class SdStyleSheetPool
;
52 struct SdrDocumentStreamInfo
;
53 struct SpellCallbackInfo
;
54 class AbstractSvxNameDialog
;
55 class SdFormatClipboard
;
67 class SD_DLLPUBLIC DrawDocShell
: public SfxObjectShell
71 SFX_DECL_INTERFACE(SD_IF_SDDRAWDOCSHELL
)
72 SFX_DECL_OBJECTFACTORY();
75 SfxObjectCreateMode eMode
= SFX_CREATE_MODE_EMBEDDED
,
76 BOOL bSdDataObj
=FALSE
,
77 DocumentType
=DOCUMENT_TYPE_IMPRESS
,
78 BOOL bScriptSupport
=TRUE
);
82 SfxObjectCreateMode eMode
= SFX_CREATE_MODE_EMBEDDED
,
83 BOOL bSdDataObj
=FALSE
,
84 DocumentType
=DOCUMENT_TYPE_IMPRESS
);
85 virtual ~DrawDocShell();
87 void UpdateRefDevice();
88 virtual void Activate( BOOL bMDI
);
89 virtual void Deactivate( BOOL bMDI
);
90 virtual BOOL
InitNew( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
);
91 virtual sal_Bool
ImportFrom( SfxMedium
&rMedium
);
92 virtual BOOL
ConvertFrom( SfxMedium
&rMedium
);
94 virtual BOOL
SaveAsOwnFormat( SfxMedium
& rMedium
);
95 virtual BOOL
ConvertTo( SfxMedium
&rMedium
);
96 virtual 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(USHORT nAspect
) const;
103 virtual void Draw(OutputDevice
*, const JobSetup
& rSetup
, USHORT nAspect
= ASPECT_CONTENT
);
104 virtual SfxUndoManager
* GetUndoManager();
105 virtual Printer
* GetDocumentPrinter();
106 virtual void OnDocumentPrinterChanged(Printer
* pNewPrinter
);
107 virtual SfxStyleSheetBasePool
* GetStyleSheetPool();
108 virtual void SetOrganizerSearchMask(SfxStyleSheetBasePool
* pBasePool
) const;
109 virtual Size
GetFirstPageSize();
110 virtual void FillClass(SvGlobalName
* pClassName
, sal_uInt32
* pFormat
, String
* pAppName
, String
* pFullTypeName
, String
* pShortTypeName
, sal_Int32 nFileFormat
, sal_Bool bTemplate
= sal_False
) const;
111 virtual void SetModified( BOOL
= TRUE
);
113 using SotObject::GetInterface
;
114 using SfxObjectShell::GetVisArea
;
115 using SfxShell::GetViewShell
;
117 sd::ViewShell
* GetViewShell() { return mpViewShell
; }
118 ::sd::FrameView
* GetFrameView();
119 ::Window
* GetWindow() const;
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(BOOL bCreate
);
127 void SetPrinter(SfxPrinter
*pNewPrinter
);
128 void UpdateFontList();
130 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 BOOL
GotoBookmark(const String
& rBookmark
);
143 Bitmap
GetPagePreviewBitmap(SdPage
* pPage
, USHORT 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 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 TRUE is returned, but rName is set to an empty string.
160 BOOL
CheckPageName(::Window
* pWin
, String
& rName
);
162 void SetSlotFilter(BOOL bEnable
= FALSE
, USHORT nCount
= 0, const USHORT
* pSIDs
= NULL
) { mbFilterEnable
= bEnable
; mnFilterCount
= nCount
; mpFilterSIDs
= pSIDs
; }
163 void ApplySlotFilter() const;
165 UINT16
GetStyleFamily() const { return mnStyleFamily
; }
166 void SetStyleFamily( UINT16 nSF
) { mnStyleFamily
= nSF
; }
168 sal_Bool
IsNewDocument() const;
170 /** executes the SID_OPENDOC slot to let the framework open a document
171 with the given URL and this document as a referer */
172 void OpenBookmark( const String
& rBookmarkURL
);
174 /** checks, if the given name is a valid new name for a slide
176 <p>This method does not pop up any dialog (like CheckPageName).</p>
178 @param rInOutPageName the new name for a slide that is to be renamed.
179 This string will be set to an empty string if
180 bResetStringIfStandardName is true and the name is of the
181 form of any, possibly not-yet existing, standard slide
184 @param bResetStringIfStandardName if true allows setting rInOutPageName
185 to an empty string, which returns true and implies that the
186 slide will later on get a new standard name (with a free
189 @return true, if the new name is unique. If bResetStringIfStandardName
190 is true, the return value is also true, if the slide name is
191 a standard name (see above)
193 bool IsNewPageNameValid( String
& rInOutPageName
, bool bResetStringIfStandardName
= false );
196 /** Return the reference device for the current document. When the
197 inherited implementation returns a device then this is passed to the
198 caller. Otherwise the returned value depends on the printer
199 independent layout mode and will usually be either a printer or a
200 virtual device used for screen rendering.
202 Returns NULL when the current document has no reference device.
204 virtual OutputDevice
* GetDocumentRefDev (void);
206 DECL_LINK( RenameSlideHdl
, AbstractSvxNameDialog
* );
208 // #91457# ExecuteSpellPopup now handled by DrawDocShell
209 DECL_LINK( OnlineSpellCallback
, SpellCallbackInfo
* );
211 void ClearUndoBuffer();
214 SdFormatClipboard
* mpFormatClipboard
;
218 SdDrawDocument
* mpDoc
;
219 SfxUndoManager
* mpUndoManager
;
220 SfxPrinter
* mpPrinter
;
221 ::sd::ViewShell
* mpViewShell
;
222 FontList
* mpFontList
;
223 ::sd::FunctionReference mxDocShellFunction
;
224 DocumentType meDocType
;
225 UINT16 mnStyleFamily
;
226 const USHORT
* mpFilterSIDs
;
227 USHORT mnFilterCount
;
230 BOOL mbInDestruction
;
234 bool mbOwnDocument
; // if true, we own mpDoc and will delete it in our d'tor
235 void Construct(bool bClipboard
);
236 virtual void InPlaceActivate( BOOL bActive
);
239 #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
240 #define SV_DECL_DRAW_DOC_SHELL_DEFINED
241 SV_DECL_REF(DrawDocShell
)
244 SV_IMPL_REF (DrawDocShell
)
246 } // end of namespace sd