Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/source/sdr/properties/attributeproperties.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/attributeproperties.hxx>
23
#include <tools/debug.hxx>
24
#include <svl/itemset.hxx>
25
#include <svl/style.hxx>
26
#include <svl/whiter.hxx>
27
#include <svl/poolitem.hxx>
28
#include <svx/svdobj.hxx>
29
#include <svx/xbtmpit.hxx>
30
#include <svx/xlndsit.hxx>
31
#include <svx/xlnstit.hxx>
32
#include <svx/xlnedit.hxx>
33
#include <svx/xflgrit.hxx>
34
#include <svx/xflftrit.hxx>
35
#include <svx/xflhtit.hxx>
36
#include <svx/svdmodel.hxx>
37
#include <svx/svdpage.hxx>
38
#include <osl/diagnose.h>
39
40
namespace sdr::properties
41
{
42
        void AttributeProperties::ImpSetParentAtSfxItemSet(bool bDontRemoveHardAttr)
43
1.45M
        {
44
1.45M
            if(HasSfxItemSet() && mpStyleSheet)
45
1.45M
            {
46
                // Delete hard attributes where items are set in the style sheet
47
1.45M
                if(!bDontRemoveHardAttr)
48
604k
                {
49
604k
                    const SfxItemSet& rStyle = mpStyleSheet->GetItemSet();
50
604k
                    SfxWhichIter aIter(rStyle);
51
604k
                    sal_uInt16 nWhich = aIter.FirstWhich();
52
53
128M
                    while(nWhich)
54
128M
                    {
55
128M
                        if(SfxItemState::SET == aIter.GetItemState())
56
9.87M
                        {
57
9.87M
                            moItemSet->ClearItem(nWhich);
58
9.87M
                        }
59
60
128M
                        nWhich = aIter.NextWhich();
61
128M
                    }
62
604k
                }
63
64
                // set new stylesheet as parent
65
1.45M
                moItemSet->SetParent(&mpStyleSheet->GetItemSet());
66
1.45M
            }
67
0
            else
68
0
            {
69
0
                OSL_ENSURE(false, "ImpSetParentAtSfxItemSet called without SfxItemSet/SfxStyleSheet (!)");
70
0
            }
71
1.45M
        }
72
73
        void AttributeProperties::ImpAddStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
74
1.51M
        {
75
            // test if old StyleSheet is cleared, else it would be lost
76
            // after this method -> memory leak (!)
77
1.51M
            DBG_ASSERT(!mpStyleSheet, "Old style sheet not deleted before setting new one (!)");
78
79
1.51M
            if(!pNewStyleSheet)
80
62.3k
                return;
81
82
            // local remember
83
1.45M
            mpStyleSheet = pNewStyleSheet;
84
85
1.45M
            if(HasSfxItemSet())
86
1.45M
            {
87
                // register as listener
88
1.45M
                StartListening(*pNewStyleSheet->GetPool());
89
1.45M
                StartListening(*pNewStyleSheet);
90
91
                // only apply the following when we have an SfxItemSet already, else
92
1.45M
                if(GetStyleSheet())
93
1.45M
                {
94
1.45M
                    ImpSetParentAtSfxItemSet(bDontRemoveHardAttr);
95
1.45M
                }
96
1.45M
            }
97
1.45M
        }
98
99
        void AttributeProperties::ImpRemoveStyleSheet()
100
3.44M
        {
101
            // Check type since it is destroyed when the type is deleted
102
3.44M
            if(GetStyleSheet() && mpStyleSheet)
103
1.45M
            {
104
1.45M
                EndListening(*mpStyleSheet);
105
1.45M
                if (auto const pool = mpStyleSheet->GetPool()) { // TTTT
106
1.45M
                    EndListening(*pool);
107
1.45M
                }
108
109
                // reset parent of ItemSet
110
1.45M
                if(HasSfxItemSet())
111
1.45M
                {
112
1.45M
                    moItemSet->SetParent(nullptr);
113
1.45M
                }
114
115
1.45M
                SdrObject& rObj = GetSdrObject();
116
1.45M
                rObj.SetBoundRectDirty();
117
1.45M
                rObj.SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
118
1.45M
            }
119
120
3.44M
            mpStyleSheet = nullptr;
121
3.44M
        }
122
123
        // create a new itemset
124
        SfxItemSet AttributeProperties::CreateObjectSpecificItemSet(SfxItemPool&)
125
0
        {
126
0
            assert(false && "this class is effectively abstract, should only be instantiating subclasses");
127
0
            abort();
128
0
        }
129
130
        AttributeProperties::AttributeProperties(SdrObject& rObj)
131
1.90M
        :   DefaultProperties(rObj),
132
1.90M
            mpStyleSheet(nullptr)
133
1.90M
        {
134
            // Do nothing else, esp. do *not* try to get and set
135
            // a default SfxStyle sheet. Nothing is allowed to be done
136
            // that may lead to calls to virtual functions like
137
            // CreateObjectSpecificItemSet - these would go *wrong*.
138
            // Thus the rest is lazy-init from here.
139
1.90M
        }
140
141
        AttributeProperties::AttributeProperties(const AttributeProperties& rProps, SdrObject& rObj)
142
26.6k
        :   DefaultProperties(rProps, rObj),
143
26.6k
            mpStyleSheet(nullptr)
144
26.6k
        {
145
26.6k
            SfxStyleSheet* pTargetStyleSheet(rProps.GetStyleSheet());
146
147
26.6k
            if(pTargetStyleSheet)
148
0
            {
149
0
                const bool bModelChange(&rObj.getSdrModelFromSdrObject() != &rProps.GetSdrObject().getSdrModelFromSdrObject());
150
151
0
                if(bModelChange)
152
0
                {
153
                    // tdf#117506
154
                    // The error shows that it is definitely necessary to solve this problem.
155
                    // Interestingly I already had a note here for 'work needed'.
156
                    // Checked in libreoffice-6-0 what happened there. In principle, the whole
157
                    // ::Clone of SdrPage and SdrObject happened in the same SdrModel, only
158
                    // afterwards a ::SetModel was used at the cloned SdrPage which went through
159
                    // all layers. The StyleSheet-problem was solved in
160
                    // AttributeProperties::MoveToItemPool at the end. There, a StyleSheet with the
161
                    // same name was searched for in the target-SdrModel.
162
                    // Start by resetting the current TargetStyleSheet so that nothing goes wrong
163
                    // when we do not find a fitting TargetStyleSheet.
164
                    // Note: The test for SdrModelChange above was wrong (compared the already set
165
                    // new SdrObject), so this never triggered and pTargetStyleSheet was never set to
166
                    // nullptr before. This means that a StyleSheet from another SdrModel was used
167
                    // what of course is very dangerous. Interestingly did not crash since when that
168
                    // other SdrModel was destroyed the ::Notify mechanism still worked reliably
169
                    // and de-connected this Properties successfully from the alien-StyleSheet.
170
0
                    pTargetStyleSheet = nullptr;
171
172
                    // Check if we have a TargetStyleSheetPool at the target-SdrModel. This *should*
173
                    // be the case already (SdrModel::Merge and SdDrawDocument::InsertBookmarkAsPage
174
                    // have already cloned the StyleSheets to the target-SdrModel when used in Draw/impress).
175
                    // If none is found, ImpGetDefaultStyleSheet will be used to set a 'default'
176
                    // StyleSheet as StyleSheet implicitly later (that's what happened in the task,
177
                    // thus the FillStyle changed to the 'default' Blue).
178
                    // Note: It *may* be necessary to do more for StyleSheets, e.g. clone/copy the
179
                    // StyleSheet Hierarchy from the source SdrModel and/or add the Items from there
180
                    // as hard attributes. If needed, have a look at the older AttributeProperties::SetModel
181
                    // implementation from e.g. libreoffice-6-0.
182
0
                    SfxStyleSheetBasePool* pTargetStyleSheetPool(rObj.getSdrModelFromSdrObject().GetStyleSheetPool());
183
184
0
                    if(nullptr != pTargetStyleSheetPool)
185
0
                    {
186
                        // If we have a TargetStyleSheetPool, search for the used StyleSheet
187
                        // in the target SdrModel using the Name from the original StyleSheet
188
                        // in the source-SdrModel.
189
0
                        pTargetStyleSheet = dynamic_cast< SfxStyleSheet* >(
190
0
                            pTargetStyleSheetPool->Find(
191
0
                                rProps.GetStyleSheet()->GetName(),
192
0
                                rProps.GetStyleSheet()->GetFamily()));
193
0
                    }
194
0
                }
195
0
            }
196
197
26.6k
            if(!pTargetStyleSheet)
198
26.6k
                return;
199
200
0
            if(HasSfxItemSet())
201
0
            {
202
                // The SfxItemSet has been cloned and exists,
203
                // we can directly set the SfxStyleSheet at it
204
0
                ImpAddStyleSheet(pTargetStyleSheet, true);
205
0
            }
206
0
            else
207
0
            {
208
                // No SfxItemSet exists yet (there is none in
209
                // the source, so none was cloned). Remember the
210
                // SfxStyleSheet to set it when the SfxItemSet
211
                // got constructed on-demand
212
0
                mpStyleSheet = pTargetStyleSheet;
213
0
            }
214
0
        }
215
216
        AttributeProperties::~AttributeProperties()
217
1.93M
        {
218
1.93M
            ImpRemoveStyleSheet();
219
1.93M
        }
220
221
        std::unique_ptr<BaseProperties> AttributeProperties::Clone(SdrObject&) const
222
0
        {
223
0
            assert(false && "this class is effectively abstract, should only be instantiating subclasses");
224
0
            abort();
225
0
        }
226
227
        const SfxItemSet& AttributeProperties::GetObjectItemSet() const
228
85.2M
        {
229
            // remember if we had a SfxItemSet already
230
85.2M
            const bool bHadSfxItemSet(HasSfxItemSet());
231
232
            // call parent - this will guarantee SfxItemSet existence
233
85.2M
            DefaultProperties::GetObjectItemSet();
234
235
85.2M
            if(!bHadSfxItemSet)
236
1.82M
            {
237
                // need to take care for SfxStyleSheet for newly
238
                // created SfxItemSet
239
1.82M
                if(nullptr == mpStyleSheet)
240
1.82M
                {
241
                    // Set missing defaults without removal of hard attributes.
242
                    // This is more complicated historically than I first thought:
243
                    // Originally for GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj
244
                    // SetStyleSheet(..., false) was used, while for GetDefaultStyleSheet
245
                    // SetStyleSheet(..., true) was used. Thus, for SdrGrafObj and SdrOle2Obj
246
                    // bDontRemoveHardAttr == false -> *do* delete hard attributes was used.
247
                    // This was probably not done by purpose, adding the method
248
                    // GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj additionally to
249
                    // GetDefaultStyleSheet was an enhancement to allow for SdrGrafObj/SdrOle2Obj
250
                    // with full AttributeSet (adding e.g. FillAttributes). To stay as compatible
251
                    // as possible these SdrObjects got a new default-StyleSheet.
252
                    // There is no reason to delete the HardAttributes and it anyways has only
253
                    // AFAIK effects on a single Item - the SdrTextHorzAdjustItem. To get things
254
                    // unified I will stay with not deleting the HardAttributes and adapt the
255
                    // UnitTests in CppunitTest_sd_import_tests accordingly.
256
1.82M
                    const_cast< AttributeProperties* >(this)->applyDefaultStyleSheetFromSdrModel();
257
1.82M
                }
258
0
                else
259
0
                {
260
                    // Late-Init of setting parent to SfxStyleSheet after
261
                    // it's creation. Can only happen from copy-constructor
262
                    // (where creation of SfxItemSet is avoided due to the
263
                    // problem with constructors and virtual functions in C++),
264
                    // thus DontRemoveHardAttr is not needed.
265
0
                    const_cast< AttributeProperties* >(this)->SetStyleSheet(
266
0
                        mpStyleSheet, true, true);
267
0
                }
268
1.82M
            }
269
270
85.2M
            return *moItemSet;
271
85.2M
        }
272
273
        void AttributeProperties::ItemSetChanged(std::span< const SfxPoolItem* const > /*aChangedItems*/, sal_uInt16 /*nDeletedWhich*/, bool /*bAdjustTextFrameWidthAndHeight*/)
274
7.53M
        {
275
            // own modifications
276
7.53M
            SdrObject& rObj = GetSdrObject();
277
278
7.53M
            rObj.SetBoundRectDirty();
279
7.53M
            rObj.SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
280
7.53M
            rObj.SetChanged();
281
7.53M
        }
282
283
        void AttributeProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
284
26.6M
        {
285
26.6M
            if(pNewItem)
286
26.6M
            {
287
26.6M
                std::unique_ptr<SfxPoolItem> pResultItem;
288
26.6M
                SdrModel& rModel(GetSdrObject().getSdrModelFromSdrObject());
289
290
26.6M
                switch( nWhich )
291
26.6M
                {
292
9.56k
                    case XATTR_FILLBITMAP:
293
9.56k
                    {
294
9.56k
                        pResultItem = static_cast<const XFillBitmapItem*>(pNewItem)->checkForUniqueItem( rModel );
295
9.56k
                        break;
296
0
                    }
297
14.6k
                    case XATTR_LINEDASH:
298
14.6k
                    {
299
14.6k
                        pResultItem = static_cast<const XLineDashItem*>(pNewItem)->checkForUniqueItem( rModel );
300
14.6k
                        break;
301
0
                    }
302
16.3k
                    case XATTR_LINESTART:
303
16.3k
                    {
304
16.3k
                        pResultItem = static_cast<const XLineStartItem*>(pNewItem)->checkForUniqueItem( rModel );
305
16.3k
                        break;
306
0
                    }
307
23.7k
                    case XATTR_LINEEND:
308
23.7k
                    {
309
23.7k
                        pResultItem = static_cast<const XLineEndItem*>(pNewItem)->checkForUniqueItem( rModel );
310
23.7k
                        break;
311
0
                    }
312
12.2k
                    case XATTR_FILLGRADIENT:
313
12.2k
                    {
314
12.2k
                        pResultItem = static_cast<const XFillGradientItem*>(pNewItem)->checkForUniqueItem( rModel );
315
12.2k
                        break;
316
0
                    }
317
99
                    case XATTR_FILLFLOATTRANSPARENCE:
318
99
                    {
319
                        // #85953# allow all kinds of XFillFloatTransparenceItem to be set
320
99
                        pResultItem = static_cast<const XFillFloatTransparenceItem*>(pNewItem)->checkForUniqueItem( rModel );
321
99
                        break;
322
0
                    }
323
0
                    case XATTR_FILLHATCH:
324
0
                    {
325
0
                        pResultItem = static_cast<const XFillHatchItem*>(pNewItem)->checkForUniqueItem( rModel );
326
0
                        break;
327
0
                    }
328
26.6M
                }
329
330
                // guarantee SfxItemSet existence
331
26.6M
                GetObjectItemSet();
332
333
26.6M
                if(pResultItem)
334
55.0k
                {
335
                    // force ItemSet
336
55.0k
                    moItemSet->Put(std::move(pResultItem));
337
55.0k
                }
338
26.6M
                else
339
26.6M
                {
340
26.6M
                    moItemSet->Put(*pNewItem);
341
26.6M
                }
342
26.6M
            }
343
26.1k
            else
344
26.1k
            {
345
                // clear item if ItemSet exists
346
26.1k
                if(HasSfxItemSet())
347
23.1k
                {
348
23.1k
                    moItemSet->ClearItem(nWhich);
349
23.1k
                }
350
26.1k
            }
351
26.6M
        }
352
353
        void AttributeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
354
                bool /*bBroadcast*/, bool /*bAdjustTextFrameWidthAndHeight*/)
