Kaydet (Commit) 5b900337 authored tarafından Andre Fischer's avatar Andre Fischer Kaydeden (comit) Caolán McNamara

Resolves: #i124216# Detect changes of the UI scale.

(cherry picked from commit 7e578303)

Conflicts:
	svx/source/sidebar/possize/PosSizePropertyPanel.hxx

Change-Id: Ia31d5645694ca9b9ebb36f38c650103905b346a8
üst aad580af
...@@ -811,6 +811,7 @@ void PosSizePropertyPanel::NotifyItemUpdate( ...@@ -811,6 +811,7 @@ void PosSizePropertyPanel::NotifyItemUpdate(
case SID_ATTR_METRIC: case SID_ATTR_METRIC:
MetricState( eState, pState ); MetricState( eState, pState );
UpdateUIScale();
break; break;
default: default:
...@@ -1162,4 +1163,26 @@ void PosSizePropertyPanel::DisableControls() ...@@ -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 } } // end of namespace svx::sidebar
...@@ -173,6 +173,18 @@ private: ...@@ -173,6 +173,18 @@ private:
void MetricState( SfxItemState eState, const SfxPoolItem* pState ); void MetricState( SfxItemState eState, const SfxPoolItem* pState );
FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ); FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState );
void DisableControls(); 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();
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment