diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de (CIB)> | 2018-03-19 17:42:29 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-04-06 18:06:36 +0200 |
commit | 0ada87afc9e103197e7ceb83b82f5b1e4c021fe9 (patch) | |
tree | eeecfeb5ef467972b8ab7b0c2b0ae58b0054d406 | |
parent | 51a1f7bb7fd3deb89b29a478efac479dda8edc82 (diff) |
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
-rw-r--r-- | svx/source/sdr/properties/defaultproperties.cxx | 18 |
1 files changed, 17 insertions, 1 deletions
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()) |