1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drawdoc.hxx,v $
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 ************************************************************************/
34 #ifndef _COM_SUN_STAR_FRAME_XMODEL_HDL_
35 #include <com/sun/star/frame/XModel.hdl>
38 #include <vcl/print.hxx>
40 #ifndef _FM_FMMODEL_HXX
41 #include <bf_svx/fmmodel.hxx>
43 #ifndef _PRESENTATION_HXX
44 #include <bf_sd/pres.hxx>
46 #ifndef _SVX_PAGEITEM_HXX //autogen
47 #include <bf_svx/pageitem.hxx>
49 #ifndef _UNOTOOLS_CHARCLASS_HXX
50 #include <unotools/charclass.hxx>
53 #include <bf_so3/svstor.hxx>
56 #include <rsc/rscsfx.hxx>
58 #ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
59 #include <com/sun/star/lang/Locale.hpp>
61 #ifndef _COM_SUN_STAR_TEXT_WRITINGMODE_HPP_
62 #include <com/sun/star/text/WritingMode.hpp>
67 #include <bf_svx/svdundo.hxx>
80 class SdAnimationInfo
;
83 class SdStyleSheetPool
;
87 struct SpellCallbackInfo
;
88 struct StyleRequestData
;
90 #ifndef SV_DECL_SDDRAWDOCSHELL_DEFINED
91 #define SV_DECL_SDDRAWDOCSHELL_DEFINED
92 SV_DECL_REF(SdDrawDocShell
)
95 struct StyleReplaceData
97 SfxStyleFamily nFamily
;
98 SfxStyleFamily nNewFamily
;
109 //////////////////////////////////////////////////////////////////////////////
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
122 SdrUndoUserCallObj(SdrObject
& rNewObj
, SdPage
* pNew
);
128 //////////////////////////////////////////////////////////////////////////////
130 // ------------------
131 // - SdDrawDocument -
132 // ------------------
134 class SdDrawDocument
: public FmFormModel
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
;
152 BOOL bNewOrLoadCompleted
;
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
;
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();
191 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> createUnoModel();
195 class InsertBookmarkAsPage_PageFunctorBase
;
199 SdDrawDocument(DocumentType eType
, SfxObjectShell
* pDocSh
);
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.
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.
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;
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.
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.
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.
372 This page is used to retrieve the layout for the page to
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>.
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>.
394 This flag indicates whether to show the background shape.
396 This flag indicates whether to show the shapes on the master page.
399 Returns an index of the inserted pages that can be used with the
400 <member>GetSdPage()</member> method.
403 SdPage
* pCurrentPage
,
405 const String
& sStandardPageName
,
406 const String
& sNotesPageName
,
407 AutoLayout eStandardLayout
,
408 AutoLayout eNotesLayout
,
412 /** This method acts as a simplified front end for the more complex
413 <member>DuplicatePage()</member> method.
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
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
429 This page and its associated notes/standard page is copied.
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>.
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>.
450 This flag indicates whether to show the background shape.
452 This flag indicates whether to show the shapes on the master page.
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
,
461 const String
& sStandardPageName
,
462 const String
& sNotesPageName
,
463 AutoLayout eStandardLayout
,
464 AutoLayout eNotesLayout
,
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
);
473 /** This member stores the printer independent layout mode. Please
474 refer to <member>SetPrinterIndependentLayout()</member> for its
477 sal_Int32 mnPrinterIndependentLayout
;
479 /** Insert a given set of standard and notes page after the given <argument>pCurrentPage</argument>.
481 This page and its associated notes/standard page is copied.
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>.
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>.
502 This flag indicates whether to show the background shape.
504 This flag indicates whether to show the shapes on the master page.
506 The standard page to insert.
508 The notes page to insert.
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
,
517 const String
& sStandardPageName
,
518 const String
& sNotesPageName
,
519 AutoLayout eStandardLayout
,
520 AutoLayout eNotesLayout
,
524 SdPage
* pStandardPage
,
527 /** Set up a newly created page and insert it into the list of pages.
529 A page to take the size and border geometry from.
531 This is the page to set up and insert.
533 The name of the new page.
534 @param nInsertionPoint
535 Index of the page before which the new page will be inserted.
537 This flag indicates whether to show the background shape.
539 This flag indicates whether to show the shapes on the master
543 SdPage
* pPreviousPage
,
545 const String
& sPageName
,
546 USHORT nInsertionPoint
,
551 } //namespace binfilter
552 #endif // _DRAWDOC_HXX