355
1.51M
        {
356
            // Make sure we have a SfxItemSet. We are deliberately bypassing our
357
            // own AttributeProperties::GetObjectItemSet here, because we don't want to set a default stylesheet,
358
            // and then immediately remove it, which is costly.
359
1.51M
            DefaultProperties::GetObjectItemSet();
360
361
1.51M
            ImpRemoveStyleSheet();
362
1.51M
            ImpAddStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
363
364
1.51M
            SdrObject& rObj = GetSdrObject();
365
1.51M
            rObj.SetBoundRectDirty();
366
1.51M
            rObj.SetBoundAndSnapRectsDirty(true);
367
1.51M
        }
368
369
        SfxStyleSheet* AttributeProperties::GetStyleSheet() const
370
30.6M
        {
371
30.6M
            return mpStyleSheet;
372
30.6M
        }
373
374
        void AttributeProperties::ForceStyleToHardAttributes()
375
0
        {
376
0
            if(!GetStyleSheet() || mpStyleSheet == nullptr)
377
0
                return;
378
379
            // guarantee SfxItemSet existence
380
0
            GetObjectItemSet();
381
382
            // prepare copied, new itemset, but WITHOUT parent
383
0
            SfxItemSet aDestItemSet(*moItemSet);
384
0
            aDestItemSet.SetParent(nullptr);
385
386
            // prepare forgetting the current stylesheet like in RemoveStyleSheet()
387
0
            EndListening(*mpStyleSheet);
388
0
            EndListening(*mpStyleSheet->GetPool());
389
390
            // prepare the iter; use the mpObjectItemSet which may have less
391
            // WhichIDs than the style.
392
0
            SfxWhichIter aIter(aDestItemSet);
393
0
            sal_uInt16 nWhich(aIter.FirstWhich());
394
0
            const SfxPoolItem *pItem = nullptr;
395
396
            // now set all hard attributes of the current at the new itemset
397
0
            while(nWhich)
398
0
            {
399
                // #i61284# use mpItemSet with parents, makes things easier and reduces to
400
                // one loop
401
0
                if(SfxItemState::SET == moItemSet->GetItemState(nWhich, true, &pItem))
402
0
                {
403
0
                    aDestItemSet.Put(*pItem);
404
0
                }
405
406
0
                nWhich = aIter.NextWhich();
407
0
            }
408
409
            // replace itemsets
410
0
            moItemSet.emplace(std::move(aDestItemSet));
411
412
            // set necessary changes like in RemoveStyleSheet()
413
0
            GetSdrObject().SetBoundRectDirty();
414
0
            GetSdrObject().SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
415
416
0
            mpStyleSheet = nullptr;
417
0
        }
