summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorSven Jacobi <sj@openoffice.org>2000-11-15 12:01:09 +0000
committerSven Jacobi <sj@openoffice.org>2000-11-15 12:01:09 +0000
commitc35416706a6dc85a59aab47a888c989eb5451d2d (patch)
tree1a9b89283baaf2f295e1d8b06d3880f682077f37 /vcl
parent17ccc0bdcae91bfc75b0351334e5852db7142abd (diff)
#79137# added GDI_UNICODE_COMMENT, so that a conversion to ByteString won't be done
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/cvtsvm.cxx86
1 files changed, 80 insertions, 6 deletions
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index f2ac9be53d5d..dfc2dfed85e2 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cvtsvm.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:05:37 $
+ * last change: $Author: sj $ $Date: 2000-11-15 13:01:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -362,6 +362,52 @@ void ImplWriteRasterOpAction( SvStream& rOStm, INT16 nRasterOp )
// ------------------------------------------------------------------------
+sal_Bool ImplWriteUnicodeComment( SvStream& rOStm, const String& rString )
+{
+ sal_uInt32 i, nStringLen = rString.Len();
+ if ( nStringLen )
+ {
+ sal_uInt32 nSize = ( nStringLen << 1 ) + 4;
+ sal_uInt16 nType = GDI_UNICODE_COMMENT;
+
+ rOStm << nType << nSize;
+ for ( i = 0; i < nStringLen; i++ )
+ {
+ sal_Unicode nUni = rString.GetChar( i );
+ rOStm << nUni;
+ }
+ }
+ return nStringLen != 0;
+}
+
+// ------------------------------------------------------------------------
+
+void ImplReadUnicodeComment( sal_uInt32 nStrmPos, SvStream& rIStm, String& rString )
+{
+ sal_uInt32 nOld = rIStm.Tell();
+ if ( nStrmPos )
+ {
+ sal_uInt16 nType;
+ sal_uInt32 nStringLen, nActionSize;
+
+ rIStm.Seek( nStrmPos );
+ rIStm >> nType
+ >> nActionSize;
+
+ nStringLen = ( nActionSize - 4 ) >> 1;
+
+ if ( nStringLen && ( nType == GDI_UNICODE_COMMENT ) )
+ {
+ sal_Unicode* pBuffer = rString.AllocBuffer( nStringLen );
+ while ( nStringLen-- )
+ rIStm >> *pBuffer++;
+ }
+ }
+ rIStm.Seek( nOld );
+}
+
+// ------------------------------------------------------------------------
+
void ImplSkipActions( SvStream& rIStm, ULONG nSkipCount )
{
INT32 nActionSize;
@@ -434,6 +480,9 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
INT32 nTmp, nTmp1, nActionSize;
INT16 nType;
+ sal_uInt32 nUnicodeCommentStreamPos = 0;
+ sal_uInt32 nUnicodeCommentActionNumber = 0;
+
rMtf.SetPrefSize( aPrefSz );
rMtf.SetPrefMapMode( aMapMode );
@@ -652,6 +701,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rIStm >> aPt >> nIndex >> nLen >> nTmp;
rIStm.Read( aByteStr.AllocBuffer( (USHORT)nTmp ), nTmp + 1 );
UniString aStr( aByteStr, eActualCharSet );
+ if ( nUnicodeCommentActionNumber == i )
+ ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
rMtf.AddAction( new MetaTextAction( aPt, aStr, (USHORT) nIndex, (USHORT) nLen ) );
}
break;
@@ -673,7 +724,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
for( long i = 0L; i < nAryLen; i++ )
rIStm >> nTmp, pDXAry[ i ] = nTmp;
}
-
+ if ( nUnicodeCommentActionNumber == i )
+ ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
rMtf.AddAction( new MetaTextArrayAction( aPt, aStr, pDXAry, (USHORT) nIndex, (USHORT) nLen ) );
if( pDXAry )
@@ -689,6 +741,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rIStm >> aPt >> nIndex >> nLen >> nTmp >> nWidth;
rIStm.Read( aByteStr.AllocBuffer( (USHORT)nTmp ), nTmp + 1 );
UniString aStr( aByteStr, eActualCharSet );
+ if ( nUnicodeCommentActionNumber == i )
+ ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
rMtf.AddAction( new MetaStretchTextAction( aPt, nWidth, aStr, (USHORT) nIndex, (USHORT) nLen ) );
}
break;
@@ -1056,6 +1110,14 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
}
break;
+ case ( GDI_UNICODE_COMMENT ):
+ {
+ nUnicodeCommentActionNumber = i + 1;
+ nUnicodeCommentStreamPos = rIStm.Tell() - 6;
+ rIStm.SeekRel( nActionSize - 4 );
+ }
+ break;
+
default:
rIStm.SeekRel( nActionSize - 4L );
break;
@@ -1317,9 +1379,13 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
case( META_TEXT_ACTION ):
{
MetaTextAction* pAct = (MetaTextAction*) pAction;
- ByteString aText( pAct->GetText(), rActualCharSet );
+ String aUniText( pAct->GetText() );
+ ByteString aText( aUniText, rActualCharSet );
const ULONG nStrLen = aText.Len();
+ if ( ImplWriteUnicodeComment( rOStm, aUniText ) )
+ nCount++;
+
rOStm << (INT16) GDI_TEXT_ACTION;
rOStm << (INT32) ( 24 + ( nStrLen + 1 ) );
rOStm << pAct->GetPoint();
@@ -1334,12 +1400,16 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
case( META_TEXTARRAY_ACTION ):
{
MetaTextArrayAction* pAct = (MetaTextArrayAction*)pAction;
- ByteString aText( pAct->GetText(), rActualCharSet );
+ String aUniText( pAct->GetText() );
+ ByteString aText( aUniText, rActualCharSet );
ULONG nAryLen;
ULONG nLen = pAct->GetLen();
const ULONG nTextLen = aText.Len();
long* pDXArray = pAct->GetDXArray();
+ if ( ImplWriteUnicodeComment( rOStm, aUniText ) )
+ nCount++;
+
if( ( nLen + pAct->GetIndex() ) > nTextLen )
{
if( pAct->GetIndex() <= nTextLen )
@@ -1372,9 +1442,13 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
case( META_STRETCHTEXT_ACTION ):
{
MetaStretchTextAction* pAct = (MetaStretchTextAction*) pAction;
- ByteString aText( pAct->GetText(), rActualCharSet );
+ String aUniText( pAct->GetText() );
+ ByteString aText( aUniText, rActualCharSet );
const ULONG nStrLen = aText.Len();
+ if ( ImplWriteUnicodeComment( rOStm, aUniText ) )
+ nCount++;
+
rOStm << (INT16) GDI_STRETCHTEXT_ACTION;
rOStm << (INT32) ( 28 + ( nStrLen + 1 ) );
rOStm << pAct->GetPoint();