1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SD_DRAW_DOC_SHELL_HXX
21 #define SD_DRAW_DOC_SHELL_HXX
23 #include <sfx2/docfac.hxx>
24 #include <sfx2/objsh.hxx>
26 #include <vcl/jobset.hxx>
33 class SfxStyleSheetBasePool
;
38 struct SpellCallbackInfo
;
39 class AbstractSvxNameDialog
;
51 class SD_DLLPUBLIC DrawDocShell
: public SfxObjectShell
55 SFX_DECL_INTERFACE(SD_IF_SDDRAWDOCSHELL
)
56 SFX_DECL_OBJECTFACTORY();
59 SfxObjectCreateMode eMode
= SFX_CREATE_MODE_EMBEDDED
,
60 sal_Bool bSdDataObj
=sal_False
,
61 DocumentType
=DOCUMENT_TYPE_IMPRESS
);
64 const sal_uInt64 nModelCreationFlags
,
65 sal_Bool bSdDataObj
=sal_False
,
66 DocumentType
=DOCUMENT_TYPE_IMPRESS
);
70 SfxObjectCreateMode eMode
= SFX_CREATE_MODE_EMBEDDED
,
71 sal_Bool bSdDataObj
=sal_False
,
72 DocumentType
=DOCUMENT_TYPE_IMPRESS
);
73 virtual ~DrawDocShell();
75 void UpdateRefDevice();
76 virtual void Activate( sal_Bool bMDI
);
77 virtual void Deactivate( sal_Bool bMDI
);
78 virtual sal_Bool
InitNew( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
);
79 virtual sal_Bool
ImportFrom( SfxMedium
&rMedium
, bool bInsert
=false );
80 virtual sal_Bool
ConvertFrom( SfxMedium
&rMedium
);
81 virtual sal_Bool
Save();
82 virtual sal_Bool
SaveAsOwnFormat( SfxMedium
& rMedium
);
83 virtual sal_Bool
ConvertTo( SfxMedium
&rMedium
);
84 virtual sal_Bool
SaveCompleted( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xStorage
);
86 virtual sal_Bool
Load( SfxMedium
&rMedium
);
87 virtual sal_Bool
LoadFrom( SfxMedium
& rMedium
);
88 virtual sal_Bool
SaveAs( SfxMedium
&rMedium
);
90 virtual Rectangle
GetVisArea(sal_uInt16 nAspect
) const;
91 virtual void Draw(OutputDevice
*, const JobSetup
& rSetup
, sal_uInt16 nAspect
= ASPECT_CONTENT
);
92 virtual ::svl::IUndoManager
*
94 virtual Printer
* GetDocumentPrinter();
95 virtual void OnDocumentPrinterChanged(Printer
* pNewPrinter
);
96 virtual SfxStyleSheetBasePool
* GetStyleSheetPool();
97 virtual void SetOrganizerSearchMask(SfxStyleSheetBasePool
* pBasePool
) const;
98 virtual Size
GetFirstPageSize();
99 virtual void FillClass(SvGlobalName
* pClassName
, sal_uInt32
* pFormat
, OUString
* pAppName
, OUString
* pFullTypeName
, OUString
* pShortTypeName
, sal_Int32 nFileFormat
, sal_Bool bTemplate
= sal_False
) const;
100 virtual void SetModified( sal_Bool
= sal_True
);
101 virtual SfxDocumentInfoDialog
* CreateDocumentInfoDialog( ::Window
*pParent
,
102 const SfxItemSet
&rSet
);
104 using SotObject::GetInterface
;
105 using SfxObjectShell::GetVisArea
;
106 using SfxShell::GetViewShell
;
108 sd::ViewShell
* GetViewShell() { return mpViewShell
; }
109 ::sd::FrameView
* GetFrameView();
110 ::sd::FunctionReference
GetDocShellFunction() const { return mxDocShellFunction
; }
111 void SetDocShellFunction( const ::sd::FunctionReference
& xFunction
);
113 SdDrawDocument
* GetDoc();
114 DocumentType
GetDocumentType() const { return meDocType
; }
116 SfxPrinter
* GetPrinter(sal_Bool bCreate
);
117 void SetPrinter(SfxPrinter
*pNewPrinter
);
118 void UpdateFontList();
120 sal_Bool
IsInDestruction() const { return mbInDestruction
; }
122 void CancelSearching();
124 void Execute( SfxRequest
& rReq
);
125 void GetState(SfxItemSet
&);
127 void Connect(sd::ViewShell
* pViewSh
);
128 void Disconnect(sd::ViewShell
* pViewSh
);
129 void UpdateTablePointers();
131 sal_Bool
GotoBookmark(const String
& rBookmark
);
133 Bitmap
GetPagePreviewBitmap(SdPage
* pPage
, sal_uInt16 nMaxEdgePixel
);
135 /** checks, if the given name is a valid new name for a slide
137 <p>If the name is invalid, an <type>SvxNameDialog</type> pops up that
138 queries again for a new name until it is ok or the user chose
141 @param pWin is necessary to pass to the <type>SvxNameDialog</type> in
142 case an invalid name was entered.
143 @param rName the new name that is to be set for a slide. This string
144 may be set to an empty string (see below).
146 @return sal_True, if the new name is unique. Note that if the user entered
147 a default name of a not-yet-existing slide (e.g. 'Slide 17'),
148 sal_True is returned, but rName is set to an empty string.
150 sal_Bool
CheckPageName(::Window
* pWin
, String
& rName
);
152 void SetSlotFilter(sal_Bool bEnable
= sal_False
, sal_uInt16 nCount
= 0, const sal_uInt16
* pSIDs
= NULL
) { mbFilterEnable
= bEnable
; mnFilterCount
= nCount
; mpFilterSIDs
= pSIDs
; }
153 void ApplySlotFilter() const;
155 sal_uInt16
GetStyleFamily() const { return mnStyleFamily
; }
156 void SetStyleFamily( sal_uInt16 nSF
) { mnStyleFamily
= nSF
; }
158 /** executes the SID_OPENDOC slot to let the framework open a document
159 with the given URL and this document as a referer */
160 void OpenBookmark( const String
& rBookmarkURL
);
162 /** checks, if the given name is a valid new name for a slide
164 <p>This method does not pop up any dialog (like CheckPageName).</p>
166 @param rInOutPageName the new name for a slide that is to be renamed.
167 This string will be set to an empty string if
168 bResetStringIfStandardName is true and the name is of the
169 form of any, possibly not-yet existing, standard slide
172 @param bResetStringIfStandardName if true allows setting rInOutPageName
173 to an empty string, which returns true and implies that the
174 slide will later on get a new standard name (with a free
177 @return true, if the new name is unique. If bResetStringIfStandardName
178 is true, the return value is also true, if the slide name is
179 a standard name (see above)
181 bool IsNewPageNameValid( String
& rInOutPageName
, bool bResetStringIfStandardName
= false );
184 /** Return the reference device for the current document. When the
185 inherited implementation returns a device then this is passed to the
186 caller. Otherwise the returned value depends on the printer
187 independent layout mode and will usually be either a printer or a
188 virtual device used for screen rendering.
190 Returns NULL when the current document has no reference device.
192 virtual OutputDevice
* GetDocumentRefDev (void);
194 DECL_LINK( RenameSlideHdl
, AbstractSvxNameDialog
* );
196 // ExecuteSpellPopup now handled by DrawDocShell
197 DECL_LINK( OnlineSpellCallback
, SpellCallbackInfo
* );
199 void ClearUndoBuffer();
203 SdDrawDocument
* mpDoc
;
204 SfxUndoManager
* mpUndoManager
;
205 SfxPrinter
* mpPrinter
;
206 ::sd::ViewShell
* mpViewShell
;
207 FontList
* mpFontList
;
208 ::sd::FunctionReference mxDocShellFunction
;
209 DocumentType meDocType
;
210 sal_uInt16 mnStyleFamily
;
211 const sal_uInt16
* mpFilterSIDs
;
212 sal_uInt16 mnFilterCount
;
213 sal_Bool mbFilterEnable
;
214 sal_Bool mbSdDataObj
;
215 sal_Bool mbInDestruction
;
216 sal_Bool mbOwnPrinter
;
217 sal_Bool mbNewDocument
;
219 bool mbOwnDocument
; // if true, we own mpDoc and will delete it in our d'tor
220 void Construct(bool bClipboard
);
221 virtual void InPlaceActivate( sal_Bool bActive
);
224 #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
225 #define SV_DECL_DRAW_DOC_SHELL_DEFINED
226 SV_DECL_REF(DrawDocShell
)
229 SV_IMPL_REF (DrawDocShell
)
231 } // end of namespace sd
235 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */