summaryrefslogtreecommitdiff
path: root/svtools/source/filter.vcl/wmf/wmfwr.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svtools/source/filter.vcl/wmf/wmfwr.cxx')
-rw-r--r--svtools/source/filter.vcl/wmf/wmfwr.cxx174
1 files changed, 87 insertions, 87 deletions
diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx
index b1d08c091be8..fd8fefdda821 100644
--- a/svtools/source/filter.vcl/wmf/wmfwr.cxx
+++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -37,7 +37,7 @@
#include <rtl/tencinfo.h>
#include <tools/tenccvt.hxx>
#include <osl/endian.h>
-#include <i18nutil/unicode.hxx> //unicode::getUnicodeScriptType
+#include <i18nutil/unicode.hxx> //unicode::getUnicodeScriptType
#include <vcl/metric.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
@@ -189,17 +189,17 @@
#define W_CHINESEBIG5_CHARSET 136
#define W_OEM_CHARSET 255
/*WINVER >= 0x0400*/
-#define W_JOHAB_CHARSET 130
-#define W_HEBREW_CHARSET 177
-#define W_ARABIC_CHARSET 178
-#define W_GREEK_CHARSET 161
-#define W_TURKISH_CHARSET 162
+#define W_JOHAB_CHARSET 130
+#define W_HEBREW_CHARSET 177
+#define W_ARABIC_CHARSET 178
+#define W_GREEK_CHARSET 161
+#define W_TURKISH_CHARSET 162
#define W_VIETNAMESE_CHARSET 163
-#define W_THAI_CHARSET 222
+#define W_THAI_CHARSET 222
#define W_EASTEUROPE_CHARSET 238
#define W_RUSSIAN_CHARSET 204
#define W_MAC_CHARSET 77
-#define W_BALTIC_CHARSET 186
+#define W_BALTIC_CHARSET 186
#define W_DEFAULT_PITCH 0x00
#define W_FIXED_PITCH 0x01
@@ -242,9 +242,9 @@
#define W_HS_CROSS 4
#define W_HS_DIAGCROSS 5
-#define W_MFCOMMENT 15
+#define W_MFCOMMENT 15
-#define PRIVATE_ESCAPE_UNICODE 2
+#define PRIVATE_ESCAPE_UNICODE 2
/// copied from writerwordglue.cxx
@@ -458,8 +458,8 @@ void WMFWriter::WMFRecord_CreateFontIndirect(const Font & rFont)
if (rFont.GetUnderline()==UNDERLINE_NONE) *pWMF << (BYTE)0; else *pWMF << (BYTE)1;
if (rFont.GetStrikeout()==STRIKEOUT_NONE) *pWMF << (BYTE)0; else *pWMF << (BYTE)1;
- CharSet eFontNameEncoding = rFont.GetCharSet();
- sal_uInt8 nCharSet = rtl_getBestWindowsCharsetFromTextEncoding( eFontNameEncoding );
+ CharSet eFontNameEncoding = rFont.GetCharSet();
+ sal_uInt8 nCharSet = rtl_getBestWindowsCharsetFromTextEncoding( eFontNameEncoding );
if ( eFontNameEncoding == RTL_TEXTENCODING_SYMBOL )
eFontNameEncoding = RTL_TEXTENCODING_MS_1252;
if ( nCharSet == 1 )
@@ -560,14 +560,14 @@ void WMFWriter::WMFRecord_Escape( sal_uInt32 nEsc, sal_uInt32 nLen, const sal_In
WriteRecordHeader( 3 + 9 + ( ( nLen + 1 ) >> 1 ), W_META_ESCAPE );
*pWMF << (sal_uInt16)W_MFCOMMENT
- << (sal_uInt16)( nLen + 14 ) // we will always have a fourteen byte escape header:
- << (sal_uInt16)0x4f4f // OO
- << (sal_uInt32)0xa2c2a // evil magic number
- << (sal_uInt32)nCheckSum // crc32 checksum about nEsc & pData
- << (sal_uInt32)nEsc; // escape number
+ << (sal_uInt16)( nLen + 14 ) // we will always have a fourteen byte escape header:
+ << (sal_uInt16)0x4f4f // OO
+ << (sal_uInt32)0xa2c2a // evil magic number
+ << (sal_uInt32)nCheckSum // crc32 checksum about nEsc & pData
+ << (sal_uInt32)nEsc; // escape number
pWMF->Write( pData, nLen );
if ( nLen & 1 )
- *pWMF << (sal_uInt8)0; // pad byte
+ *pWMF << (sal_uInt8)0; // pad byte
}
/* if return value is true, then a complete unicode string and also a polygon replacement has been written,
@@ -581,49 +581,49 @@ sal_Bool WMFWriter::WMFRecord_Escape_Unicode( const Point& rPoint, const String&
if ( nStringLen )
{
// first we will check if a comment is necessary
- if ( aSrcFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL ) // symbol is always byte character, so there is no unicode loss
+ if ( aSrcFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL ) // symbol is always byte character, so there is no unicode loss
{
const sal_Unicode* pBuf = rUniStr.GetBuffer();
const rtl_TextEncoding aTextEncodingOrg = aSrcFont.GetCharSet();
ByteString aByteStr( rUniStr, aTextEncodingOrg );
- String aUniStr2( aByteStr, aTextEncodingOrg );
- const sal_Unicode* pConversion = aUniStr2.GetBuffer(); // this is the unicode array after bytestring <-> unistring conversion
+ String aUniStr2( aByteStr, aTextEncodingOrg );
+ const sal_Unicode* pConversion = aUniStr2.GetBuffer(); // this is the unicode array after bytestring <-> unistring conversion
for ( i = 0; i < nStringLen; i++ )
{
if ( *pBuf++ != *pConversion++ )
break;
}
- if ( i != nStringLen ) // after conversion the characters are not original,
- { // try again, with determining a better charset from unicode char
+ if ( i != nStringLen ) // after conversion the characters are not original,
+ { // try again, with determining a better charset from unicode char
pBuf = rUniStr.GetBuffer();
const sal_Unicode* pCheckChar = pBuf;
- rtl_TextEncoding aTextEncoding = getScriptClass (*pCheckChar); // try the first character
+ rtl_TextEncoding aTextEncoding = getScriptClass (*pCheckChar); // try the first character
for ( i = 1; i < nStringLen; i++)
{
if (aTextEncoding != aTextEncodingOrg) // found something
break;
pCheckChar++;
- aTextEncoding = getScriptClass (*pCheckChar); // try the next character
+ aTextEncoding = getScriptClass (*pCheckChar); // try the next character
}
aByteStr = ByteString ( rUniStr, aTextEncoding );
aUniStr2 = String ( aByteStr, aTextEncoding );
- pConversion = aUniStr2.GetBuffer(); // this is the unicode array after bytestring <-> unistring conversion
+ pConversion = aUniStr2.GetBuffer(); // this is the unicode array after bytestring <-> unistring conversion
for ( i = 0; i < nStringLen; i++ )
{
if ( *pBuf++ != *pConversion++ )
break;
}
- if (i == nStringLen)
+ if (i == nStringLen)
{
aSrcFont.SetCharSet (aTextEncoding);
SetAllAttr();
}
}
- if ( ( i != nStringLen ) || IsStarSymbol( aSrcFont.GetName() ) ) // after conversion the characters are not original, so we
- { // will store the unicode string and a polypoly replacement
+ if ( ( i != nStringLen ) || IsStarSymbol( aSrcFont.GetName() ) ) // after conversion the characters are not original, so we
+ { // will store the unicode string and a polypoly replacement
Color aOldFillColor( aSrcFillColor );
Color aOldLineColor( aSrcLineColor );
aSrcLineInfo = LineInfo();
@@ -686,7 +686,7 @@ void WMFWriter::WMFRecord_ExtTextOut( const Point & rPoint,
TrueExtTextOut(rPoint,rString,aByteString,pDXAry);
}
-void WMFWriter::TrueExtTextOut( const Point & rPoint, const String & rString,
+void WMFWriter::TrueExtTextOut( const Point & rPoint, const String & rString,
const ByteString & rByteString, const sal_Int32 * pDXAry )
{
WriteRecordHeader( 0, W_META_EXTTEXTOUT );
@@ -1179,8 +1179,8 @@ void WMFWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx:
void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
{
- ULONG nA, nACount;
- MetaAction* pMA;
+ ULONG nA, nACount;
+ MetaAction* pMA;
if( bStatus )
{
@@ -1205,8 +1205,8 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
case META_POINT_ACTION:
{
- const MetaPointAction* pA = (const MetaPointAction*) pMA;
- const Point& rPt = pA->GetPoint();
+ const MetaPointAction* pA = (const MetaPointAction*) pMA;
+ const Point& rPt = pA->GetPoint();
aSrcLineInfo = LineInfo();
SetLineAndFillAttr();
WMFRecord_MoveTo( rPt);
@@ -1293,7 +1293,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
case META_POLYLINE_ACTION:
{
const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pMA;
- const Polygon& rPoly = pA->GetPolygon();
+ const Polygon& rPoly = pA->GetPolygon();
if( rPoly.GetSize() )
{
@@ -1357,7 +1357,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
case META_TEXTARRAY_ACTION:
{
const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pMA;
-
+
String aTemp( pA->GetText(), pA->GetIndex(), pA->GetLen() );
aSrcLineInfo = LineInfo();
SetAllAttr();
@@ -1406,8 +1406,8 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
case META_BMPSCALEPART_ACTION:
{
- const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pMA;
- Bitmap aTmp( pA->GetBitmap() );
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pMA;
+ Bitmap aTmp( pA->GetBitmap() );
if( aTmp.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) ) )
WMFRecord_StretchDIB( pA->GetDestPoint(), pA->GetDestSize(), aTmp );
@@ -1416,9 +1416,9 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
case META_BMPEX_ACTION:
{
- const MetaBmpExAction* pA = (const MetaBmpExAction *) pMA;
- Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
- Bitmap aMsk( pA->GetBitmapEx().GetMask() );
+ const MetaBmpExAction* pA = (const MetaBmpExAction *) pMA;
+ Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
+ Bitmap aMsk( pA->GetBitmapEx().GetMask() );
if( !!aMsk )
{
@@ -1434,9 +1434,9 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
case META_BMPEXSCALE_ACTION:
{
- const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pMA;
- Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
- Bitmap aMsk( pA->GetBitmapEx().GetMask() );
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pMA;
+ Bitmap aBmp( pA->GetBitmapEx().GetBitmap() );
+ Bitmap aMsk( pA->GetBitmapEx().GetMask() );
if( !!aMsk )
{
@@ -1452,11 +1452,11 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
case META_BMPEXSCALEPART_ACTION:
{
- const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pMA;
- BitmapEx aBmpEx( pA->GetBitmapEx() );
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pMA;
+ BitmapEx aBmpEx( pA->GetBitmapEx() );
aBmpEx.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
- Bitmap aBmp( aBmpEx.GetBitmap() );
- Bitmap aMsk( aBmpEx.GetMask() );
+ Bitmap aBmp( aBmpEx.GetBitmap() );
+ Bitmap aMsk( aBmpEx.GetMask() );
if( !!aMsk )
{
@@ -1472,8 +1472,8 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
case META_GRADIENT_ACTION:
{
- const MetaGradientAction* pA = (const MetaGradientAction*) pMA;
- GDIMetaFile aTmpMtf;
+ const MetaGradientAction* pA = (const MetaGradientAction*) pMA;
+ GDIMetaFile aTmpMtf;
pVirDev->AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
WriteRecords( aTmpMtf );
@@ -1482,8 +1482,8 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
case META_HATCH_ACTION:
{
- const MetaHatchAction* pA = (const MetaHatchAction*) pMA;
- GDIMetaFile aTmpMtf;
+ const MetaHatchAction* pA = (const MetaHatchAction*) pMA;
+ GDIMetaFile aTmpMtf;
pVirDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
WriteRecords( aTmpMtf );
@@ -1492,10 +1492,10 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
case META_WALLPAPER_ACTION:
{
- const MetaWallpaperAction* pA = (const MetaWallpaperAction*) pMA;
- const Color& rColor = pA->GetWallpaper().GetColor();
- const Color aOldLineColor( aSrcLineColor );
- const Color aOldFillColor( aSrcFillColor );
+ const MetaWallpaperAction* pA = (const MetaWallpaperAction*) pMA;
+ const Color& rColor = pA->GetWallpaper().GetColor();
+ const Color aOldLineColor( aSrcLineColor );
+ const Color aOldFillColor( aSrcFillColor );
aSrcLineColor = rColor;
aSrcFillColor = rColor;
@@ -1729,15 +1729,15 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
case META_FLOATTRANSPARENT_ACTION:
{
const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pMA;
-
- GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
- Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() );
- const Size aSrcSize( aTmpMtf.GetPrefSize() );
- const Point aDestPt( pA->GetPoint() );
- const Size aDestSize( pA->GetSize() );
- const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0;
- const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0;
- long nMoveX, nMoveY;
+
+ GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
+ Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() );
+ const Size aSrcSize( aTmpMtf.GetPrefSize() );
+ const Point aDestPt( pA->GetPoint() );
+ const Size aDestSize( pA->GetSize() );
+ const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0;
+ const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0;
+ long nMoveX, nMoveY;
aSrcLineInfo = LineInfo();
SetAllAttr();
@@ -1815,9 +1815,9 @@ void WMFWriter::WriteHeader( const GDIMetaFile &, BOOL bPlaceable )
{
if( bPlaceable )
{
- USHORT nCheckSum, nValue;
- Size aSize( pVirDev->LogicToLogic(Size(1,1),MapMode(MAP_INCH), aTargetMapMode) );
- USHORT nUnitsPerInch = (USHORT) ( ( aSize.Width() + aSize.Height() ) >> 1 );
+ USHORT nCheckSum, nValue;
+ Size aSize( pVirDev->LogicToLogic(Size(1,1),MapMode(MAP_INCH), aTargetMapMode) );
+ USHORT nUnitsPerInch = (USHORT) ( ( aSize.Width() + aSize.Height() ) >> 1 );
nCheckSum=0;
nValue=0xcdd7; nCheckSum^=nValue; *pWMF << nValue;
@@ -1825,8 +1825,8 @@ void WMFWriter::WriteHeader( const GDIMetaFile &, BOOL bPlaceable )
nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue;
nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue;
nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue;
- nValue=(USHORT) aTargetSize.Width(); nCheckSum^=nValue; *pWMF << nValue;
- nValue=(USHORT) aTargetSize.Height(); nCheckSum^=nValue; *pWMF << nValue;
+ nValue=(USHORT) aTargetSize.Width(); nCheckSum^=nValue; *pWMF << nValue;
+ nValue=(USHORT) aTargetSize.Height(); nCheckSum^=nValue; *pWMF << nValue;
nValue=nUnitsPerInch; nCheckSum^=nValue; *pWMF << nValue;
nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue;
nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue;
@@ -1837,9 +1837,9 @@ void WMFWriter::WriteHeader( const GDIMetaFile &, BOOL bPlaceable )
*pWMF << (sal_uInt16)0x0001 // Typ: Datei
<< (sal_uInt16)0x0009 // Headerlaenge in Worten
<< (sal_uInt16)0x0300 // Version als BCD-Zahl
- << (sal_uInt32) 0x00000000 // Dateilaenge (ohne 1. Header), wird spaeter durch UpdateHeader() berichtigt
+ << (sal_uInt32) 0x00000000 // Dateilaenge (ohne 1. Header), wird spaeter durch UpdateHeader() berichtigt
<< (sal_uInt16)MAXOBJECTHANDLES // Maximalezahl der gleichzeitigen Objekte
- << (sal_uInt32) 0x00000000 // Maximale Record-laenge, wird spaeter durch UpdateHeader() berichtigt
+ << (sal_uInt32) 0x00000000 // Maximale Record-laenge, wird spaeter durch UpdateHeader() berichtigt
<< (sal_uInt16)0x0000; // Reserved
}
@@ -1908,8 +1908,8 @@ BOOL WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream,
{
aTargetMapMode = MapMode( MAP_INCH );
- const long nUnit = pVirDev->LogicToPixel( Size( 1, 1 ), aTargetMapMode ).Width();
- const Fraction aFrac( 1, nUnit );
+ const long nUnit = pVirDev->LogicToPixel( Size( 1, 1 ), aTargetMapMode ).Width();
+ const Fraction aFrac( 1, nUnit );
aTargetMapMode.SetScaleX( aFrac );
aTargetMapMode.SetScaleY( aFrac );
@@ -1987,7 +1987,7 @@ BOOL WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream,
if ( xStatusIndicator.is() )
xStatusIndicator->end();
-
+
return bStatus;
}
@@ -1996,8 +1996,8 @@ BOOL WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream,
USHORT WMFWriter::CalcSaveTargetMapMode(MapMode& rMapMode,
const Size& rPrefSize)
{
- Fraction aDivFrac(2, 1);
- USHORT nDivisor = 1;
+ Fraction aDivFrac(2, 1);
+ USHORT nDivisor = 1;
Size aSize = pVirDev->LogicToLogic( rPrefSize, aSrcMapMode, rMapMode );
@@ -2023,7 +2023,7 @@ void WMFWriter::WriteEmbeddedEMF( const GDIMetaFile& rMTF )
{
EMFWriter aEMFWriter;
SvMemoryStream aStream;
-
+
if( aEMFWriter.WriteEMF( rMTF, aStream ) )
{
sal_Size nTotalSize = aStream.Tell();
@@ -2059,8 +2059,8 @@ void WMFWriter::WriteEmbeddedEMF( const GDIMetaFile& rMTF )
nCurSize = nRemainingSize;
nRemainingSize = 0;
}
- WriteEMFRecord( aStream,
- nCurSize,
+ WriteEMFRecord( aStream,
+ nCurSize,
nRemainingSize,
nTotalSize,
nRecCounts,
@@ -2069,18 +2069,18 @@ void WMFWriter::WriteEmbeddedEMF( const GDIMetaFile& rMTF )
}
}
}
-
+
// ------------------------------------------------------------------------
void WMFWriter::WriteEMFRecord( SvMemoryStream& rStream, sal_uInt32 nCurSize, sal_uInt32 nRemainingSize,
sal_uInt32 nTotalSize, sal_uInt32 nRecCounts, sal_uInt16 nCheckSum )
{
// according to http://msdn.microsoft.com/en-us/library/dd366152%28PROT.13%29.aspx
- WriteRecordHeader( 0, W_META_ESCAPE );
- *pWMF << (sal_uInt16)W_MFCOMMENT // same as META_ESCAPE_ENHANCED_METAFILE
- << (sal_uInt16)( nCurSize + 34 ) // we will always have a 34 byte escape header:
- << (sal_uInt32) 0x43464D57 // WMFC
- << (sal_uInt32) 0x00000001 // Comment type
+ WriteRecordHeader( 0, W_META_ESCAPE );
+ *pWMF << (sal_uInt16)W_MFCOMMENT // same as META_ESCAPE_ENHANCED_METAFILE
+ << (sal_uInt16)( nCurSize + 34 ) // we will always have a 34 byte escape header:
+ << (sal_uInt32) 0x43464D57 // WMFC
+ << (sal_uInt32) 0x00000001 // Comment type
<< (sal_uInt32) 0x00010000 // version
<< nCheckSum // check sum
<< (sal_uInt32) 0 // flags = 0