Index: sw/source/filter/ww8/wrtww8gr.cxx =================================================================== --- sw/source/filter/ww8/wrtww8gr.cxx (revision 1350468) +++ sw/source/filter/ww8/wrtww8gr.cxx (working copy) @@ -601,11 +601,13 @@ substitute the final size and loose on retaining the scaling factor but still keep the correct display size anyway. */ + sal_Bool bIsSubstitutedSize = sal_False; if ( (aGrTwipSz.Width() > SHRT_MAX) || (aGrTwipSz.Height() > SHRT_MAX) || (aGrTwipSz.Width() < 0 ) || (aGrTwipSz.Height() < 0) ) { aGrTwipSz.Width() = nWidth; aGrTwipSz.Height() = nHeight; + bIsSubstitutedSize = sal_True; } using namespace sw::types; // set xExt & yExt @@ -619,24 +621,39 @@ 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 ) + { + 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 { - double fVal = nHeight * 1000.0 / (aGrTwipSz.Height() + nYSizeAdd); - Set_UInt16( pArr, (sal_uInt16)::rtl::math::round(fVal) ); + if ( !bIsSubstitutedSize ) + { + 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 ); }