From 5b9003372effe4ee4bc34f34ee20138ac6a6050f Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Tue, 18 Feb 2014 14:17:32 +0000 Subject: Resolves: #i124216# Detect changes of the UI scale. (cherry picked from commit 7e5783030c82f8ec87b88899869e9152cf5c3271) Conflicts: svx/source/sidebar/possize/PosSizePropertyPanel.hxx Change-Id: Ia31d5645694ca9b9ebb36f38c650103905b346a8 --- .../sidebar/possize/PosSizePropertyPanel.cxx | 23 ++++++++++++++++++++++ .../sidebar/possize/PosSizePropertyPanel.hxx | 12 +++++++++++ 2 files changed, 35 insertions(+) (limited to 'svx') diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index 291d71b4964d..f320e3e88156 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -811,6 +811,7 @@ void PosSizePropertyPanel::NotifyItemUpdate( case SID_ATTR_METRIC: MetricState( eState, pState ); + UpdateUIScale(); break; default: @@ -1162,4 +1163,26 @@ void PosSizePropertyPanel::DisableControls() } + + +void PosSizePropertyPanel::UpdateUIScale() +{ + const Fraction aUIScale (mpView->GetModel()->GetUIScale()); + if (maUIScale != aUIScale) + { + // UI scale has changed. + + // Remember the new UI scale. + maUIScale = aUIScale; + + // The content of the position and size boxes is only updated when item changes are notified. + // Request such notifications without changing the actual item values. + GetBindings()->Invalidate(SID_ATTR_TRANSFORM_POS_X, sal_True, sal_False); + GetBindings()->Invalidate(SID_ATTR_TRANSFORM_POS_Y, sal_True, sal_False); + GetBindings()->Invalidate(SID_ATTR_TRANSFORM_WIDTH, sal_True, sal_False); + GetBindings()->Invalidate(SID_ATTR_TRANSFORM_HEIGHT, sal_True, sal_False); + } +} + + } } // end of namespace svx::sidebar diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx index f7892827f3d1..5649a490e4c0 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx @@ -173,6 +173,18 @@ private: void MetricState( SfxItemState eState, const SfxPoolItem* pState ); FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ); void DisableControls(); + + /** Check if the UI scale has changed and handle such a change. + UI scale is an SD only feature. The UI scale is represented by items + ATTR_OPTIONS_SCALE_X and + ATTR_OPTIONS_SCALE_Y. + As we have no direct access (there is no dependency of svx on sd) we have to + use a small trick (aka hack): + a) call this method whenever a change of the metric item is notified, + b) check if the UI scale has changed (strangely, the UI scale value is available at the SdrModel. + c) invalidate the items for position and size to trigger notifications of their current values. + */ + void UpdateUIScale(); }; -- cgit