[Libreoffice-commits] core.git: sw/inc sw/source

Matteo Casalin matteo.casalin at yahoo.com
Tue Aug 13 22:53:50 PDT 2013


 sw/inc/tblafmt.hxx              |    8 ++++----
 sw/source/core/doc/tblafmt.cxx  |   22 ++++++++++------------
 sw/source/ui/table/tautofmt.cxx |   33 ++++++++++++++++-----------------
 3 files changed, 30 insertions(+), 33 deletions(-)

New commits:
commit e32a74ca1ba5c89f97b5741f376ae6a2c2ee32d4
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Tue Aug 13 20:22:13 2013 +0200

    String to OUString
    
    Change-Id: Ib185c067c52bb8c65441c30d4c61be24b0950afd
    Reviewed-on: https://gerrit.libreoffice.org/5394
    Reviewed-by: Tor Lillqvist <tml at iki.fi>
    Tested-by: Tor Lillqvist <tml at iki.fi>

diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index 404aaf6..8bb36f9 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -233,7 +233,7 @@ class SW_DLLPUBLIC SwTableAutoFmt
     friend void _FinitCore();       // To destroy dflt. pointer.
     static SwBoxAutoFmt* pDfltBoxAutoFmt;
 
-    String aName;
+    OUString m_aName;
     sal_uInt16 nStrResId;
 
     // Common flags of Calc and Writer.
@@ -259,7 +259,7 @@ class SW_DLLPUBLIC SwTableAutoFmt
     SvxShadowItem m_aShadow;
 
 public:
-    SwTableAutoFmt( const String& rName );
+    SwTableAutoFmt( const OUString& rName );
     SwTableAutoFmt( const SwTableAutoFmt& rNew );
     ~SwTableAutoFmt();
 
@@ -268,8 +268,8 @@ public:
     void SetBoxFmt( const SwBoxAutoFmt& rNew, sal_uInt8 nPos );
     const SwBoxAutoFmt& GetBoxFmt( sal_uInt8 nPos ) const;
 
-    void SetName( const String& rNew ) { aName = rNew; nStrResId = USHRT_MAX; }
-    const String& GetName() const { return aName; }
+    void SetName( const OUString& rNew ) { m_aName = rNew; nStrResId = USHRT_MAX; }
+    OUString GetName() const { return m_aName; }
 
     enum UpdateFlags { UPDATE_CHAR = 1, UPDATE_BOX = 2, UPDATE_ALL = 3 };
     void UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet,
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index fa7e792..8343b98 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -89,7 +89,7 @@ const sal_uInt16 AUTOFORMAT_FILE_VERSION= SOFFICE_FILEFORMAT_50;
 
 SwBoxAutoFmt* SwTableAutoFmt::pDfltBoxAutoFmt = 0;
 
-#define sAutoTblFmtName "autotbl.fmt"
+#define AUTOTABLE_FORMAT_NAME "autotbl.fmt"
 
 namespace
 {
@@ -583,8 +583,8 @@ sal_Bool SwBoxAutoFmt::SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion
     return 0 == rStream.GetError();
 }
 
-SwTableAutoFmt::SwTableAutoFmt( const String& rName )
-    : aName( rName )
+SwTableAutoFmt::SwTableAutoFmt( const OUString& rName )
+    : m_aName( rName )
     , nStrResId( USHRT_MAX )
     , m_aBreak( SVX_BREAK_NONE, RES_BREAK )
     , m_aKeepWithNextPara( sal_False, RES_KEEP )
@@ -631,7 +631,7 @@ SwTableAutoFmt& SwTableAutoFmt::operator=( const SwTableAutoFmt& rNew )
             aBoxAutoFmt[ n ] = 0;
     }
 
-    aName = rNew.aName;
+    m_aName = rNew.m_aName;
     nStrResId = rNew.nStrResId;
     bInclFont = rNew.bInclFont;
     bInclJustify = rNew.bInclJustify;
