summaryrefslogtreecommitdiffstats
path: root/svx/source/sdr/properties
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /svx/source/sdr/properties
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'svx/source/sdr/properties')
-rw-r--r--svx/source/sdr/properties/attributeproperties.cxx537
-rw-r--r--svx/source/sdr/properties/captionproperties.cxx103
-rw-r--r--svx/source/sdr/properties/circleproperties.cxx122
-rw-r--r--svx/source/sdr/properties/connectorproperties.cxx90
-rw-r--r--svx/source/sdr/properties/customshapeproperties.cxx231
-rw-r--r--svx/source/sdr/properties/defaultproperties.cxx251
-rw-r--r--svx/source/sdr/properties/e3dcompoundproperties.cxx144
-rw-r--r--svx/source/sdr/properties/e3dextrudeproperties.cxx74
-rw-r--r--svx/source/sdr/properties/e3dlatheproperties.cxx84
-rw-r--r--svx/source/sdr/properties/e3dproperties.cxx75
-rw-r--r--svx/source/sdr/properties/e3dsceneproperties.cxx286
-rw-r--r--svx/source/sdr/properties/e3dsphereproperties.cxx69
-rw-r--r--svx/source/sdr/properties/emptyproperties.cxx89
-rw-r--r--svx/source/sdr/properties/graphicproperties.cxx148
-rw-r--r--svx/source/sdr/properties/groupproperties.cxx222
-rw-r--r--svx/source/sdr/properties/itemsettools.cxx87
-rw-r--r--svx/source/sdr/properties/measureproperties.cxx127
-rw-r--r--svx/source/sdr/properties/oleproperties.cxx65
-rw-r--r--svx/source/sdr/properties/pageproperties.cxx106
-rw-r--r--svx/source/sdr/properties/properties.cxx178
-rw-r--r--svx/source/sdr/properties/rectangleproperties.cxx69
-rw-r--r--svx/source/sdr/properties/textproperties.cxx627
22 files changed, 3784 insertions, 0 deletions
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx
new file mode 100644
index 0000000000..56ce36b9d0
--- /dev/null
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -0,0 +1,537 @@
+/* -*- 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/attributeproperties.hxx>
+#include <tools/debug.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svl/whiter.hxx>
+#include <svl/poolitem.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svddef.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflftrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <osl/diagnose.h>
+
+namespace sdr::properties
+{
+ void AttributeProperties::ImpSetParentAtSfxItemSet(bool bDontRemoveHardAttr)
+ {
+ if(HasSfxItemSet() && mpStyleSheet)
+ {
+ // Delete hard attributes where items are set in the style sheet
+ if(!bDontRemoveHardAttr)
+ {
+ const SfxItemSet& rStyle = mpStyleSheet->GetItemSet();
+ SfxWhichIter aIter(rStyle);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while(nWhich)
+ {
+ if(SfxItemState::SET == aIter.GetItemState())
+ {
+ moItemSet->ClearItem(nWhich);
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+
+ // set new stylesheet as parent
+ moItemSet->SetParent(&mpStyleSheet->GetItemSet());
+ }
+ else
+ {
+ OSL_ENSURE(false, "ImpSetParentAtSfxItemSet called without SfxItemSet/SfxStyleSheet (!)");
+ }
+ }
+
+ void AttributeProperties::ImpAddStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
+ {
+ // test if old StyleSheet is cleared, else it would be lost
+ // after this method -> memory leak (!)
+ DBG_ASSERT(!mpStyleSheet, "Old style sheet not deleted before setting new one (!)");
+
+ if(!pNewStyleSheet)
+ return;
+
+ // local remember
+ mpStyleSheet = pNewStyleSheet;
+
+ if(HasSfxItemSet())
+ {
+ // register as listener
+ StartListening(*pNewStyleSheet->GetPool());
+ StartListening(*pNewStyleSheet);
+
+ // only apply the following when we have an SfxItemSet already, else
+ if(GetStyleSheet())
+ {
+ ImpSetParentAtSfxItemSet(bDontRemoveHardAttr);
+ }
+ }
+ }
+
+ void AttributeProperties::ImpRemoveStyleSheet()
+ {
+ // Check type since it is destroyed when the type is deleted
+ if(GetStyleSheet() && mpStyleSheet)
+ {
+ EndListening(*mpStyleSheet);
+ if (auto const pool = mpStyleSheet->GetPool()) { // TTTT
+ EndListening(*pool);
+ }
+
+ // reset parent of ItemSet
+ if(HasSfxItemSet())
+ {
+ moItemSet->SetParent(nullptr);
+ }
+
+ SdrObject& rObj = GetSdrObject();
+ rObj.SetBoundRectDirty();
+ rObj.SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
+ }
+
+ mpStyleSheet = nullptr;
+ }
+
+ // create a new itemset
+ SfxItemSet AttributeProperties::CreateObjectSpecificItemSet(SfxItemPool&)
+ {
+ assert(false && "this class is effectively abstract, should only be instantiating subclasses");
+ abort();
+ }
+
+ AttributeProperties::AttributeProperties(SdrObject& rObj)
+ : DefaultProperties(rObj),
+ mpStyleSheet(nullptr)
+ {
+ // Do nothing else, esp. do *not* try to get and set
+ // a default SfxStyle sheet. Nothing is allowed to be done
+ // that may lead to calls to virtual functions like
+ // CreateObjectSpecificItemSet - these would go *wrong*.
+ // Thus the rest is lazy-init from here.
+ }
+
+ AttributeProperties::AttributeProperties(const AttributeProperties& rProps, SdrObject& rObj)
+ : DefaultProperties(rProps, rObj),
+ mpStyleSheet(nullptr)
+ {
+ SfxStyleSheet* pTargetStyleSheet(rProps.GetStyleSheet());
+
+ if(pTargetStyleSheet)
+ {
+ const bool bModelChange(&rObj.getSdrModelFromSdrObject() != &rProps.GetSdrObject().getSdrModelFromSdrObject());
+
+ if(bModelChange)
+ {
+ // tdf#117506
+ // The error shows that it is definitely necessary to solve this problem.
+ // Interestingly I already had a note here for 'work needed'.
+ // Checked in libreoffice-6-0 what happened there. In principle, the whole
+ // ::Clone of SdrPage and SdrObject happened in the same SdrModel, only
+ // afterwards a ::SetModel was used at the cloned SdrPage which went through
+ // all layers. The StyleSheet-problem was solved in
+ // AttributeProperties::MoveToItemPool at the end. There, a StyleSheet with the
+ // same name was searched for in the target-SdrModel.
+ // Start by resetting the current TargetStyleSheet so that nothing goes wrong
+ // when we do not find a fitting TargetStyleSheet.
+ // Note: The test for SdrModelChange above was wrong (compared the already set
+ // new SdrObject), so this never triggered and pTargetStyleSheet was never set to
+ // nullptr before. This means that a StyleSheet from another SdrModel was used
+ // what of course is very dangerous. Interestingly did not crash since when that
+ // other SdrModel was destroyed the ::Notify mechanism still worked reliably
+ // and de-connected this Properties successfully from the alien-StyleSheet.
+ pTargetStyleSheet = nullptr;
+
+ // Check if we have a TargetStyleSheetPool at the target-SdrModel. This *should*
+ // be the case already (SdrModel::Merge and SdDrawDocument::InsertBookmarkAsPage
+ // have already cloned the StyleSheets to the target-SdrModel when used in Draw/impress).
+ // If none is found, ImpGetDefaultStyleSheet will be used to set a 'default'
+ // StyleSheet as StyleSheet implicitly later (that's what happened in the task,
+ // thus the FillStyle changed to the 'default' Blue).
+ // Note: It *may* be necessary to do more for StyleSheets, e.g. clone/copy the
+ // StyleSheet Hierarchy from the source SdrModel and/or add the Items from there
+ // as hard attributes. If needed, have a look at the older AttributeProperties::SetModel
+ // implementation from e.g. libreoffice-6-0.
+ SfxStyleSheetBasePool* pTargetStyleSheetPool(rObj.getSdrModelFromSdrObject().GetStyleSheetPool());
+
+ if(nullptr != pTargetStyleSheetPool)
+ {
+ // If we have a TargetStyleSheetPool, search for the used StyleSheet
+ // in the target SdrModel using the Name from the original StyleSheet
+ // in the source-SdrModel.
+ pTargetStyleSheet = dynamic_cast< SfxStyleSheet* >(
+ pTargetStyleSheetPool->Find(
+ rProps.GetStyleSheet()->GetName(),
+ rProps.GetStyleSheet()->GetFamily()));
+ }
+ }
+ }
+
+ if(!pTargetStyleSheet)
+ return;
+
+ if(HasSfxItemSet())
+ {
+ // The SfxItemSet has been cloned and exists,
+ // we can directly set the SfxStyleSheet at it
+ ImpAddStyleSheet(pTargetStyleSheet, true);
+ }
+ else
+ {
+ // No SfxItemSet exists yet (there is none in
+ // the source, so none was cloned). Remember the
+ // SfxStyleSheet to set it when the SfxItemSet
+ // got constructed on-demand
+ mpStyleSheet = pTargetStyleSheet;
+ }
+ }
+
+ AttributeProperties::~AttributeProperties()
+ {
+ ImpRemoveStyleSheet();
+ }
+
+ std::unique_ptr<BaseProperties> AttributeProperties::Clone(SdrObject&) const
+ {
+ assert(false && "this class is effectively abstract, should only be instantiating subclasses");
+ abort();
+ }
+
+ const SfxItemSet& AttributeProperties::GetObjectItemSet() const
+ {
+ // remember if we had a SfxItemSet already
+ const bool bHadSfxItemSet(HasSfxItemSet());
+
+ // call parent - this will guarantee SfxItemSet existence
+ DefaultProperties::GetObjectItemSet();
+
+ if(!bHadSfxItemSet)
+ {
+ // need to take care for SfxStyleSheet for newly
+ // created SfxItemSet
+ if(nullptr == mpStyleSheet)
+ {
+ // Set missing defaults without removal of hard attributes.
+ // This is more complicated historically than I first thought:
+ // Originally for GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj
+ // SetStyleSheet(..., false) was used, while for GetDefaultStyleSheet
+ // SetStyleSheet(..., true) was used. Thus, for SdrGrafObj and SdrOle2Obj
+ // bDontRemoveHardAttr == false -> *do* delete hard attributes was used.
+ // This was probably not done by purpose, adding the method
+ // GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj additionally to
+ // GetDefaultStyleSheet was an enhancement to allow for SdrGrafObj/SdrOle2Obj
+ // with full AttributeSet (adding e.g. FillAttributes). To stay as compatible
+ // as possible these SdrObjects got a new default-StyleSheet.
+ // There is no reason to delete the HardAttributes and it anyways has only
+ // AFAIK effects on a single Item - the SdrTextHorzAdjustItem. To get things
+ // unified I will stay with not deleting the HardAttributes and adapt the
+ // UnitTests in CppunitTest_sd_import_tests accordingly.
+ const_cast< AttributeProperties* >(this)->applyDefaultStyleSheetFromSdrModel();
+ }
+ else
+ {
+ // Late-Init of setting parent to SfxStyleSheet after
+ // it's creation. Can only happen from copy-constructor
+ // (where creation of SfxItemSet is avoided due to the
+ // problem with constructors and virtual functions in C++),
+ // thus DontRemoveHardAttr is not needed.
+ const_cast< AttributeProperties* >(this)->SetStyleSheet(
+ mpStyleSheet, true, true);
+ }
+ }
+
+ return *moItemSet;
+ }
+
+ void AttributeProperties::ItemSetChanged(std::span< const SfxPoolItem* const > /*aChangedItems*/, sal_uInt16 /*nDeletedWhich*/)
+ {
+ // own modifications
+ SdrObject& rObj = GetSdrObject();
+
+ rObj.SetBoundRectDirty();
+ rObj.SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
+ rObj.SetChanged();
+ }
+
+ void AttributeProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
+ {
+ if(pNewItem)
+ {
+ std::unique_ptr<SfxPoolItem> pResultItem;
+ SdrModel& rModel(GetSdrObject().getSdrModelFromSdrObject());
+
+ switch( nWhich )
+ {
+ case XATTR_FILLBITMAP:
+ {
+ // TTTT checkForUniqueItem should use SdrModel&
+ pResultItem = static_cast<const XFillBitmapItem*>(pNewItem)->checkForUniqueItem( &rModel );
+ break;
+ }
+ case XATTR_LINEDASH:
+ {
+ pResultItem = static_cast<const XLineDashItem*>(pNewItem)->checkForUniqueItem( &rModel );
+ break;
+ }
+ case XATTR_LINESTART:
+ {
+ pResultItem = static_cast<const XLineStartItem*>(pNewItem)->checkForUniqueItem( &rModel );
+ break;
+ }
+ case XATTR_LINEEND:
+ {
+ pResultItem = static_cast<const XLineEndItem*>(pNewItem)->checkForUniqueItem( &rModel );
+ break;
+ }
+ case XATTR_FILLGRADIENT:
+ {
+ pResultItem = static_cast<const XFillGradientItem*>(pNewItem)->checkForUniqueItem( &rModel );
+ break;
+ }
+ case XATTR_FILLFLOATTRANSPARENCE:
+ {
+ // #85953# allow all kinds of XFillFloatTransparenceItem to be set
+ pResultItem = static_cast<const XFillFloatTransparenceItem*>(pNewItem)->checkForUniqueItem( &rModel );
+ break;
+ }
+ case XATTR_FILLHATCH:
+ {
+ pResultItem = static_cast<const XFillHatchItem*>(pNewItem)->checkForUniqueItem( &rModel );
+ break;
+ }
+ }
+
+ // guarantee SfxItemSet existence
+ GetObjectItemSet();
+
+ if(pResultItem)
+ {
+ // force ItemSet
+ moItemSet->Put(std::move(pResultItem));
+ }
+ else
+ {
+ moItemSet->Put(*pNewItem);
+ }
+ }
+ else
+ {
+ // clear item if ItemSet exists
+ if(HasSfxItemSet())
+ {
+ moItemSet->ClearItem(nWhich);
+ }
+ }
+ }
+
+ void AttributeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
+ bool /*bBroadcast*/)
+ {
+ // guarantee SfxItemSet existence
+ GetObjectItemSet();
+
+ ImpRemoveStyleSheet();
+ ImpAddStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+
+ SdrObject& rObj = GetSdrObject();
+ rObj.SetBoundRectDirty();
+ rObj.SetBoundAndSnapRectsDirty(true);
+ }
+
+ SfxStyleSheet* AttributeProperties::GetStyleSheet() const
+ {
+ return mpStyleSheet;
+ }
+
+ void AttributeProperties::ForceStyleToHardAttributes()
+ {
+ if(!GetStyleSheet() || mpStyleSheet == nullptr)
+ return;
+
+ // guarantee SfxItemSet existence
+ GetObjectItemSet();
+
+ // prepare copied, new itemset, but WITHOUT parent
+ SfxItemSet aDestItemSet(*moItemSet);
+ aDestItemSet.SetParent(nullptr);
+
+ // prepare forgetting the current stylesheet like in RemoveStyleSheet()
+ EndListening(*mpStyleSheet);
+ EndListening(*mpStyleSheet->GetPool());
+
+ // prepare the iter; use the mpObjectItemSet which may have less
+ // WhichIDs than the style.
+ SfxWhichIter aIter(aDestItemSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+ const SfxPoolItem *pItem = nullptr;
+
+ // now set all hard attributes of the current at the new itemset
+ while(nWhich)
+ {
+ // #i61284# use mpItemSet with parents, makes things easier and reduces to
+ // one loop
+ if(SfxItemState::SET == moItemSet->GetItemState(nWhich, true, &pItem))
+ {
+ aDestItemSet.Put(*pItem);
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+
+ // replace itemsets
+ moItemSet.emplace(std::move(aDestItemSet));
+
+ // set necessary changes like in RemoveStyleSheet()
+ GetSdrObject().SetBoundRectDirty();
+ GetSdrObject().SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
+
+ mpStyleSheet = nullptr;
+ }
+
+ void AttributeProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+ {
+ bool bHintUsed(false);
+
+ const SfxStyleSheetHint* pStyleHint = dynamic_cast<const SfxStyleSheetHint*>(&rHint);
+
+ if(pStyleHint && pStyleHint->GetStyleSheet() == GetStyleSheet())
+ {
+ SdrObject& rObj = GetSdrObject();
+ //SdrPage* pPage = rObj.GetPage();
+
+ switch(pStyleHint->GetId())
+ {
+ case SfxHintId::StyleSheetCreated :
+ {
+ // cannot happen, nothing to do
+ break;
+ }
+ case SfxHintId::StyleSheetModified :
+ case SfxHintId::StyleSheetChanged :
+ {
+ // notify change
+ break;
+ }
+ case SfxHintId::StyleSheetErased :
+ case SfxHintId::StyleSheetInDestruction :
+ {
+ // Style needs to be exchanged
+ SfxStyleSheet* pNewStSh = nullptr;
+ SdrModel& rModel(rObj.getSdrModelFromSdrObject());
+
+ // Do nothing if object is in destruction, else a StyleSheet may be found from
+ // a StyleSheetPool which is just being deleted itself. and thus it would be fatal
+ // to register as listener to that new StyleSheet.
+ if(!rObj.IsInDestruction())
+ {
+ if(SfxStyleSheet* pStyleSheet = GetStyleSheet())
+ {
+ pNewStSh = static_cast<SfxStyleSheet*>(rModel.GetStyleSheetPool()->Find(
+ pStyleSheet->GetParent(), pStyleSheet->GetFamily()));
+ }
+
+ if(!pNewStSh)
+ {
+ pNewStSh = rModel.GetDefaultStyleSheet();
+ }
+ }
+
+ // remove used style, it's erased or in destruction
+ ImpRemoveStyleSheet();
+
+ if(pNewStSh)
+ {
+ ImpAddStyleSheet(pNewStSh, true);
+ }
+
+ break;
+ }
+ default: break;
+ }
+
+ // Get old BoundRect. Do this after the style change is handled
+ // in the ItemSet parts because GetBoundRect() may calculate a new
+ tools::Rectangle aBoundRect = rObj.GetLastBoundRect();
+
+ rObj.SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
+
+ // tell the object about the change
+ rObj.SetChanged();
+ rObj.BroadcastObjectChange();
+
+ //if(pPage && pPage->IsInserted())
+ //{
+ // rObj.BroadcastObjectChange();
+ //}
+
+ rObj.SendUserCall(SdrUserCallType::ChangeAttr, aBoundRect);
+
+ bHintUsed = true;
+ }
+
+ if(!bHintUsed)
+ {
+ // forward to SdrObject ATM. Not sure if this will be necessary
+ // in the future.
+ GetSdrObject().Notify(rBC, rHint);
+ }
+ }
+
+ bool AttributeProperties::isUsedByModel() const
+ {
+ const SdrObject& rObj(GetSdrObject());
+ if (rObj.IsInserted())
+ {
+ const SdrPage* const pPage(rObj.getSdrPageFromSdrObject());
+ if (pPage && pPage->IsInserted())
+ return true;
+ }
+ return false;
+ }
+
+ void AttributeProperties::applyDefaultStyleSheetFromSdrModel()
+ {
+ SfxStyleSheet* pDefaultStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet());
+
+ // tdf#118139 Only do this when StyleSheet really differs. It may e.g.
+ // be the case that nullptr == pDefaultStyleSheet and there is none set yet,
+ // so indeed no need to set it (needed for some strange old MSWord2003
+ // documents with CustomShape-'Group' and added Text-Frames, see task description)
+ if(pDefaultStyleSheet != GetStyleSheet())
+ {
+ // do not delete hard attributes when setting dsefault Style
+ SetStyleSheet(pDefaultStyleSheet, true, true);
+ }
+ }
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/captionproperties.cxx b/svx/source/sdr/properties/captionproperties.cxx
new file mode 100644
index 0000000000..3de1da6d65
--- /dev/null
+++ b/svx/source/sdr/properties/captionproperties.cxx
@@ -0,0 +1,103 @@
+/* -*- 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/captionproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdocapt.hxx>
+
+
+namespace sdr::properties
+{
+ // create a new itemset
+ SfxItemSet CaptionProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return SfxItemSet(
+ rPool,
+ svl::Items<
+ // Ranges from SdrAttrObj, SdrCaptionObj:
+ SDRATTR_START, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+ SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST,
+ // Range from SdrTextObj:
+ EE_ITEMS_START, EE_ITEMS_END>);
+ }
+
+ CaptionProperties::CaptionProperties(SdrObject& rObj)
+ : RectangleProperties(rObj)
+ {
+ }
+
+ CaptionProperties::CaptionProperties(const CaptionProperties& rProps, SdrObject& rObj)
+ : RectangleProperties(rProps, rObj)
+ {
+ }
+
+ CaptionProperties::~CaptionProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> CaptionProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new CaptionProperties(*this, rObj));
+ }
+
+ void CaptionProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich)
+ {
+ SdrCaptionObj& rObj = static_cast<SdrCaptionObj&>(GetSdrObject());
+
+ // local changes
+ rObj.ImpRecalcTail();
+
+ // call parent
+ RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich);
+ }
+
+ void CaptionProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
+ bool bBroadcast)
+ {
+ // call parent (always first thing to do, may create the SfxItemSet)
+ RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast);
+
+ // local changes
+ SdrCaptionObj& rObj = static_cast<SdrCaptionObj&>(GetSdrObject());
+ rObj.ImpRecalcTail();
+ }
+
+ void CaptionProperties::ForceDefaultAttributes()
+ {
+ // call parent
+ RectangleProperties::ForceDefaultAttributes();
+
+ // this was set by TextProperties::ForceDefaultAttributes(),
+ // reset to default
+ if (static_cast<SdrCaptionObj&>(GetSdrObject()).GetSpecialTextBoxShadow())
+ {
+ moItemSet->ClearItem(XATTR_FILLCOLOR);
+ moItemSet->ClearItem(XATTR_FILLSTYLE);
+ }
+ moItemSet->ClearItem(XATTR_LINESTYLE);
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/circleproperties.cxx b/svx/source/sdr/properties/circleproperties.cxx
new file mode 100644
index 0000000000..643c297eb0
--- /dev/null
+++ b/svx/source/sdr/properties/circleproperties.cxx
@@ -0,0 +1,122 @@
+/* -*- 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/circleproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdocirc.hxx>
+#include <sxcikitm.hxx>
+#include <svx/sxciaitm.hxx>
+
+
+namespace sdr::properties
+{
+ // create a new itemset
+ SfxItemSet CircleProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return SfxItemSet(
+ rPool,
+ svl::Items<
+ // Ranges from SdrAttrObj, SdrCircObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+ SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST,
+ // Range from SdrTextObj:
+ EE_ITEMS_START, EE_ITEMS_END>);
+ }
+
+ CircleProperties::CircleProperties(SdrObject& rObj)
+ : RectangleProperties(rObj)
+ {
+ }
+
+ CircleProperties::CircleProperties(const CircleProperties& rProps, SdrObject& rObj)
+ : RectangleProperties(rProps, rObj)
+ {
+ }
+
+ CircleProperties::~CircleProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> CircleProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new CircleProperties(*this, rObj));
+ }
+
+ void CircleProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich)
+ {
+ SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
+
+ // call parent
+ RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich);
+
+ // local changes
+ rObj.ImpSetAttrToCircInfo();
+ }
+
+ void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
+ bool bBroadcast)
+ {
+ // call parent (always first thing to do, may create the SfxItemSet)
+ RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast);
+
+ // local changes
+ SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
+ rObj.SetXPolyDirty();
+
+ // local changes
+ rObj.ImpSetAttrToCircInfo();
+ }
+
+ void CircleProperties::ForceDefaultAttributes()
+ {
+ SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
+ SdrCircKind eKind = rObj.GetCircleKind();
+
+ if(eKind != SdrCircKind::Full)
+ {
+ moItemSet->Put(SdrCircKindItem(eKind));
+
+ if(rObj.GetStartAngle())
+ {
+ moItemSet->Put(makeSdrCircStartAngleItem(rObj.GetStartAngle()));
+ }
+
+ if(rObj.GetEndAngle() != 36000_deg100)
+ {
+ moItemSet->Put(makeSdrCircEndAngleItem(rObj.GetEndAngle()));
+ }
+ }
+
+ // call parent after SetObjectItem(SdrCircKindItem())
+ // because ForceDefaultAttr() will call
+ // ImpSetAttrToCircInfo() which needs a correct
+ // SdrCircKindItem
+ RectangleProperties::ForceDefaultAttributes();
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/connectorproperties.cxx b/svx/source/sdr/properties/connectorproperties.cxx
new file mode 100644
index 0000000000..4d3542d678
--- /dev/null
+++ b/svx/source/sdr/properties/connectorproperties.cxx
@@ -0,0 +1,90 @@
+/* -*- 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/connectorproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdoedge.hxx>
+
+
+namespace sdr::properties
+{
+ // create a new itemset
+ SfxItemSet ConnectorProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return SfxItemSet(
+ rPool,
+ svl::Items<
+ // Ranges from SdrAttrObj, SdrEdgeObj:
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_EDGE_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+ SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST,
+ SDRATTR_EDGEOOXMLCURVE_FIRST, SDRATTR_EDGEOOXMLCURVE_LAST,
+ // Range from SdrTextObj:
+ EE_ITEMS_START, EE_ITEMS_END>);
+ }
+
+ ConnectorProperties::ConnectorProperties(SdrObject& rObj)
+ : TextProperties(rObj)
+ {
+ }
+
+ ConnectorProperties::ConnectorProperties(const ConnectorProperties& rProps, SdrObject& rObj)
+ : TextProperties(rProps, rObj)
+ {
+ }
+
+ ConnectorProperties::~ConnectorProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> ConnectorProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new ConnectorProperties(*this, rObj));
+ }
+
+ void ConnectorProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich)
+ {
+ SdrEdgeObj& rObj = static_cast<SdrEdgeObj&>(GetSdrObject());
+
+ // call parent
+ TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich);
+
+ // local changes
+ rObj.ImpSetAttrToEdgeInfo();
+ }
+
+ void ConnectorProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
+ bool bBroadcast)
+ {
+ // call parent (always first thing to do, may create the SfxItemSet)
+ TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast);
+
+ // local changes
+ SdrEdgeObj& rObj = static_cast<SdrEdgeObj&>(GetSdrObject());
+ rObj.ImpSetAttrToEdgeInfo();
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx
new file mode 100644
index 0000000000..cbad73ab78
--- /dev/null
+++ b/svx/source/sdr/properties/customshapeproperties.cxx
@@ -0,0 +1,231 @@
+/* -*- 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/customshapeproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/sdooitm.hxx>
+#include <editeng/eeitem.hxx>
+#include <svl/whiter.hxx>
+#include <svl/hint.hxx>
+
+
+namespace sdr::properties
+{
+ void CustomShapeProperties::UpdateTextFrameStatus(bool bInvalidateRenderGeometry)
+ {
+ SdrObjCustomShape& rObj = static_cast< SdrObjCustomShape& >(GetSdrObject());
+ const bool bOld(rObj.mbTextFrame);
+
+ // change TextFrame flag when bResizeShapeToFitText changes (which is mapped
+ // on the item SDRATTR_TEXT_AUTOGROWHEIGHT for custom shapes, argh)
+ rObj.mbTextFrame = GetObjectItemSet().Get(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue();
+
+ // check if it did change
+ if(rObj.mbTextFrame != bOld)
+ {
+ // on change also invalidate render geometry
+ bInvalidateRenderGeometry = true;
+
+ // #115391# Potential recursion, since it calls SetObjectItemSet again, but rObj.bTextFrame
+ // will not change again. Thus it will be only one level and terminate safely
+ rObj.AdaptTextMinSize();
+ }
+
+ if(bInvalidateRenderGeometry)
+ {
+ // if asked for or bResizeShapeToFitText changed, make sure that
+ // the render geometry is reconstructed using changed parameters
+ rObj.InvalidateRenderGeometry();
+ }
+ }
+
+ SfxItemSet CustomShapeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return SfxItemSet(
+ rPool,
+ svl::Items<
+ // Ranges from SdrAttrObj:
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+ // Graphic attributes, 3D properties, CustomShape
+ // properties:
+ SDRATTR_GRAF_FIRST, SDRATTR_CUSTOMSHAPE_LAST,
+ SDRATTR_GLOW_FIRST, SDRATTR_SOFTEDGE_LAST,
+ SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST,
+ SDRATTR_WRITINGMODE2, SDRATTR_WRITINGMODE2,
+ // Range from SdrTextObj:
+ EE_ITEMS_START, EE_ITEMS_END>);
+ }
+
+ bool CustomShapeProperties::AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem ) const
+ {
+ bool bAllowItemChange = true;
+ if ( !pNewItem )
+ {
+ if ( ( nWhich >= SDRATTR_CUSTOMSHAPE_FIRST ) && ( nWhich <= SDRATTR_CUSTOMSHAPE_LAST ) )
+ bAllowItemChange = false;
+ }
+ if ( bAllowItemChange )
+ bAllowItemChange = TextProperties::AllowItemChange( nWhich, pNewItem );
+ return bAllowItemChange;
+ }
+
+ void CustomShapeProperties::ClearObjectItem(const sal_uInt16 nWhich)
+ {
+ if ( !nWhich )
+ {
+ SfxWhichIter aIter( *moItemSet );
+ sal_uInt16 nWhich2 = aIter.FirstWhich();
+ while( nWhich2 )
+ {
+ TextProperties::ClearObjectItemDirect( nWhich2 );
+ nWhich2 = aIter.NextWhich();
+ }
+ ItemSetChanged({}, 0);
+ }
+ else
+ TextProperties::ClearObjectItem( nWhich );
+ }
+
+ void CustomShapeProperties::ClearObjectItemDirect(const sal_uInt16 nWhich)
+ {
+ if ( !nWhich )
+ {
+ SfxWhichIter aIter( *moItemSet );
+ sal_uInt16 nWhich2 = aIter.FirstWhich();
+ while( nWhich2 )
+ {
+ TextProperties::ClearObjectItemDirect( nWhich2 );
+ nWhich2 = aIter.NextWhich();
+ }
+ }
+ else
+ TextProperties::ClearObjectItemDirect( nWhich );
+ }
+
+ void CustomShapeProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich)
+ {
+ // call parent
+ TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich);
+
+ // update bTextFrame and RenderGeometry
+ UpdateTextFrameStatus(true);
+ }
+
+ void CustomShapeProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ switch(nWhich)
+ {
+ case SDRATTR_TEXT_AUTOGROWHEIGHT:
+ {
+ // #115391# update bTextFrame and RenderGeometry using AdaptTextMinSize()
+ UpdateTextFrameStatus(false);
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ // call parent
+ TextProperties::PostItemChange(nWhich);
+ }
+
+ void CustomShapeProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem)
+ {
+ // call parent
+ TextProperties::ItemChange( nWhich, pNewItem );
+
+ // update bTextFrame and RenderGeometry
+ UpdateTextFrameStatus(true);
+ }
+
+ void CustomShapeProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
+ bool bBroadcast)
+ {
+ // call parent (always first thing to do, may create the SfxItemSet)
+ TextProperties::SetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr, bBroadcast );
+
+ // update bTextFrame and RenderGeometry
+ UpdateTextFrameStatus(true);
+ }
+
+ void CustomShapeProperties::ForceDefaultAttributes()
+ {
+ // update bTextFrame and RenderGeometry
+ UpdateTextFrameStatus(true);
+
+ // SJ: Following is no good if creating customshapes, leading to objects that are white after loading via xml
+ // This means: Do *not* call parent here is by purpose...
+ }
+
+ CustomShapeProperties::CustomShapeProperties(SdrObject& rObj)
+ : TextProperties(rObj)
+ {
+ }
+
+ CustomShapeProperties::CustomShapeProperties(const CustomShapeProperties& rProps, SdrObject& rObj)
+ : TextProperties(rProps, rObj)
+ {
+ }
+
+ CustomShapeProperties::~CustomShapeProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> CustomShapeProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new CustomShapeProperties(*this, rObj));
+ }
+
+ void CustomShapeProperties::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+ {
+ TextProperties::Notify( rBC, rHint );
+
+ bool bRemoveRenderGeometry = false;
+ const SfxStyleSheetHint* pStyleHint = dynamic_cast<const SfxStyleSheetHint*>(&rHint);
+
+ if ( pStyleHint && pStyleHint->GetStyleSheet() == GetStyleSheet() )
+ {
+ switch( pStyleHint->GetId() )
+ {
+ case SfxHintId::StyleSheetModified :
+ case SfxHintId::StyleSheetChanged :
+ bRemoveRenderGeometry = true;
+ break;
+ default: break;
+ }
+ }
+ else if ( rHint.GetId() == SfxHintId::DataChanged )
+ {
+ bRemoveRenderGeometry = true;
+ }
+
+ // update bTextFrame and RenderGeometry
+ UpdateTextFrameStatus(bRemoveRenderGeometry);
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx
new file mode 100644
index 0000000000..ec98d7a0d0
--- /dev/null
+++ b/svx/source/sdr/properties/defaultproperties.cxx
@@ -0,0 +1,251 @@
+/* -*- 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 <svx/sdr/properties/defaultproperties.hxx>
+#include <sdr/properties/itemsettools.hxx>
+#include <svl/itemset.hxx>
+#include <svl/whiter.hxx>
+#include <vector>
+#include <svx/svdobj.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <libxml/xmlwriter.h>
+#include <svx/svdmodel.hxx>
+#include <svx/svdtrans.hxx>
+#include <svx/xbtmpit.hxx>
+
+namespace sdr::properties
+{
+ SfxItemSet DefaultProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ // Basic implementation; Basic object has NO attributes
+ return SfxItemSet(rPool);
+ }
+
+ DefaultProperties::DefaultProperties(SdrObject& rObj)
+ : BaseProperties(rObj)
+ {
+ }
+
+ DefaultProperties::DefaultProperties(const DefaultProperties& rProps, SdrObject& rObj)
+ : BaseProperties(rObj)
+ {
+ if(!rProps.moItemSet)
+ return;
+
+ // Clone may be to another model and thus another ItemPool.
+ // SfxItemSet supports that thus we are able to Clone all
+ // SfxItemState::SET items to the target pool.
+ moItemSet.emplace(rProps.moItemSet->CloneAsValue(
+ true,
+ &rObj.getSdrModelFromSdrObject().GetItemPool()));
+
+ // React on ModelChange: If metric has changed, scale items.
+ // As seen above, clone is supported, but scale is not included,
+ // thus: TTTT maybe add scale to SfxItemSet::Clone() (?)
+ // tdf#117707 correct ModelChange detection
+ const bool bModelChange(&rObj.getSdrModelFromSdrObject() != &rProps.GetSdrObject().getSdrModelFromSdrObject());
+
+ if(bModelChange)
+ {
+ const MapUnit aOldUnit(rProps.GetSdrObject().getSdrModelFromSdrObject().GetScaleUnit());
+ const MapUnit aNewUnit(rObj.getSdrModelFromSdrObject().GetScaleUnit());
+ const bool bScaleUnitChanged(aNewUnit != aOldUnit);
+
+ if(bScaleUnitChanged)
+ {
+ const Fraction aMetricFactor(GetMapFactor(aOldUnit, aNewUnit).X());
+
+ ScaleItemSet(*moItemSet, aMetricFactor);
+ }
+ }
+
+ // do not keep parent info, this may be changed by later constructors.
+ // This class just copies the ItemSet, ignore parent.
+ if(moItemSet && moItemSet->GetParent())
+ {
+ moItemSet->SetParent(nullptr);
+ }
+ }
+
+ std::unique_ptr<BaseProperties> DefaultProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new DefaultProperties(*this, rObj));
+ }
+
+ DefaultProperties::~DefaultProperties() {}
+
+ const SfxItemSet& DefaultProperties::GetObjectItemSet() const
+ {
+ if(!moItemSet)
+ {
+ moItemSet.emplace(const_cast<DefaultProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool()));
+ const_cast<DefaultProperties*>(this)->ForceDefaultAttributes();
+ }
+
+ assert(moItemSet && "Could not create an SfxItemSet(!)");
+
+ return *moItemSet;
+ }
+
+ void DefaultProperties::SetObjectItem(const SfxPoolItem& rItem)
+ {
+ const sal_uInt16 nWhichID(rItem.Which());
+
+ if(!AllowItemChange(nWhichID, &rItem))
+ return;
+
+ ItemChange(nWhichID, &rItem);
+ PostItemChange(nWhichID);
+
+ const SfxPoolItem* pItem = &rItem;
+ ItemSetChanged( {&pItem, 1}, 0);
+ }
+
+ void DefaultProperties::SetObjectItemDirect(const SfxPoolItem& rItem)
+ {
+ const sal_uInt16 nWhichID(rItem.Which());
+
+ if(AllowItemChange(nWhichID, &rItem))
+ {
+ ItemChange(nWhichID, &rItem);
+ }
+ }
+
+ void DefaultProperties::ClearObjectItem(const sal_uInt16 nWhich)
+ {
+ if(!AllowItemChange(nWhich))
+ return;
+
+ ItemChange(nWhich);
+ PostItemChange(nWhich);
+
+ if(nWhich)
+ {
+ ItemSetChanged({}, nWhich);
+ }
+ }
+
+ void DefaultProperties::ClearObjectItemDirect(const sal_uInt16 nWhich)
+ {
+ if(AllowItemChange(nWhich))
+ {
+ ItemChange(nWhich);
+ }
+ }
+
+ void DefaultProperties::SetObjectItemSet(const SfxItemSet& rSet)
+ {
+ if (rSet.HasItem(XATTR_FILLBITMAP))
+ {
+ const XFillBitmapItem* pItem = rSet.GetItem(XATTR_FILLBITMAP);
+ const std::shared_ptr<VectorGraphicData>& pVectorData
+ = pItem->GetGraphicObject().GetGraphic().getVectorGraphicData();
+ if (pVectorData)
+ {
+ // Shape is filled by a vector graphic: tell it our size as a hint.
+ basegfx::B2DTuple aSizeHint;
+ aSizeHint.setX(GetSdrObject().GetSnapRect().getOpenWidth());
+ aSizeHint.setY(GetSdrObject().GetSnapRect().getOpenHeight());
+ pVectorData->setSizeHint(aSizeHint);
+ }
+ }
+
+ SfxWhichIter aWhichIter(rSet);
+ sal_uInt16 nWhich(aWhichIter.FirstWhich());
+ std::vector< const SfxPoolItem * > aPostItemChangeList;
+ // give a hint to STL_Vector
+ aPostItemChangeList.reserve(rSet.Count());
+
+ while(nWhich)
+ {
+ const SfxPoolItem* pPoolItem;
+ if(SfxItemState::SET == aWhichIter.GetItemState(false, &pPoolItem))
+ {
+ if(AllowItemChange(nWhich, pPoolItem))
+ {
+ ItemChange(nWhich, pPoolItem);
+ aPostItemChangeList.emplace_back( pPoolItem );
+ }
+ }
+
+ nWhich = aWhichIter.NextWhich();
+ }
+
+ if(!aPostItemChangeList.empty())
+ {
+ for (const auto& rItem : aPostItemChangeList)
+ {
+ PostItemChange(rItem->Which());
+ }
+
+ ItemSetChanged(aPostItemChangeList, 0);
+ }
+ }
+
+ void DefaultProperties::ItemSetChanged(std::span< const SfxPoolItem* const > /*aChangedItems*/, sal_uInt16 /*nDeletedWhich*/)
+ {
+ }
+
+ bool DefaultProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) const
+ {
+ return true;
+ }
+
+ void DefaultProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
+ {
+ }
+
+ void DefaultProperties::PostItemChange(const sal_uInt16 nWhich )
+ {
+ if( (nWhich == XATTR_FILLSTYLE) && moItemSet )
+ CleanupFillProperties(*moItemSet);
+ }
+
+ void DefaultProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, bool /*bDontRemoveHardAttr*/,
+ bool /*bBroadcast*/)
+ {
+ // no StyleSheet in DefaultProperties
+ }
+
+ SfxStyleSheet* DefaultProperties::GetStyleSheet() const
+ {
+ // no StyleSheet in DefaultProperties
+ return nullptr;
+ }
+
+ void DefaultProperties::ForceDefaultAttributes()
+ {
+ }
+
+ void DefaultProperties::dumpAsXml(xmlTextWriterPtr pWriter) const
+ {
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("DefaultProperties"));
+ BaseProperties::dumpAsXml(pWriter);
+ if (moItemSet)
+ {
+ moItemSet->dumpAsXml(pWriter);
+ }
+ (void)xmlTextWriterEndElement(pWriter);
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/e3dcompoundproperties.cxx b/svx/source/sdr/properties/e3dcompoundproperties.cxx
new file mode 100644
index 0000000000..2d65a74983
--- /dev/null
+++ b/svx/source/sdr/properties/e3dcompoundproperties.cxx
@@ -0,0 +1,144 @@
+/* -*- 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 <sdr/properties/e3dcompoundproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/obj3d.hxx>
+#include <svx/scene3d.hxx>
+
+
+namespace sdr::properties
+{
+ E3dCompoundProperties::E3dCompoundProperties(SdrObject& rObj)
+ : E3dProperties(rObj)
+ {
+ }
+
+ E3dCompoundProperties::E3dCompoundProperties(const E3dCompoundProperties& rProps, SdrObject& rObj)
+ : E3dProperties(rProps, rObj)
+ {
+ }
+
+ E3dCompoundProperties::~E3dCompoundProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> E3dCompoundProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new E3dCompoundProperties(*this, rObj));
+ }
+
+ const SfxItemSet& E3dCompoundProperties::GetMergedItemSet() const
+ {
+ // include Items of scene this object belongs to
+ const E3dCompoundObject& rObj = static_cast<const E3dCompoundObject&>(GetSdrObject());
+ E3dScene* pScene(rObj.getRootE3dSceneFromE3dObject());
+
+ if(nullptr != pScene)
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ // add filtered scene properties (SDRATTR_3DSCENE_) to local itemset
+ SfxItemSetFixed<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST> aSet(*moItemSet->GetPool() );
+ aSet.Put(pScene->GetProperties().GetObjectItemSet());
+ moItemSet->Put(aSet);
+ }
+
+ // call parent
+ return E3dProperties::GetMergedItemSet();
+ }
+
+ void E3dCompoundProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems)
+ {
+ // Set scene specific items at scene
+ E3dCompoundObject& rObj = static_cast<E3dCompoundObject&>(GetSdrObject());
+ E3dScene* pScene(rObj.getRootE3dSceneFromE3dObject());
+
+ if(nullptr != pScene)
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ // Generate filtered scene properties (SDRATTR_3DSCENE_) itemset
+ SfxItemSetFixed<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST> aSet(*moItemSet->GetPool());
+ aSet.Put(rSet);
+
+ if(bClearAllItems)
+ {
+ pScene->GetProperties().ClearObjectItem();
+ }
+
+ if(aSet.Count())
+ {
+ pScene->GetProperties().SetObjectItemSet(aSet);
+ }
+ }
+
+ // call parent. This will set items on local object, too.
+ E3dProperties::SetMergedItemSet(rSet, bClearAllItems);
+ }
+
+ void E3dCompoundProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dProperties::PostItemChange(nWhich);
+
+ // handle value change
+ E3dCompoundObject& rObj = static_cast<E3dCompoundObject&>(GetSdrObject());
+
+ switch(nWhich)
+ {
+ // #i28528#
+ // Added extra Item (Bool) for chart2 to be able to show reduced line geometry
+ case SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_DOUBLE_SIDED:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_NORMALS_KIND:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_NORMALS_INVERT:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_TEXTURE_PROJ_X:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_TEXTURE_PROJ_Y:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ }
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/e3dextrudeproperties.cxx b/svx/source/sdr/properties/e3dextrudeproperties.cxx
new file mode 100644
index 0000000000..9b9ffd8be9
--- /dev/null
+++ b/svx/source/sdr/properties/e3dextrudeproperties.cxx
@@ -0,0 +1,74 @@
+/* -*- 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 <sdr/properties/e3dextrudeproperties.hxx>
+#include <extrud3d.hxx>
+
+
+namespace sdr::properties
+{
+ E3dExtrudeProperties::E3dExtrudeProperties(SdrObject& rObj)
+ : E3dCompoundProperties(rObj)
+ {
+ }
+
+ E3dExtrudeProperties::E3dExtrudeProperties(const E3dExtrudeProperties& rProps, SdrObject& rObj)
+ : E3dCompoundProperties(rProps, rObj)
+ {
+ }
+
+ E3dExtrudeProperties::~E3dExtrudeProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> E3dExtrudeProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new E3dExtrudeProperties(*this, rObj));
+ }
+
+ void E3dExtrudeProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dCompoundProperties::PostItemChange(nWhich);
+
+ // handle value change
+ E3dExtrudeObj& rObj = static_cast<E3dExtrudeObj&>(GetSdrObject());
+
+ switch(nWhich)
+ {
+ case SDRATTR_3DOBJ_PERCENT_DIAGONAL:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_BACKSCALE:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_DEPTH:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ }
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/e3dlatheproperties.cxx b/svx/source/sdr/properties/e3dlatheproperties.cxx
new file mode 100644
index 0000000000..feb546534d
--- /dev/null
+++ b/svx/source/sdr/properties/e3dlatheproperties.cxx
@@ -0,0 +1,84 @@
+/* -*- 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 <sdr/properties/e3dlatheproperties.hxx>
+#include <svx/lathe3d.hxx>
+
+
+namespace sdr::properties
+{
+ E3dLatheProperties::E3dLatheProperties(SdrObject& rObj)
+ : E3dCompoundProperties(rObj)
+ {
+ }
+
+ E3dLatheProperties::E3dLatheProperties(const E3dLatheProperties& rProps, SdrObject& rObj)
+ : E3dCompoundProperties(rProps, rObj)
+ {
+ }
+
+ E3dLatheProperties::~E3dLatheProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> E3dLatheProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new E3dLatheProperties(*this, rObj));
+ }
+
+ void E3dLatheProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dCompoundProperties::PostItemChange(nWhich);
+
+ // handle value change
+ E3dLatheObj& rObj = static_cast<E3dLatheObj&>(GetSdrObject());
+
+ switch(nWhich)
+ {
+ case SDRATTR_3DOBJ_HORZ_SEGS:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_VERT_SEGS:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_PERCENT_DIAGONAL:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_BACKSCALE:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_END_ANGLE:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ }
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/e3dproperties.cxx b/svx/source/sdr/properties/e3dproperties.cxx
new file mode 100644
index 0000000000..d7a106088e
--- /dev/null
+++ b/svx/source/sdr/properties/e3dproperties.cxx
@@ -0,0 +1,75 @@
+/* -*- 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/e3dproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svddef.hxx>
+#include <svx/obj3d.hxx>
+
+
+namespace sdr::properties
+{
+ // create a new itemset
+ SfxItemSet E3dProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return SfxItemSet(rPool,
+
+ // ranges from SdrAttrObj
+ svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+
+ // ranges from E3dObject, contains object and scene because of GetMergedItemSet()
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST>);
+ }
+
+ E3dProperties::E3dProperties(SdrObject& rObj)
+ : AttributeProperties(rObj)
+ {
+ }
+
+ E3dProperties::E3dProperties(const E3dProperties& rProps, SdrObject& rObj)
+ : AttributeProperties(rProps, rObj)
+ {
+ }
+
+ E3dProperties::~E3dProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> E3dProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new E3dProperties(*this, rObj));
+ }
+
+ void E3dProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich)
+ {
+ E3dObject& rObj = static_cast<E3dObject&>(GetSdrObject());
+
+ // call parent
+ AttributeProperties::ItemSetChanged(aChangedItems, nDeletedWhich);
+
+ // local changes
+ rObj.StructureChanged();
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx b/svx/source/sdr/properties/e3dsceneproperties.cxx
new file mode 100644
index 0000000000..b08d534aa6
--- /dev/null
+++ b/svx/source/sdr/properties/e3dsceneproperties.cxx
@@ -0,0 +1,286 @@
+/* -*- 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 <sdr/properties/e3dsceneproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/whiter.hxx>
+#include <svx/svddef.hxx>
+#include <svx/scene3d.hxx>
+#include <osl/diagnose.h>
+#include <memory>
+
+
+namespace sdr::properties
+{
+ E3dSceneProperties::E3dSceneProperties(SdrObject& rObj)
+ : E3dProperties(rObj)
+ {
+ }
+
+ E3dSceneProperties::E3dSceneProperties(const E3dSceneProperties& rProps, SdrObject& rObj)
+ : E3dProperties(rProps, rObj)
+ {
+ }
+
+ E3dSceneProperties::~E3dSceneProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> E3dSceneProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new E3dSceneProperties(*this, rObj));
+ }
+
+ const SfxItemSet& E3dSceneProperties::GetMergedItemSet() const
+ {
+ // prepare ItemSet
+ if(moItemSet)
+ {
+ // filter for SDRATTR_3DSCENE_ items, only keep those items
+ SfxItemSetFixed<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST> aNew(*moItemSet->GetPool());
+ aNew.Put(*moItemSet);
+ moItemSet->ClearItem();
+ moItemSet->Put(aNew);
+ }
+ else
+ {
+ // No ItemSet yet, force local ItemSet
+ GetObjectItemSet();
+ }
+
+ // collect all ItemSets of contained 3d objects
+ const SdrObjList* pSub(static_cast<const E3dScene&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+
+ if (pSub)
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ {
+ if(dynamic_cast<const E3dCompoundObject* >(pObj.get()))
+ {
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ while(nWhich)
+ {
+ // Leave out the SDRATTR_3DSCENE_ range, this would only be double
+ // and always equal.
+ if(nWhich <= SDRATTR_3DSCENE_FIRST || nWhich >= SDRATTR_3DSCENE_LAST)
+ {
+ if(SfxItemState::DONTCARE == aIter.GetItemState(false))
+ {
+ moItemSet->InvalidateItem(nWhich);
+ }
+ else
+ {
+ moItemSet->MergeValue(rSet.Get(nWhich), true);
+ }
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+ }
+
+ // call parent
+ return E3dProperties::GetMergedItemSet();
+ }
+
+ void E3dSceneProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems)
+ {
+ // Set SDRATTR_3DOBJ_ range at contained objects.
+ const SdrObjList* pSub(static_cast<const E3dScene&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+ const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount());
+
+ if(nCount)
+ {
+ // Generate filtered ItemSet which contains all but the SDRATTR_3DSCENE items.
+ // #i50808# Leak fix, Clone produces a new instance and we get ownership here
+ std::unique_ptr<SfxItemSet> xNewSet(rSet.Clone());
+
+ for(sal_uInt16 b(SDRATTR_3DSCENE_FIRST); b <= SDRATTR_3DSCENE_LAST; b++)
+ {
+ xNewSet->ClearItem(b);
+ }
+
+ if(xNewSet->Count())
+ {
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ {
+ if(dynamic_cast<const E3dCompoundObject* >(pObj.get()))
+ {
+ // set merged ItemSet at contained 3d object.
+ pObj->SetMergedItemSet(*xNewSet, bClearAllItems);
+ }
+ }
+ }
+ }
+
+ // call parent. This will set items on local object, too.
+ E3dProperties::SetMergedItemSet(rSet, bClearAllItems);
+ }
+
+ void E3dSceneProperties::SetMergedItem(const SfxPoolItem& rItem)
+ {
+ const SdrObjList* pSub(static_cast<const E3dScene&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+ if (pSub)
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ pObj->SetMergedItem(rItem);
+
+ // #i43809# call parent. This will set items on local object, too.
+ E3dProperties::SetMergedItem(rItem);
+ }
+
+ void E3dSceneProperties::ClearMergedItem(const sal_uInt16 nWhich)
+ {
+ const SdrObjList* pSub(static_cast<const E3dScene&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+ if (pSub)
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ pObj->ClearMergedItem(nWhich);
+
+ // #i43809# call parent. This will clear items on local object, too.
+ E3dProperties::ClearMergedItem(nWhich);
+ }
+
+ void E3dSceneProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dProperties::PostItemChange(nWhich);
+
+ // local changes
+ E3dScene& rObj = static_cast<E3dScene&>(GetSdrObject());
+ rObj.StructureChanged();
+
+ switch(nWhich)
+ {
+ case SDRATTR_3DSCENE_PERSPECTIVE :
+ case SDRATTR_3DSCENE_DISTANCE :
+ case SDRATTR_3DSCENE_FOCAL_LENGTH :
+ {
+ // #83387#, #83391#
+ // one common function for the camera attributes
+ // since SetCamera() sets all three back to the ItemSet
+ Camera3D aSceneCam(rObj.GetCamera());
+ bool bChange(false);
+
+ // for SDRATTR_3DSCENE_PERSPECTIVE:
+ if(aSceneCam.GetProjection() != rObj.GetPerspective())
+ {
+ aSceneCam.SetProjection(rObj.GetPerspective());
+ bChange = true;
+ }
+
+ // for SDRATTR_3DSCENE_DISTANCE:
+ basegfx::B3DPoint aActualPosition(aSceneCam.GetPosition());
+ double fNew = rObj.GetDistance();
+
+ if(fNew != aActualPosition.getZ())
+ {
+ aSceneCam.SetPosition(basegfx::B3DPoint(aActualPosition.getX(), aActualPosition.getY(), fNew));
+ bChange = true;
+ }
+
+ // for SDRATTR_3DSCENE_FOCAL_LENGTH:
+ fNew = rObj.GetFocalLength() / 100.0;
+
+ if(aSceneCam.GetFocalLength() != fNew)
+ {
+ aSceneCam.SetFocalLength(fNew);
+ bChange = true;
+ }
+
+ // for all
+ if(bChange)
+ {
+ rObj.SetCamera(aSceneCam);
+ }
+
+ break;
+ }
+ }
+ }
+
+ void E3dSceneProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
+ bool bBroadcast)
+ {
+ const SdrObjList* pSub(static_cast<const E3dScene&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+ if (!pSub)
+ return;
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ {
+ if(bBroadcast)
+ pObj->SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ else
+ pObj->NbcSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ }
+ }
+
+ SfxStyleSheet* E3dSceneProperties::GetStyleSheet() const
+ {
+ SfxStyleSheet* pRetval = nullptr;
+
+ const SdrObjList* pSub(static_cast<const E3dScene&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+ if (!pSub)
+ return pRetval;
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ {
+ SfxStyleSheet* pCandidate = pObj->GetStyleSheet();
+
+ if(pRetval)
+ {
+ if(pCandidate != pRetval)
+ {
+ // different StyleSheelts, return none
+ return nullptr;
+ }
+ }
+ else
+ {
+ pRetval = pCandidate;
+ }
+ }
+
+ return pRetval;
+ }
+
+ void E3dSceneProperties::SetSceneItemsFromCamera()
+ {
+ // force ItemSet
+ GetObjectItemSet();
+
+ E3dScene& rObj = static_cast<E3dScene&>(GetSdrObject());
+ const Camera3D& aSceneCam(rObj.GetCamera());
+
+ // ProjectionType
+ moItemSet->Put(Svx3DPerspectiveItem(aSceneCam.GetProjection()));
+
+ // CamPos
+ moItemSet->Put(makeSvx3DDistanceItem(static_cast<sal_uInt32>(aSceneCam.GetPosition().getZ() + 0.5)));
+
+ // FocalLength
+ moItemSet->Put(makeSvx3DFocalLengthItem(static_cast<sal_uInt32>((aSceneCam.GetFocalLength() * 100.0) + 0.5)));
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/e3dsphereproperties.cxx b/svx/source/sdr/properties/e3dsphereproperties.cxx
new file mode 100644
index 0000000000..66f01748f2
--- /dev/null
+++ b/svx/source/sdr/properties/e3dsphereproperties.cxx
@@ -0,0 +1,69 @@
+/* -*- 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 <sdr/properties/e3dsphereproperties.hxx>
+#include <svx/sphere3d.hxx>
+
+
+namespace sdr::properties
+{
+ E3dSphereProperties::E3dSphereProperties(SdrObject& rObj)
+ : E3dCompoundProperties(rObj)
+ {
+ }
+
+ E3dSphereProperties::E3dSphereProperties(const E3dSphereProperties& rProps, SdrObject& rObj)
+ : E3dCompoundProperties(rProps, rObj)
+ {
+ }
+
+ E3dSphereProperties::~E3dSphereProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> E3dSphereProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new E3dSphereProperties(*this, rObj));
+ }
+
+ void E3dSphereProperties::PostItemChange(const sal_uInt16 nWhich)
+ {
+ // call parent
+ E3dCompoundProperties::PostItemChange(nWhich);
+
+ // handle value change
+ E3dSphereObj& rObj = static_cast<E3dSphereObj&>(GetSdrObject());
+
+ switch(nWhich)
+ {
+ case SDRATTR_3DOBJ_HORZ_SEGS:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ case SDRATTR_3DOBJ_VERT_SEGS:
+ {
+ rObj.ActionChanged();
+ break;
+ }
+ }
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/emptyproperties.cxx b/svx/source/sdr/properties/emptyproperties.cxx
new file mode 100644
index 0000000000..1cad150b22
--- /dev/null
+++ b/svx/source/sdr/properties/emptyproperties.cxx
@@ -0,0 +1,89 @@
+/* -*- 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/emptyproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svdobj.hxx>
+
+
+namespace sdr::properties
+{
+ EmptyProperties::EmptyProperties(SdrObject& rObj)
+ : BaseProperties(rObj)
+ {
+ }
+
+ std::unique_ptr<BaseProperties> EmptyProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new EmptyProperties(rObj));
+ }
+
+ const SfxItemSet& EmptyProperties::GetObjectItemSet() const
+ {
+ assert(!"EmptyProperties::GetObjectItemSet() should never be called");
+ abort();
+ }
+
+ SfxItemSet EmptyProperties::CreateObjectSpecificItemSet(SfxItemPool&)
+ {
+ assert(!"EmptyProperties::CreateObjectSpecificItemSet() should never be called");
+ abort();
+ }
+
+ void EmptyProperties::SetObjectItem(const SfxPoolItem& /*rItem*/)
+ {
+ assert(!"EmptyProperties::SetObjectItem() should never be called");
+ }
+
+ void EmptyProperties::SetObjectItemDirect(const SfxPoolItem& /*rItem*/)
+ {
+ assert(!"EmptyProperties::SetObjectItemDirect() should never be called");
+ }
+
+ void EmptyProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
+ {
+ assert(!"EmptyProperties::ClearObjectItem() should never be called");
+ }
+
+ void EmptyProperties::ClearObjectItemDirect(const sal_uInt16 /*nWhich*/)
+ {
+ assert(!"EmptyProperties::ClearObjectItemDirect() should never be called");
+ }
+
+ void EmptyProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/)
+ {
+ assert(!"EmptyProperties::SetObjectItemSet() should never be called");
+ }
+
+ void EmptyProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, bool /*bDontRemoveHardAttr*/,
+ bool /*bBroadcast*/)
+ {
+ assert(!"EmptyProperties::SetStyleSheet() should never be called");
+ }
+
+ SfxStyleSheet* EmptyProperties::GetStyleSheet() const
+ {
+ assert(!"EmptyProperties::GetStyleSheet() should never be called");
+ return nullptr;
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx
new file mode 100644
index 0000000000..a43ee5bd9f
--- /dev/null
+++ b/svx/source/sdr/properties/graphicproperties.cxx
@@ -0,0 +1,148 @@
+/* -*- 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/graphicproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/sdgcpitm.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/sdgluitm.hxx>
+#include <sdgcoitm.hxx>
+#include <svx/sdggaitm.hxx>
+#include <sdgtritm.hxx>
+#include <sdginitm.hxx>
+#include <svx/sdgmoitm.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xlineit0.hxx>
+
+namespace sdr::properties
+{
+ void GraphicProperties::applyDefaultStyleSheetFromSdrModel()
+ {
+ SfxStyleSheet* pStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());
+
+ if(pStyleSheet)
+ {
+ // do not delete hard attributes when setting dsefault Style
+ SetStyleSheet(pStyleSheet, true, true);
+ }
+ else
+ {
+ RectangleProperties::applyDefaultStyleSheetFromSdrModel();
+ SetMergedItem(XFillStyleItem(com::sun::star::drawing::FillStyle_NONE));
+ SetMergedItem(XLineStyleItem(com::sun::star::drawing::LineStyle_NONE));
+ }
+ }
+
+ // create a new itemset
+ SfxItemSet GraphicProperties::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,
+
+ // range from SdrGrafObj
+ SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
+
+ SDRATTR_GLOW_FIRST, SDRATTR_SOFTEDGE_LAST,
+ SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST,
+
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END>);
+ }
+
+ GraphicProperties::GraphicProperties(SdrObject& rObj)
+ : RectangleProperties(rObj)
+ {
+ }
+
+ GraphicProperties::GraphicProperties(const GraphicProperties& rProps, SdrObject& rObj)
+ : RectangleProperties(rProps, rObj)
+ {
+ }
+
+ GraphicProperties::~GraphicProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> GraphicProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new GraphicProperties(*this, rObj));
+ }
+
+ void GraphicProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich)
+ {
+ SdrGrafObj& rObj = static_cast<SdrGrafObj&>(GetSdrObject());
+
+ // local changes
+ rObj.SetXPolyDirty();
+
+ // #i29367# Update GraphicAttr, too. This was formerly
+ // triggered by SdrGrafObj::Notify, which is no longer
+ // called nowadays. BTW: strictly speaking, the whole
+ // ImpSetAttrToGrafInfostuff could
+ // be dumped, when SdrGrafObj::aGrafInfo is removed and
+ // always created on the fly for repaint.
+ rObj.ImpSetAttrToGrafInfo();
+
+ // call parent
+ RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich);
+ }
+
+ void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
+ bool bBroadcast)
+ {
+ // call parent (always first thing to do, may create the SfxItemSet)
+ RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast);
+
+ // local changes
+ SdrGrafObj& rObj = static_cast<SdrGrafObj&>(GetSdrObject());
+ rObj.SetXPolyDirty();
+
+ // local changes
+ rObj.ImpSetAttrToGrafInfo();
+ }
+
+ void GraphicProperties::ForceDefaultAttributes()
+ {
+ // call parent
+ RectangleProperties::ForceDefaultAttributes();
+
+ moItemSet->Put( SdrGrafLuminanceItem( 0 ) );
+ moItemSet->Put( SdrGrafContrastItem( 0 ) );
+ moItemSet->Put( SdrGrafRedItem( 0 ) );
+ moItemSet->Put( SdrGrafGreenItem( 0 ) );
+ moItemSet->Put( SdrGrafBlueItem( 0 ) );
+ moItemSet->Put( SdrGrafGamma100Item( 100 ) );
+ moItemSet->Put( SdrGrafTransparenceItem( 0 ) );
+ moItemSet->Put( SdrGrafInvertItem( false ) );
+ moItemSet->Put( SdrGrafModeItem( GraphicDrawMode::Standard ) );
+ moItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) );
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/groupproperties.cxx b/svx/source/sdr/properties/groupproperties.cxx
new file mode 100644
index 0000000000..e6a83d329d
--- /dev/null
+++ b/svx/source/sdr/properties/groupproperties.cxx
@@ -0,0 +1,222 @@
+/* -*- 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/groupproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/whiter.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdpage.hxx>
+#include <osl/diagnose.h>
+
+
+namespace sdr::properties
+{
+ GroupProperties::GroupProperties(SdrObject& rObj)
+ : BaseProperties(rObj)
+ {
+ }
+
+ GroupProperties::~GroupProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> GroupProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new GroupProperties(rObj));
+ }
+
+ SfxItemSet GroupProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return SfxItemSet(rPool);
+ }
+
+ const SfxItemSet& GroupProperties::GetObjectItemSet() const
+ {
+ assert(!"GroupProperties::GetObjectItemSet() should never be called");
+ abort();
+ }
+
+ const SfxItemSet& GroupProperties::GetMergedItemSet() const
+ {
+ // prepare ItemSet
+ if(moMergedItemSet)
+ // clear local itemset for merge
+ moMergedItemSet->ClearItem();
+ else if(!moMergedItemSet)
+ // force local itemset
+ moMergedItemSet.emplace(GetSdrObject().GetObjectItemPool());
+
+ // collect all ItemSets in mpItemSet
+ const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+ if (!pSub)
+ return *moMergedItemSet;
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ {
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+
+ while(nWhich)
+ {
+ if(SfxItemState::DONTCARE == aIter.GetItemState(false))
+ {
+ moMergedItemSet->InvalidateItem(nWhich);
+ }
+ else
+ {
+ moMergedItemSet->MergeValue(rSet.Get(nWhich), true);
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+ }
+
+ // For group properties, do not call parent since groups do
+ // not have local ItemSets.
+ return *moMergedItemSet;
+ }
+
+ void GroupProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems)
+ {
+ // iterate over contained SdrObjects
+ const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+ if (!pSub)
+ return;
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ // Set merged ItemSet at contained object
+ pObj->SetMergedItemSet(rSet, bClearAllItems);
+
+ // Do not call parent here. Group objects do not have local ItemSets
+ // where items need to be set.
+ }
+
+ void GroupProperties::SetObjectItem(const SfxPoolItem& /*rItem*/)
+ {
+ assert(!"GroupProperties::SetObjectItem() should never be called");
+ }
+
+ void GroupProperties::SetObjectItemDirect(const SfxPoolItem& /*rItem*/)
+ {
+ assert(!"GroupProperties::SetObjectItemDirect() should never be called");
+ }
+
+ void GroupProperties::ClearObjectItem(const sal_uInt16 nWhich)
+ {
+ // iterate over contained SdrObjects
+ const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+ if (!pSub)
+ return;
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ pObj->GetProperties().ClearObjectItem(nWhich);
+ }
+
+ void GroupProperties::ClearObjectItemDirect(const sal_uInt16 /*nWhich*/)
+ {
+ assert(!"GroupProperties::ClearObjectItemDirect() should never be called");
+ }
+
+ void GroupProperties::SetMergedItem(const SfxPoolItem& rItem)
+ {
+ const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+ if (!pSub)
+ return;
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ pObj->GetProperties().SetMergedItem(rItem);
+ }
+
+ void GroupProperties::ClearMergedItem(const sal_uInt16 nWhich)
+ {
+ const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+ if (!pSub)
+ return;
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ pObj->GetProperties().ClearMergedItem(nWhich);
+ }
+
+ void GroupProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/)
+ {
+ assert(!"GroupProperties::SetObjectItemSet() should never be called");
+ }
+
+ SfxStyleSheet* GroupProperties::GetStyleSheet() const
+ {
+ SfxStyleSheet* pRetval = nullptr;
+
+ const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+ if (!pSub)
+ return pRetval;
+
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ {
+ SfxStyleSheet* pCandidate = pObj->GetStyleSheet();
+
+ if(pRetval)
+ {
+ if(pCandidate != pRetval)
+ {
+ // different StyleSheets, return none
+ return nullptr;
+ }
+ }
+ else
+ {
+ pRetval = pCandidate;
+ }
+ }
+
+ return pRetval;
+ }
+
+ void GroupProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
+ bool bBroadcast)
+ {
+ const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+ if (!pSub)
+ return;
+
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ {
+ if(bBroadcast)
+ pObj->SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ else
+ pObj->NbcSetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
+ }
+ }
+
+ void GroupProperties::ForceStyleToHardAttributes()
+ {
+ const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList());
+ OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)");
+ if (!pSub)
+ return;
+ for (const rtl::Reference<SdrObject>& pObj : *pSub)
+ pObj->GetProperties().ForceStyleToHardAttributes();
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/itemsettools.cxx b/svx/source/sdr/properties/itemsettools.cxx
new file mode 100644
index 0000000000..11431d367d
--- /dev/null
+++ b/svx/source/sdr/properties/itemsettools.cxx
@@ -0,0 +1,87 @@
+/* -*- 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 <sdr/properties/itemsettools.hxx>
+#include <tools/fract.hxx>
+#include <svl/itemset.hxx>
+#include <svl/whiter.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svditer.hxx>
+#include <memory>
+
+// class to remember broadcast start positions
+
+namespace sdr::properties
+{
+ ItemChangeBroadcaster::ItemChangeBroadcaster(const SdrObject& rObj)
+ {
+ if (rObj.GetObjIdentifier() == SdrObjKind::Group)
+ {
+ const SdrObjGroup* pGroupObj = static_cast<const SdrObjGroup*>(&rObj);
+ SdrObjListIter aIter(pGroupObj->GetSubList(), SdrIterMode::DeepNoGroups);
+ maRectangles.reserve(aIter.Count());
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pObj = aIter.Next();
+
+ if(pObj)
+ {
+ maRectangles.push_back(pObj->GetLastBoundRect());
+ }
+ }
+ }
+ else
+ {
+ maRectangles.push_back(rObj.GetLastBoundRect());
+ }
+ }
+
+
+ void ScaleItemSet(SfxItemSet& rSet, const Fraction& rScale)
+ {
+ sal_Int32 nMul(rScale.GetNumerator());
+ sal_Int32 nDiv(rScale.GetDenominator());
+
+ if(!rScale.IsValid() || !nDiv)
+ {
+ return;
+ }
+
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+ const SfxPoolItem *pItem = nullptr;
+
+ while(nWhich)
+ {
+ if(SfxItemState::SET == aIter.GetItemState(false, &pItem))
+ {
+ if(pItem->HasMetrics())
+ {
+ std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone());
+ pNewItem->ScaleMetrics(nMul, nDiv);
+ rSet.Put(std::move(pNewItem));
+ }
+ }
+ nWhich = aIter.NextWhich();
+ }
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/measureproperties.cxx b/svx/source/sdr/properties/measureproperties.cxx
new file mode 100644
index 0000000000..a6f4b7fd7c
--- /dev/null
+++ b/svx/source/sdr/properties/measureproperties.cxx
@@ -0,0 +1,127 @@
+/* -*- 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/measureproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svl/style.hxx>
+#include <svx/svddef.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdomeas.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/sdynitm.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+
+namespace sdr::properties
+{
+ // create a new itemset
+ SfxItemSet MeasureProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return SfxItemSet(
+ rPool,
+ svl::Items<
+ // Ranges from SdrAttrObj, SdrMeasureObj:
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+ SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST,
+ // Range from SdrTextObj:
+ EE_ITEMS_START, EE_ITEMS_END>);
+ }
+
+ MeasureProperties::MeasureProperties(SdrObject& rObj)
+ : TextProperties(rObj)
+ {
+ }
+
+ MeasureProperties::MeasureProperties(const MeasureProperties& rProps, SdrObject& rObj)
+ : TextProperties(rProps, rObj)
+ {
+ }
+
+ MeasureProperties::~MeasureProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> MeasureProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new MeasureProperties(*this, rObj));
+ }
+
+ void MeasureProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich)
+ {
+ SdrMeasureObj& rObj = static_cast<SdrMeasureObj&>(GetSdrObject());
+
+ // call parent
+ TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich);
+
+ // local changes
+ rObj.SetTextDirty();
+ }
+
+ void MeasureProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
+ bool bBroadcast)
+ {
+ // call parent (always first thing to do, may create the SfxItemSet)
+ TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast);
+
+ // local changes
+ // get access to dimension line object
+ SdrMeasureObj& rObj = static_cast<SdrMeasureObj&>(GetSdrObject());
+
+ // mark dimension line text as changed (dirty) in the dimension line object
+ rObj.SetTextDirty();
+
+ // tdf#98525 ask the dimension line object to redraw the changed text
+ rObj.UndirtyText();
+ }
+
+ void MeasureProperties::ForceDefaultAttributes()
+ {
+ // call parent
+ TextProperties::ForceDefaultAttributes();
+
+ //#71958# by default, the show units Bool-Item is set as hard
+ // attribute to sal_True to avoid confusion when copying SdrMeasureObj's
+ // from one application to another
+ moItemSet->Put(SdrYesNoItem(SDRATTR_MEASURESHOWUNIT, true));
+
+ basegfx::B2DPolygon aNewPolygon;
+ aNewPolygon.append(basegfx::B2DPoint(100.0, 0.0));
+ aNewPolygon.append(basegfx::B2DPoint(200.0, 400.0));
+ aNewPolygon.append(basegfx::B2DPoint(0.0, 400.0));
+ aNewPolygon.setClosed(true);
+
+ moItemSet->Put(XLineStartItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon)));
+ moItemSet->Put(XLineStartWidthItem(200));
+ moItemSet->Put(XLineEndItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon)));
+ moItemSet->Put(XLineEndWidthItem(200));
+ moItemSet->Put(XLineStyleItem(css::drawing::LineStyle_SOLID));
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/oleproperties.cxx b/svx/source/sdr/properties/oleproperties.cxx
new file mode 100644
index 0000000000..a0e0e82d37
--- /dev/null
+++ b/svx/source/sdr/properties/oleproperties.cxx
@@ -0,0 +1,65 @@
+/* -*- 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 <sdr/properties/oleproperties.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdmodel.hxx>
+
+namespace sdr::properties
+{
+ void OleProperties::applyDefaultStyleSheetFromSdrModel()
+ {
+ SfxStyleSheet* pStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());
+
+ if(pStyleSheet)
+ {
+ // do not delete hard attributes when setting dsefault Style
+ SetStyleSheet(pStyleSheet, true, true);
+ }
+ else
+ {
+ RectangleProperties::applyDefaultStyleSheetFromSdrModel();
+ SetMergedItem(XFillStyleItem(com::sun::star::drawing::FillStyle_NONE));
+ SetMergedItem(XLineStyleItem(com::sun::star::drawing::LineStyle_NONE));
+ }
+ }
+
+ OleProperties::OleProperties(SdrObject& rObj)
+ : RectangleProperties(rObj)
+ {
+ }
+
+ OleProperties::OleProperties(const OleProperties& rProps, SdrObject& rObj)
+ : RectangleProperties(rProps, rObj)
+ {
+ }
+
+ OleProperties::~OleProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> OleProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new OleProperties(*this, rObj));
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/pageproperties.cxx b/svx/source/sdr/properties/pageproperties.cxx
new file mode 100644
index 0000000000..011ab2192d
--- /dev/null
+++ b/svx/source/sdr/properties/pageproperties.cxx
@@ -0,0 +1,106 @@
+/* -*- 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/pageproperties.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svdobj.hxx>
+#include <tools/debug.hxx>
+
+
+namespace sdr::properties
+{
+ PageProperties::PageProperties(SdrObject& rObj)
+ : BaseProperties(rObj)
+ {
+ }
+
+ PageProperties::PageProperties(const PageProperties& /*rProps*/, SdrObject& rObj)
+ : BaseProperties(rObj)
+ {
+ }
+
+ PageProperties::~PageProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> PageProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new PageProperties(*this, rObj));
+ }
+
+ SfxItemSet PageProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ {
+ return SfxItemSet(rPool);
+ }
+
+ // get itemset. Override here to allow creating the empty itemset
+ // without asserting
+ const SfxItemSet& PageProperties::GetObjectItemSet() const
+ {
+ if(!mxEmptyItemSet)
+ {
+ mxEmptyItemSet.emplace(GetSdrObject().GetObjectItemPool());
+ }
+
+ DBG_ASSERT(mxEmptyItemSet, "Could not create an SfxItemSet(!)");
+
+ return *mxEmptyItemSet;
+ }
+
+ SfxStyleSheet* PageProperties::GetStyleSheet() const
+ {
+ // override to legally return a 0L pointer here
+ return nullptr;
+ }
+
+ void PageProperties::SetStyleSheet(SfxStyleSheet* /*pStyleSheet*/, bool /*bDontRemoveHardAttr*/,
+ bool /*bBroadcast*/)
+ {
+ // override to legally ignore the StyleSheet here
+ }
+
+ void PageProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
+ {
+ // simply ignore item clearing on page objects
+ }
+
+ void PageProperties::SetObjectItem(const SfxPoolItem& /*rItem*/)
+ {
+ assert(!"PageProperties::SetObjectItem() should never be called");
+ }
+
+ void PageProperties::SetObjectItemDirect(const SfxPoolItem& /*rItem*/)
+ {
+ assert(!"PageProperties::SetObjectItemDirect() should never be called");
+ }
+
+ void PageProperties::ClearObjectItemDirect(const sal_uInt16 /*nWhich*/)
+ {
+ assert(!"PageProperties::ClearObjectItemDirect() should never be called");
+ }
+
+ void PageProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/)
+ {
+ assert(!"PageProperties::SetObjectItemSet() should never be called");
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx
new file mode 100644
index 0000000000..97a264712b
--- /dev/null
+++ b/svx/source/sdr/properties/properties.cxx
@@ -0,0 +1,178 @@
+/* -*- 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 <libxml/xmlwriter.h>
+
+#include <svx/sdr/properties/properties.hxx>
+#include <sdr/properties/itemsettools.hxx>
+#include <svl/itemset.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svditer.hxx>
+#include <svx/xdef.hxx>
+#include <svx/xfillit0.hxx>
+
+using namespace com::sun::star;
+
+namespace sdr::properties
+{
+ BaseProperties::BaseProperties(SdrObject& rObj)
+ : mrObject(rObj)
+ {
+ }
+
+ BaseProperties::~BaseProperties()
+ {
+ }
+
+ const SdrObject& BaseProperties::GetSdrObject() const
+ {
+ return mrObject;
+ }
+
+ SdrObject& BaseProperties::GetSdrObject()
+ {
+ return mrObject;
+ }
+
+ const SfxItemSet& BaseProperties::GetMergedItemSet() const
+ {
+ // default implementation falls back to GetObjectItemSet()
+ return GetObjectItemSet();
+ }
+
+ void BaseProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems)
+ {
+ // clear items if requested
+ if(bClearAllItems)
+ {
+ ClearObjectItem();
+ }
+
+ // default implementation falls back to SetObjectItemSet()
+ SetObjectItemSet(rSet);
+ }
+
+ void BaseProperties::SetMergedItem(const SfxPoolItem& rItem)
+ {
+ // default implementation falls back to SetObjectItem()
+ SetObjectItem(rItem);
+ }
+
+ void BaseProperties::ClearMergedItem(const sal_uInt16 nWhich)
+ {
+ // default implementation falls back to ClearObjectItem()
+ ClearObjectItem(nWhich);
+ }
+
+ void BaseProperties::ForceStyleToHardAttributes()
+ {
+ // force all attributes which come from styles to hard attributes
+ // to be able to live without the style. Default implementation does nothing.
+ // Override where an ItemSet is implemented.
+ }
+
+ void BaseProperties::SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems)
+ {
+ ItemChangeBroadcaster aC(GetSdrObject());
+
+ if(bClearAllItems)
+ {
+ ClearObjectItem();
+ }
+
+ SetMergedItemSet(rSet);
+ BroadcastItemChange(aC);
+ }
+
+ const SfxPoolItem& BaseProperties::GetItem(const sal_uInt16 nWhich) const
+ {
+ return GetObjectItemSet().Get(nWhich);
+ }
+
+ void BaseProperties::BroadcastItemChange(const ItemChangeBroadcaster& rChange)
+ {
+ const sal_uInt32 nCount(rChange.GetRectangleCount());
+
+ // invalidate all new rectangles
+ SdrObject* pObj = &GetSdrObject();
+ if (pObj->GetObjIdentifier() == SdrObjKind::Group)
+ {
+ SdrObjGroup* pObjGroup = static_cast<SdrObjGroup*>(pObj);
+ SdrObjListIter aIter(pObjGroup, SdrIterMode::DeepNoGroups);
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pChildObj = aIter.Next();
+ pChildObj->BroadcastObjectChange();
+ }
+ }
+ else
+ {
+ pObj->BroadcastObjectChange();
+ }
+
+ // also send the user calls
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ pObj->SendUserCall(SdrUserCallType::ChangeAttr, rChange.GetRectangle(a));
+ }
+ }
+
+ sal_uInt32 BaseProperties::getVersion() const
+ {
+ return 0;
+ }
+
+ void BaseProperties::dumpAsXml(xmlTextWriterPtr pWriter) const
+ {
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("BaseProperties"));
+ (void)xmlTextWriterEndElement(pWriter);
+ }
+
+ void CleanupFillProperties( SfxItemSet& rItemSet )
+ {
+ const bool bFillBitmap = rItemSet.GetItemState(XATTR_FILLBITMAP, false) == SfxItemState::SET;
+ const bool bFillGradient = rItemSet.GetItemState(XATTR_FILLGRADIENT, false) == SfxItemState::SET;
+ const bool bFillHatch = rItemSet.GetItemState(XATTR_FILLHATCH, false) == SfxItemState::SET;
+ if( !(bFillBitmap || bFillGradient || bFillHatch) )
+ return;
+
+ const XFillStyleItem* pFillStyleItem = rItemSet.GetItem(XATTR_FILLSTYLE);
+ if( !pFillStyleItem )
+ return;
+
+ if( bFillBitmap && (pFillStyleItem->GetValue() != drawing::FillStyle_BITMAP) )
+ {
+ rItemSet.ClearItem( XATTR_FILLBITMAP );
+ }
+
+ if( bFillGradient && (pFillStyleItem->GetValue() != drawing::FillStyle_GRADIENT) )
+ {
+ rItemSet.ClearItem( XATTR_FILLGRADIENT );
+ }
+
+ if( bFillHatch && (pFillStyleItem->GetValue() != drawing::FillStyle_HATCH) )
+ {
+ rItemSet.ClearItem( XATTR_FILLHATCH );
+ }
+ }
+
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/rectangleproperties.cxx b/svx/source/sdr/properties/rectangleproperties.cxx
new file mode 100644
index 0000000000..71680e012b
--- /dev/null
+++ b/svx/source/sdr/properties/rectangleproperties.cxx
@@ -0,0 +1,69 @@
+/* -*- 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 <sdr/properties/rectangleproperties.hxx>
+#include <svx/svdorect.hxx>
+
+
+namespace sdr::properties
+{
+ RectangleProperties::RectangleProperties(SdrObject& rObj)
+ : TextProperties(rObj)
+ {
+ }
+
+ RectangleProperties::RectangleProperties(const RectangleProperties& rProps, SdrObject& rObj)
+ : TextProperties(rProps, rObj)
+ {
+ }
+
+ RectangleProperties::~RectangleProperties()
+ {
+ }
+
+ std::unique_ptr<BaseProperties> RectangleProperties::Clone(SdrObject& rObj) const
+ {
+ return std::unique_ptr<BaseProperties>(new RectangleProperties(*this, rObj));
+ }
+
+ void RectangleProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich)
+ {
+ SdrRectObj& rObj = static_cast<SdrRectObj&>(GetSdrObject());
+
+ // call parent
+ TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich);
+
+ // local changes
+ rObj.SetXPolyDirty();
+ }
+
+ // set a new StyleSheet and broadcast
+ void RectangleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
+ bool bBroadcast)
+ {
+ // call parent (always first thing to do, may create the SfxItemSet)
+ TextProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast);
+
+ // local changes
+ SdrRectObj& rObj = static_cast<SdrRectObj&>(GetSdrObject());
+ rObj.SetXPolyDirty();
+ }
+} // end of namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
new file mode 100644
index 0000000000..55b366bdc0
--- /dev/null
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -0,0 +1,627 @@
+/* -*- 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)
+ {
+ ESelection aSelection( 0, 0, EE_PARA_ALL, EE_TEXTPOS_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)
+ {
+ // call parent (always first thing to do, may create the SfxItemSet)
+ AttributeProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast);
+
+ // #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);
+ }
+ }
+ }
+
+ if(rObj.IsTextFrame())
+ {
+ 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);
+
+ SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject());
+ if(!rObj.HasText())
+ return;
+
+ const svx::ITextProvider& rTextProvider(getTextProvider());
+ if(dynamic_cast<const SfxStyleSheet *>(&rBC) != nullptr)
+ {
+ SfxHintId nId(rHint.GetId());
+
+ if(SfxHintId::DataChanged == nId)
+ {
+ 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++;
+ }
+
+ if(SfxHintId::Dying == nId)
+ {
+ sal_Int32 nText = rTextProvider.getTextCount();
+ while (nText--)
+ {
+ OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject();
+ if( pParaObj )
+ pParaObj->ClearPortionInfo();
+ }
+ }
+ }
+ else if(dynamic_cast<const SfxStyleSheetBasePool *>(&rBC) != nullptr)
+ {
+ const SfxStyleSheetModifiedHint* pExtendedHint = dynamic_cast<const SfxStyleSheetModifiedHint*>(&rHint);
+
+ if(pExtendedHint
+ && SfxHintId::StyleSheetModified == pExtendedHint->GetId())
+ {
+ const OUString& aOldName(pExtendedHint->GetOldName());
+ OUString aNewName(pExtendedHint->GetStyleSheet()->GetName());
+ SfxStyleFamily eFamily = pExtendedHint->GetStyleSheet()->GetFamily();
+
+ if(aOldName != aNewName)
+ {
+ 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: */