[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - include/sfx2 sfx2/source sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jan 22 20:02:51 UTC 2021
include/sfx2/ctrlitem.hxx | 8 ++++++-
sfx2/source/control/ctrlitem.cxx | 29 ++++++++++-----------------
sw/source/uibase/sidebar/PageFormatPanel.cxx | 1
3 files changed, 19 insertions(+), 19 deletions(-)
New commits:
commit cf175d313b7cb3084f99f01e6213cdeeee124d92
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jan 22 10:18:38 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jan 22 21:02:18 2021 +0100
tdf#135590 MapUnit::Map100thMM fallback is inappropiate for writer
which uses MapUnit::Twip
so directly after insert, envelope, ok the new document sidebar
was using MapUnit::Map100thMM to lookup paper sizes instead of
MapUnit::Twip giving inconsistent results against format, page
Change-Id: I6a92fddedfe9fef8ad7532ad00b2b38b9741bb69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109751
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
Tested-by: Jenkins
diff --git a/include/sfx2/ctrlitem.hxx b/include/sfx2/ctrlitem.hxx
index 489fdb9461a8..da9f86f93e1c 100644
--- a/include/sfx2/ctrlitem.hxx
+++ b/include/sfx2/ctrlitem.hxx
@@ -30,9 +30,10 @@ class SfxBindings;
class SFX2_DLLPUBLIC SfxControllerItem
{
private:
- sal_uInt16 nId;
+ sal_uInt16 nId;
SfxControllerItem* pNext; // to notify next ControllerItem
SfxBindings* pBindings;
+ MapUnit eFallbackCoreMetric;
public:
SfxBindings & GetBindings() {
@@ -67,6 +68,11 @@ public:
virtual void GetControlState( sal_uInt16 nSID, boost::property_tree::ptree& );
MapUnit GetCoreMetric() const;
+ // override what GetCoreMetric will return if it cannot determine the current CoreMetric
+ void SetFallbackCoreMetric(MapUnit eFallback)
+ {
+ eFallbackCoreMetric = eFallback;
+ }
static SfxItemState GetItemState( const SfxPoolItem* pState );
diff --git a/sfx2/source/control/ctrlitem.cxx b/sfx2/source/control/ctrlitem.cxx
index 1b039e44ad9d..308706f95b8c 100644
--- a/sfx2/source/control/ctrlitem.cxx
+++ b/sfx2/source/control/ctrlitem.cxx
@@ -152,9 +152,7 @@ void SfxControllerItem::ClearCache()
pBindings->ClearCache_Impl( GetId() );
}
-
// replaces the successor in the list of bindings of the same id
-
SfxControllerItem* SfxControllerItem::ChangeItemLink( SfxControllerItem* pNewLink )
{
SfxControllerItem* pOldLink = pNext;
@@ -164,37 +162,32 @@ SfxControllerItem* SfxControllerItem::ChangeItemLink( SfxControllerItem* pNewLin
// changes the id of unbound functions (e.g. for sub-menu-ids)
-
void SfxControllerItem::SetId( sal_uInt16 nItemId )
{
DBG_ASSERT( !IsBound(), "changing id of bound binding" );
nId = nItemId;
}
-
// creates an atomic item for a controller without registration.
-
-SfxControllerItem::SfxControllerItem():
- nId(0),
- pNext(this),
- pBindings(nullptr)
+SfxControllerItem::SfxControllerItem()
+ : nId(0)
+ , pNext(this)
+ , pBindings(nullptr)
+ , eFallbackCoreMetric(MapUnit::Map100thMM)
{
}
-
// creates a representation of the function nId and registers it
-
-SfxControllerItem::SfxControllerItem( sal_uInt16 nID, SfxBindings &rBindings ):
- nId(nID),
- pNext(this),
- pBindings(&rBindings)
+SfxControllerItem::SfxControllerItem(sal_uInt16 nID, SfxBindings &rBindings)
+ : nId(nID)
+ , pNext(this)
+ , pBindings(&rBindings)
+ , eFallbackCoreMetric(MapUnit::Map100thMM)
{
Bind(nId, &rBindings);
}
-
// unregisters the item in the bindings
-
SfxControllerItem::~SfxControllerItem()
{
dispose();
@@ -345,7 +338,7 @@ MapUnit SfxControllerItem::GetCoreMetric() const
}
SAL_INFO( "sfx.control", "W1: Can not find ItemPool!" );
- return MapUnit::Map100thMM;
+ return eFallbackCoreMetric;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/sidebar/PageFormatPanel.cxx b/sw/source/uibase/sidebar/PageFormatPanel.cxx
index 45019db48e9d..31d556ca15ee 100644
--- a/sw/source/uibase/sidebar/PageFormatPanel.cxx
+++ b/sw/source/uibase/sidebar/PageFormatPanel.cxx
@@ -139,6 +139,7 @@ void PageFormatPanel::dispose()
void PageFormatPanel::Initialize()
{
mxPaperSizeBox->FillPaperSizeEntries( PaperSizeApp::Std );
+ maPaperSizeController.SetFallbackCoreMetric(MapUnit::MapTwip);
meUnit = maPaperSizeController.GetCoreMetric();
mxPaperWidth->SetFieldUnit(meFUnit);
mxPaperHeight->SetFieldUnit(meFUnit);
More information about the Libreoffice-commits
mailing list