[Libreoffice-commits] core.git: sw/source
Oliver-Rainer Wittmann
orw at apache.org
Sun Apr 14 18:18:45 PDT 2013
sw/source/filter/ww8/wrtww8gr.cxx | 50 ++++++++++++++++++++++++++++----------
1 file changed, 38 insertions(+), 12 deletions(-)
New commits:
commit 7f71ed1c62775a4e5b2efebf55f284a5c32b2df4
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Fri Jul 6 07:07:48 2012 +0000
Resolves: #i119567# wmf in PICT assure correct scaling...
in case that the size is substituted.
Found by: Yan Ji <yanji.yj at gmail dot com>
Patch by: zjchen <zjchencdl at gmail dot com>
Review by: Oliver <orw at apache dot org>
(cherry picked from commit 69ea079e09f64ac037686f874617efc63d0449f5)
Change-Id: I1eb4b0be184fcefca26eee5f98ba6135a32574c2
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index 74f46da..32c5b2e 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -630,8 +630,9 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const sw::Frame &rFly,
substitute the final size and loose on retaining the scaling factor but
still keep the correct display size anyway.
*/
- if ( (aGrTwipSz.Width() > SHRT_MAX) || (aGrTwipSz.Height() > SHRT_MAX)
- || (aGrTwipSz.Width() < 0 ) || (aGrTwipSz.Height() < 0) )
+ const bool bIsSubstitutedSize = (aGrTwipSz.Width() > SHRT_MAX) || (aGrTwipSz.Height() > SHRT_MAX) ||
+ (aGrTwipSz.Width() < 0 ) || (aGrTwipSz.Height() < 0);
+ if ( bIsSubstitutedSize )
{
aGrTwipSz.Width() = nWidth;
aGrTwipSz.Height() = nHeight;
@@ -646,26 +647,51 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const sw::Frame &rFly,
Set_UInt16(pArr, msword_cast<sal_uInt16>(aGrTwipSz.Width()));
Set_UInt16(pArr, msword_cast<sal_uInt16>(aGrTwipSz.Height()));
- if( aGrTwipSz.Width() + nXSizeAdd ) // set mx
+ if ( aGrTwipSz.Width() + nXSizeAdd ) // set mx
{
- double fVal = nWidth * 1000.0 / (aGrTwipSz.Width() + nXSizeAdd);
- Set_UInt16( pArr, (sal_uInt16)::rtl::math::round(fVal) );
+ if ( !bIsSubstitutedSize )
+ {
+ const double fVal = nWidth * 1000.0 / (aGrTwipSz.Width() + nXSizeAdd );
+ Set_UInt16( pArr, (sal_uInt16)::rtl::math::round(fVal) );
+ }
+ else
+ {
+ Set_UInt16( pArr, 1000 );
+ }
}
else
+ {
pArr += 2;
+ }
- if( aGrTwipSz.Height() + nYSizeAdd ) // set my
+ if ( aGrTwipSz.Height() + nYSizeAdd ) // set my
{
- double fVal = nHeight * 1000.0 / (aGrTwipSz.Height() + nYSizeAdd);
- Set_UInt16( pArr, (sal_uInt16)::rtl::math::round(fVal) );
+ if ( !bIsSubstitutedSize )
+ {
+ const double fVal = nHeight * 1000.0 / (aGrTwipSz.Height() + nYSizeAdd);
+ Set_UInt16( pArr, (sal_uInt16)::rtl::math::round(fVal) );
+ }
+ else
+ {
+ Set_UInt16( pArr, 1000 );
+ }
}
else
+ {
pArr += 2;
+ }
- Set_UInt16( pArr, nCropL ); // set dxaCropLeft
- Set_UInt16( pArr, nCropT ); // set dyaCropTop
- Set_UInt16( pArr, nCropR ); // set dxaCropRight
- Set_UInt16( pArr, nCropB ); // set dyaCropBottom
+ if ( !bIsSubstitutedSize )
+ {
+ Set_UInt16( pArr, nCropL ); // set dxaCropLeft
+ Set_UInt16( pArr, nCropT ); // set dyaCropTop
+ Set_UInt16( pArr, nCropR ); // set dxaCropRight
+ Set_UInt16( pArr, nCropB ); // set dyaCropBottom
+ }
+ else
+ {
+ pArr += 8;
+ }
rStrm.Write( aArr, nHdrLen );
}
More information about the Libreoffice-commits
mailing list