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 :
47 :
48 : // DrawDocShell
49 : class SD_DLLPUBLIC DrawDocShell : public SfxObjectShell
50 : {
51 : public:
52 : TYPEINFO_OVERRIDE();
53 0 : SFX_DECL_INTERFACE(SD_IF_SDDRAWDOCSHELL)
54 0 : SFX_DECL_OBJECTFACTORY();
55 :
56 : DrawDocShell (
57 : SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED,
58 : sal_Bool bSdDataObj=sal_False,
59 : DocumentType=DOCUMENT_TYPE_IMPRESS);
60 :
61 : DrawDocShell (
62 : const sal_uInt64 nModelCreationFlags,
63 : sal_Bool bSdDataObj=sal_False,
64 : DocumentType=DOCUMENT_TYPE_IMPRESS);
65 :
66 : DrawDocShell (
67 : SdDrawDocument* pDoc,
68 : SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED,
69 : sal_Bool bSdDataObj=sal_False,
70 : DocumentType=DOCUMENT_TYPE_IMPRESS);
71 : virtual ~DrawDocShell();
72 :
73 : void UpdateRefDevice();
74 : virtual void Activate( bool bMDI ) SAL_OVERRIDE;
75 : virtual void Deactivate( bool bMDI ) SAL_OVERRIDE;
76 : virtual bool InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) SAL_OVERRIDE;
77 : virtual bool ImportFrom(SfxMedium &rMedium,
78 : css::uno::Reference<css::text::XTextRange> const& xInsertPosition)
79 : SAL_OVERRIDE;
80 : virtual bool ConvertFrom( SfxMedium &rMedium ) SAL_OVERRIDE;
81 : virtual bool Save() SAL_OVERRIDE;
82 : virtual bool SaveAsOwnFormat( SfxMedium& rMedium ) SAL_OVERRIDE;
83 : virtual bool ConvertTo( SfxMedium &rMedium ) SAL_OVERRIDE;
84 : virtual bool SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) SAL_OVERRIDE;
85 :
86 : virtual bool Load( SfxMedium &rMedium ) SAL_OVERRIDE;
87 : virtual bool LoadFrom( SfxMedium& rMedium ) SAL_OVERRIDE;
88 : virtual bool SaveAs( SfxMedium &rMedium ) SAL_OVERRIDE;
89 :
90 : virtual Rectangle GetVisArea(sal_uInt16 nAspect) const SAL_OVERRIDE;
91 : virtual void Draw(OutputDevice*, const JobSetup& rSetup, sal_uInt16 nAspect = ASPECT_CONTENT) SAL_OVERRIDE;
92 : virtual ::svl::IUndoManager*
93 : GetUndoManager() SAL_OVERRIDE;
94 : virtual Printer* GetDocumentPrinter() SAL_OVERRIDE;
95 : virtual void OnDocumentPrinterChanged(Printer* pNewPrinter) SAL_OVERRIDE;
96 : virtual SfxStyleSheetBasePool* GetStyleSheetPool() SAL_OVERRIDE;
97 : virtual Size GetFirstPageSize() SAL_OVERRIDE;
98 : virtual void FillClass(SvGlobalName* pClassName, sal_uInt32* pFormat, OUString* pAppName, OUString* pFullTypeName, OUString* pShortTypeName, sal_Int32 nFileFormat, bool bTemplate = false ) const SAL_OVERRIDE;
99 : virtual void SetModified( bool = true ) SAL_OVERRIDE;
100 : virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog( ::Window *pParent,
101 : const SfxItemSet &rSet ) SAL_OVERRIDE;
102 :
103 : using SotObject::GetInterface;
104 : using SfxObjectShell::GetVisArea;
105 : using SfxShell::GetViewShell;
106 :
107 0 : sd::ViewShell* GetViewShell() { return mpViewShell; }
108 : ::sd::FrameView* GetFrameView();
109 0 : rtl::Reference<FuPoor> GetDocShellFunction() const { return mxDocShellFunction; }
110 : void SetDocShellFunction( const rtl::Reference<FuPoor>& xFunction );
111 :
112 : SdDrawDocument* GetDoc();
113 0 : DocumentType GetDocumentType() const { return meDocType; }
114 :
115 : SfxPrinter* GetPrinter(sal_Bool bCreate);
116 : void SetPrinter(SfxPrinter *pNewPrinter);
117 : void UpdateFontList();
118 :
119 0 : sal_Bool IsInDestruction() const { return mbInDestruction; }
120 :
121 : void CancelSearching();
122 :
123 : void Execute( SfxRequest& rReq );
124 : void GetState(SfxItemSet&);
125 :
126 : void Connect(sd::ViewShell* pViewSh);
127 : void Disconnect(sd::ViewShell* pViewSh);
128 : void UpdateTablePointers();
129 :
130 : sal_Bool GotoBookmark(const OUString& rBookmark);
131 :
132 : //realize multi-selection of objects
133 : sal_Bool GotoTreeBookmark(const OUString& rBookmark);
134 : sal_Bool IsMarked( SdrObject* pObject );
135 : sal_Bool GetObjectIsmarked(const OUString& rBookmark);
136 : Bitmap GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixel);
137 :
138 : /** checks, if the given name is a valid new name for a slide
139 :
140 : <p>If the name is invalid, an <type>SvxNameDialog</type> pops up that
141 : queries again for a new name until it is ok or the user chose
142 : Cancel.</p>
143 :
144 : @param pWin is necessary to pass to the <type>SvxNameDialog</type> in
145 : case an invalid name was entered.
146 : @param rName the new name that is to be set for a slide. This string
147 : may be set to an empty string (see below).
148 :
149 : @return sal_True, if the new name is unique. Note that if the user entered
150 : a default name of a not-yet-existing slide (e.g. 'Slide 17'),
151 : sal_True is returned, but rName is set to an empty string.
152 : */
153 : sal_Bool CheckPageName(::Window* pWin, OUString& rName );
154 :
155 0 : void SetSlotFilter(sal_Bool bEnable = sal_False, sal_uInt16 nCount = 0, const sal_uInt16* pSIDs = NULL) { mbFilterEnable = bEnable; mnFilterCount = nCount; mpFilterSIDs = pSIDs; }
156 : void ApplySlotFilter() const;
157 :
158 0 : sal_uInt16 GetStyleFamily() const { return mnStyleFamily; }
159 0 : void SetStyleFamily( sal_uInt16 nSF ) { mnStyleFamily = nSF; }
160 :
161 : /** executes the SID_OPENDOC slot to let the framework open a document
162 : with the given URL and this document as a referer */
163 : void OpenBookmark( const OUString& rBookmarkURL );
164 :
165 : /** checks, if the given name is a valid new name for a slide
166 :
167 : <p>This method does not pop up any dialog (like CheckPageName).</p>
168 :
169 : @param rInOutPageName the new name for a slide that is to be renamed.
170 : This string will be set to an empty string if
171 : bResetStringIfStandardName is true and the name is of the
172 : form of any, possibly not-yet existing, standard slide
173 : (e.g. 'Slide 17')
174 :
175 : @param bResetStringIfStandardName if true allows setting rInOutPageName
176 : to an empty string, which returns true and implies that the
177 : slide will later on get a new standard name (with a free
178 : slide number).
179 :
180 : @return true, if the new name is unique. If bResetStringIfStandardName
181 : is true, the return value is also true, if the slide name is
182 : a standard name (see above)
183 : */
184 : bool IsNewPageNameValid( OUString & rInOutPageName, bool bResetStringIfStandardName = false );
185 :
186 :
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.
192 : @return
193 : Returns NULL when the current document has no reference device.
194 : */
195 : virtual OutputDevice* GetDocumentRefDev (void) SAL_OVERRIDE;
196 :
197 : DECL_LINK( RenameSlideHdl, AbstractSvxNameDialog* );
198 :
199 : // ExecuteSpellPopup now handled by DrawDocShell
200 : DECL_LINK( OnlineSpellCallback, SpellCallbackInfo* );
201 :
202 : void ClearUndoBuffer();
203 :
204 : protected:
205 :
206 : SdDrawDocument* mpDoc;
207 : SfxUndoManager* mpUndoManager;
208 : SfxPrinter* mpPrinter;
209 : ::sd::ViewShell* mpViewShell;
210 : FontList* mpFontList;
211 : rtl::Reference<FuPoor> mxDocShellFunction;
212 : DocumentType meDocType;
213 : sal_uInt16 mnStyleFamily;
214 : const sal_uInt16* mpFilterSIDs;
215 : sal_uInt16 mnFilterCount;
216 : sal_Bool mbFilterEnable;
217 : sal_Bool mbSdDataObj;
218 : sal_Bool mbInDestruction;
219 : sal_Bool mbOwnPrinter;
220 : sal_Bool mbNewDocument;
221 :
222 : bool mbOwnDocument; // if true, we own mpDoc and will delete it in our d'tor
223 : void Construct(bool bClipboard);
224 : virtual void InPlaceActivate( bool bActive ) SAL_OVERRIDE;
225 : public:
226 : virtual void setDocAccTitle( const OUString& rTitle );
227 : virtual const OUString getDocAccTitle() const;
228 : virtual void setDocReadOnly( sal_Bool bReadOnly);
229 : virtual sal_Bool getDocReadOnly() const;
230 : };
231 :
232 : #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
233 : #define SV_DECL_DRAW_DOC_SHELL_DEFINED
234 : typedef ::tools::SvRef<DrawDocShell> DrawDocShellRef;
235 : #endif
236 :
237 : } // end of namespace sd
238 :
239 : #endif
240 :
241 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|