2010-10-12 15:51:52 +02:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2000-09-18 23:16:46 +00:00
/*************************************************************************
*
2008-04-10 17:35:58 +00:00
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER .
2000-09-18 23:16:46 +00:00
*
2010-02-12 15:01:35 +01:00
* Copyright 2000 , 2010 Oracle and / or its affiliates .
2000-09-18 23:16:46 +00:00
*
2008-04-10 17:35:58 +00:00
* OpenOffice . org - a multi - platform office productivity suite
2000-09-18 23:16:46 +00:00
*
2008-04-10 17:35:58 +00:00
* This file is part of OpenOffice . org .
2000-09-18 23:16:46 +00:00
*
2008-04-10 17:35:58 +00:00
* OpenOffice . org is free software : you can redistribute it and / or modify
* it under the terms of the GNU Lesser General Public License version 3
* only , as published by the Free Software Foundation .
2000-09-18 23:16:46 +00:00
*
2008-04-10 17:35:58 +00:00
* OpenOffice . org 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 version 3 for more details
* ( a copy is included in the LICENSE file that accompanied this code ) .
2000-09-18 23:16:46 +00:00
*
2008-04-10 17:35:58 +00:00
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice . org . If not , see
* < http : //www.openoffice.org/license.html>
* for a copy of the LGPLv3 License .
2000-09-18 23:16:46 +00:00
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2006-09-16 17:14:07 +00:00
// MARKER(update_precomp.py): autogen include statement, do not remove
# include "precompiled_sd.hxx"
2004-01-20 09:25:48 +00:00
# include "PageListWatcher.hxx"
2003-03-27 09:58:12 +00:00
# include <com/sun/star/text/WritingMode.hpp>
2003-04-24 13:35:54 +00:00
# include <com/sun/star/document/PrinterIndependentLayout.hpp>
2009-09-17 11:26:03 +00:00
# include <com/sun/star/i18n/ScriptType.hpp>
2010-01-08 18:32:51 +01:00
# include <editeng/forbiddencharacterstable.hxx>
2001-04-06 13:17:19 +00:00
2000-09-18 23:16:46 +00:00
# include <svx/svxids.hrc>
2009-12-10 23:06:35 +01:00
# include <svl/srchitem.hxx>
2010-01-08 18:32:51 +01:00
# include <editeng/eeitem.hxx>
# include <editeng/scriptspaceitem.hxx>
2000-09-18 23:16:46 +00:00
2009-10-06 07:38:24 +02:00
# include <unotools/useroptions.hxx>
2009-09-16 13:55:36 +00:00
2000-09-18 23:16:46 +00:00
# include <sfx2/printer.hxx>
# include <sfx2/app.hxx>
2010-01-13 22:25:07 +01:00
# include <sfx2/linkmgr.hxx>
2000-09-18 23:16:46 +00:00
# include <svx/dialogs.hrc>
2004-01-20 09:25:48 +00:00
# include "Outliner.hxx"
2000-09-18 23:16:46 +00:00
# include "app.hxx"
2010-01-08 18:32:51 +01:00
# include <editeng/eeitem.hxx>
# include <editeng/editstat.hxx>
# include <editeng/fontitem.hxx>
2009-10-16 00:05:16 +02:00
# include <svl/flagitem.hxx>
2000-09-18 23:16:46 +00:00
# include <svx/svdoattr.hxx>
# include <svx/svdotext.hxx>
2010-01-08 18:32:51 +01:00
# include <editeng/bulitem.hxx>
# include <editeng/numitem.hxx>
2000-09-18 23:16:46 +00:00
# include <svx/svditer.hxx>
2010-01-08 18:32:51 +01:00
# include <editeng/unolingu.hxx>
2009-10-16 00:05:16 +02:00
# include <svl/itempool.hxx>
2000-10-25 09:34:04 +00:00
# include <com/sun/star/lang/XMultiServiceFactory.hpp>
2000-09-18 23:16:46 +00:00
# include <svx/xtable.hxx>
2000-10-25 09:34:04 +00:00
# include <com/sun/star/linguistic2/XHyphenator.hpp>
# include <com/sun/star/linguistic2/XSpellChecker1.hpp>
2000-09-18 23:16:46 +00:00
# include <com/sun/star/beans/XPropertySet.hpp>
2010-01-08 18:32:51 +01:00
# include <editeng/outlobj.hxx>
2009-10-06 07:38:24 +02:00
# include <unotools/saveopt.hxx>
2001-03-19 08:53:25 +00:00
# include <comphelper/extract.hxx>
2006-04-07 14:00:59 +00:00
# include <i18npool/mslangid.hxx>
2000-09-18 23:16:46 +00:00
# include <unotools/charclass.hxx>
2000-11-17 09:56:37 +00:00
# include <comphelper/processfactory.hxx>
2009-10-06 07:38:24 +02:00
# include <unotools/pathoptions.hxx>
# include <unotools/lingucfg.hxx>
# include <unotools/linguprops.hxx>
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"
2004-01-20 09:25:48 +00:00
# include "../ui/inc/DrawDocShell.hxx"
# include "../ui/inc/GraphicDocShell.hxx"
2001-01-19 18:15:28 +00:00
# include "../ui/inc/sdxfer.hxx"
2004-01-20 09:25:48 +00:00
# include "../ui/inc/ViewShell.hxx"
2000-10-09 08:26:51 +00:00
# include "../ui/inc/optsitem.hxx"
2004-01-20 09:25:48 +00:00
# include "../ui/inc/FrameView.hxx"
2000-09-18 23:16:46 +00:00
2001-08-06 07:34:08 +00:00
# include <tools/tenccvt.hxx>
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 ) ,
2006-12-12 15:31:02 +00:00
mbCustomShow ( false ) ,
2004-11-26 18:46:34 +00:00
mbManual ( false ) ,
2006-07-10 10:21:11 +00:00
mbMouseVisible ( false ) ,
2004-11-26 18:46:34 +00:00
mbMouseAsPen ( false ) ,
mbLockedPages ( false ) ,
mbAlwaysOnTop ( false ) ,
mbFullScreen ( true ) ,
mbAnimationAllowed ( true ) ,
mnPauseTimeout ( 10 ) ,
mbShowPauseLogo ( false ) ,
mbStartWithNavigator ( false )
{
}
// ---------------------------------------------------------------------------
PresentationSettings : : PresentationSettings ( const PresentationSettings & r )
: maPresPage ( r . maPresPage ) ,
mbAll ( r . mbAll ) ,
mbEndless ( r . mbEndless ) ,
2006-12-12 15:31:02 +00:00
mbCustomShow ( r . mbCustomShow ) ,
2004-11-26 18:46:34 +00:00
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 ) ,
mbStartWithNavigator ( r . mbStartWithNavigator )
{
}
// ---------------------------------------------------------------------------
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
SdDrawDocument : : SdDrawDocument ( DocumentType eType , SfxObjectShell * pDrDocSh )
: FmFormModel ( SvtPathOptions ( ) . GetPalettePath ( ) , NULL , pDrDocSh )
, mpOutliner ( NULL )
, mpInternalOutliner ( NULL )
, mpWorkStartupTimer ( NULL )
, mpOnlineSpellingTimer ( NULL )
, mpOnlineSpellingList ( NULL )
, mpOnlineSearchItem ( NULL )
, mpCustomShowList ( NULL )
, mpDocSh ( static_cast < : : sd : : DrawDocShell * > ( pDrDocSh ) )
, mpCreatingTransferable ( NULL )
2011-01-17 11:41:00 +01:00
, mbHasOnlineSpellErrors ( sal_False )
, mbInitialOnlineSpellingEnabled ( sal_True )
, mbNewOrLoadCompleted ( sal_False )
2006-12-12 15:31:02 +00:00
, mbStartWithPresentation ( false )
, meLanguage ( LANGUAGE_SYSTEM )
, meLanguageCJK ( LANGUAGE_SYSTEM )
, meLanguageCTL ( LANGUAGE_SYSTEM )
, mePageNumType ( SVX_ARABIC )
2011-01-17 11:41:00 +01:00
, mbAllocDocSh ( sal_False )
2006-12-12 15:31:02 +00:00
, meDocType ( eType )
, mpCharClass ( NULL )
, mpLocale ( NULL )
, mpDrawPageListWatcher ( 0 )
, mpMasterPageListWatcher ( 0 )
2000-09-18 23:16:46 +00:00
{
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
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
2000-09-18 23:16:46 +00:00
{
2011-01-17 11:41:00 +01:00
SetSwapGraphics ( sal_True ) ;
2000-09-18 23:16:46 +00:00
}
// Masseinheit (von App) und Massstab (von SdMod) setzen
2011-01-17 11:41:00 +01:00
sal_Int32 nX , nY ;
2006-12-12 15:31:02 +00:00
SdOptions * pOptions = SD_MOD ( ) - > GetSdOptions ( meDocType ) ;
2000-09-18 23:16:46 +00:00
pOptions - > GetScale ( nX , nY ) ;
2001-09-25 11:09:02 +00:00
2011-02-07 22:11:09 +01:00
// Allow UI scale only for draw documents.
2001-09-25 11:09:02 +00:00
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 ( ) ) ;
2009-09-16 13:55:36 +00:00
SetCalcFieldValueHdl ( & rOutliner ) ;
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
2009-09-17 11:26:03 +00:00
SetLanguage ( MsLangId : : resolveSystemLanguageByScriptType ( aOptions . nDefaultLanguage ,
: : com : : sun : : star : : i18n : : ScriptType : : LATIN ) , EE_CHAR_LANGUAGE ) ;
SetLanguage ( MsLangId : : resolveSystemLanguageByScriptType ( aOptions . nDefaultLanguage_CJK ,
: : com : : sun : : star : : i18n : : ScriptType : : ASIAN ) , EE_CHAR_LANGUAGE_CJK ) ;
SetLanguage ( MsLangId : : resolveSystemLanguageByScriptType ( aOptions . nDefaultLanguage_CTL ,
: : com : : sun : : star : : i18n : : ScriptType : : COMPLEX ) , EE_CHAR_LANGUAGE_CTL ) ;
2002-02-20 10:05:16 +00:00
2006-12-12 15:31:02 +00:00
mbOnlineSpell = aOptions . bIsSpellAuto ;
2000-09-18 23:16:46 +00:00
}
2006-12-12 15:31:02 +00:00
LanguageType eRealLanguage = MsLangId : : getRealLanguage ( meLanguage ) ;
2006-04-07 14:00:59 +00:00
mpLocale = new : : com : : sun : : star : : lang : : Locale ( MsLangId : : convertLanguageToLocale ( eRealLanguage ) ) ;
2000-09-18 23:16:46 +00:00
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 ( ) ;
2006-04-07 14:00:59 +00:00
if ( MsLangId : : isRightToLeft ( 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 ) )
{
2011-01-17 11:41:00 +01:00
GetPool ( ) . GetSecondaryPool ( ) - > SetPoolDefaultItem ( SvxScriptSpaceItem ( sal_False , EE_PARA_ASIANCJKSPACING ) ) ;
2003-12-01 09:07:08 +00:00
}
2000-09-18 23:16:46 +00:00
// DefTab und SpellOptions setzen
// Jetzt am Modul (SD)
2011-01-17 11:41:00 +01:00
sal_uInt16 nDefTab = pOptions - > GetDefTab ( ) ;
2000-09-18 23:16:46 +00:00
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
{
2011-03-01 19:06:55 +01:00
OSL_FAIL ( " Can't get SpellChecker " ) ;
2000-09-18 23:16:46 +00:00
}
2003-06-26 10:11:18 +00:00
rOutliner . SetDefaultLanguage ( Application : : GetSettings ( ) . GetLanguage ( ) ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
2000-09-18 23:16:46 +00:00
{
2010-01-13 22:25:07 +01:00
SetLinkManager ( new sfx2 : : LinkManager ( mpDocSh ) ) ;
2000-09-18 23:16:46 +00:00
}
2001-02-09 12:01:31 +00:00
2011-01-17 11:41:00 +01:00
sal_uLong nCntrl = rOutliner . GetControlWord ( ) ;
2001-02-09 12:01:31 +00:00
nCntrl | = EE_CNTRL_ALLOWBIGOBJS ;
nCntrl | = EE_CNTRL_URLSFXEXECUTE ;
2006-12-12 15:31:02 +00:00
if ( mbOnlineSpell )
2001-02-09 12:01:31 +00:00
nCntrl | = EE_CNTRL_ONLINESPELLING ;
else
nCntrl & = ~ EE_CNTRL_ONLINESPELLING ;
2001-04-24 12:06:10 +00:00
nCntrl & = ~ EE_CNTRL_ULSPACESUMMATION ;
2006-12-12 15:31:02 +00:00
if ( meDocType ! = DOCUMENT_TYPE_IMPRESS )
2001-05-07 12:14:17 +00:00
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 ( ) ) ;
2009-09-16 13:55:36 +00:00
SetCalcFieldValueHdl ( pHitTestOutliner ) ;
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
{
2011-03-01 19:06:55 +01:00
OSL_FAIL ( " Can't get SpellChecker " ) ;
2000-09-18 23:16:46 +00:00
}
2003-06-26 10:11:18 +00:00
pHitTestOutliner - > SetDefaultLanguage ( Application : : GetSettings ( ) . GetLanguage ( ) ) ;
2000-09-18 23:16:46 +00:00
2011-01-17 11:41:00 +01:00
sal_uLong nCntrl2 = pHitTestOutliner - > GetControlWord ( ) ;
2000-09-18 23:16:46 +00:00
nCntrl2 | = EE_CNTRL_ALLOWBIGOBJS ;
nCntrl2 | = EE_CNTRL_URLSFXEXECUTE ;
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 :
*
2011-03-12 20:06:58 +01:00
* Layer STR_LAYOUT : Standardlayer f <EFBFBD> r alle Zeichenobjekte
2000-09-18 23:16:46 +00:00
*
* 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 )
*
2011-03-12 20:06:58 +01:00
* Layer STR_CONTROLS : Standardlayer f <EFBFBD> r Controls
2000-09-18 23:16:46 +00:00
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
{
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 ) ;
}
2006-12-12 15:31:02 +00:00
2000-09-18 23:16:46 +00:00
}
/*************************************************************************
| *
| * 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 ) ) ;
2006-12-12 15:31:02 +00:00
if ( mpWorkStartupTimer )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
if ( mpWorkStartupTimer - > IsActive ( ) )
mpWorkStartupTimer - > Stop ( ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
delete mpWorkStartupTimer ;
mpWorkStartupTimer = NULL ;
2000-09-18 23:16:46 +00:00
}
StopOnlineSpelling ( ) ;
2006-12-12 15:31:02 +00:00
delete mpOnlineSearchItem ;
mpOnlineSearchItem = NULL ;
2000-09-18 23:16:46 +00:00
CloseBookmarkDoc ( ) ;
2011-01-17 11:41:00 +01:00
SetAllocDocSh ( sal_False ) ;
2000-09-18 23:16:46 +00:00
2004-05-10 13:36:46 +00:00
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 ;
}
2011-06-08 15:43:44 -04:30
std : : vector < sd : : FrameView * > : : iterator pIter ;
for ( pIter = maFrameViewList . begin ( ) ; pIter ! = maFrameViewList . end ( ) ; + + pIter )
delete * pIter ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mpCustomShowList )
2000-09-18 23:16:46 +00:00
{
2011-01-17 11:41:00 +01:00
for ( sal_uLong j = 0 ; j < mpCustomShowList - > Count ( ) ; j + + )
2000-09-18 23:16:46 +00:00
{
// Ggf. CustomShows loeschen
2006-12-12 15:31:02 +00:00
SdCustomShow * pCustomShow = ( SdCustomShow * ) mpCustomShowList - > GetObject ( j ) ;
2000-09-18 23:16:46 +00:00
delete pCustomShow ;
}
2006-12-12 15:31:02 +00:00
delete mpCustomShowList ;
mpCustomShowList = NULL ;
2000-09-18 23:16:46 +00:00
}
2006-12-12 15:31:02 +00:00
delete mpOutliner ;
mpOutliner = NULL ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
delete mpInternalOutliner ;
mpInternalOutliner = NULL ;
2000-09-18 23:16:46 +00:00
delete mpLocale ;
mpLocale = NULL ;
delete mpCharClass ;
mpCharClass = NULL ;
}
/*************************************************************************
| *
| * 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 ;
2006-12-12 15:31:02 +00:00
if ( mpCreatingTransferable )
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
2006-12-12 15:31:02 +00:00
if ( meDocType = = DOCUMENT_TYPE_IMPRESS )
mpCreatingTransferable - > SetDocShell ( new : : sd : : DrawDocShell (
2011-01-17 11:41:00 +01:00
SFX_CREATE_MODE_EMBEDDED , sal_True , meDocType ) ) ;
2001-11-23 13:17:09 +00:00
else
2006-12-12 15:31:02 +00:00
mpCreatingTransferable - > SetDocShell ( new : : sd : : GraphicDocShell (
2011-01-17 11:41:00 +01:00
SFX_CREATE_MODE_EMBEDDED , sal_True , meDocType ) ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
pNewDocSh = static_cast < : : sd : : DrawDocShell * > ( pObj = mpCreatingTransferable - > 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 ) ;
2008-03-12 10:25:59 +00:00
pNewStylePool - > CopyCellSheets ( * pOldStylePool ) ;
pNewStylePool - > CopyTableStyles ( * pOldStylePool ) ;
2000-09-18 23:16:46 +00:00
2011-01-17 11:41:00 +01:00
for ( sal_uInt16 i = 0 ; i < GetMasterSdPageCount ( PK_STANDARD ) ; i + + )
2000-09-18 23:16:46 +00:00
{
// 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 ) ) ;
2008-03-12 10:25:59 +00:00
SdStyleSheetVector aCreatedSheets ;
pNewStylePool - > CopyLayoutSheets ( aOldLayoutName , * pOldStylePool , aCreatedSheets ) ;
2000-09-18 23:16:46 +00:00
}
pNewModel - > NewOrLoadCompleted ( DOC_LOADED ) ; // loaded from source document
}
2006-12-12 15:31:02 +00:00
else if ( mbAllocDocSh )
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 ;
2011-01-17 11:41:00 +01:00
pDoc - > SetAllocDocSh ( sal_False ) ;
2006-12-12 15:31:02 +00:00
pDoc - > mxAllocedDocShRef = new : : sd : : DrawDocShell (
2011-01-17 11:41:00 +01:00
SFX_CREATE_MODE_EMBEDDED , sal_True , meDocType ) ;
2006-12-12 15:31:02 +00:00
pDoc - > mxAllocedDocShRef - > DoInitNew ( NULL ) ;
pNewModel = pDoc - > mxAllocedDocShRef - > GetDoc ( ) ;
2000-09-18 23:16:46 +00:00
}
else
{
2006-12-12 15:31:02 +00:00
pNewModel = new SdDrawDocument ( meDocType , NULL ) ;
2000-09-18 23:16:46 +00:00
}
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 ) .
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2010-10-05 07:57:51 -05:00
SdrPage * SdDrawDocument : : AllocPage ( bool bMasterPage )
2000-09-18 23:16:46 +00:00
{
2010-10-05 07:57:51 -05:00
return new SdPage ( * this , NULL , bMasterPage ) ;
2000-09-18 23:16:46 +00:00
}
/*************************************************************************
| *
| * 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
{
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
if ( mbNewOrLoadCompleted & & mpDocSh - > IsEnableSetModified ( ) )
2000-09-18 23:16:46 +00:00
{
// weitergeben an Basisklasse
FmFormModel : : SetChanged ( bFlag ) ;
// an ObjectShell weiterleiten
2006-12-12 15:31:02 +00:00
mpDocSh - > SetModified ( bFlag ) ;
2000-09-18 23:16:46 +00:00
}
}
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
{
2011-02-07 22:11:09 +01:00
// forward to baseclass
2002-07-19 11:06:18 +00:00
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 ( ) ;
2008-03-12 10:25:59 +00:00
CreateDefaultCellStyles ( ) ;
2000-09-18 23:16:46 +00:00
2008-03-12 10:25:59 +00:00
static_cast < SdStyleSheetPool * > ( mxStyleSheetPool . get ( ) ) - > CreatePseudosIfNecessary ( ) ;
2000-09-18 23:16:46 +00:00
}
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 )
2011-01-17 11:41:00 +01:00
RemoveUnnecessaryMasterPages ( NULL , sal_True , sal_False ) ;
2000-09-18 23:16:46 +00:00
2011-01-17 11:41:00 +01:00
for ( sal_uInt16 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
}
}
2011-01-17 11:41:00 +01:00
for ( sal_uInt16 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 ) ;
2000-09-18 23:16:46 +00:00
}
// Sprachabhaengige Namen der StandardLayer erzeugen
RestoreLayerNames ( ) ;
// Sprachabhaengige Namen der Vorlagen setzen
2008-03-12 10:25:59 +00:00
static_cast < SdStyleSheetPool * > ( mxStyleSheetPool . get ( ) ) - > UpdateStdNames ( ) ;
2000-09-18 23:16:46 +00:00
// Ggf. fehlende Vorlagen erzeugen (es gab z.B. frueher keinen Subtitle)
2008-03-12 10:25:59 +00:00
static_cast < SdStyleSheetPool * > ( mxStyleSheetPool . get ( ) ) - > CreatePseudosIfNecessary ( ) ;
2000-09-18 23:16:46 +00:00
}
// Standardvorlage an der Drawing Engine setzen
String aName ( SdResId ( STR_STANDARD_STYLESHEET_NAME ) ) ;
2008-03-12 10:25:59 +00:00
SetDefaultStyleSheet ( static_cast < SfxStyleSheet * > ( mxStyleSheetPool - > Find ( aName , SD_STYLE_FAMILY_GRAPHICS ) ) ) ;
2000-09-18 23:16:46 +00:00
// 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 ( ) ) ;
2011-01-17 11:41:00 +01:00
sal_uLong nCntrl = rDrawOutliner . GetControlWord ( ) ;
2006-12-12 15:31:02 +00:00
if ( mbOnlineSpell )
2000-09-18 23:16:46 +00:00
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 ( ) ) ;
2006-12-12 15:31:02 +00:00
if ( mpOutliner )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
mpOutliner - > SetStyleSheetPool ( ( SfxStyleSheetPool * ) GetStyleSheetPool ( ) ) ;
2000-09-18 23:16:46 +00:00
}
2006-12-12 15:31:02 +00:00
if ( mpInternalOutliner )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
mpInternalOutliner - > SetStyleSheetPool ( ( SfxStyleSheetPool * ) GetStyleSheetPool ( ) ) ;
2000-09-18 23:16:46 +00:00
}
if ( eMode = = DOC_LOADED )
{
// Praesentationsobjekte muessen wieder Listener der entsprechenden
// Vorlagen werden
SdStyleSheetPool * pSPool = ( SdStyleSheetPool * ) GetStyleSheetPool ( ) ;
2011-01-17 11:41:00 +01:00
sal_uInt16 nPage , nPageCount ;
2002-01-09 13:40:05 +00:00
2011-02-07 22:11:09 +01:00
// create missing layout style sheets for broken documents
2002-01-09 13:40:05 +00:00
// 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 ) ;
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
}
}
2011-01-17 11:41:00 +01:00
mbNewOrLoadCompleted = sal_True ;
2000-09-18 23:16:46 +00:00
/**************************************************************************
* Alle gelinkten Pages aktualisieren
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
SdPage * pPage = NULL ;
2011-01-17 11:41:00 +01:00
sal_uInt16 nMaxSdPages = GetSdPageCount ( PK_STANDARD ) ;
2000-09-18 23:16:46 +00:00
2011-01-17 11:41:00 +01:00
for ( sal_uInt16 nSdPage = 0 ; nSdPage < nMaxSdPages ; nSdPage + + )
2000-09-18 23:16:46 +00:00
{
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 ( ) ;
2011-01-17 11:41:00 +01:00
SetChanged ( sal_False ) ;
2001-12-18 14:03:13 +00:00
}
/** 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 )
{
2006-01-10 13:25:20 +00:00
const sd : : ShapeList & rPresentationShapes ( pPage - > GetPresentationShapeList ( ) ) ;
if ( ! rPresentationShapes . isEmpty ( ) )
2004-03-30 14:43:59 +00:00
{
// Listen mit Titel- und Gliederungsvorlagen erstellen
String aName = pPage - > GetLayoutName ( ) ;
aName . Erase ( aName . SearchAscii ( SD_LT_SEPARATOR ) ) ;
2011-03-04 21:49:59 -08:00
std : : vector < SfxStyleSheetBase * > aOutlineList ;
pSPool - > CreateOutlineSheetList ( aName , aOutlineList ) ;
SfxStyleSheet * pTitleSheet = ( SfxStyleSheet * ) pSPool - > GetTitleSheet ( aName ) ;
2004-03-30 14:43:59 +00:00
2006-01-10 13:25:20 +00:00
SdrObject * pObj = rPresentationShapes . getNextShape ( 0 ) ;
2004-03-30 14:43:59 +00:00
// jetzt nach Titel- und Gliederungstextobjekten suchen und
// Objekte zu Listenern machen
2006-01-10 13:25:20 +00:00
while ( pObj )
2004-03-30 14:43:59 +00:00
{
if ( pObj - > GetObjInventor ( ) = = SdrInventor )
{
OutlinerParaObject * pOPO = pObj - > GetOutlinerParaObject ( ) ;
2011-01-17 11:41:00 +01:00
sal_uInt16 nId = pObj - > GetObjIdentifier ( ) ;
2004-03-30 14:43:59 +00:00
if ( nId = = OBJ_TITLETEXT )
{
if ( pOPO & & pOPO - > GetOutlinerMode ( ) = = OUTLINERMODE_DONTKNOW )
pOPO - > SetOutlinerMode ( OUTLINERMODE_TITLEOBJECT ) ;
2011-01-17 11:41:00 +01:00
// sal_True: harte Attribute dabei nicht loeschen
2004-03-30 14:43:59 +00:00
if ( pTitleSheet )
2011-01-17 11:41:00 +01:00
pObj - > SetStyleSheet ( pTitleSheet , sal_True ) ;
2004-03-30 14:43:59 +00:00
}
else if ( nId = = OBJ_OUTLINETEXT )
{
if ( pOPO & & pOPO - > GetOutlinerMode ( ) = = OUTLINERMODE_DONTKNOW )
pOPO - > SetOutlinerMode ( OUTLINERMODE_OUTLINEOBJECT ) ;
2011-03-04 21:49:59 -08:00
std : : vector < SfxStyleSheetBase * > : : iterator iter ;
for ( iter = aOutlineList . begin ( ) ; iter ! = aOutlineList . end ( ) ; + + iter )
2004-03-30 14:43:59 +00:00
{
2011-03-04 21:49:59 -08:00
SfxStyleSheet * pSheet = reinterpret_cast < SfxStyleSheet * > ( * iter ) ;
2004-03-30 14:43:59 +00:00
if ( pSheet )
{
pObj - > StartListening ( * pSheet ) ;
2011-03-04 21:49:59 -08:00
if ( iter = = aOutlineList . begin ( ) )
2004-03-30 14:43:59 +00:00
// Textrahmen hoert auf StyleSheet der Ebene1
2011-01-17 11:41:00 +01:00
pObj - > NbcSetStyleSheet ( pSheet , sal_True ) ;
2004-03-30 14:43:59 +00:00
}
}
}
if ( pObj - > ISA ( SdrTextObj ) & & pObj - > IsEmptyPresObj ( ) & & pPage )
{
2006-01-10 13:25:20 +00:00
PresObjKind ePresObjKind = pPage - > GetPresObjKind ( pObj ) ;
2004-03-30 14:43:59 +00:00
String aString ( pPage - > GetPresObjText ( ePresObjKind ) ) ;
if ( aString . Len ( ) )
{
2011-01-17 11:41:00 +01:00
sd : : Outliner * pInternalOutl = GetInternalOutliner ( sal_True ) ;
2004-03-30 14:43:59 +00:00
pPage - > SetObjText ( ( SdrTextObj * ) pObj , pInternalOutl , ePresObjKind , aString ) ;
2011-01-17 11:41:00 +01:00
pObj - > NbcSetStyleSheet ( pPage - > GetStyleSheetForPresObj ( ePresObjKind ) , sal_True ) ;
2004-03-30 14:43:59 +00:00
pInternalOutl - > Clear ( ) ;
}
}
}
2006-01-10 13:25:20 +00:00
pObj = rPresentationShapes . getNextShape ( pObj ) ;
2004-03-30 14:43:59 +00:00
}
}
}
2000-09-18 23:16:46 +00:00
/*************************************************************************
| *
| * Lokaler Outliner , welcher fuer den Gliederungsmodus verwendet wird
| * In diesen Outliner werden ggf . OutlinerViews inserted !
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2011-01-17 11:41:00 +01:00
: : sd : : Outliner * SdDrawDocument : : GetOutliner ( sal_Bool bCreateOutliner )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
if ( ! mpOutliner & & bCreateOutliner )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
mpOutliner = new : : sd : : Outliner ( this , OUTLINERMODE_TEXTOBJECT ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
mpOutliner - > SetRefDevice ( SD_MOD ( ) - > GetRefDevice ( * mpDocSh ) ) ;
2002-07-26 07:32:44 +00:00
2006-12-12 15:31:02 +00:00
mpOutliner - > SetDefTab ( nDefaultTabulator ) ;
mpOutliner - > SetStyleSheetPool ( ( SfxStyleSheetPool * ) GetStyleSheetPool ( ) ) ;
2000-09-18 23:16:46 +00:00
}
2006-12-12 15:31:02 +00:00
return ( mpOutliner ) ;
2000-09-18 23:16:46 +00:00
}
/*************************************************************************
| *
| * Interner Outliner , welcher fuer die Erzeugung von Textobjekten
| * verwendet wird .
| * In diesen Outliner werden keine OutlinerViews inserted !
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2011-01-17 11:41:00 +01:00
: : sd : : Outliner * SdDrawDocument : : GetInternalOutliner ( sal_Bool bCreateOutliner )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
if ( ! mpInternalOutliner & & bCreateOutliner )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
mpInternalOutliner = 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
2011-01-17 11:41:00 +01:00
// gespeichert werden muessen, kann/soll der Update-Mode immer sal_False bleiben.
mpInternalOutliner - > SetUpdateMode ( sal_False ) ;
mpInternalOutliner - > EnableUndo ( sal_False ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
mpInternalOutliner - > SetRefDevice ( SD_MOD ( ) - > GetRefDevice ( * mpDocSh ) ) ;
2002-07-26 07:32:44 +00:00
2006-12-12 15:31:02 +00:00
mpInternalOutliner - > SetDefTab ( nDefaultTabulator ) ;
mpInternalOutliner - > SetStyleSheetPool ( ( SfxStyleSheetPool * ) GetStyleSheetPool ( ) ) ;
2000-09-18 23:16:46 +00:00
}
2011-01-17 11:41:00 +01:00
DBG_ASSERT ( ! mpInternalOutliner | | ( mpInternalOutliner - > GetUpdateMode ( ) = = sal_False ) , " InternalOutliner: UpdateMode = sal_True ! " ) ;
DBG_ASSERT ( ! mpInternalOutliner | | ( mpInternalOutliner - > IsUndoEnabled ( ) = = sal_False ) , " InternalOutliner: Undo = sal_True ! " ) ;
2000-09-18 23:16:46 +00:00
// MT: Wer ihn vollmuellt, macht ihn auch gleich wieder leer:
// Vorteile:
// a) Keine unnoetigen Clear-Aufrufe
// b) Kein Muell im Speicher.
2006-12-12 15:31:02 +00:00
DBG_ASSERT ( ! mpInternalOutliner | | ( ( mpInternalOutliner - > GetParagraphCount ( ) = = 1 ) & & ( mpInternalOutliner - > GetText ( mpInternalOutliner - > GetParagraph ( 0 ) ) . Len ( ) = = 0 ) ) , " InternalOutliner: Nicht leer! " ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
return mpInternalOutliner ;
2000-09-18 23:16:46 +00:00
}
/*************************************************************************
| *
| * OnlineSpelling ein / aus
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2011-01-17 11:41:00 +01:00
void SdDrawDocument : : SetOnlineSpell ( sal_Bool bIn )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
mbOnlineSpell = bIn ;
2011-01-17 11:41:00 +01:00
sal_uLong nCntrl = 0 ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mpOutliner )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
nCntrl = mpOutliner - > GetControlWord ( ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mbOnlineSpell )
2000-09-18 23:16:46 +00:00
nCntrl | = EE_CNTRL_ONLINESPELLING ;
else
nCntrl & = ~ EE_CNTRL_ONLINESPELLING ;
2006-12-12 15:31:02 +00:00
mpOutliner - > SetControlWord ( nCntrl ) ;
2000-09-18 23:16:46 +00:00
}
2006-12-12 15:31:02 +00:00
if ( mpInternalOutliner )
2000-09-18 23:16:46 +00:00
{
2006-12-12 15:31:02 +00:00
nCntrl = mpInternalOutliner - > GetControlWord ( ) ;
2000-09-18 23:16:46 +00:00
2006-12-12 15:31:02 +00:00
if ( mbOnlineSpell )
2000-09-18 23:16:46 +00:00
nCntrl | = EE_CNTRL_ONLINESPELLING ;
else
nCntrl & = ~ EE_CNTRL_ONLINESPELLING ;
2006-12-12 15:31:02 +00:00
mpInternalOutliner - > SetControlWord ( nCntrl ) ;
2000-09-18 23:16:46 +00:00
}
2004-03-30 14:43:59 +00:00
: : Outliner & rOutliner = GetDrawOutliner ( ) ;
2000-09-18 23:16:46 +00:00
nCntrl = rOutliner . GetControlWord ( ) ;
2006-12-12 15:31:02 +00:00
if ( mbOnlineSpell )
2000-09-18 23:16:46 +00:00
nCntrl | = EE_CNTRL_ONLINESPELLING ;
else
nCntrl & = ~ EE_CNTRL_ONLINESPELLING ;
rOutliner . SetControlWord ( nCntrl ) ;
2006-12-12 15:31:02 +00:00
if ( mbOnlineSpell )
2000-09-18 23:16:46 +00:00
{
StartOnlineSpelling ( ) ;
}
else
{
StopOnlineSpelling ( ) ;
}
}
/*************************************************************************
| *
| * OnlineSpelling : Markierung ein / aus
| *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2000-11-26 18:24:16 +00:00
uno : : Reference < uno : : XInterface > SdDrawDocument : : createUnoModel ( )
{
uno : : Reference < uno : : XInterface > xModel ;
try
{
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
xModel = mpDocSh - > GetModel ( ) ;
2000-11-26 18:24:16 +00:00
}
2006-12-12 15:31:02 +00:00
catch ( uno : : RuntimeException & )
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
{
2006-12-12 15:31:02 +00:00
return mePageNumType ;
2003-04-24 13:35:54 +00:00
}
void SdDrawDocument : : SetPrinterIndependentLayout ( sal_Int32 nMode )
{
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 ;
// Since it is possible that a SdDrawDocument is constructed without a
2006-12-12 15:31:02 +00:00
// SdDrawDocShell the pointer member mpDocSh needs to be tested
2003-04-24 13:35:54 +00:00
// before the call is executed. This is e.-g. used for copy/paste.
2006-12-12 15:31:02 +00:00
if ( mpDocSh )
2003-04-24 13:35:54 +00:00
{
2006-12-12 15:31:02 +00:00
mpDocSh - > UpdateRefDevice ( ) ;
2003-04-24 13:35:54 +00:00
}
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
void SdDrawDocument : : PageListChanged ( )
{
mpDrawPageListWatcher - > Invalidate ( ) ;
}
void SdDrawDocument : : MasterPageListChanged ( )
{
mpMasterPageListWatcher - > Invalidate ( ) ;
}
2009-09-16 13:55:36 +00:00
void SdDrawDocument : : SetCalcFieldValueHdl ( : : Outliner * pOutliner )
{
pOutliner - > SetCalcFieldValueHdl ( LINK ( SD_MOD ( ) , SdModule , CalcFieldValueHdl ) ) ;
}
sal_uInt16 SdDrawDocument : : GetAnnotationAuthorIndex ( const rtl : : OUString & rAuthor )
{
// force current user to have first color
if ( maAnnotationAuthors . empty ( ) )
{
SvtUserOptions aUserOptions ;
maAnnotationAuthors . push_back ( aUserOptions . GetFullName ( ) ) ;
}
sal_uInt16 idx = 0 ;
for ( std : : vector < OUString > : : iterator iter ( maAnnotationAuthors . begin ( ) ) ; iter ! = maAnnotationAuthors . end ( ) ; iter + + )
{
if ( ( * iter ) = = rAuthor )
{
break ;
}
idx + + ;
}
if ( idx = = maAnnotationAuthors . size ( ) )
{
maAnnotationAuthors . push_back ( rAuthor ) ;
}
return idx ;
}
2004-11-26 18:46:34 +00:00
2003-10-27 12:29:26 +00:00
// eof
2010-10-12 15:51:52 +02:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */