Coverage Report

Created: 2026-07-10 11:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/source/sdr/properties/textproperties.cxx
Line
Count
Source
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 <sal/config.h>
21
22
#include <sdr/properties/textproperties.hxx>
23
#include <svl/itemset.hxx>
24
#include <svl/style.hxx>
25
#include <svl/itemiter.hxx>
26
#include <svl/hint.hxx>
27
#include <svx/svddef.hxx>
28
#include <svx/svdotext.hxx>
29
#include <svx/svdoutl.hxx>
30
#include <svx/sdmetitm.hxx>
31
#include <svx/sdtditm.hxx>
32
#include <editeng/writingmodeitem.hxx>
33
#include <svx/svdmodel.hxx>
34
#include <editeng/eeitem.hxx>
35
#include <editeng/outlobj.hxx>
36
#include <svx/xfillit0.hxx>
37
#include <svx/xflclit.hxx>
38
#include <editeng/adjustitem.hxx>
39
#include <svx/svdetc.hxx>
40
#include <editeng/editeng.hxx>
41
#include <editeng/flditem.hxx>
42
#include <svx/xlineit0.hxx>
43
#include <svx/xlnwtit.hxx>
44
#include <tools/debug.hxx>
45
46
using namespace com::sun::star;
47
48
namespace sdr::properties
49
{
50
        SfxItemSet TextProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
51
646k
        {
52
646k
            return SfxItemSet(rPool,
53
54
                // range from SdrAttrObj
55
646k
                svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST,
56
646k
                SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
57
646k
                SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
58
646k
                SDRATTR_GLOW_FIRST, SDRATTR_GLOW_TEXT_LAST,
59
646k
                SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST,
60
61
                // range from SdrTextObj
62
646k
                EE_ITEMS_START, EE_ITEMS_END>);
63
646k
        }
64
65
        TextProperties::TextProperties(SdrObject& rObj)
66
795k
        :   AttributeProperties(rObj),
67
795k
            maVersion(0)
68
795k
        {
69
795k
        }
70
71
        TextProperties::TextProperties(const TextProperties& rProps, SdrObject& rObj)
72
20.6k
        :   AttributeProperties(rProps, rObj),
73
20.6k
            maVersion(rProps.getVersion())
74
20.6k
        {
75
20.6k
        }
76
77
        TextProperties::~TextProperties()
78
815k
        {
79
815k
        }
80
81
        std::unique_ptr<BaseProperties> TextProperties::Clone(SdrObject& rObj) const
82
4.83k
        {
83
4.83k
            return std::unique_ptr<BaseProperties>(new TextProperties(*this, rObj));
84
4.83k
        }
85
86
        void TextProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight)
87
4.45M
        {
88
4.45M
            SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
89
90
            // #i101556# ItemSet has changed -> new version
91
4.45M
            maVersion++;
92
93
4.45M
            if (auto pOutliner = rObj.GetTextEditOutliner())
94
0
            {
95
0
                pOutliner->SetTextColumns(rObj.GetTextColumnsNumber(),
96
0
                                          rObj.GetTextColumnsSpacing());
97
0
            }
98
99
4.45M
            const svx::ITextProvider& rTextProvider(getTextProvider());
100
4.45M
            sal_Int32 nText = rTextProvider.getTextCount();
101
8.93M
            while (nText--)
102
4.47M
            {
103
4.47M
                SdrText* pText = rTextProvider.getText( nText );
104
105
4.47M
                OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : nullptr;
106
107
4.47M
                if(pParaObj)
108
619k
                {
109
619k
                    const bool bTextEdit = rObj.IsTextEditActive() && (rObj.getActiveText() == pText);
110
111
                    // handle outliner attributes
112
619k
                    GetObjectItemSet();
113
619k
                    Outliner* pOutliner = rObj.GetTextEditOutliner();
114
115
619k
                    if(!bTextEdit)
116
619k
                    {
117
619k
                        pOutliner = &rObj.ImpGetDrawOutliner();
118
619k
                        pOutliner->SetText(*pParaObj);
119
619k
                    }
120
121
619k
                    sal_Int32 nParaCount(pOutliner->GetParagraphCount());
122
123
2.62M
                    for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
124
2.00M
                    {
125
2.00M
                        SfxItemSet aSet(pOutliner->GetParaAttribs(nPara));
126
2.00M
                        for (const SfxPoolItem* pItem : aChangedItems)
127
10.2M
                            aSet.Put(*pItem);
128
2.00M
                        if (nDeletedWhich)
129
0
                            aSet.ClearItem(nDeletedWhich);
130
2.00M
                        pOutliner->SetParaAttribs(nPara, aSet);
131
2.00M
                    }
132
133
619k
                    if(!bTextEdit)
134
619k
                    {
135
619k
                        if(nParaCount)
136
619k
                        {
137
                            // force ItemSet
138
619k
                            GetObjectItemSet();
139
140
619k
                            moItemSet->Put(pOutliner->GetParaAttribs(0));
141
619k
                        }
142
143
619k
                        std::optional<OutlinerParaObject> pTemp = pOutliner->CreateParaObject(0, nParaCount);
144
619k
                        pOutliner->Clear();
145
146
619k
                        rObj.NbcSetOutlinerParaObjectForText(std::move(pTemp), pText, bAdjustTextFrameWidthAndHeight);
147
619k
                    }
148
619k
                }
149
4.47M
            }
150
151
            // Extra-Repaint for radical layout changes (#43139#)
152
4.45M
            for (const SfxPoolItem* pItem : aChangedItems)
153
14.2M
                if (pItem->Which() == SDRATTR_TEXT_CONTOURFRAME)
154
739
                {
155
                    // Here only repaint wanted
156
739
                    rObj.ActionChanged();
157
                    //rObj.BroadcastObjectChange();
158
739
                    break;
159
739
                }
160
161
            // call parent
162
4.45M
            AttributeProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight);
163
4.45M
        }
164
165
        void TextProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
166
16.3M
        {
167
16.3M
            SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
168
169
            // #i25616#
170
16.3M
            sal_Int32 nOldLineWidth(0);
171
172
16.3M
            if(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange())
173
265k
            {
174
265k
                nOldLineWidth = GetItem(XATTR_LINEWIDTH).GetValue();
175
265k
            }
176
177
16.3M
            if(pNewItem && (SDRATTR_TEXTDIRECTION == nWhich))
178
1.56M
            {
179
1.56M
                bool bVertical(css::text::WritingMode_TB_RL == static_cast<const SvxWritingModeItem*>(pNewItem)->GetValue());
180
1.56M
                rObj.SetVerticalWriting(bVertical);
181
1.56M
            }
182
183
            // #95501# reset to default
184
16.3M
            if(!pNewItem && !nWhich && rObj.HasText() )
185
335
            {
186
335
                SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
187
188
335
                const svx::ITextProvider& rTextProvider(getTextProvider());
189
335
                sal_Int32 nCount = rTextProvider.getTextCount();
190
670
                while (nCount--)
191
335
                {
192
335
                    SdrText* pText = rTextProvider.getText( nCount );
193
335
                    OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject();
194
335
                    if( pParaObj )
195
334
                    {
196
334
                        rOutliner.SetText(*pParaObj);
197
334
                        sal_Int32 nParaCount(rOutliner.GetParagraphCount());
198
199
334
                        if(nParaCount)
200
334
                        {
201
334
                            auto aSelection = ESelection::All();
202
334
                            rOutliner.RemoveAttribs(aSelection, true, 0);
203
204
334
                            std::optional<OutlinerParaObject> pTemp = rOutliner.CreateParaObject(0, nParaCount);
205
334
                            rOutliner.Clear();
206
207
334
                            rObj.NbcSetOutlinerParaObjectForText( std::move(pTemp), pText );
208
334
                        }
209
334
                    }
210
335
                }
211
335
            }
212
213
            // call parent
214
16.3M
            AttributeProperties::ItemChange( nWhich, pNewItem );
215
216
            // #i25616#
217
16.3M
            if(!(XATTR_LINEWIDTH == nWhich && rObj.DoesSupportTextIndentingOnLineWidthChange()))
218
16.0M
                return;
219
220
265k
            const sal_Int32 nNewLineWidth(GetItem(XATTR_LINEWIDTH).GetValue());
221
265k
            const sal_Int32 nDifference((nNewLineWidth - nOldLineWidth) / 2);
222
223
265k
            if(!nDifference)
224
82.1k
                return;
225
226
183k
            const bool bLineVisible(drawing::LineStyle_NONE != GetItem(XATTR_LINESTYLE).GetValue());
227
228
183k
            if(bLineVisible)
229
162k
            {
230
162k
                const sal_Int32 nLeftDist(GetItem(SDRATTR_TEXT_LEFTDIST).GetValue());
231
162k
                const sal_Int32 nRightDist(GetItem(SDRATTR_TEXT_RIGHTDIST).GetValue());
232
162k
                const sal_Int32 nUpperDist(GetItem(SDRATTR_TEXT_UPPERDIST).GetValue());
233
162k
                const sal_Int32 nLowerDist(GetItem(SDRATTR_TEXT_LOWERDIST).GetValue());
234
235
162k
                SetObjectItemDirect(makeSdrTextLeftDistItem(nLeftDist + nDifference));
236
162k
                SetObjectItemDirect(makeSdrTextRightDistItem(nRightDist + nDifference));
237
162k
                SetObjectItemDirect(makeSdrTextUpperDistItem(nUpperDist + nDifference));
238
162k
                SetObjectItemDirect(makeSdrTextLowerDistItem(nLowerDist + nDifference));
239
162k
            }
240
183k
        }
241
242
        const svx::ITextProvider& TextProperties::getTextProvider() const
243
14.1M
        {
244
14.1M
            return static_cast<const SdrTextObj&>(GetSdrObject());
245
14.1M
        }
246
247
        void TextProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
248
                bool bBroadcast, bool bAdjustTextFrameWidthAndHeight)
249
507k
        {
250
            // call parent (always first thing to do, may create the SfxItemSet)
251
507k
            AttributeProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast, bAdjustTextFrameWidthAndHeight);
252
253
            // #i101556# StyleSheet has changed -> new version
254
507k
            SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
255
507k
            maVersion++;
256
257
507k
            if(!rObj.IsLinkedText() )
258
507k
            {
259
507k
                SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
260
261
507k
                const svx::ITextProvider& rTextProvider(getTextProvider());
262
507k
                sal_Int32 nText = rTextProvider.getTextCount();
263
1.01M
                while (nText--)
264
507k
                {
265
507k
                    SdrText* pText = rTextProvider.getText( nText );
266
267
507k
                    OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : nullptr;
268
507k
                    if( !pParaObj )
269
316k
                        continue;
270
271
                    // apply StyleSheet to all paragraphs
272
191k
                    rOutliner.SetText(*pParaObj);
273
191k
                    sal_Int32 nParaCount(rOutliner.GetParagraphCount());
274
275
191k
                    if(nParaCount)
276
191k
                    {
277
562k
                        for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
278
370k
                        {
279
370k
                            std::optional<SfxItemSet> pTempSet;
280
281
                            // since setting the stylesheet removes all para attributes
282
370k
                            if(bDontRemoveHardAttr)
283
82.0k
                            {
284
                                // we need to remember them if we want to keep them
285
82.0k
                                pTempSet.emplace(rOutliner.GetParaAttribs(nPara));
286
82.0k
                            }
287
288
370k
                            if(GetStyleSheet())
289
322k
                            {
290
322k
                                if((SdrObjKind::OutlineText == rObj.GetTextKind()) && (SdrInventor::Default == rObj.GetObjInventor()))
291
139k
                                {
292
139k
                                    OUString aNewStyleSheetName(GetStyleSheet()->GetName());
293
139k
                                    aNewStyleSheetName = aNewStyleSheetName.copy(0, aNewStyleSheetName.getLength() - 1);
294
139k
                                    sal_Int16 nDepth = rOutliner.GetDepth(nPara);
295
139k
                                    aNewStyleSheetName += OUString::number( nDepth <= 0 ? 1 : nDepth + 1);
296
139k
                                    SfxStyleSheetBasePool* pStylePool(rObj.getSdrModelFromSdrObject().GetStyleSheetPool());
297
139k
                                    SfxStyleSheet* pNewStyle = nullptr;
298
139k
                                    if(pStylePool)
299
139k
                                        pNewStyle = static_cast<SfxStyleSheet*>(pStylePool->Find(aNewStyleSheetName, GetStyleSheet()->GetFamily()));
300
139k
                                    DBG_ASSERT( pNewStyle, "AutoStyleSheetName - Style not found!" );
301
302
139k
                                    if(pNewStyle)
303
139k
                                    {
304
139k
                                        rOutliner.SetStyleSheet(nPara, pNewStyle);
305
139k
                                    }
306
139k
                                }
307
182k
                                else
308
182k
                                {
309
182k
                                    rOutliner.SetStyleSheet(nPara, GetStyleSheet());
310
182k
                                }
311
322k
                            }
312
48.5k
                            else
313
48.5k
                            {
314
                                // remove StyleSheet
315
48.5k
                                rOutliner.SetStyleSheet(nPara, nullptr);
316
48.5k
                            }
317
318
370k
                            if(bDontRemoveHardAttr)
319
82.0k
                            {
320
82.0k
                                if(pTempSet)
321
82.0k
                                {
322
                                    // restore para attributes
323
82.0k
                                    rOutliner.SetParaAttribs(nPara, *pTempSet);
324
82.0k
                                }
325
82.0k
                            }
326
288k
                            else
327
288k
                            {
328
288k
                                if(pNewStyleSheet)
329
288k
                                {
330
                                    // remove all hard paragraph attributes
331
                                    // which occur in StyleSheet, take care of
332
                                    // parents (!)
333
7.59M
                                    for (SfxItemIter aIter( pNewStyleSheet->GetItemSet() ); !aIter.IsAtEnd(); aIter.Next())
334
7.30M
                                    {
335
7.30M
                                        const SfxPoolItem* pItem = aIter.GetCurItem();
336
7.30M
                                        if(!IsInvalidItem(pItem))
337
7.30M
                                        {
338
7.30M
                                            sal_uInt16 nW(pItem->Which());
339
340
7.30M
                                            if(nW >= EE_ITEMS_START && nW <= EE_ITEMS_END)
341
6.14M
                                            {
342
6.14M
                                                rOutliner.RemoveCharAttribs(nPara, nW);
343
6.14M
                                            }
344
7.30M
                                        }
345
7.30M
                                    }
346
288k
                                }
347
288k
                            }
348
370k
                        }
349
350
191k
                        std::optional<OutlinerParaObject> pTemp = rOutliner.CreateParaObject(0, nParaCount);
351
191k
                        rOutliner.Clear();
352
191k
                        rObj.NbcSetOutlinerParaObjectForText(std::move(pTemp), pText, bAdjustTextFrameWidthAndHeight);
353
191k
                    }
354
191k
                }
355
507k
            }
