[Libreoffice-commits] core.git: 2 commits - cui/source include/svx include/vcl svx/source vcl/source
Michael Stahl
mstahl at redhat.com
Tue May 20 07:49:02 PDT 2014
cui/source/tabpages/paragrph.cxx | 6 ++++--
include/svx/relfld.hxx | 3 ++-
include/vcl/builder.hxx | 2 ++
svx/source/dialog/relfld.cxx | 14 ++++++++++----
vcl/source/window/builder.cxx | 6 ++++++
5 files changed, 24 insertions(+), 7 deletions(-)
New commits:
commit 68bc8af6b6c4d0399bd10ed450d81aa2f17931a1
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue May 20 16:20:42 2014 +0200
SvxRelativeField: set the unit from the passed stringmap
In the Paragraph "Indents & Spacing" tab there are fields with unit:
<object class="svxlo-SvxRelativeField" id="spinED_LEFTINDENT:0cm">
But the unit is effectively ignored, and the resulting SvxRelativeField
with FUNIT_NONE and 9999 max somehow results in 0.18cm max when the
dialog sets cm as unit.
Change-Id: I6001c93079fd7d899f1e119913b29ea4898b1c34
diff --git a/include/svx/relfld.hxx b/include/svx/relfld.hxx
index 9b9d726..91fb36d 100644
--- a/include/svx/relfld.hxx
+++ b/include/svx/relfld.hxx
@@ -19,6 +19,7 @@
#ifndef INCLUDED_SVX_RELFLD_HXX
#define INCLUDED_SVX_RELFLD_HXX
+#include <tools/fldunit.hxx>
#include <vcl/field.hxx>
#include <svx/svxdllapi.h>
@@ -39,7 +40,7 @@ protected:
void Modify() SAL_OVERRIDE;
public:
- SvxRelativeField( Window* pParent, WinBits nBits);
+ SvxRelativeField(Window* pParent, WinBits nBits, FieldUnit eUnit);
void EnableRelativeMode( sal_uInt16 nMin = 50, sal_uInt16 nMax = 150,
sal_uInt16 nStep = 5 );
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index f8208f5..3f4841e 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -13,6 +13,7 @@
#include <typeinfo>
#include <osl/module.hxx>
#include <tools/resmgr.hxx>
+#include <tools/fldunit.hxx>
#include <vcl/dllapi.h>
#include <vcl/window.hxx>
#include <xmlreader/xmlreader.hxx>
@@ -303,6 +304,7 @@ public:
static OString convertMnemonicMarkup(const OString &rIn);
static OString extractCustomProperty(stringmap &rMap);
+ static FieldUnit detectUnit(OString const&);
static bool extractDropdown(stringmap &rMap);
diff --git a/svx/source/dialog/relfld.cxx b/svx/source/dialog/relfld.cxx
index 1031c89..b4db001 100644
--- a/svx/source/dialog/relfld.cxx
+++ b/svx/source/dialog/relfld.cxx
@@ -22,7 +22,8 @@
-SvxRelativeField::SvxRelativeField( Window* pParent, WinBits nBits)
+SvxRelativeField::SvxRelativeField(
+ Window *const pParent, WinBits const nBits, FieldUnit const eUnit)
: MetricField( pParent, nBits)
, nRelMin(0)
, nRelMax(0)
@@ -32,15 +33,20 @@ SvxRelativeField::SvxRelativeField( Window* pParent, WinBits nBits)
, bNegativeEnabled(false)
{
-
+ SetUnit(eUnit);
SetDecimalDigits( 2 );
SetMin( 0 );
SetMax( 9999 );
}
-extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxRelativeField(Window *pParent, VclBuilder::stringmap &)
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL
+makeSvxRelativeField(Window *const pParent, VclBuilder::stringmap & rMap)
{
- return new SvxRelativeField(pParent, WB_BORDER | WB_SPIN | WB_REPEAT | WB_LEFT | WB_GROUP);
+ OString const custom(VclBuilder::extractCustomProperty(rMap));
+ FieldUnit const eUnit(VclBuilder::detectUnit(custom));
+ SvxRelativeField *const pRet = new SvxRelativeField(pParent,
+ WB_BORDER | WB_SPIN | WB_REPEAT | WB_LEFT | WB_GROUP, eUnit);
+ return pRet;
}
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index f3858d1..fb0356a 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -904,6 +904,12 @@ namespace
}
}
+FieldUnit VclBuilder::detectUnit(OString const& rString)
+{
+ OString const unit(extractUnit(rString));
+ return detectMetricUnit(unit);
+}
+
void VclBuilder::ensureDefaultWidthChars(VclBuilder::stringmap &rMap)
{
OString sWidthChars("width-chars");
commit 35199df7b7af9d9dd3e98eb5f1b24ac1d407345c
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue May 20 11:18:55 2014 +0200
(related: fdo#62176) Revert "reset min/max values in paragraph ...
... dialog before setting the actual value"
This prevents handling negative first-line indent in Impress, for which
it is necessary that the values are set before the limits.
This reverts commit 3d7ff1e907713d8ed53a1e193641a2f16de3c38b.
Change-Id: I47807d7d49716acab3657de1da64c6e9a99fc44d
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 6dba191..0e71f68 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -431,8 +431,6 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet& rSet )
SetFieldUnit( *m_pLineDistAtMetricBox, eFUnit );
}
- ELRLoseFocusHdl( NULL ); // reset min/max values
-
sal_uInt16 _nWhich = GetWhich( SID_ATTR_LRSPACE );
SfxItemState eItemState = rSet.GetItemState( _nWhich );
@@ -590,6 +588,10 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet& rSet )
}
}
+ // this sets the min/max limits; do this _after_ setting the values,
+ // because for Impress the min of first-line indent depends on value of
+ // left-indent!
+ ELRLoseFocusHdl( NULL );
m_pAutoCB->SaveValue();
m_pContextualCB->SaveValue();
m_pLineDist->SaveValue();
More information about the Libreoffice-commits
mailing list