View | Details | Raw Unified | Return to issue 119567
Collapse All | Expand All

(-)sw/source/filter/ww8/wrtww8gr.cxx (-8 / +25 lines)
Lines 601-611 Link Here
601
    substitute the final size and loose on retaining the scaling factor but
601
    substitute the final size and loose on retaining the scaling factor but
602
    still keep the correct display size anyway.
602
    still keep the correct display size anyway.
603
    */
603
    */
604
    sal_Bool bIsSubstitutedSize = sal_False;
604
    if ( (aGrTwipSz.Width() > SHRT_MAX) || (aGrTwipSz.Height() > SHRT_MAX)
605
    if ( (aGrTwipSz.Width() > SHRT_MAX) || (aGrTwipSz.Height() > SHRT_MAX)
605
        || (aGrTwipSz.Width() < 0 ) || (aGrTwipSz.Height() < 0) )
606
        || (aGrTwipSz.Width() < 0 ) || (aGrTwipSz.Height() < 0) )
606
    {
607
    {
607
        aGrTwipSz.Width() = nWidth;
608
        aGrTwipSz.Width() = nWidth;
608
        aGrTwipSz.Height() = nHeight;
609
        aGrTwipSz.Height() = nHeight;
610
        bIsSubstitutedSize = sal_True;
609
    }
611
    }
610
    using namespace sw::types;
612
    using namespace sw::types;
611
    // set xExt & yExt
613
    // set xExt & yExt
Lines 619-642 Link Here
619
621
620
    if( aGrTwipSz.Width() + nXSizeAdd )             // set mx
622
    if( aGrTwipSz.Width() + nXSizeAdd )             // set mx
621
    {
623
    {
622
        double fVal = nWidth * 1000.0 / (aGrTwipSz.Width() + nXSizeAdd);
624
		if ( !bIsSubstitutedSize )
623
        Set_UInt16( pArr, (sal_uInt16)::rtl::math::round(fVal) );
625
		{
626
			double fVal = nWidth * 1000.0 / (aGrTwipSz.Width() + nXSizeAdd );
627
			Set_UInt16( pArr, (sal_uInt16)::rtl::math::round(fVal) );
628
		}
629
		else
630
            Set_UInt16( pArr, 1000 );
624
    }
631
    }
625
    else
632
    else
626
        pArr += 2;
633
        pArr += 2;
627
634
628
    if( aGrTwipSz.Height() + nYSizeAdd )            // set my
635
    if( aGrTwipSz.Height() + nYSizeAdd )            // set my
629
    {
636
    {
630
        double fVal = nHeight * 1000.0 / (aGrTwipSz.Height() + nYSizeAdd);
637
		if ( !bIsSubstitutedSize )
631
        Set_UInt16( pArr, (sal_uInt16)::rtl::math::round(fVal) );
638
		{
639
			double fVal = nHeight * 1000.0 / (aGrTwipSz.Height() + nYSizeAdd);
640
			Set_UInt16( pArr, (sal_uInt16)::rtl::math::round(fVal) );	
641
		}
642
		else
643
		    Set_UInt16( pArr, 1000 );
632
    }
644
    }
633
    else
645
    else
634
        pArr += 2;
646
        pArr += 2;
635
647
636
    Set_UInt16( pArr, nCropL );                     // set dxaCropLeft
648
	if ( !bIsSubstitutedSize )
637
    Set_UInt16( pArr, nCropT );                     // set dyaCropTop
649
	{
638
    Set_UInt16( pArr, nCropR );                     // set dxaCropRight
650
        Set_UInt16( pArr, nCropL );                     // set dxaCropLeft
639
    Set_UInt16( pArr, nCropB );                     // set dyaCropBottom
651
        Set_UInt16( pArr, nCropT );                     // set dyaCropTop
652
        Set_UInt16( pArr, nCropR );                     // set dxaCropRight
653
        Set_UInt16( pArr, nCropB );                     // set dyaCropBottom 
654
	}
655
	else 
656
        pArr += 8;
640
657
641
    rStrm.Write( aArr, nHdrLen );
658
    rStrm.Write( aArr, nHdrLen );
642
}
659
}

Return to issue 119567