Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SD_SOURCE_UI_INC_DRAWDOCSHELL_HXX
21 : #define INCLUDED_SD_SOURCE_UI_INC_DRAWDOCSHELL_HXX
22 :
23 : #include <sfx2/docfac.hxx>
24 : #include <sfx2/objsh.hxx>
25 :
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"
32 :
33 : class SfxStyleSheetBasePool;
34 : class FontList;
35 : class SdDrawDocument;
36 : class SdPage;
37 : class SfxPrinter;
38 : struct SpellCallbackInfo;
39 : class AbstractSvxNameDialog;
40 : class SfxUndoManager;
41 :
42 : namespace sd {
43 :
44 : class FrameView;
45 : class ViewShell;
46 : class DrawViewShell;
47 :
48 : // DrawDocShell
49 : class SD_DLLPUBLIC DrawDocShell : public SfxObjectShell
50 : {
51 : public:
52 : TYPEINFO_OVERRIDE();
53 36 : SFX_DECL_INTERFACE(SD_IF_SDDRAWDOCSHELL)
54 17254 : SFX_DECL_OBJECTFACTORY();
55 :
56 : private:
57 : /// SfxInterface initializer.
58 : static void InitInterface_Impl();
59 :
60 : public:
61 : DrawDocShell (
62 : SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED,
63 : bool bSdDataObj=false,
64 : DocumentType=DOCUMENT_TYPE_IMPRESS);
65 :
66 : DrawDocShell (
67 : const sal_uInt64 nModelCreationFlags,
68 : bool bSdDataObj=false,
69 : DocumentType=DOCUMENT_TYPE_IMPRESS);
70 :
71 : DrawDocShell (
72 : SdDrawDocument* pDoc,
73 : SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED,
74 : bool bSdDataObj=false,
75 : DocumentType=DOCUMENT_TYPE_IMPRESS);
76 : virtual ~DrawDocShell();
77 :
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;
90 :
91 : virtual bool Load( SfxMedium &rMedium ) SAL_OVERRIDE;
92 : virtual bool LoadFrom( SfxMedium& rMedium ) SAL_OVERRIDE;
93 : virtual bool SaveAs( SfxMedium &rMedium ) SAL_OVERRIDE;
94 :
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, sal_uInt32* 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 SfxDocumentInfoDialog* CreateDocumentInfoDialog( ::vcl::Window *pParent,
106 : const SfxItemSet &rSet ) SAL_OVERRIDE;
107 :
108 : using SotObject::GetInterface;
109 : using SfxObjectShell::GetVisArea;
110 : using SfxShell::GetViewShell;
111 :
112 10336 : sd::ViewShell* GetViewShell() { return mpViewShell; }
113 : ::sd::FrameView* GetFrameView();
114 477 : rtl::Reference<FuPoor> GetDocShellFunction() const { return mxDocShellFunction; }
115 : void SetDocShellFunction( const rtl::Reference<FuPoor>& xFunction );
116 :
117 5062 : SdDrawDocument* GetDoc() { return mpDoc;}
118 311 : DocumentType GetDocumentType() const { return meDocType; }
119 :
120 : SfxPrinter* GetPrinter(bool bCreate);
121 : void SetPrinter(SfxPrinter *pNewPrinter);
122 : void UpdateFontList();
123 :
124 142 : bool IsInDestruction() const { return mbInDestruction; }
125 :
126 : void CancelSearching();
127 :
128 : void Execute( SfxRequest& rReq );
129 : void GetState(SfxItemSet&);
130 :
131 : void Connect(sd::ViewShell* pViewSh);
132 : void Disconnect(sd::ViewShell* pViewSh);
133 : void UpdateTablePointers();
134 :
135 : bool GotoBookmark(const OUString& rBookmark);
136 :
137 : //realize multi-selection of objects
138 : bool GotoTreeBookmark(const OUString& rBookmark);
139 : bool IsMarked( SdrObject* pObject );
140 : bool GetObjectIsmarked(const OUString& rBookmark);
141 : Bitmap GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixel);
142 :
143 : /** checks, if the given name is a valid new name for a slide
144 :
145 : <p>If the name is invalid, an <type>SvxNameDialog</type> pops up that
146 : queries again for a new name until it is ok or the user chose
147 : Cancel.</p>
148 :
149 : @param pWin is necessary to pass to the <type>SvxNameDialog</type> in
150 : case an invalid name was entered.
151 : @param rName the new name that is to be set for a slide. This string
152 : may be set to an empty string (see below).
153 :
154 : @return sal_True, if the new name is unique. Note that if the user entered
155 : a default name of a not-yet-existing slide (e.g. 'Slide 17'),
156 : sal_True is returned, but rName is set to an empty string.
157 : */
158 : bool CheckPageName(vcl::Window* pWin, OUString& rName );
159 :
160 438 : void SetSlotFilter(bool bEnable = false, sal_uInt16 nCount = 0, const sal_uInt16* pSIDs = NULL) { mbFilterEnable = bEnable; mnFilterCount = nCount; mpFilterSIDs = pSIDs; }
161 : void ApplySlotFilter() const;
162 :
163 0 : sal_uInt16 GetStyleFamily() const { return mnStyleFamily; }
164 608 : void SetStyleFamily( sal_uInt16 nSF ) { mnStyleFamily = nSF; }
165 :
166 : /** executes the SID_OPENDOC slot to let the framework open a document
167 : with the given URL and this document as a referer */
168 : void OpenBookmark( const OUString& rBookmarkURL );
169 :
170 : /** checks, if the given name is a valid new name for a slide
171 :
172 : <p>This method does not pop up any dialog (like CheckPageName).</p>
173 :
174 : @param rInOutPageName the new name for a slide that is to be renamed.
175 : This string will be set to an empty string if
176 : bResetStringIfStandardName is true and the name is of the
177 : form of any, possibly not-yet existing, standard slide
178 : (e.g. 'Slide 17')
179 :
180 : @param bResetStringIfStandardName if true allows setting rInOutPageName
181 : to an empty string, which returns true and implies that the
182 : slide will later on get a new standard name (with a free
183 : slide number).
184 :
185 : @return true, if the new name is unique. If bResetStringIfStandardName
186 : is true, the return value is also true, if the slide name is
187 : a standard name (see above)
188 : */
189 : bool IsNewPageNameValid( OUString & rInOutPageName, bool bResetStringIfStandardName = false );
190 :
191 : /** Return the reference device for the current document. When the
192 : inherited implementation returns a device then this is passed to the
193 : caller. Otherwise the returned value depends on the printer
194 : independent layout mode and will usually be either a printer or a
195 : virtual device used for screen rendering.
196 : @return
197 : Returns NULL when the current document has no reference device.
198 : */
199 : virtual OutputDevice* GetDocumentRefDev (void) SAL_OVERRIDE;
200 :
201 : DECL_LINK( RenameSlideHdl, AbstractSvxNameDialog* );
202 :
203 : // ExecuteSpellPopup now handled by DrawDocShell
204 : DECL_LINK( OnlineSpellCallback, SpellCallbackInfo* );
205 :
206 : void ClearUndoBuffer();
207 :
208 : protected:
209 :
210 : SdDrawDocument* mpDoc;
211 : SfxUndoManager* mpUndoManager;
212 : SfxPrinter* mpPrinter;
213 : ::sd::ViewShell* mpViewShell;
214 : FontList* mpFontList;
215 : rtl::Reference<FuPoor> mxDocShellFunction;
216 : DocumentType meDocType;
217 : sal_uInt16 mnStyleFamily;
218 : const sal_uInt16* mpFilterSIDs;
219 : sal_uInt16 mnFilterCount;
220 : bool mbFilterEnable;
221 : bool mbSdDataObj;
222 : bool mbInDestruction;
223 : bool mbOwnPrinter;
224 : bool mbNewDocument;
225 :
226 : bool mbOwnDocument; // if true, we own mpDoc and will delete it in our d'tor
227 : void Construct(bool bClipboard);
228 : virtual void InPlaceActivate( bool bActive ) SAL_OVERRIDE;
229 : public:
230 : virtual void setDocAccTitle( const OUString& rTitle );
231 : virtual const OUString getDocAccTitle() const;
232 : virtual void setDocReadOnly( bool bReadOnly);
233 : virtual bool getDocReadOnly() const;
234 : private:
235 : void setEditMode(DrawViewShell* pDrawViewShell, bool isMasterPage);
236 : };
237 :
238 : #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
239 : #define SV_DECL_DRAW_DOC_SHELL_DEFINED
240 : typedef ::tools::SvRef<DrawDocShell> DrawDocShellRef;
241 : #endif
242 :
243 : } // end of namespace sd
244 :
245 : #endif
246 :
247 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|