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