summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2014-02-18 14:17:32 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-02-19 09:49:49 +0000
commit5b9003372effe4ee4bc34f34ee20138ac6a6050f (patch)
tree868e927381b81298206ad40447b275696f207b62 /svx
parentaad580af924d477f90264d6d1a2365d8e0cf8c9c (diff)
Resolves: #i124216# Detect changes of the UI scale.
(cherry picked from commit 7e5783030c82f8ec87b88899869e9152cf5c3271) Conflicts: svx/source/sidebar/possize/PosSizePropertyPanel.hxx Change-Id: Ia31d5645694ca9b9ebb36f38c650103905b346a8
Diffstat (limited to 'svx')
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.cxx23
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.hxx12
2 files changed, 35 insertions, 0 deletions
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();
};