356
357
507k
            if(rObj.IsTextFrame() && !rObj.getSdrModelFromSdrObject().isLocked() && bAdjustTextFrameWidthAndHeight)
358
10.3k
                rObj.NbcAdjustTextFrameWidthAndHeight();
359
507k
        }
360
361
        void TextProperties::ForceDefaultAttributes()
362
648k
        {
363
648k
            SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
364
365
648k
            if( rObj.GetObjInventor() == SdrInventor::Default )
366
644k
            {
367
644k
                const SdrObjKind nSdrObjKind = rObj.GetObjIdentifier();
368
369
644k
                if( nSdrObjKind == SdrObjKind::TitleText || nSdrObjKind == SdrObjKind::OutlineText )
370
94.9k
                    return; // no defaults for presentation objects
371
644k
            }
372
373
553k
            bool bTextFrame(rObj.IsTextFrame());
374
375
553k
            if(bTextFrame)
376
364k
            {
377
364k
                moItemSet->Put(XLineStyleItem(drawing::LineStyle_NONE));
378
364k
                moItemSet->Put(XFillColorItem(OUString(), COL_WHITE));
379
364k
                moItemSet->Put(XFillStyleItem(drawing::FillStyle_NONE));
380
364k
            }
381
189k
            else
382
189k
            {
383
189k
                moItemSet->Put(SvxAdjustItem(SvxAdjust::Center, EE_PARA_JUST));
384
189k
                moItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER));
385
189k
                moItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
386
189k
            }
387
553k
        }
388
389
        void TextProperties::ForceStyleToHardAttributes()
