summaryrefslogtreecommitdiff
path: root/svx/source/sdr/properties/textproperties.cxx
blob: 7eb9603d739e95a529cf602a2f4000dd094b6a19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#include <sal/config.h>

#include <sdr/properties/textproperties.hxx>
#include <svl/itemset.hxx>
#include <svl/style.hxx>
#include <svl/itemiter.hxx>
#include <svl/hint.hxx>
#include <svx/svddef.hxx>
#include <svx/svdotext.hxx>
#include <svx/svdoutl.hxx>
#include <svx/sdmetitm.hxx>
#include <svx/sdtditm.hxx>
#include <editeng/writingmodeitem.hxx>
#include <svx/svdmodel.hxx>
#include <editeng/eeitem.hxx>
#include <editeng/outlobj.hxx>
#include <svx/xfillit0.hxx>
#include <svx/xflclit.hxx>
#include <editeng/adjustitem.hxx>
#include <svx/svdetc.hxx>
#include <editeng/editeng.hxx>
#include <editeng/flditem.hxx>
#include <svx/xlineit0.hxx>
#include <svx/xlnwtit.hxx>

using namespace com::sun::star;

namespace sdr::properties
{
        SfxItemSet TextProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
        {
            return SfxItemSet(rPool,

                // range from SdrAttrObj
                svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST,
                SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
                SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
                SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST,

                // range from SdrTextObj
                EE_ITEMS_START, EE_ITEMS_END>);
        }

        TextProperties::TextProperties(SdrObject& rObj)
        :   AttributeProperties(rObj),
            maVersion(0)
        {
        }

        TextProperties::TextProperties(const TextProperties& rProps, SdrObject& rObj)
        :   AttributeProperties(rProps, rObj),
            maVersion(rProps.getVersion())
        {
        }

        TextProperties::~TextProperties()
        {
        }

        std::unique_ptr<BaseProperties> TextProperties::Clone(SdrObject& rObj) const
        {
            return std::unique_ptr<BaseProperties>(new TextProperties(*this, rObj));
        }

