Kaydet (Commit) 759aed9b authored tarafından Tor Lillqvist's avatar Tor Lillqvist Kaydeden (comit) Tor Lillqvist

De-duplicate _ReadFieldParams

Change-Id: Ib08f5ab8e6155f1b9be100377657678b8c480060
üst 1f1ebf7d
...@@ -108,7 +108,7 @@ class SwAttrSet; ...@@ -108,7 +108,7 @@ class SwAttrSet;
class GDIMetaFile; class GDIMetaFile;
struct ESelection; struct ESelection;
class SfxItemSet; class SfxItemSet;
class _ReadFieldParams; class WW8ReadFieldParams;
class wwZOrderer; class wwZOrderer;
class OutlinerParaObject; class OutlinerParaObject;
...@@ -1691,8 +1691,8 @@ public: // eigentlich private, geht aber leider nur public ...@@ -1691,8 +1691,8 @@ public: // eigentlich private, geht aber leider nur public
eF_ResT Read_F_DBNext( WW8FieldDesc*, String& ); eF_ResT Read_F_DBNext( WW8FieldDesc*, String& );
eF_ResT Read_F_DBNum( WW8FieldDesc*, String& ); eF_ResT Read_F_DBNum( WW8FieldDesc*, String& );
eF_ResT Read_F_Equation( WW8FieldDesc*, String& ); eF_ResT Read_F_Equation( WW8FieldDesc*, String& );
void Read_SubF_Ruby( _ReadFieldParams& rReadParam); void Read_SubF_Ruby( WW8ReadFieldParams& rReadParam);
void Read_SubF_Combined( _ReadFieldParams& rReadParam); void Read_SubF_Combined( WW8ReadFieldParams& rReadParam);
eF_ResT Read_F_IncludePicture( WW8FieldDesc*, String& rStr ); eF_ResT Read_F_IncludePicture( WW8FieldDesc*, String& rStr );
eF_ResT Read_F_IncludeText( WW8FieldDesc*, String& rStr ); eF_ResT Read_F_IncludeText( WW8FieldDesc*, String& rStr );
eF_ResT Read_F_Seq( WW8FieldDesc*, String& rStr ); eF_ResT Read_F_Seq( WW8FieldDesc*, String& rStr );
......
...@@ -78,17 +78,17 @@ SwVbaField::getServiceNames() ...@@ -78,17 +78,17 @@ SwVbaField::getServiceNames()
return aServiceNames; return aServiceNames;
} }
// *** _ReadFieldParams *********************************************** // *** SwVbaReadFieldParams ***********************************************
// the codes are copied from ww8par5.cxx // the codes are copied from ww8par5.cxx
class _ReadFieldParams class SwVbaReadFieldParams
{ {
private: private:
String aData; String aData;
xub_StrLen nLen, nFnd, nNext, nSavPtr; xub_StrLen nLen, nFnd, nNext, nSavPtr;
String aFieldName; String aFieldName;
public: public:
_ReadFieldParams( const String& rData ); SwVbaReadFieldParams( const String& rData );
~_ReadFieldParams(); ~SwVbaReadFieldParams();
xub_StrLen GoToTokenParam(); xub_StrLen GoToTokenParam();
long SkipToNextToken(); long SkipToNextToken();
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
}; };
_ReadFieldParams::_ReadFieldParams( const String& _rData ) SwVbaReadFieldParams::SwVbaReadFieldParams( const String& _rData )
: aData( _rData ), nLen( _rData.Len() ), nNext( 0 ) : aData( _rData ), nLen( _rData.Len() ), nNext( 0 )
{ {
/* /*
...@@ -129,12 +129,12 @@ _ReadFieldParams::_ReadFieldParams( const String& _rData ) ...@@ -129,12 +129,12 @@ _ReadFieldParams::_ReadFieldParams( const String& _rData )
} }
_ReadFieldParams::~_ReadFieldParams() SwVbaReadFieldParams::~SwVbaReadFieldParams()
{ {
} }
String _ReadFieldParams::GetResult() const String SwVbaReadFieldParams::GetResult() const
{ {
return (STRING_NOTFOUND == nFnd) return (STRING_NOTFOUND == nFnd)
? aEmptyStr ? aEmptyStr
...@@ -142,7 +142,7 @@ String _ReadFieldParams::GetResult() const ...@@ -142,7 +142,7 @@ String _ReadFieldParams::GetResult() const
} }
xub_StrLen _ReadFieldParams::GoToTokenParam() xub_StrLen SwVbaReadFieldParams::GoToTokenParam()
{ {
xub_StrLen nOld = nNext; xub_StrLen nOld = nNext;
if( -2 == SkipToNextToken() ) if( -2 == SkipToNextToken() )
...@@ -152,7 +152,7 @@ xub_StrLen _ReadFieldParams::GoToTokenParam() ...@@ -152,7 +152,7 @@ xub_StrLen _ReadFieldParams::GoToTokenParam()
} }
// ret: -2: NOT a '\' parameter but normal Text // ret: -2: NOT a '\' parameter but normal Text
long _ReadFieldParams::SkipToNextToken() long SwVbaReadFieldParams::SkipToNextToken()
{ {
long nRet = -1; // Ende long nRet = -1; // Ende
if ( if (
...@@ -194,7 +194,7 @@ long _ReadFieldParams::SkipToNextToken() ...@@ -194,7 +194,7 @@ long _ReadFieldParams::SkipToNextToken()
// Returnwert: 0 falls String-Ende erreicht, // Returnwert: 0 falls String-Ende erreicht,
// ansonsten Anfang des Paramters bzw. der Zeichenkette // ansonsten Anfang des Paramters bzw. der Zeichenkette
// //
xub_StrLen _ReadFieldParams::FindNextStringPiece(const xub_StrLen nStart) xub_StrLen SwVbaReadFieldParams::FindNextStringPiece(const xub_StrLen nStart)
{ {
xub_StrLen n = ( STRING_NOTFOUND == nStart ) ? nFnd : nStart; // Anfang xub_StrLen n = ( STRING_NOTFOUND == nStart ) ? nFnd : nStart; // Anfang
xub_StrLen n2; // Ende xub_StrLen n2; // Ende
...@@ -250,7 +250,7 @@ xub_StrLen _ReadFieldParams::FindNextStringPiece(const xub_StrLen nStart) ...@@ -250,7 +250,7 @@ xub_StrLen _ReadFieldParams::FindNextStringPiece(const xub_StrLen nStart)
// read parameters "1-3" or 1-3 with both values between 1 and nMax // read parameters "1-3" or 1-3 with both values between 1 and nMax
bool _ReadFieldParams::GetTokenSttFromTo(sal_uInt16* pFrom, sal_uInt16* pTo, sal_uInt16 nMax) bool SwVbaReadFieldParams::GetTokenSttFromTo(sal_uInt16* pFrom, sal_uInt16* pTo, sal_uInt16 nMax)
{ {
sal_uInt16 nStart = 0; sal_uInt16 nStart = 0;
sal_uInt16 nEnd = 0; sal_uInt16 nEnd = 0;
...@@ -377,7 +377,7 @@ SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, ...@@ -377,7 +377,7 @@ SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range,
String sFieldName; String sFieldName;
if( ( nType == word::WdFieldType::wdFieldEmpty ) && !sText.isEmpty() ) if( ( nType == word::WdFieldType::wdFieldEmpty ) && !sText.isEmpty() )
{ {
_ReadFieldParams aReadParam(sText); SwVbaReadFieldParams aReadParam(sText);
sFieldName = aReadParam.GetFieldName(); sFieldName = aReadParam.GetFieldName();
OSL_TRACE("SwVbaFields::Add, the field name is %s ",rtl::OUStringToOString( sFieldName, RTL_TEXTENCODING_UTF8 ).getStr() ); OSL_TRACE("SwVbaFields::Add, the field name is %s ",rtl::OUStringToOString( sFieldName, RTL_TEXTENCODING_UTF8 ).getStr() );
} }
...@@ -410,7 +410,7 @@ uno::Reference< text::XTextField > SwVbaFields::Create_Field_FileName( const rtl ...@@ -410,7 +410,7 @@ uno::Reference< text::XTextField > SwVbaFields::Create_Field_FileName( const rtl
if( !_text.isEmpty() ) if( !_text.isEmpty() )
{ {
long nRet; long nRet;
_ReadFieldParams aReadParam( _text ); SwVbaReadFieldParams aReadParam( _text );
while (-1 != (nRet = aReadParam.SkipToNextToken())) while (-1 != (nRet = aReadParam.SkipToNextToken()))
{ {
switch (nRet) switch (nRet)
...@@ -475,7 +475,7 @@ static const DocPropertyTable aDocPropertyTables[] = ...@@ -475,7 +475,7 @@ static const DocPropertyTable aDocPropertyTables[] =
uno::Reference< text::XTextField > SwVbaFields::Create_Field_DocProperty( const rtl::OUString _text ) throw (uno::RuntimeException) uno::Reference< text::XTextField > SwVbaFields::Create_Field_DocProperty( const rtl::OUString _text ) throw (uno::RuntimeException)
{ {
String aDocProperty; String aDocProperty;
_ReadFieldParams aReadParam( _text ); SwVbaReadFieldParams aReadParam( _text );
long nRet; long nRet;
while( -1 != ( nRet = aReadParam.SkipToNextToken() )) while( -1 != ( nRet = aReadParam.SkipToNextToken() ))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment