[Libreoffice-commits] core.git: 2 commits - editeng/source include/editeng svx/source

Caolán McNamara caolanm at redhat.com
Fri Aug 9 03:41:59 PDT 2013


 editeng/source/editeng/editobj.cxx  |   18 +++++++++---------
 editeng/source/editeng/editobj2.hxx |    8 ++++----
 editeng/source/items/itemtype.cxx   |   32 +++++++++++++++++---------------
 editeng/source/misc/svxacorr.cxx    |   13 ++++++++-----
 include/editeng/editobj.hxx         |    8 ++++----
 include/editeng/itemtype.hxx        |    8 ++++----
 svx/source/svdraw/svdotxat.cxx      |    8 ++++----
 7 files changed, 50 insertions(+), 45 deletions(-)

New commits:
commit d2c3297eed9917c110da67b2a4c19265aecb38ed
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Aug 9 11:40:25 2013 +0100

    Resolves: fdo#67743 user autocorr file not written
    
    regression since c9c2fbe485de2bb831bd2e58faef87a19ceff622
    
    revert the logic change and keep the OUString conversion
    
    Change-Id: Ia4f8c3be2b6e325122ae7b21c431c301b8afecad

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 8b651a6..7936933 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1542,7 +1542,9 @@ sal_Bool SvxAutoCorrect::CreateLanguageFile( LanguageType eLang, sal_Bool bNewFi
 {
     OSL_ENSURE(pLangTable->find(eLang) == pLangTable->end(), "Language already exists ");
 
-    OUString sShareDirFile( GetAutoCorrFileName( eLang, sal_True, sal_False ));
+    OUString sUserDirFile( GetAutoCorrFileName( eLang, sal_True, sal_False ));
+    OUString sShareDirFile( sUserDirFile );
+
     SvxAutoCorrectLanguageListsPtr pLists = 0;
 
     Time nMinTime( 0, 2 ), nAktTime( Time::SYSTEM ), nLastCheckTime( Time::EMPTY );
@@ -1556,17 +1558,18 @@ sal_Bool SvxAutoCorrect::CreateLanguageFile( LanguageType eLang, sal_Bool bNewFi
         // 2 minutes.
         if( bNewFile )
         {
-            pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sShareDirFile );
+            sShareDirFile = sUserDirFile;
+            pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sUserDirFile );
             pLangTable->insert(eLang, pLists);
             aLastFileTable.erase(nFndPos);
         }
     }
-    else if( ( FStatHelper::IsDocument( sShareDirFile ) ||
+    else if( ( FStatHelper::IsDocument( sUserDirFile ) ||
                 FStatHelper::IsDocument( sShareDirFile =
                               GetAutoCorrFileName( eLang, sal_False, sal_False ) ) ) ||
-        ( sShareDirFile = sShareDirFile, bNewFile ))
+        ( sShareDirFile = sUserDirFile, bNewFile ))
     {
-        pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sShareDirFile );
+        pLists = new SvxAutoCorrectLanguageLists( *this, sShareDirFile, sUserDirFile );
         pLangTable->insert(eLang, pLists);
         if (nFndPos != aLastFileTable.end())
             aLastFileTable.erase(nFndPos);
commit 0136b4e524a50613148b7bea423f385cb5cf0e39
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Aug 9 09:25:28 2013 +0100

    XubString->OUString
    
    Change-Id: I888537cbaec11ef52b1e89b61f7351c6b7769819

diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index efb5eb1..bcbef1e 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -276,24 +276,24 @@ bool EditTextObject::RemoveCharAttribs( sal_uInt16 nWhich )
     return mpImpl->RemoveCharAttribs(nWhich);
 }
 
-void EditTextObject::GetStyleSheet(sal_Int32 nPara, String& rName, SfxStyleFamily& eFamily) const
+void EditTextObject::GetStyleSheet(sal_Int32 nPara, OUString& rName, SfxStyleFamily& eFamily) const
 {
     mpImpl->GetStyleSheet(nPara, rName, eFamily);
 }
 
-void EditTextObject::SetStyleSheet(sal_Int32 nPara, const String& rName, const SfxStyleFamily& eFamily)
+void EditTextObject::SetStyleSheet(sal_Int32 nPara, const OUString& rName, const SfxStyleFamily& eFamily)
 {
     mpImpl->SetStyleSheet(nPara, rName, eFamily);
 }
 
 bool EditTextObject::ChangeStyleSheets(
-    const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily )
+    const OUString& rOldName, SfxStyleFamily eOldFamily, const OUString& rNewName, SfxStyleFamily eNewFamily)
 {
     return mpImpl->ChangeStyleSheets(rOldName, eOldFamily, rNewName, eNewFamily);
 }
 
 void EditTextObject::ChangeStyleSheetName(
-    SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName )
+    SfxStyleFamily eFamily, const OUString& rOldName, const OUString& rNewName)
 {
     mpImpl->ChangeStyleSheetName(eFamily, rOldName, rNewName);
 }
@@ -824,7 +824,7 @@ bool EditTextObjectImpl::RemoveCharAttribs( sal_uInt16 _nWhich )
     return bChanged;
 }
 
-void EditTextObjectImpl::GetStyleSheet(sal_Int32 nPara, String& rName, SfxStyleFamily& rFamily) const
+void EditTextObjectImpl::GetStyleSheet(sal_Int32 nPara, OUString& rName, SfxStyleFamily& rFamily) const
 {
     if (nPara < 0 || static_cast<size_t>(nPara) >= aContents.size())
         return;
@@ -834,7 +834,7 @@ void EditTextObjectImpl::GetStyleSheet(sal_Int32 nPara, String& rName, SfxStyleF
     rFamily = rC.GetFamily();
 }
 
-void EditTextObjectImpl::SetStyleSheet(sal_Int32 nPara, const String& rName, const SfxStyleFamily& rFamily)
+void EditTextObjectImpl::SetStyleSheet(sal_Int32 nPara, const OUString& rName, const SfxStyleFamily& rFamily)
 {
     if (nPara < 0 || static_cast<size_t>(nPara) >= aContents.size())
         return;
@@ -868,8 +868,8 @@ bool EditTextObjectImpl::ImpChangeStyleSheets(
 }
 
 bool EditTextObjectImpl::ChangeStyleSheets(
-                    const XubString& rOldName, SfxStyleFamily eOldFamily,
-                    const XubString& rNewName, SfxStyleFamily eNewFamily )
+                    const OUString& rOldName, SfxStyleFamily eOldFamily,
+                    const OUString& rNewName, SfxStyleFamily eNewFamily)
 {
     sal_Bool bChanges = ImpChangeStyleSheets( rOldName, eOldFamily, rNewName, eNewFamily );
     if ( bChanges )
@@ -879,7 +879,7 @@ bool EditTextObjectImpl::ChangeStyleSheets(
 }
 
 void EditTextObjectImpl::ChangeStyleSheetName( SfxStyleFamily eFamily,
-                const XubString& rOldName, const XubString& rNewName )
+                const OUString& rOldName, const OUString& rNewName )
 {
     ImpChangeStyleSheets( rOldName, eFamily, rNewName, eFamily );
 }
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
index 3e056f1..d602753 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -228,11 +228,11 @@ public:
     const SfxItemSet& GetParaAttribs(sal_Int32 nPara) const;
     void SetParaAttribs(sal_Int32 nPara, const SfxItemSet& rAttribs);
 
-    void GetStyleSheet(sal_Int32 nPara, String& rName, SfxStyleFamily& eFamily) const;
-    void SetStyleSheet(sal_Int32 nPara, const String& rName, const SfxStyleFamily& eFamily);
+    void GetStyleSheet(sal_Int32 nPara, OUString& rName, SfxStyleFamily& eFamily) const;
+    void SetStyleSheet(sal_Int32 nPara, const OUString& rName, const SfxStyleFamily& eFamily);
     bool ChangeStyleSheets(
-        const XubString& rOldName, SfxStyleFamily eOldFamily, const String& rNewName, SfxStyleFamily eNewFamily );
-    void ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName );
+        const OUString& rOldName, SfxStyleFamily eOldFamily, const OUString& rNewName, SfxStyleFamily eNewFamily);
+    void ChangeStyleSheetName(SfxStyleFamily eFamily, const OUString& rOldName, const OUString& rNewName);
 
     editeng::FieldUpdater GetFieldUpdater();
 
diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx
index 519471c..ec28bbb 100644
--- a/editeng/source/items/itemtype.cxx
+++ b/editeng/source/items/itemtype.cxx
@@ -23,14 +23,14 @@
 #include <unotools/localedatawrapper.hxx>
 #include <editeng/itemtype.hxx>
 #include <editeng/eerdll.hxx>
+#include <rtl/ustrbuf.hxx>
 
 // -----------------------------------------------------------------------
 
-XubString GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, const IntlWrapper* pIntl    )
+OUString GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, const IntlWrapper* pIntl )
 {
     sal_Bool bNeg = sal_False;
-    long nRet = 0;
-    XubString sRet;
+    sal_Int32 nRet = 0;
 
     if ( nVal < 0 )
     {
@@ -63,7 +63,7 @@ XubString GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, c
         case SFX_MAPUNIT_10TH_INCH:
         case SFX_MAPUNIT_INCH:
         {
-            nRet = (long)OutputDevice::LogicToLogic(
+            nRet = OutputDevice::LogicToLogic(
                 nVal, (MapUnit)eSrcUnit, (MapUnit)SFX_MAPUNIT_1000TH_INCH );
 
             switch ( eDestUnit )
@@ -84,12 +84,12 @@ XubString GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, c
 
         default:
             OSL_FAIL( "not supported mapunit" );
-            return sRet;
+            return OUString();
     }
 
     if ( SFX_MAPUNIT_CM == eDestUnit || SFX_MAPUNIT_INCH == eDestUnit )
     {
-        long nMod = nRet % 10;
+        sal_Int32 nMod = nRet % 10;
 
         if ( nMod > 4 )
             nRet += 10 - nMod;
@@ -97,45 +97,47 @@ XubString GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, c
             nRet -= nMod;
     }
 
+    OUStringBuffer sRet;
+
     if ( bNeg )
-        sRet += sal_Unicode('-');
+        sRet.append('-');
 
     long nDiff = 1000;
     for( int nDigits = 4; nDigits; --nDigits, nDiff /= 10 )
     {
         if ( nRet < nDiff )
-            sRet += sal_Unicode('0');
+            sRet.append('0');
         else
-            sRet += OUString::number( nRet / nDiff );
+            sRet.append(nRet / nDiff);
         nRet %= nDiff;
         if( 4 == nDigits )
         {
             if(pIntl)
-                sRet += pIntl->getLocaleData()->getNumDecimalSep();
+                sRet.append(pIntl->getLocaleData()->getNumDecimalSep());
             else
-                sRet += ',';
+                sRet.append(',');
             if( !nRet )
             {
-                sRet += sal_Unicode('0');
+                sRet.append('0');
                 break;
             }
         }
         else if( !nRet )
             break;
     }
-    return sRet;
+    return sRet.makeStringAndClear();
 }
 
 // -----------------------------------------------------------------------
 
-XubString GetSvxString( sal_uInt16 nId )
+OUString GetSvxString( sal_uInt16 nId )
 {
     return EE_RESSTR( nId );
 }
 
 // -----------------------------------------------------------------------
 
-XubString GetColorString( const Color& rCol )
+OUString GetColorString( const Color& rCol )
 {
     OUString sStr;
 
diff --git a/include/editeng/editobj.hxx b/include/editeng/editobj.hxx
index 83f6475..570615f 100644
--- a/include/editeng/editobj.hxx
+++ b/include/editeng/editobj.hxx
@@ -106,11 +106,11 @@ public:
 
     const SfxItemSet& GetParaAttribs(sal_Int32 nPara) const;
 
-    void GetStyleSheet(sal_Int32 nPara, String& rName, SfxStyleFamily& eFamily) const;
-    void SetStyleSheet(sal_Int32 nPara, const String& rName, const SfxStyleFamily& eFamily);
+    void GetStyleSheet(sal_Int32 nPara, OUString& rName, SfxStyleFamily& eFamily) const;
+    void SetStyleSheet(sal_Int32 nPara, const OUString& rName, const SfxStyleFamily& eFamily);
     bool ChangeStyleSheets(
-        const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily );
-    void ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName );
+        const OUString& rOldName, SfxStyleFamily eOldFamily, const OUString& rNewName, SfxStyleFamily eNewFamily);
+    void ChangeStyleSheetName(SfxStyleFamily eFamily, const OUString& rOldName, const OUString& rNewName);
 
     editeng::FieldUpdater GetFieldUpdater();
 
diff --git a/include/editeng/itemtype.hxx b/include/editeng/itemtype.hxx
index 422cb3b..8a64415 100644
--- a/include/editeng/itemtype.hxx
+++ b/include/editeng/itemtype.hxx
@@ -36,14 +36,14 @@ class IntlWrapper;
 
 static const sal_Unicode cpDelim[] = { ',' , ' ', '\0' };
 
-EDITENG_DLLPUBLIC String GetSvxString( sal_uInt16 nId );
-EDITENG_DLLPUBLIC String GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, const IntlWrapper * pIntl );
-String GetColorString( const Color& rCol );
+EDITENG_DLLPUBLIC OUString GetSvxString( sal_uInt16 nId );
+EDITENG_DLLPUBLIC OUString GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, const IntlWrapper * pIntl );
+OUString GetColorString( const Color& rCol );
 EDITENG_DLLPUBLIC sal_uInt16 GetMetricId( SfxMapUnit eUnit );
 
 // -----------------------------------------------------------------------
 
