summaryrefslogtreecommitdiff
path: root/sfx2/source/sidebar
diff options
context:
space:
mode:
authorPranam Lashkari <lpranam@collabora.com>2024-12-05 21:29:16 +0530
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-12-10 11:28:36 +0100
commit161cd3c3a2bc1d9d1b3d65de45aad1200bb4fd8e (patch)
tree418cda449178c74f0abaa1bd6ff054f46916a54e /sfx2/source/sidebar
parent6ea738e7f4ffa7d9452c65df48550842f711c6c4 (diff)
lok: use locale units in dialogs and sidebar
this patch updates fix for the dialog which were not fixed by e2708fecb34fb4084f8db5f2c5ffb4d8923002ca Change-Id: I7a9531d5af5b388cd6d763ea8c8d62ff4e7f12ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177896 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178203 Tested-by: Jenkins
Diffstat (limited to 'sfx2/source/sidebar')
-rw-r--r--sfx2/source/sidebar/ControllerItem.cxx27
1 files changed, 18 insertions, 9 deletions
diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx
index 9f8b856be86c..313cf1c49566 100644
--- a/sfx2/source/sidebar/ControllerItem.cxx
+++ b/sfx2/source/sidebar/ControllerItem.cxx
@@ -44,12 +44,28 @@ ControllerItem::~ControllerItem()
dispose();
}
+void ControllerItem::ReceiverNotifyItemUpdate(sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState)
+{
+ if (nSID == SID_ATTR_METRIC && pState && comphelper::LibreOfficeKit::isActive())
+ {
+ std::unique_ptr<SfxPoolItem> xClose(pState->Clone());
+ MeasurementSystem eSystem
+ = LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum();
+ FieldUnit eUnit = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH;
+ static_cast<SfxUInt16Item*>(xClose.get())->SetValue(static_cast<sal_uInt16>(eUnit));
+ mrItemUpdateReceiver.NotifyItemUpdate(nSID, eState, xClose.get());
+ return;
+ }
+ mrItemUpdateReceiver.NotifyItemUpdate(nSID, eState, pState);
+}
+
void ControllerItem::StateChangedAtToolBoxControl (
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState)
{
- mrItemUpdateReceiver.NotifyItemUpdate(nSID, eState, pState);
+ ReceiverNotifyItemUpdate(nSID, eState, pState);
}
void ControllerItem::GetControlState (
@@ -63,14 +79,7 @@ void ControllerItem::RequestUpdate()
{
std::unique_ptr<SfxPoolItem> pState;
const SfxItemState eState (GetBindings().QueryState(GetId(), pState));
- if (GetId() == SID_ATTR_METRIC && pState && comphelper::LibreOfficeKit::isActive())
- {
- MeasurementSystem eSystem
- = LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum();
- FieldUnit eUnit = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH;
- static_cast<SfxUInt16Item*>(pState.get())->SetValue(static_cast<sal_uInt16>(eUnit));
- }
- mrItemUpdateReceiver.NotifyItemUpdate(GetId(), eState, pState.get());
+ ReceiverNotifyItemUpdate(GetId(), eState, pState.get());
}
ControllerItem::ItemUpdateReceiverInterface::~ItemUpdateReceiverInterface()