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 11 : SFX_DECL_INTERFACE(SD_IF_SDDRAWDOCSHELL)
56 7877 : 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, OUString* pAppName, OUString* pFullTypeName, OUString* pShortTypeName, sal_Int32 nFileFormat, sal_Bool bTemplate = sal_False ) const;
100 : virtual void SetModified( sal_Bool = sal_True );
101 : virtual SfxDocumentInfoDialog* CreateDocumentInfoDialog( ::Window *pParent,
102 : const SfxItemSet &rSet );
103 :
104 : using SotObject::GetInterface;
105 : using SfxObjectShell::GetVisArea;
106 : using SfxShell::GetViewShell;
107 :
108 1652 : sd::ViewShell* GetViewShell() { return mpViewShell; }
109 : ::sd::FrameView* GetFrameView();
110 482 : ::sd::FunctionReference GetDocShellFunction() const { return mxDocShellFunction; }
111 : void SetDocShellFunction( const ::sd::FunctionReference& xFunction );
112 :
113 : SdDrawDocument* GetDoc();
114 210 : DocumentType GetDocumentType() const { return meDocType; }
115 :
116 : SfxPrinter* GetPrinter(sal_Bool bCreate);
117 : void SetPrinter(SfxPrinter *pNewPrinter);
118 : void UpdateFontList();
119 :
120 11 : sal_Bool IsInDestruction() const { return mbInDestruction; }
121 :
122 : void CancelSearching();
123 :
124 : void Execute( SfxRequest& rReq );
125 : void GetState(SfxItemSet&);
126 :
127 : void Connect(sd::ViewShell* pViewSh);
128 : void Disconnect(sd::ViewShell* pViewSh);
129 : void UpdateTablePointers();
130 :
131 : sal_Bool GotoBookmark(const String& rBookmark);
132 :
133 : Bitmap GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixel);
134 :
135 : /** checks, if the given name is a valid new name for a slide
136 :
137 : <p>If the name is invalid, an <type>SvxNameDialog</type> pops up that
138 : queries again for a new name until it is ok or the user chose
139 : Cancel.</p>
140 :
141 : @param pWin is necessary to pass to the <type>SvxNameDialog</type> in
142 : case an invalid name was entered.
143 : @param rName the new name that is to be set for a slide. This string
144 : may be set to an empty string (see below).
145 :
146 : @return sal_True, if the new name is unique. Note that if the user entered
147 : a default name of a not-yet-existing slide (e.g. 'Slide 17'),
148 : sal_True is returned, but rName is set to an empty string.
149 : */
150 : sal_Bool CheckPageName(::Window* pWin, String& rName );
151 :
152 89 : void SetSlotFilter(sal_Bool bEnable = sal_False, sal_uInt16 nCount = 0, const sal_uInt16* pSIDs = NULL) { mbFilterEnable = bEnable; mnFilterCount = nCount; mpFilterSIDs = pSIDs; }
153 : void ApplySlotFilter() const;
154 :
155 1 : sal_uInt16 GetStyleFamily() const { return mnStyleFamily; }
156 141 : void SetStyleFamily( sal_uInt16 nSF ) { mnStyleFamily = nSF; }
157 :
158 : /** executes the SID_OPENDOC slot to let the framework open a document
159 : with the given URL and this document as a referer */
160 : void OpenBookmark( const String& rBookmarkURL );
161 :
162 : /** checks, if the given name is a valid new name for a slide
163 :
164 : <p>This method does not pop up any dialog (like CheckPageName).</p>
165 :
166 : @param rInOutPageName the new name for a slide that is to be renamed.
167 : This string will be set to an empty string if
168 : bResetStringIfStandardName is true and the name is of the
169 : form of any, possibly not-yet existing, standard slide
170 : (e.g. 'Slide 17')
171 :
172 : @param bResetStringIfStandardName if true allows setting rInOutPageName
173 : to an empty string, which returns true and implies that the
174 : slide will later on get a new standard name (with a free
175 : slide number).
176 :
177 : @return true, if the new name is unique. If bResetStringIfStandardName
178 : is true, the return value is also true, if the slide name is
179 : a standard name (see above)
180 : */
181 : bool IsNewPageNameValid( String & rInOutPageName, bool bResetStringIfStandardName = false );
182 :
183 :
184 : /** Return the reference device for the current document. When the
185 : inherited implementation returns a device then this is passed to the
186 : caller. Otherwise the returned value depends on the printer
187 : independent layout mode and will usually be either a printer or a
188 : virtual device used for screen rendering.
189 : @return
190 : Returns NULL when the current document has no reference device.
191 : */
192 : virtual OutputDevice* GetDocumentRefDev (void);
193 :
194 : DECL_LINK( RenameSlideHdl, AbstractSvxNameDialog* );
195 :
196 : // ExecuteSpellPopup now handled by DrawDocShell
197 : DECL_LINK( OnlineSpellCallback, SpellCallbackInfo* );
198 :
199 : void ClearUndoBuffer();
200 :
201 : protected:
202 :
203 : SdDrawDocument* mpDoc;
204 : SfxUndoManager* mpUndoManager;
205 : SfxPrinter* mpPrinter;
206 : ::sd::ViewShell* mpViewShell;
207 : FontList* mpFontList;
208 : ::sd::FunctionReference mxDocShellFunction;
209 : DocumentType meDocType;
210 : sal_uInt16 mnStyleFamily;
211 : const sal_uInt16* mpFilterSIDs;
212 : sal_uInt16 mnFilterCount;
213 : sal_Bool mbFilterEnable;
214 : sal_Bool mbSdDataObj;
215 : sal_Bool mbInDestruction;
216 : sal_Bool mbOwnPrinter;
217 : sal_Bool mbNewDocument;
218 :
219 : bool mbOwnDocument; // if true, we own mpDoc and will delete it in our d'tor
220 : void Construct(bool bClipboard);
221 : virtual void InPlaceActivate( sal_Bool bActive );
222 : };
223 :
224 : #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
225 : #define SV_DECL_DRAW_DOC_SHELL_DEFINED
226 0 : SV_DECL_REF(DrawDocShell)
227 : #endif
228 :
229 402 : SV_IMPL_REF (DrawDocShell)
230 :
231 : } // end of namespace sd
232 :
233 : #endif
234 :
235 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|