@@ -912,7 +912,7 @@ sal_Bool SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions
         sal_Bool b;
         // --- from 680/dr25 on: store strings as UTF-8
         CharSet eCharSet = (nVal >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet();
-        aName = rStream.ReadUniOrByteString( eCharSet );
+        m_aName = rStream.ReadUniOrByteString( eCharSet );
         if( AUTOFORMAT_DATA_ID_552 <= nVal )
         {
             rStream >> nStrResId;
@@ -920,7 +920,7 @@ sal_Bool SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions
             if( RID_SVXSTR_TBLAFMT_BEGIN <= nId &&
                 nId < RID_SVXSTR_TBLAFMT_END )
             {
-                aName = SVX_RESSTR( nId );
+                m_aName = SVX_RESSTR( nId );
             }
             else
                 nStrResId = USHRT_MAX;
@@ -969,7 +969,7 @@ sal_Bool SwTableAutoFmt::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
     sal_Bool b;
     rStream << nVal;
     // --- from 680/dr25 on: store strings as UTF-8
-    write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStream, aName,
+    write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rStream, m_aName,
         RTL_TEXTENCODING_UTF8 );
     rStream << nStrResId;
     rStream << ( b = bInclFont );
@@ -1048,7 +1048,7 @@ SwTableAutoFmtTbl::~SwTableAutoFmtTbl()
 SwTableAutoFmtTbl::SwTableAutoFmtTbl()
     : m_pImpl(new Impl)
 {
-    String sNm;
+    OUString sNm;
     SwTableAutoFmt* pNew = new SwTableAutoFmt(
                             SwStyleNameMapper::GetUIName( RES_POOLCOLL_STANDARD, sNm ) );
 
@@ -1107,7 +1107,7 @@ SwTableAutoFmtTbl::SwTableAutoFmtTbl()
 sal_Bool SwTableAutoFmtTbl::Load()
 {
     sal_Bool bRet = sal_False;
-    OUString sNm(OUString(sAutoTblFmtName));
+    OUString sNm(AUTOTABLE_FORMAT_NAME);
     SvtPathOptions aOpt;
     if( aOpt.SearchFile( sNm, SvtPathOptions::PATH_USERCONFIG ))
     {
@@ -1122,9 +1122,7 @@ sal_Bool SwTableAutoFmtTbl::Load()
 sal_Bool SwTableAutoFmtTbl::Save() const
 {
     SvtPathOptions aPathOpt;
-    String sNm( aPathOpt.GetUserConfigPath() );
-    sNm += INET_PATH_TOKEN;
-    sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( sAutoTblFmtName ));
+    const OUString sNm( aPathOpt.GetUserConfigPath() + OUString(INET_PATH_TOKEN) + AUTOTABLE_FORMAT_NAME );
     SfxMedium aStream(sNm, STREAM_STD_WRITE );
     return Save( *aStream.GetOutStream() ) && aStream.Commit();
 }
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 2b4d1cf..20b4589 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -101,10 +101,10 @@ public:
             SwStringInputDlg(     Window* pParent,
                             const String& rTitle,
                             const String& rEditTitle,
-                            const String& rDefault );
+                            const OUString& rDefault );
             ~SwStringInputDlg();
 
-    void GetInputString( String& rString ) const;
+    OUString GetInputString() const;
 
 private:
     Edit*           m_pEdInput;   // Edit obtains the focus.
@@ -112,7 +112,7 @@ private:
 
 
 SwStringInputDlg::SwStringInputDlg(Window* pParent, const String& rTitle,
-    const String& rEditTitle, const String& rDefault)
+    const String& rEditTitle, const OUString& rDefault)
     : ModalDialog(pParent, "StringInputDialog", "modules/swriter/ui/stringinput.ui")
 {
     get<FixedText>("name")->SetText(rEditTitle);
@@ -122,9 +122,9 @@ SwStringInputDlg::SwStringInputDlg(Window* pParent, const String& rTitle,
     m_pEdInput->SetText(rDefault);
 }
 
-void SwStringInputDlg::GetInputString( String& rString ) const
+OUString SwStringInputDlg::GetInputString() const
 {
-    rString = m_pEdInput->GetText();
+    return m_pEdInput->GetText();
 }
 
 
@@ -288,16 +288,15 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl)
     bool bOk = false, bFmtInserted = false;
     while( !bOk )
     {
-        SwStringInputDlg*   pDlg = new SwStringInputDlg( this,
-                                                            aStrTitle,
-                                                            aStrLabel,
-                                                            aEmptyStr );
+        SwStringInputDlg* pDlg = new SwStringInputDlg( this,
+                                                       aStrTitle,
+                                                       aStrLabel,
+                                                       OUString() );
         if( RET_OK == pDlg->Execute() )
         {
-            String aFormatName;
-            pDlg->GetInputString( aFormatName );
+            const OUString aFormatName( pDlg->GetInputString() );
 
-            if( aFormatName.Len() > 0 )
+            if ( !aFormatName.isEmpty() )
             {
                 sal_uInt16 n;
                 for( n = 0; n < pTableTbl->size(); ++n )
@@ -390,15 +389,15 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl)
     while( !bOk )
     {
         SwStringInputDlg* pDlg = new SwStringInputDlg( this,
-                        aStrRenameTitle, m_pLbFormat->GetSelectEntry(),
-                                                        aEmptyStr );
+                                                       aStrRenameTitle,
+                                                       m_pLbFormat->GetSelectEntry(),
+                                                       OUString() );
         if( pDlg->Execute() == RET_OK )
         {
             bool bFmtRenamed = false;
-            String aFormatName;
-            pDlg->GetInputString( aFormatName );
+            const OUString aFormatName( pDlg->GetInputString() );
 
-            if ( aFormatName.Len() > 0 )
+            if ( !aFormatName.isEmpty() )
             {
                 sal_uInt16 n;
                 for( n = 0; n < pTableTbl->size(); ++n )


More information about the Libreoffice-commits mailing list