XubString->OUString

Change-Id: Ib5f39e099d238b739e0d6b3d92d3f04ee50022fb
This commit is contained in:
Caolán McNamara
2012-10-12 14:48:34 +01:00
parent a551cad4e3
commit 53acdd29e3
10 changed files with 124 additions and 138 deletions

View File

@@ -78,9 +78,12 @@ public:
void ClearPortionInfo(); void ClearPortionInfo();
// StyleSheet support // StyleSheet support
bool ChangeStyleSheets(const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily); bool ChangeStyleSheets(const OUString& rOldName, SfxStyleFamily eOldFamily,
void ChangeStyleSheetName(SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName); const OUString& rNewName, SfxStyleFamily eNewFamily);
void SetStyleSheets(sal_uInt16 nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily); void ChangeStyleSheetName(SfxStyleFamily eFamily, const OUString& rOldName,
const OUString& rNewName);
void SetStyleSheets(sal_uInt16 nLevel, const OUString rNewName,
const SfxStyleFamily& rNewFamily);
}; };
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@@ -82,7 +82,7 @@ public:
inline sal_Bool IsEsc() const { return 0 != nEsc; } inline sal_Bool IsEsc() const { return 0 != nEsc; }
// Consider Upper case, Lower case letters etc. // Consider Upper case, Lower case letters etc.
String CalcCaseMap( const String &rTxt ) const; OUString CalcCaseMap(const OUString &rTxt) const;
// The following section is not needed by anyone, so it can be excluded. // The following section is not needed by anyone, so it can be excluded.
#ifndef REDUCEDSVXFONT #ifndef REDUCEDSVXFONT

View File

@@ -110,10 +110,11 @@ void SvxFont::DrawArrow( OutputDevice &rOut, const Rectangle& rRect,
} }
XubString SvxFont::CalcCaseMap( const XubString &rTxt ) const OUString SvxFont::CalcCaseMap(const OUString &rTxt) const
{ {
if( !IsCaseMap() || !rTxt.Len() ) return rTxt; if (!IsCaseMap() || rTxt.isEmpty())
XubString aTxt( rTxt ); return rTxt;
OUString aTxt(rTxt);
// I still have to get the language // I still have to get the language
const LanguageType eLng = LANGUAGE_DONTKNOW == eLang const LanguageType eLng = LANGUAGE_DONTKNOW == eLang
? LANGUAGE_SYSTEM : eLang; ? LANGUAGE_SYSTEM : eLang;
@@ -139,21 +140,20 @@ XubString SvxFont::CalcCaseMap( const XubString &rTxt ) const
// Every beginning of a word is capitalized, the rest of the word // Every beginning of a word is capitalized, the rest of the word
// is taken over as is. // is taken over as is.
// Bug: if the attribute starts in the middle of the word. // Bug: if the attribute starts in the middle of the word.
sal_Bool bBlank = sal_True; bool bBlank = true;
for( sal_uInt16 i = 0; i < aTxt.Len(); ++i ) for (sal_Int32 i = 0; i < aTxt.getLength(); ++i)
{ {
if( sal_Unicode(' ') == aTxt.GetChar(i) || sal_Unicode('\t') == aTxt.GetChar(i) ) if( aTxt[i] == ' ' || aTxt[i] == '\t')
bBlank = sal_True; bBlank = true;
else else
{ {
if( bBlank ) if (bBlank)
{ {
rtl::OUString aTemp(aTxt.GetChar(i)); OUString sTitle(aCharClass.uppercase(OUString(aTxt[i])));
aTemp = aCharClass.uppercase( aTemp ); aTxt = aTxt.replaceAt(i, 1, sTitle);
aTxt.Replace( i, 1, aTemp );
} }
bBlank = sal_False; bBlank = false;
} }
} }
break; break;

View File

@@ -240,19 +240,22 @@ void OutlinerParaObject::ClearPortionInfo()
mpImplOutlinerParaObject->mpEditTextObject->ClearPortionInfo(); mpImplOutlinerParaObject->mpEditTextObject->ClearPortionInfo();
} }
bool OutlinerParaObject::ChangeStyleSheets(const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily) bool OutlinerParaObject::ChangeStyleSheets(const OUString& rOldName,
SfxStyleFamily eOldFamily, const OUString& rNewName, SfxStyleFamily eNewFamily)
{ {
ImplMakeUnique(); ImplMakeUnique();
return mpImplOutlinerParaObject->mpEditTextObject->ChangeStyleSheets(rOldName, eOldFamily, rNewName, eNewFamily); return mpImplOutlinerParaObject->mpEditTextObject->ChangeStyleSheets(rOldName, eOldFamily, rNewName, eNewFamily);
} }
void OutlinerParaObject::ChangeStyleSheetName(SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName) void OutlinerParaObject::ChangeStyleSheetName(SfxStyleFamily eFamily,
const OUString& rOldName, const OUString& rNewName)
{ {
ImplMakeUnique(); ImplMakeUnique();
mpImplOutlinerParaObject->mpEditTextObject->ChangeStyleSheetName(eFamily, rOldName, rNewName); mpImplOutlinerParaObject->mpEditTextObject->ChangeStyleSheetName(eFamily, rOldName, rNewName);
} }
void OutlinerParaObject::SetStyleSheets(sal_uInt16 nLevel, const XubString rNewName, const SfxStyleFamily& rNewFamily) void OutlinerParaObject::SetStyleSheets(sal_uInt16 nLevel, const OUString rNewName,
const SfxStyleFamily& rNewFamily)
{ {
const sal_uInt32 nCount(mpImplOutlinerParaObject->maParagraphDataVector.size()); const sal_uInt32 nCount(mpImplOutlinerParaObject->maParagraphDataVector.size());

View File

@@ -44,7 +44,7 @@ class SubsetMap;
/**************************************************************************/ /**************************************************************************/
void SetFontStyle(const XubString &rStyleName, Font &rFont); void SetFontStyle(const OUString &rStyleName, Font &rFont);
/**************************************************************************/ /**************************************************************************/
@@ -382,7 +382,7 @@ public:
SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell, bool bFreeRes = true); SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell, bool bFreeRes = true);
virtual ~SmSymbolDialog(); virtual ~SmSymbolDialog();
bool SelectSymbolSet(const XubString &rSymbolSetName); bool SelectSymbolSet(const OUString &rSymbolSetName);
void SelectSymbol(sal_uInt16 nSymbolPos); void SelectSymbol(sal_uInt16 nSymbolPos);
sal_uInt16 GetSelectedSymbol() const { return aSymbolSetDisplay.GetSelectSymbol(); } sal_uInt16 GetSelectedSymbol() const { return aSymbolSetDisplay.GetSelectSymbol(); }
}; };
@@ -462,16 +462,16 @@ class SmSymDefineDialog : public ModalDialog
void FillStyles(bool bDeleteText = true); void FillStyles(bool bDeleteText = true);
void SetSymbolSetManager(const SmSymbolManager &rMgr); void SetSymbolSetManager(const SmSymbolManager &rMgr);
void SetFont(const XubString &rFontName, const XubString &rStyleName); void SetFont(const OUString &rFontName, const OUString &rStyleName);
void SetOrigSymbol(const SmSym *pSymbol, const XubString &rSymbolSetName); void SetOrigSymbol(const SmSym *pSymbol, const OUString &rSymbolSetName);
void UpdateButtons(); void UpdateButtons();
bool SelectSymbolSet(ComboBox &rComboBox, const XubString &rSymbolSetName, bool SelectSymbolSet(ComboBox &rComboBox, const OUString &rSymbolSetName,
bool bDeleteText); bool bDeleteText);
bool SelectSymbol(ComboBox &rComboBox, const XubString &rSymbolName, bool SelectSymbol(ComboBox &rComboBox, const OUString &rSymbolName,
bool bDeleteText); bool bDeleteText);
bool SelectFont(const XubString &rFontName, bool bApplyFont); bool SelectFont(const OUString &rFontName, bool bApplyFont);
bool SelectStyle(const XubString &rStyleName, bool bApplyFont); bool SelectStyle(const OUString &rStyleName, bool bApplyFont);
SmSym * GetSymbol(const ComboBox &rComboBox); SmSym * GetSymbol(const ComboBox &rComboBox);
const SmSym * GetSymbol(const ComboBox &rComboBox) const const SmSym * GetSymbol(const ComboBox &rComboBox) const
@@ -492,28 +492,28 @@ public:
// Dialog // Dialog
virtual short Execute(); virtual short Execute();
bool SelectOldSymbolSet(const XubString &rSymbolSetName) bool SelectOldSymbolSet(const OUString &rSymbolSetName)
{ {
return SelectSymbolSet(aOldSymbolSets, rSymbolSetName, false); return SelectSymbolSet(aOldSymbolSets, rSymbolSetName, false);
} }
bool SelectOldSymbol(const XubString &rSymbolName) bool SelectOldSymbol(const OUString &rSymbolName)
{ {
return SelectSymbol(aOldSymbols, rSymbolName, false); return SelectSymbol(aOldSymbols, rSymbolName, false);
} }
bool SelectSymbolSet(const XubString &rSymbolSetName) bool SelectSymbolSet(const OUString &rSymbolSetName)
{ {
return SelectSymbolSet(aSymbolSets, rSymbolSetName, false); return SelectSymbolSet(aSymbolSets, rSymbolSetName, false);
} }
bool SelectSymbol(const XubString &rSymbolName) bool SelectSymbol(const OUString &rSymbolName)
{ {
return SelectSymbol(aSymbols, rSymbolName, false); return SelectSymbol(aSymbols, rSymbolName, false);
} }
bool SelectFont(const XubString &rFontName) { return SelectFont(rFontName, true); } bool SelectFont(const OUString &rFontName) { return SelectFont(rFontName, true); }
bool SelectStyle(const XubString &rStyleName) { return SelectStyle(rStyleName, true); }; bool SelectStyle(const OUString &rStyleName) { return SelectStyle(rStyleName, true); };
void SelectChar(xub_Unicode cChar); void SelectChar(xub_Unicode cChar);
}; };

View File

@@ -40,24 +40,24 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
inline const String GetExportSymbolName( const String &rUiSymbolName ) inline const OUString GetExportSymbolName( const OUString &rUiSymbolName )
{ {
return SM_MOD()->GetLocSymbolData().GetExportSymbolName( rUiSymbolName ); return SM_MOD()->GetLocSymbolData().GetExportSymbolName( rUiSymbolName );
} }
inline const String GetUiSymbolName( const String &rExportSymbolName ) inline const OUString GetUiSymbolName( const OUString &rExportSymbolName )
{ {
return SM_MOD()->GetLocSymbolData().GetUiSymbolName( rExportSymbolName ); return SM_MOD()->GetLocSymbolData().GetUiSymbolName( rExportSymbolName );
} }
inline const String GetExportSymbolSetName( const String &rUiSymbolSetName ) inline const OUString GetExportSymbolSetName( const OUString &rUiSymbolSetName )
{ {
return SM_MOD()->GetLocSymbolData().GetExportSymbolSetName( rUiSymbolSetName ); return SM_MOD()->GetLocSymbolData().GetExportSymbolSetName( rUiSymbolSetName );
} }
inline const String GetUiSymbolSetName( const String &rExportSymbolSetName ) inline const OUString GetUiSymbolSetName( const OUString &rExportSymbolSetName )
{ {
return SM_MOD()->GetLocSymbolData().GetUiSymbolSetName( rExportSymbolSetName ); return SM_MOD()->GetLocSymbolData().GetUiSymbolSetName( rExportSymbolSetName );
} }
@@ -68,37 +68,33 @@ class SmSym
{ {
private: private:
SmFace m_aFace; SmFace m_aFace;
String m_aName; OUString m_aName;
String m_aExportName; OUString m_aExportName;
String m_aSetName; OUString m_aSetName;
sal_UCS4 m_cChar; sal_UCS4 m_cChar;
bool m_bPredefined; bool m_bPredefined;
bool m_bDocSymbol; bool m_bDocSymbol;
public: public:
SmSym(); SmSym();
SmSym(const String& rName, const Font& rFont, sal_UCS4 cChar, SmSym(const OUString& rName, const Font& rFont, sal_UCS4 cChar,
const String& rSet, bool bIsPredefined = false); const OUString& rSet, bool bIsPredefined = false);
SmSym(const SmSym& rSymbol); SmSym(const SmSym& rSymbol);
SmSym& operator = (const SmSym& rSymbol); SmSym& operator = (const SmSym& rSymbol);
const Font& GetFace() const { return m_aFace; } const Font& GetFace() const { return m_aFace; }
sal_UCS4 GetCharacter() const { return m_cChar; } sal_UCS4 GetCharacter() const { return m_cChar; }
const String& GetName() const { return m_aName; } const OUString& GetName() const { return m_aName; }
void SetFace( const Font& rFont ) { m_aFace = rFont; } void SetFace( const Font& rFont ) { m_aFace = rFont; }
void SetCharacter( sal_UCS4 cChar ) { m_cChar = cChar; } void SetCharacter( sal_UCS4 cChar ) { m_cChar = cChar; }
//! since the symbol name is also used as key in the map it should not be possible to change the name
//! because ten the key would not be the same as its supposed copy here
// void SetName( const String &rTxt ) { m_aName = rTxt; }
bool IsPredefined() const { return m_bPredefined; } bool IsPredefined() const { return m_bPredefined; }
const String & GetSymbolSetName() const { return m_aSetName; } const OUString& GetSymbolSetName() const { return m_aSetName; }
void SetSymbolSetName( const String &rName ) { m_aSetName = rName; } void SetSymbolSetName( const OUString &rName ) { m_aSetName = rName; }
const String & GetExportName() const { return m_aExportName; } const OUString& GetExportName() const { return m_aExportName; }
void SetExportName( const String &rName ) { m_aExportName = rName; } void SetExportName( const OUString &rName ) { m_aExportName = rName; }
bool IsDocSymbol() const { return m_bDocSymbol; } bool IsDocSymbol() const { return m_bDocSymbol; }
void SetDocSymbol( bool bVal ) { m_bDocSymbol = bVal; } void SetDocSymbol( bool bVal ) { m_bDocSymbol = bVal; }
@@ -107,20 +103,8 @@ public:
bool IsEqualInUI( const SmSym& rSymbol ) const; bool IsEqualInUI( const SmSym& rSymbol ) const;
}; };
/**************************************************************************/
struct lt_String
{
bool operator()( const String &r1, const String &r2 ) const
{
// r1 < r2 ?
return r1.CompareTo( r2 ) == COMPARE_LESS;
}
};
// type of the actual container to hold the symbols // type of the actual container to hold the symbols
typedef std::map< String, SmSym, lt_String > SymbolMap_t; typedef std::map< OUString, SmSym > SymbolMap_t;
// vector of pointers to the actual symbols in the above container // vector of pointers to the actual symbols in the above container
typedef std::vector< const SmSym * > SymbolPtrVec_t; typedef std::vector< const SmSym * > SymbolPtrVec_t;
@@ -151,16 +135,16 @@ public:
SmSymbolManager & operator = (const SmSymbolManager& rSymbolSetManager); SmSymbolManager & operator = (const SmSymbolManager& rSymbolSetManager);
// symbol sets are for UI purpose only, thus we assemble them here // symbol sets are for UI purpose only, thus we assemble them here
std::set< String > GetSymbolSetNames() const; std::set< OUString > GetSymbolSetNames() const;
const SymbolPtrVec_t GetSymbolSet( const String& rSymbolSetName ); const SymbolPtrVec_t GetSymbolSet( const OUString& rSymbolSetName );
sal_uInt16 GetSymbolCount() const { return static_cast< sal_uInt16 >(m_aSymbols.size()); } sal_uInt16 GetSymbolCount() const { return static_cast< sal_uInt16 >(m_aSymbols.size()); }
const SymbolPtrVec_t GetSymbols() const; const SymbolPtrVec_t GetSymbols() const;
bool AddOrReplaceSymbol( const SmSym & rSymbol, bool bForceChange = false ); bool AddOrReplaceSymbol( const SmSym & rSymbol, bool bForceChange = false );
void RemoveSymbol( const String & rSymbolName ); void RemoveSymbol( const OUString & rSymbolName );
SmSym * GetSymbolByName(const String& rSymbolName); SmSym * GetSymbolByName(const OUString& rSymbolName);
const SmSym * GetSymbolByName(const String& rSymbolName) const const SmSym * GetSymbolByName(const OUString& rSymbolName) const
{ {
return ((SmSymbolManager *) this)->GetSymbolByName(rSymbolName); return ((SmSymbolManager *) this)->GetSymbolByName(rSymbolName);
} }

