2000-09-18 23:16:46 +00:00
/*************************************************************************
*
2005-09-09 02:10:52 +00:00
* OpenOffice . org - a multi - platform office productivity suite
2000-09-18 23:16:46 +00:00
*
2005-09-09 02:10:52 +00:00
* $ RCSfile : drawdoc . cxx , v $
2000-09-18 23:16:46 +00:00
*
2005-12-14 15:51:37 +00:00
* $ Revision : 1.75 $
2000-09-18 23:16:46 +00:00
*
2005-12-14 15:51:37 +00:00
* last change : $ Author : rt $ $ Date : 2005 - 12 - 14 16 : 51 : 37 $
2000-09-18 23:16:46 +00:00
*
2005-09-09 02:10:52 +00:00
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1 .
2000-09-18 23:16:46 +00:00
*
*
2005-09-09 02:10:52 +00:00
* GNU Lesser General Public License Version 2.1
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* Copyright 2005 by Sun Microsystems , Inc .
* 901 San Antonio Road , Palo Alto , CA 94303 , USA
2000-09-18 23:16:46 +00:00
*
2005-09-09 02:10:52 +00:00
* This library is free software ; you can redistribute it and / or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1 , as published by the Free Software Foundation .
2000-09-18 23:16:46 +00:00
*
2005-09-09 02:10:52 +00:00
* This library is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* Lesser General Public License for more details .
2000-09-18 23:16:46 +00:00
*
2005-09-09 02:10:52 +00:00
* You should have received a copy of the GNU Lesser General Public
* License along with this library ; if not , write to the Free Software
* Foundation , Inc . , 59 Temple Place , Suite 330 , Boston ,
* MA 02111 - 1307 USA
2000-09-18 23:16:46 +00:00
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# define ITEMID_SEARCH SID_SEARCH_ITEM
2004-01-20 09:25:48 +00:00
# include "PageListWatcher.hxx"
2003-03-27 09:58:12 +00:00
# ifndef _COM_SUN_STAR_TEXT_WRITINGMODE_HPP_
# include <com/sun/star/text/WritingMode.hpp>
# endif
2003-04-24 13:35:54 +00:00
# ifndef _COM_SUN_STAR_DOCUMENT_PRINTERINDEPENDENTLAYOUT_HPP_
# include <com/sun/star/document/PrinterIndependentLayout.hpp>
# endif
2003-03-27 09:58:12 +00:00
2001-04-06 13:17:19 +00:00
# ifndef _FORBIDDENCHARACTERSTABLE_HXX
# include <svx/forbiddencharacterstable.hxx>
# endif
2000-09-18 23:16:46 +00:00
# include <svx/svxids.hrc>
# include <svx/srchitem.hxx>
2003-12-01 09:07:08 +00:00
# include <svx/eeitem.hxx>
# define ITEMID_SCRIPTSPACE EE_PARA_ASIANCJKSPACING
# include <svx/scriptspaceitem.hxx>
2000-09-18 23:16:46 +00:00
# ifndef _OFA_MISCCFG_HXX
2004-02-03 19:10:21 +00:00
# include <svtools/misccfg.hxx>
2000-09-18 23:16:46 +00:00
# endif
# ifndef _SFX_PRINTER_HXX //autogen
# include <sfx2/printer.hxx>
# endif
# ifndef _SFX_TOPFRM_HXX //autogen wg. SfxTopViewFrame
# include <sfx2/topfrm.hxx>
# endif
# include <sfx2/app.hxx>
# include <svx/linkmgr.hxx>
# include <svx/dialogs.hrc>
2004-01-20 09:25:48 +00:00
# ifndef SD_OUTLINER_HXX
# include "Outliner.hxx"
# endif
2000-09-18 23:16:46 +00:00
# include "app.hxx"
# ifndef _EEITEM_HXX //autogen
# include <svx/eeitem.hxx>
# endif
# ifndef _EEITEMID_HXX //autogen
# include <svx/eeitemid.hxx>
# endif
# ifndef _EDITSTAT_HXX //autogen
# include <svx/editstat.hxx>
# endif
# ifndef _SVX_FONTITEM_HXX //autogen
# include <svx/fontitem.hxx>
# endif
# ifndef _SFXFLAGITEM_HXX //autogen
# include <svtools/flagitem.hxx>
# endif
# ifndef _SVDOATTR_HXX //autogen
# include <svx/svdoattr.hxx>
# endif
# ifndef _SVDOTEXT_HXX //autogen
# include <svx/svdotext.hxx>
# endif
# ifndef _SVX_BULITEM_HXX //autogen
# include <svx/bulitem.hxx>
# endif
# ifndef _SVX_NUMITEM_HXX //autogen
# include <svx/numitem.hxx>
# endif
# ifndef _SVDITER_HXX //autogen
# include <svx/svditer.hxx>
# endif
# ifndef _UNO_LINGU_HXX
# include <svx/unolingu.hxx>
# endif
2002-02-20 10:05:16 +00:00
# ifndef _SFXITEMPOOL_HXX //autogen wg. SfxItemPool
# include <svtools/itempool.hxx>
# endif
2000-10-25 09:34:04 +00:00
# ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
# include <com/sun/star/lang/XMultiServiceFactory.hpp>
# endif
2000-09-18 23:16:46 +00:00
# include <svx/xtable.hxx>
2000-10-25 09:34:04 +00:00
# ifndef _COM_SUN_STAR_LINGUISTIC2_XHYPHENATOR_HPP_
# include <com/sun/star/linguistic2/XHyphenator.hpp>
# endif
# ifndef _COM_SUN_STAR_LINGUISTIC2_XSPELLCHECKER1_HPP_
# include <com/sun/star/linguistic2/XSpellChecker1.hpp>
2000-09-18 23:16:46 +00:00
# endif
# ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
# include <com/sun/star/beans/XPropertySet.hpp>
# endif
# ifndef _OUTLOBJ_HXX
# include <svx/outlobj.hxx>
# endif
2000-10-12 07:40:47 +00:00
# ifndef INCLUDED_SVTOOLS_SAVEOPT_HXX
# include <svtools/saveopt.hxx>
# endif
2001-03-19 08:53:25 +00:00
# include <comphelper/extract.hxx>
2000-09-18 23:16:46 +00:00
# ifndef _ISOLANG_HXX
# include <tools/isolang.hxx>
# endif
# include <unotools/charclass.hxx>
2000-11-17 09:56:37 +00:00
# ifndef _COMPHELPER_PROCESSFACTORY_HXX_
# include <comphelper/processfactory.hxx>
# endif
2002-02-20 10:05:16 +00:00
# ifndef _SVTOOLS_PATHOPTIONS_HXX_
2000-11-15 09:44:50 +00:00
# include <svtools/pathoptions.hxx>
2002-02-20 10:05:16 +00:00
# endif
# ifndef _SVTOOLS_LINGUCFG_HXX_
# include <svtools/lingucfg.hxx>
# endif
# ifndef _SVTOOLS_LINGUPROPS_HXX_
# include <svtools/linguprops.hxx>
# endif
2000-10-25 09:34:04 +00:00
2002-02-20 10:05:16 +00:00
# include "eetext.hxx"
2000-09-18 23:16:46 +00:00
# include "drawdoc.hxx"
# include "sdpage.hxx"
# include "pglink.hxx"
# include "sdattr.hxx"
# include "glob.hrc"
# include "glob.hxx"
# include "stlpool.hxx"
# include "sdiocmpt.hxx"
# include "sdresid.hxx"
# include "cusshow.hxx"
# ifndef MAC
2004-01-20 09:25:48 +00:00
# ifndef SD_DRAW_DOC_SHELL_HXX
# include "../ui/inc/DrawDocShell.hxx"
# endif
# ifndef SD_GRAPHIC_DOC_SHELL_HXX
# include "../ui/inc/GraphicDocShell.hxx"
# endif
2001-01-19 18:15:28 +00:00
# include "../ui/inc/sdxfer.hxx"
2004-01-20 09:25:48 +00:00
# ifndef SD_VIEW_SHELL_HXX
# include "../ui/inc/ViewShell.hxx"
# endif
2000-10-09 08:26:51 +00:00
# include "../ui/inc/optsitem.hxx"
2004-01-20 09:25:48 +00:00
# ifndef SD_FRAME_VIEW_HXX
# include "../ui/inc/FrameView.hxx"
# endif
2000-09-18 23:16:46 +00:00
# else
2004-01-20 09:25:48 +00:00
# ifndef SD_DRAW_DOC_SHELL_HXX
# include "DrawDocShell.hxx"
# endif
# ifndef SD_GRAPHIC_DOC_SHELL_HXX
# include "GraphicDocShell.hxx"
# endif
2001-01-19 18:15:28 +00:00
# include "sdxfer.hxx"
2004-01-20 09:25:48 +00:00
# ifndef SD_VIEW_SHELL_HXX
# include "ViewShell.hxx"
# endif
2000-10-09 08:26:51 +00:00
# include "optsitem.hxx"
2004-01-20 09:25:48 +00:00
# ifndef SD_FRAME_VIEW_HXX
# include "FrameView.hxx"
# endif
2000-09-18 23:16:46 +00:00
# endif
2001-08-06 07:34:08 +00:00
// #90477#
# ifndef _TOOLS_TENCCVT_HXX
# include <tools/tenccvt.hxx>
# endif
2005-12-14 15:51:37 +00:00
using : : rtl : : OUString ;
2004-03-30 14:43:59 +00:00
using namespace : : sd ;
2000-09-18 23:16:46 +00:00
using namespace : : com : : sun : : star ;
2000-10-25 09:34:04 +00:00
using namespace : : com : : sun : : star : : uno ;
using namespace : : com : : sun : : star : : lang ;
using namespace : : com : : sun : : star : : linguistic2 ;
2000-09-18 23:16:46 +00:00
2003-10-27 12:29:26 +00:00
//////////////////////////////////////////////////////////////////////////////
2000-09-18 23:16:46 +00:00
TYPEINIT1 ( SdDrawDocument , FmFormModel ) ;
SdDrawDocument * SdDrawDocument : : pDocLockedInsertingLinks = NULL ;
2004-11-26 18:46:34 +00:00
//////////////////////////////////////////////////////////////////////////////
PresentationSettings : : PresentationSettings ( )
: mbAll ( true ) ,
mbEndless ( false ) ,
mbManual ( false ) ,
mbMouseVisible ( true ) ,
mbMouseAsPen ( false ) ,
mbLockedPages ( false ) ,
mbAlwaysOnTop ( false ) ,
mbFullScreen ( true ) ,
mbAnimationAllowed ( true ) ,
mnPauseTimeout ( 10 ) ,
mbShowPauseLogo ( false ) ,
mbCustomShow ( false ) ,
mbStartWithNavigator ( false )
{
}
// ---------------------------------------------------------------------------
PresentationSettings : : PresentationSettings ( const PresentationSettings & r )
: maPresPage ( r . maPresPage ) ,
mbAll ( r . mbAll ) ,
mbEndless ( r . mbEndless ) ,
mbManual ( r . mbManual ) ,
mbMouseVisible ( r . mbMouseVisible ) ,
mbMouseAsPen ( r . mbMouseAsPen ) ,
mbLockedPages ( r . mbLockedPages ) ,
mbAlwaysOnTop ( r . mbAlwaysOnTop ) ,
mbFullScreen ( r . mbFullScreen ) ,
mbAnimationAllowed ( r . mbAnimationAllowed ) ,
mnPauseTimeout ( r . mnPauseTimeout ) ,
mbShowPauseLogo ( r . mbShowPauseLogo ) ,
mbCustomShow ( r . mbCustomShow ) ,
mbStartWithNavigator ( r . mbStartWithNavigator )
{
}
// ---------------------------------------------------------------------------
2000-09-18 23:16:46 +00:00
SdDrawDocument : : SdDrawDocument ( DocumentType eType , SfxObjectShell * pDrDocSh ) :
FmFormModel (
2000-11-10 15:53:19 +00:00
SvtPathOptions ( ) . GetPalettePath ( ) ,
2004-10-04 17:16:14 +00:00
NULL , pDrDocSh ) ,
2000-09-18 23:16:46 +00:00
eDocType ( eType ) ,
2004-01-20 09:25:48 +00:00
pDocSh ( static_cast < : : sd : : DrawDocShell * > ( pDrDocSh ) ) ,
2001-11-23 13:17:09 +00:00
pCreatingTransferable ( NULL ) ,
2000-09-18 23:16:46 +00:00
pOutliner ( NULL ) ,
pInternalOutliner ( NULL ) ,
ePageNumType ( SVX_ARABIC ) ,
bNewOrLoadCompleted ( FALSE ) ,
pWorkStartupTimer ( NULL ) ,
pOnlineSpellingTimer ( NULL ) ,
pOnlineSpellingList ( NULL ) ,
bInitialOnlineSpellingEnabled ( TRUE ) ,
bHasOnlineSpellErrors ( FALSE ) ,
pOnlineSearchItem ( NULL ) ,
2000-09-27 08:06:50 +00:00
mpInternational ( NULL ) ,
mpLocale ( NULL ) ,
mpCharClass ( NULL ) ,
2000-09-18 23:16:46 +00:00
bAllocDocSh ( FALSE ) ,
pDeletedPresObjList ( NULL ) ,
nFileFormatVersion ( SDIOCOMPAT_VERSIONDONTKNOW ) ,
2001-02-09 12:01:31 +00:00
pCustomShowList ( NULL ) ,
eLanguage ( LANGUAGE_SYSTEM ) ,
eLanguageCJK ( LANGUAGE_SYSTEM ) ,
2003-05-16 13:16:34 +00:00
eLanguageCTL ( LANGUAGE_SYSTEM ) ,
2003-10-27 12:29:26 +00:00
mbStartWithPresentation ( false ) ,
// #109538#
2004-01-20 09:25:48 +00:00
mpDrawPageListWatcher ( 0 ) ,
mpMasterPageListWatcher ( 0 )
2000-09-18 23:16:46 +00:00
{
2003-10-27 12:29:26 +00:00
// #109538#
2004-01-20 09:25:48 +00:00
mpDrawPageListWatcher = : : std : : auto_ptr < ImpDrawPageListWatcher > (
new ImpDrawPageListWatcher ( * this ) ) ;
mpMasterPageListWatcher = : : std : : auto_ptr < ImpMasterPageListWatcher > (
new ImpMasterPageListWatcher ( * this ) ) ;
2003-10-27 12:29:26 +00:00
2000-09-18 23:16:46 +00:00
SetObjectShell ( pDrDocSh ) ; // fuer das VCDrawModel
if ( pDocSh )
{
SetSwapGraphics ( TRUE ) ;
}
// Masseinheit (von App) und Massstab (von SdMod) setzen
INT32 nX , nY ;
SdOptions * pOptions = SD_MOD ( ) - > GetSdOptions ( eDocType ) ;
pOptions - > GetScale ( nX , nY ) ;
2001-09-25 11:09:02 +00:00
// #92067# Allow UI scale only for draw documents.
if ( eType = = DOCUMENT_TYPE_DRAW )
SetUIUnit ( ( FieldUnit ) pOptions - > GetMetric ( ) , Fraction ( nX , nY ) ) ; // user-defined
else
SetUIUnit ( ( FieldUnit ) pOptions - > GetMetric ( ) , Fraction ( 1 , 1 ) ) ; // default
2000-09-18 23:16:46 +00:00
SetScaleUnit ( MAP_100TH_MM ) ;
SetScaleFraction ( Fraction ( 1 , 1 ) ) ;
SetDefaultFontHeight ( 847 ) ; // 24p
pItemPool - > SetDefaultMetric ( SFX_MAPUNIT_100TH_MM ) ;
pItemPool - > FreezeIdRanges ( ) ;
SetTextDefaults ( ) ;
// die DrawingEngine muss auch wissen, wo er ist
FmFormModel : : SetStyleSheetPool ( new SdStyleSheetPool ( GetPool ( ) , this ) ) ;
2001-02-09 12:01:31 +00:00
// Dem DrawOutliner den StyleSheetPool setzen, damit Textobjekte richtig
// eingelesen werden koennen. Der Link zum StyleRequest-Handler des
// Dokuments wird erst in NewOrLoadCompleted gesetzt, da erst dann alle
// Vorlagen existieren.
SdrOutliner & rOutliner = GetDrawOutliner ( ) ;
rOutliner . SetStyleSheetPool ( ( SfxStyleSheetPool * ) GetStyleSheetPool ( ) ) ;
2001-06-19 14:07:14 +00:00
rOutliner . SetCalcFieldValueHdl ( LINK ( SD_MOD ( ) , SdModule , CalcFieldValueHdl ) ) ;
2000-09-18 23:16:46 +00:00
2002-07-26 11:42:05 +00:00
// set linguistic options
2000-09-18 23:16:46 +00:00
{
2002-02-20 10:05:16 +00:00
const SvtLinguConfig aLinguConfig ;
2002-07-26 11:42:05 +00:00
SvtLinguOptions aOptions ;
aLinguConfig . GetOptions ( aOptions ) ;
2002-02-20 10:05:16 +00:00
2002-07-26 11:42:05 +00:00
SetLanguage ( aOptions . nDefaultLanguage , EE_CHAR_LANGUAGE ) ;
SetLanguage ( aOptions . nDefaultLanguage_CJK , EE_CHAR_LANGUAGE_CJK ) ;
SetLanguage ( aOptions . nDefaultLanguage_CTL , EE_CHAR_LANGUAGE_CTL ) ;
2002-02-20 10:05:16 +00:00
2002-07-26 11:42:05 +00:00
bOnlineSpell = aOptions . bIsSpellAuto ;
bHideSpell = aOptions . bIsSpellHideMarkings ;
2000-09-18 23:16:46 +00:00
}
2003-03-27 09:58:12 +00:00
LanguageType eRealLanguage = International : : GetRealLanguage ( eLanguage ) ;
2000-09-18 23:16:46 +00:00
mpInternational = new International ( eLanguage ) ;
String aLanguage , aCountry , aEmpty ;
2003-03-27 09:58:12 +00:00
ConvertLanguageToIsoNames ( eRealLanguage , aLanguage , aCountry ) ;
2000-09-18 23:16:46 +00:00
mpLocale = new : : com : : sun : : star : : lang : : Locale ( aLanguage , aCountry , aEmpty ) ;
mpCharClass = new CharClass ( * mpLocale ) ;
2003-04-24 13:35:54 +00:00
// If the current application language is a language that uses right-to-left text...
LanguageType eRealCTLLanguage = Application : : GetSettings ( ) . GetLanguage ( ) ;
if ( ( LANGUAGE_ARABIC = = ( eRealCTLLanguage & 0x00ff ) ) | |
( LANGUAGE_URDU = = ( eRealCTLLanguage & 0x00ff ) ) | |
( LANGUAGE_HEBREW = = eRealCTLLanguage ) )
2003-03-27 09:58:12 +00:00
{
// ... then we have to set this as a default
SetDefaultWritingMode ( : : com : : sun : : star : : text : : WritingMode_RL_TB ) ;
}
2003-12-01 09:07:08 +00:00
// for korean and japanese languages we have a different default for apply spacing between asian, latin and ctl text
if ( ( LANGUAGE_KOREAN = = eRealCTLLanguage ) | | ( LANGUAGE_KOREAN_JOHAB = = eRealCTLLanguage ) | | ( LANGUAGE_JAPANESE = = eRealCTLLanguage ) )
{
GetPool ( ) . GetSecondaryPool ( ) - > SetPoolDefaultItem ( SvxScriptSpaceItem ( FALSE ) ) ;
}
2000-09-18 23:16:46 +00:00
// DefTab und SpellOptions setzen
//OfaMiscCfg* pOfaMiscCfg = SFX_APP()->GetMiscConfig();
// Jetzt am Modul (SD)
USHORT nDefTab = pOptions - > GetDefTab ( ) ;
SetDefaultTabulator ( nDefTab ) ;
2004-02-04 13:19:04 +00:00
try
2000-09-18 23:16:46 +00:00
{
2002-02-20 10:05:16 +00:00
Reference < XSpellChecker1 > xSpellChecker ( LinguMgr : : GetSpellChecker ( ) ) ;
if ( xSpellChecker . is ( ) )
rOutliner . SetSpeller ( xSpellChecker ) ;
Reference < XHyphenator > xHyphenator ( LinguMgr : : GetHyphenator ( ) ) ;
if ( xHyphenator . is ( ) )
rOutliner . SetHyphenator ( xHyphenator ) ;
SetForbiddenCharsTable ( new SvxForbiddenCharactersTable ( : : comphelper : : getProcessServiceFactory ( ) ) ) ;
2000-09-18 23:16:46 +00:00
}
2004-02-04 13:19:04 +00:00
catch ( . . . )
2000-09-18 23:16:46 +00:00
{
DBG_ERROR ( " Can't get SpellChecker " ) ;
}
2003-06-26 10:11:18 +00:00
rOutliner . SetDefaultLanguage ( Application : : GetSettings ( ) . GetLanguage ( ) ) ;
2000-09-18 23:16:46 +00:00
aOldNotifyUndoActionHdl = GetNotifyUndoActionHdl ( ) ;
SetNotifyUndoActionHdl ( LINK ( this , SdDrawDocument , NotifyUndoActionHdl ) ) ;
if ( pDocSh )
{
SetLinkManager ( new SvxLinkManager ( pDocSh ) ) ;
}
2001-02-09 12:01:31 +00:00
ULONG nCntrl = rOutliner . GetControlWord ( ) ;
nCntrl | = EE_CNTRL_ALLOWBIGOBJS ;
nCntrl | = EE_CNTRL_URLSFXEXECUTE ;
if ( bHideSpell )
nCntrl | = EE_CNTRL_NOREDLINES ;
else
nCntrl & = ~ EE_CNTRL_NOREDLINES ;
if ( bOnlineSpell )
nCntrl | = EE_CNTRL_ONLINESPELLING ;
else
nCntrl & = ~ EE_CNTRL_ONLINESPELLING ;
2001-04-24 12:06:10 +00:00
nCntrl & = ~ EE_CNTRL_ULSPACESUMMATION ;
2001-05-07 12:14:17 +00:00
if ( eDocType ! = DOCUMENT_TYPE_IMPRESS )
SetSummationOfParagraphs ( sal_False ) ;
else
{
SetSummationOfParagraphs ( pOptions - > IsSummationOfParagraphs ( ) ) ;
if ( pOptions - > IsSummationOfParagraphs ( ) )
nCntrl | = EE_CNTRL_ULSPACESUMMATION ;
}
2001-02-09 12:01:31 +00:00
rOutliner . SetControlWord ( nCntrl ) ;
2003-04-24 13:35:54 +00:00
// Initialize the printer independent layout mode.
SetPrinterIndependentLayout ( pOptions - > GetPrinterIndependentLayout ( ) ) ;
2001-02-09 12:01:31 +00:00
2000-09-18 23:16:46 +00:00
// Dem HitTestOutliner den StyleSheetPool setzen.
// Der Link zum StyleRequest-Handler des
// Dokuments wird erst in NewOrLoadCompleted gesetzt, da erst dann alle
// Vorlagen existieren.
SfxItemSet aSet2 ( pHitTestOutliner - > GetEmptyItemSet ( ) ) ;
pHitTestOutliner - > SetStyleSheetPool ( ( SfxStyleSheetPool * ) GetStyleSheetPool ( ) ) ;
2001-06-19 14:07:14 +00:00
pHitTestOutliner - > SetCalcFieldValueHdl ( LINK ( SD_MOD ( ) , SdModule , CalcFieldValueHdl ) ) ;
2001-06-25 12:08:18 +00:00
2004-02-04 13:19:04 +00:00
try
2000-09-18 23:16:46 +00:00
{
2002-02-20 10:05:16 +00:00
Reference < XSpellChecker1 > xSpellChecker ( LinguMgr : : GetSpellChecker ( ) ) ;
if ( xSpellChecker . is ( ) )
pHitTestOutliner - > SetSpeller ( xSpellChecker ) ;
Reference < XHyphenator > xHyphenator ( LinguMgr : : GetHyphenator ( ) ) ;
if ( xHyphenator . is ( ) )
pHitTestOutliner - > SetHyphenator ( xHyphenator ) ;
2000-09-18 23:16:46 +00:00
}
2004-02-04 13:19:04 +00:00
catch ( . . . )
2000-09-18 23:16:46 +00:00
{
DBG_ERROR ( " Can't get SpellChecker " ) ;
}
2003-06-26 10:11:18 +00:00
pHitTestOutliner - > SetDefaultLanguage ( Application : : GetSettings ( ) . GetLanguage ( ) ) ;
2000-09-18 23:16:46 +00:00
ULONG nCntrl2 = pHitTestOutliner - > GetControlWord ( ) ;
nCntrl2 | = EE_CNTRL_ALLOWBIGOBJS ;
nCntrl2 | = EE_CNTRL_URLSFXEXECUTE ;
nCntrl2 | = EE_CNTRL_NOREDLINES ;
nCntrl2 & = ~ EE_CNTRL_ONLINESPELLING ;
2001-04-24 12:06:10 +00:00
nCntrl2 & = ~ EE_CNTRL_ULSPACESUMMATION ;
if ( pOptions - > IsSummationOfParagraphs ( ) )
nCntrl2 | = EE_CNTRL_ULSPACESUMMATION ;
2000-09-18 23:16:46 +00:00
pHitTestOutliner - > SetControlWord ( nCntrl2 ) ;
/**************************************************************************
* Layer anlegen
*
* Es werden auf Pages und MasterPages folgende Default - Layer angelegt :
*
* Layer STR_LAYOUT : Standardlayer f <EFBFBD> r alle Zeichenobjekte
*
* Layer STR_BCKGRND : Hintergrund der MasterPage
* ( auf normalen Pages z . Z . keine Verwendung )
*
* Layer STR_BCKGRNDOBJ : Objekte auf dem Hintergrund der MasterPage
* ( auf normalen Pages z . Z . keine Verwendung )
*
* Layer STR_CONTROLS : Standardlayer f <EFBFBD> r Controls
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
{
String aControlLayerName ( SdResId ( STR_LAYER_CONTROLS ) ) ;
SdrLayerAdmin & rLayerAdmin = GetLayerAdmin ( ) ;
rLayerAdmin . NewLayer ( String ( SdResId ( STR_LAYER_LAYOUT ) ) ) ;
rLayerAdmin . NewLayer ( String ( SdResId ( STR_LAYER_BCKGRND ) ) ) ;
rLayerAdmin . NewLayer ( String ( SdResId ( STR_LAYER_BCKGRNDOBJ ) ) ) ;
rLayerAdmin . NewLayer ( aControlLayerName ) ;
rLayerAdmin . NewLayer ( String ( SdResId ( STR_LAYER_MEASURELINES ) ) ) ;
rLayerAdmin . SetControlLayerName ( aControlLayerName ) ;
}
pFrameViewList = new List ( ) ;
}
/*************************************************************************
| *
| * Destruktor
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2001-10-22 12:36:57 +00:00
SdDrawDocument : : ~ SdDrawDocument ( )
2000-09-18 23:16:46 +00:00
{
2003-03-27 09:58:12 +00:00
Broadcast ( SdrHint ( HINT_MODELCLEARED ) ) ;
2000-09-18 23:16:46 +00:00
if ( pWorkStartupTimer )
{
if ( pWorkStartupTimer - > IsActive ( ) )
pWorkStartupTimer - > Stop ( ) ;
delete pWorkStartupTimer ;
pWorkStartupTimer = NULL ;
}
StopOnlineSpelling ( ) ;
delete pOnlineSearchItem ;
pOnlineSearchItem = NULL ;
CloseBookmarkDoc ( ) ;
SetAllocDocSh ( FALSE ) ;
SetNotifyUndoActionHdl ( aOldNotifyUndoActionHdl ) ;
2004-05-10 13:36:46 +00:00
// #116168#
ClearModel ( sal_True ) ;
2000-09-18 23:16:46 +00:00
if ( pLinkManager )
{
// BaseLinks freigeben
if ( pLinkManager - > GetLinks ( ) . Count ( ) )
{
pLinkManager - > Remove ( 0 , pLinkManager - > GetLinks ( ) . Count ( ) ) ;
}
delete pLinkManager ;
pLinkManager = NULL ;
}
2004-01-20 09:25:48 +00:00
: : sd : : FrameView * pFrameView = NULL ;
2000-09-18 23:16:46 +00:00
for ( ULONG i = 0 ; i < pFrameViewList - > Count ( ) ; i + + )
{
// Ggf. FrameViews loeschen
2004-01-20 09:25:48 +00:00
pFrameView =
static_cast < : : sd : : FrameView * > ( pFrameViewList - > GetObject ( i ) ) ;
2000-09-18 23:16:46 +00:00
if ( pFrameView )
delete pFrameView ;
}
delete pFrameViewList ;
pFrameViewList = NULL ;
if ( pCustomShowList )
{
for ( ULONG j = 0 ; j < pCustomShowList - > Count ( ) ; j + + )
{
// Ggf. CustomShows loeschen
SdCustomShow * pCustomShow = ( SdCustomShow * ) pCustomShowList - > GetObject ( j ) ;
delete pCustomShow ;
}
delete pCustomShowList ;
pCustomShowList = NULL ;
}
delete pOutliner ;
pOutliner = NULL ;
delete pInternalOutliner ;
pInternalOutliner = NULL ;
delete pDeletedPresObjList ;
pDeletedPresObjList = NULL ;
delete mpInternational ;
mpInternational = NULL ;
delete mpLocale ;
mpLocale = NULL ;
delete mpCharClass ;
mpCharClass = NULL ;
2004-01-20 09:25:48 +00:00
/*af deletion is done by auto ptr s.
2003-10-27 12:29:26 +00:00
// #109538#
delete mpDrawPageListWatcher ;
mpDrawPageListWatcher = 0L ;
// #109538#
delete mpMasterPageListWatcher ;
mpMasterPageListWatcher = 0L ;
2004-01-20 09:25:48 +00:00
*/
2000-09-18 23:16:46 +00:00
}
/*************************************************************************
| *
| * Diese Methode erzeugt ein neues Dokument ( SdDrawDocument ) und gibt einen
| * Zeiger darauf zurueck . Die Drawing Engine benutzt diese Methode um das
| * Dokument oder Teile davon ins Clipboard / DragServer stellen zu koennen .
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2001-10-22 12:36:57 +00:00
SdrModel * SdDrawDocument : : AllocModel ( ) const
2000-09-18 23:16:46 +00:00
{
SdDrawDocument * pNewModel = NULL ;
2001-11-23 13:17:09 +00:00
if ( pCreatingTransferable )
2000-09-18 23:16:46 +00:00
{
2001-01-19 18:15:28 +00:00
// Dokument wird fuer Drag&Drop/Clipboard erzeugt, dafuer muss dem Dokument eine DocShell (SvPersist) bekannt sein
2004-10-04 17:16:14 +00:00
SfxObjectShell * pObj = NULL ;
2004-01-20 09:25:48 +00:00
: : sd : : DrawDocShell * pNewDocSh = NULL ;
2000-09-18 23:16:46 +00:00
2001-11-23 13:17:09 +00:00
if ( eDocType = = DOCUMENT_TYPE_IMPRESS )
2004-01-20 09:25:48 +00:00
pCreatingTransferable - > SetDocShell ( new : : sd : : DrawDocShell (
SFX_CREATE_MODE_EMBEDDED , TRUE , eDocType ) ) ;
2001-11-23 13:17:09 +00:00
else
2004-01-20 09:25:48 +00:00
pCreatingTransferable - > SetDocShell ( new : : sd : : GraphicDocShell (
SFX_CREATE_MODE_EMBEDDED , TRUE , eDocType ) ) ;
2000-09-18 23:16:46 +00:00
2004-01-20 09:25:48 +00:00
pNewDocSh = static_cast < : : sd : : DrawDocShell * > ( pObj = pCreatingTransferable - > GetDocShell ( ) ) ;
2001-01-19 18:15:28 +00:00
pNewDocSh - > DoInitNew ( NULL ) ;
2000-09-18 23:16:46 +00:00
pNewModel = pNewDocSh - > GetDoc ( ) ;
// Nur fuer Clipboard notwendig,
// fuer Drag&Drop erfolgt dieses im DragServer
SdStyleSheetPool * pOldStylePool = ( SdStyleSheetPool * ) GetStyleSheetPool ( ) ;
SdStyleSheetPool * pNewStylePool = ( SdStyleSheetPool * ) pNewModel - > GetStyleSheetPool ( ) ;
pNewStylePool - > CopyGraphicSheets ( * pOldStylePool ) ;
for ( USHORT i = 0 ; i < GetMasterSdPageCount ( PK_STANDARD ) ; i + + )
{
// Alle Layouts der MasterPage mitnehmen
2001-06-28 07:11:11 +00:00
String aOldLayoutName ( ( ( SdDrawDocument * ) this ) - > GetMasterSdPage ( i , PK_STANDARD ) - > GetLayoutName ( ) ) ;
aOldLayoutName . Erase ( aOldLayoutName . SearchAscii ( SD_LT_SEPARATOR ) ) ;
2000-09-18 23:16:46 +00:00
pNewStylePool - > CopyLayoutSheets ( aOldLayoutName , * pOldStylePool ) ;
}
pNewModel - > NewOrLoadCompleted ( DOC_LOADED ) ; // loaded from source document
}
2001-01-19 18:15:28 +00:00
else if ( bAllocDocSh )
2000-09-18 23:16:46 +00:00
{
2001-01-19 18:15:28 +00:00
// Es wird eine DocShell erzeugt, welche mit GetAllocedDocSh() zurueckgegeben wird
2000-09-18 23:16:46 +00:00
SdDrawDocument * pDoc = ( SdDrawDocument * ) this ;
pDoc - > SetAllocDocSh ( FALSE ) ;
2004-01-20 09:25:48 +00:00
pDoc - > xAllocedDocShRef = new : : sd : : DrawDocShell (
SFX_CREATE_MODE_EMBEDDED , TRUE , eDocType ) ;
2000-09-18 23:16:46 +00:00
pDoc - > xAllocedDocShRef - > DoInitNew ( NULL ) ;
pNewModel = pDoc - > xAllocedDocShRef - > GetDoc ( ) ;
}
else
{
pNewModel = new SdDrawDocument ( eDocType , NULL ) ;
}
2001-01-19 18:15:28 +00:00
return pNewModel ;
2000-09-18 23:16:46 +00:00
}
/*************************************************************************
| *
| * Diese Methode erzeugt eine neue Seite ( SdPage ) und gibt einen Zeiger
| * darauf zurueck . Die Drawing Engine benutzt diese Methode beim Laden
| * zur Erzeugung von Seiten ( deren Typ sie ja nicht kennt , da es ABLEITUNGEN
| * der SdrPage sind ) .
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2001-10-22 12:36:57 +00:00
SdrPage * SdDrawDocument : : AllocPage ( FASTBOOL bMasterPage )
2000-09-18 23:16:46 +00:00
{
return new SdPage ( * this , NULL , bMasterPage ) ;
}
/*************************************************************************
| *
| * SetChanged ( ) , das Model wurde geaendert
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2003-11-24 16:07:37 +00:00
void SdDrawDocument : : SetChanged ( sal_Bool bFlag )
2000-09-18 23:16:46 +00:00
{
if ( pDocSh )
{
if ( bNewOrLoadCompleted & & pDocSh - > IsEnableSetModified ( ) )
{
// weitergeben an Basisklasse
FmFormModel : : SetChanged ( bFlag ) ;
// an ObjectShell weiterleiten
pDocSh - > SetModified ( bFlag ) ;
}
}
else
{
// weitergeben an Basisklasse
FmFormModel : : SetChanged ( bFlag ) ;
}
}
2002-07-19 11:06:18 +00:00
/*************************************************************************
| *
| * NbcSetChanged ( ) , the model changed , don ' t call anybody else
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2003-11-24 16:07:37 +00:00
void SdDrawDocument : : NbcSetChanged ( sal_Bool bFlag )
2002-07-19 11:06:18 +00:00
{
// #100237# forward to baseclass
FmFormModel : : SetChanged ( bFlag ) ;
}
2000-09-18 23:16:46 +00:00
/*************************************************************************
| *
| * NewOrLoadCompleted
| *
| * Wird gerufen , wenn das Dokument geladen wurde bzw . feststeht , dass es
| * nicht mehr geladen wird .
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void SdDrawDocument : : NewOrLoadCompleted ( DocCreationMode eMode )
{
if ( eMode = = NEW_DOC )
{
// Neues Dokument:
// Praesentations- und Standardvorlagen erzeugen,
// Pool fuer virtuelle Controls erzeugen
CreateLayoutTemplates ( ) ;
( ( SdStyleSheetPool * ) pStyleSheetPool ) - > CreatePseudosIfNecessary ( ) ;
}
else if ( eMode = = DOC_LOADED )
{
2001-04-26 16:11:09 +00:00
// Dokument wurde geladen:
2000-09-18 23:16:46 +00:00
2002-01-18 14:36:06 +00:00
CheckMasterPages ( ) ;
2000-09-18 23:16:46 +00:00
if ( GetMasterSdPageCount ( PK_STANDARD ) > 1 )
RemoveUnnessesaryMasterPages ( NULL , TRUE , FALSE ) ;
2001-02-26 09:28:07 +00:00
for ( USHORT i = 0 ; i < GetPageCount ( ) ; i + + )
2000-09-18 23:16:46 +00:00
{
// Check for correct layout names
SdPage * pPage = ( SdPage * ) GetPage ( i ) ;
2004-07-12 13:55:03 +00:00
if ( pPage - > TRG_HasMasterPage ( ) )
2000-09-18 23:16:46 +00:00
{
2004-07-12 13:55:03 +00:00
SdPage & rMaster = ( SdPage & ) pPage - > TRG_GetMasterPage ( ) ;
if ( rMaster . GetLayoutName ( ) ! = pPage - > GetLayoutName ( ) )
{
pPage - > SetLayoutName ( rMaster . GetLayoutName ( ) ) ;
}
2000-09-18 23:16:46 +00:00
}
}
2001-07-03 13:21:16 +00:00
for ( USHORT nPage = 0 ; nPage < GetMasterPageCount ( ) ; nPage + + )
2000-09-18 23:16:46 +00:00
{
2001-07-03 13:21:16 +00:00
// LayoutName and PageName must be the same
SdPage * pPage = ( SdPage * ) GetMasterPage ( nPage ) ;
2000-09-18 23:16:46 +00:00
2001-07-03 13:21:16 +00:00
String aName ( pPage - > GetLayoutName ( ) ) ;
aName . Erase ( aName . SearchAscii ( SD_LT_SEPARATOR ) ) ;
if ( aName ! = pPage - > GetName ( ) )
pPage - > SetName ( aName ) ;
2002-04-24 10:05:16 +00:00
SdrObject * pPresObj = pPage - > GetPresObj ( PRESOBJ_BACKGROUND ) ;
2001-07-03 13:21:16 +00:00
if ( pPage - > GetPageKind ( ) = = PK_STANDARD )
{
DBG_ASSERT ( pPresObj , " Masterpage without a background object! " ) ;
if ( pPresObj & & pPresObj - > GetOrdNum ( ) ! = 0 )
pPage - > NbcSetObjectOrdNum ( pPresObj - > GetOrdNum ( ) , 0 ) ;
}
2002-04-24 10:05:16 +00:00
else
{
DBG_ASSERT ( pPresObj = = NULL , " Non Standard Masterpage with a background object! \n (This assertion is ok for old binary files) " ) ;
if ( pPresObj )
{
pPage - > RemoveObject ( pPresObj - > GetOrdNum ( ) ) ;
2004-03-30 14:43:59 +00:00
pPage - > RemovePresObj ( pPresObj ) ;
2002-04-24 10:05:16 +00:00
delete pPresObj ;
}
}
2000-09-18 23:16:46 +00:00
}
// Sprachabhaengige Namen der StandardLayer erzeugen
RestoreLayerNames ( ) ;
// Sprachabhaengige Namen der Vorlagen setzen
( ( SdStyleSheetPool * ) pStyleSheetPool ) - > UpdateStdNames ( ) ;
// Ggf. fehlende Vorlagen erzeugen (es gab z.B. frueher keinen Subtitle)
( ( SdStyleSheetPool * ) pStyleSheetPool ) - > CreatePseudosIfNecessary ( ) ;
}
// Standardvorlage an der Drawing Engine setzen
String aName ( SdResId ( STR_STANDARD_STYLESHEET_NAME ) ) ;
SfxStyleSheet * pSheet = ( SfxStyleSheet * ) pStyleSheetPool - >
Find ( aName , SFX_STYLE_FAMILY_PARA ) ;
SetDefaultStyleSheet ( pSheet ) ;
// Draw-Outliner und Dokument Outliner initialisieren,
// aber nicht den globalen Outliner, den der ist ja nicht
// dokumentspezifisch wie StyleSheetPool und StyleRequestHandler
2004-03-30 14:43:59 +00:00
: : Outliner & rDrawOutliner = GetDrawOutliner ( ) ;
2000-09-18 23:16:46 +00:00
rDrawOutliner . SetStyleSheetPool ( ( SfxStyleSheetPool * ) GetStyleSheetPool ( ) ) ;
rDrawOutliner . SetMinDepth ( 0 ) ;
ULONG nCntrl = rDrawOutliner . GetControlWord ( ) ;
if ( bOnlineSpell )
nCntrl | = EE_CNTRL_ONLINESPELLING ;
else
nCntrl & = ~ EE_CNTRL_ONLINESPELLING ;
rDrawOutliner . SetControlWord ( nCntrl ) ;
// HitTest-Outliner und Dokument Outliner initialisieren,
// aber nicht den globalen Outliner, den der ist ja nicht
// dokumentspezifisch wie StyleSheetPool und StyleRequestHandler
pHitTestOutliner - > SetStyleSheetPool ( ( SfxStyleSheetPool * ) GetStyleSheetPool ( ) ) ;
pHitTestOutliner - > SetMinDepth ( 0 ) ;
if ( pOutliner )
{
pOutliner - > SetStyleSheetPool ( ( SfxStyleSheetPool * ) GetStyleSheetPool ( ) ) ;
pOutliner - > SetMinDepth ( 0 ) ;
}
if ( pInternalOutliner )
{
pInternalOutliner - > SetStyleSheetPool ( ( SfxStyleSheetPool * ) GetStyleSheetPool ( ) ) ;
pInternalOutliner - > SetMinDepth ( 0 ) ;
}
if ( eMode = = DOC_LOADED )
{
if ( nFileFormatVersion < = 17 & & nFileFormatVersion ! = SDIOCOMPAT_VERSIONDONTKNOW )
{
// Da sich die Bedeutung der SvxLRSpaceItems ab nFileFormatVersion = 16
// geaendert hat (Bullet-Handling des Outliners), muss fuer aeltere Versionen
// eine Korrektur vorgenommen werden.
// Bis Version 17 gab es noch diverse Probleme
( ( SdStyleSheetPool * ) pStyleSheetPool ) - > AdjustLRSpaceItems ( ) ;
}
// Praesentationsobjekte muessen wieder Listener der entsprechenden
// Vorlagen werden
SdStyleSheetPool * pSPool = ( SdStyleSheetPool * ) GetStyleSheetPool ( ) ;
SfxStyleSheet * pSheet = NULL ;
2002-01-09 13:40:05 +00:00
USHORT nPage , nPageCount ;
// #96323# create missing layout style sheets for broken documents
// that where created with the 5.2
nPageCount = GetMasterSdPageCount ( PK_STANDARD ) ;
for ( nPage = 0 ; nPage < nPageCount ; nPage + + )
{
SdPage * pPage = GetMasterSdPage ( nPage , PK_STANDARD ) ;
pSPool - > CreateLayoutStyleSheets ( pPage - > GetName ( ) , sal_True ) ;
}
2000-09-18 23:16:46 +00:00
// Standard- und Notizseiten:
2002-01-09 13:40:05 +00:00
for ( nPage = 0 ; nPage < GetPageCount ( ) ; nPage + + )
2000-09-18 23:16:46 +00:00
{
SdPage * pPage = ( SdPage * ) GetPage ( nPage ) ;
2001-12-07 08:55:23 +00:00
if ( nFileFormatVersion < = 4 )
pPage - > CreateTitleAndLayout ( ) ;
2004-03-30 14:43:59 +00:00
NewOrLoadCompleted ( pPage , pSPool ) ;
2000-10-18 11:07:10 +00:00
}
2000-09-18 23:16:46 +00:00
2000-10-18 11:07:10 +00:00
// Masterpages:
for ( nPage = 0 ; nPage < GetMasterPageCount ( ) ; nPage + + )
{
SdPage * pPage = ( SdPage * ) GetMasterPage ( nPage ) ;
2000-09-18 23:16:46 +00:00
2004-03-30 14:43:59 +00:00
NewOrLoadCompleted ( pPage , pSPool ) ;
2000-09-18 23:16:46 +00:00
// BackgroundObjekt vor Selektion schuetzen #62144#
SdrObject * pBackObj = pPage - > GetPresObj ( PRESOBJ_BACKGROUND ) ;
if ( pBackObj )
pBackObj - > SetMarkProtect ( TRUE ) ;
}
}
bNewOrLoadCompleted = TRUE ;
/**************************************************************************
* Alle gelinkten Pages aktualisieren
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
SdPage * pPage = NULL ;
USHORT nMaxSdPages = GetSdPageCount ( PK_STANDARD ) ;
for ( USHORT nSdPage = 0 ; nSdPage < nMaxSdPages ; nSdPage + + )
{
pPage = ( SdPage * ) GetSdPage ( nSdPage , PK_STANDARD ) ;
if ( pPage & & pPage - > GetFileName ( ) . Len ( ) & & pPage - > GetBookmarkName ( ) . Len ( ) )
{
pPage - > SetModel ( this ) ;
}
}
2001-12-18 14:03:13 +00:00
UpdateAllLinks ( ) ;
SetChanged ( FALSE ) ;
}
/** updates all links, only links in this document should by resolved */
void SdDrawDocument : : UpdateAllLinks ( )
{
2000-09-18 23:16:46 +00:00
if ( ! pDocLockedInsertingLinks & & pLinkManager & & pLinkManager - > GetLinks ( ) . Count ( ) )
{
pDocLockedInsertingLinks = this ; // lock inserting links. only links in this document should by resolved
pLinkManager - > UpdateAllLinks ( ) ; // query box: update all links?
if ( pDocLockedInsertingLinks = = this )
pDocLockedInsertingLinks = NULL ; // unlock inserting links
}
}
2004-03-30 14:43:59 +00:00
/** this loops over the presentation objectes of a page and repairs some new settings
from old binary files and resets all default strings for empty presentation objects .
*/
void SdDrawDocument : : NewOrLoadCompleted ( SdPage * pPage , SdStyleSheetPool * pSPool )
{
SdrObjListIter aShapeIter ( * pPage ) ;
while ( aShapeIter . IsMore ( ) )
{
OutlinerParaObject * pOPO = aShapeIter . Next ( ) - > GetOutlinerParaObject ( ) ;
if ( pOPO )
{
if ( pOPO - > GetOutlinerMode ( ) = = OUTLINERMODE_DONTKNOW )
pOPO - > SetOutlinerMode ( OUTLINERMODE_TEXTOBJECT ) ;
pOPO - > FinishLoad ( pSPool ) ;
}
}
PresentationObjectList : : iterator aIter ( pPage - > GetPresObjList ( ) . begin ( ) ) ;
const PresentationObjectList : : iterator aEnd ( pPage - > GetPresObjList ( ) . end ( ) ) ;
if ( aIter ! = aEnd )
{
// Listen mit Titel- und Gliederungsvorlagen erstellen
String aName = pPage - > GetLayoutName ( ) ;
aName . Erase ( aName . SearchAscii ( SD_LT_SEPARATOR ) ) ;
List * pOutlineList = pSPool - > CreateOutlineSheetList ( aName ) ;
SfxStyleSheet * pTitleSheet = ( SfxStyleSheet * )
pSPool - > GetTitleSheet ( aName ) ;
// jetzt nach Titel- und Gliederungstextobjekten suchen und
// Objekte zu Listenern machen
while ( aIter ! = aEnd )
{
SdrObject * pObj = ( * aIter ) . mpObject ;
if ( pObj - > GetObjInventor ( ) = = SdrInventor )
{
OutlinerParaObject * pOPO = pObj - > GetOutlinerParaObject ( ) ;
UINT16 nId = pObj - > GetObjIdentifier ( ) ;
if ( nId = = OBJ_TITLETEXT )
{
if ( pOPO & & pOPO - > GetOutlinerMode ( ) = = OUTLINERMODE_DONTKNOW )
pOPO - > SetOutlinerMode ( OUTLINERMODE_TITLEOBJECT ) ;
// TRUE: harte Attribute dabei nicht loeschen
if ( pTitleSheet )
pObj - > SetStyleSheet ( pTitleSheet , TRUE ) ;
}
else if ( nId = = OBJ_OUTLINETEXT )
{
if ( pOPO & & pOPO - > GetOutlinerMode ( ) = = OUTLINERMODE_DONTKNOW )
pOPO - > SetOutlinerMode ( OUTLINERMODE_OUTLINEOBJECT ) ;
for ( USHORT nSheet = 0 ; nSheet < 10 ; nSheet + + )
{
SfxStyleSheet * pSheet = ( SfxStyleSheet * ) pOutlineList - > GetObject ( nSheet ) ;
if ( pSheet )
{
pObj - > StartListening ( * pSheet ) ;
if ( nSheet = = 0 )
// Textrahmen hoert auf StyleSheet der Ebene1
pObj - > NbcSetStyleSheet ( pSheet , TRUE ) ;
}
}
}
if ( pObj - > ISA ( SdrTextObj ) & & pObj - > IsEmptyPresObj ( ) & & pPage )
{
PresObjKind ePresObjKind = ( * aIter ) . meKind ;
String aString ( pPage - > GetPresObjText ( ePresObjKind ) ) ;
if ( aString . Len ( ) )
{
sd : : Outliner * pInternalOutl = GetInternalOutliner ( TRUE ) ;
pInternalOutl - > SetMinDepth ( 0 ) ;
pPage - > SetObjText ( ( SdrTextObj * ) pObj , pInternalOutl , ePresObjKind , aString ) ;
pObj - > NbcSetStyleSheet ( pPage - > GetStyleSheetForPresObj ( ePresObjKind ) , TRUE ) ;
pInternalOutl - > Clear ( ) ;
}
}
}
aIter + + ;
}
delete pOutlineList ;
}
}
2000-09-18 23:16:46 +00:00
/*************************************************************************
| *
| * Lokaler Outliner , welcher fuer den Gliederungsmodus verwendet wird
| * In diesen Outliner werden ggf . OutlinerViews inserted !
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2004-01-20 09:25:48 +00:00
: : sd : : Outliner * SdDrawDocument : : GetOutliner ( BOOL bCreateOutliner )
2000-09-18 23:16:46 +00:00
{
if ( ! pOutliner & & bCreateOutliner )
{
2004-01-20 09:25:48 +00:00
pOutliner = new : : sd : : Outliner ( this , OUTLINERMODE_TEXTOBJECT ) ;
2000-09-18 23:16:46 +00:00
if ( pDocSh )
2002-07-26 07:32:44 +00:00
pOutliner - > SetRefDevice ( SD_MOD ( ) - > GetRefDevice ( * pDocSh ) ) ;
2000-09-18 23:16:46 +00:00
pOutliner - > SetDefTab ( nDefaultTabulator ) ;
pOutliner - > SetStyleSheetPool ( ( SfxStyleSheetPool * ) GetStyleSheetPool ( ) ) ;
pOutliner - > SetMinDepth ( 0 ) ;
}
return ( pOutliner ) ;
}
/*************************************************************************
| *
| * Interner Outliner , welcher fuer die Erzeugung von Textobjekten
| * verwendet wird .
| * In diesen Outliner werden keine OutlinerViews inserted !
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2004-01-20 09:25:48 +00:00
: : sd : : Outliner * SdDrawDocument : : GetInternalOutliner ( BOOL bCreateOutliner )
2000-09-18 23:16:46 +00:00
{
if ( ! pInternalOutliner & & bCreateOutliner )
{
2004-01-20 09:25:48 +00:00
pInternalOutliner = new : : sd : : Outliner ( this , OUTLINERMODE_TEXTOBJECT ) ;
2000-09-18 23:16:46 +00:00
// MT:
// Dieser Outliner wird nur fuer das Erzeugen spezieller Textobjekte
// verwendet. Da in diesen Textobjekten keine Portion-Informationen
// gespeichert werden muessen, kann/soll der Update-Mode immer FALSE bleiben.
pInternalOutliner - > SetUpdateMode ( FALSE ) ;
pInternalOutliner - > EnableUndo ( FALSE ) ;
if ( pDocSh )
2002-07-26 07:32:44 +00:00
pInternalOutliner - > SetRefDevice ( SD_MOD ( ) - > GetRefDevice ( * pDocSh ) ) ;
2000-09-18 23:16:46 +00:00
pInternalOutliner - > SetDefTab ( nDefaultTabulator ) ;
pInternalOutliner - > SetStyleSheetPool ( ( SfxStyleSheetPool * ) GetStyleSheetPool ( ) ) ;
pInternalOutliner - > SetMinDepth ( 0 ) ;
}
DBG_ASSERT ( ! pInternalOutliner | | ( pInternalOutliner - > GetUpdateMode ( ) = = FALSE ) , " InternalOutliner: UpdateMode = TRUE ! " ) ;
DBG_ASSERT ( ! pInternalOutliner | | ( pInternalOutliner - > IsUndoEnabled ( ) = = FALSE ) , " InternalOutliner: Undo = TRUE ! " ) ;
// MT: Wer ihn vollmuellt, macht ihn auch gleich wieder leer:
// Vorteile:
// a) Keine unnoetigen Clear-Aufrufe
// b) Kein Muell im Speicher.
DBG_ASSERT ( ! pInternalOutliner | | ( ( pInternalOutliner - > GetParagraphCount ( ) = = 1 ) & & ( pInternalOutliner - > GetText ( pInternalOutliner - > GetParagraph ( 0 ) ) . Len ( ) = = 0 ) ) , " InternalOutliner: Nicht leer! " ) ;
return pInternalOutliner ;
}
/*************************************************************************
| *
| * OnlineSpelling ein / aus
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void SdDrawDocument : : SetOnlineSpell ( BOOL bIn )
{
bOnlineSpell = bIn ;
ULONG nCntrl = 0 ;
if ( pOutliner )
{
nCntrl = pOutliner - > GetControlWord ( ) ;
if ( bOnlineSpell )
nCntrl | = EE_CNTRL_ONLINESPELLING ;
else
nCntrl & = ~ EE_CNTRL_ONLINESPELLING ;
pOutliner - > SetControlWord ( nCntrl ) ;
}
if ( pInternalOutliner )
{
nCntrl = pInternalOutliner - > GetControlWord ( ) ;
if ( bOnlineSpell )
nCntrl | = EE_CNTRL_ONLINESPELLING ;
else
nCntrl & = ~ EE_CNTRL_ONLINESPELLING ;
pInternalOutliner - > SetControlWord ( nCntrl ) ;
}
2004-03-30 14:43:59 +00:00
: : Outliner & rOutliner = GetDrawOutliner ( ) ;
2000-09-18 23:16:46 +00:00
nCntrl = rOutliner . GetControlWord ( ) ;
if ( bOnlineSpell )
nCntrl | = EE_CNTRL_ONLINESPELLING ;
else
nCntrl & = ~ EE_CNTRL_ONLINESPELLING ;
rOutliner . SetControlWord ( nCntrl ) ;
if ( bOnlineSpell )
{
StartOnlineSpelling ( ) ;
}
else
{
StopOnlineSpelling ( ) ;
}
}
/*************************************************************************
| *
| * OnlineSpelling : Markierung ein / aus
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void SdDrawDocument : : SetHideSpell ( BOOL bIn )
{
bHideSpell = bIn ;
ULONG nCntrl = 0 ;
if ( pOutliner )
{
nCntrl = pOutliner - > GetControlWord ( ) ;
if ( bHideSpell )
nCntrl | = EE_CNTRL_NOREDLINES ;
else
nCntrl & = ~ EE_CNTRL_NOREDLINES ;
pOutliner - > SetControlWord ( nCntrl ) ;
}
if ( pInternalOutliner )
{
nCntrl = pInternalOutliner - > GetControlWord ( ) ;
if ( bHideSpell )
nCntrl | = EE_CNTRL_NOREDLINES ;
else
nCntrl & = ~ EE_CNTRL_NOREDLINES ;
pInternalOutliner - > SetControlWord ( nCntrl ) ;
}
2004-03-30 14:43:59 +00:00
: : Outliner & rOutliner = GetDrawOutliner ( ) ;
2000-09-18 23:16:46 +00:00
nCntrl = rOutliner . GetControlWord ( ) ;
if ( bHideSpell )
nCntrl | = EE_CNTRL_NOREDLINES ;
else
nCntrl & = ~ EE_CNTRL_NOREDLINES ;
rOutliner . SetControlWord ( nCntrl ) ;
}
2000-11-26 18:24:16 +00:00
uno : : Reference < uno : : XInterface > SdDrawDocument : : createUnoModel ( )
{
uno : : Reference < uno : : XInterface > xModel ;
try
{
2004-04-02 12:20:25 +00:00
if ( pDocSh )
xModel = pDocSh - > GetModel ( ) ;
2000-11-26 18:24:16 +00:00
}
catch ( uno : : RuntimeException & e )
{
2001-03-21 15:20:10 +00:00
e ; // to avoid a compiler warning...
2000-11-26 18:24:16 +00:00
}
2000-09-18 23:16:46 +00:00
2000-11-26 18:24:16 +00:00
return xModel ;
}
2002-12-11 15:23:04 +00:00
SvxNumType SdDrawDocument : : GetPageNumType ( ) const
{
return ePageNumType ;
2003-04-24 13:35:54 +00:00
}
void SdDrawDocument : : SetPrinterIndependentLayout ( sal_Int32 nMode )
{
// #108104#
// DBG_ASSERT (pDocSh!=NULL, "No available document shell to set ref device at.");
switch ( nMode )
{
case : : com : : sun : : star : : document : : PrinterIndependentLayout : : DISABLED :
case : : com : : sun : : star : : document : : PrinterIndependentLayout : : ENABLED :
// Just store supported modes and inform the doc shell.
mnPrinterIndependentLayout = nMode ;
// #108104#
// Since it is possible that a SdDrawDocument is constructed without a
// SdDrawDocShell the pointer member pDocSh needs to be tested
// before the call is executed. This is e.-g. used for copy/paste.
if ( pDocSh )
{
pDocSh - > UpdateRefDevice ( ) ;
}
break ;
default :
// Ignore unknown values.
break ;
}
}
sal_Int32 SdDrawDocument : : GetPrinterIndependentLayout ( void )
{
return mnPrinterIndependentLayout ;
}
2003-05-16 13:16:34 +00:00
bool SdDrawDocument : : IsStartWithPresentation ( ) const
{
return mbStartWithPresentation ;
}
void SdDrawDocument : : SetStartWithPresentation ( bool bStartWithPresentation )
{
mbStartWithPresentation = bStartWithPresentation ;
}
2003-10-27 12:29:26 +00:00
// #109538#
void SdDrawDocument : : PageListChanged ( )
{
mpDrawPageListWatcher - > Invalidate ( ) ;
}
// #109538#
void SdDrawDocument : : MasterPageListChanged ( )
{
mpMasterPageListWatcher - > Invalidate ( ) ;
}
2004-11-26 18:46:34 +00:00
2003-10-27 12:29:26 +00:00
// eof