Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_sd / drawdoc.hxx
blobab82fe8c77f028083e4c54fbcf76a5698e8c8cc7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drawdoc.hxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DRAWDOC_HXX
32 #define _DRAWDOC_HXX
34 #ifndef _COM_SUN_STAR_FRAME_XMODEL_HDL_
35 #include <com/sun/star/frame/XModel.hdl>
36 #endif
37 #ifndef _SV_PRINT_HXX
38 #include <vcl/print.hxx>
39 #endif
40 #ifndef _FM_FMMODEL_HXX
41 #include <bf_svx/fmmodel.hxx>
42 #endif
43 #ifndef _PRESENTATION_HXX
44 #include <bf_sd/pres.hxx>
45 #endif
46 #ifndef _SVX_PAGEITEM_HXX //autogen
47 #include <bf_svx/pageitem.hxx>
48 #endif
49 #ifndef _UNOTOOLS_CHARCLASS_HXX
50 #include <unotools/charclass.hxx>
51 #endif
53 #include <bf_so3/svstor.hxx>
55 #ifndef _RSCSFX_HXX
56 #include <rsc/rscsfx.hxx>
57 #endif
58 #ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
59 #include <com/sun/star/lang/Locale.hpp>
60 #endif
61 #ifndef _COM_SUN_STAR_TEXT_WRITINGMODE_HPP_
62 #include <com/sun/star/text/WritingMode.hpp>
63 #endif
65 // #107844#
66 #ifndef _SVDUNDO_HXX
67 #include <bf_svx/svdundo.hxx>
68 #endif
69 class Timer;
70 class Graphic;
71 class Point;
72 class Window;
73 namespace binfilter {
75 class SfxObjectShell;
76 class SdPage;
77 class FrameView;
78 class SdDrawDocShell;
79 class SdOutliner;
80 class SdAnimationInfo;
81 class SdIMapInfo;
82 class IMapObject;
83 class SdStyleSheetPool;
84 class SfxMedium;
85 class SdrOle2Obj;
86 class EditStatus;
87 struct SpellCallbackInfo;
88 struct StyleRequestData;
90 #ifndef SV_DECL_SDDRAWDOCSHELL_DEFINED
91 #define SV_DECL_SDDRAWDOCSHELL_DEFINED
92 SV_DECL_REF(SdDrawDocShell)
93 #endif
95 struct StyleReplaceData
97 SfxStyleFamily nFamily;
98 SfxStyleFamily nNewFamily;
99 String aName;
100 String aNewName;
103 enum DocCreationMode
105 NEW_DOC,
106 DOC_LOADED
109 //////////////////////////////////////////////////////////////////////////////
110 // #107844#
111 // An undo class which is able to set/unset user calls is needed to handle
112 // the undo/redo of PresObjs correctly. It can also add/remove the object
113 // from the PresObjList of that page.
115 class SdrUndoUserCallObj : public SdrUndoObj
117 protected:
118 SdPage* mpOld;
119 SdPage* mpNew;
121 public:
122 SdrUndoUserCallObj(SdrObject& rNewObj, SdPage* pNew);
124 virtual void Undo();
125 virtual void Redo();
128 //////////////////////////////////////////////////////////////////////////////
130 // ------------------
131 // - SdDrawDocument -
132 // ------------------
134 class SdDrawDocument : public FmFormModel
136 private:
138 SdOutliner* pOutliner; // local outliner for outline mode
139 SdOutliner* pInternalOutliner; // internal outliner for creation of text objects
140 Timer* pWorkStartupTimer;
141 Timer* pOnlineSpellingTimer;
142 List* pOnlineSpellingList;
143 List* pDeletedPresObjList;
144 List* pFrameViewList;
145 List* pCustomShowList;
146 SdDrawDocShell* pDocSh;
147 BOOL bHasOnlineSpellErrors;
148 BOOL bInitialOnlineSpellingEnabled;
149 String aBookmarkFile;
150 SdDrawDocShellRef xBookmarkDocShRef;
151 String aPresPage;
152 BOOL bNewOrLoadCompleted;
153 BOOL bPresAll;
154 BOOL bPresEndless;
155 BOOL bPresManual;
156 BOOL bPresMouseVisible;
157 BOOL bPresMouseAsPen;
158 BOOL bStartPresWithNavigator;
159 BOOL bAnimationAllowed;
160 BOOL bPresLockedPages;
161 BOOL bPresAlwaysOnTop;
162 BOOL bPresFullScreen;
163 sal_uInt32 nPresPause;
164 BOOL bPresShowLogo;
165 BOOL bOnlineSpell;
166 BOOL bHideSpell;
167 BOOL bCustomShow;
168 BOOL bSummationOfParagraphs;
169 bool mbStartWithPresentation; // is set to true when starting with command line parameter -start
171 sal_uInt32 nPresFirstPage;
172 LanguageType eLanguage;
173 LanguageType eLanguageCJK;
174 LanguageType eLanguageCTL;
175 SvxNumType ePageNumType;
176 SdDrawDocShellRef xAllocedDocShRef; // => AllocModel()
177 BOOL bAllocDocSh; // => AllocModel()
178 DocumentType eDocType;
179 UINT16 nFileFormatVersion;
180 SotStorage* pDocStor;
181 SotStorageRef xPictureStorage;
182 SotStorageStreamRef xDocStream;
183 CharClass* mpCharClass;
184 ::com::sun::star::lang::Locale* mpLocale;
186 void UpdatePageObjectsInNotes(USHORT nStartPos);
188 void WorkStartupHdl();
189 protected:
191 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel();
193 public:
195 class InsertBookmarkAsPage_PageFunctorBase;
197 TYPEINFO();
199 SdDrawDocument(DocumentType eType, SfxObjectShell* pDocSh);
200 ~SdDrawDocument();
202 virtual SdrPage* AllocPage(FASTBOOL bMasterPage);
203 virtual void DisposeLoadedModels();
204 virtual void SetChanged(FASTBOOL bFlag = TRUE);
205 virtual SvStream* GetDocumentStream(SdrDocumentStreamInfo& rStreamInfo) const;
206 virtual void HandsOff();
208 SfxItemPool& GetPool() { return( *pItemPool ); }
210 SdOutliner* GetOutliner(BOOL bCreateOutliner=TRUE);
211 SdOutliner* GetInternalOutliner(BOOL bCreateOutliner=TRUE);
213 SdDrawDocShell* GetDocSh() const { return(pDocSh) ; }
215 LanguageType GetLanguage( const USHORT nId ) const;
216 void SetLanguage( const LanguageType eLang, const USHORT nId );
218 SvxNumType GetPageNumType() const;
219 void SetPageNumType(SvxNumType eType) { ePageNumType = eType; }
220 String CreatePageNumValue(USHORT nNum) const;
222 DocumentType GetDocumentType() const { return eDocType; }
224 void SetAllocDocSh(BOOL bAlloc);
226 void CreateFirstPages();
228 void InsertPage(SdrPage* pPage, USHORT nPos=0xFFFF);
229 void DeletePage(USHORT nPgNum);
230 SdrPage* RemovePage(USHORT nPgNum);
231 void RemoveDuplicateMasterPages();
233 void CloseBookmarkDoc();
236 SdPage* GetSdPage(USHORT nPgNum, PageKind ePgKind) const;
237 USHORT GetSdPageCount(PageKind ePgKind) const;
239 SdPage* GetMasterSdPage(USHORT nPgNum, PageKind ePgKind);
240 USHORT GetMasterSdPageCount(PageKind ePgKind) const;
242 USHORT GetMasterPageUserCount(SdrPage* pMaster) const;
244 void SetPresPage( const String& rPresPage ) { aPresPage = rPresPage; }
245 const String& GetPresPage() const { return aPresPage; }
247 void SetPresAll(BOOL bNewPresAll);
248 BOOL GetPresAll() const { return bPresAll; }
250 void SetPresEndless(BOOL bNewPresEndless);
251 BOOL GetPresEndless() const { return bPresEndless; }
253 void SetPresManual(BOOL bNewPresManual);
254 BOOL GetPresManual() const { return bPresManual; }
256 void SetPresMouseVisible(BOOL bNewPresMouseVisible);
257 BOOL GetPresMouseVisible() const { return bPresMouseVisible; }
259 void SetPresMouseAsPen(BOOL bNewPresMouseAsPen);
260 BOOL GetPresMouseAsPen() const { return bPresMouseAsPen; }
262 ULONG GetPresFirstPage() const { return nPresFirstPage; }
264 void SetStartPresWithNavigator (BOOL bStart);
265 BOOL GetStartPresWithNavigator() const { return bStartPresWithNavigator; }
267 void SetAnimationAllowed (BOOL bAllowed) { bAnimationAllowed = bAllowed; }
268 BOOL IsAnimationAllowed() const { return bAnimationAllowed; }
270 void SetPresPause( sal_uInt32 nSecondsToWait ) { nPresPause = nSecondsToWait; }
271 sal_uInt32 GetPresPause() const { return nPresPause; }
273 void SetPresShowLogo( BOOL bShowLogo ) { bPresShowLogo = bShowLogo; }
274 BOOL IsPresShowLogo() const { return bPresShowLogo; }
276 void SetPresLockedPages (BOOL bLock);
277 BOOL GetPresLockedPages() const { return bPresLockedPages; }
279 void SetPresAlwaysOnTop (BOOL bOnTop);
280 BOOL GetPresAlwaysOnTop() const { return bPresAlwaysOnTop; }
282 void SetPresFullScreen (BOOL bNewFullScreen);
283 BOOL GetPresFullScreen() const { return bPresFullScreen; }
285 void SetSummationOfParagraphs( BOOL bOn = TRUE ) { bSummationOfParagraphs = bOn; }
286 const BOOL IsSummationOfParagraphs() const { return bSummationOfParagraphs; }
288 /** Set the mode that controls whether (and later how) the formatting of the document
289 depends on the current printer metrics.
290 @param nMode
291 Use <const
292 scope="com::sun::star::document::PrinterIndependentLayout">ENABLED</const>
293 to make formatting printer-independent and <const
294 scope="com::sun::star::document::PrinterIndependentLayout">DISABLED</const>
295 to make formatting depend on the current printer metrics.
297 void SetPrinterIndependentLayout (sal_Int32 nMode);
299 /** Get the flag that controls whether the formatting of the document
300 depends on the current printer metrics.
301 @return
302 Use <const
303 scope="com::sun::star::document::PrinterIndependentLayout">ENABLED</const>
304 when formatting is printer-independent and <const
305 scope="com::sun::star::document::PrinterIndependentLayout">DISABLED</const>
306 when formatting depends on the current printer metrics.
308 sal_Int32 GetPrinterIndependentLayout (void);
310 void SetOnlineSpell( BOOL bIn );
311 BOOL GetOnlineSpell() const { return bOnlineSpell; }
313 BOOL GetHideSpell() const { return bHideSpell; }
316 List* GetFrameViewList() const { return pFrameViewList; }
317 List* GetCustomShowList(BOOL bCreate = FALSE);
319 void SetCustomShow(BOOL bCustShow) { bCustomShow = bCustShow; }
320 BOOL IsCustomShow() const { return bCustomShow; }
322 void NbcSetChanged(FASTBOOL bFlag = TRUE);
324 void SetTextDefaults() const;
326 void CreateLayoutTemplates();
327 void RenameLayoutTemplate(const String& rOldLayoutName, const String& rNewName);
329 void NewOrLoadCompleted(DocCreationMode eMode);
330 BOOL IsNewOrLoadCompleted() const {return bNewOrLoadCompleted; }
332 SdAnimationInfo* GetAnimationInfo(SdrObject* pObject) const;
334 SdIMapInfo* GetIMapInfo( SdrObject* pObject ) const;
338 CharClass* GetCharClass() const { return mpCharClass; }
340 void RestoreLayerNames();
342 void UpdateAllLinks();
344 void CheckMasterPages();
347 ::com::sun::star::text::WritingMode GetDefaultWritingMode() const;
349 public:
351 static SdDrawDocument* pDocLockedInsertingLinks; // static to prevent recursions while resolving links
353 friend SvStream& operator<<(SvStream& rOut, SdDrawDocument& rDoc);
354 friend SvStream& operator>>(SvStream& rIn, SdDrawDocument& rDoc);
356 /** This method acts as a simplified front end for the more complex
357 <member>CreatePage()</member> method.
358 @param nPageNum
359 The page number as passed to the <member>GetSdPage()</member>
360 method from which to use certain properties for the new pages.
361 These include the auto layout.
362 @return
363 Returns an index of the inserted pages that can be used with the
364 <member>GetSdPage()</member> method.
366 USHORT CreatePage (USHORT nPageNum);
368 /** Create and insert a set of two new pages: a standard (draw) page and
369 the associated notes page. The new pages are inserted direclty
370 after the specified page set.
371 @param pCurrentPage
372 This page is used to retrieve the layout for the page to
373 create.
374 @param ePageKind
375 This specifies whether <argument>pCurrentPage</argument> is a
376 standard (draw) page or a notes page.
377 @param sStandardPageName
378 Name of the standard page. An empty string leads to using an
379 automatically created name.
380 @param sNotesPageName
381 Name of the standard page. An empty string leads to using an
382 automatically created name.
383 @param eStandardLayout
384 Layout to use for the new standard page. Note that this layout
385 is not used when the given <argument>pCurrentPage</argument> is
386 not a standard page. In this case the layout is taken from the
387 standard page associated with <argument>pCurrentPage</argument>.
388 @param eNotesLayout
389 Layout to use for the new notes page. Note that this layout
390 is not used when the given <argument>pCurrentPage</argument> is
391 not a notes page. In this case the layout is taken from the
392 notes page associated with <argument>pCurrentPage</argument>.
393 @param bIsPageBack
394 This flag indicates whether to show the background shape.
395 @param bIsPageObj
396 This flag indicates whether to show the shapes on the master page.
398 @return
399 Returns an index of the inserted pages that can be used with the
400 <member>GetSdPage()</member> method.
402 USHORT CreatePage (
403 SdPage* pCurrentPage,
404 PageKind ePageKind,
405 const String& sStandardPageName,
406 const String& sNotesPageName,
407 AutoLayout eStandardLayout,
408 AutoLayout eNotesLayout,
409 BOOL bIsPageBack,
410 BOOL bIsPageObj);
412 /** This method acts as a simplified front end for the more complex
413 <member>DuplicatePage()</member> method.
414 @param nPageNum
415 The page number as passed to the <member>GetSdPage()</member>
416 method for which the standard page and the notes page are to be
417 copied.
418 @return
419 Returns an index of the inserted pages that can be used with the
420 <member>GetSdPage()</member> method.
422 USHORT DuplicatePage (USHORT nPageNum);
424 /** Create and insert a set of two new pages that are copies of the
425 given <argument>pCurrentPage</argument> and its associated notes
426 resp. standard page. The copies are inserted directly after the
427 specified page set.
428 @param pCurrentPage
429 This page and its associated notes/standard page is copied.
430 @param ePageKind
431 This specifies whether <argument>pCurrentPage</argument> is a
432 standard (draw) page or a notes page.
433 @param sStandardPageName
434 Name of the standard page. An empty string leads to using an
435 automatically created name.
436 @param sNotesPageName
437 Name of the standard page. An empty string leads to using an
438 automatically created name.
439 @param eStandardLayout
440 Layout to use for the new standard page. Note that this layout
441 is not used when the given <argument>pCurrentPage</argument> is
442 not a standard page. In this case the layout is taken from the
443 standard page associated with <argument>pCurrentPage</argument>.
444 @param eNotesLayout
445 Layout to use for the new notes page. Note that this layout
446 is not used when the given <argument>pCurrentPage</argument> is
447 not a notes page. In this case the layout is taken from the
448 notes page associated with <argument>pCurrentPage</argument>.
449 @param bIsPageBack
450 This flag indicates whether to show the background shape.
451 @param bIsPageObj
452 This flag indicates whether to show the shapes on the master page.
454 @return
455 Returns an index of the inserted pages that can be used with the
456 <member>GetSdPage()</member> method.
458 USHORT DuplicatePage (
459 SdPage* pCurrentPage,
460 PageKind ePageKind,
461 const String& sStandardPageName,
462 const String& sNotesPageName,
463 AutoLayout eStandardLayout,
464 AutoLayout eNotesLayout,
465 BOOL bIsPageBack,
466 BOOL bIsPageObj);
468 /** return the document fonts for latin, cjk and ctl according to the current
469 languages set at this document */
470 void getDefaultFonts( Font& rLatinFont, Font& rCJKFont, Font& rCTLFont );
472 private:
473 /** This member stores the printer independent layout mode. Please
474 refer to <member>SetPrinterIndependentLayout()</member> for its
475 values.
477 sal_Int32 mnPrinterIndependentLayout;
479 /** Insert a given set of standard and notes page after the given <argument>pCurrentPage</argument>.
480 @param pCurrentPage
481 This page and its associated notes/standard page is copied.
482 @param ePageKind
483 This specifies whether <argument>pCurrentPage</argument> is a
484 standard (draw) page or a notes page.
485 @param sStandardPageName
486 Name of the standard page. An empty string leads to using an
487 automatically created name.
488 @param sNotesPageName
489 Name of the standard page. An empty string leads to using an
490 automatically created name.
491 @param eStandardLayout
492 Layout to use for the new standard page. Note that this layout
493 is not used when the given <argument>pCurrentPage</argument> is
494 not a standard page. In this case the layout is taken from the
495 standard page associated with <argument>pCurrentPage</argument>.
496 @param eNotesLayout
497 Layout to use for the new notes page. Note that this layout
498 is not used when the given <argument>pCurrentPage</argument> is
499 not a notes page. In this case the layout is taken from the
500 notes page associated with <argument>pCurrentPage</argument>.
501 @param bIsPageBack
502 This flag indicates whether to show the background shape.
503 @param bIsPageObj
504 This flag indicates whether to show the shapes on the master page.
505 @param pStandardPage
506 The standard page to insert.
507 @param pNotesPage
508 The notes page to insert.
510 @return
511 Returns an index of the inserted pages that can be used with the
512 <member>GetSdPage()</member> method.
514 USHORT InsertPageSet (
515 SdPage* pCurrentPage,
516 PageKind ePageKind,
517 const String& sStandardPageName,
518 const String& sNotesPageName,
519 AutoLayout eStandardLayout,
520 AutoLayout eNotesLayout,
521 BOOL bIsPageBack,
522 BOOL bIsPageObj,
524 SdPage* pStandardPage,
525 SdPage* pNotesPage);
527 /** Set up a newly created page and insert it into the list of pages.
528 @param pPreviousPage
529 A page to take the size and border geometry from.
530 @param pPage
531 This is the page to set up and insert.
532 @param sPageName
533 The name of the new page.
534 @param nInsertionPoint
535 Index of the page before which the new page will be inserted.
536 @param bIsPageBack
537 This flag indicates whether to show the background shape.
538 @param bIsPageObj
539 This flag indicates whether to show the shapes on the master
540 page.
542 void SetupNewPage (
543 SdPage* pPreviousPage,
544 SdPage* pPage,
545 const String& sPageName,
546 USHORT nInsertionPoint,
547 BOOL bIsPageBack,
548 BOOL bIsPageObj);
551 } //namespace binfilter
552 #endif // _DRAWDOC_HXX