1f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f6e50924SAndrew Rist * distributed with this work for additional information 6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f6e50924SAndrew Rist * software distributed under the License is distributed on an 15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17f6e50924SAndrew Rist * specific language governing permissions and limitations 18f6e50924SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20f6e50924SAndrew Rist *************************************************************/ 21f6e50924SAndrew Rist 22f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <svx/svdmodel.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <rtl/uuid.h> 30cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 31cdf0e10cSrcweir #include <osl/endian.h> 32cdf0e10cSrcweir #include <rtl/logfile.hxx> 33cdf0e10cSrcweir #include <math.h> 34cdf0e10cSrcweir #include <tools/urlobj.hxx> 35cdf0e10cSrcweir #include <unotools/ucbstreamhelper.hxx> 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include <tools/string.hxx> 38cdf0e10cSrcweir #include <svl/whiter.hxx> 39cdf0e10cSrcweir #include <svx/xit.hxx> 40cdf0e10cSrcweir #include <svx/xbtmpit.hxx> 41cdf0e10cSrcweir #include <svx/xlndsit.hxx> 42cdf0e10cSrcweir #include <svx/xlnedit.hxx> 43cdf0e10cSrcweir #include <svx/xflgrit.hxx> 44cdf0e10cSrcweir #include <svx/xflftrit.hxx> 45cdf0e10cSrcweir #include <svx/xflhtit.hxx> 46cdf0e10cSrcweir #include <svx/xlnstit.hxx> 47cdf0e10cSrcweir 48cdf0e10cSrcweir #include "svx/svditext.hxx" 49cdf0e10cSrcweir #include <editeng/editeng.hxx> // Fuer EditEngine::CreatePool() 50cdf0e10cSrcweir 51cdf0e10cSrcweir #include <svx/xtable.hxx> 52cdf0e10cSrcweir 53cdf0e10cSrcweir #include "svx/svditer.hxx" 54cdf0e10cSrcweir #include <svx/svdtrans.hxx> 55cdf0e10cSrcweir #include <svx/svdpage.hxx> 56cdf0e10cSrcweir #include <svx/svdlayer.hxx> 57cdf0e10cSrcweir #include <svx/svdundo.hxx> 58cdf0e10cSrcweir #include <svx/svdpool.hxx> 59cdf0e10cSrcweir #include <svx/svdobj.hxx> 60cdf0e10cSrcweir #include <svx/svdotext.hxx> // fuer ReformatAllTextObjects und CalcFieldValue 61cdf0e10cSrcweir #include <svx/svdetc.hxx> 62cdf0e10cSrcweir #include <svx/svdoutl.hxx> 63cdf0e10cSrcweir #include <svx/svdoole2.hxx> 64cdf0e10cSrcweir #include "svx/svdglob.hxx" // Stringcache 65cdf0e10cSrcweir #include "svx/svdstr.hrc" // Objektname 66cdf0e10cSrcweir #include "svdoutlinercache.hxx" 67cdf0e10cSrcweir 68cdf0e10cSrcweir #include "svx/xflclit.hxx" 69cdf0e10cSrcweir #include "svx/xflhtit.hxx" 70cdf0e10cSrcweir #include "svx/xlnclit.hxx" 71cdf0e10cSrcweir 72cdf0e10cSrcweir #include <svl/asiancfg.hxx> 73cdf0e10cSrcweir #include "editeng/fontitem.hxx" 74cdf0e10cSrcweir #include <editeng/colritem.hxx> 75cdf0e10cSrcweir #include <editeng/fhgtitem.hxx> 76cdf0e10cSrcweir #include <svl/style.hxx> 77cdf0e10cSrcweir #include <tools/bigint.hxx> 78cdf0e10cSrcweir #include <editeng/numitem.hxx> 79cdf0e10cSrcweir #include <editeng/bulitem.hxx> 80cdf0e10cSrcweir #include <editeng/outlobj.hxx> 81cdf0e10cSrcweir #include "editeng/forbiddencharacterstable.hxx" 82cdf0e10cSrcweir #include <svl/zforlist.hxx> 83cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 84cdf0e10cSrcweir 85cdf0e10cSrcweir // #90477# 86cdf0e10cSrcweir #include <tools/tenccvt.hxx> 87cdf0e10cSrcweir #include <unotools/syslocale.hxx> 88cdf0e10cSrcweir 89cdf0e10cSrcweir // #95114# 90cdf0e10cSrcweir #include <vcl/svapp.hxx> 91cdf0e10cSrcweir #include <svx/sdr/properties/properties.hxx> 92cdf0e10cSrcweir #include <editeng/eeitem.hxx> 93cdf0e10cSrcweir #include <svl/itemset.hxx> 94cdf0e10cSrcweir 95cdf0e10cSrcweir using namespace ::com::sun::star; 96cdf0e10cSrcweir using namespace ::com::sun::star::uno; 97cdf0e10cSrcweir using namespace ::com::sun::star::lang; 98cdf0e10cSrcweir 99cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 100cdf0e10cSrcweir 101cdf0e10cSrcweir struct SdrModelImpl 102cdf0e10cSrcweir { 103cdf0e10cSrcweir SfxUndoManager* mpUndoManager; 104cdf0e10cSrcweir SdrUndoFactory* mpUndoFactory; 105cdf0e10cSrcweir bool mbAllowShapePropertyChangeListener; 106cdf0e10cSrcweir }; 107cdf0e10cSrcweir 108cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 109cdf0e10cSrcweir 110cdf0e10cSrcweir DBG_NAME(SdrModel) 111cdf0e10cSrcweir TYPEINIT1(SdrModel,SfxBroadcaster); 112cdf0e10cSrcweir void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbeddedHelper, 113cdf0e10cSrcweir bool bUseExtColorTable, bool bLoadRefCounts) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir mpImpl = new SdrModelImpl; 116cdf0e10cSrcweir mpImpl->mpUndoManager=0; 117cdf0e10cSrcweir mpImpl->mpUndoFactory=0; 118cdf0e10cSrcweir mpImpl->mbAllowShapePropertyChangeListener=false; 119cdf0e10cSrcweir mbInDestruction=false; 120cdf0e10cSrcweir aObjUnit=SdrEngineDefaults::GetMapFraction(); 121cdf0e10cSrcweir eObjUnit=SdrEngineDefaults::GetMapUnit(); 122cdf0e10cSrcweir eUIUnit=FUNIT_MM; 123cdf0e10cSrcweir aUIScale=Fraction(1,1); 124cdf0e10cSrcweir nUIUnitKomma=0; 125cdf0e10cSrcweir bUIOnlyKomma=sal_False; 126cdf0e10cSrcweir pLayerAdmin=NULL; 127cdf0e10cSrcweir pItemPool=pPool; 128cdf0e10cSrcweir bMyPool=sal_False; 129cdf0e10cSrcweir m_pEmbeddedHelper=_pEmbeddedHelper; 130cdf0e10cSrcweir pDrawOutliner=NULL; 131cdf0e10cSrcweir pHitTestOutliner=NULL; 132cdf0e10cSrcweir pRefOutDev=NULL; 133cdf0e10cSrcweir nProgressAkt=0; 134cdf0e10cSrcweir nProgressMax=0; 135cdf0e10cSrcweir nProgressOfs=0; 136cdf0e10cSrcweir pDefaultStyleSheet=NULL; 1379e9dd2d5SArmin Le Grand mpDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj = 0; 138cdf0e10cSrcweir pLinkManager=NULL; 139cdf0e10cSrcweir pUndoStack=NULL; 140cdf0e10cSrcweir pRedoStack=NULL; 141cdf0e10cSrcweir nMaxUndoCount=16; 142cdf0e10cSrcweir pAktUndoGroup=NULL; 143cdf0e10cSrcweir nUndoLevel=0; 144cdf0e10cSrcweir mbUndoEnabled=true; 145cdf0e10cSrcweir nProgressPercent=0; 146cdf0e10cSrcweir nLoadVersion=0; 147cdf0e10cSrcweir bExtColorTable=sal_False; 148cdf0e10cSrcweir mbChanged = sal_False; 149cdf0e10cSrcweir bInfoChanged=sal_False; 150cdf0e10cSrcweir bPagNumsDirty=sal_False; 151cdf0e10cSrcweir bMPgNumsDirty=sal_False; 152cdf0e10cSrcweir bPageNotValid=sal_False; 153cdf0e10cSrcweir bSavePortable=sal_False; 154cdf0e10cSrcweir bSaveCompressed=sal_False; 155cdf0e10cSrcweir bSaveNative=sal_False; 156cdf0e10cSrcweir bSwapGraphics=sal_False; 157cdf0e10cSrcweir nSwapGraphicsMode=SDR_SWAPGRAPHICSMODE_DEFAULT; 158cdf0e10cSrcweir bSaveOLEPreview=sal_False; 159cdf0e10cSrcweir bPasteResize=sal_False; 160cdf0e10cSrcweir bNoBitmapCaching=sal_False; 161cdf0e10cSrcweir bReadOnly=sal_False; 162cdf0e10cSrcweir nStreamCompressMode=COMPRESSMODE_NONE; 163cdf0e10cSrcweir nStreamNumberFormat=NUMBERFORMAT_INT_BIGENDIAN; 164cdf0e10cSrcweir nDefaultTabulator=0; 165cdf0e10cSrcweir pColorTable=NULL; 166cdf0e10cSrcweir pDashList=NULL; 167cdf0e10cSrcweir pLineEndList=NULL; 168cdf0e10cSrcweir pHatchList=NULL; 169cdf0e10cSrcweir pGradientList=NULL; 170cdf0e10cSrcweir pBitmapList=NULL; 171cdf0e10cSrcweir mpNumberFormatter = NULL; 172cdf0e10cSrcweir bTransparentTextFrames=sal_False; 173cdf0e10cSrcweir bStarDrawPreviewMode = sal_False; 174cdf0e10cSrcweir nStarDrawPreviewMasterPageNum = SDRPAGE_NOTFOUND; 175cdf0e10cSrcweir pModelStorage = NULL; 176cdf0e10cSrcweir mpForbiddenCharactersTable = NULL; 177cdf0e10cSrcweir mbModelLocked = sal_False; 178cdf0e10cSrcweir mpOutlinerCache = NULL; 179cdf0e10cSrcweir mbKernAsianPunctuation = sal_False; 180cdf0e10cSrcweir mbAddExtLeading = sal_False; 181cdf0e10cSrcweir mnHandoutPageCount = 0; 182cdf0e10cSrcweir 183cdf0e10cSrcweir SvxAsianConfig aAsian; 184cdf0e10cSrcweir mnCharCompressType = aAsian.GetCharDistanceCompression(); 185cdf0e10cSrcweir 186cdf0e10cSrcweir #ifdef OSL_LITENDIAN 187cdf0e10cSrcweir nStreamNumberFormat=NUMBERFORMAT_INT_LITTLEENDIAN; 188cdf0e10cSrcweir #endif 189cdf0e10cSrcweir bExtColorTable=bUseExtColorTable; 190cdf0e10cSrcweir 191cdf0e10cSrcweir if ( pPool == NULL ) 192cdf0e10cSrcweir { 193cdf0e10cSrcweir pItemPool=new SdrItemPool(0L, bLoadRefCounts); 194cdf0e10cSrcweir // Der Outliner hat keinen eigenen Pool, deshalb den der EditEngine 195cdf0e10cSrcweir SfxItemPool* pOutlPool=EditEngine::CreatePool( bLoadRefCounts ); 196cdf0e10cSrcweir // OutlinerPool als SecondaryPool des SdrPool 197cdf0e10cSrcweir pItemPool->SetSecondaryPool(pOutlPool); 198cdf0e10cSrcweir // Merken, dass ich mir die beiden Pools selbst gemacht habe 199cdf0e10cSrcweir bMyPool=sal_True; 200cdf0e10cSrcweir } 201cdf0e10cSrcweir pItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit); 202cdf0e10cSrcweir 203cdf0e10cSrcweir // SJ: #95129# using static SdrEngineDefaults only if default SvxFontHeight item is not available 204cdf0e10cSrcweir const SfxPoolItem* pPoolItem = pItemPool->GetPoolDefaultItem( EE_CHAR_FONTHEIGHT ); 205cdf0e10cSrcweir if ( pPoolItem ) 206cdf0e10cSrcweir nDefTextHgt = ((SvxFontHeightItem*)pPoolItem)->GetHeight(); 207cdf0e10cSrcweir else 208cdf0e10cSrcweir nDefTextHgt = SdrEngineDefaults::GetFontHeight(); 209cdf0e10cSrcweir 210cdf0e10cSrcweir pItemPool->SetPoolDefaultItem( SdrTextWordWrapItem( sal_False ) ); 211cdf0e10cSrcweir 212cdf0e10cSrcweir SetTextDefaults(); 213cdf0e10cSrcweir 214cdf0e10cSrcweir pLayerAdmin=new SdrLayerAdmin; 215cdf0e10cSrcweir pLayerAdmin->SetModel(this); 216cdf0e10cSrcweir ImpSetUIUnit(); 217cdf0e10cSrcweir 218cdf0e10cSrcweir // den DrawOutliner OnDemand erzeugen geht noch nicht, weil ich den Pool 219cdf0e10cSrcweir // sonst nicht kriege (erst ab 302!) 220cdf0e10cSrcweir pDrawOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this ); 221cdf0e10cSrcweir ImpSetOutlinerDefaults(pDrawOutliner, sal_True); 222cdf0e10cSrcweir 223cdf0e10cSrcweir pHitTestOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this ); 224cdf0e10cSrcweir ImpSetOutlinerDefaults(pHitTestOutliner, sal_True); 225cdf0e10cSrcweir 226cdf0e10cSrcweir ImpCreateTables(); 227cdf0e10cSrcweir } 228cdf0e10cSrcweir 229cdf0e10cSrcweir SdrModel::SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, sal_Bool bLoadRefCounts): 230cdf0e10cSrcweir maMaPag(1024,32,32), 231cdf0e10cSrcweir maPages(1024,32,32) 232cdf0e10cSrcweir { 233cdf0e10cSrcweir #ifdef TIMELOG 234cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" ); 235cdf0e10cSrcweir #endif 236cdf0e10cSrcweir 237cdf0e10cSrcweir DBG_CTOR(SdrModel,NULL); 238cdf0e10cSrcweir ImpCtor(pPool,pPers,sal_False, (FASTBOOL)bLoadRefCounts); 239cdf0e10cSrcweir } 240cdf0e10cSrcweir 241cdf0e10cSrcweir SdrModel::SdrModel(const String& rPath, SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, sal_Bool bLoadRefCounts): 242cdf0e10cSrcweir maMaPag(1024,32,32), 243cdf0e10cSrcweir maPages(1024,32,32), 244cdf0e10cSrcweir aTablePath(rPath) 245cdf0e10cSrcweir { 246cdf0e10cSrcweir #ifdef TIMELOG 247cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" ); 248cdf0e10cSrcweir #endif 249cdf0e10cSrcweir 250cdf0e10cSrcweir DBG_CTOR(SdrModel,NULL); 251cdf0e10cSrcweir ImpCtor(pPool,pPers,sal_False, (FASTBOOL)bLoadRefCounts); 252cdf0e10cSrcweir } 253cdf0e10cSrcweir 254cdf0e10cSrcweir SdrModel::SdrModel(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, FASTBOOL bUseExtColorTable, sal_Bool bLoadRefCounts): 255cdf0e10cSrcweir maMaPag(1024,32,32), 256cdf0e10cSrcweir maPages(1024,32,32) 257cdf0e10cSrcweir { 258cdf0e10cSrcweir #ifdef TIMELOG 259cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" ); 260cdf0e10cSrcweir #endif 261cdf0e10cSrcweir 262cdf0e10cSrcweir DBG_CTOR(SdrModel,NULL); 263cdf0e10cSrcweir ImpCtor(pPool,pPers,bUseExtColorTable, (FASTBOOL)bLoadRefCounts); 264cdf0e10cSrcweir } 265cdf0e10cSrcweir 266cdf0e10cSrcweir SdrModel::SdrModel(const String& rPath, SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* pPers, FASTBOOL bUseExtColorTable, sal_Bool bLoadRefCounts): 267cdf0e10cSrcweir maMaPag(1024,32,32), 268cdf0e10cSrcweir maPages(1024,32,32), 269cdf0e10cSrcweir aTablePath(rPath) 270cdf0e10cSrcweir { 271cdf0e10cSrcweir #ifdef TIMELOG 272cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" ); 273cdf0e10cSrcweir #endif 274cdf0e10cSrcweir 275cdf0e10cSrcweir DBG_CTOR(SdrModel,NULL); 276cdf0e10cSrcweir ImpCtor(pPool,pPers,bUseExtColorTable, (FASTBOOL)bLoadRefCounts); 277cdf0e10cSrcweir } 278cdf0e10cSrcweir 279cdf0e10cSrcweir SdrModel::SdrModel(const SdrModel& /*rSrcModel*/): 280cdf0e10cSrcweir SfxBroadcaster(), 281cdf0e10cSrcweir tools::WeakBase< SdrModel >(), 282cdf0e10cSrcweir maMaPag(1024,32,32), 283cdf0e10cSrcweir maPages(1024,32,32) 284cdf0e10cSrcweir { 285cdf0e10cSrcweir #ifdef TIMELOG 286cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::SdrModel(...)" ); 287cdf0e10cSrcweir #endif 288cdf0e10cSrcweir 289cdf0e10cSrcweir // noch nicht implementiert 290cdf0e10cSrcweir DBG_ERROR("SdrModel::CopyCtor() ist noch nicht implementiert"); 291cdf0e10cSrcweir } 292cdf0e10cSrcweir 293cdf0e10cSrcweir SdrModel::~SdrModel() 294cdf0e10cSrcweir { 295cdf0e10cSrcweir #ifdef TIMELOG 296cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "svx", "aw93748", "SdrModel::~SdrModel(...)" ); 297cdf0e10cSrcweir #endif 298cdf0e10cSrcweir 299cdf0e10cSrcweir DBG_DTOR(SdrModel,NULL); 300cdf0e10cSrcweir 301cdf0e10cSrcweir mbInDestruction = true; 302cdf0e10cSrcweir 303cdf0e10cSrcweir Broadcast(SdrHint(HINT_MODELCLEARED)); 304cdf0e10cSrcweir 305cdf0e10cSrcweir delete mpOutlinerCache; 306cdf0e10cSrcweir 307cdf0e10cSrcweir ClearUndoBuffer(); 308cdf0e10cSrcweir #ifdef DBG_UTIL 309cdf0e10cSrcweir if(pAktUndoGroup) 310cdf0e10cSrcweir { 311cdf0e10cSrcweir ByteString aStr("Im Dtor des SdrModel steht noch ein offenes Undo rum: \""); 312cdf0e10cSrcweir 313cdf0e10cSrcweir aStr += ByteString(pAktUndoGroup->GetComment(), gsl_getSystemTextEncoding()); 314cdf0e10cSrcweir aStr += '\"'; 315cdf0e10cSrcweir 316cdf0e10cSrcweir DBG_ERROR(aStr.GetBuffer()); 317cdf0e10cSrcweir } 318cdf0e10cSrcweir #endif 319cdf0e10cSrcweir if (pAktUndoGroup!=NULL) 320cdf0e10cSrcweir delete pAktUndoGroup; 321cdf0e10cSrcweir 322cdf0e10cSrcweir // #116168# 323cdf0e10cSrcweir ClearModel(sal_True); 324cdf0e10cSrcweir 325cdf0e10cSrcweir delete pLayerAdmin; 326cdf0e10cSrcweir 327cdf0e10cSrcweir // Den DrawOutliner erst nach dem ItemPool loeschen, da 328cdf0e10cSrcweir // der ItemPool Items des DrawOutliners referenziert !!! (<- das war mal) 329cdf0e10cSrcweir // Wg. Problem bei Malte Reihenfolge wieder umgestellt. 330cdf0e10cSrcweir // Loeschen des Outliners vor dem loeschen des ItemPools 331cdf0e10cSrcweir delete pHitTestOutliner; 332cdf0e10cSrcweir delete pDrawOutliner; 333cdf0e10cSrcweir 334cdf0e10cSrcweir // delete StyleSheetPool, derived classes should not do this since 335cdf0e10cSrcweir // the DrawingEngine may need it in its destrctor (SB) 336cdf0e10cSrcweir if( mxStyleSheetPool.is() ) 337cdf0e10cSrcweir { 338cdf0e10cSrcweir Reference< XComponent > xComponent( dynamic_cast< cppu::OWeakObject* >( mxStyleSheetPool.get() ), UNO_QUERY ); 339cdf0e10cSrcweir if( xComponent.is() ) try 340cdf0e10cSrcweir { 341cdf0e10cSrcweir xComponent->dispose(); 342cdf0e10cSrcweir } 343cdf0e10cSrcweir catch( RuntimeException& ) 344cdf0e10cSrcweir { 345cdf0e10cSrcweir } 346cdf0e10cSrcweir mxStyleSheetPool.clear(); 347cdf0e10cSrcweir } 348cdf0e10cSrcweir 349cdf0e10cSrcweir if (bMyPool) 350cdf0e10cSrcweir { 351cdf0e10cSrcweir // Pools loeschen, falls es meine sind 352cdf0e10cSrcweir SfxItemPool* pOutlPool=pItemPool->GetSecondaryPool(); 353cdf0e10cSrcweir SfxItemPool::Free(pItemPool); 354cdf0e10cSrcweir // Der OutlinerPool muss nach dem ItemPool plattgemacht werden, da der 355cdf0e10cSrcweir // ItemPool SetItems enthaelt die ihrerseits Items des OutlinerPools 356cdf0e10cSrcweir // referenzieren (Joe) 357cdf0e10cSrcweir SfxItemPool::Free(pOutlPool); 358cdf0e10cSrcweir } 359cdf0e10cSrcweir 360cdf0e10cSrcweir if( mpForbiddenCharactersTable ) 361cdf0e10cSrcweir mpForbiddenCharactersTable->release(); 362cdf0e10cSrcweir 363cdf0e10cSrcweir // Tabellen, Listen und Paletten loeschen 364cdf0e10cSrcweir if (!bExtColorTable) 365cdf0e10cSrcweir delete pColorTable; 366cdf0e10cSrcweir delete pDashList; 367cdf0e10cSrcweir delete pLineEndList; 368cdf0e10cSrcweir delete pHatchList; 369cdf0e10cSrcweir delete pGradientList; 370cdf0e10cSrcweir delete pBitmapList; 371cdf0e10cSrcweir 372cdf0e10cSrcweir if(mpNumberFormatter) 373cdf0e10cSrcweir delete mpNumberFormatter; 374cdf0e10cSrcweir 375cdf0e10cSrcweir delete mpImpl->mpUndoFactory; 376cdf0e10cSrcweir delete mpImpl; 377cdf0e10cSrcweir } 378cdf0e10cSrcweir 379cdf0e10cSrcweir bool SdrModel::IsInDestruction() const 380cdf0e10cSrcweir { 381cdf0e10cSrcweir return mbInDestruction; 382cdf0e10cSrcweir } 383cdf0e10cSrcweir 384cdf0e10cSrcweir const SvNumberFormatter& SdrModel::GetNumberFormatter() const 385cdf0e10cSrcweir { 386cdf0e10cSrcweir if(!mpNumberFormatter) 387cdf0e10cSrcweir { 388cdf0e10cSrcweir // use cast here since from outside view this IS a const method 389cdf0e10cSrcweir ((SdrModel*)this)->mpNumberFormatter = new SvNumberFormatter( 390cdf0e10cSrcweir ::comphelper::getProcessServiceFactory(), LANGUAGE_SYSTEM); 391cdf0e10cSrcweir } 392cdf0e10cSrcweir 393cdf0e10cSrcweir return *mpNumberFormatter; 394cdf0e10cSrcweir } 395cdf0e10cSrcweir 396cdf0e10cSrcweir // noch nicht implementiert: 397cdf0e10cSrcweir void SdrModel::operator=(const SdrModel& /*rSrcModel*/) 398cdf0e10cSrcweir { 399cdf0e10cSrcweir DBG_ERROR("SdrModel::operator=() ist noch nicht implementiert"); 400cdf0e10cSrcweir } 401cdf0e10cSrcweir 402cdf0e10cSrcweir FASTBOOL SdrModel::operator==(const SdrModel& /*rCmpModel*/) const 403cdf0e10cSrcweir { 404cdf0e10cSrcweir DBG_ERROR("SdrModel::operator==() ist noch nicht implementiert"); 405cdf0e10cSrcweir return sal_False; 406cdf0e10cSrcweir } 407cdf0e10cSrcweir 408cdf0e10cSrcweir void SdrModel::SetSwapGraphics( FASTBOOL bSwap ) 409cdf0e10cSrcweir { 410cdf0e10cSrcweir bSwapGraphics = bSwap; 411cdf0e10cSrcweir } 412cdf0e10cSrcweir 413cdf0e10cSrcweir FASTBOOL SdrModel::IsReadOnly() const 414cdf0e10cSrcweir { 415cdf0e10cSrcweir return bReadOnly; 416cdf0e10cSrcweir } 417cdf0e10cSrcweir 418cdf0e10cSrcweir void SdrModel::SetReadOnly(FASTBOOL bYes) 419cdf0e10cSrcweir { 420cdf0e10cSrcweir bReadOnly=bYes; 421cdf0e10cSrcweir } 422cdf0e10cSrcweir 423cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 424cdf0e10cSrcweir 425cdf0e10cSrcweir void SdrModel::SetMaxUndoActionCount(sal_uIntPtr nAnz) 426cdf0e10cSrcweir { 427cdf0e10cSrcweir if (nAnz<1) nAnz=1; 428cdf0e10cSrcweir nMaxUndoCount=nAnz; 429cdf0e10cSrcweir if (pUndoStack!=NULL) { 430cdf0e10cSrcweir while (pUndoStack->Count()>nMaxUndoCount) { 431cdf0e10cSrcweir delete (SfxUndoAction*) pUndoStack->Remove(pUndoStack->Count()); 432cdf0e10cSrcweir } 433cdf0e10cSrcweir } 434cdf0e10cSrcweir } 435cdf0e10cSrcweir 436cdf0e10cSrcweir void SdrModel::ClearUndoBuffer() 437cdf0e10cSrcweir { 438cdf0e10cSrcweir if (pUndoStack!=NULL) { 439cdf0e10cSrcweir while (pUndoStack->Count()!=0) { 440cdf0e10cSrcweir delete (SfxUndoAction*) pUndoStack->Remove(pUndoStack->Count()-1); 441cdf0e10cSrcweir } 442cdf0e10cSrcweir delete pUndoStack; 443cdf0e10cSrcweir pUndoStack=NULL; 444cdf0e10cSrcweir } 445cdf0e10cSrcweir if (pRedoStack!=NULL) { 446cdf0e10cSrcweir while (pRedoStack->Count()!=0) { 447cdf0e10cSrcweir delete (SfxUndoAction*) pRedoStack->Remove(pRedoStack->Count()-1); 448cdf0e10cSrcweir } 449cdf0e10cSrcweir delete pRedoStack; 450cdf0e10cSrcweir pRedoStack=NULL; 451cdf0e10cSrcweir } 452cdf0e10cSrcweir } 453cdf0e10cSrcweir 454cdf0e10cSrcweir FASTBOOL SdrModel::Undo() 455cdf0e10cSrcweir { 456cdf0e10cSrcweir FASTBOOL bRet=sal_False; 457cdf0e10cSrcweir if( mpImpl->mpUndoManager ) 458cdf0e10cSrcweir { 459cdf0e10cSrcweir DBG_ERROR("svx::SdrModel::Undo(), method not supported with application undo manager!"); 460cdf0e10cSrcweir } 461cdf0e10cSrcweir else 462cdf0e10cSrcweir { 463cdf0e10cSrcweir SfxUndoAction* pDo=(SfxUndoAction*)GetUndoAction(0); 464cdf0e10cSrcweir if(pDo!=NULL) 465cdf0e10cSrcweir { 466cdf0e10cSrcweir const bool bWasUndoEnabled = mbUndoEnabled; 467cdf0e10cSrcweir mbUndoEnabled = false; 468cdf0e10cSrcweir pDo->Undo(); 469cdf0e10cSrcweir if(pRedoStack==NULL) 470cdf0e10cSrcweir pRedoStack=new Container(1024,16,16); 471cdf0e10cSrcweir pRedoStack->Insert(pUndoStack->Remove((sal_uIntPtr)0),(sal_uIntPtr)0); 472cdf0e10cSrcweir mbUndoEnabled = bWasUndoEnabled; 473cdf0e10cSrcweir } 474cdf0e10cSrcweir } 475cdf0e10cSrcweir return bRet; 476cdf0e10cSrcweir } 477cdf0e10cSrcweir 478cdf0e10cSrcweir FASTBOOL SdrModel::Redo() 479cdf0e10cSrcweir { 480cdf0e10cSrcweir FASTBOOL bRet=sal_False; 481cdf0e10cSrcweir if( mpImpl->mpUndoManager ) 482cdf0e10cSrcweir { 483cdf0e10cSrcweir DBG_ERROR("svx::SdrModel::Redo(), method not supported with application undo manager!"); 484cdf0e10cSrcweir } 485cdf0e10cSrcweir else 486cdf0e10cSrcweir { 487cdf0e10cSrcweir SfxUndoAction* pDo=(SfxUndoAction*)GetRedoAction(0); 488cdf0e10cSrcweir if(pDo!=NULL) 489cdf0e10cSrcweir { 490cdf0e10cSrcweir const bool bWasUndoEnabled = mbUndoEnabled; 491cdf0e10cSrcweir mbUndoEnabled = false; 492cdf0e10cSrcweir pDo->Redo(); 493cdf0e10cSrcweir if(pUndoStack==NULL) 494cdf0e10cSrcweir pUndoStack=new Container(1024,16,16); 495cdf0e10cSrcweir pUndoStack->Insert(pRedoStack->Remove((sal_uIntPtr)0),(sal_uIntPtr)0); 496cdf0e10cSrcweir mbUndoEnabled = bWasUndoEnabled; 497cdf0e10cSrcweir } 498cdf0e10cSrcweir } 499cdf0e10cSrcweir return bRet; 500cdf0e10cSrcweir } 501cdf0e10cSrcweir 502cdf0e10cSrcweir FASTBOOL SdrModel::Repeat(SfxRepeatTarget& rView) 503cdf0e10cSrcweir { 504cdf0e10cSrcweir FASTBOOL bRet=sal_False; 505cdf0e10cSrcweir if( mpImpl->mpUndoManager ) 506cdf0e10cSrcweir { 507cdf0e10cSrcweir DBG_ERROR("svx::SdrModel::Redo(), method not supported with application undo manager!"); 508cdf0e10cSrcweir } 509cdf0e10cSrcweir else 510cdf0e10cSrcweir { 511cdf0e10cSrcweir SfxUndoAction* pDo=(SfxUndoAction*)GetUndoAction(0); 512cdf0e10cSrcweir if(pDo!=NULL) 513cdf0e10cSrcweir { 514cdf0e10cSrcweir if(pDo->CanRepeat(rView)) 515cdf0e10cSrcweir { 516cdf0e10cSrcweir pDo->Repeat(rView); 517cdf0e10cSrcweir bRet=sal_True; 518cdf0e10cSrcweir } 519cdf0e10cSrcweir } 520cdf0e10cSrcweir } 521cdf0e10cSrcweir return bRet; 522cdf0e10cSrcweir } 523cdf0e10cSrcweir 524cdf0e10cSrcweir void SdrModel::ImpPostUndoAction(SdrUndoAction* pUndo) 525cdf0e10cSrcweir { 526cdf0e10cSrcweir DBG_ASSERT( mpImpl->mpUndoManager == 0, "svx::SdrModel::ImpPostUndoAction(), method not supported with application undo manager!" ); 527cdf0e10cSrcweir if( IsUndoEnabled() ) 528cdf0e10cSrcweir { 529cdf0e10cSrcweir if (aUndoLink.IsSet()) 530cdf0e10cSrcweir { 531cdf0e10cSrcweir aUndoLink.Call(pUndo); 532cdf0e10cSrcweir } 533cdf0e10cSrcweir else 534cdf0e10cSrcweir { 535cdf0e10cSrcweir if (pUndoStack==NULL) 536cdf0e10cSrcweir pUndoStack=new Container(1024,16,16); 537cdf0e10cSrcweir pUndoStack->Insert(pUndo,(sal_uIntPtr)0); 538cdf0e10cSrcweir while (pUndoStack->Count()>nMaxUndoCount) 539cdf0e10cSrcweir { 540cdf0e10cSrcweir delete (SfxUndoAction*)pUndoStack->Remove(pUndoStack->Count()-1); 541cdf0e10cSrcweir } 542cdf0e10cSrcweir if (pRedoStack!=NULL) 543cdf0e10cSrcweir pRedoStack->Clear(); 544cdf0e10cSrcweir } 545cdf0e10cSrcweir } 546cdf0e10cSrcweir else 547cdf0e10cSrcweir { 548cdf0e10cSrcweir delete pUndo; 549cdf0e10cSrcweir } 550cdf0e10cSrcweir } 551cdf0e10cSrcweir 552cdf0e10cSrcweir void SdrModel::BegUndo() 553cdf0e10cSrcweir { 554cdf0e10cSrcweir if( mpImpl->mpUndoManager ) 555cdf0e10cSrcweir { 556cdf0e10cSrcweir const String aEmpty; 557cdf0e10cSrcweir mpImpl->mpUndoManager->EnterListAction(aEmpty,aEmpty); 558cdf0e10cSrcweir nUndoLevel++; 559cdf0e10cSrcweir } 560cdf0e10cSrcweir else if( IsUndoEnabled() ) 561cdf0e10cSrcweir { 562cdf0e10cSrcweir if(pAktUndoGroup==NULL) 563cdf0e10cSrcweir { 564cdf0e10cSrcweir pAktUndoGroup = new SdrUndoGroup(*this); 565cdf0e10cSrcweir nUndoLevel=1; 566cdf0e10cSrcweir } 567cdf0e10cSrcweir else 568cdf0e10cSrcweir { 569cdf0e10cSrcweir nUndoLevel++; 570cdf0e10cSrcweir } 571cdf0e10cSrcweir } 572cdf0e10cSrcweir } 573cdf0e10cSrcweir 574cdf0e10cSrcweir void SdrModel::BegUndo(const XubString& rComment) 575cdf0e10cSrcweir { 576cdf0e10cSrcweir if( mpImpl->mpUndoManager ) 577cdf0e10cSrcweir { 578cdf0e10cSrcweir const String aEmpty; 579cdf0e10cSrcweir mpImpl->mpUndoManager->EnterListAction( rComment, aEmpty ); 580cdf0e10cSrcweir nUndoLevel++; 581cdf0e10cSrcweir } 582cdf0e10cSrcweir else if( IsUndoEnabled() ) 583cdf0e10cSrcweir { 584cdf0e10cSrcweir BegUndo(); 585cdf0e10cSrcweir if (nUndoLevel==1) 586cdf0e10cSrcweir { 587cdf0e10cSrcweir pAktUndoGroup->SetComment(rComment); 588cdf0e10cSrcweir } 589cdf0e10cSrcweir } 590cdf0e10cSrcweir } 591cdf0e10cSrcweir 592cdf0e10cSrcweir void SdrModel::BegUndo(const XubString& rComment, const XubString& rObjDescr, SdrRepeatFunc eFunc) 593cdf0e10cSrcweir { 594cdf0e10cSrcweir if( mpImpl->mpUndoManager ) 595cdf0e10cSrcweir { 596cdf0e10cSrcweir String aComment(rComment); 597cdf0e10cSrcweir if( aComment.Len() && rObjDescr.Len() ) 598cdf0e10cSrcweir { 599cdf0e10cSrcweir String aSearchString(RTL_CONSTASCII_USTRINGPARAM("%1")); 600cdf0e10cSrcweir aComment.SearchAndReplace(aSearchString, rObjDescr); 601cdf0e10cSrcweir } 602cdf0e10cSrcweir const String aEmpty; 603cdf0e10cSrcweir mpImpl->mpUndoManager->EnterListAction( aComment,aEmpty ); 604cdf0e10cSrcweir nUndoLevel++; 605cdf0e10cSrcweir } 606cdf0e10cSrcweir else if( IsUndoEnabled() ) 607cdf0e10cSrcweir { 608cdf0e10cSrcweir BegUndo(); 609cdf0e10cSrcweir if (nUndoLevel==1) 610cdf0e10cSrcweir { 611cdf0e10cSrcweir pAktUndoGroup->SetComment(rComment); 612cdf0e10cSrcweir pAktUndoGroup->SetObjDescription(rObjDescr); 613cdf0e10cSrcweir pAktUndoGroup->SetRepeatFunction(eFunc); 614cdf0e10cSrcweir } 615cdf0e10cSrcweir } 616cdf0e10cSrcweir } 617cdf0e10cSrcweir 618cdf0e10cSrcweir void SdrModel::BegUndo(SdrUndoGroup* pUndoGrp) 619cdf0e10cSrcweir { 620cdf0e10cSrcweir if( mpImpl->mpUndoManager ) 621cdf0e10cSrcweir { 622cdf0e10cSrcweir DBG_ERROR("svx::SdrModel::BegUndo(), method not supported with application undo manager!" ); 623cdf0e10cSrcweir nUndoLevel++; 624cdf0e10cSrcweir } 625cdf0e10cSrcweir else if( IsUndoEnabled() ) 626cdf0e10cSrcweir { 627cdf0e10cSrcweir if (pAktUndoGroup==NULL) 628cdf0e10cSrcweir { 629cdf0e10cSrcweir pAktUndoGroup=pUndoGrp; 630cdf0e10cSrcweir nUndoLevel=1; 631cdf0e10cSrcweir } 632cdf0e10cSrcweir else 633cdf0e10cSrcweir { 634cdf0e10cSrcweir delete pUndoGrp; 635cdf0e10cSrcweir nUndoLevel++; 636cdf0e10cSrcweir } 637cdf0e10cSrcweir } 638cdf0e10cSrcweir else 639cdf0e10cSrcweir { 640cdf0e10cSrcweir delete pUndoGrp; 641cdf0e10cSrcweir } 642cdf0e10cSrcweir } 643cdf0e10cSrcweir 644cdf0e10cSrcweir void SdrModel::EndUndo() 645cdf0e10cSrcweir { 646cdf0e10cSrcweir DBG_ASSERT(nUndoLevel!=0,"SdrModel::EndUndo(): UndoLevel is already 0!"); 647cdf0e10cSrcweir if( mpImpl->mpUndoManager ) 648cdf0e10cSrcweir { 649cdf0e10cSrcweir if( nUndoLevel ) 650cdf0e10cSrcweir { 651cdf0e10cSrcweir nUndoLevel--; 652cdf0e10cSrcweir mpImpl->mpUndoManager->LeaveListAction(); 653cdf0e10cSrcweir } 654cdf0e10cSrcweir } 655cdf0e10cSrcweir else 656cdf0e10cSrcweir { 657cdf0e10cSrcweir if(pAktUndoGroup!=NULL && IsUndoEnabled()) 658cdf0e10cSrcweir { 659cdf0e10cSrcweir nUndoLevel--; 660cdf0e10cSrcweir if(nUndoLevel==0) 661cdf0e10cSrcweir { 662cdf0e10cSrcweir if(pAktUndoGroup->GetActionCount()!=0) 663cdf0e10cSrcweir { 664cdf0e10cSrcweir SdrUndoAction* pUndo=pAktUndoGroup; 665cdf0e10cSrcweir pAktUndoGroup=NULL; 666cdf0e10cSrcweir ImpPostUndoAction(pUndo); 667cdf0e10cSrcweir } 668cdf0e10cSrcweir else 669cdf0e10cSrcweir { 670cdf0e10cSrcweir // was empty 671cdf0e10cSrcweir delete pAktUndoGroup; 672cdf0e10cSrcweir pAktUndoGroup=NULL; 673cdf0e10cSrcweir } 674cdf0e10cSrcweir } 675cdf0e10cSrcweir } 676cdf0e10cSrcweir } 677cdf0e10cSrcweir } 678cdf0e10cSrcweir 679cdf0e10cSrcweir void SdrModel::SetUndoComment(const XubString& rComment) 680cdf0e10cSrcweir { 681cdf0e10cSrcweir DBG_ASSERT(nUndoLevel!=0,"SdrModel::SetUndoComment(): UndoLevel is on level 0!"); 682cdf0e10cSrcweir 683cdf0e10cSrcweir if( mpImpl->mpUndoManager ) 684cdf0e10cSrcweir { 685cdf0e10cSrcweir DBG_ERROR("svx::SdrModel::SetUndoComment(), method not supported with application undo manager!" ); 686cdf0e10cSrcweir } 687cdf0e10cSrcweir else if( IsUndoEnabled() ) 688cdf0e10cSrcweir { 689cdf0e10cSrcweir if(nUndoLevel==1) 690cdf0e10cSrcweir { 691cdf0e10cSrcweir pAktUndoGroup->SetComment(rComment); 692cdf0e10cSrcweir } 693cdf0e10cSrcweir } 694cdf0e10cSrcweir } 695cdf0e10cSrcweir 696cdf0e10cSrcweir void SdrModel::SetUndoComment(const XubString& rComment, const XubString& rObjDescr) 697cdf0e10cSrcweir { 698cdf0e10cSrcweir DBG_ASSERT(nUndoLevel!=0,"SdrModel::SetUndoComment(): UndoLevel is 0!"); 699cdf0e10cSrcweir if( mpImpl->mpUndoManager ) 700cdf0e10cSrcweir { 701cdf0e10cSrcweir DBG_ERROR("svx::SdrModel::SetUndoComment(), method not supported with application undo manager!" ); 702cdf0e10cSrcweir } 703cdf0e10cSrcweir else 704cdf0e10cSrcweir { 705cdf0e10cSrcweir if (nUndoLevel==1) 706cdf0e10cSrcweir { 707cdf0e10cSrcweir pAktUndoGroup->SetComment(rComment); 708cdf0e10cSrcweir pAktUndoGroup->SetObjDescription(rObjDescr); 709cdf0e10cSrcweir } 710cdf0e10cSrcweir } 711cdf0e10cSrcweir } 712cdf0e10cSrcweir 713cdf0e10cSrcweir void SdrModel::AddUndo(SdrUndoAction* pUndo) 714cdf0e10cSrcweir { 715cdf0e10cSrcweir if( mpImpl->mpUndoManager ) 716cdf0e10cSrcweir { 717cdf0e10cSrcweir mpImpl->mpUndoManager->AddUndoAction( pUndo ); 718cdf0e10cSrcweir } 719cdf0e10cSrcweir else if( !IsUndoEnabled() ) 720cdf0e10cSrcweir { 721cdf0e10cSrcweir delete pUndo; 722cdf0e10cSrcweir } 723cdf0e10cSrcweir else 724cdf0e10cSrcweir { 725cdf0e10cSrcweir if (pAktUndoGroup!=NULL) 726cdf0e10cSrcweir { 727cdf0e10cSrcweir pAktUndoGroup->AddAction(pUndo); 728cdf0e10cSrcweir } 729cdf0e10cSrcweir else 730cdf0e10cSrcweir { 731cdf0e10cSrcweir ImpPostUndoAction(pUndo); 732cdf0e10cSrcweir } 733cdf0e10cSrcweir } 734cdf0e10cSrcweir } 735cdf0e10cSrcweir 736cdf0e10cSrcweir void SdrModel::EnableUndo( bool bEnable ) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir if( mpImpl->mpUndoManager ) 739cdf0e10cSrcweir { 740cdf0e10cSrcweir mpImpl->mpUndoManager->EnableUndo( bEnable ); 741cdf0e10cSrcweir } 742cdf0e10cSrcweir else 743cdf0e10cSrcweir { 744cdf0e10cSrcweir mbUndoEnabled = bEnable; 745cdf0e10cSrcweir } 746cdf0e10cSrcweir } 747cdf0e10cSrcweir 748cdf0e10cSrcweir bool SdrModel::IsUndoEnabled() const 749cdf0e10cSrcweir { 750cdf0e10cSrcweir if( mpImpl->mpUndoManager ) 751cdf0e10cSrcweir { 752cdf0e10cSrcweir return mpImpl->mpUndoManager->IsUndoEnabled(); 753cdf0e10cSrcweir } 754cdf0e10cSrcweir else 755cdf0e10cSrcweir { 756cdf0e10cSrcweir return mbUndoEnabled; 757cdf0e10cSrcweir } 758cdf0e10cSrcweir } 759cdf0e10cSrcweir 760cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 761cdf0e10cSrcweir 762cdf0e10cSrcweir void SdrModel::ImpCreateTables() 763cdf0e10cSrcweir { 764cdf0e10cSrcweir // der Writer hat seinen eigenen ColorTable 765cdf0e10cSrcweir if (!bExtColorTable) pColorTable=new XColorTable(aTablePath,(XOutdevItemPool*)pItemPool); 766cdf0e10cSrcweir pDashList =new XDashList (aTablePath,(XOutdevItemPool*)pItemPool); 767cdf0e10cSrcweir pLineEndList =new XLineEndList (aTablePath,(XOutdevItemPool*)pItemPool); 768cdf0e10cSrcweir pHatchList =new XHatchList (aTablePath,(XOutdevItemPool*)pItemPool); 769cdf0e10cSrcweir pGradientList=new XGradientList(aTablePath,(XOutdevItemPool*)pItemPool); 770cdf0e10cSrcweir pBitmapList =new XBitmapList (aTablePath,(XOutdevItemPool*)pItemPool); 771cdf0e10cSrcweir } 772cdf0e10cSrcweir 773cdf0e10cSrcweir // #116168# 774cdf0e10cSrcweir void SdrModel::ClearModel(sal_Bool bCalledFromDestructor) 775cdf0e10cSrcweir { 776cdf0e10cSrcweir if(bCalledFromDestructor) 777cdf0e10cSrcweir { 778cdf0e10cSrcweir mbInDestruction = true; 779cdf0e10cSrcweir } 780cdf0e10cSrcweir 781cdf0e10cSrcweir sal_Int32 i; 782cdf0e10cSrcweir // delete all drawing pages 783cdf0e10cSrcweir sal_Int32 nAnz=GetPageCount(); 784cdf0e10cSrcweir for (i=nAnz-1; i>=0; i--) 785cdf0e10cSrcweir { 786cdf0e10cSrcweir DeletePage( (sal_uInt16)i ); 787cdf0e10cSrcweir } 788cdf0e10cSrcweir maPages.Clear(); 789cdf0e10cSrcweir // #109538# 790cdf0e10cSrcweir PageListChanged(); 791cdf0e10cSrcweir 792cdf0e10cSrcweir // delete all Masterpages 793cdf0e10cSrcweir nAnz=GetMasterPageCount(); 794cdf0e10cSrcweir for(i=nAnz-1; i>=0; i--) 795cdf0e10cSrcweir { 796cdf0e10cSrcweir DeleteMasterPage( (sal_uInt16)i ); 797cdf0e10cSrcweir } 798cdf0e10cSrcweir maMaPag.Clear(); 799cdf0e10cSrcweir // #109538# 800cdf0e10cSrcweir MasterPageListChanged(); 801cdf0e10cSrcweir 802cdf0e10cSrcweir pLayerAdmin->ClearLayer(); 803cdf0e10cSrcweir } 804cdf0e10cSrcweir 805cdf0e10cSrcweir SdrModel* SdrModel::AllocModel() const 806cdf0e10cSrcweir { 807cdf0e10cSrcweir SdrModel* pModel=new SdrModel; 808cdf0e10cSrcweir pModel->SetScaleUnit(eObjUnit,aObjUnit); 809cdf0e10cSrcweir return pModel; 810cdf0e10cSrcweir } 811cdf0e10cSrcweir 812cdf0e10cSrcweir SdrPage* SdrModel::AllocPage(FASTBOOL bMasterPage) 813cdf0e10cSrcweir { 814cdf0e10cSrcweir return new SdrPage(*this,bMasterPage); 815cdf0e10cSrcweir } 816cdf0e10cSrcweir 817cdf0e10cSrcweir void SdrModel::SetTextDefaults() const 818cdf0e10cSrcweir { 819cdf0e10cSrcweir SetTextDefaults( pItemPool, nDefTextHgt ); 820cdf0e10cSrcweir } 821cdf0e10cSrcweir 822cdf0e10cSrcweir void ImpGetDefaultFontsLanguage( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rComplex) 823cdf0e10cSrcweir { 824cdf0e10cSrcweir const sal_uInt16 nItemCnt = 3; 825cdf0e10cSrcweir static struct { 826cdf0e10cSrcweir sal_uInt16 nFntType, nLanguage; 827cdf0e10cSrcweir } aOutTypeArr[ nItemCnt ] = { 828cdf0e10cSrcweir { DEFAULTFONT_LATIN_TEXT, LANGUAGE_ENGLISH_US }, 829cdf0e10cSrcweir { DEFAULTFONT_CJK_TEXT, LANGUAGE_ENGLISH_US }, 830cdf0e10cSrcweir { DEFAULTFONT_CTL_TEXT, LANGUAGE_ARABIC_SAUDI_ARABIA } 831cdf0e10cSrcweir }; 832cdf0e10cSrcweir SvxFontItem* aItemArr[ nItemCnt ] = { &rLatin, &rAsian, &rComplex }; 833cdf0e10cSrcweir 834cdf0e10cSrcweir for( sal_uInt16 n = 0; n < nItemCnt; ++n ) 835cdf0e10cSrcweir { 836cdf0e10cSrcweir Font aFnt( OutputDevice::GetDefaultFont( 837cdf0e10cSrcweir aOutTypeArr[ n ].nFntType, aOutTypeArr[ n ].nLanguage, 838cdf0e10cSrcweir DEFAULTFONT_FLAGS_ONLYONE, 0 )); 839cdf0e10cSrcweir SvxFontItem* pI = aItemArr[ n ]; 840cdf0e10cSrcweir pI->SetFamily( aFnt.GetFamily()); 841cdf0e10cSrcweir pI->SetFamilyName( aFnt.GetName()); 842cdf0e10cSrcweir pI->SetStyleName( String() ); 843cdf0e10cSrcweir pI->SetPitch( aFnt.GetPitch()); 844cdf0e10cSrcweir pI->SetCharSet( aFnt.GetCharSet() ); 845cdf0e10cSrcweir } 846cdf0e10cSrcweir } 847cdf0e10cSrcweir 848cdf0e10cSrcweir void SdrModel::SetTextDefaults( SfxItemPool* pItemPool, sal_uIntPtr nDefTextHgt ) 849cdf0e10cSrcweir { 850cdf0e10cSrcweir // #95114# set application-language specific dynamic pool language defaults 851cdf0e10cSrcweir SvxFontItem aSvxFontItem( EE_CHAR_FONTINFO) ; 852cdf0e10cSrcweir SvxFontItem aSvxFontItemCJK(EE_CHAR_FONTINFO_CJK); 853cdf0e10cSrcweir SvxFontItem aSvxFontItemCTL(EE_CHAR_FONTINFO_CTL); 854cdf0e10cSrcweir sal_uInt16 nLanguage(Application::GetSettings().GetLanguage()); 855cdf0e10cSrcweir 856cdf0e10cSrcweir // get DEFAULTFONT_LATIN_TEXT and set at pool as dynamic default 857cdf0e10cSrcweir Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_LATIN_TEXT, nLanguage, DEFAULTFONT_FLAGS_ONLYONE, 0)); 858cdf0e10cSrcweir aSvxFontItem.SetFamily(aFont.GetFamily()); 859cdf0e10cSrcweir aSvxFontItem.SetFamilyName(aFont.GetName()); 860cdf0e10cSrcweir aSvxFontItem.SetStyleName(String()); 861cdf0e10cSrcweir aSvxFontItem.SetPitch( aFont.GetPitch()); 862cdf0e10cSrcweir aSvxFontItem.SetCharSet( aFont.GetCharSet() ); 863cdf0e10cSrcweir pItemPool->SetPoolDefaultItem(aSvxFontItem); 864cdf0e10cSrcweir 865cdf0e10cSrcweir // get DEFAULTFONT_CJK_TEXT and set at pool as dynamic default 866cdf0e10cSrcweir Font aFontCJK(OutputDevice::GetDefaultFont(DEFAULTFONT_CJK_TEXT, nLanguage, DEFAULTFONT_FLAGS_ONLYONE, 0)); 867cdf0e10cSrcweir aSvxFontItemCJK.SetFamily( aFontCJK.GetFamily()); 868cdf0e10cSrcweir aSvxFontItemCJK.SetFamilyName(aFontCJK.GetName()); 869cdf0e10cSrcweir aSvxFontItemCJK.SetStyleName(String()); 870cdf0e10cSrcweir aSvxFontItemCJK.SetPitch( aFontCJK.GetPitch()); 871cdf0e10cSrcweir aSvxFontItemCJK.SetCharSet( aFontCJK.GetCharSet()); 872cdf0e10cSrcweir pItemPool->SetPoolDefaultItem(aSvxFontItemCJK); 873cdf0e10cSrcweir 874cdf0e10cSrcweir // get DEFAULTFONT_CTL_TEXT and set at pool as dynamic default 875cdf0e10cSrcweir Font aFontCTL(OutputDevice::GetDefaultFont(DEFAULTFONT_CTL_TEXT, nLanguage, DEFAULTFONT_FLAGS_ONLYONE, 0)); 876cdf0e10cSrcweir aSvxFontItemCTL.SetFamily(aFontCTL.GetFamily()); 877cdf0e10cSrcweir aSvxFontItemCTL.SetFamilyName(aFontCTL.GetName()); 878cdf0e10cSrcweir aSvxFontItemCTL.SetStyleName(String()); 879cdf0e10cSrcweir aSvxFontItemCTL.SetPitch( aFontCTL.GetPitch() ); 880cdf0e10cSrcweir aSvxFontItemCTL.SetCharSet( aFontCTL.GetCharSet()); 881cdf0e10cSrcweir pItemPool->SetPoolDefaultItem(aSvxFontItemCTL); 882cdf0e10cSrcweir 883cdf0e10cSrcweir // set dynamic FontHeight defaults 884cdf0e10cSrcweir pItemPool->SetPoolDefaultItem( SvxFontHeightItem(nDefTextHgt, 100, EE_CHAR_FONTHEIGHT ) ); 885cdf0e10cSrcweir pItemPool->SetPoolDefaultItem( SvxFontHeightItem(nDefTextHgt, 100, EE_CHAR_FONTHEIGHT_CJK ) ); 886cdf0e10cSrcweir pItemPool->SetPoolDefaultItem( SvxFontHeightItem(nDefTextHgt, 100, EE_CHAR_FONTHEIGHT_CTL ) ); 887cdf0e10cSrcweir 888cdf0e10cSrcweir // set FontColor defaults 889cdf0e10cSrcweir pItemPool->SetPoolDefaultItem( SvxColorItem(SdrEngineDefaults::GetFontColor(), EE_CHAR_COLOR) ); 890cdf0e10cSrcweir } 891cdf0e10cSrcweir 892cdf0e10cSrcweir SdrOutliner& SdrModel::GetDrawOutliner(const SdrTextObj* pObj) const 893cdf0e10cSrcweir { 894cdf0e10cSrcweir pDrawOutliner->SetTextObj(pObj); 895cdf0e10cSrcweir return *pDrawOutliner; 896cdf0e10cSrcweir } 897cdf0e10cSrcweir 898cdf0e10cSrcweir boost::shared_ptr< SdrOutliner > SdrModel::CreateDrawOutliner(const SdrTextObj* pObj) 899cdf0e10cSrcweir { 900cdf0e10cSrcweir boost::shared_ptr< SdrOutliner > xDrawOutliner( SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this ) ); 901cdf0e10cSrcweir ImpSetOutlinerDefaults(xDrawOutliner.get(), sal_True); 902cdf0e10cSrcweir xDrawOutliner->SetTextObj(pObj); 903cdf0e10cSrcweir return xDrawOutliner; 904cdf0e10cSrcweir } 905cdf0e10cSrcweir 906cdf0e10cSrcweir const SdrTextObj* SdrModel::GetFormattingTextObj() const 907cdf0e10cSrcweir { 908cdf0e10cSrcweir if (pDrawOutliner!=NULL) { 909cdf0e10cSrcweir return pDrawOutliner->GetTextObj(); 910cdf0e10cSrcweir } 911cdf0e10cSrcweir return NULL; 912cdf0e10cSrcweir } 913cdf0e10cSrcweir 914cdf0e10cSrcweir void SdrModel::ImpSetOutlinerDefaults( SdrOutliner* pOutliner, sal_Bool bInit ) 915cdf0e10cSrcweir { 916cdf0e10cSrcweir /************************************************************************** 917cdf0e10cSrcweir * Initialisierung der Outliner fuer Textausgabe und HitTest 918cdf0e10cSrcweir **************************************************************************/ 919cdf0e10cSrcweir if( bInit ) 920cdf0e10cSrcweir { 921cdf0e10cSrcweir pOutliner->EraseVirtualDevice(); 922cdf0e10cSrcweir pOutliner->SetUpdateMode(sal_False); 923cdf0e10cSrcweir pOutliner->SetEditTextObjectPool(pItemPool); 924cdf0e10cSrcweir pOutliner->SetDefTab(nDefaultTabulator); 925cdf0e10cSrcweir } 926cdf0e10cSrcweir 927cdf0e10cSrcweir pOutliner->SetRefDevice(GetRefDevice()); 928cdf0e10cSrcweir pOutliner->SetForbiddenCharsTable(GetForbiddenCharsTable()); 929cdf0e10cSrcweir pOutliner->SetAsianCompressionMode( mnCharCompressType ); 930cdf0e10cSrcweir pOutliner->SetKernAsianPunctuation( IsKernAsianPunctuation() ); 931cdf0e10cSrcweir pOutliner->SetAddExtLeading( IsAddExtLeading() ); 932cdf0e10cSrcweir 933cdf0e10cSrcweir if ( !GetRefDevice() ) 934cdf0e10cSrcweir { 935cdf0e10cSrcweir MapMode aMapMode(eObjUnit, Point(0,0), aObjUnit, aObjUnit); 936cdf0e10cSrcweir pOutliner->SetRefMapMode(aMapMode); 937cdf0e10cSrcweir } 938cdf0e10cSrcweir } 939cdf0e10cSrcweir 940cdf0e10cSrcweir void SdrModel::SetRefDevice(OutputDevice* pDev) 941cdf0e10cSrcweir { 942cdf0e10cSrcweir pRefOutDev=pDev; 943cdf0e10cSrcweir ImpSetOutlinerDefaults( pDrawOutliner ); 944cdf0e10cSrcweir ImpSetOutlinerDefaults( pHitTestOutliner ); 945cdf0e10cSrcweir RefDeviceChanged(); 946cdf0e10cSrcweir } 947cdf0e10cSrcweir 948cdf0e10cSrcweir void SdrModel::ImpReformatAllTextObjects() 949cdf0e10cSrcweir { 950cdf0e10cSrcweir if( isLocked() ) 951cdf0e10cSrcweir return; 952cdf0e10cSrcweir 953cdf0e10cSrcweir sal_uInt16 nAnz=GetMasterPageCount(); 954cdf0e10cSrcweir sal_uInt16 nNum; 955cdf0e10cSrcweir for (nNum=0; nNum<nAnz; nNum++) { 956cdf0e10cSrcweir GetMasterPage(nNum)->ReformatAllTextObjects(); 957cdf0e10cSrcweir } 958cdf0e10cSrcweir nAnz=GetPageCount(); 959cdf0e10cSrcweir for (nNum=0; nNum<nAnz; nNum++) { 960cdf0e10cSrcweir GetPage(nNum)->ReformatAllTextObjects(); 961cdf0e10cSrcweir } 962cdf0e10cSrcweir } 963cdf0e10cSrcweir 964cdf0e10cSrcweir /** #103122# 965cdf0e10cSrcweir steps over all available pages and sends notify messages to 966cdf0e10cSrcweir all edge objects that are connected to other objects so that 967cdf0e10cSrcweir they may reposition itselfs 968cdf0e10cSrcweir */ 969cdf0e10cSrcweir void SdrModel::ImpReformatAllEdgeObjects() 970cdf0e10cSrcweir { 971cdf0e10cSrcweir if( isLocked() ) 972cdf0e10cSrcweir return; 973cdf0e10cSrcweir 974cdf0e10cSrcweir sal_uInt16 nAnz=GetMasterPageCount(); 975cdf0e10cSrcweir sal_uInt16 nNum; 976cdf0e10cSrcweir for (nNum=0; nNum<nAnz; nNum++) 977cdf0e10cSrcweir { 978cdf0e10cSrcweir GetMasterPage(nNum)->ReformatAllEdgeObjects(); 979cdf0e10cSrcweir } 980cdf0e10cSrcweir nAnz=GetPageCount(); 981cdf0e10cSrcweir for (nNum=0; nNum<nAnz; nNum++) 982cdf0e10cSrcweir { 983cdf0e10cSrcweir GetPage(nNum)->ReformatAllEdgeObjects(); 984cdf0e10cSrcweir } 985cdf0e10cSrcweir } 986cdf0e10cSrcweir 987cdf0e10cSrcweir SvStream* SdrModel::GetDocumentStream(SdrDocumentStreamInfo& /*rStreamInfo*/) const 988cdf0e10cSrcweir { 989cdf0e10cSrcweir return NULL; 990cdf0e10cSrcweir } 991cdf0e10cSrcweir 992cdf0e10cSrcweir // Die Vorlagenattribute der Zeichenobjekte in harte Attribute verwandeln. 993cdf0e10cSrcweir void SdrModel::BurnInStyleSheetAttributes() 994cdf0e10cSrcweir { 995cdf0e10cSrcweir sal_uInt16 nAnz=GetMasterPageCount(); 996cdf0e10cSrcweir sal_uInt16 nNum; 997cdf0e10cSrcweir for (nNum=0; nNum<nAnz; nNum++) { 998cdf0e10cSrcweir GetMasterPage(nNum)->BurnInStyleSheetAttributes(); 999cdf0e10cSrcweir } 1000cdf0e10cSrcweir nAnz=GetPageCount(); 1001cdf0e10cSrcweir for (nNum=0; nNum<nAnz; nNum++) { 1002cdf0e10cSrcweir GetPage(nNum)->BurnInStyleSheetAttributes(); 1003cdf0e10cSrcweir } 1004cdf0e10cSrcweir } 1005cdf0e10cSrcweir 1006cdf0e10cSrcweir void SdrModel::RefDeviceChanged() 1007cdf0e10cSrcweir { 1008cdf0e10cSrcweir Broadcast(SdrHint(HINT_REFDEVICECHG)); 1009cdf0e10cSrcweir ImpReformatAllTextObjects(); 1010cdf0e10cSrcweir } 1011cdf0e10cSrcweir 1012cdf0e10cSrcweir void SdrModel::SetDefaultFontHeight(sal_uIntPtr nVal) 1013cdf0e10cSrcweir { 1014cdf0e10cSrcweir if (nVal!=nDefTextHgt) { 1015cdf0e10cSrcweir nDefTextHgt=nVal; 1016cdf0e10cSrcweir Broadcast(SdrHint(HINT_DEFFONTHGTCHG)); 1017cdf0e10cSrcweir ImpReformatAllTextObjects(); 1018cdf0e10cSrcweir } 1019cdf0e10cSrcweir } 1020cdf0e10cSrcweir 1021cdf0e10cSrcweir void SdrModel::SetDefaultTabulator(sal_uInt16 nVal) 1022cdf0e10cSrcweir { 1023cdf0e10cSrcweir if (nDefaultTabulator!=nVal) { 1024cdf0e10cSrcweir nDefaultTabulator=nVal; 1025cdf0e10cSrcweir Outliner& rOutliner=GetDrawOutliner(); 1026cdf0e10cSrcweir rOutliner.SetDefTab(nVal); 1027cdf0e10cSrcweir Broadcast(SdrHint(HINT_DEFAULTTABCHG)); 1028cdf0e10cSrcweir ImpReformatAllTextObjects(); 1029cdf0e10cSrcweir } 1030cdf0e10cSrcweir } 1031cdf0e10cSrcweir 1032cdf0e10cSrcweir void SdrModel::ImpSetUIUnit() 1033cdf0e10cSrcweir { 1034cdf0e10cSrcweir if(0 == aUIScale.GetNumerator() || 0 == aUIScale.GetDenominator()) 1035cdf0e10cSrcweir { 1036cdf0e10cSrcweir aUIScale = Fraction(1,1); 1037cdf0e10cSrcweir } 1038cdf0e10cSrcweir 1039cdf0e10cSrcweir // set start values 1040cdf0e10cSrcweir nUIUnitKomma = 0; 1041cdf0e10cSrcweir sal_Int64 nMul(1); 1042cdf0e10cSrcweir sal_Int64 nDiv(1); 1043cdf0e10cSrcweir 1044cdf0e10cSrcweir // normalize on meters resp. inch 1045cdf0e10cSrcweir switch (eObjUnit) 1046cdf0e10cSrcweir { 1047cdf0e10cSrcweir case MAP_100TH_MM : nUIUnitKomma+=5; break; 1048cdf0e10cSrcweir case MAP_10TH_MM : nUIUnitKomma+=4; break; 1049cdf0e10cSrcweir case MAP_MM : nUIUnitKomma+=3; break; 1050cdf0e10cSrcweir case MAP_CM : nUIUnitKomma+=2; break; 1051cdf0e10cSrcweir case MAP_1000TH_INCH: nUIUnitKomma+=3; break; 1052cdf0e10cSrcweir case MAP_100TH_INCH : nUIUnitKomma+=2; break; 1053cdf0e10cSrcweir case MAP_10TH_INCH : nUIUnitKomma+=1; break; 1054cdf0e10cSrcweir case MAP_INCH : nUIUnitKomma+=0; break; 1055cdf0e10cSrcweir case MAP_POINT : nDiv=72; break; // 1Pt = 1/72" 1056cdf0e10cSrcweir case MAP_TWIP : nDiv=144; nUIUnitKomma++; break; // 1Twip = 1/1440" 1057cdf0e10cSrcweir case MAP_PIXEL : break; 1058cdf0e10cSrcweir case MAP_SYSFONT : break; 1059cdf0e10cSrcweir case MAP_APPFONT : break; 1060cdf0e10cSrcweir case MAP_RELATIVE : break; 1061cdf0e10cSrcweir default: break; 1062cdf0e10cSrcweir } // switch 1063cdf0e10cSrcweir 1064cdf0e10cSrcweir // 1 mile = 8 furlong = 63.360" = 1.609.344,0mm 1065cdf0e10cSrcweir // 1 furlong = 10 chains = 7.920" = 201.168,0mm 1066cdf0e10cSrcweir // 1 chain = 4 poles = 792" = 20.116,8mm 1067cdf0e10cSrcweir // 1 pole = 5 1/2 yd = 198" = 5.029,2mm 1068cdf0e10cSrcweir // 1 yd = 3 ft = 36" = 914,4mm 1069cdf0e10cSrcweir // 1 ft = 12 " = 1" = 304,8mm 1070cdf0e10cSrcweir switch (eUIUnit) 1071cdf0e10cSrcweir { 1072cdf0e10cSrcweir case FUNIT_NONE : break; 1073cdf0e10cSrcweir // Metrisch 1074cdf0e10cSrcweir case FUNIT_100TH_MM: nUIUnitKomma-=5; break; 1075cdf0e10cSrcweir case FUNIT_MM : nUIUnitKomma-=3; break; 1076cdf0e10cSrcweir case FUNIT_CM : nUIUnitKomma-=2; break; 1077cdf0e10cSrcweir case FUNIT_M : nUIUnitKomma+=0; break; 1078cdf0e10cSrcweir case FUNIT_KM : nUIUnitKomma+=3; break; 1079cdf0e10cSrcweir // Inch 1080cdf0e10cSrcweir case FUNIT_TWIP : nMul=144; nUIUnitKomma--; break; // 1Twip = 1/1440" 1081cdf0e10cSrcweir case FUNIT_POINT : nMul=72; break; // 1Pt = 1/72" 1082cdf0e10cSrcweir case FUNIT_PICA : nMul=6; break; // 1Pica = 1/6" ? 1083cdf0e10cSrcweir case FUNIT_INCH : break; // 1" = 1" 1084cdf0e10cSrcweir case FUNIT_FOOT : nDiv*=12; break; // 1Ft = 12" 1085cdf0e10cSrcweir case FUNIT_MILE : nDiv*=6336; nUIUnitKomma++; break; // 1mile = 63360" 1086cdf0e10cSrcweir // sonstiges 1087cdf0e10cSrcweir case FUNIT_CUSTOM : break; 1088cdf0e10cSrcweir case FUNIT_PERCENT: nUIUnitKomma+=2; break; 1089cdf0e10cSrcweir } // switch 1090cdf0e10cSrcweir 1091cdf0e10cSrcweir // check if mapping is from metric to inch and adapt 1092cdf0e10cSrcweir const bool bMapInch(IsInch(eObjUnit)); 1093cdf0e10cSrcweir const bool bUIMetr(IsMetric(eUIUnit)); 1094cdf0e10cSrcweir 1095cdf0e10cSrcweir if (bMapInch && bUIMetr) 1096cdf0e10cSrcweir { 1097cdf0e10cSrcweir nUIUnitKomma += 4; 1098cdf0e10cSrcweir nMul *= 254; 1099cdf0e10cSrcweir } 1100cdf0e10cSrcweir 1101cdf0e10cSrcweir // check if mapping is from inch to metric and adapt 1102cdf0e10cSrcweir const bool bMapMetr(IsMetric(eObjUnit)); 1103cdf0e10cSrcweir const bool bUIInch(IsInch(eUIUnit)); 1104cdf0e10cSrcweir 1105cdf0e10cSrcweir if (bMapMetr && bUIInch) 1106cdf0e10cSrcweir { 1107cdf0e10cSrcweir nUIUnitKomma -= 4; 1108cdf0e10cSrcweir nDiv *= 254; 1109cdf0e10cSrcweir } 1110cdf0e10cSrcweir 1111cdf0e10cSrcweir // use temporary fraction for reduction (fallback to 32bit here), 1112cdf0e10cSrcweir // may need to be changed in the future, too 1113cdf0e10cSrcweir if(1 != nMul || 1 != nDiv) 1114cdf0e10cSrcweir { 1115cdf0e10cSrcweir const Fraction aTemp(static_cast< long >(nMul), static_cast< long >(nDiv)); 1116cdf0e10cSrcweir nMul = aTemp.GetNumerator(); 1117cdf0e10cSrcweir nDiv = aTemp.GetDenominator(); 1118cdf0e10cSrcweir } 1119cdf0e10cSrcweir 1120cdf0e10cSrcweir // #i89872# take Unit of Measurement into account 1121cdf0e10cSrcweir if(1 != aUIScale.GetDenominator() || 1 != aUIScale.GetNumerator()) 1122cdf0e10cSrcweir { 1123cdf0e10cSrcweir // divide by UIScale 1124cdf0e10cSrcweir nMul *= aUIScale.GetDenominator(); 1125cdf0e10cSrcweir nDiv *= aUIScale.GetNumerator(); 1126cdf0e10cSrcweir } 1127cdf0e10cSrcweir 1128cdf0e10cSrcweir // shorten trailing zeroes for dividend 1129cdf0e10cSrcweir while(0 == (nMul % 10)) 1130cdf0e10cSrcweir { 1131cdf0e10cSrcweir nUIUnitKomma--; 1132cdf0e10cSrcweir nMul /= 10; 1133cdf0e10cSrcweir } 1134cdf0e10cSrcweir 1135cdf0e10cSrcweir // shorten trailing zeroes for divisor 1136cdf0e10cSrcweir while(0 == (nDiv % 10)) 1137cdf0e10cSrcweir { 1138cdf0e10cSrcweir nUIUnitKomma++; 1139cdf0e10cSrcweir nDiv /= 10; 1140cdf0e10cSrcweir } 1141cdf0e10cSrcweir 1142cdf0e10cSrcweir // end preparations, set member values 1143cdf0e10cSrcweir aUIUnitFact = Fraction(sal_Int32(nMul), sal_Int32(nDiv)); 1144cdf0e10cSrcweir bUIOnlyKomma = (nMul == nDiv); 1145cdf0e10cSrcweir TakeUnitStr(eUIUnit, aUIUnitStr); 1146cdf0e10cSrcweir } 1147cdf0e10cSrcweir 1148cdf0e10cSrcweir void SdrModel::SetScaleUnit(MapUnit eMap, const Fraction& rFrac) 1149cdf0e10cSrcweir { 1150cdf0e10cSrcweir if (eObjUnit!=eMap || aObjUnit!=rFrac) { 1151cdf0e10cSrcweir eObjUnit=eMap; 1152cdf0e10cSrcweir aObjUnit=rFrac; 1153cdf0e10cSrcweir pItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit); 1154cdf0e10cSrcweir ImpSetUIUnit(); 1155cdf0e10cSrcweir ImpSetOutlinerDefaults( pDrawOutliner ); 1156cdf0e10cSrcweir ImpSetOutlinerDefaults( pHitTestOutliner ); 1157cdf0e10cSrcweir ImpReformatAllTextObjects(); // #40424# 1158cdf0e10cSrcweir } 1159cdf0e10cSrcweir } 1160cdf0e10cSrcweir 1161cdf0e10cSrcweir void SdrModel::SetScaleUnit(MapUnit eMap) 1162cdf0e10cSrcweir { 1163cdf0e10cSrcweir if (eObjUnit!=eMap) { 1164cdf0e10cSrcweir eObjUnit=eMap; 1165cdf0e10cSrcweir pItemPool->SetDefaultMetric((SfxMapUnit)eObjUnit); 1166cdf0e10cSrcweir ImpSetUIUnit(); 1167cdf0e10cSrcweir ImpSetOutlinerDefaults( pDrawOutliner ); 1168cdf0e10cSrcweir ImpSetOutlinerDefaults( pHitTestOutliner ); 1169cdf0e10cSrcweir ImpReformatAllTextObjects(); // #40424# 1170cdf0e10cSrcweir } 1171cdf0e10cSrcweir } 1172cdf0e10cSrcweir 1173cdf0e10cSrcweir void SdrModel::SetScaleFraction(const Fraction& rFrac) 1174cdf0e10cSrcweir { 1175cdf0e10cSrcweir if (aObjUnit!=rFrac) { 1176cdf0e10cSrcweir aObjUnit=rFrac; 1177cdf0e10cSrcweir ImpSetUIUnit(); 1178cdf0e10cSrcweir ImpSetOutlinerDefaults( pDrawOutliner ); 1179cdf0e10cSrcweir ImpSetOutlinerDefaults( pHitTestOutliner ); 1180cdf0e10cSrcweir ImpReformatAllTextObjects(); // #40424# 1181cdf0e10cSrcweir } 1182cdf0e10cSrcweir } 1183cdf0e10cSrcweir 1184cdf0e10cSrcweir void SdrModel::SetUIUnit(FieldUnit eUnit) 1185cdf0e10cSrcweir { 1186cdf0e10cSrcweir if (eUIUnit!=eUnit) { 1187cdf0e10cSrcweir eUIUnit=eUnit; 1188cdf0e10cSrcweir ImpSetUIUnit(); 1189cdf0e10cSrcweir ImpReformatAllTextObjects(); // #40424# 1190cdf0e10cSrcweir } 1191cdf0e10cSrcweir } 1192cdf0e10cSrcweir 1193cdf0e10cSrcweir void SdrModel::SetUIScale(const Fraction& rScale) 1194cdf0e10cSrcweir { 1195cdf0e10cSrcweir if (aUIScale!=rScale) { 1196cdf0e10cSrcweir aUIScale=rScale; 1197cdf0e10cSrcweir ImpSetUIUnit(); 1198cdf0e10cSrcweir ImpReformatAllTextObjects(); // #40424# 1199cdf0e10cSrcweir } 1200cdf0e10cSrcweir } 1201cdf0e10cSrcweir 1202cdf0e10cSrcweir void SdrModel::SetUIUnit(FieldUnit eUnit, const Fraction& rScale) 1203cdf0e10cSrcweir { 1204cdf0e10cSrcweir if (eUIUnit!=eUnit || aUIScale!=rScale) { 1205cdf0e10cSrcweir eUIUnit=eUnit; 1206cdf0e10cSrcweir aUIScale=rScale; 1207cdf0e10cSrcweir ImpSetUIUnit(); 1208cdf0e10cSrcweir ImpReformatAllTextObjects(); // #40424# 1209cdf0e10cSrcweir } 1210cdf0e10cSrcweir } 1211cdf0e10cSrcweir 1212cdf0e10cSrcweir void SdrModel::TakeUnitStr(FieldUnit eUnit, XubString& rStr) 1213cdf0e10cSrcweir { 1214cdf0e10cSrcweir switch(eUnit) 1215cdf0e10cSrcweir { 1216cdf0e10cSrcweir default: 1217cdf0e10cSrcweir case FUNIT_NONE : 1218cdf0e10cSrcweir case FUNIT_CUSTOM : 1219cdf0e10cSrcweir { 1220cdf0e10cSrcweir rStr = String(); 1221cdf0e10cSrcweir break; 1222cdf0e10cSrcweir } 1223cdf0e10cSrcweir case FUNIT_100TH_MM: 1224cdf0e10cSrcweir { 1225cdf0e10cSrcweir sal_Char aText[] = "/100mm"; 1226cdf0e10cSrcweir rStr = UniString(aText, sizeof(aText-1)); 1227cdf0e10cSrcweir break; 1228cdf0e10cSrcweir } 1229cdf0e10cSrcweir case FUNIT_MM : 1230cdf0e10cSrcweir { 1231cdf0e10cSrcweir sal_Char aText[] = "mm"; 1232cdf0e10cSrcweir rStr = UniString(aText, sizeof(aText-1)); 1233cdf0e10cSrcweir break; 1234cdf0e10cSrcweir } 1235cdf0e10cSrcweir case FUNIT_CM : 1236cdf0e10cSrcweir { 1237cdf0e10cSrcweir sal_Char aText[] = "cm"; 1238cdf0e10cSrcweir rStr = UniString(aText, sizeof(aText-1)); 1239cdf0e10cSrcweir break; 1240cdf0e10cSrcweir } 1241cdf0e10cSrcweir case FUNIT_M : 1242cdf0e10cSrcweir { 1243cdf0e10cSrcweir rStr = String(); 1244cdf0e10cSrcweir rStr += sal_Unicode('m'); 1245cdf0e10cSrcweir break; 1246cdf0e10cSrcweir } 1247cdf0e10cSrcweir case FUNIT_KM : 1248cdf0e10cSrcweir { 1249cdf0e10cSrcweir sal_Char aText[] = "km"; 1250cdf0e10cSrcweir rStr = UniString(aText, sizeof(aText-1)); 1251cdf0e10cSrcweir break; 1252cdf0e10cSrcweir } 1253cdf0e10cSrcweir case FUNIT_TWIP : 1254cdf0e10cSrcweir { 1255cdf0e10cSrcweir sal_Char aText[] = "twip"; 1256cdf0e10cSrcweir rStr = UniString(aText, sizeof(aText-1)); 1257cdf0e10cSrcweir break; 1258cdf0e10cSrcweir } 1259cdf0e10cSrcweir case FUNIT_POINT : 1260cdf0e10cSrcweir { 1261cdf0e10cSrcweir sal_Char aText[] = "pt"; 1262cdf0e10cSrcweir rStr = UniString(aText, sizeof(aText-1)); 1263cdf0e10cSrcweir break; 1264cdf0e10cSrcweir } 1265cdf0e10cSrcweir case FUNIT_PICA : 1266cdf0e10cSrcweir { 1267cdf0e10cSrcweir sal_Char aText[] = "pica"; 1268cdf0e10cSrcweir rStr = UniString(aText, sizeof(aText-1)); 1269cdf0e10cSrcweir break; 1270cdf0e10cSrcweir } 1271cdf0e10cSrcweir case FUNIT_INCH : 1272cdf0e10cSrcweir { 1273cdf0e10cSrcweir rStr = String(); 1274cdf0e10cSrcweir rStr += sal_Unicode('"'); 1275cdf0e10cSrcweir break; 1276cdf0e10cSrcweir } 1277cdf0e10cSrcweir case FUNIT_FOOT : 1278cdf0e10cSrcweir { 1279cdf0e10cSrcweir sal_Char aText[] = "ft"; 1280cdf0e10cSrcweir rStr = UniString(aText, sizeof(aText-1)); 1281cdf0e10cSrcweir break; 1282cdf0e10cSrcweir } 1283cdf0e10cSrcweir case FUNIT_MILE : 1284cdf0e10cSrcweir { 1285cdf0e10cSrcweir sal_Char aText[] = "mile(s)"; 1286cdf0e10cSrcweir rStr = UniString(aText, sizeof(aText-1)); 1287cdf0e10cSrcweir break; 1288cdf0e10cSrcweir } 1289cdf0e10cSrcweir case FUNIT_PERCENT: 1290cdf0e10cSrcweir { 1291cdf0e10cSrcweir rStr = String(); 1292cdf0e10cSrcweir rStr += sal_Unicode('%'); 1293cdf0e10cSrcweir break; 1294cdf0e10cSrcweir } 1295cdf0e10cSrcweir } 1296cdf0e10cSrcweir } 1297cdf0e10cSrcweir 1298cdf0e10cSrcweir void SdrModel::TakeMetricStr(long nVal, XubString& rStr, FASTBOOL bNoUnitChars, sal_Int32 nNumDigits) const 1299cdf0e10cSrcweir { 1300cdf0e10cSrcweir // #i22167# 1301cdf0e10cSrcweir // change to double precision usage to not loose decimal places after comma 1302cdf0e10cSrcweir const bool bNegative(nVal < 0L); 1303cdf0e10cSrcweir SvtSysLocale aSysLoc; 1304cdf0e10cSrcweir const LocaleDataWrapper& rLoc(aSysLoc.GetLocaleData()); 1305cdf0e10cSrcweir double fLocalValue(double(nVal) * double(aUIUnitFact)); 1306cdf0e10cSrcweir 1307cdf0e10cSrcweir if(bNegative) 1308cdf0e10cSrcweir { 1309cdf0e10cSrcweir fLocalValue = -fLocalValue; 1310cdf0e10cSrcweir } 1311cdf0e10cSrcweir 1312cdf0e10cSrcweir if( -1 == nNumDigits ) 1313cdf0e10cSrcweir { 1314cdf0e10cSrcweir nNumDigits = rLoc.getNumDigits(); 1315cdf0e10cSrcweir } 1316cdf0e10cSrcweir 1317cdf0e10cSrcweir sal_Int32 nKomma(nUIUnitKomma); 1318cdf0e10cSrcweir 1319cdf0e10cSrcweir if(nKomma > nNumDigits) 1320cdf0e10cSrcweir { 1321cdf0e10cSrcweir const sal_Int32 nDiff(nKomma - nNumDigits); 1322cdf0e10cSrcweir const double fFactor(pow(10.0, static_cast<const int>(nDiff))); 1323cdf0e10cSrcweir 1324cdf0e10cSrcweir fLocalValue /= fFactor; 1325cdf0e10cSrcweir nKomma = nNumDigits; 1326cdf0e10cSrcweir } 1327cdf0e10cSrcweir else if(nKomma < nNumDigits) 1328cdf0e10cSrcweir { 1329cdf0e10cSrcweir const sal_Int32 nDiff(nNumDigits - nKomma); 1330cdf0e10cSrcweir const double fFactor(pow(10.0, static_cast<const int>(nDiff))); 1331cdf0e10cSrcweir 1332cdf0e10cSrcweir fLocalValue *= fFactor; 1333cdf0e10cSrcweir nKomma = nNumDigits; 1334cdf0e10cSrcweir } 1335cdf0e10cSrcweir 1336cdf0e10cSrcweir rStr = UniString::CreateFromInt32(static_cast<sal_Int32>(fLocalValue + 0.5)); 1337cdf0e10cSrcweir 1338cdf0e10cSrcweir if(nKomma < 0) 1339cdf0e10cSrcweir { 1340cdf0e10cSrcweir // Negatives Komma bedeutet: Nullen dran 1341cdf0e10cSrcweir sal_Int32 nAnz(-nKomma); 1342cdf0e10cSrcweir 1343cdf0e10cSrcweir for(sal_Int32 i=0; i<nAnz; i++) 1344cdf0e10cSrcweir rStr += sal_Unicode('0'); 1345cdf0e10cSrcweir 1346cdf0e10cSrcweir nKomma = 0; 1347cdf0e10cSrcweir } 1348cdf0e10cSrcweir 1349cdf0e10cSrcweir // #83257# the second condition needs to be <= since inside this loop 1350cdf0e10cSrcweir // also the leading zero is inserted. 1351cdf0e10cSrcweir if(nKomma > 0 && rStr.Len() <= nKomma) 1352cdf0e10cSrcweir { 1353cdf0e10cSrcweir // Fuer Komma evtl. vorne Nullen dran 1354cdf0e10cSrcweir sal_Int32 nAnz(nKomma - rStr.Len()); 1355cdf0e10cSrcweir 1356cdf0e10cSrcweir if(nAnz >= 0 && rLoc.isNumLeadingZero()) 1357cdf0e10cSrcweir nAnz++; 1358cdf0e10cSrcweir 1359cdf0e10cSrcweir for(sal_Int32 i=0; i<nAnz; i++) 1360cdf0e10cSrcweir rStr.Insert(sal_Unicode('0'), 0); 1361cdf0e10cSrcweir } 1362cdf0e10cSrcweir 1363cdf0e10cSrcweir sal_Unicode cDec( rLoc.getNumDecimalSep().GetChar(0) ); 1364cdf0e10cSrcweir 1365cdf0e10cSrcweir // KommaChar einfuegen 1366cdf0e10cSrcweir sal_Int32 nVorKomma(rStr.Len() - nKomma); 1367cdf0e10cSrcweir 1368cdf0e10cSrcweir if(nKomma > 0) 1369cdf0e10cSrcweir rStr.Insert(cDec, (xub_StrLen) nVorKomma); 1370cdf0e10cSrcweir 1371cdf0e10cSrcweir if(!rLoc.isNumTrailingZeros()) 1372cdf0e10cSrcweir { 1373cdf0e10cSrcweir while(rStr.Len() && rStr.GetChar(rStr.Len() - 1) == sal_Unicode('0')) 1374cdf0e10cSrcweir rStr.Erase(rStr.Len() - 1); 1375cdf0e10cSrcweir 1376cdf0e10cSrcweir if(rStr.Len() && rStr.GetChar(rStr.Len() - 1) == cDec) 1377cdf0e10cSrcweir rStr.Erase(rStr.Len() - 1); 1378cdf0e10cSrcweir } 1379cdf0e10cSrcweir 1380cdf0e10cSrcweir // ggf. Trennpunkte bei jedem Tausender einfuegen 1381cdf0e10cSrcweir if( nVorKomma > 3 ) 1382cdf0e10cSrcweir { 1383cdf0e10cSrcweir String aThoSep( rLoc.getNumThousandSep() ); 1384cdf0e10cSrcweir if ( aThoSep.Len() > 0 ) 1385cdf0e10cSrcweir { 1386cdf0e10cSrcweir sal_Unicode cTho( aThoSep.GetChar(0) ); 1387cdf0e10cSrcweir sal_Int32 i(nVorKomma - 3); 1388cdf0e10cSrcweir 1389cdf0e10cSrcweir while(i > 0) // #78311# 1390cdf0e10cSrcweir { 1391cdf0e10cSrcweir rStr.Insert(cTho, (xub_StrLen)i); 1392cdf0e10cSrcweir i -= 3; 1393cdf0e10cSrcweir } 1394cdf0e10cSrcweir } 1395cdf0e10cSrcweir } 1396cdf0e10cSrcweir 1397cdf0e10cSrcweir if(!rStr.Len()) 1398cdf0e10cSrcweir { 1399cdf0e10cSrcweir rStr = String(); 1400cdf0e10cSrcweir rStr += sal_Unicode('0'); 1401cdf0e10cSrcweir } 1402cdf0e10cSrcweir 1403cdf0e10cSrcweir if(bNegative) 1404cdf0e10cSrcweir { 1405cdf0e10cSrcweir rStr.Insert(sal_Unicode('-'), 0); 1406cdf0e10cSrcweir } 1407cdf0e10cSrcweir 1408cdf0e10cSrcweir if(!bNoUnitChars) 1409cdf0e10cSrcweir rStr += aUIUnitStr; 1410cdf0e10cSrcweir } 1411cdf0e10cSrcweir 1412cdf0e10cSrcweir void SdrModel::TakeWinkStr(long nWink, XubString& rStr, FASTBOOL bNoDegChar) const 1413cdf0e10cSrcweir { 1414cdf0e10cSrcweir sal_Bool bNeg(nWink < 0); 1415cdf0e10cSrcweir 1416cdf0e10cSrcweir if(bNeg) 1417cdf0e10cSrcweir nWink = -nWink; 1418cdf0e10cSrcweir 1419cdf0e10cSrcweir rStr = UniString::CreateFromInt32(nWink); 1420cdf0e10cSrcweir 1421cdf0e10cSrcweir SvtSysLocale aSysLoc; 1422cdf0e10cSrcweir const LocaleDataWrapper& rLoc = aSysLoc.GetLocaleData(); 1423cdf0e10cSrcweir xub_StrLen nAnz(2); 1424cdf0e10cSrcweir 1425cdf0e10cSrcweir if(rLoc.isNumLeadingZero()) 1426cdf0e10cSrcweir nAnz++; 1427cdf0e10cSrcweir 1428cdf0e10cSrcweir while(rStr.Len() < nAnz) 1429cdf0e10cSrcweir rStr.Insert(sal_Unicode('0'), 0); 1430cdf0e10cSrcweir 1431cdf0e10cSrcweir rStr.Insert(rLoc.getNumDecimalSep().GetChar(0), rStr.Len() - 2); 1432cdf0e10cSrcweir 1433cdf0e10cSrcweir if(bNeg) 1434cdf0e10cSrcweir rStr.Insert(sal_Unicode('-'), 0); 1435cdf0e10cSrcweir 1436cdf0e10cSrcweir if(!bNoDegChar) 1437cdf0e10cSrcweir rStr += DEGREE_CHAR; 1438cdf0e10cSrcweir } 1439cdf0e10cSrcweir 1440cdf0e10cSrcweir void SdrModel::TakePercentStr(const Fraction& rVal, XubString& rStr, FASTBOOL bNoPercentChar) const 1441cdf0e10cSrcweir { 1442cdf0e10cSrcweir sal_Int32 nMul(rVal.GetNumerator()); 1443cdf0e10cSrcweir sal_Int32 nDiv(rVal.GetDenominator()); 1444cdf0e10cSrcweir sal_Bool bNeg(nMul < 0); 1445cdf0e10cSrcweir 1446cdf0e10cSrcweir if(nDiv < 0) 1447cdf0e10cSrcweir bNeg = !bNeg; 1448cdf0e10cSrcweir 1449cdf0e10cSrcweir if(nMul < 0) 1450cdf0e10cSrcweir nMul = -nMul; 1451cdf0e10cSrcweir 1452cdf0e10cSrcweir if(nDiv < 0) 1453cdf0e10cSrcweir nDiv = -nDiv; 1454cdf0e10cSrcweir 1455cdf0e10cSrcweir nMul *= 100; 1456cdf0e10cSrcweir nMul += nDiv/2; 1457cdf0e10cSrcweir nMul /= nDiv; 1458cdf0e10cSrcweir 1459cdf0e10cSrcweir rStr = UniString::CreateFromInt32(nMul); 1460cdf0e10cSrcweir 1461cdf0e10cSrcweir if(bNeg) 1462cdf0e10cSrcweir rStr.Insert(sal_Unicode('-'), 0); 1463cdf0e10cSrcweir 1464cdf0e10cSrcweir if(!bNoPercentChar) 1465cdf0e10cSrcweir rStr += sal_Unicode('%'); 1466cdf0e10cSrcweir } 1467cdf0e10cSrcweir 1468cdf0e10cSrcweir void SdrModel::SetChanged(sal_Bool bFlg) 1469cdf0e10cSrcweir { 1470cdf0e10cSrcweir mbChanged = bFlg; 1471cdf0e10cSrcweir } 1472cdf0e10cSrcweir 1473cdf0e10cSrcweir void SdrModel::RecalcPageNums(FASTBOOL bMaster) 1474cdf0e10cSrcweir { 1475cdf0e10cSrcweir Container& rPL=*(bMaster ? &maMaPag : &maPages); 1476cdf0e10cSrcweir sal_uInt16 nAnz=sal_uInt16(rPL.Count()); 1477cdf0e10cSrcweir sal_uInt16 i; 1478cdf0e10cSrcweir for (i=0; i<nAnz; i++) { 1479cdf0e10cSrcweir SdrPage* pPg=(SdrPage*)(rPL.GetObject(i)); 1480cdf0e10cSrcweir pPg->SetPageNum(i); 1481cdf0e10cSrcweir } 1482cdf0e10cSrcweir if (bMaster) bMPgNumsDirty=sal_False; 1483cdf0e10cSrcweir else bPagNumsDirty=sal_False; 1484cdf0e10cSrcweir } 1485cdf0e10cSrcweir 1486cdf0e10cSrcweir void SdrModel::InsertPage(SdrPage* pPage, sal_uInt16 nPos) 1487cdf0e10cSrcweir { 1488cdf0e10cSrcweir sal_uInt16 nAnz=GetPageCount(); 1489cdf0e10cSrcweir if (nPos>nAnz) nPos=nAnz; 1490cdf0e10cSrcweir maPages.Insert(pPage,nPos); 1491cdf0e10cSrcweir // #109538# 1492cdf0e10cSrcweir PageListChanged(); 1493cdf0e10cSrcweir pPage->SetInserted(sal_True); 1494cdf0e10cSrcweir pPage->SetPageNum(nPos); 1495cdf0e10cSrcweir pPage->SetModel(this); 1496cdf0e10cSrcweir if (nPos<nAnz) bPagNumsDirty=sal_True; 1497cdf0e10cSrcweir SetChanged(); 1498cdf0e10cSrcweir SdrHint aHint(HINT_PAGEORDERCHG); 1499cdf0e10cSrcweir aHint.SetPage(pPage); 1500cdf0e10cSrcweir Broadcast(aHint); 1501cdf0e10cSrcweir } 1502cdf0e10cSrcweir 1503cdf0e10cSrcweir void SdrModel::DeletePage(sal_uInt16 nPgNum) 1504cdf0e10cSrcweir { 1505cdf0e10cSrcweir SdrPage* pPg=RemovePage(nPgNum); 1506cdf0e10cSrcweir delete pPg; 1507cdf0e10cSrcweir } 1508cdf0e10cSrcweir 1509cdf0e10cSrcweir SdrPage* SdrModel::RemovePage(sal_uInt16 nPgNum) 1510cdf0e10cSrcweir { 1511cdf0e10cSrcweir SdrPage* pPg=(SdrPage*)maPages.Remove(nPgNum); 1512cdf0e10cSrcweir // #109538# 1513cdf0e10cSrcweir PageListChanged(); 1514cdf0e10cSrcweir if (pPg!=NULL) { 1515cdf0e10cSrcweir pPg->SetInserted(sal_False); 1516cdf0e10cSrcweir } 1517cdf0e10cSrcweir bPagNumsDirty=sal_True; 1518cdf0e10cSrcweir SetChanged(); 1519cdf0e10cSrcweir SdrHint aHint(HINT_PAGEORDERCHG); 1520cdf0e10cSrcweir aHint.SetPage(pPg); 1521cdf0e10cSrcweir Broadcast(aHint); 1522cdf0e10cSrcweir return pPg; 1523cdf0e10cSrcweir } 1524cdf0e10cSrcweir 1525cdf0e10cSrcweir void SdrModel::MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos) 1526cdf0e10cSrcweir { 1527cdf0e10cSrcweir SdrPage* pPg=(SdrPage*)maPages.Remove(nPgNum); 1528cdf0e10cSrcweir // #109538# 1529cdf0e10cSrcweir PageListChanged(); 1530cdf0e10cSrcweir if (pPg!=NULL) { 1531cdf0e10cSrcweir pPg->SetInserted(sal_False); 1532cdf0e10cSrcweir InsertPage(pPg,nNewPos); 1533cdf0e10cSrcweir } 1534cdf0e10cSrcweir } 1535cdf0e10cSrcweir 1536cdf0e10cSrcweir void SdrModel::InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos) 1537cdf0e10cSrcweir { 1538cdf0e10cSrcweir sal_uInt16 nAnz=GetMasterPageCount(); 1539cdf0e10cSrcweir if (nPos>nAnz) nPos=nAnz; 1540cdf0e10cSrcweir maMaPag.Insert(pPage,nPos); 1541cdf0e10cSrcweir // #109538# 1542cdf0e10cSrcweir MasterPageListChanged(); 1543cdf0e10cSrcweir pPage->SetInserted(sal_True); 1544cdf0e10cSrcweir pPage->SetPageNum(nPos); 1545cdf0e10cSrcweir pPage->SetModel(this); 1546cdf0e10cSrcweir if (nPos<nAnz) { 1547cdf0e10cSrcweir bMPgNumsDirty=sal_True; 1548cdf0e10cSrcweir } 1549cdf0e10cSrcweir SetChanged(); 1550cdf0e10cSrcweir SdrHint aHint(HINT_PAGEORDERCHG); 1551cdf0e10cSrcweir aHint.SetPage(pPage); 1552cdf0e10cSrcweir Broadcast(aHint); 1553cdf0e10cSrcweir } 1554cdf0e10cSrcweir 1555cdf0e10cSrcweir void SdrModel::DeleteMasterPage(sal_uInt16 nPgNum) 1556cdf0e10cSrcweir { 1557cdf0e10cSrcweir SdrPage* pPg=RemoveMasterPage(nPgNum); 1558cdf0e10cSrcweir if (pPg!=NULL) delete pPg; 1559cdf0e10cSrcweir } 1560cdf0e10cSrcweir 1561cdf0e10cSrcweir SdrPage* SdrModel::RemoveMasterPage(sal_uInt16 nPgNum) 1562cdf0e10cSrcweir { 1563cdf0e10cSrcweir SdrPage* pRetPg=(SdrPage*)maMaPag.Remove(nPgNum); 1564cdf0e10cSrcweir // #109538# 1565cdf0e10cSrcweir MasterPageListChanged(); 1566cdf0e10cSrcweir 1567cdf0e10cSrcweir if(pRetPg) 1568cdf0e10cSrcweir { 1569cdf0e10cSrcweir // Nun die Verweise der normalen Zeichenseiten auf die entfernte MasterPage loeschen 1570cdf0e10cSrcweir sal_uInt16 nPageAnz(GetPageCount()); 1571cdf0e10cSrcweir 1572cdf0e10cSrcweir for(sal_uInt16 np(0); np < nPageAnz; np++) 1573cdf0e10cSrcweir { 1574cdf0e10cSrcweir GetPage(np)->TRG_ImpMasterPageRemoved(*pRetPg); 1575cdf0e10cSrcweir } 1576cdf0e10cSrcweir 1577cdf0e10cSrcweir pRetPg->SetInserted(sal_False); 1578cdf0e10cSrcweir } 1579cdf0e10cSrcweir 1580cdf0e10cSrcweir bMPgNumsDirty=sal_True; 1581cdf0e10cSrcweir SetChanged(); 1582cdf0e10cSrcweir SdrHint aHint(HINT_PAGEORDERCHG); 1583cdf0e10cSrcweir aHint.SetPage(pRetPg); 1584cdf0e10cSrcweir Broadcast(aHint); 1585cdf0e10cSrcweir return pRetPg; 1586cdf0e10cSrcweir } 1587cdf0e10cSrcweir 1588cdf0e10cSrcweir void SdrModel::MoveMasterPage(sal_uInt16 nPgNum, sal_uInt16 nNewPos) 1589cdf0e10cSrcweir { 1590cdf0e10cSrcweir SdrPage* pPg=(SdrPage*)maMaPag.Remove(nPgNum); 1591cdf0e10cSrcweir // #109538# 1592cdf0e10cSrcweir MasterPageListChanged(); 1593cdf0e10cSrcweir if (pPg!=NULL) { 1594cdf0e10cSrcweir pPg->SetInserted(sal_False); 1595cdf0e10cSrcweir maMaPag.Insert(pPg,nNewPos); 1596cdf0e10cSrcweir // #109538# 1597cdf0e10cSrcweir MasterPageListChanged(); 1598cdf0e10cSrcweir } 1599cdf0e10cSrcweir bMPgNumsDirty=sal_True; 1600cdf0e10cSrcweir SetChanged(); 1601cdf0e10cSrcweir SdrHint aHint(HINT_PAGEORDERCHG); 1602cdf0e10cSrcweir aHint.SetPage(pPg); 1603cdf0e10cSrcweir Broadcast(aHint); 1604cdf0e10cSrcweir } 1605cdf0e10cSrcweir 1606cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 1607cdf0e10cSrcweir 1608cdf0e10cSrcweir FASTBOOL SdrModel::CheckConsistence() const 1609cdf0e10cSrcweir { 1610cdf0e10cSrcweir FASTBOOL bRet=sal_True; 1611cdf0e10cSrcweir #ifdef DBG_UTIL 1612cdf0e10cSrcweir DBG_CHKTHIS(SdrModel,NULL); 1613cdf0e10cSrcweir #endif 1614cdf0e10cSrcweir return bRet; 1615cdf0e10cSrcweir } 1616cdf0e10cSrcweir 1617cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 1618cdf0e10cSrcweir 1619cdf0e10cSrcweir // #48289# 1620cdf0e10cSrcweir void SdrModel::CopyPages(sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum, 1621cdf0e10cSrcweir sal_uInt16 nDestPos, 1622cdf0e10cSrcweir FASTBOOL bUndo, FASTBOOL bMoveNoCopy) 1623cdf0e10cSrcweir { 1624cdf0e10cSrcweir if( bUndo && !IsUndoEnabled() ) 1625cdf0e10cSrcweir bUndo = false; 1626cdf0e10cSrcweir 1627cdf0e10cSrcweir if( bUndo ) 1628cdf0e10cSrcweir BegUndo(ImpGetResStr(STR_UndoMergeModel)); 1629cdf0e10cSrcweir 1630cdf0e10cSrcweir sal_uInt16 nPageAnz=GetPageCount(); 1631cdf0e10cSrcweir sal_uInt16 nMaxPage=nPageAnz; 1632cdf0e10cSrcweir 1633cdf0e10cSrcweir if (nMaxPage!=0) 1634cdf0e10cSrcweir nMaxPage--; 1635cdf0e10cSrcweir if (nFirstPageNum>nMaxPage) 1636cdf0e10cSrcweir nFirstPageNum=nMaxPage; 1637cdf0e10cSrcweir if (nLastPageNum>nMaxPage) 1638cdf0e10cSrcweir nLastPageNum =nMaxPage; 1639cdf0e10cSrcweir FASTBOOL bReverse=nLastPageNum<nFirstPageNum; 1640cdf0e10cSrcweir if (nDestPos>nPageAnz) 1641cdf0e10cSrcweir nDestPos=nPageAnz; 1642cdf0e10cSrcweir 1643cdf0e10cSrcweir // Zunaechst die Zeiger der betroffenen Seiten in einem Array sichern 1644cdf0e10cSrcweir sal_uInt16 nPageNum=nFirstPageNum; 1645cdf0e10cSrcweir sal_uInt16 nCopyAnz=((!bReverse)?(nLastPageNum-nFirstPageNum):(nFirstPageNum-nLastPageNum))+1; 1646cdf0e10cSrcweir SdrPage** pPagePtrs=new SdrPage*[nCopyAnz]; 1647cdf0e10cSrcweir sal_uInt16 nCopyNum; 1648cdf0e10cSrcweir for(nCopyNum=0; nCopyNum<nCopyAnz; nCopyNum++) 1649cdf0e10cSrcweir { 1650cdf0e10cSrcweir pPagePtrs[nCopyNum]=GetPage(nPageNum); 1651cdf0e10cSrcweir if (bReverse) 1652cdf0e10cSrcweir nPageNum--; 1653cdf0e10cSrcweir else 1654cdf0e10cSrcweir nPageNum++; 1655cdf0e10cSrcweir } 1656cdf0e10cSrcweir 1657cdf0e10cSrcweir // Jetzt die Seiten kopieren 1658cdf0e10cSrcweir sal_uInt16 nDestNum=nDestPos; 1659cdf0e10cSrcweir for (nCopyNum=0; nCopyNum<nCopyAnz; nCopyNum++) 1660cdf0e10cSrcweir { 1661cdf0e10cSrcweir SdrPage* pPg=pPagePtrs[nCopyNum]; 1662cdf0e10cSrcweir sal_uInt16 nPageNum2=pPg->GetPageNum(); 1663cdf0e10cSrcweir if (!bMoveNoCopy) 1664cdf0e10cSrcweir { 1665cdf0e10cSrcweir const SdrPage* pPg1=GetPage(nPageNum2); 1666cdf0e10cSrcweir pPg=pPg1->Clone(); 1667cdf0e10cSrcweir InsertPage(pPg,nDestNum); 1668cdf0e10cSrcweir if (bUndo) 1669cdf0e10cSrcweir AddUndo(GetSdrUndoFactory().CreateUndoCopyPage(*pPg)); 1670cdf0e10cSrcweir nDestNum++; 1671cdf0e10cSrcweir } 1672cdf0e10cSrcweir else 1673cdf0e10cSrcweir { 1674cdf0e10cSrcweir // Move ist nicht getestet! 1675cdf0e10cSrcweir if (nDestNum>nPageNum2) 1676cdf0e10cSrcweir nDestNum--; 1677cdf0e10cSrcweir 1678cdf0e10cSrcweir if(bUndo) 1679cdf0e10cSrcweir AddUndo(GetSdrUndoFactory().CreateUndoSetPageNum(*GetPage(nPageNum2),nPageNum2,nDestNum)); 1680cdf0e10cSrcweir 1681cdf0e10cSrcweir pPg=RemovePage(nPageNum2); 1682cdf0e10cSrcweir InsertPage(pPg,nDestNum); 1683cdf0e10cSrcweir nDestNum++; 1684cdf0e10cSrcweir } 1685cdf0e10cSrcweir 1686cdf0e10cSrcweir if(bReverse) 1687cdf0e10cSrcweir nPageNum2--; 1688cdf0e10cSrcweir else 1689cdf0e10cSrcweir nPageNum2++; 1690cdf0e10cSrcweir } 1691cdf0e10cSrcweir 1692cdf0e10cSrcweir delete[] pPagePtrs; 1693cdf0e10cSrcweir if(bUndo) 1694cdf0e10cSrcweir EndUndo(); 1695cdf0e10cSrcweir } 1696cdf0e10cSrcweir 1697cdf0e10cSrcweir void SdrModel::Merge(SdrModel& rSourceModel, 1698cdf0e10cSrcweir sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum, 1699cdf0e10cSrcweir sal_uInt16 nDestPos, 1700cdf0e10cSrcweir FASTBOOL bMergeMasterPages, FASTBOOL bAllMasterPages, 1701cdf0e10cSrcweir FASTBOOL bUndo, FASTBOOL bTreadSourceAsConst) 1702cdf0e10cSrcweir { 1703cdf0e10cSrcweir if (&rSourceModel==this) 1704cdf0e10cSrcweir { // #48289# 1705cdf0e10cSrcweir CopyPages(nFirstPageNum,nLastPageNum,nDestPos,bUndo,!bTreadSourceAsConst); 1706cdf0e10cSrcweir return; 1707cdf0e10cSrcweir } 1708cdf0e10cSrcweir 1709cdf0e10cSrcweir if( bUndo && !IsUndoEnabled() ) 1710cdf0e10cSrcweir bUndo = false; 1711cdf0e10cSrcweir 1712cdf0e10cSrcweir if (bUndo) 1713cdf0e10cSrcweir BegUndo(ImpGetResStr(STR_UndoMergeModel)); 1714cdf0e10cSrcweir 1715cdf0e10cSrcweir sal_uInt16 nSrcPageAnz=rSourceModel.GetPageCount(); 1716cdf0e10cSrcweir sal_uInt16 nSrcMasterPageAnz=rSourceModel.GetMasterPageCount(); 1717cdf0e10cSrcweir sal_uInt16 nDstMasterPageAnz=GetMasterPageCount(); 1718cdf0e10cSrcweir FASTBOOL bInsPages=(nFirstPageNum<nSrcPageAnz || nLastPageNum<nSrcPageAnz); 1719cdf0e10cSrcweir sal_uInt16 nMaxSrcPage=nSrcPageAnz; if (nMaxSrcPage!=0) nMaxSrcPage--; 1720cdf0e10cSrcweir if (nFirstPageNum>nMaxSrcPage) nFirstPageNum=nMaxSrcPage; 1721cdf0e10cSrcweir if (nLastPageNum>nMaxSrcPage) nLastPageNum =nMaxSrcPage; 1722cdf0e10cSrcweir FASTBOOL bReverse=nLastPageNum<nFirstPageNum; 1723cdf0e10cSrcweir 1724cdf0e10cSrcweir sal_uInt16* pMasterMap=NULL; 1725cdf0e10cSrcweir int* pMasterNeed=NULL; 1726cdf0e10cSrcweir sal_uInt16 nMasterNeed=0; 1727cdf0e10cSrcweir if (bMergeMasterPages && nSrcMasterPageAnz!=0) { 1728cdf0e10cSrcweir // Feststellen, welche MasterPages aus rSrcModel benoetigt werden 1729cdf0e10cSrcweir pMasterMap=new sal_uInt16[nSrcMasterPageAnz]; 1730cdf0e10cSrcweir pMasterNeed=new int[nSrcMasterPageAnz]; 1731cdf0e10cSrcweir memset(pMasterMap,0xFF,nSrcMasterPageAnz*sizeof(sal_uInt16)); 1732cdf0e10cSrcweir if (bAllMasterPages) { 1733cdf0e10cSrcweir memset(pMasterNeed,sal_True,nSrcMasterPageAnz*sizeof(FASTBOOL)); 1734cdf0e10cSrcweir } else { 1735cdf0e10cSrcweir memset(pMasterNeed,sal_False,nSrcMasterPageAnz*sizeof(FASTBOOL)); 1736cdf0e10cSrcweir sal_uInt16 nAnf= bReverse ? nLastPageNum : nFirstPageNum; 1737cdf0e10cSrcweir sal_uInt16 nEnd= bReverse ? nFirstPageNum : nLastPageNum; 1738cdf0e10cSrcweir for (sal_uInt16 i=nAnf; i<=nEnd; i++) { 1739cdf0e10cSrcweir const SdrPage* pPg=rSourceModel.GetPage(i); 1740cdf0e10cSrcweir if(pPg->TRG_HasMasterPage()) 1741cdf0e10cSrcweir { 1742cdf0e10cSrcweir SdrPage& rMasterPage = pPg->TRG_GetMasterPage(); 1743cdf0e10cSrcweir sal_uInt16 nMPgNum(rMasterPage.GetPageNum()); 1744cdf0e10cSrcweir 1745cdf0e10cSrcweir if(nMPgNum < nSrcMasterPageAnz) 1746cdf0e10cSrcweir { 1747cdf0e10cSrcweir pMasterNeed[nMPgNum] = sal_True; 1748cdf0e10cSrcweir } 1749cdf0e10cSrcweir } 1750cdf0e10cSrcweir } 1751cdf0e10cSrcweir } 1752cdf0e10cSrcweir // Nun das Mapping der MasterPages bestimmen 1753cdf0e10cSrcweir sal_uInt16 nAktMaPagNum=nDstMasterPageAnz; 1754cdf0e10cSrcweir for (sal_uInt16 i=0; i<nSrcMasterPageAnz; i++) { 1755cdf0e10cSrcweir if (pMasterNeed[i]) { 1756cdf0e10cSrcweir pMasterMap[i]=nAktMaPagNum; 1757cdf0e10cSrcweir nAktMaPagNum++; 1758cdf0e10cSrcweir nMasterNeed++; 1759cdf0e10cSrcweir } 1760cdf0e10cSrcweir } 1761cdf0e10cSrcweir } 1762cdf0e10cSrcweir 1763cdf0e10cSrcweir // rueberholen der Masterpages 1764cdf0e10cSrcweir if (pMasterMap!=NULL && pMasterNeed!=NULL && nMasterNeed!=0) { 1765cdf0e10cSrcweir for (sal_uInt16 i=nSrcMasterPageAnz; i>0;) { 1766cdf0e10cSrcweir i--; 1767cdf0e10cSrcweir if (pMasterNeed[i]) { 1768cdf0e10cSrcweir SdrPage* pPg=NULL; 1769cdf0e10cSrcweir if (bTreadSourceAsConst) { 1770cdf0e10cSrcweir const SdrPage* pPg1=rSourceModel.GetMasterPage(i); 1771cdf0e10cSrcweir pPg=pPg1->Clone(); 1772cdf0e10cSrcweir } else { 1773cdf0e10cSrcweir pPg=rSourceModel.RemoveMasterPage(i); 1774cdf0e10cSrcweir } 1775cdf0e10cSrcweir if (pPg!=NULL) { 1776cdf0e10cSrcweir // und alle ans einstige Ende des DstModel reinschieben. 1777cdf0e10cSrcweir // nicht InsertMasterPage() verwenden da die Sache 1778cdf0e10cSrcweir // inkonsistent ist bis alle drin sind 1779cdf0e10cSrcweir maMaPag.Insert(pPg,nDstMasterPageAnz); 1780cdf0e10cSrcweir // #109538# 1781cdf0e10cSrcweir MasterPageListChanged(); 1782cdf0e10cSrcweir pPg->SetInserted(sal_True); 1783cdf0e10cSrcweir pPg->SetModel(this); 1784cdf0e10cSrcweir bMPgNumsDirty=sal_True; 1785cdf0e10cSrcweir if (bUndo) AddUndo(GetSdrUndoFactory().CreateUndoNewPage(*pPg)); 1786cdf0e10cSrcweir } else { 1787cdf0e10cSrcweir DBG_ERROR("SdrModel::Merge(): MasterPage im SourceModel nicht gefunden"); 1788cdf0e10cSrcweir } 1789cdf0e10cSrcweir } 1790cdf0e10cSrcweir } 1791cdf0e10cSrcweir } 1792cdf0e10cSrcweir 1793cdf0e10cSrcweir // rueberholen der Zeichenseiten 1794cdf0e10cSrcweir if (bInsPages) { 1795cdf0e10cSrcweir sal_uInt16 nSourcePos=nFirstPageNum; 1796cdf0e10cSrcweir sal_uInt16 nMergeCount=sal_uInt16(Abs((long)((long)nFirstPageNum-nLastPageNum))+1); 1797cdf0e10cSrcweir if (nDestPos>GetPageCount()) nDestPos=GetPageCount(); 1798cdf0e10cSrcweir while (nMergeCount>0) { 1799cdf0e10cSrcweir SdrPage* pPg=NULL; 1800cdf0e10cSrcweir if (bTreadSourceAsConst) { 1801cdf0e10cSrcweir const SdrPage* pPg1=rSourceModel.GetPage(nSourcePos); 1802cdf0e10cSrcweir pPg=pPg1->Clone(); 1803cdf0e10cSrcweir } else { 1804cdf0e10cSrcweir pPg=rSourceModel.RemovePage(nSourcePos); 1805cdf0e10cSrcweir } 1806cdf0e10cSrcweir if (pPg!=NULL) { 1807cdf0e10cSrcweir InsertPage(pPg,nDestPos); 1808cdf0e10cSrcweir if (bUndo) AddUndo(GetSdrUndoFactory().CreateUndoNewPage(*pPg)); 1809cdf0e10cSrcweir // und nun zu den MasterPageDescriptoren 1810cdf0e10cSrcweir 1811cdf0e10cSrcweir if(pPg->TRG_HasMasterPage()) 1812cdf0e10cSrcweir { 1813cdf0e10cSrcweir SdrPage& rMasterPage = pPg->TRG_GetMasterPage(); 1814cdf0e10cSrcweir sal_uInt16 nMaPgNum(rMasterPage.GetPageNum()); 1815cdf0e10cSrcweir 1816cdf0e10cSrcweir if (bMergeMasterPages) 1817cdf0e10cSrcweir { 1818cdf0e10cSrcweir sal_uInt16 nNeuNum(0xFFFF); 1819cdf0e10cSrcweir 1820cdf0e10cSrcweir if(pMasterMap) 1821cdf0e10cSrcweir { 1822cdf0e10cSrcweir nNeuNum = pMasterMap[nMaPgNum]; 1823cdf0e10cSrcweir } 1824cdf0e10cSrcweir 1825cdf0e10cSrcweir if(nNeuNum != 0xFFFF) 1826cdf0e10cSrcweir { 1827cdf0e10cSrcweir if(bUndo) 1828cdf0e10cSrcweir { 1829cdf0e10cSrcweir AddUndo(GetSdrUndoFactory().CreateUndoPageChangeMasterPage(*pPg)); 1830cdf0e10cSrcweir } 1831cdf0e10cSrcweir 1832cdf0e10cSrcweir pPg->TRG_SetMasterPage(*GetMasterPage(nNeuNum)); 1833cdf0e10cSrcweir } 1834cdf0e10cSrcweir DBG_ASSERT(nNeuNum!=0xFFFF,"SdrModel::Merge(): Irgendwas ist krumm beim Mappen der MasterPages"); 1835cdf0e10cSrcweir } else { 1836cdf0e10cSrcweir if (nMaPgNum>=nDstMasterPageAnz) { 1837cdf0e10cSrcweir // Aha, die ist ausserbalb des urspruenglichen Bereichs der Masterpages des DstModel 1838cdf0e10cSrcweir pPg->TRG_ClearMasterPage(); 1839cdf0e10cSrcweir } 1840cdf0e10cSrcweir } 1841cdf0e10cSrcweir } 1842cdf0e10cSrcweir 1843cdf0e10cSrcweir } else { 1844cdf0e10cSrcweir DBG_ERROR("SdrModel::Merge(): Zeichenseite im SourceModel nicht gefunden"); 1845cdf0e10cSrcweir } 1846cdf0e10cSrcweir nDestPos++; 1847cdf0e10cSrcweir if (bReverse) nSourcePos--; 1848cdf0e10cSrcweir else if (bTreadSourceAsConst) nSourcePos++; 1849cdf0e10cSrcweir nMergeCount--; 1850cdf0e10cSrcweir } 1851cdf0e10cSrcweir } 1852cdf0e10cSrcweir 1853cdf0e10cSrcweir delete [] pMasterMap; 1854cdf0e10cSrcweir delete [] pMasterNeed; 1855cdf0e10cSrcweir 1856cdf0e10cSrcweir bMPgNumsDirty=sal_True; 1857cdf0e10cSrcweir bPagNumsDirty=sal_True; 1858cdf0e10cSrcweir 1859cdf0e10cSrcweir SetChanged(); 1860cdf0e10cSrcweir // Fehlt: Mergen und Mapping der Layer 1861cdf0e10cSrcweir // an den Objekten sowie an den MasterPageDescriptoren 1862cdf0e10cSrcweir if (bUndo) EndUndo(); 1863cdf0e10cSrcweir } 1864cdf0e10cSrcweir 1865cdf0e10cSrcweir void SdrModel::SetStarDrawPreviewMode(sal_Bool bPreview) 1866cdf0e10cSrcweir { 1867cdf0e10cSrcweir if (!bPreview && bStarDrawPreviewMode && GetPageCount()) 1868cdf0e10cSrcweir { 1869cdf0e10cSrcweir // Das Zuruecksetzen ist nicht erlaubt, da das Model ev. nicht vollstaendig geladen wurde 1870cdf0e10cSrcweir DBG_ASSERT(sal_False,"SdrModel::SetStarDrawPreviewMode(): Zuruecksetzen nicht erlaubt, da Model ev. nicht vollstaendig"); 1871cdf0e10cSrcweir } 1872cdf0e10cSrcweir else 1873cdf0e10cSrcweir { 1874cdf0e10cSrcweir bStarDrawPreviewMode = bPreview; 1875cdf0e10cSrcweir } 1876cdf0e10cSrcweir } 1877cdf0e10cSrcweir 1878cdf0e10cSrcweir uno::Reference< uno::XInterface > SdrModel::getUnoModel() 1879cdf0e10cSrcweir { 1880cdf0e10cSrcweir if( !mxUnoModel.is() ) 1881cdf0e10cSrcweir mxUnoModel = createUnoModel(); 1882cdf0e10cSrcweir 1883cdf0e10cSrcweir return mxUnoModel; 1884cdf0e10cSrcweir } 1885cdf0e10cSrcweir 1886cdf0e10cSrcweir void SdrModel::setUnoModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xModel ) 1887cdf0e10cSrcweir { 1888cdf0e10cSrcweir mxUnoModel = xModel; 1889cdf0e10cSrcweir } 1890cdf0e10cSrcweir 1891cdf0e10cSrcweir uno::Reference< uno::XInterface > SdrModel::createUnoModel() 1892cdf0e10cSrcweir { 1893cdf0e10cSrcweir DBG_ERROR( "SdrModel::createUnoModel() - base implementation should not be called!" ); 1894cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInt; 1895cdf0e10cSrcweir return xInt; 1896cdf0e10cSrcweir } 1897cdf0e10cSrcweir 1898cdf0e10cSrcweir void SdrModel::setLock( sal_Bool bLock ) 1899cdf0e10cSrcweir { 1900cdf0e10cSrcweir if( mbModelLocked != bLock ) 1901cdf0e10cSrcweir { 19020ce6329eSArmin Le Grand // #120437# need to set first, else ImpReformatAllEdgeObjects will do nothing 19030ce6329eSArmin Le Grand mbModelLocked = bLock; 19040ce6329eSArmin Le Grand 1905cdf0e10cSrcweir if( sal_False == bLock ) 1906cdf0e10cSrcweir { 1907cdf0e10cSrcweir // ReformatAllTextObjects(); #103122# due to a typo in the above if, this code was never 1908cdf0e10cSrcweir // executed, so I remove it until we discover that we need it here 1909cdf0e10cSrcweir ImpReformatAllEdgeObjects(); // #103122# 1910cdf0e10cSrcweir } 1911cdf0e10cSrcweir } 1912cdf0e10cSrcweir } 1913cdf0e10cSrcweir 1914cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 1915cdf0e10cSrcweir 1916cdf0e10cSrcweir void SdrModel::MigrateItemSet( const SfxItemSet* pSourceSet, SfxItemSet* pDestSet, SdrModel* pNewModel ) 1917cdf0e10cSrcweir { 1918cdf0e10cSrcweir if( pSourceSet && pDestSet && (pSourceSet != pDestSet ) ) 1919cdf0e10cSrcweir { 1920cdf0e10cSrcweir if( pNewModel == NULL ) 1921cdf0e10cSrcweir pNewModel = this; 1922cdf0e10cSrcweir 1923cdf0e10cSrcweir SfxWhichIter aWhichIter(*pSourceSet); 1924cdf0e10cSrcweir sal_uInt16 nWhich(aWhichIter.FirstWhich()); 1925cdf0e10cSrcweir const SfxPoolItem *pPoolItem; 1926cdf0e10cSrcweir 1927cdf0e10cSrcweir while(nWhich) 1928cdf0e10cSrcweir { 1929cdf0e10cSrcweir if(SFX_ITEM_SET == pSourceSet->GetItemState(nWhich, sal_False, &pPoolItem)) 1930cdf0e10cSrcweir { 1931cdf0e10cSrcweir const SfxPoolItem* pItem = pPoolItem; 1932cdf0e10cSrcweir 1933cdf0e10cSrcweir switch( nWhich ) 1934cdf0e10cSrcweir { 1935cdf0e10cSrcweir case XATTR_FILLBITMAP: 1936cdf0e10cSrcweir pItem = ((XFillBitmapItem*)pItem)->checkForUniqueItem( pNewModel ); 1937cdf0e10cSrcweir break; 1938cdf0e10cSrcweir case XATTR_LINEDASH: 1939cdf0e10cSrcweir pItem = ((XLineDashItem*)pItem)->checkForUniqueItem( pNewModel ); 1940cdf0e10cSrcweir break; 1941cdf0e10cSrcweir case XATTR_LINESTART: 1942cdf0e10cSrcweir pItem = ((XLineStartItem*)pItem)->checkForUniqueItem( pNewModel ); 1943cdf0e10cSrcweir break; 1944cdf0e10cSrcweir case XATTR_LINEEND: 1945cdf0e10cSrcweir pItem = ((XLineEndItem*)pItem)->checkForUniqueItem( pNewModel ); 1946cdf0e10cSrcweir break; 1947cdf0e10cSrcweir case XATTR_FILLGRADIENT: 1948cdf0e10cSrcweir pItem = ((XFillGradientItem*)pItem)->checkForUniqueItem( pNewModel ); 1949cdf0e10cSrcweir break; 1950cdf0e10cSrcweir case XATTR_FILLFLOATTRANSPARENCE: 1951cdf0e10cSrcweir // #85953# allow all kinds of XFillFloatTransparenceItem to be set 1952cdf0e10cSrcweir pItem = ((XFillFloatTransparenceItem*)pItem)->checkForUniqueItem( pNewModel ); 1953cdf0e10cSrcweir break; 1954cdf0e10cSrcweir case XATTR_FILLHATCH: 1955cdf0e10cSrcweir pItem = ((XFillHatchItem*)pItem)->checkForUniqueItem( pNewModel ); 1956cdf0e10cSrcweir break; 1957cdf0e10cSrcweir } 1958cdf0e10cSrcweir 1959cdf0e10cSrcweir // set item 1960cdf0e10cSrcweir if( pItem ) 1961cdf0e10cSrcweir { 1962cdf0e10cSrcweir pDestSet->Put(*pItem); 1963cdf0e10cSrcweir 1964cdf0e10cSrcweir // delete item if it was a generated one 1965cdf0e10cSrcweir if( pItem != pPoolItem) 1966cdf0e10cSrcweir delete (SfxPoolItem*)pItem; 1967cdf0e10cSrcweir } 1968cdf0e10cSrcweir } 1969cdf0e10cSrcweir nWhich = aWhichIter.NextWhich(); 1970cdf0e10cSrcweir } 1971cdf0e10cSrcweir } 1972cdf0e10cSrcweir } 1973cdf0e10cSrcweir 1974cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 1975cdf0e10cSrcweir 1976cdf0e10cSrcweir void SdrModel::SetForbiddenCharsTable( vos::ORef<SvxForbiddenCharactersTable> xForbiddenChars ) 1977cdf0e10cSrcweir { 1978cdf0e10cSrcweir if( mpForbiddenCharactersTable ) 1979cdf0e10cSrcweir mpForbiddenCharactersTable->release(); 1980cdf0e10cSrcweir 1981cdf0e10cSrcweir mpForbiddenCharactersTable = xForbiddenChars.getBodyPtr(); 1982cdf0e10cSrcweir 1983cdf0e10cSrcweir if( mpForbiddenCharactersTable ) 1984cdf0e10cSrcweir mpForbiddenCharactersTable->acquire(); 1985cdf0e10cSrcweir 1986cdf0e10cSrcweir ImpSetOutlinerDefaults( pDrawOutliner ); 1987cdf0e10cSrcweir ImpSetOutlinerDefaults( pHitTestOutliner ); 1988cdf0e10cSrcweir } 1989cdf0e10cSrcweir 1990cdf0e10cSrcweir vos::ORef<SvxForbiddenCharactersTable> SdrModel::GetForbiddenCharsTable() const 1991cdf0e10cSrcweir { 1992cdf0e10cSrcweir return mpForbiddenCharactersTable; 1993cdf0e10cSrcweir } 1994cdf0e10cSrcweir 1995cdf0e10cSrcweir void SdrModel::SetCharCompressType( sal_uInt16 nType ) 1996cdf0e10cSrcweir { 1997cdf0e10cSrcweir if( nType != mnCharCompressType ) 1998cdf0e10cSrcweir { 1999cdf0e10cSrcweir mnCharCompressType = nType; 2000cdf0e10cSrcweir ImpSetOutlinerDefaults( pDrawOutliner ); 2001cdf0e10cSrcweir ImpSetOutlinerDefaults( pHitTestOutliner ); 2002cdf0e10cSrcweir } 2003cdf0e10cSrcweir } 2004cdf0e10cSrcweir 2005cdf0e10cSrcweir void SdrModel::SetKernAsianPunctuation( sal_Bool bEnabled ) 2006cdf0e10cSrcweir { 2007cdf0e10cSrcweir if( mbKernAsianPunctuation != bEnabled ) 2008cdf0e10cSrcweir { 2009cdf0e10cSrcweir mbKernAsianPunctuation = bEnabled; 2010cdf0e10cSrcweir ImpSetOutlinerDefaults( pDrawOutliner ); 2011cdf0e10cSrcweir ImpSetOutlinerDefaults( pHitTestOutliner ); 2012cdf0e10cSrcweir } 2013cdf0e10cSrcweir } 2014cdf0e10cSrcweir 2015cdf0e10cSrcweir void SdrModel::SetAddExtLeading( sal_Bool bEnabled ) 2016cdf0e10cSrcweir { 2017cdf0e10cSrcweir if( mbAddExtLeading != bEnabled ) 2018cdf0e10cSrcweir { 2019cdf0e10cSrcweir mbAddExtLeading = bEnabled; 2020cdf0e10cSrcweir ImpSetOutlinerDefaults( pDrawOutliner ); 2021cdf0e10cSrcweir ImpSetOutlinerDefaults( pHitTestOutliner ); 2022cdf0e10cSrcweir } 2023cdf0e10cSrcweir } 2024cdf0e10cSrcweir 2025cdf0e10cSrcweir void SdrModel::ReformatAllTextObjects() 2026cdf0e10cSrcweir { 2027cdf0e10cSrcweir ImpReformatAllTextObjects(); 2028cdf0e10cSrcweir } 2029cdf0e10cSrcweir 2030cdf0e10cSrcweir FASTBOOL SdrModel::HasTransparentObjects( sal_Bool bCheckForAlphaChannel ) const 2031cdf0e10cSrcweir { 2032cdf0e10cSrcweir FASTBOOL bRet = sal_False; 2033cdf0e10cSrcweir sal_uInt16 n, nCount; 2034cdf0e10cSrcweir 2035cdf0e10cSrcweir for( n = 0, nCount = GetMasterPageCount(); ( n < nCount ) && !bRet; n++ ) 2036cdf0e10cSrcweir if( GetMasterPage( n )->HasTransparentObjects( bCheckForAlphaChannel ) ) 2037cdf0e10cSrcweir bRet = sal_True; 2038cdf0e10cSrcweir 2039cdf0e10cSrcweir if( !bRet ) 2040cdf0e10cSrcweir { 2041cdf0e10cSrcweir for( n = 0, nCount = GetPageCount(); ( n < nCount ) && !bRet; n++ ) 2042cdf0e10cSrcweir if( GetPage( n )->HasTransparentObjects( bCheckForAlphaChannel ) ) 2043cdf0e10cSrcweir bRet = sal_True; 2044cdf0e10cSrcweir } 2045cdf0e10cSrcweir 2046cdf0e10cSrcweir return bRet; 2047cdf0e10cSrcweir } 2048cdf0e10cSrcweir 2049cdf0e10cSrcweir SdrOutliner* SdrModel::createOutliner( sal_uInt16 nOutlinerMode ) 2050cdf0e10cSrcweir { 2051cdf0e10cSrcweir if( NULL == mpOutlinerCache ) 2052cdf0e10cSrcweir mpOutlinerCache = new SdrOutlinerCache(this); 2053cdf0e10cSrcweir 2054cdf0e10cSrcweir return mpOutlinerCache->createOutliner( nOutlinerMode ); 2055cdf0e10cSrcweir } 2056cdf0e10cSrcweir 2057cdf0e10cSrcweir void SdrModel::disposeOutliner( SdrOutliner* pOutliner ) 2058cdf0e10cSrcweir { 2059cdf0e10cSrcweir if( mpOutlinerCache ) 2060cdf0e10cSrcweir { 2061cdf0e10cSrcweir mpOutlinerCache->disposeOutliner( pOutliner ); 2062cdf0e10cSrcweir } 2063cdf0e10cSrcweir else 2064cdf0e10cSrcweir { 2065cdf0e10cSrcweir delete pOutliner; 2066cdf0e10cSrcweir } 2067cdf0e10cSrcweir } 2068cdf0e10cSrcweir 2069cdf0e10cSrcweir SvxNumType SdrModel::GetPageNumType() const 2070cdf0e10cSrcweir { 2071cdf0e10cSrcweir return SVX_ARABIC; 2072cdf0e10cSrcweir } 2073cdf0e10cSrcweir 2074cdf0e10cSrcweir const SdrPage* SdrModel::GetPage(sal_uInt16 nPgNum) const 2075cdf0e10cSrcweir { 2076cdf0e10cSrcweir DBG_ASSERT(nPgNum < maPages.Count(), "SdrModel::GetPage: Access out of range (!)"); 2077cdf0e10cSrcweir return (SdrPage*)(maPages.GetObject(nPgNum)); 2078cdf0e10cSrcweir } 2079cdf0e10cSrcweir 2080cdf0e10cSrcweir SdrPage* SdrModel::GetPage(sal_uInt16 nPgNum) 2081cdf0e10cSrcweir { 2082cdf0e10cSrcweir DBG_ASSERT(nPgNum < maPages.Count(), "SdrModel::GetPage: Access out of range (!)"); 2083cdf0e10cSrcweir return (SdrPage*)(maPages.GetObject(nPgNum)); 2084cdf0e10cSrcweir } 2085cdf0e10cSrcweir 2086cdf0e10cSrcweir sal_uInt16 SdrModel::GetPageCount() const 2087cdf0e10cSrcweir { 2088cdf0e10cSrcweir return sal_uInt16(maPages.Count()); 2089cdf0e10cSrcweir } 2090cdf0e10cSrcweir 2091cdf0e10cSrcweir void SdrModel::PageListChanged() 2092cdf0e10cSrcweir { 2093cdf0e10cSrcweir } 2094cdf0e10cSrcweir 2095cdf0e10cSrcweir const SdrPage* SdrModel::GetMasterPage(sal_uInt16 nPgNum) const 2096cdf0e10cSrcweir { 2097cdf0e10cSrcweir DBG_ASSERT(nPgNum < maMaPag.Count(), "SdrModel::GetMasterPage: Access out of range (!)"); 2098cdf0e10cSrcweir return (SdrPage*)(maMaPag.GetObject(nPgNum)); 2099cdf0e10cSrcweir } 2100cdf0e10cSrcweir 2101cdf0e10cSrcweir SdrPage* SdrModel::GetMasterPage(sal_uInt16 nPgNum) 2102cdf0e10cSrcweir { 2103cdf0e10cSrcweir DBG_ASSERT(nPgNum < maMaPag.Count(), "SdrModel::GetMasterPage: Access out of range (!)"); 2104cdf0e10cSrcweir return (SdrPage*)(maMaPag.GetObject(nPgNum)); 2105cdf0e10cSrcweir } 2106cdf0e10cSrcweir 2107cdf0e10cSrcweir sal_uInt16 SdrModel::GetMasterPageCount() const 2108cdf0e10cSrcweir { 2109cdf0e10cSrcweir return sal_uInt16(maMaPag.Count()); 2110cdf0e10cSrcweir } 2111cdf0e10cSrcweir 2112cdf0e10cSrcweir void SdrModel::MasterPageListChanged() 2113cdf0e10cSrcweir { 2114cdf0e10cSrcweir } 2115cdf0e10cSrcweir 2116cdf0e10cSrcweir void SdrModel::SetSdrUndoManager( SfxUndoManager* pUndoManager ) 2117cdf0e10cSrcweir { 2118cdf0e10cSrcweir mpImpl->mpUndoManager = pUndoManager; 2119cdf0e10cSrcweir } 2120cdf0e10cSrcweir 2121cdf0e10cSrcweir SfxUndoManager* SdrModel::GetSdrUndoManager() const 2122cdf0e10cSrcweir { 2123cdf0e10cSrcweir return mpImpl->mpUndoManager; 2124cdf0e10cSrcweir } 2125cdf0e10cSrcweir 2126cdf0e10cSrcweir SdrUndoFactory& SdrModel::GetSdrUndoFactory() const 2127cdf0e10cSrcweir { 2128cdf0e10cSrcweir if( !mpImpl->mpUndoFactory ) 2129cdf0e10cSrcweir mpImpl->mpUndoFactory = new SdrUndoFactory; 2130cdf0e10cSrcweir return *mpImpl->mpUndoFactory; 2131cdf0e10cSrcweir } 2132cdf0e10cSrcweir 2133cdf0e10cSrcweir void SdrModel::SetSdrUndoFactory( SdrUndoFactory* pUndoFactory ) 2134cdf0e10cSrcweir { 2135cdf0e10cSrcweir if( pUndoFactory && (pUndoFactory != mpImpl->mpUndoFactory) ) 2136cdf0e10cSrcweir { 2137cdf0e10cSrcweir delete mpImpl->mpUndoFactory; 2138cdf0e10cSrcweir mpImpl->mpUndoFactory = pUndoFactory; 2139cdf0e10cSrcweir } 2140cdf0e10cSrcweir } 2141cdf0e10cSrcweir 2142cdf0e10cSrcweir /** cl: added this for OJ to complete his reporting engine, does not work 2143cdf0e10cSrcweir correctly so only enable it for his model */ 2144cdf0e10cSrcweir bool SdrModel::IsAllowShapePropertyChangeListener() const 2145cdf0e10cSrcweir { 2146cdf0e10cSrcweir return mpImpl && mpImpl->mbAllowShapePropertyChangeListener; 2147cdf0e10cSrcweir } 2148cdf0e10cSrcweir 2149cdf0e10cSrcweir void SdrModel::SetAllowShapePropertyChangeListener( bool bAllow ) 2150cdf0e10cSrcweir { 2151cdf0e10cSrcweir if( mpImpl ) 2152cdf0e10cSrcweir { 2153cdf0e10cSrcweir mpImpl->mbAllowShapePropertyChangeListener = bAllow; 2154cdf0e10cSrcweir } 2155cdf0e10cSrcweir } 2156cdf0e10cSrcweir 2157cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< sal_Int8 >& SdrModel::getUnoTunnelImplementationId() 2158cdf0e10cSrcweir { 2159cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; 2160cdf0e10cSrcweir if( !pSeq ) 2161cdf0e10cSrcweir { 2162cdf0e10cSrcweir ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); 2163cdf0e10cSrcweir if( !pSeq ) 2164cdf0e10cSrcweir { 2165cdf0e10cSrcweir static Sequence< sal_Int8 > aSeq( 16 ); 2166cdf0e10cSrcweir rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); 2167cdf0e10cSrcweir pSeq = &aSeq; 2168cdf0e10cSrcweir } 2169cdf0e10cSrcweir } 2170cdf0e10cSrcweir return *pSeq; 2171cdf0e10cSrcweir } 2172cdf0e10cSrcweir 2173cdf0e10cSrcweir void SdrModel::SetDrawingLayerPoolDefaults() 2174cdf0e10cSrcweir { 2175cdf0e10cSrcweir const String aNullStr; 2176cdf0e10cSrcweir const Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); 2177cdf0e10cSrcweir const Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); 2178cdf0e10cSrcweir const XHatch aNullHatch(aNullLineCol); 2179cdf0e10cSrcweir 2180cdf0e10cSrcweir pItemPool->SetPoolDefaultItem( XFillColorItem(aNullStr,aNullFillCol) ); 2181cdf0e10cSrcweir pItemPool->SetPoolDefaultItem( XFillHatchItem(pItemPool,aNullHatch) ); 2182cdf0e10cSrcweir pItemPool->SetPoolDefaultItem( XLineColorItem(aNullStr,aNullLineCol) ); 2183cdf0e10cSrcweir } 2184cdf0e10cSrcweir 2185*fc76769fSJian Fang Zhang // 2186*fc76769fSJian Fang Zhang // i120668, move from the header files, add delete action 2187*fc76769fSJian Fang Zhang // 2188*fc76769fSJian Fang Zhang void SdrModel::SetColorTable(XColorTable* pTable) { delete pColorTable; pColorTable=pTable; } 2189*fc76769fSJian Fang Zhang void SdrModel::SetDashList(XDashList* pList) { delete pDashList; pDashList=pList; } 2190*fc76769fSJian Fang Zhang void SdrModel::SetLineEndList(XLineEndList* pList) { delete pLineEndList; pLineEndList=pList; } 2191*fc76769fSJian Fang Zhang void SdrModel::SetHatchList(XHatchList* pList) { delete pHatchList; pHatchList=pList; } 2192*fc76769fSJian Fang Zhang void SdrModel::SetGradientList(XGradientList* pList) { delete pGradientList; pGradientList=pList; } 2193*fc76769fSJian Fang Zhang void SdrModel::SetBitmapList(XBitmapList* pList) { delete pBitmapList; pBitmapList=pList; } 2194*fc76769fSJian Fang Zhang 2195cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 2196cdf0e10cSrcweir 2197cdf0e10cSrcweir TYPEINIT1(SdrHint,SfxHint); 2198cdf0e10cSrcweir 2199cdf0e10cSrcweir SdrHint::SdrHint() 2200cdf0e10cSrcweir : mpPage(0L), 2201cdf0e10cSrcweir mpObj(0L), 2202cdf0e10cSrcweir mpObjList(0L), 2203cdf0e10cSrcweir meHint(HINT_UNKNOWN) 2204cdf0e10cSrcweir { 2205cdf0e10cSrcweir } 2206cdf0e10cSrcweir 2207cdf0e10cSrcweir SdrHint::SdrHint(SdrHintKind eNewHint) 2208cdf0e10cSrcweir : mpPage(0L), 2209cdf0e10cSrcweir mpObj(0L), 2210cdf0e10cSrcweir mpObjList(0L), 2211cdf0e10cSrcweir meHint(eNewHint) 2212cdf0e10cSrcweir { 2213cdf0e10cSrcweir } 2214cdf0e10cSrcweir 2215cdf0e10cSrcweir SdrHint::SdrHint(const SdrObject& rNewObj) 2216cdf0e10cSrcweir : mpPage(rNewObj.GetPage()), 2217cdf0e10cSrcweir mpObj(&rNewObj), 2218cdf0e10cSrcweir mpObjList(rNewObj.GetObjList()), 2219cdf0e10cSrcweir meHint(HINT_OBJCHG) 2220cdf0e10cSrcweir { 2221cdf0e10cSrcweir maRectangle = rNewObj.GetLastBoundRect(); 2222cdf0e10cSrcweir } 2223cdf0e10cSrcweir 2224cdf0e10cSrcweir SdrHint::SdrHint(const SdrObject& rNewObj, const Rectangle& rRect) 2225cdf0e10cSrcweir : mpPage(rNewObj.GetPage()), 2226cdf0e10cSrcweir mpObj(&rNewObj), 2227cdf0e10cSrcweir mpObjList(rNewObj.GetObjList()), 2228cdf0e10cSrcweir meHint(HINT_OBJCHG) 2229cdf0e10cSrcweir { 2230cdf0e10cSrcweir maRectangle = rRect; 2231cdf0e10cSrcweir } 2232cdf0e10cSrcweir 2233cdf0e10cSrcweir void SdrHint::SetPage(const SdrPage* pNewPage) 2234cdf0e10cSrcweir { 2235cdf0e10cSrcweir mpPage = pNewPage; 2236cdf0e10cSrcweir } 2237cdf0e10cSrcweir 2238cdf0e10cSrcweir void SdrHint::SetObjList(const SdrObjList* pNewOL) 2239cdf0e10cSrcweir { 2240cdf0e10cSrcweir mpObjList = pNewOL; 2241cdf0e10cSrcweir } 2242cdf0e10cSrcweir 2243cdf0e10cSrcweir void SdrHint::SetObject(const SdrObject* pNewObj) 2244cdf0e10cSrcweir { 2245cdf0e10cSrcweir mpObj = pNewObj; 2246cdf0e10cSrcweir } 2247cdf0e10cSrcweir 2248cdf0e10cSrcweir void SdrHint::SetKind(SdrHintKind eNewKind) 2249cdf0e10cSrcweir { 2250cdf0e10cSrcweir meHint = eNewKind; 2251cdf0e10cSrcweir } 2252cdf0e10cSrcweir 2253cdf0e10cSrcweir void SdrHint::SetRect(const Rectangle& rNewRect) 2254cdf0e10cSrcweir { 2255cdf0e10cSrcweir maRectangle = rNewRect; 2256cdf0e10cSrcweir } 2257cdf0e10cSrcweir 2258cdf0e10cSrcweir const SdrPage* SdrHint::GetPage() const 2259cdf0e10cSrcweir { 2260cdf0e10cSrcweir return mpPage; 2261cdf0e10cSrcweir } 2262cdf0e10cSrcweir 2263cdf0e10cSrcweir const SdrObjList* SdrHint::GetObjList() const 2264cdf0e10cSrcweir { 2265cdf0e10cSrcweir return mpObjList; 2266cdf0e10cSrcweir } 2267cdf0e10cSrcweir 2268cdf0e10cSrcweir const SdrObject* SdrHint::GetObject() const 2269cdf0e10cSrcweir { 2270cdf0e10cSrcweir return mpObj; 2271cdf0e10cSrcweir } 2272cdf0e10cSrcweir 2273cdf0e10cSrcweir SdrHintKind SdrHint::GetKind() const 2274cdf0e10cSrcweir { 2275cdf0e10cSrcweir return meHint; 2276cdf0e10cSrcweir } 2277cdf0e10cSrcweir 2278cdf0e10cSrcweir const Rectangle& SdrHint::GetRect() const 2279cdf0e10cSrcweir { 2280cdf0e10cSrcweir return maRectangle; 2281cdf0e10cSrcweir } 2282cdf0e10cSrcweir 2283cdf0e10cSrcweir // eof 2284