390
0
        {
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
            std::vector<const SfxPoolItem*> aChangedItems;
398
399
0
            { // own scope to get SfxItemIter aIter destroyed ASAP - it maybe detected
400
              // as reading source to the ItemSet when Items get changed below, but it
401
              // is no longer active/needed
402
0
                for (SfxItemIter aIter( *moItemSet ); !aIter.IsAtEnd(); aIter.Next())
403
0
                {
404
0
                    const SfxPoolItem* pItem = aIter.GetCurItem();
405
0
                    if(!IsInvalidItem(pItem))
406
0
                        aChangedItems.push_back(pItem);
407
0
                }
408
0
            }
409
410
0
            ItemSetChanged(aChangedItems, 0);
411
412
            // now the standard TextProperties stuff
413
0
            SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
414
415
0
            if(rObj.IsTextEditActive() || rObj.IsLinkedText())
416
0
                return;
417
418
0
            std::unique_ptr<Outliner> pOutliner = SdrMakeOutliner(OutlinerMode::OutlineObject, rObj.getSdrModelFromSdrObject());
419
0
            const svx::ITextProvider& rTextProvider(getTextProvider());
420
0
            sal_Int32 nText = rTextProvider.getTextCount();
421
0
            while (nText--)
422
0
            {
423
0
                SdrText* pText = rTextProvider.getText( nText );
424
425
0
                OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : nullptr;
426
0
                if( !pParaObj )
427
0
                    continue;
428
429
0
                pOutliner->SetText(*pParaObj);
430
431
0
                sal_Int32 nParaCount(pOutliner->GetParagraphCount());
432
433
0
                if(nParaCount)
434
0
                {
435
0
                    bool bBurnIn(false);
436
437
0
                    for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
438
0
                    {
439
0
                        SfxStyleSheet* pSheet = pOutliner->GetStyleSheet(nPara);
440
441
0
                        if(pSheet)
442
0
                        {
443
0
                            SfxItemSet aParaSet(pOutliner->GetParaAttribs(nPara));
444
0
                            SfxItemSet aSet(*aParaSet.GetPool());
445
0
                            aSet.Put(pSheet->GetItemSet());
446
447
                            /** the next code handles a special case for paragraphs that contain a
448
                                url field. The color for URL fields is either the system color for
449
                                urls or the char color attribute that formats the portion in which the
450
                                url field is contained.
451
                                When we set a char color attribute to the paragraphs item set from the
452
                                styles item set, we would have this char color attribute as an attribute
453
                                that is spanned over the complete paragraph after xml import due to some
454
                                problems in the xml import (using a XCursor on import so it does not know
455
                                the paragraphs and can't set char attributes to paragraphs ).
456
457
                                To avoid this, as soon as we try to set a char color attribute from the style
458
                                we
459
                                1. check if we have at least one url field in this paragraph
460
                                2. if we found at least one url field, we span the char color attribute over
461
                                all portions that are not url fields and remove the char color attribute
462
                                from the paragraphs item set
463
                            */
464
465
0
                            bool bHasURL(false);
466
467
0
                            if(aSet.GetItemState(EE_CHAR_COLOR) == SfxItemState::SET)
468
0
                            {
469
0
                                EditEngine* pEditEngine = const_cast<EditEngine*>(&(pOutliner->GetEditEngine()));
470
0
                                std::vector<EECharAttrib> aAttribs;
471
0
                                pEditEngine->GetCharAttribs(nPara, aAttribs);
472
473
0
                                for(const auto& rAttrib : aAttribs)
474
0
                                {
475
0
                                    if(rAttrib.pAttr && EE_FEATURE_FIELD == rAttrib.pAttr->Which())
476
0
                                    {
477
0
                                        const SvxFieldItem* pFieldItem = static_cast<const SvxFieldItem*>(rAttrib.pAttr);
478
479
0
                                        if(pFieldItem)
480
0
                                        {
481
0
                                            const SvxFieldData* pData = pFieldItem->GetField();
482
483
0
                                            if(dynamic_cast<const SvxURLField*>( pData))
484
0
                                            {
485
0
                                                bHasURL = true;
486
0
                                                break;
487
0
                                            }
488
0
                                        }
489
0
                                    }
490
0
                                }
491
492
0
                                if(bHasURL)
493
0
                                {
494
0
                                    SfxItemSet aColorSet(SfxItemSet::makeFixedSfxItemSet<EE_CHAR_COLOR, EE_CHAR_COLOR>(*aSet.GetPool()));
495
0
                                    aColorSet.Put(aSet, false);
496
497
0
                                    ESelection aSel(nPara, 0);
498
499
0
                                    for(const auto& rAttrib : aAttribs)
500
0
                                    {
501
0
                                        if(EE_FEATURE_FIELD == rAttrib.pAttr->Which())
502
0
                                        {
503
0
                                            aSel.end.nIndex = rAttrib.nStart;
504
505
0
                                            if (aSel.start.nIndex != aSel.end.nIndex)
506
0
                                                pEditEngine->QuickSetAttribs(aColorSet, aSel);
507
508
0
                                            aSel.start.nIndex = rAttrib.nEnd;
509
0
                                        }
510
0
                                    }
511
512
0
                                    aSel.end.nIndex = pEditEngine->GetTextLen(nPara);
513
514
0
                                    if (aSel.start.nIndex != aSel.end.nIndex)
515
0
                                    {
516
0
                                        pEditEngine->QuickSetAttribs( aColorSet, aSel );
517
0
                                    }
518
0
                                }
519
520
0
                            }
521
522
0
                            aSet.Put(aParaSet, false);
523
524
0
                            if(bHasURL)
525
0
                            {
526
0
                                aSet.ClearItem(EE_CHAR_COLOR);
527
0
                            }
528
529
0
                            pOutliner->SetParaAttribs(nPara, aSet);
530
0
                            bBurnIn = true; // #i51163# Flag was set wrong
531
0
                        }
532
0
                    }
533
534
0
                    if(bBurnIn)
535
0
                    {
536
0
                        std::optional<OutlinerParaObject> pTemp = pOutliner->CreateParaObject(0, nParaCount);
537
0
                        rObj.NbcSetOutlinerParaObjectForText(std::move(pTemp),pText);
538
0
                    }
539
0
                }
540
541
0
                pOutliner->Clear();
542
0
            }
543
0
        }