418
419
        void AttributeProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
420
19.5M
        {
421
19.5M
            bool bHintUsed(false);
422
423
19.5M
            SfxHintId id = rHint.GetId();
424
19.5M
            if (id == SfxHintId::StyleSheetChanged
425
19.5M
                || id == SfxHintId::StyleSheetErased
426
19.5M
                || id == SfxHintId::StyleSheetModified
427
10.5M
                || id == SfxHintId::StyleSheetInDestruction
428
10.5M
                || id == SfxHintId::StyleSheetModifiedExtended)
429
19.1M
            {
430
19.1M
                const SfxStyleSheetHint* pStyleHint = static_cast<const SfxStyleSheetHint*>(&rHint);
431
432
19.1M
                if(pStyleHint->GetStyleSheet() == GetStyleSheet())
433
79.0k
                {
434
79.0k
                    SdrObject& rObj = GetSdrObject();
435
                    //SdrPage* pPage = rObj.GetPage();
436
437
79.0k
                    switch(id)
438
79.0k
                    {
439
0
                        case SfxHintId::StyleSheetModified        :
440
79.0k
                        case SfxHintId::StyleSheetModifiedExtended:
441
79.0k
                        case SfxHintId::StyleSheetChanged         :
442
79.0k
                        {
443
                            // notify change
444
79.0k
                            break;
445
79.0k
                        }
446
0
                        case SfxHintId::StyleSheetErased          :
447
0
                        case SfxHintId::StyleSheetInDestruction   :
448
0
                        {
449
                            // Style needs to be exchanged
450
0
                            SfxStyleSheet* pNewStSh = nullptr;
451
0
                            SdrModel& rModel(rObj.getSdrModelFromSdrObject());
452
453
                            // Do nothing if object is in destruction, else a StyleSheet may be found from
454
                            // a StyleSheetPool which is just being deleted itself. and thus it would be fatal
455
                            // to register as listener to that new StyleSheet.
456
0
                            if(!rObj.IsInDestruction())
457
0
                            {
458
0
                                if(SfxStyleSheet* pStyleSheet = GetStyleSheet())
459
0
                                {
460
0
                                    pNewStSh = static_cast<SfxStyleSheet*>(rModel.GetStyleSheetPool()->Find(
461
0
                                        pStyleSheet->GetParent(), pStyleSheet->GetFamily()));
462
0
                                }
463
464
0
                                if(!pNewStSh)
465
0
                                {
466
0
                                    pNewStSh = rModel.GetDefaultStyleSheet();
467
0
                                }
468
0
                            }
469
470
                            // remove used style, it's erased or in destruction
471
0
                            ImpRemoveStyleSheet();
472
473
0
                            if(pNewStSh)
474
0
                            {
475
0
                                ImpAddStyleSheet(pNewStSh, true);
476
0
                            }
477
478
0
                            break;
479
0
                        }
480
0
                        default: break;
481
79.0k
                    }
482
483
                    // Get old BoundRect. Do this after the style change is handled
484
                    // in the ItemSet parts because GetBoundRect() may calculate a new
485
79.0k
                    tools::Rectangle aBoundRect = rObj.GetLastBoundRect();
486
487
79.0k
                    rObj.SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
488
489
                    // tell the object about the change
490
79.0k
                    rObj.SetChanged();
491
79.0k
                    rObj.BroadcastObjectChange();
492
493
                    //if(pPage && pPage->IsInserted())
494
                    //{
495
                    //  rObj.BroadcastObjectChange();
496
                    //}
497
498
79.0k
                    rObj.SendUserCall(SdrUserCallType::ChangeAttr, aBoundRect);
499
500
79.0k
                    bHintUsed = true;
501
79.0k
                }
502
19.1M
            }
503
19.5M
            if(!bHintUsed)
504
19.4M
            {
505
                // forward to SdrObject ATM. Not sure if this will be necessary
506
                // in the future.
507
19.4M
                GetSdrObject().Notify(rBC, rHint);
508
19.4M
            }
509
19.5M
        }
510
511
        bool AttributeProperties::isUsedByModel() const
512
2
        {
513
2
            const SdrObject& rObj(GetSdrObject());
514
2
            if (rObj.IsInserted())
515
2
            {
516
2
                const SdrPage* const pPage(rObj.getSdrPageFromSdrObject());
517
2
                if (pPage && pPage->IsInserted())
518
2
                    return true;
519
2
            }
520
0
            return false;
521
2
        }
522
523
        void AttributeProperties::applyDefaultStyleSheetFromSdrModel()
524
1.82M
        {
525
1.82M
            SfxStyleSheet* pDefaultStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet());
526
527
            // tdf#118139 Only do this when StyleSheet really differs. It may e.g.
528
            // be the case that nullptr == pDefaultStyleSheet and there is none set yet,
529
            // so indeed no need to set it (needed for some strange old MSWord2003
530
            // documents with CustomShape-'Group' and added Text-Frames, see task description)
531
1.82M
            if(pDefaultStyleSheet != GetStyleSheet())
532
818k
            {
533
                // do not delete hard attributes when setting dsefault Style
534
818k
                SetStyleSheet(pDefaultStyleSheet, true, true);
535
818k
            }
536
1.82M
        }
537
538
} // end of namespace
539
540
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */