String to OUString and some reduction of scope
Change-Id: Ia760c5f3f8c158bea30be3102841a66330e5180a
Reviewed-on: https://gerrit.libreoffice.org/5339
Reviewed-by: Tor Lillqvist <tml@iki.fi>
Tested-by: Tor Lillqvist <tml@iki.fi>
diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx
index bd01dad..a02912d 100644
--- a/sw/inc/dbgoutsw.hxx
+++ b/sw/inc/dbgoutsw.hxx
@@ -24,7 +24,7 @@
#include <boost/unordered_map.hpp>
#include <tox.hxx>
#include <cstdio>
class String;
#include "tools/string.hxx"
class SwNode;
class SwTxtAttr;
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index e80ce34..89f6c05 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1399,8 +1399,8 @@ public:
const SwAttrSet& GetTOXBaseAttrSet(const SwTOXBase& rTOX) const;
bool DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes = false );
String GetUniqueTOXBaseName( const SwTOXType& rType,
const String& rChkStr ) const;
OUString GetUniqueTOXBaseName( const SwTOXType& rType,
const OUString sChkStr ) const;
bool SetTOXBaseName(const SwTOXBase& rTOXBase, const String& rName);
void SetTOXBaseProtection(const SwTOXBase& rTOXBase, sal_Bool bProtect);
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index c623168..047cc15 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -23,7 +23,6 @@
#include <i18nlangtag/lang.h>
#include <svl/poolitem.hxx>
#include <tools/string.hxx>
#include <editeng/svxenum.hxx>
#include <swtypes.hxx>
@@ -54,13 +53,14 @@ class SW_DLLPUBLIC SwTOXMark
friend void _InitCore();
friend class SwTxtTOXMark;
String aAltText; // Text of caption is different.
String aPrimaryKey, aSecondaryKey;
OUString aAltText; // Text of caption is different.
OUString aPrimaryKey;
OUString aSecondaryKey;
// three more strings for phonetic sorting
String aTextReading;
String aPrimaryKeyReading;
String aSecondaryKeyReading;
OUString aTextReading;
OUString aPrimaryKeyReading;
OUString aSecondaryKeyReading;
SwTxtTOXMark* pTxtAttr;
@@ -93,29 +93,29 @@ public:
void InvalidateTOXMark();
String GetText() const;
OUString GetText() const;
inline sal_Bool IsAlternativeText() const;
inline const String& GetAlternativeText() const;
inline OUString GetAlternativeText() const;
inline void SetAlternativeText( const String& rAlt );
inline void SetAlternativeText( const OUString& rAlt );
// content or user defined index
inline void SetLevel(sal_uInt16 nLevel);
inline sal_uInt16 GetLevel() const;
// for alphabetical index only
inline void SetPrimaryKey(const String& rStr );
inline void SetSecondaryKey(const String& rStr);
inline void SetTextReading(const String& rStr);
inline void SetPrimaryKeyReading(const String& rStr );
inline void SetSecondaryKeyReading(const String& rStr);
inline void SetPrimaryKey(const OUString& rStr );
inline void SetSecondaryKey(const OUString& rStr);
inline void SetTextReading(const OUString& rStr);
inline void SetPrimaryKeyReading(const OUString& rStr );
inline void SetSecondaryKeyReading(const OUString& rStr);
inline const String& GetPrimaryKey() const;
inline const String& GetSecondaryKey() const;
inline const String& GetTextReading() const;
inline const String& GetPrimaryKeyReading() const;
inline const String& GetSecondaryKeyReading() const;
inline OUString GetPrimaryKey() const;
inline OUString GetSecondaryKey() const;
inline OUString GetTextReading() const;
inline OUString GetPrimaryKeyReading() const;
inline OUString GetSecondaryKeyReading() const;
sal_Bool IsAutoGenerated() const {return bAutoGenerated;}
void SetAutoGenerated(sal_Bool bSet) {bAutoGenerated = bSet;}
@@ -146,16 +146,16 @@ public:
class SwTOXType : public SwModify
{
public:
SwTOXType(TOXTypes eTyp, const String& aName);
SwTOXType(TOXTypes eTyp, const OUString& aName);
// @@@ public copy ctor, but no copy assignment?
SwTOXType(const SwTOXType& rCopy);
inline const String& GetTypeName() const;
inline OUString GetTypeName() const;
inline TOXTypes GetType() const;
private:
String aName;
OUString aName;
TOXTypes eType;
// @@@ public copy ctor, but no copy assignment?
@@ -205,8 +205,8 @@ enum FormTokenType
struct SW_DLLPUBLIC SwFormToken
{
String sText;
String sCharStyleName;
OUString sText;
OUString sCharStyleName;
SwTwips nTabStopPosition;
FormTokenType eTokenType;
sal_uInt16 nPoolId;
@@ -231,7 +231,7 @@ struct SW_DLLPUBLIC SwFormToken
bWithTab(sal_True) // #i21237#
{}
String GetString() const;
OUString GetString() const;
};
struct SwFormTokenEqualToFormTokenType
@@ -253,8 +253,8 @@ struct SwFormTokenEqualToFormTokenType
*/
struct SwFormTokenToString
{
String & rText;
SwFormTokenToString(String & _rText) : rText(_rText) {}
OUString & rText;
SwFormTokenToString(OUString & _rText) : rText(_rText) {}
void operator()(const SwFormToken & rToken) { rText += rToken.GetString(); }
};
@@ -278,8 +278,8 @@ class SW_DLLPUBLIC SwFormTokensHelper
@return the token
*/
SW_DLLPRIVATE SwFormToken BuildToken( const String & sPattern,
xub_StrLen & nCurPatternPos ) const;
SW_DLLPRIVATE SwFormToken BuildToken( const OUString & sPattern,
sal_Int32 & nCurPatternPos ) const;
/**
Returns the string of a token.
@@ -289,8 +289,8 @@ class SW_DLLPUBLIC SwFormTokensHelper
@return the string representation of the token
*/
SW_DLLPRIVATE String SearchNextToken( const String & sPattern,
xub_StrLen nStt ) const;
SW_DLLPRIVATE OUString SearchNextToken( const OUString & sPattern,
sal_Int32 nStt ) const;
/**
Returns the type of a token.
@@ -303,8 +303,8 @@ class SW_DLLPUBLIC SwFormTokensHelper
@return the type of the token
*/
SW_DLLPRIVATE FormTokenType GetTokenType(const String & sToken,
xub_StrLen * pTokenLen) const;
SW_DLLPRIVATE FormTokenType GetTokenType(const OUString & sToken,
sal_Int32 * pTokenLen) const;
public:
/**
@@ -319,7 +319,7 @@ public:
@param rStr string representation of the tokens
*/
SwFormTokensHelper(const String & rStr);
SwFormTokensHelper(const OUString & rStr);
/**
Returns vector of tokens.
@@ -332,7 +332,7 @@ public:
class SW_DLLPUBLIC SwForm
{
SwFormTokens aPattern[ AUTH_TYPE_END + 1 ]; // #i21237#
String aTemplate[ AUTH_TYPE_END + 1 ];
OUString aTemplate[ AUTH_TYPE_END + 1 ];
TOXTypes eType;
sal_uInt16 nFormMaxLevel;
@@ -347,12 +347,12 @@ public:
SwForm& operator=( const SwForm& rForm );
inline void SetTemplate(sal_uInt16 nLevel, const String& rName);
inline const String& GetTemplate(sal_uInt16 nLevel) const;
inline void SetTemplate(sal_uInt16 nLevel, const OUString& rName);
inline OUString GetTemplate(sal_uInt16 nLevel) const;
// #i21237#
void SetPattern(sal_uInt16 nLevel, const SwFormTokens& rName);
void SetPattern(sal_uInt16 nLevel, const String& rStr);
void SetPattern(sal_uInt16 nLevel, const OUString& rStr);
const SwFormTokens& GetPattern(sal_uInt16 nLevel) const;
// fill tab stop positions from template to pattern
@@ -371,26 +371,16 @@ public:
static sal_uInt16 GetFormMaxLevel( TOXTypes eType );
static const sal_Char* aFormEntry; // <E>
static sal_uInt8 nFormEntryLen; // 3 characters
static const sal_Char* aFormTab; // <T>
static sal_uInt8 nFormTabLen; // 3 characters
static const sal_Char* aFormPageNums; // <P>
static sal_uInt8 nFormPageNumsLen; // 3 characters
static const sal_Char* aFormLinkStt; // <LS>
static sal_uInt8 nFormLinkSttLen; // 4 characters
static const sal_Char* aFormLinkEnd; // <LE>
static sal_uInt8 nFormLinkEndLen; // 4 characters
static const sal_Char* aFormEntryNum; // <E#>
static sal_uInt8 nFormEntryNumLen; // 4 characters
static const sal_Char* aFormEntryTxt; // <ET>
static sal_uInt8 nFormEntryTxtLen; // 4 characters
static const sal_Char* aFormChapterMark; // <C>
static sal_uInt8 nFormChapterMarkLen; // 3 characters
static const sal_Char* aFormText; // <TX>
static sal_uInt8 nFormTextLen; // 4 characters
static const sal_Char* aFormAuth; // <Axx> xx - decimal enum value
static sal_uInt8 nFormAuthLen; // 3 characters
static OUString GetFormEntry();
static OUString GetFormTab();
static OUString GetFormPageNums();
static OUString GetFormLinkStt();
static OUString GetFormLinkEnd();
static OUString GetFormEntryNum();
static OUString GetFormEntryTxt();
static OUString GetFormChapterMark();
static OUString GetFormText();
static OUString GetFormAuth();
};
/*--------------------------------------------------------------------
@@ -449,16 +439,16 @@ namespace nsSwTOOElements
class SW_DLLPUBLIC SwTOXBase : public SwClient
{
SwForm aForm; // description of the lines
String aName; // unique name
String aTitle; // title
OUString aName; // unique name
OUString aTitle; // title
String sMainEntryCharStyle; // name of the character style applied to main index entries
OUString sMainEntryCharStyle; // name of the character style applied to main index entries
String aStyleNames[MAXLEVEL]; // (additional) style names TOX_CONTENT, TOX_USER
String sSequenceName; // FieldTypeName of a caption sequence
OUString aStyleNames[MAXLEVEL]; // (additional) style names TOX_CONTENT, TOX_USER
OUString sSequenceName; // FieldTypeName of a caption sequence
LanguageType eLanguage;
String sSortAlgorithm;
OUString sSortAlgorithm;
union {
sal_uInt16 nLevel; // consider outline levels
@@ -475,7 +465,7 @@ class SW_DLLPUBLIC SwTOXBase : public SwClient
sal_Bool bLevelFromChapter : 1; // User index: get the level from the source chapter
public:
SwTOXBase( const SwTOXType* pTyp, const SwForm& rForm,
sal_uInt16 nCreaType, const String& rTitle );
sal_uInt16 nCreaType, const OUString& rTitle );
SwTOXBase( const SwTOXBase& rCopy, SwDoc* pDoc = 0 );
virtual ~SwTOXBase();
@@ -489,21 +479,21 @@ public:
sal_uInt16 GetCreateType() const; // creation types
const String& GetTOXName() const {return aName;}
void SetTOXName(const String& rSet) {aName = rSet;}
OUString GetTOXName() const {return aName;}
void SetTOXName(const OUString& rSet) {aName = rSet;}
const String& GetTitle() const; // Title
const String& GetTypeName() const; // Name
OUString GetTitle() const; // Title
OUString GetTypeName() const; // Name
const SwForm& GetTOXForm() const; // description of the lines
void SetCreate(sal_uInt16);
void SetTitle(const String& rTitle);
void SetTitle(const OUString& rTitle);
void SetTOXForm(const SwForm& rForm);
TOXTypes GetType() const;
const String& GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
void SetMainEntryCharStyle(const String& rSet) {sMainEntryCharStyle = rSet;}
OUString GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
void SetMainEntryCharStyle(const OUString& rSet) {sMainEntryCharStyle = rSet;}
// content index only
inline void SetLevel(sal_uInt16); // consider outline level
@@ -520,14 +510,14 @@ public:
// index of objects
// user defined index only
inline void SetTemplateName(const String& rName); // Absatzlayout beachten
inline void SetTemplateName(const OUString& rName); // Absatzlayout beachten
const String& GetStyleNames(sal_uInt16 nLevel) const
OUString GetStyleNames(sal_uInt16 nLevel) const
{
SAL_WARN_IF( nLevel >= MAXLEVEL, "sw", "Which level?");
return aStyleNames[nLevel];
}
void SetStyleNames(const String& rSet, sal_uInt16 nLevel)
void SetStyleNames(const OUString& rSet, sal_uInt16 nLevel)
{
SAL_WARN_IF( nLevel >= MAXLEVEL, "sw", "Which level?");
aStyleNames[nLevel] = rSet;
@@ -544,8 +534,8 @@ public:
sal_Bool IsProtected() const { return bProtected; }
void SetProtected(sal_Bool bSet) { bProtected = bSet; }
const String& GetSequenceName() const {return sSequenceName;}
void SetSequenceName(const String& rSet) {sSequenceName = rSet;}
OUString GetSequenceName() const {return sSequenceName;}
void SetSequenceName(const OUString& rSet) {sSequenceName = rSet;}
SwCaptionDisplay GetCaptionDisplay() const { return eCaptionDisplay;}
void SetCaptionDisplay(SwCaptionDisplay eSet) {eCaptionDisplay = eSet;}
@@ -558,8 +548,8 @@ public:
LanguageType GetLanguage() const {return eLanguage;}
void SetLanguage(LanguageType nLang) {eLanguage = nLang;}
const String& GetSortAlgorithm()const {return sSortAlgorithm;}
void SetSortAlgorithm(const String& rSet) {sSortAlgorithm = rSet;}
OUString GetSortAlgorithm()const {return sSortAlgorithm;}
void SetSortAlgorithm(const OUString& rSet) {sSortAlgorithm = rSet;}
// #i21237#
void AdjustTabStops(SwDoc & rDoc, sal_Bool bDefaultRightTabStop);
SwTOXBase& operator=(const SwTOXBase& rSource);
@@ -574,16 +564,16 @@ public:
//
//SwTOXMark
//
inline const String& SwTOXMark::GetAlternativeText() const
inline OUString SwTOXMark::GetAlternativeText() const
{ return aAltText; }
inline const SwTOXType* SwTOXMark::GetTOXType() const
{ return (SwTOXType*)GetRegisteredIn(); }
inline sal_Bool SwTOXMark::IsAlternativeText() const
{ return aAltText.Len() > 0; }
{ return !aAltText.isEmpty(); }
inline void SwTOXMark::SetAlternativeText(const String& rAlt)
inline void SwTOXMark::SetAlternativeText(const OUString& rAlt)
{
aAltText = rAlt;
}
@@ -594,31 +584,31 @@ inline void SwTOXMark::SetLevel( sal_uInt16 nLvl )
nLevel = nLvl;
}
inline void SwTOXMark::SetPrimaryKey( const String& rKey )
inline void SwTOXMark::SetPrimaryKey( const OUString& rKey )
{
SAL_WARN_IF( GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
aPrimaryKey = rKey;
}
inline void SwTOXMark::SetSecondaryKey( const String& rKey )
inline void SwTOXMark::SetSecondaryKey( const OUString& rKey )
{
SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
aSecondaryKey = rKey;
}
inline void SwTOXMark::SetTextReading( const String& rTxt )
inline void SwTOXMark::SetTextReading( const OUString& rTxt )
{
SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
aTextReading = rTxt;
}
inline void SwTOXMark::SetPrimaryKeyReading( const String& rKey )
inline void SwTOXMark::SetPrimaryKeyReading( const OUString& rKey )
{
SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
aPrimaryKeyReading = rKey;
}
inline void SwTOXMark::SetSecondaryKeyReading( const String& rKey )
inline void SwTOXMark::SetSecondaryKeyReading( const OUString& rKey )
{
SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
aSecondaryKeyReading = rKey;
@@ -630,31 +620,31 @@ inline sal_uInt16 SwTOXMark::GetLevel() const
return nLevel;
}
inline const String& SwTOXMark::GetPrimaryKey() const
inline OUString SwTOXMark::GetPrimaryKey() const
{
SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
return aPrimaryKey;
}
inline const String& SwTOXMark::GetSecondaryKey() const
inline OUString SwTOXMark::GetSecondaryKey() const
{
SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
return aSecondaryKey;
}
inline const String& SwTOXMark::GetTextReading() const
inline OUString SwTOXMark::GetTextReading() const
{
SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
return aTextReading;
}
inline const String& SwTOXMark::GetPrimaryKeyReading() const
inline OUString SwTOXMark::GetPrimaryKeyReading() const
{
SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
return aPrimaryKeyReading;
}
inline const String& SwTOXMark::GetSecondaryKeyReading() const
inline OUString SwTOXMark::GetSecondaryKeyReading() const
{
SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
return aSecondaryKeyReading;
@@ -663,13 +653,13 @@ inline const String& SwTOXMark::GetSecondaryKeyReading() const
//
//SwForm
//
inline void SwForm::SetTemplate(sal_uInt16 nLevel, const String& rTemplate)
inline void SwForm::SetTemplate(sal_uInt16 nLevel, const OUString& rTemplate)
{
SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()");
aTemplate[nLevel] = rTemplate;
}
inline const String& SwForm::GetTemplate(sal_uInt16 nLevel) const
inline OUString SwForm::GetTemplate(sal_uInt16 nLevel) const
{
SAL_WARN_IF(nLevel >= GetFormMax(), "sw", "Index >= GetFormMax()");
return aTemplate[nLevel];
@@ -689,7 +679,7 @@ inline sal_uInt16 SwForm::GetFormMax() const
//
//SwTOXType
//
inline const String& SwTOXType::GetTypeName() const
inline OUString SwTOXType::GetTypeName() const
{ return aName; }
inline TOXTypes SwTOXType::GetType() const
@@ -704,10 +694,10 @@ inline const SwTOXType* SwTOXBase::GetTOXType() const
inline sal_uInt16 SwTOXBase::GetCreateType() const
{ return nCreateType; }
inline const String& SwTOXBase::GetTitle() const
inline OUString SwTOXBase::GetTitle() const
{ return aTitle; }
inline const String& SwTOXBase::GetTypeName() const
inline OUString SwTOXBase::GetTypeName() const
{ return GetTOXType()->GetTypeName(); }
inline const SwForm& SwTOXBase::GetTOXForm() const
@@ -739,7 +729,7 @@ inline sal_uInt16 SwTOXBase::GetLevel() const
return aData.nLevel;
}
inline void SwTOXBase::SetTemplateName(const String& rName)
inline void SwTOXBase::SetTemplateName(const OUString& rName)
{
SAL_WARN("sw", "SwTOXBase::SetTemplateName obsolete");
aStyleNames[0] = rName;
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 8135874..08d5471 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -103,14 +103,12 @@ sal_uInt16 SwDoc::GetTOIKeys( SwTOIKeyType eTyp, std::vector<String>& rArr ) con
if ( pMark && pMark->GetpTxtNd() &&
pMark->GetpTxtNd()->GetNodes().IsDocNodes() )
{
const String* pStr;
if( TOI_PRIMARY == eTyp )
pStr = &((SwTOXMark*)pItem)->GetPrimaryKey();
else
pStr = &((SwTOXMark*)pItem)->GetSecondaryKey();
const OUString sStr = TOI_PRIMARY == eTyp
? pItem->GetPrimaryKey()
: pItem->GetSecondaryKey();
if( pStr->Len() )
rArr.push_back( *pStr );
if( !sStr.isEmpty() )
rArr.push_back( sStr );
}
}
@@ -359,7 +357,7 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos,
// Value of 1st parameter = default value.
pNewSection->Update( 0, true );
}
else if( 1 == rTOX.GetTitle().Len() && IsInReading() )
else if( rTOX.GetTitle().getLength()==1 && IsInReading() )
// insert title of TOX
{
// then insert the headline section
@@ -610,12 +608,12 @@ const SwTOXType* SwDoc::InsertTOXType( const SwTOXType& rTyp )
return pNew;
}
String SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
const String& rChkStr ) const
OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
const OUString sChkStr ) const
{
bool bUseChkStr = rChkStr.Len()>0;
String aName( rType.GetTypeName() );
xub_StrLen nNmLen = aName.Len();
bool bUseChkStr = !sChkStr.isEmpty();
const OUString aName( rType.GetTypeName() );
const sal_Int32 nNmLen = aName.getLength();
sal_uInt16 nNum = 0;
const sal_uInt16 nFlagSize = ( mpSectionFmtTbl->size() / 8 ) +2;
@@ -631,15 +629,15 @@ String SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
const SwSection& rSect = pSectNd->GetSection();
if (rSect.GetType()==TOX_CONTENT_SECTION)
{
const String& rNm = rSect.GetSectionName();
if( rNm.Match( aName ) == nNmLen )
const OUString rNm = rSect.GetSectionName();
if ( aName.startsWith(rNm) )
{
// Calculate number and set the Flag
nNum = (sal_uInt16)rNm.Copy( nNmLen ).ToInt32();
nNum = (sal_uInt16)rNm.copy( nNmLen ).toInt32();
if( nNum-- && nNum < mpSectionFmtTbl->size() )
pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
}
if( bUseChkStr && rChkStr.Equals( rNm ) )
if ( bUseChkStr && sChkStr==rNm )
bUseChkStr = false;
}
}
@@ -666,8 +664,8 @@ String SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
}
delete [] pSetFlags;
if ( bUseChkStr )
return rChkStr;
return aName += OUString::number( ++nNum );
return sChkStr;
return aName + OUString::number( ++nNum );
}
bool SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const String& rName)
@@ -879,7 +877,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
}
// insert title of TOX
if( GetTitle().Len() )
if ( !GetTitle().isEmpty() )
{
// then insert the headline section
SwNodeIndex aIdx( *pSectNd, +1 );
@@ -924,7 +922,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
(TOX_ILLUSTRATIONS == SwTOXBase::GetType() && IsFromObjectNames()))
UpdateCntnt( nsSwTOXElement::TOX_GRAPHIC, pOwnChapterNode );
if( GetSequenceName().Len() && !IsFromObjectNames() &&
if( !GetSequenceName().isEmpty() && !IsFromObjectNames() &&
(TOX_TABLES == SwTOXBase::GetType() ||
TOX_ILLUSTRATIONS == SwTOXBase::GetType() ) )
UpdateSequence( pOwnChapterNode );
@@ -998,7 +996,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
// Task 70995 - save and restore PageDesc and Break Attributes
if( pFirstEmptyNd->HasSwAttrSet() )
{
if( GetTitle().Len() )
if( !GetTitle().isEmpty() )
aEndIdx = *pSectNd;
else
aEndIdx = *pFirstEmptyNd;
@@ -1162,12 +1160,12 @@ void SwTOXBaseSection::UpdateMarks( const SwTOXInternational& rIntl,
GetOptions(), FORM_ENTRY, rIntl, aLocale );
InsertSorted(pBase);
if(GetOptions() & nsSwTOIOptions::TOI_KEY_AS_ENTRY &&
pTxtMark->GetTOXMark().GetPrimaryKey().Len())
!pTxtMark->GetTOXMark().GetPrimaryKey().isEmpty())
{
pBase = new SwTOXIndex( *pTOXSrc, pTxtMark,
GetOptions(), FORM_PRIMARY_KEY, rIntl, aLocale );
InsertSorted(pBase);
if(pTxtMark->GetTOXMark().GetSecondaryKey().Len())
if (!pTxtMark->GetTOXMark().GetSecondaryKey().isEmpty())
{
pBase = new SwTOXIndex( *pTOXSrc, pTxtMark,
GetOptions(), FORM_SECONDARY_KEY, rIntl, aLocale );
@@ -1826,7 +1824,7 @@ void SwTOXBaseSection::GenerateText( sal_uInt16 nArrayIdx,
case TOKEN_END: break;
}
if( aToken.sCharStyleName.Len() )
if ( !aToken.sCharStyleName.isEmpty() )
{
SwCharFmt* pCharFmt;
if( USHRT_MAX != aToken.nPoolId )
@@ -2115,7 +2113,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd,
}
// The main entries should get their character style
if(pCharStyleIdx && !pCharStyleIdx->empty() && GetMainEntryCharStyle().Len())
if(pCharStyleIdx && !pCharStyleIdx->empty() && !GetMainEntryCharStyle().isEmpty())
{
// eventually the last index must me appended
if(pCharStyleIdx->size()&0x01)
@@ -2155,13 +2153,13 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew)
// Evaluate Key
// Calculate the range where to insert
if( 0 == (GetOptions() & nsSwTOIOptions::TOI_KEY_AS_ENTRY) &&
rMark.GetPrimaryKey().Len() )
!rMark.GetPrimaryKey().isEmpty() )
{
aRange = GetKeyRange( rMark.GetPrimaryKey(),
rMark.GetPrimaryKeyReading(),
*pNew, FORM_PRIMARY_KEY, aRange );
if( rMark.GetSecondaryKey().Len() )
if( !rMark.GetSecondaryKey().isEmpty() )
aRange = GetKeyRange( rMark.GetSecondaryKey(),
rMark.GetSecondaryKeyReading(),
*pNew, FORM_SECONDARY_KEY, aRange );
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index 4c6872d..1a469d0 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -18,7 +18,6 @@
*/
#include <comphelper/string.hxx>
#include <tools/resid.hxx>
#include <hintids.hxx>
#include <swtypes.hxx>
@@ -39,28 +38,8 @@
using namespace std;
const sal_Char* SwForm::aFormEntry = "<E>";
const sal_Char* SwForm::aFormTab = "<T>";
const sal_Char* SwForm::aFormPageNums = "<#>";
const sal_Char* SwForm::aFormLinkStt = "<LS>";
const sal_Char* SwForm::aFormLinkEnd = "<LE>";
const sal_Char* SwForm::aFormEntryNum = "<E#>";
const sal_Char* SwForm::aFormEntryTxt = "<ET>";
const sal_Char* SwForm::aFormChapterMark= "<C>";
const sal_Char* SwForm::aFormText = "<X>";
const sal_Char* SwForm::aFormAuth = "<A>";
sal_uInt8 SwForm::nFormTabLen = 3;
sal_uInt8 SwForm::nFormEntryLen = 3;
sal_uInt8 SwForm::nFormPageNumsLen = 3;
sal_uInt8 SwForm::nFormLinkSttLen = 4;
sal_uInt8 SwForm::nFormLinkEndLen = 4;
sal_uInt8 SwForm::nFormEntryNumLen = 4;
sal_uInt8 SwForm::nFormEntryTxtLen = 4;
sal_uInt8 SwForm::nFormChapterMarkLen = 3;
sal_uInt8 SwForm::nFormTextLen = 3;
sal_uInt8 SwForm::nFormAuthLen = 5;
TYPEINIT2( SwTOXMark, SfxPoolItem, SwClient ); // fuers rtti
namespace
{
struct PatternIni
{
@@ -143,6 +122,11 @@ static SwFormTokens lcl_GetAuthPattern(sal_uInt16 nTypeId)
return aRet;
}
}
TYPEINIT2( SwTOXMark, SfxPoolItem, SwClient ); // fuers rtti
/*--------------------------------------------------------------------
TOX dtor and ctor
--------------------------------------------------------------------*/
@@ -227,22 +211,23 @@ void SwTOXMark::InvalidateTOXMark()
NotifyClients(&aMsgHint, &aMsgHint);
}
String SwTOXMark::GetText() const
OUString SwTOXMark::GetText() const
{
String aStr;
if( aAltText.Len() )
aStr = aAltText;
else if( pTxtAttr && pTxtAttr->GetpTxtNd() )
if( !aAltText.isEmpty() )
return aAltText;
if( pTxtAttr && pTxtAttr->GetpTxtNd() )
{
xub_StrLen* pEndIdx = pTxtAttr->GetEnd();
OSL_ENSURE( pEndIdx, "TOXMark without mark!");
if( pEndIdx )
{
const xub_StrLen nStt = *pTxtAttr->GetStart();
aStr = pTxtAttr->GetpTxtNd()->GetExpandTxt( nStt, *pEndIdx-nStt );
return pTxtAttr->GetpTxtNd()->GetExpandTxt( nStt, *pEndIdx-nStt );
}
}
return aStr;
return OUString();
}
void SwTOXMark::InsertTOXMarks( SwTOXMarks& aMarks, const SwTOXType& rType )
@@ -261,7 +246,7 @@ void SwTOXMark::InsertTOXMarks( SwTOXMarks& aMarks, const SwTOXType& rType )
Manage types of TOX
--------------------------------------------------------------------*/
SwTOXType::SwTOXType( TOXTypes eTyp, const String& rName )
SwTOXType::SwTOXType( TOXTypes eTyp, const OUString& rName )
: SwModify(0),
aName(rName),
eType(eTyp)
@@ -313,7 +298,7 @@ SwForm::SwForm( TOXTypes eTyp ) // #i21237#
if (TOX_CONTENT == eType || TOX_ILLUSTRATIONS == eType )
{
SwFormToken aLinkStt (TOKEN_LINK_START);
aLinkStt.sCharStyleName = String(SW_RES(STR_POOLCHR_TOXJUMP));
aLinkStt.sCharStyleName = SW_RES(STR_POOLCHR_TOXJUMP);
aTokens.push_back(aLinkStt);
}
@@ -433,7 +418,7 @@ void SwForm::AdjustTabStops(SwDoc& rDoc, sal_Bool bInsertNewTapStops) // #i21237
{
for(sal_uInt16 nLevel = 1; nLevel < GetFormMax(); nLevel++)
{
const String& sTemplateName = GetTemplate(nLevel);
const OUString sTemplateName = GetTemplate(nLevel);
SwTxtFmtColl* pColl = rDoc.FindTxtFmtCollByName( sTemplateName );
if( !pColl )
@@ -502,13 +487,25 @@ void SwForm::AdjustTabStops(SwDoc& rDoc, sal_Bool bInsertNewTapStops) // #i21237
}
}
}
OUString SwForm::GetFormEntry() {return OUString("<E>");}
OUString SwForm::GetFormTab() {return OUString("<T>");}
OUString SwForm::GetFormPageNums() {return OUString("<#>");}
OUString SwForm::GetFormLinkStt() {return OUString("<LS>");}
OUString SwForm::GetFormLinkEnd() {return OUString("<LE>");}
OUString SwForm::GetFormEntryNum() {return OUString("<E#>");}
OUString SwForm::GetFormEntryTxt() {return OUString("<ET>");}
OUString SwForm::GetFormChapterMark() {return OUString("<C>");}
OUString SwForm::GetFormText() {return OUString("<X>");}
OUString SwForm::GetFormAuth() {return OUString("<A>");}
/*--------------------------------------------------------------------
Ctor TOXBase
--------------------------------------------------------------------*/
SwTOXBase::SwTOXBase(const SwTOXType* pTyp, const SwForm& rForm,
sal_uInt16 nCreaType, const String& rTitle )
sal_uInt16 nCreaType, const OUString& rTitle )
: SwClient((SwModify*)pTyp),
aForm(rForm),
aTitle(rTitle),
@@ -599,7 +596,7 @@ SwTOXBase::~SwTOXBase()
// delete aData.pTemplateName;
}
void SwTOXBase::SetTitle(const String& rTitle)
void SwTOXBase::SetTitle(const OUString& rTitle)
{ aTitle = rTitle; }
@@ -629,119 +626,100 @@ SwTOXBase & SwTOXBase::operator = (const SwTOXBase & rSource)
return *this;
}
String SwFormToken::GetString() const
OUString SwFormToken::GetString() const
{
String sRet;
OUString sToken;
bool bAppend = true;
switch( eTokenType )
{
case TOKEN_ENTRY_NO:
sRet.AssignAscii( SwForm::aFormEntryNum );
sToken = SwForm::GetFormEntryNum();
break;
case TOKEN_ENTRY_TEXT:
sRet.AssignAscii( SwForm::aFormEntryTxt );
sToken = SwForm::GetFormEntryTxt();
break;
case TOKEN_ENTRY:
sRet.AssignAscii( SwForm::aFormEntry );
sToken = SwForm::GetFormEntry();
break;
case TOKEN_TAB_STOP:
sRet.AssignAscii( SwForm::aFormTab );
sToken = SwForm::GetFormTab();
break;
case TOKEN_TEXT:
sRet.AssignAscii( SwForm::aFormText );
// Return a Token only if Text is not empty!
if( sText.isEmpty() )
{
return OUString();
}
sToken = SwForm::GetFormText();
break;
case TOKEN_PAGE_NUMS:
sRet.AssignAscii( SwForm::aFormPageNums );
sToken = SwForm::GetFormPageNums();
break;
case TOKEN_CHAPTER_INFO:
sRet.AssignAscii( SwForm::aFormChapterMark );
sToken = SwForm::GetFormChapterMark();
break;
case TOKEN_LINK_START:
sRet.AssignAscii( SwForm::aFormLinkStt );
sToken = SwForm::GetFormLinkStt();
break;
case TOKEN_LINK_END:
sRet.AssignAscii( SwForm::aFormLinkEnd );
sToken = SwForm::GetFormLinkEnd();
break;
case TOKEN_AUTHORITY:
{
sRet.AssignAscii( SwForm::aFormAuth );
String sTmp( OUString::number( nAuthorityField ));
if( sTmp.Len() < 2 )
sTmp.Insert('0', 0);
sRet.Insert( sTmp, 2 );
sToken = SwForm::GetFormAuth();
}
break;
case TOKEN_END:
break;
}
sRet.Erase( sRet.Len() - 1 );
sRet += ' ';
sRet += sCharStyleName;
sRet += ',';
sRet += OUString::number( nPoolId );
sRet += ',';
OUString sData = " " + sCharStyleName + "," + OUString::number( nPoolId ) + ",";
// TabStopPosition and TabAlign or ChapterInfoFormat
if(TOKEN_TAB_STOP == eTokenType)
switch (eTokenType)
{
sRet += OUString::number( nTabStopPosition );
sRet += ',';
sRet += OUString::number( static_cast< sal_Int32 >(eTabAlign) );
sRet += ',';
sRet += cTabFillChar;
sRet += ',';
sRet += OUString::number( bWithTab );
}
else if(TOKEN_CHAPTER_INFO == eTokenType)
{
sRet += OUString::number( nChapterFormat );
// add maximum permitted level
sRet += ',';
sRet += OUString::number( nOutlineLevel );
}
else if(TOKEN_TEXT == eTokenType)
{
//append Text if Len() > 0 only!
if( sText.Len() )
{
sRet += TOX_STYLE_DELIMITER;
String sTmp(comphelper::string::remove(sText, TOX_STYLE_DELIMITER));
sRet += sTmp;
sRet += TOX_STYLE_DELIMITER;
}
else
bAppend = false;
}
else if(TOKEN_ENTRY_NO == eTokenType)
{
sRet += OUString::number( nChapterFormat );
// add maximum permitted level
sRet += ',';
sRet += OUString::number( nOutlineLevel );
case TOKEN_TAB_STOP:
sData += OUString::number( nTabStopPosition ) + ","
+ OUString::number( static_cast< sal_Int32 >(eTabAlign) ) + ","
+ OUString(cTabFillChar) + ","
+ OUString::number( bWithTab );
break;
case TOKEN_CHAPTER_INFO:
case TOKEN_ENTRY_NO:
// add also maximum permitted level
sData += OUString::number( nChapterFormat ) + ","
+ OUString::number( nOutlineLevel );
break;
case TOKEN_TEXT:
sData += OUString(TOX_STYLE_DELIMITER)
+ sText.replaceAll(OUString(TOX_STYLE_DELIMITER), OUString())
+ OUString(TOX_STYLE_DELIMITER);
break;
case TOKEN_AUTHORITY:
if (nAuthorityField<10)
{
sData = "0" + OUString::number( nAuthorityField ) + sData;
}
else
{
sData = OUString::number( nAuthorityField ) + sData;
}
default:
break;
}
if(bAppend)
{
sRet += '>';
}
else
{
// don't append empty text tokens
sRet.Erase();
}
return sRet;
return sToken.copy(0, sToken.getLength()-1) + sData + sToken.copy(sToken.getLength()-1);
}
// -> #i21237#
SwFormTokensHelper::SwFormTokensHelper(const String & rPattern)
SwFormTokensHelper::SwFormTokensHelper(const OUString & rPattern)
{
xub_StrLen nCurPatternPos = 0;
xub_StrLen nCurPatternLen = 0;
sal_Int32 nCurPatternPos = 0;
sal_Int32 nCurPatternLen = 0;
while (nCurPatternPos < rPattern.Len())
while (nCurPatternPos < rPattern.getLength())
{
// FIXME: nCurPatternLen added but set to 0?
nCurPatternPos = nCurPatternPos + nCurPatternLen;
SwFormToken aToken = BuildToken(rPattern, nCurPatternPos);
@@ -749,12 +727,12 @@ SwFormTokensHelper::SwFormTokensHelper(const String & rPattern)
}
}
SwFormToken SwFormTokensHelper::BuildToken( const String & sPattern,
xub_StrLen & nCurPatternPos ) const
SwFormToken SwFormTokensHelper::BuildToken( const OUString & sPattern,
sal_Int32 & nCurPatternPos ) const
{
String sToken( SearchNextToken(sPattern, nCurPatternPos) );
nCurPatternPos = nCurPatternPos + sToken.Len();
xub_StrLen nTokenLen;
OUString sToken( SearchNextToken(sPattern, nCurPatternPos) );
nCurPatternPos += sToken.getLength();
sal_Int32 nTokenLen = 0;
FormTokenType eTokenType = GetTokenType(sToken, &nTokenLen);
// at this point sPattern contains the
@@ -762,34 +740,38 @@ SwFormToken SwFormTokensHelper::BuildToken( const String & sPattern,
// the form is: CharStyleName, PoolId[, TabStopPosition|ChapterInfoFormat[, TabStopAlignment[, TabFillChar]]]
// in text tokens the form differs from the others: CharStyleName, PoolId[,\0xffinserted text\0xff]
SwFormToken eRet( eTokenType );
String sAuthFieldEnum = sToken.Copy( 2, 2 );
sToken = sToken.Copy( nTokenLen, sToken.Len() - nTokenLen - 1);
const OUString sAuthFieldEnum = sToken.copy( 2, 2 );
sToken = sToken.copy( nTokenLen, sToken.getLength() - nTokenLen - 1);
eRet.sCharStyleName = sToken.GetToken( 0, ',');
String sTmp( sToken.GetToken( 1, ',' ));
if( sTmp.Len() )
eRet.nPoolId = static_cast<sal_uInt16>(sTmp.ToInt32());
eRet.sCharStyleName = sToken.getToken( 0, ',');
OUString sTmp( sToken.getToken( 1, ',' ));
if( !sTmp.isEmpty() )
eRet.nPoolId = static_cast<sal_uInt16>(sTmp.toInt32());
switch( eTokenType )
{
//i53420
case TOKEN_CHAPTER_INFO:
//i53420
case TOKEN_ENTRY_NO:
if( (sTmp = sToken.GetToken( 2, ',' ) ).Len() )
eRet.nChapterFormat = static_cast<sal_uInt16>(sTmp.ToInt32());
if( (sTmp = sToken.GetToken( 3, ',' ) ).Len() )
eRet.nOutlineLevel = static_cast<sal_uInt16>(sTmp.ToInt32()); //the maximum outline level to examine
sTmp = sToken.getToken( 2, ',' );
if( !sTmp.isEmpty() )
eRet.nChapterFormat = static_cast<sal_uInt16>(sTmp.toInt32());
sTmp = sToken.getToken( 3, ',' );
if( !sTmp.isEmpty() )
eRet.nOutlineLevel = static_cast<sal_uInt16>(sTmp.toInt32()); //the maximum outline level to examine
break;
case TOKEN_TEXT:
{
xub_StrLen nStartText = sToken.Search( TOX_STYLE_DELIMITER );
if( STRING_NOTFOUND != nStartText )
const sal_Int32 nStartText = sToken.indexOf( TOX_STYLE_DELIMITER );
if( nStartText>=0 && nStartText+1<sToken.getLength())
{
xub_StrLen nEndText = sToken.Search( TOX_STYLE_DELIMITER,
nStartText + 1);
if( STRING_NOTFOUND != nEndText )
const sal_Int32 nEndText = sToken.indexOf( TOX_STYLE_DELIMITER,
nStartText + 1);
if( nEndText>=0 )
{
eRet.sText = sToken.Copy( nStartText + 1,
eRet.sText = sToken.copy( nStartText + 1,
nEndText - nStartText - 1);
}
}
@@ -797,109 +779,99 @@ SwFormToken SwFormTokensHelper::BuildToken( const String & sPattern,
break;
case TOKEN_TAB_STOP:
if( (sTmp = sToken.GetToken( 2, ',' ) ).Len() )
eRet.nTabStopPosition = sTmp.ToInt32();
sTmp = sToken.getToken( 2, ',' );
if( !sTmp.isEmpty() )
eRet.nTabStopPosition = sTmp.toInt32();
if( (sTmp = sToken.GetToken( 3, ',' ) ).Len() )
eRet.eTabAlign = static_cast<SvxTabAdjust>(sTmp.ToInt32());
sTmp = sToken.getToken( 3, ',' );
if( !sTmp.isEmpty() )
eRet.eTabAlign = static_cast<SvxTabAdjust>(sTmp.toInt32());
if( (sTmp = sToken.GetToken( 4, ',' ) ).Len() )
eRet.cTabFillChar = sTmp.GetChar(0);
sTmp = sToken.getToken( 4, ',' );
if( !sTmp.isEmpty() )
eRet.cTabFillChar = sTmp[0];
if( (sTmp = sToken.GetToken( 5, ',' ) ).Len() )
eRet.bWithTab = 0 != sTmp.ToInt32();
break;
case TOKEN_CHAPTER_INFO:
if( (sTmp = sToken.GetToken( 2, ',' ) ).Len() )
eRet.nChapterFormat = static_cast<sal_uInt16>(sTmp.ToInt32()); //SwChapterFormat;
//i53420
if( (sTmp = sToken.GetToken( 3, ',' ) ).Len() )
eRet.nOutlineLevel = static_cast<sal_uInt16>(sTmp.ToInt32()); //the maximum outline level to examine
sTmp = sToken.getToken( 5, ',' );
if( !sTmp.isEmpty() )
eRet.bWithTab = 0 != sTmp.toInt32();
break;
case TOKEN_AUTHORITY:
eRet.nAuthorityField = static_cast<sal_uInt16>(sAuthFieldEnum.ToInt32());
eRet.nAuthorityField = static_cast<sal_uInt16>(sAuthFieldEnum.toInt32());
break;
default: break;
}
return eRet;
}
String SwFormTokensHelper::SearchNextToken( const String & sPattern,
xub_StrLen nStt ) const
OUString SwFormTokensHelper::SearchNextToken( const OUString & sPattern,
sal_Int32 nStt ) const
{
//it's not so easy - it doesn't work if the text part contains a '>'
//sal_uInt16 nTokenEnd = sPattern.Search('>');
String aResult;
xub_StrLen nEnd = sPattern.Search( '>', nStt );
if( STRING_NOTFOUND == nEnd )
sal_Int32 nEnd = sPattern.indexOf( '>', nStt );
if( nEnd<0 )
{
nEnd = sPattern.Len();
// FIXME: why is nEnd updated?
// should "aResult = sPattern.copy( nStt, nEnd - nStt );"
// or something like that be returned?
nEnd = sPattern.getLength();
}
else
{
xub_StrLen nTextSeparatorFirst = sPattern.Search( TOX_STYLE_DELIMITER, nStt );
if( STRING_NOTFOUND != nTextSeparatorFirst )
const sal_Int32 nTextSeparatorFirst = sPattern.indexOf( TOX_STYLE_DELIMITER, nStt );
if( nTextSeparatorFirst>=0 && nTextSeparatorFirst+1<sPattern.getLength())
{
xub_StrLen nTextSeparatorSecond = sPattern.Search( TOX_STYLE_DELIMITER,
nTextSeparatorFirst + 1 );
if( STRING_NOTFOUND != nTextSeparatorSecond &&
nEnd > nTextSeparatorFirst )
nEnd = sPattern.Search( '>', nTextSeparatorSecond );
const sal_Int32 nTextSeparatorSecond = sPattern.indexOf( TOX_STYLE_DELIMITER,
nTextSeparatorFirst + 1 );
// Since nEnd>=0 we don't need to check if nTextSeparatorSecond<0!
if( nEnd < nTextSeparatorSecond )
nEnd = sPattern.indexOf( '>', nTextSeparatorSecond );
// FIXME: No check to verify that nEnd is still >=0?
}
++nEnd;
aResult = sPattern.Copy( nStt, nEnd - nStt );
return sPattern.copy( nStt, nEnd - nStt );
}
return aResult;
return OUString();
}
FormTokenType SwFormTokensHelper::GetTokenType(const String & sToken,
xub_StrLen * pTokenLen) const
FormTokenType SwFormTokensHelper::GetTokenType(const OUString & sToken,
sal_Int32 * pTokenLen) const
{
static struct
{
const sal_Char* pNm;
sal_uInt16 nLen;
OUString sNm;
sal_uInt16 nOffset;
FormTokenType eToken;
} const aTokenArr[] = {
{ SwForm::aFormTab, SwForm::nFormEntryLen, 1, TOKEN_TAB_STOP },
{ SwForm::aFormPageNums, SwForm::nFormPageNumsLen, 1, TOKEN_PAGE_NUMS },
{ SwForm::aFormLinkStt, SwForm::nFormLinkSttLen, 1, TOKEN_LINK_START },
{ SwForm::aFormLinkEnd, SwForm::nFormLinkEndLen, 1, TOKEN_LINK_END },
{ SwForm::aFormEntryNum, SwForm::nFormEntryNumLen, 1, TOKEN_ENTRY_NO },
{ SwForm::aFormEntryTxt, SwForm::nFormEntryTxtLen, 1, TOKEN_ENTRY_TEXT },
{ SwForm::aFormChapterMark,SwForm::nFormChapterMarkLen,1,TOKEN_CHAPTER_INFO },
{ SwForm::aFormText, SwForm::nFormTextLen, 1, TOKEN_TEXT },
{ SwForm::aFormEntry, SwForm::nFormEntryLen, 1, TOKEN_ENTRY },
{ SwForm::aFormAuth, SwForm::nFormAuthLen, 3, TOKEN_AUTHORITY },
{ 0, 0, 0, TOKEN_END }
{ SwForm::GetFormTab(), 1, TOKEN_TAB_STOP },
{ SwForm::GetFormPageNums(), 1, TOKEN_PAGE_NUMS },
{ SwForm::GetFormLinkStt(), 1, TOKEN_LINK_START },
{ SwForm::GetFormLinkEnd(), 1, TOKEN_LINK_END },
{ SwForm::GetFormEntryNum(), 1, TOKEN_ENTRY_NO },
{ SwForm::GetFormEntryTxt(), 1, TOKEN_ENTRY_TEXT },
{ SwForm::GetFormChapterMark(), 1, TOKEN_CHAPTER_INFO },
{ SwForm::GetFormText(), 1, TOKEN_TEXT },
{ SwForm::GetFormEntry(), 1, TOKEN_ENTRY },
{ SwForm::GetFormAuth(), 3, TOKEN_AUTHORITY }
};
FormTokenType eTokenType = TOKEN_TEXT;
xub_StrLen nTokenLen = 0;
const sal_Char* pNm;
for( int i = 0; 0 != ( pNm = aTokenArr[ i ].pNm ); ++i )
if( COMPARE_EQUAL == sToken.CompareToAscii( pNm,
aTokenArr[ i ].nLen - aTokenArr[ i ].nOffset ))
for( size_t i = 0; i<SAL_N_ELEMENTS(aTokenArr); ++i )
{
const sal_Int32 nLen(aTokenArr[i].sNm.getLength());
if( sToken.startsWith( aTokenArr[i].sNm.copy(0, nLen - aTokenArr[i].nOffset) ))
{
eTokenType = aTokenArr[ i ].eToken;
nTokenLen = aTokenArr[ i ].nLen;
break;
if (pTokenLen)
*pTokenLen = nLen;
return aTokenArr[ i ].eToken;
}
}
OSL_ENSURE( pNm, "wrong token" );
if (pTokenLen)
*pTokenLen = nTokenLen;
return eTokenType;
OSL_FAIL( "wrong token" );
return TOKEN_END;
}
// <- #i21237#
@@ -910,7 +882,7 @@ void SwForm::SetPattern(sal_uInt16 nLevel, const SwFormTokens& rTokens)
aPattern[nLevel] = rTokens;
}
void SwForm::SetPattern(sal_uInt16 nLevel, const String & rStr)
void SwForm::SetPattern(sal_uInt16 nLevel, const OUString & rStr)
{
OSL_ENSURE(nLevel < GetFormMax(), "Index >= FORM_MAX");
@@ -935,4 +907,5 @@ SwTOXTypes::~SwTOXTypes()
for(const_iterator it = begin(); it != end(); ++it)
delete *it;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index b0a060a..7ead474 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -442,10 +442,10 @@ sal_uInt16 SwTOXIndex::GetLevel() const
sal_uInt16 nForm = FORM_PRIMARY_KEY;
if( 0 == (GetOptions() & nsSwTOIOptions::TOI_KEY_AS_ENTRY)&&
pTxtMark->GetTOXMark().GetPrimaryKey().Len() )
!pTxtMark->GetTOXMark().GetPrimaryKey().isEmpty() )
{
nForm = FORM_SECONDARY_KEY;
if( pTxtMark->GetTOXMark().GetSecondaryKey().Len() )
if( !pTxtMark->GetTOXMark().GetSecondaryKey().isEmpty() )
nForm = FORM_ENTRY;
}
return nForm;
diff --git a/sw/source/core/txtnode/atrtox.cxx b/sw/source/core/txtnode/atrtox.cxx
index 24277cc..0c60b94 100644
--- a/sw/source/core/txtnode/atrtox.cxx
+++ b/sw/source/core/txtnode/atrtox.cxx
@@ -30,7 +30,7 @@ SwTxtTOXMark::SwTxtTOXMark( SwTOXMark& rAttr,
, m_pEnd( 0 )
{
rAttr.pTxtAttr = this;
if ( !rAttr.GetAlternativeText().Len() )
if ( rAttr.GetAlternativeText().isEmpty() )
{
m_nEnd = *pEnd;
m_pEnd = & m_nEnd;
@@ -58,7 +58,7 @@ void SwTxtTOXMark::CopyTOXMark( SwDoc* pDoc )
TOXTypes eType = rTOX.GetTOXType()->GetType();
sal_uInt16 nCount = pDoc->GetTOXTypeCount( eType );
const SwTOXType* pType = 0;
const XubString& rNm = rTOX.GetTOXType()->GetTypeName();
const OUString rNm = rTOX.GetTOXType()->GetTypeName();
// kein entsprechender Verzeichnistyp vorhanden -> anlegen
// sonst verwenden
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index b237a7e..0dad757 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -120,7 +120,7 @@ lcl_ReAssignTOXType(SwDoc* pDoc, SwTOXBase& rTOXBase, const OUString& rNewName)
for(sal_uInt16 nUser = 0; nUser < nUserCount; nUser++)
{
const SwTOXType* pType = pDoc->GetTOXType( TOX_USER, nUser );
if(pType->GetTypeName().Equals((String)rNewName))
if (pType->GetTypeName()==rNewName)
{
pNewType = pType;
break;
@@ -1915,7 +1915,7 @@ void SwXDocumentIndexMark::Impl::InsertTOXMark(
UnoActionContext aAction(pDoc);
bool bMark = *rPam.GetPoint() != *rPam.GetMark();
// n.b.: toxmarks must have either alternative text or an extent
if (bMark && rMark.GetAlternativeText().Len())
if (bMark && !rMark.GetAlternativeText().isEmpty())
{
rPam.Normalize(true);
rPam.DeleteMark();
@@ -1923,7 +1923,7 @@ void SwXDocumentIndexMark::Impl::InsertTOXMark(
}
// Marks ohne Alternativtext ohne selektierten Text koennen nicht eingefuegt werden,
// deshalb hier ein Leerzeichen - ob das die ideale Loesung ist?
if (!bMark && !rMark.GetAlternativeText().Len())
if (!bMark && rMark.GetAlternativeText().isEmpty())
{
rMark.SetAlternativeText( OUString(' ') );
}
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index f320ce4..7af0c2e 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1074,9 +1074,9 @@ void AttributeOutputBase::TOXMark( const SwTxtNode& rNode, const SwTOXMark& rAtt
{
case TOX_INDEX:
eType = ww::eXE;
if ( rAttr.GetPrimaryKey().Len() )
if ( !rAttr.GetPrimaryKey().isEmpty() )
{
if ( rAttr.GetSecondaryKey().Len() )
if ( !rAttr.GetSecondaryKey().isEmpty() )
{
sTxt.Insert( ':', 0 );
sTxt.Insert( rAttr.GetSecondaryKey(), 0 );
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 66acee6..f79155d 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1975,7 +1975,7 @@ static int lcl_CheckForm( const SwForm& rForm, sal_uInt8 nLvl, String& rText )
break;
case TOKEN_TEXT:
nRet = 3;
rText = aIt->sText.Copy( 0, 5 ); // #i21237#
rText = aIt->sText.copy( 0, 5 ); // #i21237#
break;
case TOKEN_LINK_START:
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index ed1ef20..dbae13c 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2877,7 +2877,7 @@ static void EnsureMaxLevelForTemplates(SwTOXBase& rBase)
{
for (sal_uInt16 nI = MAXLEVEL; nI > 0; --nI)
{
if (rBase.GetStyleNames(nI-1).Len())
if (!rBase.GetStyleNames(nI-1).isEmpty())
{
rBase.SetLevel(nI);
break;
diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx
index 644ee08..a96cdc0 100644
--- a/sw/source/ui/docvw/edtwin2.cxx
+++ b/sw/source/ui/docvw/edtwin2.cxx
@@ -256,7 +256,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
{
const SwTOXType* pTType = aCntntAtPos.pFndTxtAttr->
GetTOXMark().GetTOXType();
if( pTType && pTType->GetTypeName().Len() )
if( pTType && !pTType->GetTypeName().isEmpty() )
{
sTxt.InsertAscii( ": ", 0 );
sTxt.Insert( pTType->GetTypeName(), 0 );
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index b8f552c..68482fc 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -1730,7 +1730,7 @@ public:
OSL_ENSURE(TOKEN_LINK_START == aFormToken.eTokenType,
"call SetLinkEnd for link start only!");
aFormToken.eTokenType = TOKEN_LINK_END;
aFormToken.sText.AssignAscii(SwForm::aFormLinkEnd);
aFormToken.sText = SwForm::GetFormLinkEnd();
SetText(aFormToken.sText);
}
void SetLinkStart()
@@ -1738,7 +1738,7 @@ public:
OSL_ENSURE(TOKEN_LINK_END == aFormToken.eTokenType,
"call SetLinkStart for link start only!");
aFormToken.eTokenType = TOKEN_LINK_START;
aFormToken.sText.AssignAscii(SwForm::aFormLinkStt);
aFormToken.sText = SwForm::GetFormLinkStt();
SetText(aFormToken.sText);
}
};
@@ -2340,8 +2340,7 @@ IMPL_LINK(SwTOXEntryTabPage, RemoveInsertAuthHdl, PushButton*, pButton)
String sToInsert(aAuthFieldsLB.GetSelectEntry());
SwFormToken aInsert(TOKEN_AUTHORITY);
aInsert.nAuthorityField = (sal_uInt16)(sal_uIntPtr)aAuthFieldsLB.GetEntryData(nSelPos);
aTokenWIN.InsertAtSelection(OUString::createFromAscii(
SwForm::aFormAuth), aInsert);
aTokenWIN.InsertAtSelection(SwForm::GetFormAuth(), aInsert);
aAuthFieldsLB.RemoveEntry(sToInsert);
aAuthFieldsLB.SelectEntryPos( nSelPos ? nSelPos - 1 : 0);
}
@@ -2382,42 +2381,42 @@ IMPL_LINK(SwTOXEntryTabPage, InsertTokenHdl, PushButton*, pBtn)
sal_uInt16 nChapterFormat = CF_NUMBER; // i89791
if(pBtn == &aEntryNoPB)
{
sText.AssignAscii(SwForm::aFormEntryNum);
sText = SwForm::GetFormEntryNum();
eTokenType = TOKEN_ENTRY_NO;
}
else if(pBtn == &aEntryPB)
{
if( TOX_CONTENT == m_pCurrentForm->GetTOXType() )
{
sText.AssignAscii( SwForm::aFormEntryTxt );
sText = SwForm::GetFormEntryTxt();
eTokenType = TOKEN_ENTRY_TEXT;
}
else
{
sText.AssignAscii( SwForm::aFormEntry);
sText = SwForm::GetFormEntry();
eTokenType = TOKEN_ENTRY;
}
}
else if(pBtn == &aChapterInfoPB)
{
sText.AssignAscii( SwForm::aFormChapterMark);
sText = SwForm::GetFormChapterMark();
eTokenType = TOKEN_CHAPTER_INFO;
nChapterFormat = CF_NUM_NOPREPST_TITLE; // i89791
}
else if(pBtn == &aPageNoPB)
{
sText.AssignAscii(SwForm::aFormPageNums);
sText = SwForm::GetFormPageNums();
eTokenType = TOKEN_PAGE_NUMS;
}
else if(pBtn == &aHyperLinkPB)
{
sText.AssignAscii(SwForm::aFormLinkStt);
sText = SwForm::GetFormLinkStt();
eTokenType = TOKEN_LINK_START;
sCharStyle = String(SW_RES(STR_POOLCHR_TOXJUMP));
}
else if(pBtn == &aTabPB)
{
sText.AssignAscii(SwForm::aFormTab);
sText = SwForm::GetFormTab();
eTokenType = TOKEN_TAB_STOP;
}
SwFormToken aInsert(eTokenType);
@@ -2520,7 +2519,7 @@ IMPL_LINK(SwTOXEntryTabPage, SortKeyHdl, RadioButton*, pButton)
IMPL_LINK(SwTOXEntryTabPage, TokenSelectedHdl, SwFormToken*, pToken)
{
if(pToken->sCharStyleName.Len())
if (!pToken->sCharStyleName.isEmpty())
aCharStyleLB.SelectEntry(pToken->sCharStyleName);
else
aCharStyleLB.SelectEntry(sNoCharStyle);
@@ -2881,23 +2880,23 @@ void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL)
if(!pSetActiveControl)
pSetActiveControl = pCtrl;
}
const sal_Char* pTmp = 0;
OUString sForm;
switch( aToken.eTokenType )
{
case TOKEN_ENTRY_NO: pTmp = SwForm::aFormEntryNum; break;
case TOKEN_ENTRY_TEXT: pTmp = SwForm::aFormEntryTxt; break;
case TOKEN_ENTRY: pTmp = SwForm::aFormEntry; break;
case TOKEN_TAB_STOP: pTmp = SwForm::aFormTab; break;
case TOKEN_PAGE_NUMS: pTmp = SwForm::aFormPageNums; break;
case TOKEN_CHAPTER_INFO:pTmp = SwForm::aFormChapterMark; break;
case TOKEN_LINK_START: pTmp = SwForm::aFormLinkStt; break;
case TOKEN_LINK_END: pTmp = SwForm::aFormLinkEnd; break;
case TOKEN_AUTHORITY: pTmp = SwForm::aFormAuth; break;
case TOKEN_ENTRY_NO: sForm = SwForm::GetFormEntryNum(); break;
case TOKEN_ENTRY_TEXT: sForm = SwForm::GetFormEntryTxt(); break;
case TOKEN_ENTRY: sForm = SwForm::GetFormEntry(); break;
case TOKEN_TAB_STOP: sForm = SwForm::GetFormTab(); break;
case TOKEN_PAGE_NUMS: sForm = SwForm::GetFormPageNums(); break;
case TOKEN_CHAPTER_INFO: sForm = SwForm::GetFormChapterMark(); break;
case TOKEN_LINK_START: sForm = SwForm::GetFormLinkStt(); break;
case TOKEN_LINK_END: sForm = SwForm::GetFormLinkEnd(); break;
case TOKEN_AUTHORITY: sForm = SwForm::GetFormAuth(); break;
default:; //prevent warning
}
InsertItem( pTmp ? OUString::createFromAscii(pTmp)
: OUString(), aToken );
InsertItem( sForm, aToken );
bLastWasText = false;
}
@@ -3483,7 +3482,7 @@ sal_Bool SwTokenWindow::CreateQuickHelp(Control* pCtrl,
}
else
{
if(rToken.sCharStyleName.Len())
if (!rToken.sCharStyleName.isEmpty())
{
if(bBalloon)
sEntry += '\n';
@@ -3697,7 +3696,7 @@ void SwTOXStylesTabPage::ActivatePage( const SfxItemSet& )
// display 1st TemplateEntry
String aStr( SW_RES( STR_TITLE ));
if( m_pCurrentForm->GetTemplate( 0 ).Len() )
if( !m_pCurrentForm->GetTemplate( 0 ).isEmpty() )
{
aStr += ' ';
aStr += aDeliStart;
@@ -3719,7 +3718,7 @@ void SwTOXStylesTabPage::ActivatePage( const SfxItemSet& )
}
String aCpy( aStr );
if( m_pCurrentForm->GetTemplate( i ).Len() )
if( !m_pCurrentForm->GetTemplate( i ).isEmpty() )
{
aCpy += ' ';
aCpy += aDeliStart;
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index 1e1d863..8c89daf 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -811,9 +811,9 @@ void SwIndexMarkPane::UpdateDialog()
{
bLevelEnable = sal_False;
bKeyEnable = sal_True;
bKey1HasText = bKey2Enable = 0 != pMark->GetPrimaryKey().Len();
bKey2HasText = 0 != pMark->GetSecondaryKey().Len();
bEntryHasText = 0 != pMark->GetText().Len();
bKey1HasText = bKey2Enable = !pMark->GetPrimaryKey().isEmpty();
bKey2HasText = !pMark->GetSecondaryKey().isEmpty();
bEntryHasText = !pMark->GetText().isEmpty();
m_pKey1DCB->SetText( pMark->GetPrimaryKey() );
m_pKey2DCB->SetText( pMark->GetSecondaryKey() );
m_pPhoneticED0->SetText( pMark->GetTextReading() );