[Libreoffice-commits] core.git: Branch 'feature/SOSAW080' - svx/source
Armin Le Grand (CIB)
Armin.Le.Grand at cib.de
Mon Mar 19 16:44:19 UTC 2018
svx/source/sdr/properties/defaultproperties.cxx | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
New commits:
commit e0930919f4aa7d847f56e857dfc0320f2dc2b455
Author: Armin Le Grand <Armin.Le.Grand at cib.de (CIB)>
Date: Mon Mar 19 17:42:29 2018 +0100
SOSAW080: Added Scale to DefaultProperties
If a SdrModel change happens in DefaultProperties copy
constructor (used from Clone()), potentially a Scale
for the SfxItems has to be done.
Change-Id: If9e646242cf89f6fde1315046952252a2c429779
diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx
index 1856ca2db8c2..5c5af1a24559 100644
--- a/svx/source/sdr/properties/defaultproperties.cxx
+++ b/svx/source/sdr/properties/defaultproperties.cxx
@@ -57,7 +57,7 @@ namespace sdr
{
if(rProps.mpItemSet)
{
- // TTTT Clone may be to another model and thus another ItemPool
+ // 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.
mpItemSet.reset(
@@ -65,6 +65,22 @@ namespace sdr
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() (?)
+ if(&rObj.getSdrModelFromSdrObject() != &GetSdrObject().getSdrModelFromSdrObject())
+ {
+ const MapUnit aOldUnit(GetSdrObject().getSdrModelFromSdrObject().GetScaleUnit());
+ const MapUnit aNewUnit(rObj.getSdrModelFromSdrObject().GetScaleUnit());
+ const bool bScaleUnitChanged(aNewUnit != aOldUnit);
+
+ if(bScaleUnitChanged)
+ {
+ const Fraction aMetricFactor(GetMapFactor(aOldUnit, aNewUnit).X());
+ Scale(aMetricFactor);
+ }
+ }
+
// do not keep parent info, this may be changed by later constructors.
// This class just copies the ItemSet, ignore parent.
if(mpItemSet && mpItemSet->GetParent())
More information about the Libreoffice-commits
mailing list