View File

@@ -809,7 +809,7 @@ void SmMathConfig::StripFontFormatList( const std::vector< SmSym > &rSymbols )
SmFontFormatList aUsedList; SmFontFormatList aUsedList;
for (i = 0; i < rSymbols.size(); ++i) for (i = 0; i < rSymbols.size(); ++i)
{ {
OSL_ENSURE( rSymbols[i].GetName().Len() > 0, "non named symbol" ); OSL_ENSURE( rSymbols[i].GetName().getLength() > 0, "non named symbol" );
aUsedList.GetFontFormatId( SmFontFormat( rSymbols[i].GetFace() ) , true ); aUsedList.GetFontFormatId( SmFontFormat( rSymbols[i].GetFace() ) , true );
} }
const SmFormat & rStdFmt = GetStandardFormat(); const SmFormat & rStdFmt = GetStandardFormat();

View File

@@ -59,18 +59,18 @@ using ::rtl::OUString;
class SmFontStyles class SmFontStyles
{ {
String aNormal; OUString aNormal;
String aBold; OUString aBold;
String aItalic; OUString aItalic;
String aBoldItalic; OUString aBoldItalic;
String aEmpty; OUString aEmpty;
public: public:
SmFontStyles(); SmFontStyles();
sal_uInt16 GetCount() const { return 4; } sal_uInt16 GetCount() const { return 4; }
const String & GetStyleName( const Font &rFont ) const; const OUString& GetStyleName( const Font &rFont ) const;
const String & GetStyleName( sal_uInt16 nIdx ) const; const OUString& GetStyleName( sal_uInt16 nIdx ) const;
}; };
@@ -81,12 +81,12 @@ SmFontStyles::SmFontStyles() :
{ {
aBoldItalic = aBold; aBoldItalic = aBold;
aBoldItalic.AppendAscii( ", " ); aBoldItalic += ", ";
aBoldItalic += aItalic; aBoldItalic += aItalic;
} }
const String & SmFontStyles::GetStyleName( const Font &rFont ) const const OUString& SmFontStyles::GetStyleName( const Font &rFont ) const
{ {
//! compare also SmSpecialNode::Prepare //! compare also SmSpecialNode::Prepare
bool bBold = IsBold( rFont ), bool bBold = IsBold( rFont ),
@@ -98,12 +98,11 @@ const String & SmFontStyles::GetStyleName( const Font &rFont ) const
return aItalic; return aItalic;
else if (bBold) else if (bBold)
return aBold; return aBold;
else return aNormal;
return aNormal;
} }
const String & SmFontStyles::GetStyleName( sal_uInt16 nIdx ) const const OUString& SmFontStyles::GetStyleName( sal_uInt16 nIdx ) const
{ {
// 0 = "normal", 1 = "italic", // 0 = "normal", 1 = "italic",
// 2 = "bold", 3 = "bold italic" // 2 = "bold", 3 = "bold italic"
@@ -130,17 +129,17 @@ const SmFontStyles & GetFontStyles()
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
void SetFontStyle(const XubString &rStyleName, Font &rFont) void SetFontStyle(const OUString &rStyleName, Font &rFont)
{ {
// Find index related to StyleName. For an empty StyleName it's assumed to be // Find index related to StyleName. For an empty StyleName it's assumed to be
// 0 (neither bold nor italic). // 0 (neither bold nor italic).
sal_uInt16 nIndex = 0; sal_uInt16 nIndex = 0;
if (rStyleName.Len()) if (!rStyleName.isEmpty())
{ {
sal_uInt16 i; sal_uInt16 i;
const SmFontStyles &rStyles = GetFontStyles(); const SmFontStyles &rStyles = GetFontStyles();
for (i = 0; i < rStyles.GetCount(); i++) for (i = 0; i < rStyles.GetCount(); ++i)
if (rStyleName.CompareTo( rStyles.GetStyleName(i) ) == COMPARE_EQUAL) if (rStyleName == rStyles.GetStyleName(i))
break; break;
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
OSL_ENSURE(i < rStyles.GetCount(), "style-name unknown"); OSL_ENSURE(i < rStyles.GetCount(), "style-name unknown");
@@ -242,7 +241,7 @@ void SmShowFont::Paint(const Rectangle& rRect )
{ {
Control::Paint( rRect ); Control::Paint( rRect );
XubString Text (GetFont().GetName()); OUString Text (GetFont().GetName());
Size TextSize(GetTextWidth(Text), GetTextHeight()); Size TextSize(GetTextWidth(Text), GetTextHeight());
DrawText(Point((GetOutputSize().Width() - TextSize.Width()) / 2, DrawText(Point((GetOutputSize().Width() - TextSize.Width()) / 2,
@@ -801,10 +800,7 @@ void SmDistanceDialog::SetHelpId(MetricField &rField, const rtl::OString& sHelpI
// HelpIDs which are explicitly set in this way have to be defined in the // HelpIDs which are explicitly set in this way have to be defined in the
// util directory in the file "hidother.src" with the help of "hidspecial"! // util directory in the file "hidother.src" with the help of "hidspecial"!
const XubString aEmptyText; const OUString aEmptyText;
#if OSL_DEBUG_LEVEL > 1
OSL_ENSURE(aEmptyText.Len() == 0, "Sm: Ooops...");
#endif
rField.SetHelpId(sHelpId); rField.SetHelpId(sHelpId);
rField.SetHelpText(aEmptyText); rField.SetHelpText(aEmptyText);
@@ -1360,7 +1356,7 @@ void SmShowSymbol::Paint(const Rectangle &rRect)
{ {
Control::Paint( rRect ); Control::Paint( rRect );
const XubString &rText = GetText(); const OUString &rText = GetText();
Size aTextSize(GetTextWidth(rText), GetTextHeight()); Size aTextSize(GetTextWidth(rText), GetTextHeight());
DrawText(Point((GetOutputSize().Width() - aTextSize.Width()) / 2, DrawText(Point((GetOutputSize().Width() - aTextSize.Width()) / 2,
@@ -1407,8 +1403,8 @@ void SmSymbolDialog::FillSymbolSets(bool bDeleteText)
if (bDeleteText) if (bDeleteText)
aSymbolSets.SetNoSelection(); aSymbolSets.SetNoSelection();
std::set< String > aSybolSetNames( rSymbolMgr.GetSymbolSetNames() ); std::set< OUString > aSybolSetNames( rSymbolMgr.GetSymbolSetNames() );
std::set< String >::const_iterator aIt( aSybolSetNames.begin() ); std::set< OUString >::const_iterator aIt( aSybolSetNames.begin() );
for ( ; aIt != aSybolSetNames.end(); ++aIt) for ( ; aIt != aSybolSetNames.end(); ++aIt)
aSymbolSets.InsertEntry( *aIt ); aSymbolSets.InsertEntry( *aIt );
} }
@@ -1447,7 +1443,7 @@ IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, EMPTYARG pButton )
SmSymDefineDialog *pDialog = new SmSymDefineDialog(this, pFontListDev, rSymbolMgr); SmSymDefineDialog *pDialog = new SmSymDefineDialog(this, pFontListDev, rSymbolMgr);
// set current symbol and SymbolSet for the new dialog // set current symbol and SymbolSet for the new dialog
const XubString aSymSetName (aSymbolSets.GetSelectEntry()), const OUString aSymSetName (aSymbolSets.GetSelectEntry()),
aSymName (aSymbolName.GetText()); aSymName (aSymbolName.GetText());
pDialog->SelectOldSymbolSet(aSymSetName); pDialog->SelectOldSymbolSet(aSymSetName);
pDialog->SelectOldSymbol(aSymName); pDialog->SelectOldSymbol(aSymName);
@@ -1455,7 +1451,7 @@ IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, EMPTYARG pButton )
pDialog->SelectSymbol(aSymName); pDialog->SelectSymbol(aSymName);
// remember old SymbolSet // remember old SymbolSet
XubString aOldSymbolSet (aSymbolSets.GetSelectEntry()); OUString aOldSymbolSet (aSymbolSets.GetSelectEntry());
sal_uInt16 nSymPos = GetSelectedSymbol(); sal_uInt16 nSymPos = GetSelectedSymbol();
@@ -1625,7 +1621,7 @@ void SmSymbolDialog::DataChanged( const DataChangedEvent& rDCEvt )
} }
bool SmSymbolDialog::SelectSymbolSet(const XubString &rSymbolSetName) bool SmSymbolDialog::SelectSymbolSet(const OUString &rSymbolSetName)
{ {
bool bRet = false; bool bRet = false;
sal_uInt16 nPos = aSymbolSets.GetEntryPos(rSymbolSetName); sal_uInt16 nPos = aSymbolSets.GetEntryPos(rSymbolSetName);
@@ -1663,7 +1659,7 @@ void SmSymbolDialog::SelectSymbol(sal_uInt16 nSymbolNo)
aSymbolSetDisplay.SelectSymbol(nSymbolNo); aSymbolSetDisplay.SelectSymbol(nSymbolNo);
aSymbolDisplay.SetSymbol(pSym); aSymbolDisplay.SetSymbol(pSym);
aSymbolName.SetText(pSym ? pSym->GetName() : XubString()); aSymbolName.SetText(pSym ? pSym->GetName() : OUString());
} }
@@ -1751,8 +1747,8 @@ void SmSymDefineDialog::FillSymbolSets(ComboBox &rComboBox, bool bDeleteText)
if (bDeleteText) if (bDeleteText)
rComboBox.SetText(rtl::OUString()); rComboBox.SetText(rtl::OUString());
const std::set< String > aSymbolSetNames( aSymbolMgrCopy.GetSymbolSetNames() ); const std::set< OUString > aSymbolSetNames( aSymbolMgrCopy.GetSymbolSetNames() );
std::set< String >::const_iterator aIt( aSymbolSetNames.begin() ); std::set< OUString >::const_iterator aIt( aSymbolSetNames.begin() );
for ( ; aIt != aSymbolSetNames.end(); ++aIt) for ( ; aIt != aSymbolSetNames.end(); ++aIt)
rComboBox.InsertEntry( *aIt ); rComboBox.InsertEntry( *aIt );
} }
@@ -1782,8 +1778,8 @@ void SmSymDefineDialog::FillStyles(bool bDeleteText)
if (bDeleteText) if (bDeleteText)
aStyles.SetText(rtl::OUString()); aStyles.SetText(rtl::OUString());
XubString aText (aFonts.GetSelectEntry()); OUString aText (aFonts.GetSelectEntry());
if (aText.Len() != 0) if (!aText.isEmpty())
{ {
// use own StyleNames // use own StyleNames
const SmFontStyles &rStyles = GetFontStyles(); const SmFontStyles &rStyles = GetFontStyles();
@@ -2040,16 +2036,16 @@ void SmSymDefineDialog::UpdateButtons()
bool bAdd = false, bool bAdd = false,
bChange = false, bChange = false,
bDelete = false; bDelete = false;
XubString aTmpSymbolName (aSymbols.GetText()), OUString aTmpSymbolName (aSymbols.GetText()),
aTmpSymbolSetName (aSymbolSets.GetText()); aTmpSymbolSetName (aSymbolSets.GetText());
if (aTmpSymbolName.Len() > 0 && aTmpSymbolSetName.Len() > 0) if (aTmpSymbolName.getLength() > 0 && aTmpSymbolSetName.getLength() > 0)
{ {
// are all settings equal? // are all settings equal?
//! (Font-, Style- und SymbolSet name comparison is not case sensitive) //! (Font-, Style- und SymbolSet name comparison is not case sensitive)
bool bEqual = pOrigSymbol bool bEqual = pOrigSymbol
&& aTmpSymbolSetName.EqualsIgnoreCaseAscii(aOldSymbolSetName.GetText()) && aTmpSymbolSetName.equalsIgnoreAsciiCase(aOldSymbolSetName.GetText())
&& aTmpSymbolName.Equals(pOrigSymbol->GetName()) && aTmpSymbolName.equals(pOrigSymbol->GetName())
&& aFonts.GetSelectEntry().EqualsIgnoreCaseAscii( && aFonts.GetSelectEntry().EqualsIgnoreCaseAscii(
pOrigSymbol->GetFace().GetName()) pOrigSymbol->GetFace().GetName())
&& aStyles.GetText().EqualsIgnoreCaseAscii( && aStyles.GetText().EqualsIgnoreCaseAscii(
@@ -2245,7 +2241,7 @@ void SmSymDefineDialog::SetSymbolSetManager(const SmSymbolManager &rMgr)
bool SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox, bool SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox,
const XubString &rSymbolSetName, bool bDeleteText) const OUString &rSymbolSetName, bool bDeleteText)
{ {
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
OSL_ENSURE(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets, OSL_ENSURE(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets,
@@ -2253,7 +2249,7 @@ bool SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox,
#endif #endif
// trim SymbolName (no leading and trailing blanks) // trim SymbolName (no leading and trailing blanks)
XubString aNormName (rSymbolSetName); OUString aNormName (rSymbolSetName);
aNormName = comphelper::string::stripStart(aNormName, ' '); aNormName = comphelper::string::stripStart(aNormName, ' ');
aNormName = comphelper::string::stripEnd(aNormName, ' '); aNormName = comphelper::string::stripEnd(aNormName, ' ');
// and remove possible deviations within the input // and remove possible deviations within the input
@@ -2283,7 +2279,7 @@ bool SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox,
// display a valid respectively no symbol when changing the SymbolSets // display a valid respectively no symbol when changing the SymbolSets
if (bIsOld) if (bIsOld)
{ {
XubString aTmpOldSymbolName; OUString aTmpOldSymbolName;
if (aOldSymbols.GetEntryCount() > 0) if (aOldSymbols.GetEntryCount() > 0)
aTmpOldSymbolName = aOldSymbols.GetEntry(0); aTmpOldSymbolName = aOldSymbols.GetEntry(0);
SelectSymbol(aOldSymbols, aTmpOldSymbolName, true); SelectSymbol(aOldSymbols, aTmpOldSymbolName, true);
@@ -2296,13 +2292,13 @@ bool SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox,
void SmSymDefineDialog::SetOrigSymbol(const SmSym *pSymbol, void SmSymDefineDialog::SetOrigSymbol(const SmSym *pSymbol,
const XubString &rSymbolSetName) const OUString &rSymbolSetName)
{ {
// clear old symbol // clear old symbol
delete pOrigSymbol; delete pOrigSymbol;
pOrigSymbol = 0; pOrigSymbol = 0;
XubString aSymName, OUString aSymName,
aSymSetName; aSymSetName;
if (pSymbol) if (pSymbol)
{ {
@@ -2324,7 +2320,7 @@ void SmSymDefineDialog::SetOrigSymbol(const SmSym *pSymbol,
bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox, bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
const XubString &rSymbolName, bool bDeleteText) const OUString &rSymbolName, bool bDeleteText)
{ {
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
OSL_ENSURE(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols, OSL_ENSURE(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols,
@@ -2332,7 +2328,7 @@ bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
#endif #endif
// trim SymbolName (no blanks) // trim SymbolName (no blanks)
XubString aNormName(comphelper::string::remove(rSymbolName, ' ')); OUString aNormName(comphelper::string::remove(rSymbolName, ' '));
// and remove possible deviations within the input // and remove possible deviations within the input
rComboBox.SetText(aNormName); rComboBox.SetText(aNormName);
@@ -2379,7 +2375,7 @@ bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
{ {
// if there's a change of the old symbol, show only the available ones, otherwise show none // if there's a change of the old symbol, show only the available ones, otherwise show none
const SmSym *pOldSymbol = NULL; const SmSym *pOldSymbol = NULL;
XubString aTmpOldSymbolSetName; OUString aTmpOldSymbolSetName;
if (nPos != COMBOBOX_ENTRY_NOTFOUND) if (nPos != COMBOBOX_ENTRY_NOTFOUND)
{ {
pOldSymbol = aSymbolMgrCopy.GetSymbolByName(aNormName); pOldSymbol = aSymbolMgrCopy.GetSymbolByName(aNormName);
@@ -2396,7 +2392,7 @@ bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
} }
void SmSymDefineDialog::SetFont(const XubString &rFontName, const XubString &rStyleName) void SmSymDefineDialog::SetFont(const OUString &rFontName, const OUString &rStyleName)
{ {
// get Font (FontInfo) matching name and style // get Font (FontInfo) matching name and style
FontInfo aFI; FontInfo aFI;
@@ -2432,7 +2428,7 @@ void SmSymDefineDialog::SetFont(const XubString &rFontName, const XubString &rSt
} }
bool SmSymDefineDialog::SelectFont(const XubString &rFontName, bool bApplyFont) bool SmSymDefineDialog::SelectFont(const OUString &rFontName, bool bApplyFont)
{ {
bool bRet = false; bool bRet = false;
sal_uInt16 nPos = aFonts.GetEntryPos(rFontName); sal_uInt16 nPos = aFonts.GetEntryPos(rFontName);
@@ -2460,7 +2456,7 @@ bool SmSymDefineDialog::SelectFont(const XubString &rFontName, bool bApplyFont)
} }
bool SmSymDefineDialog::SelectStyle(const XubString &rStyleName, bool bApplyFont) bool SmSymDefineDialog::SelectStyle(const OUString &rStyleName, bool bApplyFont)
{ {
bool bRet = false; bool bRet = false;
sal_uInt16 nPos = aStyles.GetEntryPos(rStyleName); sal_uInt16 nPos = aStyles.GetEntryPos(rStyleName);

View File

@@ -2869,7 +2869,7 @@ static bool lcl_IsFromGreekSymbolSet( const String &rTokenText )
{ {
String aName( rTokenText.Copy(1) ); String aName( rTokenText.Copy(1) );
SmSym *pSymbol = SM_MOD()->GetSymbolManager().GetSymbolByName( aName ); SmSym *pSymbol = SM_MOD()->GetSymbolManager().GetSymbolByName( aName );
if (pSymbol && GetExportSymbolSetName( pSymbol->GetSymbolSetName() ).EqualsAscii( "Greek" ) ) if (pSymbol && GetExportSymbolSetName(pSymbol->GetSymbolSetName()) == "Greek")
bRes = true; bRes = true;
} }

View File

@@ -47,8 +47,8 @@ using namespace ::rtl;
/**************************************************************************/ /**************************************************************************/
SmSym::SmSym() : SmSym::SmSym() :
m_aName(rtl::OUString("unknown")), m_aName(OUString("unknown")),
m_aSetName(rtl::OUString("unknown")), m_aSetName(OUString("unknown")),
m_cChar('\0'), m_cChar('\0'),
m_bPredefined(false), m_bPredefined(false),
m_bDocSymbol(false) m_bDocSymbol(false)
@@ -65,8 +65,8 @@ SmSym::SmSym(const SmSym& rSymbol)
} }
SmSym::SmSym(const String& rName, const Font& rFont, sal_UCS4 cChar, SmSym::SmSym(const OUString& rName, const Font& rFont, sal_UCS4 cChar,
const String& rSet, bool bIsPredefined) const OUString& rSet, bool bIsPredefined)
{ {
m_aName = m_aExportName = rName; m_aName = m_aExportName = rName;
@@ -141,7 +141,7 @@ SmSymbolManager& SmSymbolManager::operator = (const SmSymbolManager& rSymbolSetM
} }
SmSym *SmSymbolManager::GetSymbolByName(const String& rSymbolName) SmSym *SmSymbolManager::GetSymbolByName(const OUString& rSymbolName)
{ {
SmSym *pRes = NULL; SmSym *pRes = NULL;
SymbolMap_t::iterator aIt( m_aSymbols.find( rSymbolName ) ); SymbolMap_t::iterator aIt( m_aSymbols.find( rSymbolName ) );
@@ -166,8 +166,8 @@ bool SmSymbolManager::AddOrReplaceSymbol( const SmSym &rSymbol, bool bForceChang
{ {
bool bAdded = false; bool bAdded = false;
const String aSymbolName( rSymbol.GetName() ); const OUString aSymbolName( rSymbol.GetName() );
if (aSymbolName.Len() > 0 && rSymbol.GetSymbolSetName().Len() > 0) if (aSymbolName.getLength() > 0 && rSymbol.GetSymbolSetName().getLength() > 0)
{ {
const SmSym *pFound = GetSymbolByName( aSymbolName ); const SmSym *pFound = GetSymbolByName( aSymbolName );
const bool bSymbolConflict = pFound && !pFound->IsEqualInUI( rSymbol ); const bool bSymbolConflict = pFound && !pFound->IsEqualInUI( rSymbol );
@@ -198,9 +198,9 @@ bool SmSymbolManager::AddOrReplaceSymbol( const SmSym &rSymbol, bool bForceChang
} }
void SmSymbolManager::RemoveSymbol( const String & rSymbolName ) void SmSymbolManager::RemoveSymbol( const OUString & rSymbolName )
{ {
if (rSymbolName.Len() > 0) if (rSymbolName.getLength() > 0)
{ {
size_t nOldSize = m_aSymbols.size(); size_t nOldSize = m_aSymbols.size();
m_aSymbols.erase( rSymbolName ); m_aSymbols.erase( rSymbolName );
@@ -209,9 +209,9 @@ void SmSymbolManager::RemoveSymbol( const String & rSymbolName )
} }
std::set< String > SmSymbolManager::GetSymbolSetNames() const std::set< OUString > SmSymbolManager::GetSymbolSetNames() const
{ {
std::set< String > aRes; std::set< OUString > aRes;
SymbolMap_t::const_iterator aIt( m_aSymbols.begin() ); SymbolMap_t::const_iterator aIt( m_aSymbols.begin() );
for ( ; aIt != m_aSymbols.end(); ++aIt ) for ( ; aIt != m_aSymbols.end(); ++aIt )
aRes.insert( aIt->second.GetSymbolSetName() ); aRes.insert( aIt->second.GetSymbolSetName() );
@@ -219,10 +219,10 @@ std::set< String > SmSymbolManager::GetSymbolSetNames() const
} }
const SymbolPtrVec_t SmSymbolManager::GetSymbolSet( const String& rSymbolSetName ) const SymbolPtrVec_t SmSymbolManager::GetSymbolSet( const OUString& rSymbolSetName )
{ {
SymbolPtrVec_t aRes; SymbolPtrVec_t aRes;
if (rSymbolSetName.Len() > 0) if (rSymbolSetName.getLength() > 0)
{ {
SymbolMap_t::const_iterator aIt( m_aSymbols.begin() ); SymbolMap_t::const_iterator aIt( m_aSymbols.begin() );
for ( ; aIt != m_aSymbols.end(); ++aIt ) for ( ; aIt != m_aSymbols.end(); ++aIt )
@@ -246,8 +246,8 @@ void SmSymbolManager::Load()
for (size_t i = 0; i < nSymbolCount; ++i) for (size_t i = 0; i < nSymbolCount; ++i)
{ {
const SmSym &rSym = aSymbols[i]; const SmSym &rSym = aSymbols[i];
OSL_ENSURE( rSym.GetName().Len() > 0, "symbol without name!" ); OSL_ENSURE( rSym.GetName().getLength() > 0, "symbol without name!" );
if (rSym.GetName().Len() > 0) if (rSym.GetName().getLength() > 0)
AddOrReplaceSymbol( rSym ); AddOrReplaceSymbol( rSym );
} }
m_bModified = true; m_bModified = true;
@@ -260,9 +260,9 @@ void SmSymbolManager::Load()
// now add a %i... symbol to the 'iGreek' set for every symbol found in the 'Greek' set. // now add a %i... symbol to the 'iGreek' set for every symbol found in the 'Greek' set.
SmLocalizedSymbolData aLocalizedData; SmLocalizedSymbolData aLocalizedData;
const String aGreekSymbolSetName( aLocalizedData.GetUiSymbolSetName( OUString::createFromAscii( "Greek" ) )); const OUString aGreekSymbolSetName(aLocalizedData.GetUiSymbolSetName(OUString("Greek")));
const SymbolPtrVec_t aGreekSymbols( GetSymbolSet( aGreekSymbolSetName ) ); const SymbolPtrVec_t aGreekSymbols( GetSymbolSet( aGreekSymbolSetName ) );
String aSymbolSetName = rtl::OUString('i'); String aSymbolSetName = OUString('i');
aSymbolSetName += aGreekSymbolSetName; aSymbolSetName += aGreekSymbolSetName;
size_t nSymbols = aGreekSymbols.size(); size_t nSymbols = aGreekSymbols.size();
for (size_t i = 0; i < nSymbols; ++i) for (size_t i = 0; i < nSymbols; ++i)
@@ -272,7 +272,7 @@ void SmSymbolManager::Load()
Font aFont( rSym.GetFace() ); Font aFont( rSym.GetFace() );
OSL_ENSURE( aFont.GetItalic() == ITALIC_NONE, "expected Font with ITALIC_NONE, failed." ); OSL_ENSURE( aFont.GetItalic() == ITALIC_NONE, "expected Font with ITALIC_NONE, failed." );
aFont.SetItalic( ITALIC_NORMAL ); aFont.SetItalic( ITALIC_NORMAL );
String aSymbolName = rtl::OUString('i'); String aSymbolName = OUString('i');
aSymbolName += rSym.GetName(); aSymbolName += rSym.GetName();
SmSym aSymbol( aSymbolName, aFont, rSym.GetCharacter(), SmSym aSymbol( aSymbolName, aFont, rSym.GetCharacter(),
aSymbolSetName, true /*bIsPredefined*/ ); aSymbolSetName, true /*bIsPredefined*/ );
@@ -289,8 +289,8 @@ void SmSymbolManager::Save()
// prepare to skip symbols from iGreek on saving // prepare to skip symbols from iGreek on saving
SmLocalizedSymbolData aLocalizedData; SmLocalizedSymbolData aLocalizedData;
String aSymbolSetName = rtl::OUString('i'); OUString aSymbolSetName('i');
aSymbolSetName += aLocalizedData.GetUiSymbolSetName( OUString::createFromAscii( "Greek" )); aSymbolSetName += aLocalizedData.GetUiSymbolSetName(OUString("Greek"));
SymbolPtrVec_t aTmp( GetSymbols() ); SymbolPtrVec_t aTmp( GetSymbols() );
std::vector< SmSym > aSymbols; std::vector< SmSym > aSymbols;