summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2010-11-14 02:16:27 +0100
committerMiklos Vajna <vmiklos@frugalware.org>2010-11-30 01:04:36 +0100
commit7b96ed91bf380a4c6c502e8422a58a81b7ac6015 (patch)
tree824cb7a0d8d47c081a3877bfa4d2727018552adf
parent14cb46ed91afc02dd28c32385f00c22173306864 (diff)
RTF: port last changes from CWS
-rw-r--r--editeng/inc/editeng/svxrtf.hxx7
-rw-r--r--editeng/source/editeng/eertfpar.cxx1
-rw-r--r--editeng/source/rtf/makefile.mk10
-rw-r--r--editeng/source/rtf/rtfgrf.cxx36
4 files changed, 41 insertions, 13 deletions
diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx
index 0186cfd2e9..5c92d5a5d7 100644
--- a/editeng/inc/editeng/svxrtf.hxx
+++ b/editeng/inc/editeng/svxrtf.hxx
@@ -37,7 +37,8 @@
#define _SVSTDARR_USHORTS
#include <svl/svstdarr.hxx>
#include <editeng/editengdllapi.h>
-
+#include <utility>
+#include <vector>
class Font;
class Color;
class Graphic;
@@ -105,7 +106,7 @@ struct SvxRTFStyleType
// Bitmap - Mode
-
+typedef ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > PictPropertyNameValuePairs;
struct EDITENG_DLLPUBLIC SvxRTFPictureType
{
// Format der Bitmap
@@ -136,7 +137,7 @@ struct EDITENG_DLLPUBLIC SvxRTFPictureType
USHORT nWidthBytes;
USHORT nScalX, nScalY;
short nCropT, nCropB, nCropL, nCropR;
-
+ PictPropertyNameValuePairs aPropertyPairs;
SvxRTFPictureType() { ResetValues(); }
// alle Werte auf default; wird nach einlesen der Bitmap aufgerufen !
void ResetValues();
diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx
index 45c902a229..d92da4962c 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -55,6 +55,7 @@ void SvxRTFPictureType::ResetValues()
nBitsPerPixel = nPlanes = 1;
nScalX = nScalY = 100; // Skalierung in Prozent
nCropT = nCropB = nCropL = nCropR = 0;
+ aPropertyPairs.clear();
}
ImportInfo::ImportInfo( ImportState eSt, SvParser* pPrsrs, const ESelection& rSel )
diff --git a/editeng/source/rtf/makefile.mk b/editeng/source/rtf/makefile.mk
index 6a05ab66c4..1af1f0c026 100644
--- a/editeng/source/rtf/makefile.mk
+++ b/editeng/source/rtf/makefile.mk
@@ -29,20 +29,16 @@ PRJ=..$/..
PRJNAME=editeng
TARGET=rtf
-
+ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/util$/makefile.pmk
-
# --- Files --------------------------------------------------------
-EXCEPTIONSFILES= \
- $(SLO)$/svxrtf.obj \
- $(SLO)$/rtfgrf.obj
-
SLOFILES= \
- $(EXCEPTIONSFILES) \
+ $(SLO)$/svxrtf.obj \
+ $(SLO)$/rtfgrf.obj \
$(SLO)$/rtfitem.obj
# ==========================================================================
diff --git a/editeng/source/rtf/rtfgrf.cxx b/editeng/source/rtf/rtfgrf.cxx
index 96c52935c1..b7f1162aba 100644
--- a/editeng/source/rtf/rtfgrf.cxx
+++ b/editeng/source/rtf/rtfgrf.cxx
@@ -39,6 +39,7 @@
#include <editeng/svxrtf.hxx>
+using namespace ::rtl;
#ifndef DBG_UTIL
#undef DEBUG_JP
@@ -316,14 +317,26 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType )
if( RTF_SHPPICT == GetStackPtr(0)->nTokenId )
++nValidDataBraket;
-
+ OUString sShapePropertyName, sShapePropertyValue;
+ int nShapePropertyBracket = -1;
while( _nOpenBrakets && IsParserWorking() && bValidBmp )
{
nToken = GetNextToken();
USHORT nVal = USHORT( nTokenValue );
switch( nToken )
{
- case '}': --_nOpenBrakets; break;
+ case '}':
+ --_nOpenBrakets;
+ if( nShapePropertyBracket > 0 && nShapePropertyBracket > _nOpenBrakets )
+ {
+ nShapePropertyBracket = -1;
+ if( sShapePropertyName.getLength() )
+ {
+ rPicType.aPropertyPairs.push_back( ::std::pair< OUString, OUString >( sShapePropertyName, sShapePropertyValue ) );
+ sShapePropertyName = sShapePropertyValue = ::rtl::OUString();
+ }
+ }
+ break;
case '{':
{
if( RTF_IGNOREFLAG != GetNextToken() )
@@ -439,7 +452,24 @@ BOOL SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType )
case RTF_PICCROPB: rPicType.nCropB = (short)nTokenValue; break;
case RTF_PICCROPL: rPicType.nCropL = (short)nTokenValue; break;
case RTF_PICCROPR: rPicType.nCropR = (short)nTokenValue; break;
-
+ case RTF_SP:
+ //read pairs of {\sn Name}{\sv Value}
+ nShapePropertyBracket = _nOpenBrakets;
+ break;
+ case RTF_SN:
+ nToken = GetNextToken();
+ if( nToken != '}' )
+ sShapePropertyName = aToken;
+ else
+ nToken = SkipToken( -1 );
+ break;
+ case RTF_SV:
+ nToken = GetNextToken();
+ if( nToken != '}' )
+ sShapePropertyValue = aToken;
+ else
+ nToken = SkipToken( -1 );
+ break;
case RTF_TEXTTOKEN:
// JP 26.06.98: Bug #51719# - nur TextToken auf 1. Ebene
// auswerten. Alle anderen sind irgendwelche