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