544
545
        void TextProperties::SetObjectItemNoBroadcast(const SfxPoolItem& rItem)
546
0
        {
547
0
            GetObjectItemSet();
548
0
            moItemSet->Put(rItem);
549
0
        }
550
551
552
        void TextProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
553
16.0M
        {
554
            // call parent
555
16.0M
            AttributeProperties::Notify(rBC, rHint);
556
557
16.0M
            SfxHintId nId(rHint.GetId());
558
559
16.0M
            if(SfxHintId::DataChanged == nId && rBC.IsSfxStyleSheet())
560
367k
            {
561
367k
                SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
562
367k
                if(!rObj.HasText())
563
143
                    return;
564
565
367k
                const svx::ITextProvider& rTextProvider(getTextProvider());
566
367k
                sal_Int32 nText = rTextProvider.getTextCount();
567
734k
                while (nText--)
568
367k
                {
569
367k
                    OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
570
367k
                    if( pParaObj )
571
367k
                        pParaObj->ClearPortionInfo();
572
367k
                }
573
367k
                rObj.SetTextSizeDirty();
574
575
367k
                if(rObj.IsTextFrame() && rObj.NbcAdjustTextFrameWidthAndHeight())
576
27
                {
577
                    // here only repaint wanted
578
27
                    rObj.ActionChanged();
579
                    //rObj.BroadcastObjectChange();
580
27
                }
581
582
                // #i101556# content of StyleSheet has changed -> new version
583
367k
                maVersion++;
584
367k
            }
585
15.6M
            else if(SfxHintId::Dying == nId && rBC.IsSfxStyleSheet())
586
0
            {
587
0
                SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
588
0
                if(!rObj.HasText())
589
0
                    return;
590
591
0
                const svx::ITextProvider& rTextProvider(getTextProvider());
592
0
                sal_Int32 nText = rTextProvider.getTextCount();
593
0
                while (nText--)
594
0
                {
595
0
                    OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
596
0
                    if( pParaObj )
597
0
                        pParaObj->ClearPortionInfo();
598
0
                }
599
0
            }
600
15.6M
            else if (nId == SfxHintId::StyleSheetModifiedExtended)
601
8.79M
            {
602
8.79M
                assert(dynamic_cast<const SfxStyleSheetBasePool *>(&rBC) != nullptr);
603
8.79M
                const SfxStyleSheetModifiedHint& rExtendedHint = static_cast<const SfxStyleSheetModifiedHint&>(rHint);
604
8.79M
                const OUString& aOldName(rExtendedHint.GetOldName());
605
8.79M
                OUString aNewName(rExtendedHint.GetStyleSheet()->GetName());
606
8.79M
                SfxStyleFamily eFamily = rExtendedHint.GetStyleSheet()->GetFamily();
607
608
8.79M
                if(aOldName != aNewName)
609
8.79M
                {
610
8.79M
                    const svx::ITextProvider& rTextProvider(getTextProvider());
611
8.79M
                    sal_Int32 nText = rTextProvider.getTextCount();
612
17.5M
                    while (nText--)
613
8.79M
                    {
614
8.79M
                        OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
615
8.79M
                        if( pParaObj )
616
8.04M
                            pParaObj->ChangeStyleSheetName(eFamily, aOldName, aNewName);
617
8.79M
                    }
618
8.79M
                }
619
8.79M
            }
620
16.0M
        }
621
622
        // #i101556# Handout version information
623
        sal_uInt32 TextProperties::getVersion() const
624
21.4k
        {
625
21.4k
            return maVersion;
626
21.4k
        }
627
} // end of namespace
628
629
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */