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