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 INCLUDED_SD_SOURCE_UI_INC_DRAWDOCSHELL_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_DRAWDOCSHELL_HXX
23 #include <o3tl/span.hxx>
24 #include <sfx2/docfac.hxx>
25 #include <sfx2/objsh.hxx>
26 #include <svl/style.hxx>
37 struct SpellCallbackInfo
;
38 class AbstractSvxNameDialog
;
48 class SD_DLLPUBLIC DrawDocShell
: public SfxObjectShell
51 SFX_DECL_INTERFACE(SD_IF_SDDRAWDOCSHELL
)
52 SFX_DECL_OBJECTFACTORY();
55 /// SfxInterface initializer.
56 static void InitInterface_Impl();
60 SfxObjectCreateMode eMode
,
65 SfxModelFlags nModelCreationFlags
,
71 SfxObjectCreateMode eMode
,
74 virtual ~DrawDocShell() override
;
76 void UpdateRefDevice();
77 virtual void Activate( bool bMDI
) override
;
78 virtual void Deactivate( bool bMDI
) override
;
79 virtual bool InitNew( const css::uno::Reference
< css::embed::XStorage
>& xStorage
) override
;
80 virtual bool ImportFrom(SfxMedium
&rMedium
,
81 css::uno::Reference
<css::text::XTextRange
> const& xInsertPosition
)
83 virtual bool ConvertFrom( SfxMedium
&rMedium
) override
;
84 virtual bool Save() override
;
85 virtual bool SaveAsOwnFormat( SfxMedium
& rMedium
) override
;
86 virtual bool ConvertTo( SfxMedium
&rMedium
) override
;
87 virtual bool SaveCompleted( const css::uno::Reference
< css::embed::XStorage
>& xStorage
) override
;
89 virtual bool Load( SfxMedium
&rMedium
) override
;
90 virtual bool LoadFrom( SfxMedium
& rMedium
) override
;
91 virtual bool SaveAs( SfxMedium
&rMedium
) override
;
93 virtual ::tools::Rectangle
GetVisArea(sal_uInt16 nAspect
) const override
;
94 virtual void Draw(OutputDevice
*, const JobSetup
& rSetup
, sal_uInt16 nAspect
) override
;
95 virtual SfxUndoManager
* GetUndoManager() override
;
96 virtual Printer
* GetDocumentPrinter() override
;
97 virtual void OnDocumentPrinterChanged(Printer
* pNewPrinter
) override
;
98 virtual SfxStyleSheetBasePool
* GetStyleSheetPool() override
;
99 virtual void FillClass(SvGlobalName
* pClassName
, SotClipboardFormatId
* pFormat
, OUString
* pAppName
, OUString
* pFullTypeName
, OUString
* pShortTypeName
, sal_Int32 nFileFormat
, bool bTemplate
= false ) const override
;
100 virtual void SetModified( bool = true ) override
;
101 virtual std::unique_ptr
<SfxDocumentInfoDialog
> CreateDocumentInfoDialog(weld::Window
* pParent
,
102 const SfxItemSet
&rSet
) override
;
104 using SfxObjectShell::GetVisArea
;
105 using SfxShell::GetViewShell
;
107 sd::ViewShell
* GetViewShell() { return mpViewShell
; }
108 ::sd::FrameView
* GetFrameView();
109 const rtl::Reference
<FuPoor
>& GetDocShellFunction() const { return mxDocShellFunction
; }
110 void SetDocShellFunction( const rtl::Reference
<FuPoor
>& xFunction
);
112 SdDrawDocument
* GetDoc() { return mpDoc
;}
113 DocumentType
GetDocumentType() const { return meDocType
; }
115 SfxPrinter
* GetPrinter(bool bCreate
);
116 void SetPrinter(SfxPrinter
*pNewPrinter
);
117 void UpdateFontList();
119 bool IsInDestruction() const { return mbInDestruction
; }
121 void CancelSearching();
123 void Execute( SfxRequest
& rReq
);
124 void GetState(SfxItemSet
&);
126 void Connect(sd::ViewShell
* pViewSh
);
127 void Disconnect(sd::ViewShell
const * pViewSh
);
128 void UpdateTablePointers();
130 void GotoBookmark(const OUString
& rBookmark
);
132 BitmapEx
GetPagePreviewBitmap(SdPage
* pPage
);
134 /** checks, if the given name is a valid new name for a slide
136 <p>If the name is invalid, an <type>SvxNameDialog</type> pops up that
137 queries again for a new name until it is ok or the user chose
140 @param pWin is necessary to pass to the <type>SvxNameDialog</type> in
141 case an invalid name was entered.
142 @param rName the new name that is to be set for a slide. This string
143 may be set to an empty string (see below).
145 @return sal_True, if the new name is unique. Note that if the user entered
146 a default name of a not-yet-existing slide (e.g. 'Slide 17'),
147 sal_True is returned, but rName is set to an empty string.
149 bool CheckPageName(weld::Window
* pWin
, OUString
& rName
);
151 void SetSlotFilter(bool bEnable
= false, o3tl::span
<sal_uInt16
const> pSIDs
= o3tl::span
<sal_uInt16
const>()) { mbFilterEnable
= bEnable
; mpFilterSIDs
= pSIDs
; }
152 void ApplySlotFilter() const;
154 SfxStyleFamily
GetStyleFamily() const { return mnStyleFamily
; }
155 void SetStyleFamily( SfxStyleFamily nSF
) { mnStyleFamily
= nSF
; }
157 /** executes the SID_OPENDOC slot to let the framework open a document
158 with the given URL and this document as a referer */
159 void OpenBookmark( const OUString
& rBookmarkURL
);
161 /** checks, if the given name is a valid new name for a slide
163 <p>This method does not pop up any dialog (like CheckPageName).</p>
165 @param rInOutPageName the new name for a slide that is to be renamed.
166 This string will be set to an empty string if
167 bResetStringIfStandardName is true and the name is of the
168 form of any, possibly not-yet existing, standard slide
171 @param bResetStringIfStandardName if true allows setting rInOutPageName
172 to an empty string, which returns true and implies that the
173 slide will later on get a new standard name (with a free
176 @return true, if the new name is unique. If bResetStringIfStandardName
177 is true, the return value is also true, if the slide name is
178 a standard name (see above)
180 bool IsNewPageNameValid( OUString
& rInOutPageName
, bool bResetStringIfStandardName
= false );
182 /** checks, if the given name is a *unique* name for an *existing* slide
184 @param rPageName the name of an existing slide
186 @return true, if the name is unique and the slide exists
188 bool IsPageNameUnique(const OUString
& rPagName
) const;
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.
196 Returns NULL when the current document has no reference device.
198 virtual OutputDevice
* GetDocumentRefDev() override
;
200 DECL_LINK( RenameSlideHdl
, AbstractSvxNameDialog
&, bool );
202 // ExecuteSpellPopup now handled by DrawDocShell
203 DECL_LINK( OnlineSpellCallback
, SpellCallbackInfo
&, void );
205 void ClearUndoBuffer();
209 SdDrawDocument
* mpDoc
;
210 std::unique_ptr
<SfxUndoManager
> mpUndoManager
;
211 VclPtr
<SfxPrinter
> mpPrinter
;
212 ::sd::ViewShell
* mpViewShell
;
213 std::unique_ptr
<FontList
> mpFontList
;
214 rtl::Reference
<FuPoor
> mxDocShellFunction
;
215 DocumentType
const meDocType
;
216 SfxStyleFamily mnStyleFamily
;
217 o3tl::span
<sal_uInt16
const>
220 bool const mbSdDataObj
;
221 bool mbInDestruction
;
224 bool mbOwnDocument
; // if true, we own mpDoc and will delete it in our d'tor
225 void Construct(bool bClipboard
);
227 static void setEditMode(DrawViewShell
* pDrawViewShell
, bool isMasterPage
);
230 #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
231 #define SV_DECL_DRAW_DOC_SHELL_DEFINED
232 typedef ::tools::SvRef
<DrawDocShell
> DrawDocShellRef
;
235 } // end of namespace sd
239 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */