diff options
25 files changed, 88 insertions, 95 deletions
diff --git a/include/svx/sdr/properties/defaultproperties.hxx b/include/svx/sdr/properties/defaultproperties.hxx index ef490ff8f84a..09999c0ad66b 100644 --- a/include/svx/sdr/properties/defaultproperties.hxx +++ b/include/svx/sdr/properties/defaultproperties.hxx @@ -27,6 +27,7 @@ #include <svx/sdr/properties/properties.hxx> #include <svx/svxdllapi.h> #include <svl/itemset.hxx> +#include <o3tl/span.hxx> struct _xmlTextWriter; typedef struct _xmlTextWriter* xmlTextWriterPtr; @@ -54,12 +55,9 @@ namespace sdr::properties // specific item changes virtual void PostItemChange(const sal_uInt16 nWhich); - // Internally react on ItemSet changes. The given ItemSet contains all changed items, the new ones. - virtual void ItemSetChanged(const SfxItemSet*); - - // Subclasses need to return true if they want the ItemSetChanged() callback to actually have a non-zero pointer. - // We do this because creating the temporary item set is expensive and seldom used. - virtual bool WantItemSetInItemSetChanged() const { return false; } + // Internally react on ItemSet changes. The given span contains changed items. + // If nDeletedWhich is not 0, it indicates a deleted item. + virtual void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich); // check if SfxItemSet exists bool HasSfxItemSet() const { return bool(mxItemSet); } diff --git a/svx/inc/getallcharpropids.hxx b/svx/inc/getallcharpropids.hxx index c52d41b689a7..e5c8d98f34d1 100644 --- a/svx/inc/getallcharpropids.hxx +++ b/svx/inc/getallcharpropids.hxx @@ -21,14 +21,15 @@ #define INCLUDED_SVX_INC_GETALLCHARPROPIDS_HXX #include <sal/config.h> - -#include <vector> - #include <sal/types.h> +#include <o3tl/span.hxx> +#include <vector> class SfxItemSet; +class SfxPoolItem; std::vector<sal_uInt16> GetAllCharPropIds(const SfxItemSet& rSet); +std::vector<sal_uInt16> GetAllCharPropIds(o3tl::span<const SfxPoolItem* const> aChangedItems); #endif diff --git a/svx/inc/sdr/properties/attributeproperties.hxx b/svx/inc/sdr/properties/attributeproperties.hxx index 72b864bb749a..d2f1aa15a70c 100644 --- a/svx/inc/sdr/properties/attributeproperties.hxx +++ b/svx/inc/sdr/properties/attributeproperties.hxx @@ -49,7 +49,7 @@ namespace sdr::properties virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override; // react on ItemSet changes - virtual void ItemSetChanged(const SfxItemSet*) override; + virtual void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; // apply the correct SfyStyleSheet from SdrObject's SdrModel virtual void applyDefaultStyleSheetFromSdrModel(); diff --git a/svx/inc/sdr/properties/captionproperties.hxx b/svx/inc/sdr/properties/captionproperties.hxx index b9c21bf42aa3..238ec4682612 100644 --- a/svx/inc/sdr/properties/captionproperties.hxx +++ b/svx/inc/sdr/properties/captionproperties.hxx @@ -31,7 +31,7 @@ namespace sdr::properties virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; // react on ItemSet changes - virtual void ItemSetChanged(const SfxItemSet*) override; + virtual void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/circleproperties.hxx b/svx/inc/sdr/properties/circleproperties.hxx index c21269c50aa5..9eaa09dbc14d 100644 --- a/svx/inc/sdr/properties/circleproperties.hxx +++ b/svx/inc/sdr/properties/circleproperties.hxx @@ -31,7 +31,7 @@ namespace sdr::properties virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; // react on ItemSet changes - virtual void ItemSetChanged(const SfxItemSet*) override; + virtual void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/connectorproperties.hxx b/svx/inc/sdr/properties/connectorproperties.hxx index ba5379854594..b3f116289094 100644 --- a/svx/inc/sdr/properties/connectorproperties.hxx +++ b/svx/inc/sdr/properties/connectorproperties.hxx @@ -31,7 +31,7 @@ namespace sdr::properties virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; // react on ItemSet changes - virtual void ItemSetChanged(const SfxItemSet*) override; + virtual void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/customshapeproperties.hxx b/svx/inc/sdr/properties/customshapeproperties.hxx index 9bfdb47ebdb7..1cc83a2cf29f 100644 --- a/svx/inc/sdr/properties/customshapeproperties.hxx +++ b/svx/inc/sdr/properties/customshapeproperties.hxx @@ -37,7 +37,7 @@ namespace sdr::properties virtual bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) const override; // react on ItemSet changes - virtual void ItemSetChanged(const SfxItemSet*) override; + virtual void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; // react on Item change virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override; diff --git a/svx/inc/sdr/properties/e3dproperties.hxx b/svx/inc/sdr/properties/e3dproperties.hxx index 533751660fb7..caef0ff57ba7 100644 --- a/svx/inc/sdr/properties/e3dproperties.hxx +++ b/svx/inc/sdr/properties/e3dproperties.hxx @@ -32,7 +32,7 @@ namespace sdr::properties virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; // react on ItemSet changes - virtual void ItemSetChanged(const SfxItemSet*) override; + virtual void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/graphicproperties.hxx b/svx/inc/sdr/properties/graphicproperties.hxx index 19f76e438ad7..7f842a9dcfd6 100644 --- a/svx/inc/sdr/properties/graphicproperties.hxx +++ b/svx/inc/sdr/properties/graphicproperties.hxx @@ -34,7 +34,7 @@ namespace sdr::properties virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; // react on ItemSet changes - virtual void ItemSetChanged(const SfxItemSet*) override; + virtual void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/measureproperties.hxx b/svx/inc/sdr/properties/measureproperties.hxx index 7e861c6f45cf..001f9778c98d 100644 --- a/svx/inc/sdr/properties/measureproperties.hxx +++ b/svx/inc/sdr/properties/measureproperties.hxx @@ -31,7 +31,7 @@ namespace sdr::properties virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; // react on ItemSet changes - virtual void ItemSetChanged(const SfxItemSet*) override; + virtual void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/rectangleproperties.hxx b/svx/inc/sdr/properties/rectangleproperties.hxx index 887550397b83..7694e9d3c44f 100644 --- a/svx/inc/sdr/properties/rectangleproperties.hxx +++ b/svx/inc/sdr/properties/rectangleproperties.hxx @@ -29,7 +29,7 @@ namespace sdr::properties { protected: // react on ItemSet changes - virtual void ItemSetChanged(const SfxItemSet*) override; + virtual void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; public: // basic constructor diff --git a/svx/inc/sdr/properties/textproperties.hxx b/svx/inc/sdr/properties/textproperties.hxx index c5edb206a532..916e5a7f6b5b 100644 --- a/svx/inc/sdr/properties/textproperties.hxx +++ b/svx/inc/sdr/properties/textproperties.hxx @@ -40,8 +40,7 @@ namespace sdr::properties virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override; // react on ItemSet changes - virtual void ItemSetChanged(const SfxItemSet*) override; - virtual bool WantItemSetInItemSetChanged() const override final; + virtual void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; /// Get the TextProvider related to our SdrObject virtual const svx::ITextProvider& getTextProvider() const; diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index de4a22f4f533..b7407d641d44 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -275,7 +275,7 @@ namespace sdr::properties return *mxItemSet; } - void AttributeProperties::ItemSetChanged(const SfxItemSet* /*pSet*/) + void AttributeProperties::ItemSetChanged(o3tl::span< const SfxPoolItem* const > /*aChangedItems*/, sal_uInt16 /*nDeletedWhich*/) { // own modifications SdrObject& rObj = GetSdrObject(); diff --git a/svx/source/sdr/properties/captionproperties.cxx b/svx/source/sdr/properties/captionproperties.cxx index 0e6d8ec4af8a..2f7a2c8a7f89 100644 --- a/svx/source/sdr/properties/captionproperties.cxx +++ b/svx/source/sdr/properties/captionproperties.cxx @@ -62,7 +62,7 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new CaptionProperties(*this, rObj)); } - void CaptionProperties::ItemSetChanged(const SfxItemSet* pSet) + void CaptionProperties::ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) { SdrCaptionObj& rObj = static_cast<SdrCaptionObj&>(GetSdrObject()); @@ -70,7 +70,7 @@ namespace sdr::properties rObj.ImpRecalcTail(); // call parent - RectangleProperties::ItemSetChanged(pSet); + RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich); } void CaptionProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, diff --git a/svx/source/sdr/properties/circleproperties.cxx b/svx/source/sdr/properties/circleproperties.cxx index 3b40abb7cc15..0c2a5bdc173a 100644 --- a/svx/source/sdr/properties/circleproperties.cxx +++ b/svx/source/sdr/properties/circleproperties.cxx @@ -66,12 +66,12 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new CircleProperties(*this, rObj)); } - void CircleProperties::ItemSetChanged(const SfxItemSet* pSet) + void CircleProperties::ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) { SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject()); // call parent - RectangleProperties::ItemSetChanged(pSet); + RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich); // local changes rObj.ImpSetAttrToCircInfo(); diff --git a/svx/source/sdr/properties/connectorproperties.cxx b/svx/source/sdr/properties/connectorproperties.cxx index 9321226bfc43..375a98190d1e 100644 --- a/svx/source/sdr/properties/connectorproperties.cxx +++ b/svx/source/sdr/properties/connectorproperties.cxx @@ -63,12 +63,12 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new ConnectorProperties(*this, rObj)); } - void ConnectorProperties::ItemSetChanged(const SfxItemSet* pSet) + void ConnectorProperties::ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) { SdrEdgeObj& rObj = static_cast<SdrEdgeObj&>(GetSdrObject()); // call parent - TextProperties::ItemSetChanged(pSet); + TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich); // local changes rObj.ImpSetAttrToEdgeInfo(); diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx index a18b9a494a1c..59135cde1d55 100644 --- a/svx/source/sdr/properties/customshapeproperties.cxx +++ b/svx/source/sdr/properties/customshapeproperties.cxx @@ -101,8 +101,7 @@ namespace sdr::properties TextProperties::ClearObjectItemDirect( nWhich2 ); nWhich2 = aIter.NextWhich(); } - SfxItemSet aSet(GetSdrObject().GetObjectItemPool()); - ItemSetChanged(&aSet); + ItemSetChanged({}, 0); } else TextProperties::ClearObjectItem( nWhich ); @@ -124,10 +123,10 @@ namespace sdr::properties TextProperties::ClearObjectItemDirect( nWhich ); } - void CustomShapeProperties::ItemSetChanged(const SfxItemSet* pSet) + void CustomShapeProperties::ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) { // call parent - TextProperties::ItemSetChanged(pSet); + TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich); // update bTextFrame and RenderGeometry UpdateTextFrameStatus(true); diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index 08d79fd6e4ac..91a2edbfebc0 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -116,14 +116,8 @@ namespace sdr::properties ItemChange(nWhichID, &rItem); PostItemChange(nWhichID); - if (WantItemSetInItemSetChanged()) - { - SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), nWhichID, nWhichID); - aSet.Put(rItem); - ItemSetChanged(&aSet); - } - else - ItemSetChanged(nullptr); + const SfxPoolItem* pItem = &rItem; + ItemSetChanged( {&pItem, 1}, 0); } void DefaultProperties::SetObjectItemDirect(const SfxPoolItem& rItem) @@ -146,13 +140,7 @@ namespace sdr::properties if(nWhich) { - if (WantItemSetInItemSetChanged()) - { - SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), nWhich, nWhich); - ItemSetChanged(&aSet); - } - else - ItemSetChanged(nullptr); + ItemSetChanged({}, nWhich); } } @@ -183,48 +171,37 @@ namespace sdr::properties SfxWhichIter aWhichIter(rSet); sal_uInt16 nWhich(aWhichIter.FirstWhich()); - const SfxPoolItem *pPoolItem; - std::vector< sal_uInt16 > aPostItemChangeList; - bool bDidChange(false); - std::optional<SfxItemSetFixed<SDRATTR_START, EE_ITEMS_END>> aSet; - if (WantItemSetInItemSetChanged()) - aSet.emplace(GetSdrObject().GetObjectItemPool()); - + std::vector< const SfxPoolItem * > aPostItemChangeList; // give a hint to STL_Vector aPostItemChangeList.reserve(rSet.Count()); while(nWhich) { + const SfxPoolItem* pPoolItem; if(SfxItemState::SET == rSet.GetItemState(nWhich, false, &pPoolItem)) { if(AllowItemChange(nWhich, pPoolItem)) { - bDidChange = true; ItemChange(nWhich, pPoolItem); - aPostItemChangeList.push_back( nWhich ); - if (aSet) - aSet->Put(*pPoolItem); + aPostItemChangeList.emplace_back( pPoolItem ); } } nWhich = aWhichIter.NextWhich(); } - if(bDidChange) + if(!aPostItemChangeList.empty()) { for (const auto& rItem : aPostItemChangeList) { - PostItemChange(rItem); + PostItemChange(rItem->Which()); } - if (aSet) - ItemSetChanged(&*aSet); - else - ItemSetChanged(nullptr); + ItemSetChanged(aPostItemChangeList, 0); } } - void DefaultProperties::ItemSetChanged(const SfxItemSet* /*pSet*/) + void DefaultProperties::ItemSetChanged(o3tl::span< const SfxPoolItem* const > /*aChangedItems*/, sal_uInt16 /*nDeletedWhich*/) { } diff --git a/svx/source/sdr/properties/e3dproperties.cxx b/svx/source/sdr/properties/e3dproperties.cxx index bb99c2dccc05..946f879de022 100644 --- a/svx/source/sdr/properties/e3dproperties.cxx +++ b/svx/source/sdr/properties/e3dproperties.cxx @@ -60,12 +60,12 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new E3dProperties(*this, rObj)); } - void E3dProperties::ItemSetChanged(const SfxItemSet* pSet) + void E3dProperties::ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) { E3dObject& rObj = static_cast<E3dObject&>(GetSdrObject()); // call parent - AttributeProperties::ItemSetChanged(pSet); + AttributeProperties::ItemSetChanged(aChangedItems, nDeletedWhich); // local changes rObj.StructureChanged(); diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx index 117318180ab5..be9b87800a0e 100644 --- a/svx/source/sdr/properties/graphicproperties.cxx +++ b/svx/source/sdr/properties/graphicproperties.cxx @@ -93,7 +93,7 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new GraphicProperties(*this, rObj)); } - void GraphicProperties::ItemSetChanged(const SfxItemSet* pSet) + void GraphicProperties::ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) { SdrGrafObj& rObj = static_cast<SdrGrafObj&>(GetSdrObject()); @@ -109,7 +109,7 @@ namespace sdr::properties rObj.ImpSetAttrToGrafInfo(); // call parent - RectangleProperties::ItemSetChanged(pSet); + RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich); } void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, diff --git a/svx/source/sdr/properties/measureproperties.cxx b/svx/source/sdr/properties/measureproperties.cxx index c981f8e11847..07441c385184 100644 --- a/svx/source/sdr/properties/measureproperties.cxx +++ b/svx/source/sdr/properties/measureproperties.cxx @@ -72,12 +72,12 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new MeasureProperties(*this, rObj)); } - void MeasureProperties::ItemSetChanged(const SfxItemSet* pSet) + void MeasureProperties::ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) { SdrMeasureObj& rObj = static_cast<SdrMeasureObj&>(GetSdrObject()); // call parent - TextProperties::ItemSetChanged(pSet); + TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich); // local changes rObj.SetTextDirty(); diff --git a/svx/source/sdr/properties/rectangleproperties.cxx b/svx/source/sdr/properties/rectangleproperties.cxx index 0ff4286b93e0..4c3a72a2f496 100644 --- a/svx/source/sdr/properties/rectangleproperties.cxx +++ b/svx/source/sdr/properties/rectangleproperties.cxx @@ -42,12 +42,12 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new RectangleProperties(*this, rObj)); } - void RectangleProperties::ItemSetChanged(const SfxItemSet* pSet) + void RectangleProperties::ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) { SdrRectObj& rObj = static_cast<SdrRectObj&>(GetSdrObject()); // call parent - TextProperties::ItemSetChanged(pSet); + TextProperties::ItemSetChanged(aChangedItems, nDeletedWhich); // local changes rObj.SetXPolyDirty(); diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index f50ef7c1cecf..d8cdf80dfc29 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -81,15 +81,7 @@ namespace sdr::properties return std::unique_ptr<BaseProperties>(new TextProperties(*this, rObj)); } - bool TextProperties::WantItemSetInItemSetChanged() const - { - // The itemset construction is fairly expensive, and we only need it - // if this text (or sub-type of text, eg. rectangle) actually has text. - const svx::ITextProvider& rTextProvider(getTextProvider()); - return rTextProvider.getTextCount() != 0; - } - - void TextProperties::ItemSetChanged(const SfxItemSet* pSet) + void TextProperties::ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) { SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject()); @@ -129,7 +121,10 @@ namespace sdr::properties for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++) { SfxItemSet aSet(pOutliner->GetParaAttribs(nPara)); - aSet.Put(*pSet); + for (const SfxPoolItem* pItem : aChangedItems) + aSet.Put(*pItem); + if (nDeletedWhich) + aSet.ClearItem(nDeletedWhich); pOutliner->SetParaAttribs(nPara, aSet); } @@ -153,15 +148,17 @@ namespace sdr::properties } // Extra-Repaint for radical layout changes (#43139#) - if(pSet && SfxItemState::SET == pSet->GetItemState(SDRATTR_TEXT_CONTOURFRAME)) - { - // Here only repaint wanted - rObj.ActionChanged(); - //rObj.BroadcastObjectChange(); - } + for (const SfxPoolItem* pItem : aChangedItems) + if (pItem->Which() == SDRATTR_TEXT_CONTOURFRAME) + { + // Here only repaint wanted + rObj.ActionChanged(); + //rObj.BroadcastObjectChange(); + break; + } // call parent - AttributeProperties::ItemSetChanged(pSet); + AttributeProperties::ItemSetChanged(aChangedItems, nDeletedWhich); } void TextProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem) @@ -403,7 +400,14 @@ namespace sdr::properties // #i61284# push hard ObjectItemSet to OutlinerParaObject attributes // using existing functionality GetObjectItemSet(); // force ItemSet - ItemSetChanged(&*mxItemSet); + std::vector<const SfxPoolItem*> aChangedItems; + SfxItemIter aIter(*mxItemSet); + 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()); diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index ea98892f5d78..be419695e324 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -1036,6 +1036,18 @@ std::vector<sal_uInt16> GetAllCharPropIds(const SfxItemSet& rSet) return aCharWhichIds; } +std::vector<sal_uInt16> GetAllCharPropIds(o3tl::span< const SfxPoolItem* const > aChangedItems) +{ + std::vector<sal_uInt16> aCharWhichIds; + for (const SfxPoolItem* pItem : aChangedItems) + { + sal_uInt16 nWhich = pItem->Which(); + if (nWhich>=EE_CHAR_START && nWhich<=EE_CHAR_END) + aCharWhichIds.push_back( nWhich ); + } + return aCharWhichIds; +} + void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll) { if (!AreObjectsMarked()) diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index 4788c17c24d4..8f1dbe55ddca 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -166,7 +166,7 @@ namespace sdr::properties void ForceDefaultAttributes() override; - void ItemSetChanged(const SfxItemSet*) override; + void ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) override; void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override; @@ -222,7 +222,7 @@ namespace sdr::properties { } - void CellProperties::ItemSetChanged(const SfxItemSet* pSet ) + void CellProperties::ItemSetChanged(o3tl::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich) { SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject()); @@ -253,12 +253,15 @@ namespace sdr::properties // if the user sets character attributes to the complete // cell we want to remove all hard set character attributes // with same which ids from the text - std::vector<sal_uInt16> aCharWhichIds(GetAllCharPropIds(*pSet)); + std::vector<sal_uInt16> aCharWhichIds(GetAllCharPropIds(aChangedItems)); for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++) { SfxItemSet aSet(pOutliner->GetParaAttribs(nPara)); - aSet.Put(*pSet); + for (const SfxPoolItem* pItem : aChangedItems) + aSet.Put(*pItem); + if (nDeletedWhich) + aSet.ClearItem(nDeletedWhich); for (const auto& rWhichId : aCharWhichIds) { @@ -288,7 +291,7 @@ namespace sdr::properties } // call parent - AttributeProperties::ItemSetChanged(pSet); + AttributeProperties::ItemSetChanged(aChangedItems, nDeletedWhich); if( mxCell.is() ) mxCell->notifyModified(); |