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 .
22 #include <o3tl/span.hxx>
23 #include <sfx2/docfac.hxx>
24 #include <sfx2/objsh.hxx>
25 #include <svl/style.hxx>
36 struct SpellCallbackInfo
;
37 class AbstractSvxNameDialog
;
47 class SD_DLLPUBLIC DrawDocShell
: public SfxObjectShell
50 SFX_DECL_INTERFACE(SD_IF_SDDRAWDOCSHELL
)
51 SFX_DECL_OBJECTFACTORY();
54 /// SfxInterface initializer.
55 static void InitInterface_Impl();
59 SfxObjectCreateMode eMode
,
64 SfxModelFlags nModelCreationFlags
,
70 SfxObjectCreateMode eMode
,
73 virtual ~DrawDocShell() override
;
75 void UpdateRefDevice();
76 virtual void Activate( bool bMDI
) override
;
77 virtual void Deactivate( bool bMDI
) override
;
78 virtual bool InitNew( const css::uno::Reference
< css::embed::XStorage
>& xStorage
) override
;
79 virtual bool ImportFrom(SfxMedium
&rMedium
,
80 css::uno::Reference
<css::text::XTextRange
> const& xInsertPosition
)
82 virtual bool ConvertFrom( SfxMedium
&rMedium
) override
;
83 virtual bool Save() override
;
84 virtual bool SaveAsOwnFormat( SfxMedium
& rMedium
) override
;
85 virtual bool ConvertTo( SfxMedium
&rMedium
) override
;
86 virtual bool SaveCompleted( const css::uno::Reference
< css::embed::XStorage
>& xStorage
) override
;
88 virtual bool Load( SfxMedium
&rMedium
) override
;
89 virtual bool LoadFrom( SfxMedium
& rMedium
) override
;
90 virtual bool SaveAs( SfxMedium
&rMedium
) override
;
92 virtual ::tools::Rectangle
GetVisArea(sal_uInt16 nAspect
) const override
;
93 virtual void Draw(OutputDevice
*, const JobSetup
& rSetup
, sal_uInt16 nAspect
, bool bOutputForScreen
) override
;
94 virtual SfxUndoManager
* GetUndoManager() override
;
95 virtual Printer
* GetDocumentPrinter() override
;
96 virtual void OnDocumentPrinterChanged(Printer
* pNewPrinter
) override
;
97 virtual SfxStyleSheetBasePool
* GetStyleSheetPool() override
;
98 virtual void FillClass(SvGlobalName
* pClassName
, SotClipboardFormatId
* pFormat
, OUString
* pFullTypeName
, sal_Int32 nFileFormat
, bool bTemplate
= false ) const override
;
99 virtual void SetModified( bool = true ) override
;
100 virtual std::shared_ptr
<SfxDocumentInfoDialog
> CreateDocumentInfoDialog(weld::Window
* pParent
,
101 const SfxItemSet
&rSet
) override
;
103 using SfxObjectShell::GetVisArea
;
104 using SfxShell::GetViewShell
;
106 sd::ViewShell
* GetViewShell() { return mpViewShell
; }
107 ::sd::FrameView
* GetFrameView();
109 SdDrawDocument
* GetDoc() { return mpDoc
;}
110 DocumentType
GetDocumentType() const { return meDocType
; }
112 SfxPrinter
* GetPrinter(bool bCreate
);
113 void SetPrinter(SfxPrinter
*pNewPrinter
);
114 void UpdateFontList();
116 bool IsInDestruction() const { return mbInDestruction
; }
118 void CancelSearching();
120 void Execute( SfxRequest
& rReq
);
121 void GetState(SfxItemSet
&);
123 void Connect(sd::ViewShell
* pViewSh
);
124 void Disconnect(sd::ViewShell
const * pViewSh
);
125 void UpdateTablePointers();
127 void GotoBookmark(std::u16string_view rBookmark
);
129 BitmapEx
GetPagePreviewBitmap(SdPage
* pPage
);
131 /** checks, if the given name is a valid new name for a slide
133 <p>If the name is invalid, an <type>SvxNameDialog</type> pops up that
134 queries again for a new name until it is ok or the user chose
137 @param pWin is necessary to pass to the <type>SvxNameDialog</type> in
138 case an invalid name was entered.
139 @param rName the new name that is to be set for a slide. This string
140 may be set to an empty string (see below).
142 @return sal_True, if the new name is unique. Note that if the user entered
143 a default name of a not-yet-existing slide (e.g. 'Slide 17'),
144 sal_True is returned, but rName is set to an empty string.
146 bool CheckPageName(weld::Window
* pWin
, OUString
& rName
);
148 void SetSlotFilter(bool bEnable
= false, o3tl::span
<sal_uInt16
const> pSIDs
= o3tl::span
<sal_uInt16
const>()) { mbFilterEnable
= bEnable
; mpFilterSIDs
= pSIDs
; }
149 void ApplySlotFilter() const;
151 SfxStyleFamily
GetStyleFamily() const { return mnStyleFamily
; }
152 void SetStyleFamily( SfxStyleFamily nSF
) { mnStyleFamily
= nSF
; }
154 /** executes the SID_OPENDOC slot to let the framework open a document
155 with the given URL and this document as a referer */
156 void OpenBookmark( const OUString
& rBookmarkURL
);
158 /** checks, if the given name is a valid new name for a slide
160 <p>This method does not pop up any dialog (like CheckPageName).</p>
162 @param rInOutPageName the new name for a slide that is to be renamed.
163 This string will be set to an empty string if
164 bResetStringIfStandardName is true and the name is of the
165 form of any, possibly not-yet existing, standard slide
168 @param bResetStringIfStandardName if true allows setting rInOutPageName
169 to an empty string, which returns true and implies that the
170 slide will later on get a new standard name (with a free
173 @return true, if the new name is unique. If bResetStringIfStandardName
174 is true, the return value is also true, if the slide name is
175 a standard name (see above)
177 bool IsNewPageNameValid( OUString
& rInOutPageName
, bool bResetStringIfStandardName
= false );
179 /** checks, if the given name is a *unique* name for an *existing* slide
181 @param rPageName the name of an existing slide
183 @return true, if the name is unique and the slide exists
185 bool IsPageNameUnique(std::u16string_view rPagName
) const;
187 /** Return the reference device for the current document. When the
188 inherited implementation returns a device then this is passed to the
189 caller. Otherwise the returned value depends on the printer
190 independent layout mode and will usually be either a printer or a
191 virtual device used for screen rendering.
193 Returns NULL when the current document has no reference device.
195 virtual OutputDevice
* GetDocumentRefDev() override
;
197 DECL_DLLPRIVATE_LINK( RenameSlideHdl
, AbstractSvxNameDialog
&, bool );
199 // ExecuteSpellPopup now handled by DrawDocShell
200 DECL_DLLPRIVATE_LINK( OnlineSpellCallback
, SpellCallbackInfo
&, void );
202 void ClearUndoBuffer();
204 std::shared_ptr
<model::ColorSet
> GetThemeColors() override
;
207 static void setEditMode(DrawViewShell
* pDrawViewShell
, bool isMasterPage
);
208 void Construct(bool bClipboard
);
210 SdDrawDocument
* mpDoc
;
211 std::unique_ptr
<SfxUndoManager
> mpUndoManager
;
212 VclPtr
<SfxPrinter
> mpPrinter
;
213 ::sd::ViewShell
* mpViewShell
;
214 std::unique_ptr
<FontList
> mpFontList
;
215 DocumentType meDocType
;
216 SfxStyleFamily mnStyleFamily
;
217 o3tl::span
<sal_uInt16
const>
221 bool mbInDestruction
;
223 bool mbOwnDocument
; // if true, we own mpDoc and will delete it in our d'tor
226 #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
227 #define SV_DECL_DRAW_DOC_SHELL_DEFINED
228 typedef ::tools::SvRef
<DrawDocShell
> DrawDocShellRef
;
231 } // end of namespace sd
233 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */