bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / inc / DrawDocShell.hxx
blob5b82479ebf28f772254f4764e2162520f32c98a6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <sfx2/docfac.hxx>
24 #include <sfx2/objsh.hxx>
26 #include <vcl/jobset.hxx>
27 #include "glob.hxx"
28 #include "sdmod.hxx"
29 #include "pres.hxx"
30 #include "sddllapi.h"
31 #include "fupoor.hxx"
33 class SfxStyleSheetBasePool;
34 class FontList;
35 class SdDrawDocument;
36 class SdPage;
37 class SfxPrinter;
38 struct SpellCallbackInfo;
39 class AbstractSvxNameDialog;
40 class SfxUndoManager;
42 namespace sd {
44 class FrameView;
45 class ViewShell;
46 class DrawViewShell;
48 // DrawDocShell
49 class SD_DLLPUBLIC DrawDocShell : public SfxObjectShell
51 public:
52 TYPEINFO_OVERRIDE();
53 SFX_DECL_INTERFACE(SD_IF_SDDRAWDOCSHELL)
54 SFX_DECL_OBJECTFACTORY();
56 private:
57 /// SfxInterface initializer.
58 static void InitInterface_Impl();
60 public:
61 DrawDocShell (
62 SfxObjectCreateMode eMode = SfxObjectCreateMode::EMBEDDED,
63 bool bSdDataObj=false,
64 DocumentType=DOCUMENT_TYPE_IMPRESS);
66 DrawDocShell (
67 SfxModelFlags nModelCreationFlags,
68 bool bSdDataObj=false,
69 DocumentType=DOCUMENT_TYPE_IMPRESS);
71 DrawDocShell (
72 SdDrawDocument* pDoc,
73 SfxObjectCreateMode eMode = SfxObjectCreateMode::EMBEDDED,
74 bool bSdDataObj=false,
75 DocumentType=DOCUMENT_TYPE_IMPRESS);
76 virtual ~DrawDocShell();
78 void UpdateRefDevice();
79 virtual void Activate( bool bMDI ) SAL_OVERRIDE;
80 virtual void Deactivate( bool bMDI ) SAL_OVERRIDE;
81 virtual bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) SAL_OVERRIDE;
82 virtual bool ImportFrom(SfxMedium &rMedium,
83 css::uno::Reference<css::text::XTextRange> const& xInsertPosition)
84 SAL_OVERRIDE;
85 virtual bool ConvertFrom( SfxMedium &rMedium ) SAL_OVERRIDE;
86 virtual bool Save() SAL_OVERRIDE;
87 virtual bool SaveAsOwnFormat( SfxMedium& rMedium ) SAL_OVERRIDE;
88 virtual bool ConvertTo( SfxMedium &rMedium ) SAL_OVERRIDE;
89 virtual bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) SAL_OVERRIDE;
91 virtual bool Load( SfxMedium &rMedium ) SAL_OVERRIDE;
92 virtual bool LoadFrom( SfxMedium& rMedium ) SAL_OVERRIDE;
93 virtual bool SaveAs( SfxMedium &rMedium ) SAL_OVERRIDE;
95 virtual Rectangle GetVisArea(sal_uInt16 nAspect) const SAL_OVERRIDE;
96 virtual void Draw(OutputDevice*, const JobSetup& rSetup, sal_uInt16 nAspect = ASPECT_CONTENT) SAL_OVERRIDE;
97 virtual ::svl::IUndoManager*
98 GetUndoManager() SAL_OVERRIDE;
99 virtual Printer* GetDocumentPrinter() SAL_OVERRIDE;
100 virtual void OnDocumentPrinterChanged(Printer* pNewPrinter) SAL_OVERRIDE;
101 virtual SfxStyleSheetBasePool* GetStyleSheetPool() SAL_OVERRIDE;
102 virtual Size GetFirstPageSize() SAL_OVERRIDE;
103 virtual void FillClass(SvGlobalName* pClassName, SotClipboardFormatId* pFormat, OUString* pAppName, OUString* pFullTypeName, OUString* pShortTypeName, sal_Int32 nFileFormat, bool bTemplate = false ) const SAL_OVERRIDE;
104 virtual void SetModified( bool = true ) SAL_OVERRIDE;
105 virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog( vcl::Window *pParent,
106 const SfxItemSet &rSet ) SAL_OVERRIDE;
108 using SfxObjectShell::GetVisArea;
109 using SfxShell::GetViewShell;
111 sd::ViewShell* GetViewShell() { return mpViewShell; }
112 ::sd::FrameView* GetFrameView();
113 rtl::Reference<FuPoor> GetDocShellFunction() const { return mxDocShellFunction; }
114 void SetDocShellFunction( const rtl::Reference<FuPoor>& xFunction );
116 SdDrawDocument* GetDoc() { return mpDoc;}
117 DocumentType GetDocumentType() const { return meDocType; }
119 SfxPrinter* GetPrinter(bool bCreate);
120 void SetPrinter(SfxPrinter *pNewPrinter);
121 void UpdateFontList();
123 bool IsInDestruction() const { return mbInDestruction; }
125 void CancelSearching();
127 void Execute( SfxRequest& rReq );
128 void GetState(SfxItemSet&);
130 void Connect(sd::ViewShell* pViewSh);
131 void Disconnect(sd::ViewShell* pViewSh);
132 void UpdateTablePointers();
134 bool GotoBookmark(const OUString& rBookmark);
136 //realize multi-selection of objects
137 bool GotoTreeBookmark(const OUString& rBookmark);
138 bool IsMarked( SdrObject* pObject );
139 bool GetObjectIsmarked(const OUString& rBookmark);
140 Bitmap GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixel);
142 /** checks, if the given name is a valid new name for a slide
144 <p>If the name is invalid, an <type>SvxNameDialog</type> pops up that
145 queries again for a new name until it is ok or the user chose
146 Cancel.</p>
148 @param pWin is necessary to pass to the <type>SvxNameDialog</type> in
149 case an invalid name was entered.
150 @param rName the new name that is to be set for a slide. This string
151 may be set to an empty string (see below).
153 @return sal_True, if the new name is unique. Note that if the user entered
154 a default name of a not-yet-existing slide (e.g. 'Slide 17'),
155 sal_True is returned, but rName is set to an empty string.
157 bool CheckPageName(vcl::Window* pWin, OUString& rName );
159 void SetSlotFilter(bool bEnable = false, sal_uInt16 nCount = 0, const sal_uInt16* pSIDs = NULL) { mbFilterEnable = bEnable; mnFilterCount = nCount; mpFilterSIDs = pSIDs; }
160 void ApplySlotFilter() const;
162 sal_uInt16 GetStyleFamily() const { return mnStyleFamily; }
163 void SetStyleFamily( sal_uInt16 nSF ) { mnStyleFamily = nSF; }
165 /** executes the SID_OPENDOC slot to let the framework open a document
166 with the given URL and this document as a referer */
167 void OpenBookmark( const OUString& rBookmarkURL );
169 /** checks, if the given name is a valid new name for a slide
171 <p>This method does not pop up any dialog (like CheckPageName).</p>
173 @param rInOutPageName the new name for a slide that is to be renamed.
174 This string will be set to an empty string if
175 bResetStringIfStandardName is true and the name is of the
176 form of any, possibly not-yet existing, standard slide
177 (e.g. 'Slide 17')
179 @param bResetStringIfStandardName if true allows setting rInOutPageName
180 to an empty string, which returns true and implies that the
181 slide will later on get a new standard name (with a free
182 slide number).
184 @return true, if the new name is unique. If bResetStringIfStandardName
185 is true, the return value is also true, if the slide name is
186 a standard name (see above)
188 bool IsNewPageNameValid( OUString & rInOutPageName, bool bResetStringIfStandardName = false );
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.
195 @return
196 Returns NULL when the current document has no reference device.
198 virtual OutputDevice* GetDocumentRefDev() SAL_OVERRIDE;
200 DECL_LINK( RenameSlideHdl, AbstractSvxNameDialog* );
202 // ExecuteSpellPopup now handled by DrawDocShell
203 DECL_LINK( OnlineSpellCallback, SpellCallbackInfo* );
205 void ClearUndoBuffer();
207 virtual void libreOfficeKitCallback(int nType, const char* pPayload) const SAL_OVERRIDE;
208 virtual bool isTiledRendering() const SAL_OVERRIDE;
210 protected:
212 SdDrawDocument* mpDoc;
213 SfxUndoManager* mpUndoManager;
214 VclPtr<SfxPrinter> mpPrinter;
215 ::sd::ViewShell* mpViewShell;
216 FontList* mpFontList;
217 rtl::Reference<FuPoor> mxDocShellFunction;
218 DocumentType meDocType;
219 sal_uInt16 mnStyleFamily;
220 const sal_uInt16* mpFilterSIDs;
221 sal_uInt16 mnFilterCount;
222 bool mbFilterEnable;
223 bool mbSdDataObj;
224 bool mbInDestruction;
225 bool mbOwnPrinter;
226 bool mbNewDocument;
228 bool mbOwnDocument; // if true, we own mpDoc and will delete it in our d'tor
229 void Construct(bool bClipboard);
230 virtual void InPlaceActivate( bool bActive ) SAL_OVERRIDE;
231 private:
232 static void setEditMode(DrawViewShell* pDrawViewShell, bool isMasterPage);
235 #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
236 #define SV_DECL_DRAW_DOC_SHELL_DEFINED
237 typedef ::tools::SvRef<DrawDocShell> DrawDocShellRef;
238 #endif
240 } // end of namespace sd
242 #endif
244 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */