LCOV - code coverage report
Current view: top level - libreoffice/svx/source/sdr/properties - textproperties.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 178 263 67.7 %
Date: 2012-12-17 Functions: 11 14 78.6 %
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/textproperties.hxx>
      21             : #include <svl/itemset.hxx>
      22             : #include <svl/style.hxx>
      23             : #include <svl/itemiter.hxx>
      24             : #include <svl/smplhint.hxx>
      25             : #include <svx/svddef.hxx>
      26             : #include <svx/svdotext.hxx>
      27             : #include <svx/svdoutl.hxx>
      28             : #include <editeng/writingmodeitem.hxx>
      29             : #include <svx/svdmodel.hxx>
      30             : #include <editeng/outlobj.hxx>
      31             : #include <svx/xflclit.hxx>
      32             : #include <editeng/adjitem.hxx>
      33             : #include <svx/svdetc.hxx>
      34             : #include <editeng/editeng.hxx>
      35             : #include <editeng/flditem.hxx>
      36             : #include <svx/xlnwtit.hxx>
      37             : #include <svx/svdpool.hxx>
      38             : 
      39             : //////////////////////////////////////////////////////////////////////////////
      40             : 
      41             : namespace sdr
      42             : {
      43             :     namespace properties
      44             :     {
      45        6422 :         SfxItemSet& TextProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
      46             :         {
      47             :             return *(new SfxItemSet(rPool,
      48             : 
      49             :                 // range from SdrAttrObj
      50             :                 SDRATTR_START, SDRATTR_SHADOW_LAST,
      51             :                 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
      52             :                 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
      53             : 
      54             :                 // range from SdrTextObj
      55             :                 EE_ITEMS_START, EE_ITEMS_END,
      56             : 
      57             :                 // end
      58        6422 :                 0, 0));
      59             :         }
      60             : 
      61        9188 :         TextProperties::TextProperties(SdrObject& rObj)
      62             :         :   AttributeProperties(rObj),
      63        9188 :             maVersion(0)
      64             :         {
      65        9188 :         }
      66             : 
      67           8 :         TextProperties::TextProperties(const TextProperties& rProps, SdrObject& rObj)
      68             :         :   AttributeProperties(rProps, rObj),
      69           8 :             maVersion(rProps.getVersion())
      70             :         {
      71           8 :         }
      72             : 
      73       11716 :         TextProperties::~TextProperties()
      74             :         {
      75       11716 :         }
      76             : 
      77           0 :         BaseProperties& TextProperties::Clone(SdrObject& rObj) const
      78             :         {
      79           0 :             return *(new TextProperties(*this, rObj));
      80             :         }
      81             : 
      82       31930 :         void TextProperties::ItemSetChanged(const SfxItemSet& rSet)
      83             :         {
      84       31930 :             SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
      85       31930 :             sal_Int32 nText = rObj.getTextCount();
      86             : 
      87             :             // #i101556# ItemSet has changed -> new version
      88       31930 :             maVersion++;
      89             : 
      90       95790 :             while( --nText >= 0 )
      91             :             {
      92       31930 :                 SdrText* pText = rObj.getText( nText );
      93             : 
      94       31930 :                 OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
      95             : 
      96       31930 :                 if(pParaObj)
      97             :                 {
      98        2544 :                     const bool bTextEdit = rObj.IsTextEditActive() && (rObj.getActiveText() == pText);
      99             : 
     100             :                     // handle outliner attributes
     101        2544 :                     GetObjectItemSet();
     102        2544 :                     Outliner* pOutliner = rObj.GetTextEditOutliner();
     103             : 
     104        2544 :                     if(!bTextEdit)
     105             :                     {
     106        2544 :                         pOutliner = &rObj.ImpGetDrawOutliner();
     107        2544 :                         pOutliner->SetText(*pParaObj);
     108             :                     }
     109             : 
     110        2544 :                     sal_uInt32 nParaCount(pOutliner->GetParagraphCount());
     111             : 
     112        5178 :                     for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
     113             :                     {
     114        2634 :                         SfxItemSet aSet(pOutliner->GetParaAttribs(nPara));
     115        2634 :                         aSet.Put(rSet);
     116        2634 :                         pOutliner->SetParaAttribs(nPara, aSet);
     117        2634 :                     }
     118             : 
     119        2544 :                     if(!bTextEdit)
     120             :                     {
     121        2544 :                         if(nParaCount)
     122             :                         {
     123             :                             // force ItemSet
     124        2544 :                             GetObjectItemSet();
     125             : 
     126        2544 :                             SfxItemSet aNewSet(pOutliner->GetParaAttribs(0L));
     127        2544 :                             mpItemSet->Put(aNewSet);
     128             :                         }
     129             : 
     130        2544 :                         OutlinerParaObject* pTemp = pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount);
     131        2544 :                         pOutliner->Clear();
     132             : 
     133        2544 :                         rObj.NbcSetOutlinerParaObjectForText(pTemp,pText);
     134             :                     }
     135             :                 }
     136             :             }
     137             : 
     138             :             // Extra-Repaint for radical layout changes (#43139#)
     139       31930 :             if(SFX_ITEM_SET == rSet.GetItemState(SDRATTR_TEXT_CONTOURFRAME))
     140             :             {
     141             :                 // Here only repaint wanted
     142           4 :                 rObj.ActionChanged();
     143             :                 //rObj.BroadcastObjectChange();
     144             :             }
     145             : 
     146             :             // call parent
     147       31930 :             AttributeProperties::ItemSetChanged(rSet);
     148       31930 :         }
     149             : 
     150      209192 :         void TextProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
     151             :         {
     152      209192 :             SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
     153             : 
     154             :             // #i25616#
     155      209192 :             sal_Int32 nOldLineWidth(0L);
     156             : 
     157      209192 :             if(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange())
     158             :             {
     159        3484 :                 nOldLineWidth = ((const XLineWidthItem&)GetItem(XATTR_LINEWIDTH)).GetValue();
     160             :             }
     161             : 
     162      209192 :             if(pNewItem && (SDRATTR_TEXTDIRECTION == nWhich))
     163             :             {
     164        8588 :                 sal_Bool bVertical(com::sun::star::text::WritingMode_TB_RL == ((SvxWritingModeItem*)pNewItem)->GetValue());
     165        8588 :                 rObj.SetVerticalWriting(bVertical);
     166             :             }
     167             : 
     168             :             // #95501# reset to default
     169      209192 :             if(!pNewItem && !nWhich && rObj.HasText() )
     170             :             {
     171          28 :                 SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
     172             : 
     173          28 :                 sal_Int32 nCount = rObj.getTextCount();
     174          84 :                 while( nCount-- )
     175             :                 {
     176          28 :                     SdrText* pText = rObj.getText( nCount );
     177          28 :                     OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject();
     178          28 :                     if( pParaObj )
     179             :                     {
     180          28 :                         rOutliner.SetText(*pParaObj);
     181          28 :                         sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
     182             : 
     183          28 :                         if(nParaCount)
     184             :                         {
     185          28 :                             ESelection aSelection( 0, 0, EE_PARA_ALL, EE_PARA_ALL);
     186          28 :                             rOutliner.RemoveAttribs(aSelection, sal_True, 0);
     187             : 
     188          28 :                             OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
     189          28 :                             rOutliner.Clear();
     190             : 
     191          28 :                             rObj.NbcSetOutlinerParaObjectForText( pTemp, pText );
     192             :                         }
     193             :                     }
     194             :                 }
     195             :             }
     196             : 
     197             :             // call parent
     198      209192 :             AttributeProperties::ItemChange( nWhich, pNewItem );
     199             : 
     200             :             // #i25616#
     201      209192 :             if(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange())
     202             :             {
     203        3484 :                 const sal_Int32 nNewLineWidth(((const XLineWidthItem&)GetItem(XATTR_LINEWIDTH)).GetValue());
     204        3484 :                 const sal_Int32 nDifference((nNewLineWidth - nOldLineWidth) / 2);
     205             : 
     206        3484 :                 if(nDifference)
     207             :                 {
     208        1326 :                     const sal_Bool bLineVisible(XLINE_NONE != ((const XLineStyleItem&)(GetItem(XATTR_LINESTYLE))).GetValue());
     209             : 
     210        1326 :                     if(bLineVisible)
     211             :                     {
     212        1312 :                         const sal_Int32 nLeftDist(((const SdrTextLeftDistItem&)GetItem(SDRATTR_TEXT_LEFTDIST)).GetValue());
     213        1312 :                         const sal_Int32 nRightDist(((const SdrTextRightDistItem&)GetItem(SDRATTR_TEXT_RIGHTDIST)).GetValue());
     214        1312 :                         const sal_Int32 nUpperDist(((const SdrTextUpperDistItem&)GetItem(SDRATTR_TEXT_UPPERDIST)).GetValue());
     215        1312 :                         const sal_Int32 nLowerDist(((const SdrTextLowerDistItem&)GetItem(SDRATTR_TEXT_LOWERDIST)).GetValue());
     216             : 
     217        1312 :                         SetObjectItemDirect(SdrTextLeftDistItem(nLeftDist + nDifference));
     218        1312 :                         SetObjectItemDirect(SdrTextRightDistItem(nRightDist + nDifference));
     219        1312 :                         SetObjectItemDirect(SdrTextUpperDistItem(nUpperDist + nDifference));
     220        1312 :                         SetObjectItemDirect(SdrTextLowerDistItem(nLowerDist + nDifference));
     221             :                     }
     222             :                 }
     223             :             }
     224      209192 :         }
     225             : 
     226        9114 :         void TextProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
     227             :         {
     228        9114 :             SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
     229             : 
     230             :             // call parent
     231        9114 :             AttributeProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
     232             : 
     233             :             // #i101556# StyleSheet has changed -> new version
     234        9114 :             maVersion++;
     235             : 
     236        9114 :             if( rObj.GetModel() /*&& !rObj.IsTextEditActive()*/ && !rObj.IsLinkedText() )
     237             :             {
     238        9114 :                 SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
     239             : 
     240        9114 :                 sal_Int32 nText = rObj.getTextCount();
     241             : 
     242       27542 :                 while( --nText >= 0 )
     243             :                 {
     244        9314 :                     SdrText* pText = rObj.getText( nText );
     245             : 
     246        9314 :                     OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
     247        9314 :                     if( !pParaObj )
     248        8690 :                         continue;
     249             : 
     250             :                     // apply StyleSheet to all paragraphs
     251         624 :                     rOutliner.SetText(*pParaObj);
     252         624 :                     sal_uInt32 nParaCount(rOutliner.GetParagraphCount());
     253             : 
     254         624 :                     if(nParaCount)
     255             :                     {
     256        1440 :                         for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
     257             :                         {
     258         816 :                             SfxItemSet* pTempSet = 0L;
     259             : 
     260             :                             // since setting the stylesheet removes all para attributes
     261         816 :                             if(bDontRemoveHardAttr)
     262             :                             {
     263             :                                 // we need to remember them if we want to keep them
     264         236 :                                 pTempSet = new SfxItemSet(rOutliner.GetParaAttribs(nPara));
     265             :                             }
     266             : 
     267         816 :                             if(GetStyleSheet())
     268             :                             {
     269         816 :                                 if((OBJ_OUTLINETEXT == rObj.GetTextKind()) && (SdrInventor == rObj.GetObjInventor()))
     270             :                                 {
     271         244 :                                     String aNewStyleSheetName(GetStyleSheet()->GetName());
     272         244 :                                     aNewStyleSheetName.Erase(aNewStyleSheetName.Len() - 1, 1);
     273         244 :                                     sal_Int16 nDepth = rOutliner.GetDepth((sal_uInt16)nPara);
     274         244 :                                     aNewStyleSheetName += String::CreateFromInt32( nDepth <= 0 ? 1 : nDepth + 1);
     275             : 
     276         244 :                                     SdrModel* pModel = rObj.GetModel();
     277         244 :                                     SfxStyleSheetBasePool* pStylePool = (pModel != NULL) ? pModel->GetStyleSheetPool() : 0L;
     278         244 :                                     SfxStyleSheet* pNewStyle = (SfxStyleSheet*)pStylePool->Find(aNewStyleSheetName, GetStyleSheet()->GetFamily());
     279             :                                     DBG_ASSERT( pNewStyle, "AutoStyleSheetName - Style not found!" );
     280             : 
     281         244 :                                     if(pNewStyle)
     282             :                                     {
     283         244 :                                         rOutliner.SetStyleSheet(nPara, pNewStyle);
     284         244 :                                     }
     285             :                                 }
     286             :                                 else
     287             :                                 {
     288         572 :                                     rOutliner.SetStyleSheet(nPara, GetStyleSheet());
     289             :                                 }
     290             :                             }
     291             :                             else
     292             :                             {
     293             :                                 // remove StyleSheet
     294           0 :                                 rOutliner.SetStyleSheet(nPara, 0L);
     295             :                             }
     296             : 
     297         816 :                             if(bDontRemoveHardAttr)
     298             :                             {
     299         236 :                                 if(pTempSet)
     300             :                                 {
     301             :                                     // restore para attributes
     302         236 :                                     rOutliner.SetParaAttribs(nPara, *pTempSet);
     303             :                                 }
     304             :                             }
     305             :                             else
     306             :                             {
     307         580 :                                 if(pNewStyleSheet)
     308             :                                 {
     309             :                                     // remove all hard paragraph attributes
     310             :                                     // which occur in StyleSheet, take care of
     311             :                                     // parents (!)
     312         580 :                                     SfxItemIter aIter(pNewStyleSheet->GetItemSet());
     313         580 :                                     const SfxPoolItem* pItem = aIter.FirstItem();
     314             : 
     315       16418 :                                     while(pItem)
     316             :                                     {
     317       15258 :                                         if(!IsInvalidItem(pItem))
     318             :                                         {
     319       15258 :                                             sal_uInt16 nW(pItem->Which());
     320             : 
     321       15258 :                                             if(nW >= EE_ITEMS_START && nW <= EE_ITEMS_END)
     322             :                                             {
     323       12268 :                                                 rOutliner.QuickRemoveCharAttribs((sal_uInt16)nPara, nW);
     324             :                                             }
     325             :                                         }
     326       15258 :                                         pItem = aIter.NextItem();
     327         580 :                                     }
     328             :                                 }
     329             :                             }
     330             : 
     331         816 :                             if(pTempSet)
     332             :                             {
     333         236 :                                 delete pTempSet;
     334             :                             }
     335             :                         }
     336             : 
     337         624 :                         OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount);
     338         624 :                         rOutliner.Clear();
     339         624 :                         rObj.NbcSetOutlinerParaObjectForText(pTemp, pText);
     340             :                     }
     341             :                 }
     342             :             }
     343             : 
     344        9114 :             if(rObj.IsTextFrame())
     345             :             {
     346        5100 :                 rObj.NbcAdjustTextFrameWidthAndHeight();
     347             :             }
     348        9114 :         }
     349             : 
     350        6644 :         void TextProperties::ForceDefaultAttributes()
     351             :         {
     352        6644 :             SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
     353             : 
     354        6644 :             if( rObj.GetObjInventor() == SdrInventor )
     355             :             {
     356        6616 :                 const sal_uInt16 nSdrObjKind = rObj.GetObjIdentifier();
     357             : 
     358        6616 :                 if( nSdrObjKind == OBJ_TITLETEXT || nSdrObjKind == OBJ_OUTLINETEXT )
     359        6902 :                     return; // no defaults for presentation objects
     360             :             }
     361             : 
     362        6386 :             bool bTextFrame(rObj.IsTextFrame());
     363             : 
     364             :             // force ItemSet
     365        6386 :             GetObjectItemSet();
     366             : 
     367        6386 :             if(bTextFrame)
     368             :             {
     369        2394 :                 mpItemSet->Put(XLineStyleItem(XLINE_NONE));
     370        2394 :                 mpItemSet->Put(XFillColorItem(String(), Color(COL_WHITE)));
     371        2394 :                 mpItemSet->Put(XFillStyleItem(XFILL_NONE));
     372             :             }
     373             :             else
     374             :             {
     375        3992 :                 mpItemSet->Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST));
     376        3992 :                 mpItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
     377        3992 :                 mpItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
     378             :             }
     379             :         }
     380             : 
     381           0 :         void TextProperties::ForceStyleToHardAttributes()
     382             :         {
     383             :             // #i61284# call parent first to get the hard ObjectItemSet
     384           0 :             AttributeProperties::ForceStyleToHardAttributes();
     385             : 
     386             :             // #i61284# push hard ObjectItemSet to OutlinerParaObject attributes
     387             :             // using existing functionality
     388           0 :             GetObjectItemSet(); // force ItemSet
     389           0 :             ItemSetChanged(*mpItemSet);
     390             : 
     391             :             // now the standard TextProperties stuff
     392           0 :             SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
     393             : 
     394           0 :             if(rObj.GetModel()
     395           0 :                 && !rObj.IsTextEditActive()
     396           0 :                 && !rObj.IsLinkedText())
     397             :             {
     398           0 :                 Outliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, rObj.GetModel());
     399           0 :                 sal_Int32 nText = rObj.getTextCount();
     400             : 
     401           0 :                 while( --nText >= 0 )
     402             :                 {
     403           0 :                     SdrText* pText = rObj.getText( nText );
     404             : 
     405           0 :                     OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
     406           0 :                     if( !pParaObj )
     407           0 :                         continue;
     408             : 
     409           0 :                     pOutliner->SetText(*pParaObj);
     410             : 
     411           0 :                     sal_uInt32 nParaCount(pOutliner->GetParagraphCount());
     412             : 
     413           0 :                     if(nParaCount)
     414             :                     {
     415           0 :                         sal_Bool bBurnIn(sal_False);
     416             : 
     417           0 :                         for(sal_uInt16 nPara = 0; nPara < nParaCount; nPara++)
     418             :                         {
     419           0 :                             SfxStyleSheet* pSheet = pOutliner->GetStyleSheet(nPara);
     420             : 
     421           0 :                             if(pSheet)
     422             :                             {
     423           0 :                                 SfxItemSet aParaSet(pOutliner->GetParaAttribs(nPara));
     424           0 :                                 SfxItemSet aSet(*aParaSet.GetPool());
     425           0 :                                 aSet.Put(pSheet->GetItemSet());
     426             : 
     427             :                                 /** the next code handles a special case for paragraphs that contain a
     428             :                                     url field. The color for URL fields is either the system color for
     429             :                                     urls or the char color attribute that formats the portion in which the
     430             :                                     url field is contained.
     431             :                                     When we set a char color attribute to the paragraphs item set from the
     432             :                                     styles item set, we would have this char color attribute as an attribute
     433             :                                     that is spanned over the complete paragraph after xml import due to some
     434             :                                     problems in the xml import (using a XCursor on import so it does not know
     435             :                                     the paragraphs and can't set char attributes to paragraphs ).
     436             : 
     437             :                                     To avoid this, as soon as we try to set a char color attribute from the style
     438             :                                     we
     439             :                                     1. check if we have at least one url field in this paragraph
     440             :                                     2. if we found at least one url field, we span the char color attribute over
     441             :                                     all portions that are not url fields and remove the char color attribute
     442             :                                     from the paragraphs item set
     443             :                                 */
     444             : 
     445           0 :                                 sal_Bool bHasURL(sal_False);
     446             : 
     447           0 :                                 if(aSet.GetItemState(EE_CHAR_COLOR) == SFX_ITEM_SET)
     448             :                                 {
     449           0 :                                     EditEngine* pEditEngine = const_cast<EditEngine*>(&(pOutliner->GetEditEngine()));
     450           0 :                                     std::vector<EECharAttrib> aAttribs;
     451           0 :                                     pEditEngine->GetCharAttribs((sal_uInt16)nPara, aAttribs);
     452             : 
     453           0 :                                     for(std::vector<EECharAttrib>::iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
     454             :                                     {
     455           0 :                                         if(EE_FEATURE_FIELD == i->pAttr->Which())
     456             :                                         {
     457           0 :                                             if(i->pAttr)
     458             :                                             {
     459           0 :                                                 SvxFieldItem* pFieldItem = (SvxFieldItem*)(i->pAttr);
     460             : 
     461           0 :                                                 if(pFieldItem)
     462             :                                                 {
     463           0 :                                                     const SvxFieldData* pData = pFieldItem->GetField();
     464             : 
     465           0 :                                                     if(pData && pData->ISA(SvxURLField))
     466             :                                                     {
     467           0 :                                                         bHasURL = sal_True;
     468           0 :                                                         break;
     469             :                                                     }
     470             :                                                 }
     471             :                                             }
     472             :                                         }
     473             :                                     }
     474             : 
     475           0 :                                     if(bHasURL)
     476             :                                     {
     477           0 :                                         SfxItemSet aColorSet(*aSet.GetPool(), EE_CHAR_COLOR, EE_CHAR_COLOR );
     478           0 :                                         aColorSet.Put(aSet, sal_False);
     479             : 
     480           0 :                                         ESelection aSel((sal_uInt16)nPara, 0);
     481             : 
     482           0 :                                         for(std::vector<EECharAttrib>::iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
     483             :                                         {
     484           0 :                                             if(EE_FEATURE_FIELD == i->pAttr->Which())
     485             :                                             {
     486           0 :                                                 aSel.nEndPos = i->nStart;
     487             : 
     488           0 :                                                 if(aSel.nStartPos != aSel.nEndPos)
     489           0 :                                                     pEditEngine->QuickSetAttribs(aColorSet, aSel);
     490             : 
     491           0 :                                                 aSel.nStartPos = i->nEnd;
     492             :                                             }
     493             :                                         }
     494             : 
     495           0 :                                         aSel.nEndPos = pEditEngine->GetTextLen((sal_uInt16)nPara);
     496             : 
     497           0 :                                         if(aSel.nStartPos != aSel.nEndPos)
     498             :                                         {
     499           0 :                                             pEditEngine->QuickSetAttribs( aColorSet, aSel );
     500           0 :                                         }
     501           0 :                                     }
     502             : 
     503             :                                 }
     504             : 
     505           0 :                                 aSet.Put(aParaSet, sal_False);
     506             : 
     507           0 :                                 if(bHasURL)
     508             :                                 {
     509           0 :                                     aSet.ClearItem(EE_CHAR_COLOR);
     510             :                                 }
     511             : 
     512           0 :                                 pOutliner->SetParaAttribs(nPara, aSet);
     513           0 :                                 bBurnIn = sal_True; // #i51163# Flag was set wrong
     514             :                             }
     515             :                         }
     516             : 
     517           0 :                         if(bBurnIn)
     518             :                         {
     519           0 :                             OutlinerParaObject* pTemp = pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount);
     520           0 :                             rObj.NbcSetOutlinerParaObjectForText(pTemp,pText);
     521             :                         }
     522             :                     }
     523             : 
     524           0 :                     pOutliner->Clear();
     525             :                 }
     526           0 :                 delete pOutliner;
     527             :             }
     528           0 :         }
     529             : 
     530           0 :         void TextProperties::SetObjectItemNoBroadcast(const SfxPoolItem& rItem)
     531             :         {
     532           0 :             GetObjectItemSet();
     533           0 :             mpItemSet->Put(rItem);
     534           0 :         }
     535             : 
     536             : 
     537        9172 :         void TextProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
     538             :         {
     539             :             // call parent
     540        9172 :             AttributeProperties::Notify(rBC, rHint);
     541             : 
     542        9172 :             SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
     543        9172 :             if(rObj.HasText())
     544             :             {
     545        9172 :                 if(HAS_BASE(SfxStyleSheet, &rBC))
     546             :                 {
     547        3756 :                     SfxSimpleHint* pSimple = PTR_CAST(SfxSimpleHint, &rHint);
     548        3756 :                     sal_uInt32 nId(pSimple ? pSimple->GetId() : 0L);
     549             : 
     550        3756 :                     if(SFX_HINT_DATACHANGED == nId)
     551             :                     {
     552        3756 :                         rObj.SetPortionInfoChecked(sal_False);
     553             : 
     554        3756 :                         sal_Int32 nText = rObj.getTextCount();
     555        7512 :                         while( --nText > 0 )
     556             :                         {
     557           0 :                             OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject();
     558           0 :                             if( pParaObj )
     559           0 :                                 pParaObj->ClearPortionInfo();
     560             :                         }
     561        3756 :                         rObj.SetTextSizeDirty();
     562             : 
     563        3756 :                         if(rObj.IsTextFrame() && rObj.NbcAdjustTextFrameWidthAndHeight())
     564             :                         {
     565             :                             // here only repaint wanted
     566           0 :                             rObj.ActionChanged();
     567             :                             //rObj.BroadcastObjectChange();
     568             :                         }
     569             : 
     570             :                         // #i101556# content of StyleSheet has changed -> new version
     571        3756 :                         maVersion++;
     572             :                     }
     573             : 
     574        3756 :                     if(SFX_HINT_DYING == nId)
     575             :                     {
     576           0 :                         rObj.SetPortionInfoChecked(sal_False);
     577           0 :                         sal_Int32 nText = rObj.getTextCount();
     578           0 :                         while( --nText > 0 )
     579             :                         {
     580           0 :                             OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject();
     581           0 :                             if( pParaObj )
     582           0 :                                 pParaObj->ClearPortionInfo();
     583             :                         }
     584             :                     }
     585             :                 }
     586        5416 :                 else if(HAS_BASE(SfxStyleSheetBasePool, &rBC))
     587             :                 {
     588        5416 :                     SfxStyleSheetHintExtended* pExtendedHint = PTR_CAST(SfxStyleSheetHintExtended, &rHint);
     589             : 
     590        7376 :                     if(pExtendedHint
     591        1960 :                         && SFX_STYLESHEET_MODIFIED == pExtendedHint->GetHint())
     592             :                     {
     593        1960 :                         String aOldName(pExtendedHint->GetOldName());
     594        1960 :                         String aNewName(pExtendedHint->GetStyleSheet()->GetName());
     595        1960 :                         SfxStyleFamily eFamily = pExtendedHint->GetStyleSheet()->GetFamily();
     596             : 
     597        1960 :                         if(!aOldName.Equals(aNewName))
     598             :                         {
     599        1960 :                             sal_Int32 nText = rObj.getTextCount();
     600        3920 :                             while( --nText > 0 )
     601             :                             {
     602           0 :                                 OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject();
     603           0 :                                 if( pParaObj )
     604           0 :                                     pParaObj->ChangeStyleSheetName(eFamily, aOldName, aNewName);
     605             :                             }
     606        1960 :                         }
     607             :                     }
     608             :                 }
     609             :             }
     610        9172 :         }
     611             : 
     612             :         // #i101556# Handout version information
     613         172 :         sal_uInt32 TextProperties::getVersion() const
     614             :         {
     615         172 :             return maVersion;
     616             :         }
     617             :     } // end of namespace properties
     618             : } // end of namespace sdr
     619             : 
     620             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10