-inline String GetBoolString( sal_Bool bVal )
+inline OUString GetBoolString(bool bVal)
 {
     return EE_RESSTR(bVal ? RID_SVXITEMS_TRUE : RID_SVXITEMS_FALSE);
 }
diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx
index f532a3c..97c1bd4 100644
--- a/svx/source/svdraw/svdotxat.cxx
+++ b/svx/source/svdraw/svdotxat.cxx
@@ -232,7 +232,7 @@ void SdrTextObj::ImpSetTextStyleSheetListeners()
             // the container aStyles. The Family is always appended to the name
             // of the stylesheet.
             const EditTextObject& rTextObj=pOutlinerParaObject->GetTextObject();
-            XubString aStyleName;
+            OUString aStyleName;
             SfxStyleFamily eStyleFam;
             sal_Int32 nParaAnz=rTextObj.GetParagraphCount();
 
@@ -240,13 +240,13 @@ void SdrTextObj::ImpSetTextStyleSheetListeners()
             {
                 rTextObj.GetStyleSheet(nParaNum, aStyleName, eStyleFam);
 
-                if(aStyleName.Len())
+                if (!aStyleName.isEmpty())
                 {
                     OUStringBuffer aFam;
                     aFam.append(static_cast<sal_Int32>(eStyleFam));
                     comphelper::string::padToLength(aFam, 5, ' ');
 
-                    aStyleName += sal_Unicode('|');
+                    aStyleName += OUString('|');
                     aStyleName += aFam.makeStringAndClear();
 
                     sal_Bool bFnd(sal_False);
@@ -256,7 +256,7 @@ void SdrTextObj::ImpSetTextStyleSheetListeners()
                     {
                         // we don't want duplicate stylesheets
                         nNum--;
-                        bFnd = aStyleName.Equals(*aStyleNames[nNum]);
+                        bFnd = aStyleName.equals(*aStyleNames[nNum]);
                     }
 
                     if(!bFnd)


More information about the Libreoffice-commits mailing list