[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - include/svx svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 19 18:35:14 UTC 2020
include/svx/itemwin.hxx | 4 ++--
include/svx/linectrl.hxx | 2 ++
svx/source/tbxctrls/itemwin.cxx | 14 ++++++++------
svx/source/tbxctrls/linectrl.cxx | 12 ++++++++----
4 files changed, 20 insertions(+), 12 deletions(-)
New commits:
commit f53a6e025e58f723d15ac601b3759b5929c83627
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu May 14 13:42:52 2020 +0100
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Tue May 19 20:34:39 2020 +0200
tdf#132169 we always get the value in MapUnit::Map100thMM
but must set it in the core metric of the target application
since...
commit f7c751439d4616f43509301d71af92b13b576a84
Date: Thu Nov 7 15:53:49 2019 +0100
jsdialog: consume .uno:LineWidth double value
added parameters for online, but with parameters its no longer considered a
simple slot and for non-simple slots the auto-conversion of values to/from
twips isn't done.
there's probably a much and older deeper bug here, but lets get this
known broken line width working
Change-Id: I8683431f02d2d14936411d35ba070944b9b80e1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94203
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/include/svx/itemwin.hxx b/include/svx/itemwin.hxx
index dc8b8682a98c..7f46e8f020e3 100644
--- a/include/svx/itemwin.hxx
+++ b/include/svx/itemwin.hxx
@@ -61,7 +61,7 @@ class SVX_DLLPUBLIC SvxMetricField : public MetricField
using Window::Update;
OUString aCurTxt;
- MapUnit ePoolUnit;
+ MapUnit eDestPoolUnit;
FieldUnit eDlgUnit;
Size aLogicalSize;
css::uno::Reference< css::frame::XFrame > mxFrame;
@@ -80,7 +80,7 @@ public:
const css::uno::Reference< css::frame::XFrame >& rFrame );
void Update( const XLineWidthItem* pItem );
- void SetCoreUnit( MapUnit eUnit );
+ void SetDestCoreUnit( MapUnit eUnit );
void RefreshDlgUnit();
};
diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx
index 68f92e9a64fa..d3c1e394b970 100644
--- a/include/svx/linectrl.hxx
+++ b/include/svx/linectrl.hxx
@@ -57,6 +57,8 @@ public:
class SVX_DLLPUBLIC SvxLineWidthToolBoxControl final : public SfxToolBoxControl
{
+ static MapUnit GetCoreMetric();
+
public:
SFX_DECL_TOOLBOX_CONTROL();
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
index 4d8b89b36a15..17d1d2482239 100644
--- a/svx/source/tbxctrls/itemwin.cxx
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -283,7 +283,7 @@ SvxMetricField::SvxMetricField(
vcl::Window* pParent, const Reference< XFrame >& rFrame )
: MetricField(pParent, WB_BORDER | WB_SPIN | WB_REPEAT)
, aCurTxt()
- , ePoolUnit(MapUnit::MapCM)
+ , eDestPoolUnit(MapUnit::Map100thMM)
, mxFrame(rFrame)
{
Size aSize( CalcMinimumSize() );
@@ -306,8 +306,10 @@ void SvxMetricField::Update( const XLineWidthItem* pItem )
{
if ( pItem )
{
- if ( pItem->GetValue() != GetCoreValue( *this, ePoolUnit ) )
- SetMetricValue( *this, pItem->GetValue(), ePoolUnit );
+ // tdf#132169 we always get the value in MapUnit::Map100thMM but have
+ // to set it in the core metric of the target application
+ if (pItem->GetValue() != GetCoreValue(*this, MapUnit::Map100thMM))
+ SetMetricValue(*this, pItem->GetValue(), MapUnit::Map100thMM);
}
else
SetText( "" );
@@ -317,7 +319,7 @@ void SvxMetricField::Update( const XLineWidthItem* pItem )
void SvxMetricField::Modify()
{
MetricField::Modify();
- long nTmp = GetCoreValue( *this, ePoolUnit );
+ long nTmp = GetCoreValue( *this, eDestPoolUnit );
XLineWidthItem aLineWidthItem( nTmp );
Any a;
@@ -341,9 +343,9 @@ void SvxMetricField::ReleaseFocus_Impl()
}
}
-void SvxMetricField::SetCoreUnit( MapUnit eUnit )
+void SvxMetricField::SetDestCoreUnit( MapUnit eUnit )
{
- ePoolUnit = eUnit;
+ eDestPoolUnit = eUnit;
}
void SvxMetricField::RefreshDlgUnit()
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index 0704b88006dc..dfe0be2dd57c 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -225,10 +225,7 @@ void SvxLineWidthToolBoxControl::StateChanged(
{
DBG_ASSERT( dynamic_cast<const XLineWidthItem*>( pState) != nullptr, "wrong ItemType" );
- // Core-Unit handed over to MetricField
- // Should not happen in CreateItemWin ()!
- // CD!!! GetCoreMetric();
- pFld->SetCoreUnit( MapUnit::Map100thMM );
+ pFld->SetDestCoreUnit(GetCoreMetric());
pFld->Update( static_cast<const XLineWidthItem*>(pState) );
}
@@ -238,6 +235,13 @@ void SvxLineWidthToolBoxControl::StateChanged(
}
}
+MapUnit SvxLineWidthToolBoxControl::GetCoreMetric()
+{
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+ SfxItemPool& rPool = pSh ? pSh->GetPool() : SfxGetpApp()->GetPool();
+ sal_uInt16 nWhich = rPool.GetWhich(SID_ATTR_LINE_WIDTH);
+ return rPool.GetMetric(nWhich);
+}
VclPtr<vcl::Window> SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent )
{
More information about the Libreoffice-commits
mailing list