1*5b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5b190011SAndrew Rist * distributed with this work for additional information 6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance 9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10*5b190011SAndrew Rist * 11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*5b190011SAndrew Rist * 13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5b190011SAndrew Rist * software distributed under the License is distributed on an 15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the 17*5b190011SAndrew Rist * specific language governing permissions and limitations 18*5b190011SAndrew Rist * under the License. 19*5b190011SAndrew Rist * 20*5b190011SAndrew Rist *************************************************************/ 21*5b190011SAndrew Rist 22*5b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "PageListWatcher.hxx" 28cdf0e10cSrcweir #include <com/sun/star/text/WritingMode.hpp> 29cdf0e10cSrcweir #include <com/sun/star/document/PrinterIndependentLayout.hpp> 30cdf0e10cSrcweir #include <com/sun/star/i18n/ScriptType.hpp> 31cdf0e10cSrcweir #include <editeng/forbiddencharacterstable.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include <svx/svxids.hrc> 34cdf0e10cSrcweir #include <svl/srchitem.hxx> 35cdf0e10cSrcweir #include <editeng/eeitem.hxx> 36cdf0e10cSrcweir #include <editeng/scriptspaceitem.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <unotools/useroptions.hxx> 39cdf0e10cSrcweir 40cdf0e10cSrcweir #include <sfx2/printer.hxx> 41cdf0e10cSrcweir #include <sfx2/app.hxx> 42cdf0e10cSrcweir #include <sfx2/linkmgr.hxx> 43cdf0e10cSrcweir #include <svx/dialogs.hrc> 44cdf0e10cSrcweir #include "Outliner.hxx" 45cdf0e10cSrcweir #include "app.hxx" 46cdf0e10cSrcweir #include <editeng/eeitem.hxx> 47cdf0e10cSrcweir #include <editeng/editstat.hxx> 48cdf0e10cSrcweir #include <editeng/fontitem.hxx> 49cdf0e10cSrcweir #include <svl/flagitem.hxx> 50cdf0e10cSrcweir #include <svx/svdoattr.hxx> 51cdf0e10cSrcweir #include <svx/svdotext.hxx> 52cdf0e10cSrcweir #include <editeng/bulitem.hxx> 53cdf0e10cSrcweir #include <editeng/numitem.hxx> 54cdf0e10cSrcweir #include <svx/svditer.hxx> 55cdf0e10cSrcweir #include <editeng/unolingu.hxx> 56cdf0e10cSrcweir #include <svl/itempool.hxx> 57cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 58cdf0e10cSrcweir #include <svx/xtable.hxx> 59cdf0e10cSrcweir #include <com/sun/star/linguistic2/XHyphenator.hpp> 60cdf0e10cSrcweir #include <com/sun/star/linguistic2/XSpellChecker1.hpp> 61cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 62cdf0e10cSrcweir #include <editeng/outlobj.hxx> 63cdf0e10cSrcweir #include <unotools/saveopt.hxx> 64cdf0e10cSrcweir #include <comphelper/extract.hxx> 65cdf0e10cSrcweir #include <i18npool/mslangid.hxx> 66cdf0e10cSrcweir #include <unotools/charclass.hxx> 67cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 68cdf0e10cSrcweir #ifndef _SVTOOLS_PATHOPTIONS_HXX_ 69cdf0e10cSrcweir #include <unotools/pathoptions.hxx> 70cdf0e10cSrcweir #endif 71cdf0e10cSrcweir #include <unotools/lingucfg.hxx> 72cdf0e10cSrcweir #include <unotools/linguprops.hxx> 73cdf0e10cSrcweir 74cdf0e10cSrcweir #include "eetext.hxx" 75cdf0e10cSrcweir #include "drawdoc.hxx" 76cdf0e10cSrcweir #include "sdpage.hxx" 77cdf0e10cSrcweir #include "pglink.hxx" 78cdf0e10cSrcweir #include "sdattr.hxx" 79cdf0e10cSrcweir #include "glob.hrc" 80cdf0e10cSrcweir #include "glob.hxx" 81cdf0e10cSrcweir #include "stlpool.hxx" 82cdf0e10cSrcweir #include "sdiocmpt.hxx" 83cdf0e10cSrcweir #include "sdresid.hxx" 84cdf0e10cSrcweir #include "cusshow.hxx" 85cdf0e10cSrcweir #include "../ui/inc/DrawDocShell.hxx" 86cdf0e10cSrcweir #include "../ui/inc/GraphicDocShell.hxx" 87cdf0e10cSrcweir #include "../ui/inc/sdxfer.hxx" 88cdf0e10cSrcweir #include "../ui/inc/ViewShell.hxx" 89cdf0e10cSrcweir #include "../ui/inc/optsitem.hxx" 90cdf0e10cSrcweir #include "../ui/inc/FrameView.hxx" 91cdf0e10cSrcweir 92cdf0e10cSrcweir // #90477# 93cdf0e10cSrcweir #include <tools/tenccvt.hxx> 94cdf0e10cSrcweir 95cdf0e10cSrcweir using ::rtl::OUString; 96cdf0e10cSrcweir using namespace ::sd; 97cdf0e10cSrcweir using namespace ::com::sun::star; 98cdf0e10cSrcweir using namespace ::com::sun::star::uno; 99cdf0e10cSrcweir using namespace ::com::sun::star::lang; 100cdf0e10cSrcweir using namespace ::com::sun::star::linguistic2; 101cdf0e10cSrcweir 102cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 103cdf0e10cSrcweir 104cdf0e10cSrcweir TYPEINIT1( SdDrawDocument, FmFormModel ); 105cdf0e10cSrcweir 106cdf0e10cSrcweir SdDrawDocument* SdDrawDocument::pDocLockedInsertingLinks = NULL; 107cdf0e10cSrcweir 108cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 109cdf0e10cSrcweir 110cdf0e10cSrcweir PresentationSettings::PresentationSettings() 111cdf0e10cSrcweir : mbAll( true ), 112cdf0e10cSrcweir mbEndless( false ), 113cdf0e10cSrcweir mbCustomShow(false), 114cdf0e10cSrcweir mbManual( false ), 115cdf0e10cSrcweir mbMouseVisible( false ), 116cdf0e10cSrcweir mbMouseAsPen( false ), 117cdf0e10cSrcweir mbLockedPages( false ), 118cdf0e10cSrcweir mbAlwaysOnTop( false ), 119cdf0e10cSrcweir mbFullScreen( true ), 120cdf0e10cSrcweir mbAnimationAllowed( true ), 121cdf0e10cSrcweir mnPauseTimeout( 10 ), 122cdf0e10cSrcweir mbShowPauseLogo( false ), 123cdf0e10cSrcweir mbStartWithNavigator(false) 124cdf0e10cSrcweir { 125cdf0e10cSrcweir } 126cdf0e10cSrcweir 127cdf0e10cSrcweir // --------------------------------------------------------------------------- 128cdf0e10cSrcweir 129cdf0e10cSrcweir PresentationSettings::PresentationSettings( const PresentationSettings& r ) 130cdf0e10cSrcweir : maPresPage( r.maPresPage ), 131cdf0e10cSrcweir mbAll( r.mbAll ), 132cdf0e10cSrcweir mbEndless( r.mbEndless ), 133cdf0e10cSrcweir mbCustomShow( r.mbCustomShow ), 134cdf0e10cSrcweir mbManual( r.mbManual ), 135cdf0e10cSrcweir mbMouseVisible( r.mbMouseVisible ), 136cdf0e10cSrcweir mbMouseAsPen( r.mbMouseAsPen ), 137cdf0e10cSrcweir mbLockedPages( r.mbLockedPages ), 138cdf0e10cSrcweir mbAlwaysOnTop( r.mbAlwaysOnTop ), 139cdf0e10cSrcweir mbFullScreen( r.mbFullScreen ), 140cdf0e10cSrcweir mbAnimationAllowed( r.mbAnimationAllowed ), 141cdf0e10cSrcweir mnPauseTimeout( r.mnPauseTimeout ), 142cdf0e10cSrcweir mbShowPauseLogo( r.mbShowPauseLogo ), 143cdf0e10cSrcweir mbStartWithNavigator( r.mbStartWithNavigator ) 144cdf0e10cSrcweir { 145cdf0e10cSrcweir } 146cdf0e10cSrcweir 147cdf0e10cSrcweir // --------------------------------------------------------------------------- 148cdf0e10cSrcweir 149cdf0e10cSrcweir SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) 150cdf0e10cSrcweir : FmFormModel( SvtPathOptions().GetPalettePath(), NULL, pDrDocSh ) 151cdf0e10cSrcweir , mpOutliner(NULL) 152cdf0e10cSrcweir , mpInternalOutliner(NULL) 153cdf0e10cSrcweir , mpWorkStartupTimer(NULL) 154cdf0e10cSrcweir , mpOnlineSpellingTimer(NULL) 155cdf0e10cSrcweir , mpOnlineSpellingList(NULL) 156cdf0e10cSrcweir , mpOnlineSearchItem(NULL) 157cdf0e10cSrcweir , mpFrameViewList( new List() ) 158cdf0e10cSrcweir , mpCustomShowList(NULL) 159cdf0e10cSrcweir , mpDocSh(static_cast< ::sd::DrawDocShell*>(pDrDocSh)) 160cdf0e10cSrcweir , mpCreatingTransferable( NULL ) 161cdf0e10cSrcweir , mbHasOnlineSpellErrors(sal_False) 162cdf0e10cSrcweir , mbInitialOnlineSpellingEnabled(sal_True) 163cdf0e10cSrcweir , mbNewOrLoadCompleted(sal_False) 164cdf0e10cSrcweir , mbStartWithPresentation( false ) 165cdf0e10cSrcweir , meLanguage( LANGUAGE_SYSTEM ) 166cdf0e10cSrcweir , meLanguageCJK( LANGUAGE_SYSTEM ) 167cdf0e10cSrcweir , meLanguageCTL( LANGUAGE_SYSTEM ) 168cdf0e10cSrcweir , mePageNumType(SVX_ARABIC) 169cdf0e10cSrcweir , mbAllocDocSh(sal_False) 170cdf0e10cSrcweir , meDocType(eType) 171cdf0e10cSrcweir , mpCharClass(NULL) 172cdf0e10cSrcweir , mpLocale(NULL) 173cdf0e10cSrcweir , mpDrawPageListWatcher(0) 174cdf0e10cSrcweir , mpMasterPageListWatcher(0) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir // #109538# 177cdf0e10cSrcweir mpDrawPageListWatcher = ::std::auto_ptr<ImpDrawPageListWatcher>( 178cdf0e10cSrcweir new ImpDrawPageListWatcher(*this)); 179cdf0e10cSrcweir mpMasterPageListWatcher = ::std::auto_ptr<ImpMasterPageListWatcher>( 180cdf0e10cSrcweir new ImpMasterPageListWatcher(*this)); 181cdf0e10cSrcweir 182cdf0e10cSrcweir SetObjectShell(pDrDocSh); // fuer das VCDrawModel 183cdf0e10cSrcweir 184cdf0e10cSrcweir if (mpDocSh) 185cdf0e10cSrcweir { 186cdf0e10cSrcweir SetSwapGraphics(sal_True); 187cdf0e10cSrcweir } 188cdf0e10cSrcweir 189cdf0e10cSrcweir // Masseinheit (von App) und Massstab (von SdMod) setzen 190cdf0e10cSrcweir sal_Int32 nX, nY; 191cdf0e10cSrcweir SdOptions* pOptions = SD_MOD()->GetSdOptions(meDocType); 192cdf0e10cSrcweir pOptions->GetScale( nX, nY ); 193cdf0e10cSrcweir 194cdf0e10cSrcweir // #92067# Allow UI scale only for draw documents. 195cdf0e10cSrcweir if( eType == DOCUMENT_TYPE_DRAW ) 196cdf0e10cSrcweir SetUIUnit( (FieldUnit)pOptions->GetMetric(), Fraction( nX, nY ) ); // user-defined 197cdf0e10cSrcweir else 198cdf0e10cSrcweir SetUIUnit( (FieldUnit)pOptions->GetMetric(), Fraction( 1, 1 ) ); // default 199cdf0e10cSrcweir 200cdf0e10cSrcweir SetScaleUnit(MAP_100TH_MM); 201cdf0e10cSrcweir SetScaleFraction(Fraction(1, 1)); 202cdf0e10cSrcweir SetDefaultFontHeight(847); // 24p 203cdf0e10cSrcweir 204cdf0e10cSrcweir pItemPool->SetDefaultMetric(SFX_MAPUNIT_100TH_MM); 205cdf0e10cSrcweir pItemPool->FreezeIdRanges(); 206cdf0e10cSrcweir SetTextDefaults(); 207cdf0e10cSrcweir 208cdf0e10cSrcweir // die DrawingEngine muss auch wissen, wo er ist 209cdf0e10cSrcweir FmFormModel::SetStyleSheetPool( new SdStyleSheetPool( GetPool(), this ) ); 210cdf0e10cSrcweir 211cdf0e10cSrcweir // Dem DrawOutliner den StyleSheetPool setzen, damit Textobjekte richtig 212cdf0e10cSrcweir // eingelesen werden koennen. Der Link zum StyleRequest-Handler des 213cdf0e10cSrcweir // Dokuments wird erst in NewOrLoadCompleted gesetzt, da erst dann alle 214cdf0e10cSrcweir // Vorlagen existieren. 215cdf0e10cSrcweir SdrOutliner& rOutliner = GetDrawOutliner(); 216cdf0e10cSrcweir rOutliner.SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); 217cdf0e10cSrcweir SetCalcFieldValueHdl( &rOutliner ); 218cdf0e10cSrcweir 219cdf0e10cSrcweir // set linguistic options 220cdf0e10cSrcweir { 221cdf0e10cSrcweir const SvtLinguConfig aLinguConfig; 222cdf0e10cSrcweir SvtLinguOptions aOptions; 223cdf0e10cSrcweir aLinguConfig.GetOptions( aOptions ); 224cdf0e10cSrcweir 225cdf0e10cSrcweir SetLanguage( MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage, 226cdf0e10cSrcweir ::com::sun::star::i18n::ScriptType::LATIN), EE_CHAR_LANGUAGE ); 227cdf0e10cSrcweir SetLanguage( MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CJK, 228cdf0e10cSrcweir ::com::sun::star::i18n::ScriptType::ASIAN), EE_CHAR_LANGUAGE_CJK ); 229cdf0e10cSrcweir SetLanguage( MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CTL, 230cdf0e10cSrcweir ::com::sun::star::i18n::ScriptType::COMPLEX), EE_CHAR_LANGUAGE_CTL ); 231cdf0e10cSrcweir 232cdf0e10cSrcweir mbOnlineSpell = aOptions.bIsSpellAuto; 233cdf0e10cSrcweir } 234cdf0e10cSrcweir 235cdf0e10cSrcweir LanguageType eRealLanguage = MsLangId::getRealLanguage( meLanguage ); 236cdf0e10cSrcweir mpLocale = new ::com::sun::star::lang::Locale( MsLangId::convertLanguageToLocale( eRealLanguage )); 237cdf0e10cSrcweir mpCharClass = new CharClass( *mpLocale ); 238cdf0e10cSrcweir 239cdf0e10cSrcweir // If the current application language is a language that uses right-to-left text... 240cdf0e10cSrcweir LanguageType eRealCTLLanguage = Application::GetSettings().GetLanguage(); 241cdf0e10cSrcweir if( MsLangId::isRightToLeft( eRealCTLLanguage ) ) 242cdf0e10cSrcweir { 243cdf0e10cSrcweir // ... then we have to set this as a default 244cdf0e10cSrcweir SetDefaultWritingMode( ::com::sun::star::text::WritingMode_RL_TB ); 245cdf0e10cSrcweir } 246cdf0e10cSrcweir 247cdf0e10cSrcweir // for korean and japanese languages we have a different default for apply spacing between asian, latin and ctl text 248cdf0e10cSrcweir if( ( LANGUAGE_KOREAN == eRealCTLLanguage ) || ( LANGUAGE_KOREAN_JOHAB == eRealCTLLanguage ) || ( LANGUAGE_JAPANESE == eRealCTLLanguage ) ) 249cdf0e10cSrcweir { 250cdf0e10cSrcweir GetPool().GetSecondaryPool()->SetPoolDefaultItem( SvxScriptSpaceItem( sal_False, EE_PARA_ASIANCJKSPACING ) ); 251cdf0e10cSrcweir } 252cdf0e10cSrcweir 253cdf0e10cSrcweir // DefTab und SpellOptions setzen 254cdf0e10cSrcweir // Jetzt am Modul (SD) 255cdf0e10cSrcweir sal_uInt16 nDefTab = pOptions->GetDefTab(); 256cdf0e10cSrcweir SetDefaultTabulator( nDefTab ); 257cdf0e10cSrcweir 258cdf0e10cSrcweir try 259cdf0e10cSrcweir { 260cdf0e10cSrcweir Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() ); 261cdf0e10cSrcweir if ( xSpellChecker.is() ) 262cdf0e10cSrcweir rOutliner.SetSpeller( xSpellChecker ); 263cdf0e10cSrcweir 264cdf0e10cSrcweir Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() ); 265cdf0e10cSrcweir if( xHyphenator.is() ) 266cdf0e10cSrcweir rOutliner.SetHyphenator( xHyphenator ); 267cdf0e10cSrcweir 268cdf0e10cSrcweir SetForbiddenCharsTable( new SvxForbiddenCharactersTable( ::comphelper::getProcessServiceFactory() ) ); 269cdf0e10cSrcweir } 270cdf0e10cSrcweir catch(...) 271cdf0e10cSrcweir { 272cdf0e10cSrcweir DBG_ERROR("Can't get SpellChecker"); 273cdf0e10cSrcweir } 274cdf0e10cSrcweir 275cdf0e10cSrcweir rOutliner.SetDefaultLanguage( Application::GetSettings().GetLanguage() ); 276cdf0e10cSrcweir 277cdf0e10cSrcweir if (mpDocSh) 278cdf0e10cSrcweir { 279cdf0e10cSrcweir SetLinkManager( new sfx2::LinkManager(mpDocSh) ); 280cdf0e10cSrcweir } 281cdf0e10cSrcweir 282cdf0e10cSrcweir sal_uLong nCntrl = rOutliner.GetControlWord(); 283cdf0e10cSrcweir nCntrl |= EE_CNTRL_ALLOWBIGOBJS; 284cdf0e10cSrcweir nCntrl |= EE_CNTRL_URLSFXEXECUTE; 285cdf0e10cSrcweir 286cdf0e10cSrcweir if (mbOnlineSpell) 287cdf0e10cSrcweir nCntrl |= EE_CNTRL_ONLINESPELLING; 288cdf0e10cSrcweir else 289cdf0e10cSrcweir nCntrl &= ~EE_CNTRL_ONLINESPELLING; 290cdf0e10cSrcweir 291cdf0e10cSrcweir nCntrl &= ~ EE_CNTRL_ULSPACESUMMATION; 292cdf0e10cSrcweir if ( meDocType != DOCUMENT_TYPE_IMPRESS ) 293cdf0e10cSrcweir SetSummationOfParagraphs( sal_False ); 294cdf0e10cSrcweir else 295cdf0e10cSrcweir { 296cdf0e10cSrcweir SetSummationOfParagraphs( pOptions->IsSummationOfParagraphs() ); 297cdf0e10cSrcweir if ( pOptions->IsSummationOfParagraphs() ) 298cdf0e10cSrcweir nCntrl |= EE_CNTRL_ULSPACESUMMATION; 299cdf0e10cSrcweir } 300cdf0e10cSrcweir rOutliner.SetControlWord(nCntrl); 301cdf0e10cSrcweir 302cdf0e10cSrcweir // Initialize the printer independent layout mode. 303cdf0e10cSrcweir SetPrinterIndependentLayout (pOptions->GetPrinterIndependentLayout()); 304cdf0e10cSrcweir 305cdf0e10cSrcweir // Dem HitTestOutliner den StyleSheetPool setzen. 306cdf0e10cSrcweir // Der Link zum StyleRequest-Handler des 307cdf0e10cSrcweir // Dokuments wird erst in NewOrLoadCompleted gesetzt, da erst dann alle 308cdf0e10cSrcweir // Vorlagen existieren. 309cdf0e10cSrcweir SfxItemSet aSet2( pHitTestOutliner->GetEmptyItemSet() ); 310cdf0e10cSrcweir pHitTestOutliner->SetStyleSheetPool( (SfxStyleSheetPool*)GetStyleSheetPool() ); 311cdf0e10cSrcweir 312cdf0e10cSrcweir SetCalcFieldValueHdl( pHitTestOutliner ); 313cdf0e10cSrcweir 314cdf0e10cSrcweir try 315cdf0e10cSrcweir { 316cdf0e10cSrcweir Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() ); 317cdf0e10cSrcweir if ( xSpellChecker.is() ) 318cdf0e10cSrcweir pHitTestOutliner->SetSpeller( xSpellChecker ); 319cdf0e10cSrcweir 320cdf0e10cSrcweir Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() ); 321cdf0e10cSrcweir if( xHyphenator.is() ) 322cdf0e10cSrcweir pHitTestOutliner->SetHyphenator( xHyphenator ); 323cdf0e10cSrcweir } 324cdf0e10cSrcweir catch(...) 325cdf0e10cSrcweir { 326cdf0e10cSrcweir DBG_ERROR("Can't get SpellChecker"); 327cdf0e10cSrcweir } 328cdf0e10cSrcweir 329cdf0e10cSrcweir pHitTestOutliner->SetDefaultLanguage( Application::GetSettings().GetLanguage() ); 330cdf0e10cSrcweir 331cdf0e10cSrcweir sal_uLong nCntrl2 = pHitTestOutliner->GetControlWord(); 332cdf0e10cSrcweir nCntrl2 |= EE_CNTRL_ALLOWBIGOBJS; 333cdf0e10cSrcweir nCntrl2 |= EE_CNTRL_URLSFXEXECUTE; 334cdf0e10cSrcweir nCntrl2 &= ~EE_CNTRL_ONLINESPELLING; 335cdf0e10cSrcweir 336cdf0e10cSrcweir nCntrl2 &= ~ EE_CNTRL_ULSPACESUMMATION; 337cdf0e10cSrcweir if ( pOptions->IsSummationOfParagraphs() ) 338cdf0e10cSrcweir nCntrl2 |= EE_CNTRL_ULSPACESUMMATION; 339cdf0e10cSrcweir 340cdf0e10cSrcweir pHitTestOutliner->SetControlWord( nCntrl2 ); 341cdf0e10cSrcweir 342cdf0e10cSrcweir /************************************************************************** 343cdf0e10cSrcweir * Layer anlegen 344cdf0e10cSrcweir * 345cdf0e10cSrcweir * Es werden auf Pages und MasterPages folgende Default-Layer angelegt: 346cdf0e10cSrcweir * 347cdf0e10cSrcweir * Layer STR_LAYOUT : Standardlayer f�r alle Zeichenobjekte 348cdf0e10cSrcweir * 349cdf0e10cSrcweir * Layer STR_BCKGRND : Hintergrund der MasterPage 350cdf0e10cSrcweir * (auf normalen Pages z.Z. keine Verwendung) 351cdf0e10cSrcweir * 352cdf0e10cSrcweir * Layer STR_BCKGRNDOBJ: Objekte auf dem Hintergrund der MasterPage 353cdf0e10cSrcweir * (auf normalen Pages z.Z. keine Verwendung) 354cdf0e10cSrcweir * 355cdf0e10cSrcweir * Layer STR_CONTROLS : Standardlayer f�r Controls 356cdf0e10cSrcweir * 357cdf0e10cSrcweir **************************************************************************/ 358cdf0e10cSrcweir { 359cdf0e10cSrcweir String aControlLayerName( SdResId(STR_LAYER_CONTROLS) ); 360cdf0e10cSrcweir 361cdf0e10cSrcweir SdrLayerAdmin& rLayerAdmin = GetLayerAdmin(); 362cdf0e10cSrcweir rLayerAdmin.NewLayer( String(SdResId(STR_LAYER_LAYOUT)) ); 363cdf0e10cSrcweir rLayerAdmin.NewLayer( String(SdResId(STR_LAYER_BCKGRND)) ); 364cdf0e10cSrcweir rLayerAdmin.NewLayer( String(SdResId(STR_LAYER_BCKGRNDOBJ)) ); 365cdf0e10cSrcweir rLayerAdmin.NewLayer( aControlLayerName ); 366cdf0e10cSrcweir rLayerAdmin.NewLayer( String(SdResId(STR_LAYER_MEASURELINES)) ); 367cdf0e10cSrcweir 368cdf0e10cSrcweir rLayerAdmin.SetControlLayerName(aControlLayerName); 369cdf0e10cSrcweir } 370cdf0e10cSrcweir 371cdf0e10cSrcweir 372cdf0e10cSrcweir } 373cdf0e10cSrcweir 374cdf0e10cSrcweir /************************************************************************* 375cdf0e10cSrcweir |* 376cdf0e10cSrcweir |* Destruktor 377cdf0e10cSrcweir |* 378cdf0e10cSrcweir \************************************************************************/ 379cdf0e10cSrcweir 380cdf0e10cSrcweir SdDrawDocument::~SdDrawDocument() 381cdf0e10cSrcweir { 382cdf0e10cSrcweir Broadcast(SdrHint(HINT_MODELCLEARED)); 383cdf0e10cSrcweir 384cdf0e10cSrcweir if (mpWorkStartupTimer) 385cdf0e10cSrcweir { 386cdf0e10cSrcweir if ( mpWorkStartupTimer->IsActive() ) 387cdf0e10cSrcweir mpWorkStartupTimer->Stop(); 388cdf0e10cSrcweir 389cdf0e10cSrcweir delete mpWorkStartupTimer; 390cdf0e10cSrcweir mpWorkStartupTimer = NULL; 391cdf0e10cSrcweir } 392cdf0e10cSrcweir 393cdf0e10cSrcweir StopOnlineSpelling(); 394cdf0e10cSrcweir delete mpOnlineSearchItem; 395cdf0e10cSrcweir mpOnlineSearchItem = NULL; 396cdf0e10cSrcweir 397cdf0e10cSrcweir CloseBookmarkDoc(); 398cdf0e10cSrcweir SetAllocDocSh(sal_False); 399cdf0e10cSrcweir 400cdf0e10cSrcweir // #116168# 401cdf0e10cSrcweir ClearModel(sal_True); 402cdf0e10cSrcweir 403cdf0e10cSrcweir if (pLinkManager) 404cdf0e10cSrcweir { 405cdf0e10cSrcweir // BaseLinks freigeben 406cdf0e10cSrcweir if ( pLinkManager->GetLinks().Count() ) 407cdf0e10cSrcweir { 408cdf0e10cSrcweir pLinkManager->Remove( 0, pLinkManager->GetLinks().Count() ); 409cdf0e10cSrcweir } 410cdf0e10cSrcweir 411cdf0e10cSrcweir delete pLinkManager; 412cdf0e10cSrcweir pLinkManager = NULL; 413cdf0e10cSrcweir } 414cdf0e10cSrcweir 415cdf0e10cSrcweir ::sd::FrameView* pFrameView = NULL; 416cdf0e10cSrcweir 417cdf0e10cSrcweir for (sal_uLong i = 0; i < mpFrameViewList->Count(); i++) 418cdf0e10cSrcweir { 419cdf0e10cSrcweir // Ggf. FrameViews loeschen 420cdf0e10cSrcweir pFrameView = 421cdf0e10cSrcweir static_cast< ::sd::FrameView*>(mpFrameViewList->GetObject(i)); 422cdf0e10cSrcweir 423cdf0e10cSrcweir if (pFrameView) 424cdf0e10cSrcweir delete pFrameView; 425cdf0e10cSrcweir } 426cdf0e10cSrcweir 427cdf0e10cSrcweir delete mpFrameViewList; 428cdf0e10cSrcweir mpFrameViewList = NULL; 429cdf0e10cSrcweir 430cdf0e10cSrcweir if (mpCustomShowList) 431cdf0e10cSrcweir { 432cdf0e10cSrcweir for (sal_uLong j = 0; j < mpCustomShowList->Count(); j++) 433cdf0e10cSrcweir { 434cdf0e10cSrcweir // Ggf. CustomShows loeschen 435cdf0e10cSrcweir SdCustomShow* pCustomShow = (SdCustomShow*) mpCustomShowList->GetObject(j); 436cdf0e10cSrcweir delete pCustomShow; 437cdf0e10cSrcweir } 438cdf0e10cSrcweir 439cdf0e10cSrcweir delete mpCustomShowList; 440cdf0e10cSrcweir mpCustomShowList = NULL; 441cdf0e10cSrcweir } 442cdf0e10cSrcweir 443cdf0e10cSrcweir delete mpOutliner; 444cdf0e10cSrcweir mpOutliner = NULL; 445cdf0e10cSrcweir 446cdf0e10cSrcweir delete mpInternalOutliner; 447cdf0e10cSrcweir mpInternalOutliner = NULL; 448cdf0e10cSrcweir 449cdf0e10cSrcweir delete mpLocale; 450cdf0e10cSrcweir mpLocale = NULL; 451cdf0e10cSrcweir 452cdf0e10cSrcweir delete mpCharClass; 453cdf0e10cSrcweir mpCharClass = NULL; 454cdf0e10cSrcweir } 455cdf0e10cSrcweir 456cdf0e10cSrcweir /************************************************************************* 457cdf0e10cSrcweir |* 458cdf0e10cSrcweir |* Diese Methode erzeugt ein neues Dokument (SdDrawDocument) und gibt einen 459cdf0e10cSrcweir |* Zeiger darauf zurueck. Die Drawing Engine benutzt diese Methode um das 460cdf0e10cSrcweir |* Dokument oder Teile davon ins Clipboard/DragServer stellen zu koennen. 461cdf0e10cSrcweir |* 462cdf0e10cSrcweir \************************************************************************/ 463cdf0e10cSrcweir 464cdf0e10cSrcweir SdrModel* SdDrawDocument::AllocModel() const 465cdf0e10cSrcweir { 466cdf0e10cSrcweir SdDrawDocument* pNewModel = NULL; 467cdf0e10cSrcweir 468cdf0e10cSrcweir if( mpCreatingTransferable ) 469cdf0e10cSrcweir { 470cdf0e10cSrcweir // Dokument wird fuer Drag&Drop/Clipboard erzeugt, dafuer muss dem Dokument eine DocShell (SvPersist) bekannt sein 471cdf0e10cSrcweir SfxObjectShell* pObj = NULL; 472cdf0e10cSrcweir ::sd::DrawDocShell* pNewDocSh = NULL; 473cdf0e10cSrcweir 474cdf0e10cSrcweir if( meDocType == DOCUMENT_TYPE_IMPRESS ) 475cdf0e10cSrcweir mpCreatingTransferable->SetDocShell( new ::sd::DrawDocShell( 476cdf0e10cSrcweir SFX_CREATE_MODE_EMBEDDED, sal_True, meDocType ) ); 477cdf0e10cSrcweir else 478cdf0e10cSrcweir mpCreatingTransferable->SetDocShell( new ::sd::GraphicDocShell( 479cdf0e10cSrcweir SFX_CREATE_MODE_EMBEDDED, sal_True, meDocType ) ); 480cdf0e10cSrcweir 481cdf0e10cSrcweir pNewDocSh = static_cast< ::sd::DrawDocShell*>( pObj = mpCreatingTransferable->GetDocShell() ); 482cdf0e10cSrcweir pNewDocSh->DoInitNew( NULL ); 483cdf0e10cSrcweir pNewModel = pNewDocSh->GetDoc(); 484cdf0e10cSrcweir 485cdf0e10cSrcweir // Nur fuer Clipboard notwendig, 486cdf0e10cSrcweir // fuer Drag&Drop erfolgt dieses im DragServer 487cdf0e10cSrcweir SdStyleSheetPool* pOldStylePool = (SdStyleSheetPool*) GetStyleSheetPool(); 488cdf0e10cSrcweir SdStyleSheetPool* pNewStylePool = (SdStyleSheetPool*) pNewModel->GetStyleSheetPool(); 489cdf0e10cSrcweir 490cdf0e10cSrcweir pNewStylePool->CopyGraphicSheets(*pOldStylePool); 491cdf0e10cSrcweir pNewStylePool->CopyCellSheets(*pOldStylePool); 492cdf0e10cSrcweir pNewStylePool->CopyTableStyles(*pOldStylePool); 493cdf0e10cSrcweir 494cdf0e10cSrcweir 495cdf0e10cSrcweir for (sal_uInt16 i = 0; i < GetMasterSdPageCount(PK_STANDARD); i++) 496cdf0e10cSrcweir { 497cdf0e10cSrcweir // Alle Layouts der MasterPage mitnehmen 498cdf0e10cSrcweir String aOldLayoutName(((SdDrawDocument*) this)->GetMasterSdPage(i, PK_STANDARD)->GetLayoutName()); 499cdf0e10cSrcweir aOldLayoutName.Erase( aOldLayoutName.SearchAscii( SD_LT_SEPARATOR ) ); 500cdf0e10cSrcweir SdStyleSheetVector aCreatedSheets; 501cdf0e10cSrcweir pNewStylePool->CopyLayoutSheets(aOldLayoutName, *pOldStylePool, aCreatedSheets ); 502cdf0e10cSrcweir } 503cdf0e10cSrcweir 504cdf0e10cSrcweir pNewModel->NewOrLoadCompleted( DOC_LOADED ); // loaded from source document 505cdf0e10cSrcweir } 506cdf0e10cSrcweir else if( mbAllocDocSh ) 507cdf0e10cSrcweir { 508cdf0e10cSrcweir // Es wird eine DocShell erzeugt, welche mit GetAllocedDocSh() zurueckgegeben wird 509cdf0e10cSrcweir SdDrawDocument* pDoc = (SdDrawDocument*) this; 510cdf0e10cSrcweir pDoc->SetAllocDocSh(sal_False); 511cdf0e10cSrcweir pDoc->mxAllocedDocShRef = new ::sd::DrawDocShell( 512cdf0e10cSrcweir SFX_CREATE_MODE_EMBEDDED, sal_True, meDocType); 513cdf0e10cSrcweir pDoc->mxAllocedDocShRef->DoInitNew(NULL); 514cdf0e10cSrcweir pNewModel = pDoc->mxAllocedDocShRef->GetDoc(); 515cdf0e10cSrcweir } 516cdf0e10cSrcweir else 517cdf0e10cSrcweir { 518cdf0e10cSrcweir pNewModel = new SdDrawDocument(meDocType, NULL); 519cdf0e10cSrcweir } 520cdf0e10cSrcweir 521cdf0e10cSrcweir return pNewModel; 522cdf0e10cSrcweir } 523cdf0e10cSrcweir 524cdf0e10cSrcweir /************************************************************************* 525cdf0e10cSrcweir |* 526cdf0e10cSrcweir |* Diese Methode erzeugt eine neue Seite (SdPage) und gibt einen Zeiger 527cdf0e10cSrcweir |* darauf zurueck. Die Drawing Engine benutzt diese Methode beim Laden 528cdf0e10cSrcweir |* zur Erzeugung von Seiten (deren Typ sie ja nicht kennt, da es ABLEITUNGEN 529cdf0e10cSrcweir |* der SdrPage sind). 530cdf0e10cSrcweir |* 531cdf0e10cSrcweir \************************************************************************/ 532cdf0e10cSrcweir 533cdf0e10cSrcweir SdrPage* SdDrawDocument::AllocPage(FASTBOOL bMasterPage) 534cdf0e10cSrcweir { 535cdf0e10cSrcweir return new SdPage(*this, NULL, (sal_Bool)bMasterPage); 536cdf0e10cSrcweir } 537cdf0e10cSrcweir 538cdf0e10cSrcweir /************************************************************************* 539cdf0e10cSrcweir |* 540cdf0e10cSrcweir |* SetChanged(), das Model wurde geaendert 541cdf0e10cSrcweir |* 542cdf0e10cSrcweir \************************************************************************/ 543cdf0e10cSrcweir 544cdf0e10cSrcweir void SdDrawDocument::SetChanged(sal_Bool bFlag) 545cdf0e10cSrcweir { 546cdf0e10cSrcweir if (mpDocSh) 547cdf0e10cSrcweir { 548cdf0e10cSrcweir if (mbNewOrLoadCompleted && mpDocSh->IsEnableSetModified()) 549cdf0e10cSrcweir { 550cdf0e10cSrcweir // weitergeben an Basisklasse 551cdf0e10cSrcweir FmFormModel::SetChanged(bFlag); 552cdf0e10cSrcweir 553cdf0e10cSrcweir // an ObjectShell weiterleiten 554cdf0e10cSrcweir mpDocSh->SetModified(bFlag); 555cdf0e10cSrcweir } 556cdf0e10cSrcweir } 557cdf0e10cSrcweir else 558cdf0e10cSrcweir { 559cdf0e10cSrcweir // weitergeben an Basisklasse 560cdf0e10cSrcweir FmFormModel::SetChanged(bFlag); 561cdf0e10cSrcweir } 562cdf0e10cSrcweir } 563cdf0e10cSrcweir 564cdf0e10cSrcweir /************************************************************************* 565cdf0e10cSrcweir |* 566cdf0e10cSrcweir |* NbcSetChanged(), the model changed, don't call anybody else 567cdf0e10cSrcweir |* 568cdf0e10cSrcweir \************************************************************************/ 569cdf0e10cSrcweir 570cdf0e10cSrcweir void SdDrawDocument::NbcSetChanged(sal_Bool bFlag) 571cdf0e10cSrcweir { 572cdf0e10cSrcweir // #100237# forward to baseclass 573cdf0e10cSrcweir FmFormModel::SetChanged(bFlag); 574cdf0e10cSrcweir } 575cdf0e10cSrcweir 576cdf0e10cSrcweir /************************************************************************* 577cdf0e10cSrcweir |* 578cdf0e10cSrcweir |* NewOrLoadCompleted 579cdf0e10cSrcweir |* 580cdf0e10cSrcweir |* Wird gerufen, wenn das Dokument geladen wurde bzw. feststeht, dass es 581cdf0e10cSrcweir |* nicht mehr geladen wird. 582cdf0e10cSrcweir |* 583cdf0e10cSrcweir \************************************************************************/ 584cdf0e10cSrcweir 585cdf0e10cSrcweir void SdDrawDocument::NewOrLoadCompleted(DocCreationMode eMode) 586cdf0e10cSrcweir { 587cdf0e10cSrcweir if (eMode == NEW_DOC) 588cdf0e10cSrcweir { 589cdf0e10cSrcweir // Neues Dokument: 590cdf0e10cSrcweir // Praesentations- und Standardvorlagen erzeugen, 591cdf0e10cSrcweir // Pool fuer virtuelle Controls erzeugen 592cdf0e10cSrcweir CreateLayoutTemplates(); 593cdf0e10cSrcweir CreateDefaultCellStyles(); 594cdf0e10cSrcweir 595cdf0e10cSrcweir static_cast< SdStyleSheetPool* >( mxStyleSheetPool.get() )->CreatePseudosIfNecessary(); 596cdf0e10cSrcweir } 597cdf0e10cSrcweir else if (eMode == DOC_LOADED) 598cdf0e10cSrcweir { 599cdf0e10cSrcweir // Dokument wurde geladen: 600cdf0e10cSrcweir 601cdf0e10cSrcweir CheckMasterPages(); 602cdf0e10cSrcweir 603cdf0e10cSrcweir if ( GetMasterSdPageCount(PK_STANDARD) > 1 ) 604cdf0e10cSrcweir RemoveUnnecessaryMasterPages( NULL, sal_True, sal_False ); 605cdf0e10cSrcweir 606cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < GetPageCount(); i++ ) 607cdf0e10cSrcweir { 608cdf0e10cSrcweir // Check for correct layout names 609cdf0e10cSrcweir SdPage* pPage = (SdPage*) GetPage( i ); 610cdf0e10cSrcweir 611cdf0e10cSrcweir if(pPage->TRG_HasMasterPage()) 612cdf0e10cSrcweir { 613cdf0e10cSrcweir SdPage& rMaster = (SdPage&)pPage->TRG_GetMasterPage(); 614cdf0e10cSrcweir 615cdf0e10cSrcweir if(rMaster.GetLayoutName() != pPage->GetLayoutName()) 616cdf0e10cSrcweir { 617cdf0e10cSrcweir pPage->SetLayoutName(rMaster.GetLayoutName()); 618cdf0e10cSrcweir } 619cdf0e10cSrcweir } 620cdf0e10cSrcweir } 621cdf0e10cSrcweir 622cdf0e10cSrcweir for ( sal_uInt16 nPage = 0; nPage < GetMasterPageCount(); nPage++) 623cdf0e10cSrcweir { 624cdf0e10cSrcweir // LayoutName and PageName must be the same 625cdf0e10cSrcweir SdPage* pPage = (SdPage*) GetMasterPage( nPage ); 626cdf0e10cSrcweir 627cdf0e10cSrcweir String aName( pPage->GetLayoutName() ); 628cdf0e10cSrcweir aName.Erase( aName.SearchAscii( SD_LT_SEPARATOR ) ); 629cdf0e10cSrcweir 630cdf0e10cSrcweir if( aName != pPage->GetName() ) 631cdf0e10cSrcweir pPage->SetName( aName ); 632cdf0e10cSrcweir } 633cdf0e10cSrcweir 634cdf0e10cSrcweir // Sprachabhaengige Namen der StandardLayer erzeugen 635cdf0e10cSrcweir RestoreLayerNames(); 636cdf0e10cSrcweir 637cdf0e10cSrcweir // Sprachabhaengige Namen der Vorlagen setzen 638cdf0e10cSrcweir static_cast<SdStyleSheetPool*>(mxStyleSheetPool.get())->UpdateStdNames(); 639cdf0e10cSrcweir 640cdf0e10cSrcweir // Ggf. fehlende Vorlagen erzeugen (es gab z.B. frueher keinen Subtitle) 641cdf0e10cSrcweir static_cast<SdStyleSheetPool*>(mxStyleSheetPool.get())->CreatePseudosIfNecessary(); 642cdf0e10cSrcweir } 643cdf0e10cSrcweir 644cdf0e10cSrcweir // Standardvorlage an der Drawing Engine setzen 645cdf0e10cSrcweir String aName( SdResId(STR_STANDARD_STYLESHEET_NAME)); 646cdf0e10cSrcweir SetDefaultStyleSheet(static_cast<SfxStyleSheet*>(mxStyleSheetPool->Find(aName, SD_STYLE_FAMILY_GRAPHICS))); 647cdf0e10cSrcweir 648cdf0e10cSrcweir // Draw-Outliner und Dokument Outliner initialisieren, 649cdf0e10cSrcweir // aber nicht den globalen Outliner, den der ist ja nicht 650cdf0e10cSrcweir // dokumentspezifisch wie StyleSheetPool und StyleRequestHandler 651cdf0e10cSrcweir ::Outliner& rDrawOutliner = GetDrawOutliner(); 652cdf0e10cSrcweir rDrawOutliner.SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); 653cdf0e10cSrcweir sal_uLong nCntrl = rDrawOutliner.GetControlWord(); 654cdf0e10cSrcweir if (mbOnlineSpell) 655cdf0e10cSrcweir nCntrl |= EE_CNTRL_ONLINESPELLING; 656cdf0e10cSrcweir else 657cdf0e10cSrcweir nCntrl &= ~EE_CNTRL_ONLINESPELLING; 658cdf0e10cSrcweir rDrawOutliner.SetControlWord(nCntrl); 659cdf0e10cSrcweir 660cdf0e10cSrcweir // HitTest-Outliner und Dokument Outliner initialisieren, 661cdf0e10cSrcweir // aber nicht den globalen Outliner, den der ist ja nicht 662cdf0e10cSrcweir // dokumentspezifisch wie StyleSheetPool und StyleRequestHandler 663cdf0e10cSrcweir pHitTestOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); 664cdf0e10cSrcweir 665cdf0e10cSrcweir if(mpOutliner) 666cdf0e10cSrcweir { 667cdf0e10cSrcweir mpOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); 668cdf0e10cSrcweir } 669cdf0e10cSrcweir if(mpInternalOutliner) 670cdf0e10cSrcweir { 671cdf0e10cSrcweir mpInternalOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); 672cdf0e10cSrcweir } 673cdf0e10cSrcweir 674cdf0e10cSrcweir if ( eMode == DOC_LOADED ) 675cdf0e10cSrcweir { 676cdf0e10cSrcweir // Praesentationsobjekte muessen wieder Listener der entsprechenden 677cdf0e10cSrcweir // Vorlagen werden 678cdf0e10cSrcweir SdStyleSheetPool* pSPool = (SdStyleSheetPool*) GetStyleSheetPool(); 679cdf0e10cSrcweir sal_uInt16 nPage, nPageCount; 680cdf0e10cSrcweir 681cdf0e10cSrcweir // #96323# create missing layout style sheets for broken documents 682cdf0e10cSrcweir // that where created with the 5.2 683cdf0e10cSrcweir nPageCount = GetMasterSdPageCount( PK_STANDARD ); 684cdf0e10cSrcweir for (nPage = 0; nPage < nPageCount; nPage++) 685cdf0e10cSrcweir { 686cdf0e10cSrcweir SdPage* pPage = GetMasterSdPage(nPage, PK_STANDARD); 687cdf0e10cSrcweir pSPool->CreateLayoutStyleSheets( pPage->GetName(), sal_True ); 688cdf0e10cSrcweir } 689cdf0e10cSrcweir 690cdf0e10cSrcweir // Standard- und Notizseiten: 691cdf0e10cSrcweir for (nPage = 0; nPage < GetPageCount(); nPage++) 692cdf0e10cSrcweir { 693cdf0e10cSrcweir SdPage* pPage = (SdPage*)GetPage(nPage); 694cdf0e10cSrcweir NewOrLoadCompleted( pPage, pSPool ); 695cdf0e10cSrcweir } 696cdf0e10cSrcweir 697cdf0e10cSrcweir // Masterpages: 698cdf0e10cSrcweir for (nPage = 0; nPage < GetMasterPageCount(); nPage++) 699cdf0e10cSrcweir { 700cdf0e10cSrcweir SdPage* pPage = (SdPage*)GetMasterPage(nPage); 701cdf0e10cSrcweir 702cdf0e10cSrcweir NewOrLoadCompleted( pPage, pSPool ); 703cdf0e10cSrcweir } 704cdf0e10cSrcweir } 705cdf0e10cSrcweir 706cdf0e10cSrcweir mbNewOrLoadCompleted = sal_True; 707cdf0e10cSrcweir 708cdf0e10cSrcweir /************************************************************************** 709cdf0e10cSrcweir * Alle gelinkten Pages aktualisieren 710cdf0e10cSrcweir **************************************************************************/ 711cdf0e10cSrcweir SdPage* pPage = NULL; 712cdf0e10cSrcweir sal_uInt16 nMaxSdPages = GetSdPageCount(PK_STANDARD); 713cdf0e10cSrcweir 714cdf0e10cSrcweir for (sal_uInt16 nSdPage=0; nSdPage < nMaxSdPages; nSdPage++) 715cdf0e10cSrcweir { 716cdf0e10cSrcweir pPage = (SdPage*) GetSdPage(nSdPage, PK_STANDARD); 717cdf0e10cSrcweir 718cdf0e10cSrcweir if (pPage && pPage->GetFileName().Len() && pPage->GetBookmarkName().Len()) 719cdf0e10cSrcweir { 720cdf0e10cSrcweir pPage->SetModel(this); 721cdf0e10cSrcweir } 722cdf0e10cSrcweir } 723cdf0e10cSrcweir 724cdf0e10cSrcweir UpdateAllLinks(); 725cdf0e10cSrcweir 726cdf0e10cSrcweir SetChanged( sal_False ); 727cdf0e10cSrcweir } 728cdf0e10cSrcweir 729cdf0e10cSrcweir /** updates all links, only links in this document should by resolved */ 730cdf0e10cSrcweir void SdDrawDocument::UpdateAllLinks() 731cdf0e10cSrcweir { 732cdf0e10cSrcweir if ( !pDocLockedInsertingLinks && pLinkManager && pLinkManager->GetLinks().Count() ) 733cdf0e10cSrcweir { 734cdf0e10cSrcweir pDocLockedInsertingLinks = this; // lock inserting links. only links in this document should by resolved 735cdf0e10cSrcweir 736cdf0e10cSrcweir pLinkManager->UpdateAllLinks(); // query box: update all links? 737cdf0e10cSrcweir 738cdf0e10cSrcweir if( pDocLockedInsertingLinks == this ) 739cdf0e10cSrcweir pDocLockedInsertingLinks = NULL; // unlock inserting links 740cdf0e10cSrcweir } 741cdf0e10cSrcweir } 742cdf0e10cSrcweir 743cdf0e10cSrcweir /** this loops over the presentation objectes of a page and repairs some new settings 744cdf0e10cSrcweir from old binary files and resets all default strings for empty presentation objects. 745cdf0e10cSrcweir */ 746cdf0e10cSrcweir void SdDrawDocument::NewOrLoadCompleted( SdPage* pPage, SdStyleSheetPool* pSPool ) 747cdf0e10cSrcweir { 748cdf0e10cSrcweir /* cl removed because not needed anymore since binfilter 749cdf0e10cSrcweir SdrObjListIter aShapeIter( *pPage ); 750cdf0e10cSrcweir while( aShapeIter.IsMore() ) 751cdf0e10cSrcweir { 752cdf0e10cSrcweir OutlinerParaObject* pOPO = aShapeIter.Next()->GetOutlinerParaObject(); 753cdf0e10cSrcweir if( pOPO ) 754cdf0e10cSrcweir { 755cdf0e10cSrcweir if( pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW ) 756cdf0e10cSrcweir pOPO->SetOutlinerMode( OUTLINERMODE_TEXTOBJECT ); 757cdf0e10cSrcweir 758cdf0e10cSrcweir pOPO->FinishLoad( pSPool ); 759cdf0e10cSrcweir } 760cdf0e10cSrcweir } 761cdf0e10cSrcweir */ 762cdf0e10cSrcweir 763cdf0e10cSrcweir const sd::ShapeList& rPresentationShapes( pPage->GetPresentationShapeList() ); 764cdf0e10cSrcweir if(!rPresentationShapes.isEmpty()) 765cdf0e10cSrcweir { 766cdf0e10cSrcweir // Listen mit Titel- und Gliederungsvorlagen erstellen 767cdf0e10cSrcweir String aName = pPage->GetLayoutName(); 768cdf0e10cSrcweir aName.Erase( aName.SearchAscii( SD_LT_SEPARATOR )); 769cdf0e10cSrcweir 770cdf0e10cSrcweir List* pOutlineList = pSPool->CreateOutlineSheetList(aName); 771cdf0e10cSrcweir SfxStyleSheet* pTitleSheet = (SfxStyleSheet*) 772cdf0e10cSrcweir pSPool->GetTitleSheet(aName); 773cdf0e10cSrcweir 774cdf0e10cSrcweir SdrObject* pObj = rPresentationShapes.getNextShape(0); 775cdf0e10cSrcweir 776cdf0e10cSrcweir // jetzt nach Titel- und Gliederungstextobjekten suchen und 777cdf0e10cSrcweir // Objekte zu Listenern machen 778cdf0e10cSrcweir while(pObj) 779cdf0e10cSrcweir { 780cdf0e10cSrcweir if (pObj->GetObjInventor() == SdrInventor) 781cdf0e10cSrcweir { 782cdf0e10cSrcweir OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject(); 783cdf0e10cSrcweir sal_uInt16 nId = pObj->GetObjIdentifier(); 784cdf0e10cSrcweir 785cdf0e10cSrcweir if (nId == OBJ_TITLETEXT) 786cdf0e10cSrcweir { 787cdf0e10cSrcweir if( pOPO && pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW ) 788cdf0e10cSrcweir pOPO->SetOutlinerMode( OUTLINERMODE_TITLEOBJECT ); 789cdf0e10cSrcweir 790cdf0e10cSrcweir // sal_True: harte Attribute dabei nicht loeschen 791cdf0e10cSrcweir if (pTitleSheet) 792cdf0e10cSrcweir pObj->SetStyleSheet(pTitleSheet, sal_True); 793cdf0e10cSrcweir } 794cdf0e10cSrcweir else if (nId == OBJ_OUTLINETEXT) 795cdf0e10cSrcweir { 796cdf0e10cSrcweir if( pOPO && pOPO->GetOutlinerMode() == OUTLINERMODE_DONTKNOW ) 797cdf0e10cSrcweir pOPO->SetOutlinerMode( OUTLINERMODE_OUTLINEOBJECT ); 798cdf0e10cSrcweir 799cdf0e10cSrcweir for (sal_uInt16 nSheet = 0; nSheet < 10; nSheet++) 800cdf0e10cSrcweir { 801cdf0e10cSrcweir SfxStyleSheet* pSheet = (SfxStyleSheet*)pOutlineList->GetObject(nSheet); 802cdf0e10cSrcweir if (pSheet) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir pObj->StartListening(*pSheet); 805cdf0e10cSrcweir 806cdf0e10cSrcweir if( nSheet == 0) 807cdf0e10cSrcweir // Textrahmen hoert auf StyleSheet der Ebene1 808cdf0e10cSrcweir pObj->NbcSetStyleSheet(pSheet, sal_True); 809cdf0e10cSrcweir } 810cdf0e10cSrcweir } 811cdf0e10cSrcweir } 812cdf0e10cSrcweir 813cdf0e10cSrcweir if (pObj->ISA(SdrTextObj) && pObj->IsEmptyPresObj() && pPage) 814cdf0e10cSrcweir { 815cdf0e10cSrcweir PresObjKind ePresObjKind = pPage->GetPresObjKind(pObj); 816cdf0e10cSrcweir String aString( pPage->GetPresObjText(ePresObjKind) ); 817cdf0e10cSrcweir 818cdf0e10cSrcweir if (aString.Len()) 819cdf0e10cSrcweir { 820cdf0e10cSrcweir sd::Outliner* pInternalOutl = GetInternalOutliner(sal_True); 821cdf0e10cSrcweir pPage->SetObjText( (SdrTextObj*) pObj, pInternalOutl, ePresObjKind, aString ); 822cdf0e10cSrcweir pObj->NbcSetStyleSheet( pPage->GetStyleSheetForPresObj( ePresObjKind ), sal_True ); 823cdf0e10cSrcweir pInternalOutl->Clear(); 824cdf0e10cSrcweir } 825cdf0e10cSrcweir } 826cdf0e10cSrcweir } 827cdf0e10cSrcweir 828cdf0e10cSrcweir pObj = rPresentationShapes.getNextShape(pObj); 829cdf0e10cSrcweir } 830cdf0e10cSrcweir 831cdf0e10cSrcweir delete pOutlineList; 832cdf0e10cSrcweir } 833cdf0e10cSrcweir } 834cdf0e10cSrcweir 835cdf0e10cSrcweir /************************************************************************* 836cdf0e10cSrcweir |* 837cdf0e10cSrcweir |* Lokaler Outliner, welcher fuer den Gliederungsmodus verwendet wird 838cdf0e10cSrcweir |* In diesen Outliner werden ggf. OutlinerViews inserted! 839cdf0e10cSrcweir |* 840cdf0e10cSrcweir \************************************************************************/ 841cdf0e10cSrcweir 842cdf0e10cSrcweir ::sd::Outliner* SdDrawDocument::GetOutliner(sal_Bool bCreateOutliner) 843cdf0e10cSrcweir { 844cdf0e10cSrcweir if (!mpOutliner && bCreateOutliner) 845cdf0e10cSrcweir { 846cdf0e10cSrcweir mpOutliner = new ::sd::Outliner( this, OUTLINERMODE_TEXTOBJECT ); 847cdf0e10cSrcweir 848cdf0e10cSrcweir if (mpDocSh) 849cdf0e10cSrcweir mpOutliner->SetRefDevice( SD_MOD()->GetRefDevice( *mpDocSh ) ); 850cdf0e10cSrcweir 851cdf0e10cSrcweir mpOutliner->SetDefTab( nDefaultTabulator ); 852cdf0e10cSrcweir mpOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); 853cdf0e10cSrcweir } 854cdf0e10cSrcweir 855cdf0e10cSrcweir return(mpOutliner); 856cdf0e10cSrcweir } 857cdf0e10cSrcweir 858cdf0e10cSrcweir 859cdf0e10cSrcweir /************************************************************************* 860cdf0e10cSrcweir |* 861cdf0e10cSrcweir |* Interner Outliner, welcher fuer die Erzeugung von Textobjekten 862cdf0e10cSrcweir |* verwendet wird. 863cdf0e10cSrcweir |* In diesen Outliner werden keine OutlinerViews inserted! 864cdf0e10cSrcweir |* 865cdf0e10cSrcweir \************************************************************************/ 866cdf0e10cSrcweir 867cdf0e10cSrcweir ::sd::Outliner* SdDrawDocument::GetInternalOutliner(sal_Bool bCreateOutliner) 868cdf0e10cSrcweir { 869cdf0e10cSrcweir if ( !mpInternalOutliner && bCreateOutliner ) 870cdf0e10cSrcweir { 871cdf0e10cSrcweir mpInternalOutliner = new ::sd::Outliner( this, OUTLINERMODE_TEXTOBJECT ); 872cdf0e10cSrcweir // MT: 873cdf0e10cSrcweir // Dieser Outliner wird nur fuer das Erzeugen spezieller Textobjekte 874cdf0e10cSrcweir // verwendet. Da in diesen Textobjekten keine Portion-Informationen 875cdf0e10cSrcweir // gespeichert werden muessen, kann/soll der Update-Mode immer sal_False bleiben. 876cdf0e10cSrcweir mpInternalOutliner->SetUpdateMode( sal_False ); 877cdf0e10cSrcweir mpInternalOutliner->EnableUndo( sal_False ); 878cdf0e10cSrcweir 879cdf0e10cSrcweir if (mpDocSh) 880cdf0e10cSrcweir mpInternalOutliner->SetRefDevice( SD_MOD()->GetRefDevice( *mpDocSh ) ); 881cdf0e10cSrcweir 882cdf0e10cSrcweir mpInternalOutliner->SetDefTab( nDefaultTabulator ); 883cdf0e10cSrcweir mpInternalOutliner->SetStyleSheetPool((SfxStyleSheetPool*)GetStyleSheetPool()); 884cdf0e10cSrcweir } 885cdf0e10cSrcweir 886cdf0e10cSrcweir DBG_ASSERT( !mpInternalOutliner || ( mpInternalOutliner->GetUpdateMode() == sal_False ) , "InternalOutliner: UpdateMode = sal_True !" ); 887cdf0e10cSrcweir DBG_ASSERT( !mpInternalOutliner || ( mpInternalOutliner->IsUndoEnabled() == sal_False ), "InternalOutliner: Undo = sal_True !" ); 888cdf0e10cSrcweir 889cdf0e10cSrcweir // MT: Wer ihn vollmuellt, macht ihn auch gleich wieder leer: 890cdf0e10cSrcweir // Vorteile: 891cdf0e10cSrcweir // a) Keine unnoetigen Clear-Aufrufe 892cdf0e10cSrcweir // b) Kein Muell im Speicher. 893cdf0e10cSrcweir DBG_ASSERT( !mpInternalOutliner || ( ( mpInternalOutliner->GetParagraphCount() == 1 ) && ( mpInternalOutliner->GetText( mpInternalOutliner->GetParagraph( 0 ) ).Len() == 0 ) ), "InternalOutliner: Nicht leer!" ); 894cdf0e10cSrcweir 895cdf0e10cSrcweir return mpInternalOutliner; 896cdf0e10cSrcweir } 897cdf0e10cSrcweir 898cdf0e10cSrcweir /************************************************************************* 899cdf0e10cSrcweir |* 900cdf0e10cSrcweir |* OnlineSpelling ein/aus 901cdf0e10cSrcweir |* 902cdf0e10cSrcweir \************************************************************************/ 903cdf0e10cSrcweir 904cdf0e10cSrcweir void SdDrawDocument::SetOnlineSpell(sal_Bool bIn) 905cdf0e10cSrcweir { 906cdf0e10cSrcweir mbOnlineSpell = bIn; 907cdf0e10cSrcweir sal_uLong nCntrl = 0; 908cdf0e10cSrcweir 909cdf0e10cSrcweir if(mpOutliner) 910cdf0e10cSrcweir { 911cdf0e10cSrcweir nCntrl = mpOutliner->GetControlWord(); 912cdf0e10cSrcweir 913cdf0e10cSrcweir if(mbOnlineSpell) 914cdf0e10cSrcweir nCntrl |= EE_CNTRL_ONLINESPELLING; 915cdf0e10cSrcweir else 916cdf0e10cSrcweir nCntrl &= ~EE_CNTRL_ONLINESPELLING; 917cdf0e10cSrcweir 918cdf0e10cSrcweir mpOutliner->SetControlWord(nCntrl); 919cdf0e10cSrcweir } 920cdf0e10cSrcweir 921cdf0e10cSrcweir if (mpInternalOutliner) 922cdf0e10cSrcweir { 923cdf0e10cSrcweir nCntrl = mpInternalOutliner->GetControlWord(); 924cdf0e10cSrcweir 925cdf0e10cSrcweir if (mbOnlineSpell) 926cdf0e10cSrcweir nCntrl |= EE_CNTRL_ONLINESPELLING; 927cdf0e10cSrcweir else 928cdf0e10cSrcweir nCntrl &= ~EE_CNTRL_ONLINESPELLING; 929cdf0e10cSrcweir 930cdf0e10cSrcweir mpInternalOutliner->SetControlWord(nCntrl); 931cdf0e10cSrcweir } 932cdf0e10cSrcweir 933cdf0e10cSrcweir ::Outliner& rOutliner = GetDrawOutliner(); 934cdf0e10cSrcweir 935cdf0e10cSrcweir nCntrl = rOutliner.GetControlWord(); 936cdf0e10cSrcweir 937cdf0e10cSrcweir if (mbOnlineSpell) 938cdf0e10cSrcweir nCntrl |= EE_CNTRL_ONLINESPELLING; 939cdf0e10cSrcweir else 940cdf0e10cSrcweir nCntrl &= ~EE_CNTRL_ONLINESPELLING; 941cdf0e10cSrcweir 942cdf0e10cSrcweir rOutliner.SetControlWord(nCntrl); 943cdf0e10cSrcweir 944cdf0e10cSrcweir if (mbOnlineSpell) 945cdf0e10cSrcweir { 946cdf0e10cSrcweir StartOnlineSpelling(); 947cdf0e10cSrcweir } 948cdf0e10cSrcweir else 949cdf0e10cSrcweir { 950cdf0e10cSrcweir StopOnlineSpelling(); 951cdf0e10cSrcweir } 952cdf0e10cSrcweir } 953cdf0e10cSrcweir 954cdf0e10cSrcweir 955cdf0e10cSrcweir /************************************************************************* 956cdf0e10cSrcweir |* 957cdf0e10cSrcweir |* OnlineSpelling: Markierung ein/aus 958cdf0e10cSrcweir |* 959cdf0e10cSrcweir \************************************************************************/ 960cdf0e10cSrcweir 961cdf0e10cSrcweir uno::Reference< uno::XInterface > SdDrawDocument::createUnoModel() 962cdf0e10cSrcweir { 963cdf0e10cSrcweir uno::Reference< uno::XInterface > xModel; 964cdf0e10cSrcweir 965cdf0e10cSrcweir try 966cdf0e10cSrcweir { 967cdf0e10cSrcweir if ( mpDocSh ) 968cdf0e10cSrcweir xModel = mpDocSh->GetModel(); 969cdf0e10cSrcweir } 970cdf0e10cSrcweir catch( uno::RuntimeException& ) 971cdf0e10cSrcweir { 972cdf0e10cSrcweir } 973cdf0e10cSrcweir 974cdf0e10cSrcweir return xModel; 975cdf0e10cSrcweir } 976cdf0e10cSrcweir 977cdf0e10cSrcweir SvxNumType SdDrawDocument::GetPageNumType() const 978cdf0e10cSrcweir { 979cdf0e10cSrcweir return mePageNumType; 980cdf0e10cSrcweir } 981cdf0e10cSrcweir 982cdf0e10cSrcweir 983cdf0e10cSrcweir 984cdf0e10cSrcweir 985cdf0e10cSrcweir void SdDrawDocument::SetPrinterIndependentLayout (sal_Int32 nMode) 986cdf0e10cSrcweir { 987cdf0e10cSrcweir // #108104# 988cdf0e10cSrcweir // DBG_ASSERT (mpDocSh!=NULL, "No available document shell to set ref device at."); 989cdf0e10cSrcweir 990cdf0e10cSrcweir switch (nMode) 991cdf0e10cSrcweir { 992cdf0e10cSrcweir case ::com::sun::star::document::PrinterIndependentLayout::DISABLED: 993cdf0e10cSrcweir case ::com::sun::star::document::PrinterIndependentLayout::ENABLED: 994cdf0e10cSrcweir // Just store supported modes and inform the doc shell. 995cdf0e10cSrcweir mnPrinterIndependentLayout = nMode; 996cdf0e10cSrcweir 997cdf0e10cSrcweir // #108104# 998cdf0e10cSrcweir // Since it is possible that a SdDrawDocument is constructed without a 999cdf0e10cSrcweir // SdDrawDocShell the pointer member mpDocSh needs to be tested 1000cdf0e10cSrcweir // before the call is executed. This is e.-g. used for copy/paste. 1001cdf0e10cSrcweir if(mpDocSh) 1002cdf0e10cSrcweir { 1003cdf0e10cSrcweir mpDocSh->UpdateRefDevice (); 1004cdf0e10cSrcweir } 1005cdf0e10cSrcweir 1006cdf0e10cSrcweir break; 1007cdf0e10cSrcweir 1008cdf0e10cSrcweir default: 1009cdf0e10cSrcweir // Ignore unknown values. 1010cdf0e10cSrcweir break; 1011cdf0e10cSrcweir } 1012cdf0e10cSrcweir } 1013cdf0e10cSrcweir 1014cdf0e10cSrcweir sal_Int32 SdDrawDocument::GetPrinterIndependentLayout (void) 1015cdf0e10cSrcweir { 1016cdf0e10cSrcweir return mnPrinterIndependentLayout; 1017cdf0e10cSrcweir } 1018cdf0e10cSrcweir 1019cdf0e10cSrcweir bool SdDrawDocument::IsStartWithPresentation() const 1020cdf0e10cSrcweir { 1021cdf0e10cSrcweir return mbStartWithPresentation; 1022cdf0e10cSrcweir } 1023cdf0e10cSrcweir 1024cdf0e10cSrcweir void SdDrawDocument::SetStartWithPresentation( bool bStartWithPresentation ) 1025cdf0e10cSrcweir { 1026cdf0e10cSrcweir mbStartWithPresentation = bStartWithPresentation; 1027cdf0e10cSrcweir } 1028cdf0e10cSrcweir 1029cdf0e10cSrcweir // #109538# 1030cdf0e10cSrcweir void SdDrawDocument::PageListChanged() 1031cdf0e10cSrcweir { 1032cdf0e10cSrcweir mpDrawPageListWatcher->Invalidate(); 1033cdf0e10cSrcweir } 1034cdf0e10cSrcweir 1035cdf0e10cSrcweir // #109538# 1036cdf0e10cSrcweir void SdDrawDocument::MasterPageListChanged() 1037cdf0e10cSrcweir { 1038cdf0e10cSrcweir mpMasterPageListWatcher->Invalidate(); 1039cdf0e10cSrcweir } 1040cdf0e10cSrcweir 1041cdf0e10cSrcweir void SdDrawDocument::SetCalcFieldValueHdl(::Outliner* pOutliner) 1042cdf0e10cSrcweir { 1043cdf0e10cSrcweir pOutliner->SetCalcFieldValueHdl(LINK(SD_MOD(), SdModule, CalcFieldValueHdl)); 1044cdf0e10cSrcweir } 1045cdf0e10cSrcweir 1046cdf0e10cSrcweir sal_uInt16 SdDrawDocument::GetAnnotationAuthorIndex( const rtl::OUString& rAuthor ) 1047cdf0e10cSrcweir { 1048cdf0e10cSrcweir // force current user to have first color 1049cdf0e10cSrcweir if( maAnnotationAuthors.empty() ) 1050cdf0e10cSrcweir { 1051cdf0e10cSrcweir SvtUserOptions aUserOptions; 1052cdf0e10cSrcweir maAnnotationAuthors.push_back( aUserOptions.GetFullName() ); 1053cdf0e10cSrcweir } 1054cdf0e10cSrcweir 1055cdf0e10cSrcweir sal_uInt16 idx = 0; 1056cdf0e10cSrcweir for( std::vector< OUString >::iterator iter( maAnnotationAuthors.begin() ); iter != maAnnotationAuthors.end(); iter++ ) 1057cdf0e10cSrcweir { 1058cdf0e10cSrcweir if( (*iter) == rAuthor ) 1059cdf0e10cSrcweir { 1060cdf0e10cSrcweir break; 1061cdf0e10cSrcweir } 1062cdf0e10cSrcweir idx++; 1063cdf0e10cSrcweir } 1064cdf0e10cSrcweir 1065cdf0e10cSrcweir if( idx == maAnnotationAuthors.size() ) 1066cdf0e10cSrcweir { 1067cdf0e10cSrcweir maAnnotationAuthors.push_back( rAuthor ); 1068cdf0e10cSrcweir } 1069cdf0e10cSrcweir 1070cdf0e10cSrcweir return idx; 1071cdf0e10cSrcweir } 1072cdf0e10cSrcweir 1073cdf0e10cSrcweir // eof 1074