[Libreoffice-commits] core.git: starmath/source
Stephan Bergmann
sbergman at redhat.com
Thu Nov 3 12:34:04 UTC 2016
starmath/source/unomodel.cxx | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
New commits:
commit 1fa19c73859804ca42e479e50eb7dbcb94f9c5e9
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Nov 3 12:28:46 2016 +0100
Use a single method of converting between points and 100th mm in starmath
The SmFormat ctor (starmath/source/format.cxx) uses SmPtsTo100th_mm(12) to
initialize aBaseSize, resulting in a height of 422 100th mm. Getting that value
(and writing it out to a file) through SmModel::_getPropertyValues mapped back
to 12 point, but in turn setting that value (as read from a file) through
SmModel::_setPropertyValues resulted in a height of 423 100th mm. That, in
turn, caused SmDocShell::GetSize (starmath/source/document.cxx) to compute
diverging sizes, so e.g. clicking into an OLE-embedded formula in a Writer
document caused the Writer document to be marked as modified (as the embedded
formula's size had changed).
Change-Id: Ia90654aeaaf779690997b5c3bb868b193eaf46c6
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index fdc6f51..63f5651 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -496,9 +496,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
if(nVal < 1)
throw IllegalArgumentException();
Size aSize = aFormat.GetBaseSize();
- nVal *= 20;
- nVal = static_cast < sal_Int16 > ( convertTwipToMm100(nVal) );
- aSize.Height() = nVal;
+ aSize.Height() = SmPtsTo100th_mm(nVal);
aFormat.SetBaseSize(aSize);
// apply base size to fonts
@@ -749,10 +747,9 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu
case HANDLE_BASE_FONT_HEIGHT :
{
// Point!
- sal_Int16 nVal = static_cast < sal_Int16 > (aFormat.GetBaseSize().Height());
- nVal = static_cast < sal_Int16 > (convertMm100ToTwip(nVal));
- nVal = (nVal + 10) / 20;
- *pValue <<= nVal;
+ *pValue <<= sal_Int16(
+ SmRoundFraction(
+ Sm100th_mmToPts(aFormat.GetBaseSize().Height())));
}
break;
case HANDLE_RELATIVE_FONT_HEIGHT_TEXT :
More information about the Libreoffice-commits
mailing list