diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-11-03 12:28:46 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-11-03 13:33:33 +0100 |
commit | 1fa19c73859804ca42e479e50eb7dbcb94f9c5e9 (patch) | |
tree | f8f99eb9f3f6063bda59c1404b3313debfc810a9 /starmath/source | |
parent | 8d1c80e2633b8a63050cdd81b7e089f27b996c0f (diff) |
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
Diffstat (limited to 'starmath/source')
-rw-r--r-- | starmath/source/unomodel.cxx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index fdc6f51328f7..63f565190d81 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 : |