diff options
author | Mikhail Voytenko <mav@openoffice.org> | 2011-01-06 14:57:12 +0100 |
---|---|---|
committer | Mikhail Voytenko <mav@openoffice.org> | 2011-01-06 14:57:12 +0100 |
commit | 8ff51afa0dcd4e5e644e923131ee72435c80b57b (patch) | |
tree | d63f6b6e298485b5f29f60c7af25baca46f59375 /editeng | |
parent | fa1f3c352c6126b24ab5af87ea4ebea742c546c2 (diff) | |
parent | 794c821e4d48c34aa376cdc7b6ab2cb029d9574d (diff) |
removetooltypes01: rebase to DEV300_m96
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/svxrtf.hxx | 9 | ||||
-rw-r--r-- | editeng/inc/pch/precompiled_editeng.hxx | 1 | ||||
-rw-r--r-- | editeng/source/editeng/eertfpar.cxx | 1 | ||||
-rw-r--r-- | editeng/source/items/flditem.cxx | 109 | ||||
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 2 | ||||
-rw-r--r-- | editeng/source/rtf/makefile.mk | 3 | ||||
-rw-r--r-- | editeng/source/rtf/rtfgrf.cxx | 36 | ||||
-rw-r--r-- | editeng/source/rtf/rtfitem.cxx | 12 | ||||
-rw-r--r-- | editeng/source/rtf/svxrtf.cxx | 10 |
9 files changed, 83 insertions, 100 deletions
diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx index f1214f1283a6..62bc6efcd4bf 100644 --- a/editeng/inc/editeng/svxrtf.hxx +++ b/editeng/inc/editeng/svxrtf.hxx @@ -38,7 +38,8 @@ #include <editeng/editengdllapi.h> #include <deque> - +#include <utility> +#include <vector> class Font; class Color; class Graphic; @@ -109,7 +110,7 @@ struct SvxRTFStyleType // Bitmap - Mode - +typedef ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > PictPropertyNameValuePairs; struct EDITENG_DLLPUBLIC SvxRTFPictureType { // Format der Bitmap @@ -140,7 +141,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(); @@ -469,7 +470,7 @@ inline const Color& SvxRTFParser::GetColor( size_t nId ) const inline SfxItemSet& SvxRTFParser::GetAttrSet() { SvxRTFItemStackTypePtr pTmp; - if( bNewGroup || 0 == ( pTmp = aAttrStack.back()) ) + if( bNewGroup || 0 == ( pTmp = aAttrStack.empty() ? 0 : aAttrStack.back()) ) pTmp = _GetAttrSet(); return pTmp->aAttrSet; } diff --git a/editeng/inc/pch/precompiled_editeng.hxx b/editeng/inc/pch/precompiled_editeng.hxx index 9d432f73a731..d53bfcf1aaf2 100644 --- a/editeng/inc/pch/precompiled_editeng.hxx +++ b/editeng/inc/pch/precompiled_editeng.hxx @@ -694,7 +694,6 @@ #include "svtools/apearcfg.hxx" #include "svl/brdcst.hxx" #include "unotools/cacheoptions.hxx" -#include "svl/cancel.hxx" #include "svl/cjkoptions.hxx" #include "unotools/cmdoptions.hxx" #include "svl/cntwall.hxx" diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index 9f919afb39d6..817949294444 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -54,6 +54,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/items/flditem.cxx b/editeng/source/items/flditem.cxx index 5cb45144abab..132a6d0ee38c 100644 --- a/editeng/source/items/flditem.cxx +++ b/editeng/source/items/flditem.cxx @@ -377,83 +377,46 @@ int SvxURLField::operator==( const SvxFieldData& rOther ) const // ----------------------------------------------------------------------- -void SvxURLField::Load( SvPersistStream & rStm ) +static void write_unicode( SvPersistStream & rStm, const String& rString ) { - USHORT nFormat; - sal_uInt32 nFrameMarker, nCharSetMarker; - long nUlongSize = (long)sizeof(sal_uInt32); - String aTmpURL; - - rStm >> nFormat; - - // UNICODE: rStm >> aTmpURL; - rStm.ReadByteString(aTmpURL); - - // UNICODE: rStm >> aRepresentation; - // read to a temp string first, read text encoding and - // convert later to stay compatible to fileformat - ByteString aTempString; - rtl_TextEncoding aTempEncoding = RTL_TEXTENCODING_MS_1252; // #101493# Init for old documents - rStm.ReadByteString(aTempString); + USHORT nL = rString.Len(); + rStm << nL; + rStm.Write( rString.GetBuffer(), nL*sizeof(sal_Unicode) ); +} - rStm >> nFrameMarker; - if ( nFrameMarker == FRAME_MARKER ) +static void read_unicode( SvPersistStream & rStm, String& rString ) +{ + USHORT nL = 0; + rStm >> nL; + if ( nL ) { - // UNICODE: rStm >> aTargetFrame; - rStm.ReadByteString(aTargetFrame); - - rStm >> nCharSetMarker; - if ( nCharSetMarker == CHARSET_MARKER ) - { - USHORT nCharSet; - rStm >> nCharSet; - - // remember encoding - aTempEncoding = (rtl_TextEncoding)nCharSet; - } - else - rStm.SeekRel( -nUlongSize ); + rString.AllocBuffer( nL ); + rStm.Read( rString.GetBufferAccess(), nL*sizeof(sal_Unicode) ); + rString.ReleaseBufferAccess( nL ); } - else - rStm.SeekRel( -nUlongSize ); +} - // now build representation string due to known encoding - aRepresentation = String(aTempString, aTempEncoding); +void SvxURLField::Load( SvPersistStream & rStm ) +{ + USHORT nFormat = 0; + rStm >> nFormat; eFormat= (SvxURLFormat)nFormat; - // Relatives Speichern => Beim laden absolut machen. - DBG_ERROR("No BaseURL!"); - // TODO/MBA: no BaseURL - aURL = INetURLObject::GetAbsURL( String(), aTmpURL ); + read_unicode( rStm, aURL ); + read_unicode( rStm, aRepresentation ); + read_unicode( rStm, aTargetFrame ); } // ----------------------------------------------------------------------- void SvxURLField::Save( SvPersistStream & rStm ) { - // Relatives Speichern der URL - DBG_ERROR("No BaseURL!"); - // TODO/MBA: no BaseURL - String aTmpURL = INetURLObject::GetRelURL( String(), aURL ); - rStm << (USHORT)eFormat; - // UNICODE: rStm << aTmpURL; - rStm.WriteByteString(aTmpURL); - - // UNICODE: rStm << aRepresentation; - rStm.WriteByteString(aRepresentation); - - rStm << FRAME_MARKER; - - // UNICODE: rStm << aTargetFrame; - rStm.WriteByteString(aTargetFrame); - - rStm << CHARSET_MARKER; - - // #90477# rStm << (USHORT)GetStoreCharSet(gsl_getSystemTextEncoding(), rStm.GetVersion()); - rStm << (USHORT)GetSOStoreTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rStm.GetVersion()); + write_unicode( rStm, aURL ); + write_unicode( rStm, aRepresentation ); + write_unicode( rStm, aTargetFrame ); } MetaAction* SvxURLField::createBeginComment() const @@ -921,16 +884,11 @@ int SvxAuthorField::operator==( const SvxFieldData& rOther ) const void SvxAuthorField::Load( SvPersistStream & rStm ) { - USHORT nType, nFormat; - - // UNICODE: rStm >> aName; - rStm.ReadByteString(aName); + USHORT nType = 0, nFormat = 0; - // UNICODE: rStm >> aFirstName; - rStm.ReadByteString(aFirstName); - - // UNICODE: rStm >> aShortName; - rStm.ReadByteString(aShortName); + read_unicode( rStm, aName ); + read_unicode( rStm, aFirstName ); + read_unicode( rStm, aShortName ); rStm >> nType; rStm >> nFormat; @@ -943,14 +901,9 @@ void SvxAuthorField::Load( SvPersistStream & rStm ) void SvxAuthorField::Save( SvPersistStream & rStm ) { - // UNICODE: rStm << aName; - rStm.WriteByteString(aName); - - // UNICODE: rStm << aFirstName; - rStm.WriteByteString(aFirstName); - - // UNICODE: rStm << aShortName; - rStm.WriteByteString(aShortName); + write_unicode( rStm, aName ); + write_unicode( rStm, aFirstName ); + write_unicode( rStm, aShortName ); rStm << (USHORT) eType; rStm << (USHORT) eFormat; diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index ae977b2ed0d7..f2481e79eb22 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -701,7 +701,7 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace( bRunNext = true; } } - else if ( cChar == '/' ) + else if ( cChar == '/' && nEndPos > 1 && rTxt.Len() > (nEndPos - 1) ) { // Remove the hardspace right before to avoid formatting URLs sal_Unicode cPrevChar = rTxt.GetChar( nEndPos - 1 ); diff --git a/editeng/source/rtf/makefile.mk b/editeng/source/rtf/makefile.mk index 38b2ef7b45bc..081cd5b506cd 100644 --- a/editeng/source/rtf/makefile.mk +++ b/editeng/source/rtf/makefile.mk @@ -29,12 +29,11 @@ PRJ=..$/.. PRJNAME=editeng TARGET=rtf - +ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/makefile.pmk - # --- Files -------------------------------------------------------- EXCEPTIONSFILES= \ diff --git a/editeng/source/rtf/rtfgrf.cxx b/editeng/source/rtf/rtfgrf.cxx index 24fd4465b031..4b0051cd3c81 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 diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index 3141ab20afcd..58789fab2106 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -228,7 +228,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) RTF_CharTypeDef eCharType = NOTDEF_CHARTYPE; USHORT nFontAlign; - int bChkStkPos = !bNewGroup && aAttrStack.back(); + int bChkStkPos = !bNewGroup && !aAttrStack.empty(); while( bWeiter && IsParserWorking() ) // solange bekannte Attribute erkannt werden { @@ -250,7 +250,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if( !bChkStkPos ) break; - SvxRTFItemStackType* pAkt = aAttrStack.back(); + SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); if( !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() && pAkt->nSttCnt == pInsPos->GetCntIdx() )) break; @@ -269,7 +269,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) // alle bis hierher gueltigen Attribute "setzen" AttrGroupEnd(); - pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); aAttrStack.push_back( pNew ); @@ -305,7 +305,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) nStyleNo = -1 == nTokenValue ? 0 : USHORT(nTokenValue); // setze am akt. auf dem AttrStack stehenden Style die // StyleNummer - SvxRTFItemStackType* pAkt = aAttrStack.back(); + SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); if( !pAkt ) break; @@ -1869,7 +1869,7 @@ void SvxRTFParser::ReadBackgroundAttr( int nToken, SfxItemSet& rSet, // pard / plain abarbeiten void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) { - if( !bNewGroup && aAttrStack.back() ) // not at the beginning of a new group + if( !bNewGroup && !aAttrStack.empty() ) // not at the beginning of a new group { SvxRTFItemStackType* pAkt = aAttrStack.back(); @@ -1887,7 +1887,7 @@ void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) // alle bis hierher gueltigen Attribute "setzen" AttrGroupEnd(); - pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); aAttrStack.push_back( pNew ); pAkt = pNew; diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index 14b17807a0ea..2788d2fd4b10 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -875,7 +875,7 @@ const Font& SvxRTFParser::GetFont( USHORT nId ) SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( int bCopyAttr ) { - SvxRTFItemStackType* pAkt = aAttrStack.back(); + SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); SvxRTFItemStackType* pNew; if( pAkt ) pNew = new SvxRTFItemStackType( *pAkt, *pInsPos, bCopyAttr ); @@ -941,9 +941,9 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen { if( !aAttrStack.empty() ) { - SvxRTFItemStackType *pOld = aAttrStack.back(); + SvxRTFItemStackType *pOld = aAttrStack.empty() ? 0 : aAttrStack.back(); aAttrStack.pop_back(); - SvxRTFItemStackType *pAkt = aAttrStack.back(); + SvxRTFItemStackType *pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); do { // middle check loop ULONG nOldSttNdIdx = pOld->pSttNd->GetIdx(); @@ -1118,7 +1118,7 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen // alle bis hierher gueltigen Attribute "setzen" AttrGroupEnd(); - pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); aAttrStack.push_back( pNew ); pAkt = pNew; @@ -1181,7 +1181,7 @@ void SvxRTFParser::SetAttrSet( SvxRTFItemStackType &rSet ) // Is text wasn't inserted? (Get SttPos from the top of stack!) int SvxRTFParser::IsAttrSttPos() { - SvxRTFItemStackType* pAkt = aAttrStack.back(); + SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); return !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() && pAkt->nSttCnt == pInsPos->GetCntIdx()); } |