LCOV - code coverage report
Current view: top level - libreoffice/svx/source/sdr/properties - attributeproperties.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 114 231 49.4 %
Date: 2012-12-17 Functions: 12 16 75.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <svx/sdr/properties/attributeproperties.hxx>
      21             : #include <svx/sdr/properties/itemsettools.hxx>
      22             : #include <tools/debug.hxx>
      23             : #include <svl/itemset.hxx>
      24             : #include <svl/style.hxx>
      25             : #include <svl/whiter.hxx>
      26             : #include <svl/poolitem.hxx>
      27             : #include <svx/svdobj.hxx>
      28             : #include <svx/svddef.hxx>
      29             : #include <svx/xit.hxx>
      30             : #include <svx/xbtmpit.hxx>
      31             : #include <svx/xlndsit.hxx>
      32             : #include <svx/xlnstit.hxx>
      33             : #include <svx/xlnedit.hxx>
      34             : #include <svx/xflgrit.hxx>
      35             : #include <svx/xflftrit.hxx>
      36             : #include <svx/xflhtit.hxx>
      37             : #include <svx/xlnasit.hxx>
      38             : #include <svx/xflasit.hxx>
      39             : #include <svx/svdmodel.hxx>
      40             : #include <svx/svdtrans.hxx>
      41             : #include <svx/svdpage.hxx>
      42             : 
      43             : // #114265#
      44             : #include <svl/smplhint.hxx>
      45             : 
      46             : //////////////////////////////////////////////////////////////////////////////
      47             : 
      48             : namespace sdr
      49             : {
      50             :     namespace properties
      51             :     {
      52        9166 :         void AttributeProperties::ImpAddStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
      53             :         {
      54             :             // test if old StyleSheet is cleared, else it would be lost
      55             :             // after this method -> memory leak (!)
      56             :             DBG_ASSERT(!mpStyleSheet, "Old style sheet not deleted before setting new one (!)");
      57             : 
      58        9166 :             if(pNewStyleSheet)
      59             :             {
      60        4174 :                 mpStyleSheet = pNewStyleSheet;
      61             : 
      62             :                 // local ItemSet is needed here, force it
      63        4174 :                 GetObjectItemSet();
      64             : 
      65             :                 // register as listener
      66        4174 :                 StartListening(pNewStyleSheet->GetPool());
      67        4174 :                 StartListening(*pNewStyleSheet);
      68             : 
      69             :                 // Delete hard attributes where items are set in the style sheet
      70        4174 :                 if(!bDontRemoveHardAttr)
      71             :                 {
      72         404 :                     const SfxItemSet& rStyle = pNewStyleSheet->GetItemSet();
      73         404 :                     SfxWhichIter aIter(rStyle);
      74         404 :                     sal_uInt16 nWhich = aIter.FirstWhich();
      75             : 
      76       82012 :                     while(nWhich)
      77             :                     {
      78       81204 :                         if(SFX_ITEM_SET == rStyle.GetItemState(nWhich))
      79             :                         {
      80        9730 :                             mpItemSet->ClearItem(nWhich);
      81             :                         }
      82             : 
      83       81204 :                         nWhich = aIter.NextWhich();
      84         404 :                     }
      85             :                 }
      86             : 
      87             :                 // set new stylesheet as parent
      88        4174 :                 mpItemSet->SetParent(&pNewStyleSheet->GetItemSet());
      89             :             }
      90        9166 :         }
      91             : 
      92       18192 :         void AttributeProperties::ImpRemoveStyleSheet()
      93             :         {
      94             :             // Check type since it is destroyed when the type is deleted
      95       18192 :             if(GetStyleSheet() && HAS_BASE(SfxStyleSheet, mpStyleSheet))
      96             :             {
      97        4108 :                 EndListening(*mpStyleSheet);
      98        4108 :                 EndListening(mpStyleSheet->GetPool());
      99             : 
     100             :                 // reset parent of ItemSet
     101        4108 :                 if(mpItemSet)
     102             :                 {
     103        4108 :                     mpItemSet->SetParent(0L);
     104             :                 }
     105             : 
     106        4108 :                 SdrObject& rObj = GetSdrObject();
     107        4108 :                 rObj.SetBoundRectDirty();
     108        4108 :                 rObj.SetRectsDirty(sal_True);
     109             :             }
     110             : 
     111       18192 :             mpStyleSheet = 0L;
     112       18192 :         }
     113             : 
     114             :         // create a new itemset
     115           0 :         SfxItemSet& AttributeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
     116             :         {
     117             :             return *(new SfxItemSet(rPool,
     118             : 
     119             :                 // ranges from SdrAttrObj
     120             :                 SDRATTR_START, SDRATTR_SHADOW_LAST,
     121             :                 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
     122             :                 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
     123             : 
     124             :                 // end
     125           0 :                 0, 0));
     126             :         }
     127             : 
     128        9188 :         AttributeProperties::AttributeProperties(SdrObject& rObj)
     129             :         :   DefaultProperties(rObj),
     130        9188 :             mpStyleSheet(0L)
     131             :         {
     132        9188 :         }
     133             : 
     134           8 :         AttributeProperties::AttributeProperties(const AttributeProperties& rProps, SdrObject& rObj)
     135             :         :   DefaultProperties(rProps, rObj),
     136           8 :             mpStyleSheet(0L)
     137             :         {
     138           8 :             if(rProps.GetStyleSheet())
     139             :             {
     140           0 :                 ImpAddStyleSheet(rProps.GetStyleSheet(), sal_True);
     141             :             }
     142           8 :         }
     143             : 
     144       18052 :         AttributeProperties::~AttributeProperties()
     145             :         {
     146        9026 :             ImpRemoveStyleSheet();
     147        9026 :         }
     148             : 
     149           0 :         BaseProperties& AttributeProperties::Clone(SdrObject& rObj) const
     150             :         {
     151           0 :             return *(new AttributeProperties(*this, rObj));
     152             :         }
     153             : 
     154       40274 :         void AttributeProperties::ItemSetChanged(const SfxItemSet& /*rSet*/)
     155             :         {
     156             :             // own modifications
     157       40274 :             SdrObject& rObj = GetSdrObject();
     158             : 
     159       40274 :             rObj.SetBoundRectDirty();
     160       40274 :             rObj.SetRectsDirty(sal_True);
     161       40274 :             rObj.SetChanged();
     162       40274 :         }
     163             : 
     164      217776 :         void AttributeProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
     165             :         {
     166      217776 :             if(pNewItem)
     167             :             {
     168      192764 :                 const SfxPoolItem* pItem = pNewItem;
     169      192764 :                 SdrModel* pModel = GetSdrObject().GetModel();
     170             : 
     171      192764 :                 switch( nWhich )
     172             :                 {
     173             :                     case XATTR_FILLBITMAP:
     174             :                     {
     175           0 :                         pItem = ((XFillBitmapItem*)pItem)->checkForUniqueItem( pModel );
     176           0 :                         break;
     177             :                     }
     178             :                     case XATTR_LINEDASH:
     179             :                     {
     180           6 :                         pItem = ((XLineDashItem*)pItem)->checkForUniqueItem( pModel );
     181           6 :                         break;
     182             :                     }
     183             :                     case XATTR_LINESTART:
     184             :                     {
     185          32 :                         pItem = ((XLineStartItem*)pItem)->checkForUniqueItem( pModel );
     186          32 :                         break;
     187             :                     }
     188             :                     case XATTR_LINEEND:
     189             :                     {
     190          54 :                         pItem = ((XLineEndItem*)pItem)->checkForUniqueItem( pModel );
     191          54 :                         break;
     192             :                     }
     193             :                     case XATTR_FILLGRADIENT:
     194             :                     {
     195          26 :                         pItem = ((XFillGradientItem*)pItem)->checkForUniqueItem( pModel );
     196          26 :                         break;
     197             :                     }
     198             :                     case XATTR_FILLFLOATTRANSPARENCE:
     199             :                     {
     200             :                         // #85953# allow all kinds of XFillFloatTransparenceItem to be set
     201           0 :                         pItem = ((XFillFloatTransparenceItem*)pItem)->checkForUniqueItem( pModel );
     202           0 :                         break;
     203             :                     }
     204             :                     case XATTR_FILLHATCH:
     205             :                     {
     206          16 :                         pItem = ((XFillHatchItem*)pItem)->checkForUniqueItem( pModel );
     207          16 :                         break;
     208             :                     }
     209             :                 }
     210             : 
     211             :                 // set item
     212      192764 :                 if(pItem)
     213             :                 {
     214             :                     // force ItemSet
     215      192764 :                     GetObjectItemSet();
     216      192764 :                     mpItemSet->Put(*pItem);
     217             : 
     218             :                     // delete item if it was a generated one
     219      192764 :                     if(pItem != pNewItem)
     220             :                     {
     221          14 :                         delete (SfxPoolItem*)pItem;
     222             :                     }
     223             :                 }
     224             :             }
     225             :             else
     226             :             {
     227             :                 // clear item if ItemSet exists
     228       25012 :                 if(mpItemSet)
     229             :                 {
     230       25012 :                     mpItemSet->ClearItem(nWhich);
     231             :                 }
     232             :             }
     233      217776 :         }
     234             : 
     235        9114 :         void AttributeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
     236             :         {
     237        9114 :             ImpRemoveStyleSheet();
     238        9114 :             ImpAddStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
     239             : 
     240        9114 :             SdrObject& rObj = GetSdrObject();
     241        9114 :             rObj.SetBoundRectDirty();
     242        9114 :             rObj.SetRectsDirty(sal_True);
     243        9114 :         }
     244             : 
     245       42538 :         SfxStyleSheet* AttributeProperties::GetStyleSheet() const
     246             :         {
     247       42538 :             return mpStyleSheet;
     248             :         }
     249             : 
     250        8636 :         void AttributeProperties::MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel)
     251             :         {
     252             :             OSL_ASSERT(pNewModel!=NULL);
     253             : 
     254        8636 :             if(pSrcPool && pDestPool && (pSrcPool != pDestPool))
     255             :             {
     256        8636 :                 if(mpItemSet)
     257             :                 {
     258             :                     // migrate ItemSet to new pool. Scaling is NOT necessary
     259             :                     // because this functionality is used by UNDO only. Thus
     260             :                     // objects and ItemSets would be moved back to their original
     261             :                     // pool before usage.
     262         934 :                     SfxItemSet* pOldSet = mpItemSet;
     263         934 :                     SfxStyleSheet* pStySheet = GetStyleSheet();
     264             : 
     265         934 :                     if(pStySheet)
     266             :                     {
     267          52 :                         ImpRemoveStyleSheet();
     268             :                     }
     269             : 
     270         934 :                     mpItemSet = mpItemSet->Clone(sal_False, pDestPool);
     271         934 :                     GetSdrObject().GetModel()->MigrateItemSet(pOldSet, mpItemSet, pNewModel);
     272             : 
     273             :                     // set stylesheet (if used)
     274         934 :                     if(pStySheet)
     275             :                     {
     276             :                         // #i109515#
     277          52 :                         SfxItemPool* pStyleSheetPool = &pStySheet->GetPool().GetPool();
     278             : 
     279          52 :                         if(pStyleSheetPool == pDestPool)
     280             :                         {
     281             :                             // just re-set stylesheet
     282          52 :                             ImpAddStyleSheet(pStySheet, sal_True);
     283             :                         }
     284             :                         else
     285             :                         {
     286             :                             // StyleSheet is NOT from the correct pool.
     287             :                             // Look one up in the right pool with the same
     288             :                             // name or use the default.
     289             : 
     290             :                             // Look up the style in the new document.
     291             :                             OSL_ASSERT(pNewModel->GetStyleSheetPool() != NULL);
     292             :                             SfxStyleSheet* pNewStyleSheet = dynamic_cast<SfxStyleSheet*>(
     293           0 :                                 pNewModel->GetStyleSheetPool()->Find(
     294           0 :                                     pStySheet->GetName(),
     295           0 :                                     SFX_STYLE_FAMILY_ALL));
     296           0 :                             if (pNewStyleSheet == NULL
     297           0 :                                 || &pNewStyleSheet->GetPool().GetPool() != pDestPool)
     298             :                             {
     299             :                                 // There is no copy of the style in the new
     300             :                                 // document.  Use the default as a fallback.
     301           0 :                                 pNewStyleSheet = pNewModel->GetDefaultStyleSheet();
     302             :                             }
     303           0 :                             ImpAddStyleSheet(pNewStyleSheet, sal_True);
     304             :                         }
     305             :                     }
     306             : 
     307         934 :                     delete pOldSet;
     308             :                 }
     309             :             }
     310        8636 :         }
     311             : 
     312       12820 :         void AttributeProperties::SetModel(SdrModel* pOldModel, SdrModel* pNewModel)
     313             :         {
     314       12820 :             if(pOldModel != pNewModel && pNewModel && !pNewModel->IsLoading())
     315             :             {
     316             :                 // For a living model move the items from one pool to the other
     317        8304 :                 if(pOldModel)
     318             :                 {
     319             :                     // If metric has changed, scale items.
     320           0 :                     MapUnit aOldUnit(pOldModel->GetScaleUnit());
     321           0 :                     MapUnit aNewUnit(pNewModel->GetScaleUnit());
     322           0 :                     sal_Bool bScaleUnitChanged(aNewUnit != aOldUnit);
     323           0 :                     Fraction aMetricFactor;
     324             : 
     325           0 :                     if(bScaleUnitChanged)
     326             :                     {
     327           0 :                         aMetricFactor = GetMapFactor(aOldUnit, aNewUnit).X();
     328           0 :                         Scale(aMetricFactor);
     329             :                     }
     330             : 
     331             :                     // Move all styles which are used by the object to the new
     332             :                     // StyleSheet pool
     333           0 :                     SfxStyleSheet* pOldStyleSheet = GetStyleSheet();
     334             : 
     335           0 :                     if(pOldStyleSheet)
     336             :                     {
     337           0 :                         SfxStyleSheetBase* pSheet = pOldStyleSheet;
     338           0 :                         SfxStyleSheetBasePool* pOldPool = pOldModel->GetStyleSheetPool();
     339           0 :                         SfxStyleSheetBasePool* pNewPool = pNewModel->GetStyleSheetPool();
     340             :                         DBG_ASSERT(pOldPool, "Properties::SetModel(): Object has StyleSheet but no StyleSheetPool (!)");
     341             : 
     342           0 :                         if(pOldPool && pNewPool)
     343             :                         {
     344             :                             // build a list of to-be-copied Styles
     345           0 :                             std::vector<SfxStyleSheetBase*> aStyleList;
     346           0 :                             SfxStyleSheetBase* pAnchor = 0L;
     347             : 
     348           0 :                             while(pSheet)
     349             :                             {
     350           0 :                                 pAnchor = pNewPool->Find(pSheet->GetName(), pSheet->GetFamily());
     351             : 
     352           0 :                                 if(!pAnchor)
     353             :                                 {
     354           0 :                                     aStyleList.push_back(pSheet);
     355           0 :                                     pSheet = pOldPool->Find(pSheet->GetParent(), pSheet->GetFamily());
     356             :                                 }
     357             :                                 else
     358             :                                 {
     359             :                                     // the style does exist
     360           0 :                                     pSheet = 0L;
     361             :                                 }
     362             :                             }
     363             : 
     364             :                             // copy and set the parents
     365           0 :                             SfxStyleSheetBase* pNewSheet = 0L;
     366           0 :                             SfxStyleSheetBase* pLastSheet = 0L;
     367           0 :                             SfxStyleSheetBase* pForThisObject = 0L;
     368             : 
     369           0 :                             std::vector<SfxStyleSheetBase*>::iterator iter;
     370           0 :                             for (iter = aStyleList.begin(); iter != aStyleList.end(); ++iter)
     371             :                             {
     372           0 :                                 pNewSheet = &pNewPool->Make((*iter)->GetName(), (*iter)->GetFamily(), (*iter)->GetMask());
     373           0 :                                 pNewSheet->GetItemSet().Put((*iter)->GetItemSet(), sal_False);
     374             : 
     375           0 :                                 if(bScaleUnitChanged)
     376             :                                 {
     377           0 :                                     sdr::properties::ScaleItemSet(pNewSheet->GetItemSet(), aMetricFactor);
     378             :                                 }
     379             : 
     380           0 :                                 if(pLastSheet)
     381             :                                 {
     382           0 :                                     pLastSheet->SetParent(pNewSheet->GetName());
     383             :                                 }
     384             : 
     385           0 :                                 if(!pForThisObject)
     386             :                                 {
     387           0 :                                     pForThisObject = pNewSheet;
     388             :                                 }
     389             : 
     390           0 :                                 pLastSheet = pNewSheet;
     391             :                             }
     392             : 
     393             :                             // Set link to the Style found in the Pool
     394           0 :                             if(pAnchor && pLastSheet)
     395             :                             {
     396           0 :                                 pLastSheet->SetParent(pAnchor->GetName());
     397             :                             }
     398             : 
     399             :                             // if list was empty (all Styles exist in destination pool)
     400             :                             // pForThisObject is not yet set
     401           0 :                             if(!pForThisObject && pAnchor)
     402             :                             {
     403           0 :                                 pForThisObject = pAnchor;
     404             :                             }
     405             : 
     406             :                             // De-register at old and register at new Style
     407           0 :                             if(GetStyleSheet() != pForThisObject)
     408             :                             {
     409           0 :                                 ImpRemoveStyleSheet();
     410           0 :                                 ImpAddStyleSheet((SfxStyleSheet*)pForThisObject, sal_True);
     411           0 :                             }
     412             :                         }
     413             :                         else
     414             :                         {
     415             :                             // there is no StyleSheetPool in the new model, thus set
     416             :                             // all items as hard items in the object
     417           0 :                             std::vector<const SfxItemSet*> aSetList;
     418           0 :                             const SfxItemSet* pItemSet = &pOldStyleSheet->GetItemSet();
     419             : 
     420           0 :                             while(pItemSet)
     421             :                             {
     422           0 :                                 aSetList.push_back(pItemSet);
     423           0 :                                 pItemSet = pItemSet->GetParent();
     424             :                             }
     425             : 
     426           0 :                             SfxItemSet* pNewSet = &CreateObjectSpecificItemSet(pNewModel->GetItemPool());
     427             : 
     428           0 :                             std::vector<const SfxItemSet*>::reverse_iterator riter;
     429           0 :                             for (riter = aSetList.rbegin(); riter != aSetList.rend(); ++riter)
     430           0 :                                 pNewSet->Put(*(*riter));
     431             : 
     432             :                             // Items which were hard attributes before need to stay
     433           0 :                             if(mpItemSet)
     434             :                             {
     435           0 :                                 SfxWhichIter aIter(*mpItemSet);
     436           0 :                                 sal_uInt16 nWhich = aIter.FirstWhich();
     437             : 
     438           0 :                                 while(nWhich)
     439             :                                 {
     440           0 :                                     if(mpItemSet->GetItemState(nWhich, sal_False) == SFX_ITEM_SET)
     441             :                                     {
     442           0 :                                         pNewSet->Put(mpItemSet->Get(nWhich));
     443             :                                     }
     444             : 
     445           0 :                                     nWhich = aIter.NextWhich();
     446           0 :                                 }
     447             :                             }
     448             : 
     449           0 :                             if(bScaleUnitChanged)
     450             :                             {
     451           0 :                                 ScaleItemSet(*pNewSet, aMetricFactor);
     452             :                             }
     453             : 
     454           0 :                             if(mpItemSet)
     455             :                             {
     456           0 :                                 if(GetStyleSheet())
     457             :                                 {
     458           0 :                                     ImpRemoveStyleSheet();
     459             :                                 }
     460             : 
     461           0 :                                 delete mpItemSet;
     462           0 :                                 mpItemSet = 0L;
     463             :                             }
     464             : 
     465           0 :                             mpItemSet = pNewSet;
     466             :                         }
     467             :                     }
     468             :                 }
     469             : 
     470             :                 // each object gets the default Style if there is none set yet.
     471        8304 :                 if(!GetStyleSheet() && pNewModel && !pNewModel->IsLoading())
     472             :                 {
     473        8304 :                     GetObjectItemSet(); // #118414 force ItemSet to allow style to be set
     474        8304 :                     SetStyleSheet(pNewModel->GetDefaultStyleSheet(), sal_True);
     475             :                 }
     476             :             }
     477       12820 :         }
     478             : 
     479           0 :         void AttributeProperties::ForceStyleToHardAttributes()
     480             :         {
     481           0 :             if(GetStyleSheet() && HAS_BASE(SfxStyleSheet, mpStyleSheet))
     482             :             {
     483             :                 // prepare copied, new itemset, but WITHOUT parent
     484           0 :                 GetObjectItemSet();
     485           0 :                 SfxItemSet* pDestItemSet = new SfxItemSet(*mpItemSet);
     486           0 :                 pDestItemSet->SetParent(0L);
     487             : 
     488             :                 // pepare forgetting the current stylesheet like in RemoveStyleSheet()
     489           0 :                 EndListening(*mpStyleSheet);
     490           0 :                 EndListening(mpStyleSheet->GetPool());
     491             : 
     492             :                 // prepare the iter; use the mpObjectItemSet which may have less
     493             :                 // WhichIDs than the style.
     494           0 :                 SfxWhichIter aIter(*pDestItemSet);
     495           0 :                 sal_uInt16 nWhich(aIter.FirstWhich());
     496           0 :                 const SfxPoolItem *pItem = NULL;
     497             : 
     498             :                 // now set all hard attributes of the current at the new itemset
     499           0 :                 while(nWhich)
     500             :                 {
     501             :                     // #i61284# use mpItemSet with parents, makes things easier and reduces to
     502             :                     // one loop
     503           0 :                     if(SFX_ITEM_SET == mpItemSet->GetItemState(nWhich, true, &pItem))
     504             :                     {
     505           0 :                         pDestItemSet->Put(*pItem);
     506             :                     }
     507             : 
     508           0 :                     nWhich = aIter.NextWhich();
     509             :                 }
     510             : 
     511             :                 // replace itemsets
     512           0 :                 delete mpItemSet;
     513           0 :                 mpItemSet = pDestItemSet;
     514             : 
     515             :                 // set necessary changes like in RemoveStyleSheet()
     516           0 :                 GetSdrObject().SetBoundRectDirty();
     517           0 :                 GetSdrObject().SetRectsDirty(sal_True);
     518             : 
     519           0 :                 mpStyleSheet = NULL;
     520             :             }
     521           0 :         }
     522             : 
     523        9172 :         void AttributeProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
     524             :         {
     525        9172 :             sal_Bool bHintUsed(sal_False);
     526             : 
     527        9172 :             SfxStyleSheetHint *pStyleHint = PTR_CAST(SfxStyleSheetHint, &rHint);
     528             : 
     529        9172 :             if(pStyleHint && pStyleHint->GetStyleSheet() == GetStyleSheet())
     530             :             {
     531         100 :                 SdrObject& rObj = GetSdrObject();
     532             :                 //SdrPage* pPage = rObj.GetPage();
     533             : 
     534         100 :                 switch(pStyleHint->GetHint())
     535             :                 {
     536             :                     case SFX_STYLESHEET_CREATED         :
     537             :                     {
     538             :                         // cannot happen, nothing to do
     539           0 :                         break;
     540             :                     }
     541             :                     case SFX_STYLESHEET_MODIFIED        :
     542             :                     case SFX_STYLESHEET_CHANGED         :
     543             :                     {
     544             :                         // notify change
     545         100 :                         break;
     546             :                     }
     547             :                     case SFX_STYLESHEET_ERASED          :
     548             :                     case SFX_STYLESHEET_INDESTRUCTION   :
     549             :                     {
     550             :                         // Style needs to be exchanged
     551           0 :                         SfxStyleSheet* pNewStSh = 0L;
     552           0 :                         SdrModel* pModel = rObj.GetModel();
     553             : 
     554             :                         // #111111#
     555             :                         // Do nothing if object is in destruction, else a StyleSheet may be found from
     556             :                         // a StyleSheetPool which is just being deleted itself. and thus it would be fatal
     557             :                         // to register as listener to that new StyleSheet.
     558           0 :                         if(pModel && !rObj.IsInDestruction())
     559             :                         {
     560           0 :                             if(HAS_BASE(SfxStyleSheet, GetStyleSheet()))
     561             :                             {
     562           0 :                                 pNewStSh = (SfxStyleSheet*)pModel->GetStyleSheetPool()->Find(
     563           0 :                                     GetStyleSheet()->GetParent(), GetStyleSheet()->GetFamily());
     564             :                             }
     565             : 
     566           0 :                             if(!pNewStSh)
     567             :                             {
     568           0 :                                 pNewStSh = pModel->GetDefaultStyleSheet();
     569             :                             }
     570             :                         }
     571             : 
     572             :                         // remove used style, it's erased or in destruction
     573           0 :                         ImpRemoveStyleSheet();
     574             : 
     575           0 :                         if(pNewStSh)
     576             :                         {
     577           0 :                             ImpAddStyleSheet(pNewStSh, sal_True);
     578             :                         }
     579             : 
     580           0 :                         break;
     581             :                     }
     582             :                 }
     583             : 
     584             :                 // Get old BoundRect. Do this after the style change is handled
     585             :                 // in the ItemSet parts because GetBoundRect() may calculate a new
     586         100 :                 Rectangle aBoundRect = rObj.GetLastBoundRect();
     587             : 
     588         100 :                 rObj.SetRectsDirty(sal_True);
     589             : 
     590             :                 // tell the object about the change
     591         100 :                 rObj.SetChanged();
     592         100 :                 rObj.BroadcastObjectChange();
     593             : 
     594             :                 //if(pPage && pPage->IsInserted())
     595             :                 //{
     596             :                 //  rObj.BroadcastObjectChange();
     597             :                 //}
     598             : 
     599         100 :                 rObj.SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect);
     600             : 
     601         100 :                 bHintUsed = sal_True;
     602             :             }
     603             : 
     604        9172 :             if(!bHintUsed)
     605             :             {
     606             :                 // forward to SdrObject ATM. Not sure if this will be necessary
     607             :                 // in the future.
     608        9072 :                 GetSdrObject().Notify(rBC, rHint);
     609             :             }
     610        9172 :         }
     611             :     } // end of namespace properties
     612             : } // end of namespace sdr
     613             : 
     614             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10