        void TextProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich)
        {
            SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());

            // #i101556# ItemSet has changed -> new version
            maVersion++;

            if (auto pOutliner = rObj.GetTextEditOutliner())
            {
                pOutliner->SetTextColumns(rObj.GetTextColumnsNumber(),
                                          rObj.GetTextColumnsSpacing());
            }

            const svx::ITextProvider& rTextProvider(getTextProvider());
            sal_Int32 nText = rTextProvider.getTextCount();
            while (nText--)
            {
                SdrText* pText = rTextProvider.getText( nText );

                OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : nullptr;

                if(pParaObj)
                {
                    const bool bTextEdit = rObj.IsTextEditActive() && (rObj.getActiveText() == pText);

                    // handle outliner attributes
                    GetObjectItemSet();
                    Outliner* pOutliner = rObj.GetTextEditOutliner();

                    if(!bTextEdit)
                    {
                        pOutliner = &rObj.ImpGetDrawOutliner();
                        pOutliner->SetText(*pParaObj);
                    }

                    sal_Int32 nParaCount(pOutliner->GetParagraphCount());

                    for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
                    {
                        SfxItemSet aSet(pOutliner->GetParaAttribs(nPara));
                        for (const SfxPoolItem* pItem : aChangedItems)
                            aSet.Put(*pItem);
                        if (nDeletedWhich)
                            aSet.ClearItem(nDeletedWhich);
                        pOutliner->SetParaAttribs(nPara, aSet);
                    }

                    if(!bTextEdit)
                    {
                        if(nParaCount)
                        {
                            // force ItemSet
                            GetObjectItemSet();

                            moItemSet->Put(pOutliner->GetParaAttribs(0));
                        }

                        std::optional<OutlinerParaObject> pTemp = pOutliner->CreateParaObject(0, nParaCount);
                        pOutliner->Clear();

                        rObj.NbcSetOutlinerParaObjectForText(std::move(pTemp),pText);
                    }
                }
            }

            // Extra-Repaint for radical layout changes (#43139#)
            for (const SfxPoolItem* pItem : aChangedItems)
                if (pItem->Which() == SDRATTR_TEXT_CONTOURFRAME)
                {
                    // Here only repaint wanted
                    rObj.ActionChanged();
                    //rObj.BroadcastObjectChange();
                    break;
                }

            // call parent
            AttributeProperties::ItemSetChanged(aChangedItems, nDeletedWhich);
        }

        void TextProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
        {
            SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());

            // #i25616#
            sal_Int32 nOldLineWidth(0);

            if(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange())
            {
                nOldLineWidth = GetItem(XATTR_LINEWIDTH).GetValue();
            }

            if(pNewItem && (SDRATTR_TEXTDIRECTION == nWhich))
            {
                bool bVertical(css::text::WritingMode_TB_RL == static_cast<const SvxWritingModeItem*>(pNewItem)->GetValue());
                rObj.SetVerticalWriting(bVertical);
            }

            // #95501# reset to default
            if(!pNewItem && !nWhich && rObj.HasText() )
            {
                SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();

                const svx::ITextProvider& rTextProvider(getTextProvider());
                sal_Int32 nCount = rTextProvider.getTextCount();
                while (nCount--)
                {
                    SdrText* pText = rTextProvider.getText( nCount );
                    OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject();
                    if( pParaObj )
                    {
                        rOutliner.SetText(*pParaObj);
                        sal_Int32 nParaCount(rOutliner.GetParagraphCount());

                        if(nParaCount)
                        {
                            auto aSelection = ESelection::All();
                            rOutliner.RemoveAttribs(aSelection, true, 0);

                            std::optional<OutlinerParaObject> pTemp = rOutliner.CreateParaObject(0, nParaCount);
                            rOutliner.Clear();

                            rObj.NbcSetOutlinerParaObjectForText( std::move(pTemp), pText );
                        }
                    }
                }
            }

            // call parent
            AttributeProperties::ItemChange( nWhich, pNewItem );

            // #i25616#
            if(!(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange()))
                return;

            const sal_Int32 nNewLineWidth(GetItem(XATTR_LINEWIDTH).GetValue());
            const sal_Int32 nDifference((nNewLineWidth - nOldLineWidth) / 2);

            if(!nDifference)
                return;

            const bool bLineVisible(drawing::LineStyle_NONE != GetItem(XATTR_LINESTYLE).GetValue());

            if(bLineVisible)
            {
                const sal_Int32 nLeftDist(GetItem(SDRATTR_TEXT_LEFTDIST).GetValue());
                const sal_Int32 nRightDist(GetItem(SDRATTR_TEXT_RIGHTDIST).GetValue());
                const sal_Int32 nUpperDist(GetItem(SDRATTR_TEXT_UPPERDIST).GetValue());
                const sal_Int32 nLowerDist(GetItem(SDRATTR_TEXT_LOWERDIST).GetValue());

                SetObjectItemDirect(makeSdrTextLeftDistItem(nLeftDist + nDifference));
                SetObjectItemDirect(makeSdrTextRightDistItem(nRightDist + nDifference));
                SetObjectItemDirect(makeSdrTextUpperDistItem(nUpperDist + nDifference));
                SetObjectItemDirect(makeSdrTextLowerDistItem(nLowerDist + nDifference));
            }
        }

        const svx::ITextProvider& TextProperties::getTextProvider() const
        {
            return static_cast<const SdrTextObj&>(GetSdrObject());
        }

        void TextProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
                bool bBroadcast, bool bAdjustTextFrameWidthAndHeight)
        {
            // call parent (always first thing to do, may create the SfxItemSet)
            AttributeProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast, bAdjustTextFrameWidthAndHeight);

            // #i101556# StyleSheet has changed -> new version
            SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
            maVersion++;

            if(!rObj.IsLinkedText() )
            {
                SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();

                const svx::ITextProvider& rTextProvider(getTextProvider());
                sal_Int32 nText = rTextProvider.getTextCount();
                while (nText--)
                {
                    SdrText* pText = rTextProvider.getText( nText );

                    OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : nullptr;
                    if( !pParaObj )
                        continue;

                    // apply StyleSheet to all paragraphs
                    rOutliner.SetText(*pParaObj);
                    sal_Int32 nParaCount(rOutliner.GetParagraphCount());

                    if(nParaCount)
                    {
                        for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
                        {
                            std::optional<SfxItemSet> pTempSet;

                            // since setting the stylesheet removes all para attributes
                            if(bDontRemoveHardAttr)
                            {
                                // we need to remember them if we want to keep them
                                pTempSet.emplace(rOutliner.GetParaAttribs(nPara));
                            }

                            if(GetStyleSheet())
                            {
                                if((SdrObjKind::OutlineText == rObj.GetTextKind()) && (SdrInventor::Default == rObj.GetObjInventor()))
                                {
                                    OUString aNewStyleSheetName(GetStyleSheet()->GetName());
                                    aNewStyleSheetName = aNewStyleSheetName.copy(0, aNewStyleSheetName.getLength() - 1);
                                    sal_Int16 nDepth = rOutliner.GetDepth(nPara);
                                    aNewStyleSheetName += OUString::number( nDepth <= 0 ? 1 : nDepth + 1);
                                    SfxStyleSheetBasePool* pStylePool(rObj.getSdrModelFromSdrObject().GetStyleSheetPool());
                                    SfxStyleSheet* pNewStyle = nullptr;
                                    if(pStylePool)
                                        pNewStyle = static_cast<SfxStyleSheet*>(pStylePool->Find(aNewStyleSheetName, GetStyleSheet()->GetFamily()));
                                    DBG_ASSERT( pNewStyle, "AutoStyleSheetName - Style not found!" );

                                    if(pNewStyle)
                                    {
                                        rOutliner.SetStyleSheet(nPara, pNewStyle);
                                    }
                                }
                                else
                                {
                                    rOutliner.SetStyleSheet(nPara, GetStyleSheet());
                                }
                            }
                            else
                            {
                                // remove StyleSheet
                                rOutliner.SetStyleSheet(nPara, nullptr);
                            }

                            if(bDontRemoveHardAttr)
                            {
                                if(pTempSet)
                                {
                                    // restore para attributes
                                    rOutliner.SetParaAttribs(nPara, *pTempSet);
                                }
                            }
                            else
                            {
                                if(pNewStyleSheet)
                                {
                                    // remove all hard paragraph attributes
                                    // which occur in StyleSheet, take care of
                                    // parents (!)
                                    SfxItemIter aIter(pNewStyleSheet->GetItemSet());

                                    for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem;
                                         pItem = aIter.NextItem())
                                    {
                                        if(!IsInvalidItem(pItem))
                                        {
                                            sal_uInt16 nW(pItem->Which());

                                            if(nW >= EE_ITEMS_START && nW <= EE_ITEMS_END)
                                            {
                                                rOutliner.RemoveCharAttribs(nPara, nW);
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        std::optional<OutlinerParaObject> pTemp = rOutliner.CreateParaObject(0, nParaCount);
                        rOutliner.Clear();
                        rObj.NbcSetOutlinerParaObjectForText(std::move(pTemp), pText, bAdjustTextFrameWidthAndHeight);
                    }
                }
            }

            if(rObj.IsTextFrame() && !rObj.getSdrModelFromSdrObject().isLocked() && bAdjustTextFrameWidthAndHeight)
                rObj.NbcAdjustTextFrameWidthAndHeight();
        }

        void TextProperties::ForceDefaultAttributes()
        {
            SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());

            if( rObj.GetObjInventor() == SdrInventor::Default )
            {
                const SdrObjKind nSdrObjKind = rObj.GetObjIdentifier();

                if( nSdrObjKind == SdrObjKind::TitleText || nSdrObjKind == SdrObjKind::OutlineText )
                    return; // no defaults for presentation objects
            }

            bool bTextFrame(rObj.IsTextFrame());

            if(bTextFrame)
            {
                moItemSet->Put(XLineStyleItem(drawing::LineStyle_NONE));
                moItemSet->Put(XFillColorItem(OUString(), COL_WHITE));
                moItemSet->Put(XFillStyleItem(drawing::FillStyle_NONE));
            }
            else
            {
                moItemSet->Put(SvxAdjustItem(SvxAdjust::Center, EE_PARA_JUST));
                moItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
                moItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
            }
        }

        void TextProperties::ForceStyleToHardAttributes()
        {
            // #i61284# call parent first to get the hard ObjectItemSet
            AttributeProperties::ForceStyleToHardAttributes();

            // #i61284# push hard ObjectItemSet to OutlinerParaObject attributes
            // using existing functionality
            GetObjectItemSet(); // force ItemSet
            std::vector<const SfxPoolItem*> aChangedItems;
            SfxItemIter aIter(*moItemSet);
            for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
            {
                if(!IsInvalidItem(pItem))
                    aChangedItems.push_back(pItem);
            }
            ItemSetChanged(aChangedItems, 0);

            // now the standard TextProperties stuff
            SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());

            if(rObj.IsTextEditActive() || rObj.IsLinkedText())
                return;

            std::unique_ptr<Outliner> pOutliner = SdrMakeOutliner(OutlinerMode::OutlineObject, rObj.getSdrModelFromSdrObject());
            const svx::ITextProvider& rTextProvider(getTextProvider());
            sal_Int32 nText = rTextProvider.getTextCount();
            while (nText--)
            {
                SdrText* pText = rTextProvider.getText( nText );

                OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : nullptr;
                if( !pParaObj )
                    continue;

                pOutliner->SetText(*pParaObj);

                sal_Int32 nParaCount(pOutliner->GetParagraphCount());

                if(nParaCount)
                {
                    bool bBurnIn(false);

                    for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
                    {
                        SfxStyleSheet* pSheet = pOutliner->GetStyleSheet(nPara);

                        if(pSheet)
                        {
                            SfxItemSet aParaSet(pOutliner->GetParaAttribs(nPara));
                            SfxItemSet aSet(*aParaSet.GetPool());
                            aSet.Put(pSheet->GetItemSet());

                            /** the next code handles a special case for paragraphs that contain a
                                url field. The color for URL fields is either the system color for
                                urls or the char color attribute that formats the portion in which the
                                url field is contained.
                                When we set a char color attribute to the paragraphs item set from the
                                styles item set, we would have this char color attribute as an attribute
                                that is spanned over the complete paragraph after xml import due to some
                                problems in the xml import (using a XCursor on import so it does not know
                                the paragraphs and can't set char attributes to paragraphs ).

                                To avoid this, as soon as we try to set a char color attribute from the style
                                we
                                1. check if we have at least one url field in this paragraph
                                2. if we found at least one url field, we span the char color attribute over
                                all portions that are not url fields and remove the char color attribute
                                from the paragraphs item set
                            */

                            bool bHasURL(false);

                            if(aSet.GetItemState(EE_CHAR_COLOR) == SfxItemState::SET)
                            {
                                EditEngine* pEditEngine = const_cast<EditEngine*>(&(pOutliner->GetEditEngine()));
                                std::vector<EECharAttrib> aAttribs;
                                pEditEngine->GetCharAttribs(nPara, aAttribs);

                                for(const auto& rAttrib : aAttribs)
                                {
                                    if(rAttrib.pAttr && EE_FEATURE_FIELD == rAttrib.pAttr->Which())
                                    {
                                        const SvxFieldItem* pFieldItem = static_cast<const SvxFieldItem*>(rAttrib.pAttr);

                                        if(pFieldItem)
                                        {
                                            const SvxFieldData* pData = pFieldItem->GetField();

                                            if(dynamic_cast<const SvxURLField*>( pData))
                                            {
                                                bHasURL = true;
                                                break;
                                            }
                                        }
                                    }
                                }

                                if(bHasURL)
                                {
                                    SfxItemSetFixed<EE_CHAR_COLOR, EE_CHAR_COLOR> aColorSet(*aSet.GetPool());
                                    aColorSet.Put(aSet, false);

                                    ESelection aSel(nPara, 0);

                                    for(const auto& rAttrib : aAttribs)
                                    {
                                        if(EE_FEATURE_FIELD == rAttrib.pAttr->Which())
                                        {
                                            aSel.nEndPos = rAttrib.nStart;

                                            if(aSel.nStartPos != aSel.nEndPos)
                                                pEditEngine->QuickSetAttribs(aColorSet, aSel);

                                            aSel.nStartPos = rAttrib.nEnd;
                                        }
                                    }

                                    aSel.nEndPos = pEditEngine->GetTextLen(nPara);

                                    if(aSel.nStartPos != aSel.nEndPos)
                                    {
                                        pEditEngine->QuickSetAttribs( aColorSet, aSel );
                                    }
                                }

                            }

                            aSet.Put(aParaSet, false);

                            if(bHasURL)
                            {
                                aSet.ClearItem(EE_CHAR_COLOR);
                            }

                            pOutliner->SetParaAttribs(nPara, aSet);
                            bBurnIn = true; // #i51163# Flag was set wrong
                        }
                    }

                    if(bBurnIn)
                    {
                        std::optional<OutlinerParaObject> pTemp = pOutliner->CreateParaObject(0, nParaCount);
                        rObj.NbcSetOutlinerParaObjectForText(std::move(pTemp),pText);
                    }
                }

                pOutliner->Clear();
            }
        }

        void TextProperties::SetObjectItemNoBroadcast(const SfxPoolItem& rItem)
        {
            GetObjectItemSet();
            moItemSet->Put(rItem);
        }


        void TextProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
        {
            // call parent
            AttributeProperties::Notify(rBC, rHint);

            SfxHintId nId(rHint.GetId());

            if(SfxHintId::DataChanged == nId && rBC.IsSfxStyleSheet())
            {
                SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
                if(!rObj.HasText())
                    return;

                const svx::ITextProvider& rTextProvider(getTextProvider());
                sal_Int32 nText = rTextProvider.getTextCount();
                while (nText--)
                {
                    OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
                    if( pParaObj )
                        pParaObj->ClearPortionInfo();
                }
                rObj.SetTextSizeDirty();

                if(rObj.IsTextFrame() && rObj.NbcAdjustTextFrameWidthAndHeight())
                {
                    // here only repaint wanted
                    rObj.ActionChanged();
                    //rObj.BroadcastObjectChange();
                }

                // #i101556# content of StyleSheet has changed -> new version
                maVersion++;
            }
            else if(SfxHintId::Dying == nId && rBC.IsSfxStyleSheet())
            {
                SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
                if(!rObj.HasText())
                    return;

                const svx::ITextProvider& rTextProvider(getTextProvider());
                sal_Int32 nText = rTextProvider.getTextCount();
                while (nText--)
                {
                    OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
                    if( pParaObj )
                        pParaObj->ClearPortionInfo();
                }
            }
            else if (nId == SfxHintId::StyleSheetModifiedExtended)
            {
                assert(dynamic_cast<const SfxStyleSheetBasePool *>(&rBC) != nullptr);
                const SfxStyleSheetModifiedHint& rExtendedHint = static_cast<const SfxStyleSheetModifiedHint&>(rHint);
                const OUString& aOldName(rExtendedHint.GetOldName());
                OUString aNewName(rExtendedHint.GetStyleSheet()->GetName());
                SfxStyleFamily eFamily = rExtendedHint.GetStyleSheet()->GetFamily();

                if(aOldName != aNewName)
                {
                    const svx::ITextProvider& rTextProvider(getTextProvider());
                    sal_Int32 nText = rTextProvider.getTextCount();
                    while (nText--)
                    {
                        OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
                        if( pParaObj )
                            pParaObj->ChangeStyleSheetName(eFamily, aOldName, aNewName);
                    }
                }
            }
        }

        // #i101556# Handout version information
        sal_uInt32 TextProperties::getVersion() const
        {
            return maVersion;
        }
} // end of namespace

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */