summaryrefslogtreecommitdiff
path: root/sw/inc/tox.hxx
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2013-08-09 22:11:53 +0200
committerTor Lillqvist <tml@iki.fi>2013-08-13 08:05:41 +0000
commitf4fd558ac9d61fe06aa0f56d829916ef9e5ee7b9 (patch)
tree02ed54f68b09ee5c05fa932d9f0cfc356c3ea260 /sw/inc/tox.hxx
parentc083d68d1670b88ad3a88b768859c7bb1c5e5fee (diff)
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>
Diffstat (limited to 'sw/inc/tox.hxx')
-rw-r--r--sw/inc/tox.hxx188
1 files changed, 89 insertions, 99 deletions
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index c6231683c213..047cc1553172 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 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 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 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;