Lines 764-770
Link Here
|
764 |
} |
764 |
} |
765 |
} |
765 |
} |
766 |
} |
766 |
} |
|
|
767 |
//For i120928,export graphic info of bullet |
768 |
void SwWW8WrGrf::WritePICBulletFHeader(SvStream& rStrm, const Graphic &rGrf, |
769 |
sal_uInt16 mm, sal_uInt16 nWidth, sal_uInt16 nHeight) |
770 |
{ |
771 |
sal_Int16 nXSizeAdd = 0, nYSizeAdd = 0; |
772 |
sal_Int16 nCropL = 0, nCropR = 0, nCropT = 0, nCropB = 0; |
767 |
|
773 |
|
|
|
774 |
Size aGrTwipSz(rGrf.GetPrefSize()); |
775 |
bool bWrtWW8 = rWrt.bWrtWW8; |
776 |
sal_uInt16 nHdrLen = bWrtWW8 ? 0x44 : 0x3A; |
777 |
|
778 |
sal_uInt8 aArr[ 0x44 ] = { 0 }; |
779 |
|
780 |
sal_uInt8* pArr = aArr + 0x2E; //Do borders first |
781 |
|
782 |
sal_uInt8 aLnArr[4] = { BOX_LINE_TOP, BOX_LINE_LEFT, |
783 |
BOX_LINE_BOTTOM, BOX_LINE_RIGHT }; |
784 |
for( sal_uInt8 i = 0; i < 4; ++i ) |
785 |
{ |
786 |
WW8_BRC aBrc; |
787 |
|
788 |
short nSpacing; |
789 |
short nThick = aBrc.DetermineBorderProperties(!bWrtWW8, |
790 |
&nSpacing); |
791 |
switch (aLnArr[ i ]) |
792 |
{ |
793 |
case BOX_LINE_TOP: |
794 |
case BOX_LINE_BOTTOM: |
795 |
nHeight -= nThick; |
796 |
nHeight = nHeight - nSpacing; |
797 |
break; |
798 |
case BOX_LINE_LEFT: |
799 |
case BOX_LINE_RIGHT: |
800 |
default: |
801 |
nWidth -= nThick; |
802 |
nWidth = nWidth - nSpacing; |
803 |
break; |
804 |
} |
805 |
memcpy( pArr, &aBrc.aBits1, 2); |
806 |
pArr+=2; |
807 |
|
808 |
if( bWrtWW8 ) |
809 |
{ |
810 |
memcpy( pArr, &aBrc.aBits2, 2); |
811 |
pArr+=2; |
812 |
} |
813 |
} |
814 |
|
815 |
pArr = aArr + 4; //skip lcb |
816 |
Set_UInt16( pArr, nHdrLen ); // set cbHeader |
817 |
|
818 |
Set_UInt16( pArr, mm ); // set mm |
819 |
|
820 |
if ( (aGrTwipSz.Width() * 254L / 144 > USHRT_MAX) || (aGrTwipSz.Height() * 254L / 144 > USHRT_MAX) |
821 |
|| (aGrTwipSz.Width() < 0 ) || (aGrTwipSz.Height() < 0) ) |
822 |
{ |
823 |
aGrTwipSz.Width() = nWidth; |
824 |
aGrTwipSz.Height() = nHeight; |
825 |
} |
826 |
using namespace sw::types; |
827 |
// set xExt & yExt |
828 |
Set_UInt16(pArr, msword_cast<sal_uInt16>(aGrTwipSz.Width() * 254L / 144)); |
829 |
Set_UInt16(pArr, msword_cast<sal_uInt16>(aGrTwipSz.Height() * 254L / 144)); |
830 |
pArr += 16; |
831 |
// skip hMF & rcWinMF |
832 |
// set dxaGoal & dyaGoal |
833 |
Set_UInt16(pArr, msword_cast<sal_uInt16>(aGrTwipSz.Width())); |
834 |
Set_UInt16(pArr, msword_cast<sal_uInt16>(aGrTwipSz.Height())); |
835 |
|
836 |
if( aGrTwipSz.Width() + nXSizeAdd ) // set mx |
837 |
{ |
838 |
double fVal = nWidth * 1000.0 / (aGrTwipSz.Width() + nXSizeAdd); |
839 |
Set_UInt16( pArr, (sal_uInt16)::rtl::math::round(fVal) ); |
840 |
} |
841 |
else |
842 |
pArr += 2; |
843 |
|
844 |
if( aGrTwipSz.Height() + nYSizeAdd ) // set my |
845 |
{ |
846 |
double fVal = nHeight * 1000.0 / (aGrTwipSz.Height() + nYSizeAdd); |
847 |
Set_UInt16( pArr, (sal_uInt16)::rtl::math::round(fVal) ); |
848 |
} |
849 |
else |
850 |
pArr += 2; |
851 |
|
852 |
Set_UInt16( pArr, nCropL ); // set dxaCropLeft |
853 |
Set_UInt16( pArr, nCropT ); // set dyaCropTop |
854 |
Set_UInt16( pArr, nCropR ); // set dxaCropRight |
855 |
Set_UInt16( pArr, nCropB ); // set dyaCropBottom |
856 |
|
857 |
rStrm.Write( aArr, nHdrLen ); |
858 |
} |
859 |
void SwWW8WrGrf::WriteGrfForBullet(SvStream& rStrm, const Graphic &rGrf, sal_uInt16 nWidth, sal_uInt16 nHeight) |
860 |
{ |
861 |
if (rWrt.bWrtWW8) |
862 |
{ |
863 |
WritePICBulletFHeader(rStrm,rGrf, 0x64,nWidth,nHeight); |
864 |
SwBasicEscherEx aInlineEscher(&rStrm, rWrt); |
865 |
aInlineEscher.WriteGrfBullet(rGrf); |
866 |
aInlineEscher.WritePictures(); |
867 |
} |
868 |
else |
869 |
{ |
870 |
bool bSwapped = rGrf.IsSwapOut() ? true : false; |
871 |
|
872 |
GDIMetaFile aMeta; |
873 |
switch (rGrf.GetType()) |
874 |
{ |
875 |
case GRAPHIC_BITMAP: // Bitmap -> in Metafile abspielen |
876 |
{ |
877 |
VirtualDevice aVirt; |
878 |
aMeta.Record(&aVirt); |
879 |
aVirt.DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() ); |
880 |
aMeta.Stop(); |
881 |
aMeta.WindStart(); |
882 |
aMeta.SetPrefMapMode( rGrf.GetPrefMapMode()); |
883 |
aMeta.SetPrefSize( rGrf.GetPrefSize()); |
884 |
} |
885 |
break; |
886 |
case GRAPHIC_GDIMETAFILE : // GDI ( =SV ) Metafile |
887 |
aMeta = rGrf.GetGDIMetaFile(); |
888 |
break; |
889 |
default: |
890 |
return; |
891 |
} |
892 |
WritePICBulletFHeader(rStrm, rGrf, 8, nWidth, nHeight); |
893 |
WriteWindowMetafileBits(rStrm, aMeta); |
894 |
} |
895 |
} |
896 |
|
768 |
void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) |
897 |
void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) |
769 |
{ |
898 |
{ |
770 |
sal_uInt16 nWidth = rItem.mnWid; |
899 |
sal_uInt16 nWidth = rItem.mnWid; |
Lines 783-788
Link Here
|
783 |
WriteGrfFromGrfNode(rStrm, *pNd, rItem.maFly, nWidth, nHeight); |
912 |
WriteGrfFromGrfNode(rStrm, *pNd, rItem.maFly, nWidth, nHeight); |
784 |
} |
913 |
} |
785 |
break; |
914 |
break; |
|
|
915 |
//For i120928,add branch to export graphic of bullet |
916 |
case sw::Frame::eBulletGrf: |
917 |
{ |
918 |
if (rItem.maFly.HasGraphic()) |
919 |
{ |
920 |
const Graphic& rGrf = rItem.maFly.GetGraphic(); |
921 |
WriteGrfForBullet(rStrm, rGrf, nWidth, nHeight); |
922 |
} |
923 |
} |
924 |
break; |
925 |
|
786 |
case sw::Frame::eOle: |
926 |
case sw::Frame::eOle: |
787 |
{ |
927 |
{ |
788 |
#ifdef OLE_PREVIEW_AS_EMF |
928 |
#ifdef OLE_PREVIEW_AS_EMF |