Kaydet (Commit) 1fa19c73 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst 8d1c80e2
...@@ -496,9 +496,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* ...@@ -496,9 +496,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
if(nVal < 1) if(nVal < 1)
throw IllegalArgumentException(); throw IllegalArgumentException();
Size aSize = aFormat.GetBaseSize(); Size aSize = aFormat.GetBaseSize();
nVal *= 20; aSize.Height() = SmPtsTo100th_mm(nVal);
nVal = static_cast < sal_Int16 > ( convertTwipToMm100(nVal) );
aSize.Height() = nVal;
aFormat.SetBaseSize(aSize); aFormat.SetBaseSize(aSize);
// apply base size to fonts // apply base size to fonts
...@@ -749,10 +747,9 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu ...@@ -749,10 +747,9 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu
case HANDLE_BASE_FONT_HEIGHT : case HANDLE_BASE_FONT_HEIGHT :
{ {
// Point! // Point!
sal_Int16 nVal = static_cast < sal_Int16 > (aFormat.GetBaseSize().Height()); *pValue <<= sal_Int16(
nVal = static_cast < sal_Int16 > (convertMm100ToTwip(nVal)); SmRoundFraction(
nVal = (nVal + 10) / 20; Sm100th_mmToPts(aFormat.GetBaseSize().Height())));
*pValue <<= nVal;
} }
break; break;
case HANDLE_RELATIVE_FONT_HEIGHT_TEXT : case HANDLE_RELATIVE_FONT_HEIGHT_TEXT :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment