xref: /trunk/main/sd/source/ui/inc/DrawDocShell.hxx (revision c45d927ae478a6b27be268f8970f881a09d05b3f)
1*c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c45d927aSAndrew Rist  * distributed with this work for additional information
6*c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9*c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15*c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c45d927aSAndrew Rist  * specific language governing permissions and limitations
18*c45d927aSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*c45d927aSAndrew Rist  *************************************************************/
21*c45d927aSAndrew Rist 
22*c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SD_DRAW_DOC_SHELL_HXX
25cdf0e10cSrcweir #define SD_DRAW_DOC_SHELL_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <sfx2/docfac.hxx>
28cdf0e10cSrcweir #include <sfx2/objsh.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <vcl/jobset.hxx>
31cdf0e10cSrcweir #include "glob.hxx"
32cdf0e10cSrcweir #include "sdmod.hxx"
33cdf0e10cSrcweir #include "pres.hxx"
34cdf0e10cSrcweir #include "sddllapi.h"
35cdf0e10cSrcweir #include "fupoor.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class SfxStyleSheetBasePool;
38cdf0e10cSrcweir class SfxStatusBarManager;
39cdf0e10cSrcweir class SdStyleSheetPool;
40cdf0e10cSrcweir class FontList;
41cdf0e10cSrcweir class SdDrawDocument;
42cdf0e10cSrcweir class SvxItemFactory;
43cdf0e10cSrcweir class SdPage;
44cdf0e10cSrcweir class SfxPrinter;
45cdf0e10cSrcweir struct SdrDocumentStreamInfo;
46cdf0e10cSrcweir struct SpellCallbackInfo;
47cdf0e10cSrcweir class AbstractSvxNameDialog;
48cdf0e10cSrcweir class SfxUndoManager;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir namespace sd {
51cdf0e10cSrcweir 
52cdf0e10cSrcweir class FrameView;
53cdf0e10cSrcweir class View;
54cdf0e10cSrcweir class ViewShell;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir // ------------------
57cdf0e10cSrcweir // - DrawDocShell -
58cdf0e10cSrcweir // ------------------
59cdf0e10cSrcweir 
60cdf0e10cSrcweir class SD_DLLPUBLIC DrawDocShell : public SfxObjectShell
61cdf0e10cSrcweir {
62cdf0e10cSrcweir public:
63cdf0e10cSrcweir     TYPEINFO();
64cdf0e10cSrcweir     SFX_DECL_INTERFACE(SD_IF_SDDRAWDOCSHELL)
65cdf0e10cSrcweir     SFX_DECL_OBJECTFACTORY();
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     DrawDocShell (
68cdf0e10cSrcweir         SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED,
69cdf0e10cSrcweir         sal_Bool bSdDataObj=sal_False,
70cdf0e10cSrcweir         DocumentType=DOCUMENT_TYPE_IMPRESS);
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     DrawDocShell (
73cdf0e10cSrcweir         const sal_uInt64 nModelCreationFlags,
74cdf0e10cSrcweir         sal_Bool bSdDataObj=sal_False,
75cdf0e10cSrcweir         DocumentType=DOCUMENT_TYPE_IMPRESS);
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     DrawDocShell (
78cdf0e10cSrcweir         SdDrawDocument* pDoc,
79cdf0e10cSrcweir         SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED,
80cdf0e10cSrcweir         sal_Bool bSdDataObj=sal_False,
81cdf0e10cSrcweir         DocumentType=DOCUMENT_TYPE_IMPRESS);
82cdf0e10cSrcweir     virtual ~DrawDocShell();
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     void                    UpdateRefDevice();
85cdf0e10cSrcweir     virtual void            Activate( sal_Bool bMDI );
86cdf0e10cSrcweir     virtual void            Deactivate( sal_Bool bMDI );
87cdf0e10cSrcweir     virtual sal_Bool            InitNew( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
88cdf0e10cSrcweir     virtual sal_Bool            ConvertFrom( SfxMedium &rMedium );
89cdf0e10cSrcweir     virtual sal_Bool            Save();
90cdf0e10cSrcweir     virtual sal_Bool            SaveAsOwnFormat( SfxMedium& rMedium );
91cdf0e10cSrcweir     virtual sal_Bool            ConvertTo( SfxMedium &rMedium );
92cdf0e10cSrcweir     virtual sal_Bool            SaveCompleted( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     virtual sal_Bool        Load( SfxMedium &rMedium  );
95cdf0e10cSrcweir     virtual sal_Bool        LoadFrom( SfxMedium& rMedium );
96cdf0e10cSrcweir     virtual sal_Bool        SaveAs( SfxMedium &rMedium  );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     virtual Rectangle       GetVisArea(sal_uInt16 nAspect) const;
99cdf0e10cSrcweir     virtual void            Draw(OutputDevice*, const JobSetup& rSetup, sal_uInt16 nAspect = ASPECT_CONTENT);
100cdf0e10cSrcweir     virtual ::svl::IUndoManager*
101cdf0e10cSrcweir                             GetUndoManager();
102cdf0e10cSrcweir     virtual Printer*        GetDocumentPrinter();
103cdf0e10cSrcweir     virtual void            OnDocumentPrinterChanged(Printer* pNewPrinter);
104cdf0e10cSrcweir     virtual SfxStyleSheetBasePool* GetStyleSheetPool();
105cdf0e10cSrcweir     virtual void            SetOrganizerSearchMask(SfxStyleSheetBasePool* pBasePool) const;
106cdf0e10cSrcweir     virtual Size            GetFirstPageSize();
107cdf0e10cSrcweir     virtual void            FillClass(SvGlobalName* pClassName, sal_uInt32*  pFormat, String* pAppName, String* pFullTypeName, String* pShortTypeName, sal_Int32 nFileFormat, sal_Bool bTemplate = sal_False ) const;
108cdf0e10cSrcweir     virtual void            SetModified( sal_Bool = sal_True );
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     using SotObject::GetInterface;
111cdf0e10cSrcweir     using SfxObjectShell::GetVisArea;
112cdf0e10cSrcweir     using SfxShell::GetViewShell;
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     sd::ViewShell* GetViewShell() { return mpViewShell; }
115cdf0e10cSrcweir     ::sd::FrameView* GetFrameView();
116cdf0e10cSrcweir     ::sd::FunctionReference GetDocShellFunction() const { return mxDocShellFunction; }
117cdf0e10cSrcweir     void SetDocShellFunction( const ::sd::FunctionReference& xFunction );
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     SdDrawDocument*         GetDoc();
120cdf0e10cSrcweir     DocumentType            GetDocumentType() const { return meDocType; }
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     SfxPrinter*             GetPrinter(sal_Bool bCreate);
123cdf0e10cSrcweir     void                    SetPrinter(SfxPrinter *pNewPrinter);
124cdf0e10cSrcweir     void                    UpdateFontList();
125cdf0e10cSrcweir 
126cdf0e10cSrcweir     sal_Bool                    IsInDestruction() const { return mbInDestruction; }
127cdf0e10cSrcweir 
128cdf0e10cSrcweir     void                    CancelSearching();
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     void                    Execute( SfxRequest& rReq );
131cdf0e10cSrcweir     void                    GetState(SfxItemSet&);
132cdf0e10cSrcweir 
133cdf0e10cSrcweir     void                    Connect(sd::ViewShell* pViewSh);
134cdf0e10cSrcweir     void                    Disconnect(sd::ViewShell* pViewSh);
135cdf0e10cSrcweir     void                    UpdateTablePointers();
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     sal_Bool                    GotoBookmark(const String& rBookmark);
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     Bitmap                  GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixel);
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     /** checks, if the given name is a valid new name for a slide
142cdf0e10cSrcweir 
143cdf0e10cSrcweir         <p>If the name is invalid, an <type>SvxNameDialog</type> pops up that
144cdf0e10cSrcweir         queries again for a new name until it is ok or the user chose
145cdf0e10cSrcweir         Cancel.</p>
146cdf0e10cSrcweir 
147cdf0e10cSrcweir         @param pWin is necessary to pass to the <type>SvxNameDialog</type> in
148cdf0e10cSrcweir                     case an invalid name was entered.
149cdf0e10cSrcweir         @param rName the new name that is to be set for a slide.  This string
150cdf0e10cSrcweir                      may be set to an empty string (see below).
151cdf0e10cSrcweir 
152cdf0e10cSrcweir         @return sal_True, if the new name is unique.  Note that if the user entered
153cdf0e10cSrcweir                 a default name of a not-yet-existing slide (e.g. 'Slide 17'),
154cdf0e10cSrcweir                 sal_True is returned, but rName is set to an empty string.
155cdf0e10cSrcweir      */
156cdf0e10cSrcweir     sal_Bool                    CheckPageName(::Window* pWin, String& rName );
157cdf0e10cSrcweir 
158cdf0e10cSrcweir     void                    SetSlotFilter(sal_Bool bEnable = sal_False, sal_uInt16 nCount = 0, const sal_uInt16* pSIDs = NULL) { mbFilterEnable = bEnable; mnFilterCount = nCount; mpFilterSIDs = pSIDs; }
159cdf0e10cSrcweir     void                    ApplySlotFilter() const;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir     sal_uInt16                  GetStyleFamily() const { return mnStyleFamily; }
162cdf0e10cSrcweir     void                    SetStyleFamily( sal_uInt16 nSF ) { mnStyleFamily = nSF; }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     /** executes the SID_OPENDOC slot to let the framework open a document
165cdf0e10cSrcweir         with the given URL and this document as a referer */
166cdf0e10cSrcweir     void                    OpenBookmark( const String& rBookmarkURL );
167cdf0e10cSrcweir 
168cdf0e10cSrcweir     /** checks, if the given name is a valid new name for a slide
169cdf0e10cSrcweir 
170cdf0e10cSrcweir         <p>This method does not pop up any dialog (like CheckPageName).</p>
171cdf0e10cSrcweir 
172cdf0e10cSrcweir         @param rInOutPageName the new name for a slide that is to be renamed.
173cdf0e10cSrcweir                     This string will be set to an empty string if
174cdf0e10cSrcweir                     bResetStringIfStandardName is true and the name is of the
175cdf0e10cSrcweir                     form of any, possibly not-yet existing, standard slide
176cdf0e10cSrcweir                     (e.g. 'Slide 17')
177cdf0e10cSrcweir 
178cdf0e10cSrcweir         @param bResetStringIfStandardName if true allows setting rInOutPageName
179cdf0e10cSrcweir                     to an empty string, which returns true and implies that the
180cdf0e10cSrcweir                     slide will later on get a new standard name (with a free
181cdf0e10cSrcweir                     slide number).
182cdf0e10cSrcweir 
183cdf0e10cSrcweir         @return true, if the new name is unique.  If bResetStringIfStandardName
184cdf0e10cSrcweir                     is true, the return value is also true, if the slide name is
185cdf0e10cSrcweir                     a standard name (see above)
186cdf0e10cSrcweir      */
187cdf0e10cSrcweir     bool                    IsNewPageNameValid( String & rInOutPageName, bool bResetStringIfStandardName = false );
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 
190cdf0e10cSrcweir     /** Return the reference device for the current document.  When the
191cdf0e10cSrcweir         inherited implementation returns a device then this is passed to the
192cdf0e10cSrcweir         caller.  Otherwise the returned value depends on the printer
193cdf0e10cSrcweir         independent layout mode and will usually be either a printer or a
194cdf0e10cSrcweir         virtual device used for screen rendering.
195cdf0e10cSrcweir         @return
196cdf0e10cSrcweir             Returns NULL when the current document has no reference device.
197cdf0e10cSrcweir     */
198cdf0e10cSrcweir     virtual OutputDevice* GetDocumentRefDev (void);
199cdf0e10cSrcweir 
200cdf0e10cSrcweir     DECL_LINK( RenameSlideHdl, AbstractSvxNameDialog* );
201cdf0e10cSrcweir 
202cdf0e10cSrcweir                             // #91457# ExecuteSpellPopup now handled by DrawDocShell
203cdf0e10cSrcweir                             DECL_LINK( OnlineSpellCallback, SpellCallbackInfo* );
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     void                    ClearUndoBuffer();
206cdf0e10cSrcweir 
207cdf0e10cSrcweir protected:
208cdf0e10cSrcweir 
209cdf0e10cSrcweir     SdDrawDocument*         mpDoc;
210cdf0e10cSrcweir     SfxUndoManager*         mpUndoManager;
211cdf0e10cSrcweir     SfxPrinter*             mpPrinter;
212cdf0e10cSrcweir     ::sd::ViewShell*        mpViewShell;
213cdf0e10cSrcweir     FontList*               mpFontList;
214cdf0e10cSrcweir     ::sd::FunctionReference mxDocShellFunction;
215cdf0e10cSrcweir     DocumentType            meDocType;
216cdf0e10cSrcweir     sal_uInt16                  mnStyleFamily;
217cdf0e10cSrcweir     const sal_uInt16*           mpFilterSIDs;
218cdf0e10cSrcweir     sal_uInt16                  mnFilterCount;
219cdf0e10cSrcweir     sal_Bool                    mbFilterEnable;
220cdf0e10cSrcweir     sal_Bool                    mbSdDataObj;
221cdf0e10cSrcweir     sal_Bool                    mbInDestruction;
222cdf0e10cSrcweir     sal_Bool                    mbOwnPrinter;
223cdf0e10cSrcweir     sal_Bool                    mbNewDocument;
224cdf0e10cSrcweir 
225cdf0e10cSrcweir     bool                    mbOwnDocument;          // if true, we own mpDoc and will delete it in our d'tor
226cdf0e10cSrcweir     void                    Construct(bool bClipboard);
227cdf0e10cSrcweir     virtual void            InPlaceActivate( sal_Bool bActive );
228cdf0e10cSrcweir };
229cdf0e10cSrcweir 
230cdf0e10cSrcweir #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
231cdf0e10cSrcweir #define SV_DECL_DRAW_DOC_SHELL_DEFINED
232cdf0e10cSrcweir SV_DECL_REF(DrawDocShell)
233cdf0e10cSrcweir #endif
234cdf0e10cSrcweir 
235cdf0e10cSrcweir SV_IMPL_REF (DrawDocShell)
236cdf0e10cSrcweir 
237cdf0e10cSrcweir } // end of namespace sd
238cdf0e10cSrcweir 
239cdf0e10cSrcweir #endif
240