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 37973 : 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 37973 : 0, 0));
59 : }
60 :
61 41123 : TextProperties::TextProperties(SdrObject& rObj)
62 : : AttributeProperties(rObj),
63 41123 : maVersion(0)
64 : {
65 41123 : }
66 :
67 56 : TextProperties::TextProperties(const TextProperties& rProps, SdrObject& rObj)
68 : : AttributeProperties(rProps, rObj),
69 56 : maVersion(rProps.getVersion())
70 : {
71 56 : }
72 :
73 48458 : TextProperties::~TextProperties()
74 : {
75 48458 : }
76 :
77 2 : BaseProperties& TextProperties::Clone(SdrObject& rObj) const
78 : {
79 2 : return *(new TextProperties(*this, rObj));
80 : }
81 :
82 158132 : void TextProperties::ItemSetChanged(const SfxItemSet& rSet)
83 : {
84 158132 : SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
85 158132 : const svx::ITextProvider& rTextProvider(getTextProvider());
86 158132 : sal_Int32 nText = rTextProvider.getTextCount();
87 :
88 : // #i101556# ItemSet has changed -> new version
89 158132 : maVersion++;
90 :
91 474396 : while( --nText >= 0 )
92 : {
93 158132 : SdrText* pText = rTextProvider.getText( nText );
94 :
95 158132 : OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
96 :
97 158132 : if(pParaObj)
98 : {
99 38673 : const bool bTextEdit = rObj.IsTextEditActive() && (rObj.getActiveText() == pText);
100 :
101 : // handle outliner attributes
102 38673 : GetObjectItemSet();
103 38673 : Outliner* pOutliner = rObj.GetTextEditOutliner();
104 :
105 38673 : if(!bTextEdit)
106 : {
107 38673 : pOutliner = &rObj.ImpGetDrawOutliner();
108 38673 : pOutliner->SetText(*pParaObj);
109 : }
110 :
111 38673 : sal_Int32 nParaCount(pOutliner->GetParagraphCount());
112 :
113 78344 : for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
114 : {
115 39671 : SfxItemSet aSet(pOutliner->GetParaAttribs(nPara));
116 39671 : aSet.Put(rSet);
117 39671 : pOutliner->SetParaAttribs(nPara, aSet);
118 39671 : }
119 :
120 38673 : if(!bTextEdit)
121 : {
122 38673 : if(nParaCount)
123 : {
124 : // force ItemSet
125 38673 : GetObjectItemSet();
126 :
127 38673 : SfxItemSet aNewSet(pOutliner->GetParaAttribs(0L));
128 38673 : mpItemSet->Put(aNewSet);
129 : }
130 :
131 38673 : OutlinerParaObject* pTemp = pOutliner->CreateParaObject(0, nParaCount);
132 38673 : pOutliner->Clear();
133 :
134 38673 : rObj.NbcSetOutlinerParaObjectForText(pTemp,pText);
135 : }
136 : }
137 : }
138 :
139 : // Extra-Repaint for radical layout changes (#43139#)
140 158132 : if(SFX_ITEM_SET == rSet.GetItemState(SDRATTR_TEXT_CONTOURFRAME))
141 : {
142 : // Here only repaint wanted
143 14 : rObj.ActionChanged();
144 : //rObj.BroadcastObjectChange();
145 : }
146 :
147 : // call parent
148 158132 : AttributeProperties::ItemSetChanged(rSet);
149 158132 : }
150 :
151 1076342 : void TextProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
152 : {
153 1076342 : SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
154 :
155 : // #i25616#
156 1076342 : sal_Int32 nOldLineWidth(0L);
157 :
158 1076342 : if(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange())
159 : {
160 20757 : nOldLineWidth = ((const XLineWidthItem&)GetItem(XATTR_LINEWIDTH)).GetValue();
161 : }
162 :
163 1076342 : if(pNewItem && (SDRATTR_TEXTDIRECTION == nWhich))
164 : {
165 73133 : sal_Bool bVertical(com::sun::star::text::WritingMode_TB_RL == ((SvxWritingModeItem*)pNewItem)->GetValue());
166 73133 : rObj.SetVerticalWriting(bVertical);
167 : }
168 :
169 : // #95501# reset to default
170 1076342 : if(!pNewItem && !nWhich && rObj.HasText() )
171 : {
172 141 : SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
173 :
174 141 : const svx::ITextProvider& rTextProvider(getTextProvider());
175 141 : sal_Int32 nCount = rTextProvider.getTextCount();
176 423 : while( nCount-- )
177 : {
178 141 : SdrText* pText = rTextProvider.getText( nCount );
179 141 : OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject();
180 141 : if( pParaObj )
181 : {
182 141 : rOutliner.SetText(*pParaObj);
183 141 : sal_Int32 nParaCount(rOutliner.GetParagraphCount());
184 :
185 141 : if(nParaCount)
186 : {
187 141 : ESelection aSelection( 0, 0, EE_PARA_ALL, EE_TEXTPOS_ALL);
188 141 : rOutliner.RemoveAttribs(aSelection, true, 0);
189 :
190 141 : OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, nParaCount);
191 141 : rOutliner.Clear();
192 :
193 141 : rObj.NbcSetOutlinerParaObjectForText( pTemp, pText );
194 : }
195 : }
196 : }
197 : }
198 :
199 : // call parent
200 1076342 : AttributeProperties::ItemChange( nWhich, pNewItem );
201 :
202 : // #i25616#
203 1076342 : if(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange())
204 : {
205 20757 : const sal_Int32 nNewLineWidth(((const XLineWidthItem&)GetItem(XATTR_LINEWIDTH)).GetValue());
206 20757 : const sal_Int32 nDifference((nNewLineWidth - nOldLineWidth) / 2);
207 :
208 20757 : if(nDifference)
209 : {
210 3304 : const bool bLineVisible(XLINE_NONE != ((const XLineStyleItem&)(GetItem(XATTR_LINESTYLE))).GetValue());
211 :
212 3304 : if(bLineVisible)
213 : {
214 2600 : const sal_Int32 nLeftDist(((const SdrTextLeftDistItem&)GetItem(SDRATTR_TEXT_LEFTDIST)).GetValue());
215 2600 : const sal_Int32 nRightDist(((const SdrTextRightDistItem&)GetItem(SDRATTR_TEXT_RIGHTDIST)).GetValue());
216 2600 : const sal_Int32 nUpperDist(((const SdrTextUpperDistItem&)GetItem(SDRATTR_TEXT_UPPERDIST)).GetValue());
217 2600 : const sal_Int32 nLowerDist(((const SdrTextLowerDistItem&)GetItem(SDRATTR_TEXT_LOWERDIST)).GetValue());
218 :
219 2600 : SetObjectItemDirect(SdrTextLeftDistItem(nLeftDist + nDifference));
220 2600 : SetObjectItemDirect(SdrTextRightDistItem(nRightDist + nDifference));
221 2600 : SetObjectItemDirect(SdrTextUpperDistItem(nUpperDist + nDifference));
222 2600 : SetObjectItemDirect(SdrTextLowerDistItem(nLowerDist + nDifference));
223 : }
224 : }
225 : }
226 1076342 : }
227 :
228 227061 : const svx::ITextProvider& TextProperties::getTextProvider() const
229 : {
230 227061 : return static_cast<const SdrTextObj&>(GetSdrObject());
231 : }
232 :
233 42463 : void TextProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
234 : {
235 42463 : SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
236 :
237 : // call parent
238 42463 : AttributeProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
239 :
240 : // #i101556# StyleSheet has changed -> new version
241 42463 : maVersion++;
242 :
243 42463 : if( rObj.GetModel() /*&& !rObj.IsTextEditActive()*/ && !rObj.IsLinkedText() )
244 : {
245 40378 : SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
246 :
247 40378 : const svx::ITextProvider& rTextProvider(getTextProvider());
248 40378 : sal_Int32 nText = rTextProvider.getTextCount();
249 :
250 121134 : while( --nText >= 0 )
251 : {
252 40378 : SdrText* pText = rTextProvider.getText( nText );
253 :
254 40378 : OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0;
255 40378 : if( !pParaObj )
256 38939 : continue;
257 :
258 : // apply StyleSheet to all paragraphs
259 1439 : rOutliner.SetText(*pParaObj);
260 1439 : sal_Int32 nParaCount(rOutliner.GetParagraphCount());
261 :
262 1439 : if(nParaCount)
263 : {
264 3490 : for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
265 : {
266 2051 : SfxItemSet* pTempSet = 0L;
267 :
268 : // since setting the stylesheet removes all para attributes
269 2051 : 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 2051 : if(GetStyleSheet())
276 : {
277 2051 : if((OBJ_OUTLINETEXT == rObj.GetTextKind()) && (SdrInventor == rObj.GetObjInventor()))
278 : {
279 809 : OUString aNewStyleSheetName(GetStyleSheet()->GetName());
280 809 : aNewStyleSheetName = aNewStyleSheetName.copy(0, aNewStyleSheetName.getLength() - 1);
281 809 : sal_Int16 nDepth = rOutliner.GetDepth(nPara);
282 809 : aNewStyleSheetName += OUString::number( nDepth <= 0 ? 1 : nDepth + 1);
283 :
284 809 : SdrModel* pModel = rObj.GetModel();
285 809 : SfxStyleSheetBasePool* pStylePool = (pModel != NULL) ? pModel->GetStyleSheetPool() : 0L;
286 809 : SfxStyleSheet* pNewStyle = pStylePool ? (SfxStyleSheet*)pStylePool->Find(aNewStyleSheetName, GetStyleSheet()->GetFamily()) : NULL;
287 : DBG_ASSERT( pNewStyle, "AutoStyleSheetName - Style not found!" );
288 :
289 809 : if(pNewStyle)
290 : {
291 809 : rOutliner.SetStyleSheet(nPara, pNewStyle);
292 809 : }
293 : }
294 : else
295 : {
296 1242 : rOutliner.SetStyleSheet(nPara, GetStyleSheet());
297 : }
298 : }
299 : else
300 : {
301 : // remove StyleSheet
302 0 : rOutliner.SetStyleSheet(nPara, 0L);
303 : }
304 :
305 2051 : if(bDontRemoveHardAttr)
306 : {
307 20 : if(pTempSet)
308 : {
309 : // restore para attributes
310 20 : rOutliner.SetParaAttribs(nPara, *pTempSet);
311 : }
312 : }
313 : else
314 : {
315 2031 : if(pNewStyleSheet)
316 : {
317 : // remove all hard paragraph attributes
318 : // which occur in StyleSheet, take care of
319 : // parents (!)
320 2031 : SfxItemIter aIter(pNewStyleSheet->GetItemSet());
321 2031 : const SfxPoolItem* pItem = aIter.FirstItem();
322 :
323 52214 : while(pItem)
324 : {
325 48152 : if(!IsInvalidItem(pItem))
326 : {
327 48152 : sal_uInt16 nW(pItem->Which());
328 :
329 48152 : if(nW >= EE_ITEMS_START && nW <= EE_ITEMS_END)
330 : {
331 39570 : rOutliner.QuickRemoveCharAttribs(nPara, nW);
332 : }
333 : }
334 48152 : pItem = aIter.NextItem();
335 2031 : }
336 : }
337 : }
338 :
339 2051 : if(pTempSet)
340 : {
341 20 : delete pTempSet;
342 : }
343 : }
344 :
345 1439 : OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, nParaCount);
346 1439 : rOutliner.Clear();
347 1439 : rObj.NbcSetOutlinerParaObjectForText(pTemp, pText);
348 : }
349 : }
350 : }
351 :
352 42463 : if(rObj.IsTextFrame())
353 : {
354 20267 : rObj.NbcAdjustTextFrameWidthAndHeight();
355 : }
356 42463 : }
357 :
358 38501 : void TextProperties::ForceDefaultAttributes()
359 : {
360 38501 : SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
361 :
362 38501 : if( rObj.GetObjInventor() == SdrInventor )
363 : {
364 38188 : const sal_uInt16 nSdrObjKind = rObj.GetObjIdentifier();
365 :
366 38188 : if( nSdrObjKind == OBJ_TITLETEXT || nSdrObjKind == OBJ_OUTLINETEXT )
367 39067 : return; // no defaults for presentation objects
368 : }
369 :
370 37935 : bool bTextFrame(rObj.IsTextFrame());
371 :
372 : // force ItemSet
373 37935 : GetObjectItemSet();
374 :
375 37935 : if(bTextFrame)
376 : {
377 15473 : mpItemSet->Put(XLineStyleItem(XLINE_NONE));
378 15473 : mpItemSet->Put(XFillColorItem(OUString(), Color(COL_WHITE)));
379 15473 : mpItemSet->Put(XFillStyleItem(XFILL_NONE));
380 : }
381 : else
382 : {
383 22462 : mpItemSet->Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST));
384 22462 : mpItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
385 22462 : 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, 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, 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 31557 : void TextProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
547 : {
548 : // call parent
549 31557 : AttributeProperties::Notify(rBC, rHint);
550 :
551 31557 : SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
552 31557 : if(rObj.HasText())
553 : {
554 28426 : const svx::ITextProvider& rTextProvider(getTextProvider());
555 28426 : if(HAS_BASE(SfxStyleSheet, &rBC))
556 : {
557 17688 : SfxSimpleHint* pSimple = PTR_CAST(SfxSimpleHint, &rHint);
558 17688 : sal_uInt32 nId(pSimple ? pSimple->GetId() : 0L);
559 :
560 17688 : if(SFX_HINT_DATACHANGED == nId)
561 : {
562 17688 : rObj.SetPortionInfoChecked(false);
563 :
564 17688 : sal_Int32 nText = rTextProvider.getTextCount();
565 35376 : while( --nText > 0 )
566 : {
567 0 : OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
568 0 : if( pParaObj )
569 0 : pParaObj->ClearPortionInfo();
570 : }
571 17688 : rObj.SetTextSizeDirty();
572 :
573 17688 : if(rObj.IsTextFrame() && rObj.NbcAdjustTextFrameWidthAndHeight())
574 : {
575 : // here only repaint wanted
576 16 : rObj.ActionChanged();
577 : //rObj.BroadcastObjectChange();
578 : }
579 :
580 : // #i101556# content of StyleSheet has changed -> new version
581 17688 : maVersion++;
582 : }
583 :
584 17688 : if(SFX_HINT_DYING == nId)
585 : {
586 0 : rObj.SetPortionInfoChecked(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 10738 : else if(HAS_BASE(SfxStyleSheetBasePool, &rBC))
597 : {
598 10738 : SfxStyleSheetHintExtended* pExtendedHint = PTR_CAST(SfxStyleSheetHintExtended, &rHint);
599 :
600 10738 : if(pExtendedHint
601 10738 : && SFX_STYLESHEET_MODIFIED == pExtendedHint->GetHint())
602 : {
603 5678 : OUString aOldName(pExtendedHint->GetOldName());
604 11356 : OUString aNewName(pExtendedHint->GetStyleSheet()->GetName());
605 5678 : SfxStyleFamily eFamily = pExtendedHint->GetStyleSheet()->GetFamily();
606 :
607 5678 : if(aOldName != aNewName)
608 : {
609 5678 : sal_Int32 nText = rTextProvider.getTextCount();
610 11356 : 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 5678 : }
617 : }
618 : }
619 : }
620 31557 : }
621 :
622 : // #i101556# Handout version information
623 15604 : sal_uInt32 TextProperties::getVersion() const
624 : {
625 15604 : return maVersion;
626 : }
627 : } // end of namespace properties
628 : } // end of namespace sdr
629 :
630 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|