[Libreoffice-commits] .: 3 commits - basic/source i18npool/qa i18npool/source sc/source solenv/inc svl/source svtools/source svx/source vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Aug 29 03:45:13 PDT 2012


 basic/source/runtime/step0.cxx             |   13 +++++++------
 i18npool/qa/cppunit/test_breakiterator.cxx |   22 ++++++++++++++++++++--
 i18npool/source/breakiterator/data/README  |   21 +++------------------
 sc/source/ui/view/output2.cxx              |    7 ++++---
 solenv/inc/settings.mk                     |    2 +-
 svl/source/numbers/zforfind.cxx            |   15 +++++++++------
 svl/source/numbers/zformat.cxx             |   16 ++++++++++------
 svtools/source/svhtml/parhtml.cxx          |   10 +++++++---
 svx/source/svdraw/svdotxat.cxx             |    7 ++++---
 vcl/source/control/field2.cxx              |    8 +++++---
 10 files changed, 70 insertions(+), 51 deletions(-)

New commits:
commit 7a1bac5cca8257e9ec35b59be1ddb7b492f465f3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 29 11:39:44 2012 +0100

    ecj knows about -source -target
    
    Change-Id: Ieb26135bb5eeee5cd472becf704e75bcbeeb8518

diff --git a/solenv/inc/settings.mk b/solenv/inc/settings.mk
index 36234fc..7c28ad5 100644
--- a/solenv/inc/settings.mk
+++ b/solenv/inc/settings.mk
@@ -116,7 +116,7 @@ JAVAI:=$(JAVAINTERPRETER)
 .IF "$(JAVACISGCJ)" == "yes"
 JAVAC+=--encoding=UTF-8 -O2 -fno-assert -Wno-deprecated -C
 .ENDIF
-.IF "$(JDK)" != "gcj" && $(JAVACISKAFFE) != "yes"
+.IF $(JAVACISKAFFE) != "yes"
 JAVAC+=-source $(JAVA_SOURCE_VER) -target $(JAVA_TARGET_VER)
 .ENDIF
 
commit cbba41823a2e67add2620e4901bf0ead542c2932
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 29 11:22:25 2012 +0100

    String::Expand -> string::padToLength
    
    Change-Id: I684e371c31ba76d2e9b563eed70449764346161b

diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 667a805..40d8f69 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <comphelper/string.hxx>
 #include <vcl/msgbox.hxx>
 #include <tools/fsys.hxx>
 
@@ -1305,13 +1306,13 @@ void SbiRuntime::StepPRINT()        // print TOS
 void SbiRuntime::StepPRINTF()       // print TOS in field
 {
     SbxVariableRef p = PopVar();
-    String s1 = p->GetString();
-    String s;
+    OUString s1 = p->GetString();
+    OUStringBuffer s;
     if( p->GetType() >= SbxINTEGER && p->GetType() <= SbxDOUBLE )
-        s = ' ';
-    s += s1;
-    s.Expand( 14, ' ' );
-    rtl::OString aByteStr(rtl::OUStringToOString(s, osl_getThreadTextEncoding()));
+        s.append(' ');
+    s.append(s1);
+    comphelper::string::padToLength(s, 14, ' ');
+    OString aByteStr(OUStringToOString(s.makeStringAndClear(), osl_getThreadTextEncoding()));
     pIosys->Write( aByteStr );
     Error( pIosys->GetError() );
 }
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 956bf68..edfdf60 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -65,6 +65,7 @@
 #include "fillinfo.hxx"
 
 #include <com/sun/star/i18n/DirectionProperty.hpp>
+#include <comphelper/string.hxx>
 
 #include <boost/ptr_container/ptr_vector.hpp>
 
@@ -566,9 +567,9 @@ void ScDrawStringsVars::RepeatToFill( long colWidth )
         return;
 
     long nCharsToInsert = aSpaceToFill / charWidth;
-    String aFill;
-    aFill.Expand( nCharsToInsert, nChar);
-    aString.Insert( aFill, nPos);
+    StringBuffer aFill;
+    comphelper::string::padToLength(aFill, nCharsToInsert, nChar);
+    aString.Insert( aFill.makeStringAndClear(), nPos);
     TextChanged();
 }
 
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 83ac5f3..6d0cbdc 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1122,14 +1122,16 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( sal_uInt16 nStartPatternAt )
                             nPat += nLen - 1;
                         else if (nPat + nLen > rPat.getLength() && sStrArray[nNext].GetChar(nLen-1) == ' ')
                         {
+                            using namespace comphelper::string;
                             // Trailing blanks in input.
-                            String aStr(comphelper::string::stripEnd(sStrArray[nNext], ' '));
+                            OUStringBuffer aBuf(stripEnd(sStrArray[nNext], ' '));
                             // Expand again in case of pattern "M. D. " and
                             // input "M. D.  ", maybe fetched far, but..
-                            aStr.Expand( rPat.getLength() - nPat, ' ');
+                            padToLength(aBuf, rPat.getLength() - nPat, ' ');
+                            OUString aStr = aBuf.makeStringAndClear();
                             bOk = (rPat.indexOf( aStr, nPat) == nPat);
                             if (bOk)
-                                nPat += aStr.Len() - 1;
+                                nPat += aStr.getLength() - 1;
                         }
                     }
                     break;
@@ -1196,9 +1198,10 @@ bool ImpSvNumberInputScan::SkipDatePatternSeparator( sal_uInt16 nParticle, xub_S
                     {
                         // The same ugly trailing blanks check as in
                         // IsAcceptedDatePattern().
-                        String aStr(comphelper::string::stripEnd(sStrArray[nNext], ' '));
-                        aStr.Expand( rPat.getLength() - nPat, ' ');
-                        bOk = (rPat.indexOf( aStr, nPat) == nPat);
+                        using namespace comphelper::string;
+                        OUStringBuffer aBuf(stripEnd(sStrArray[nNext], ' '));
+                        padToLength(aBuf, rPat.getLength() - nPat, ' ');
+                        bOk = (rPat.indexOf( aBuf.makeStringAndClear(), nPat) == nPat);
                     }
                     if (bOk)
                     {
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 8c30d24..5cf224b 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -2774,9 +2774,11 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber,
     sSecStr = comphelper::string::stripStart(sSecStr, '.');
     if ( bInputLine )
     {
-        sSecStr = comphelper::string::stripEnd(sSecStr, '0');
-        if ( sSecStr.Len() < xub_StrLen(rInfo.nCntPost) )
-            sSecStr.Expand( xub_StrLen(rInfo.nCntPost), '0' );
+        using namespace comphelper::string;
+        OUStringBuffer aBuf(stripEnd(sSecStr, '0'));
+        if (aBuf.getLength() < rInfo.nCntPost)
+            padToLength(aBuf, rInfo.nCntPost, '0');
+        sSecStr = aBuf.makeStringAndClear();
         ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() );
         nCntPost = sSecStr.Len();
     }
@@ -3491,9 +3493,11 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber,
     sSecStr = comphelper::string::stripStart(sSecStr, '.');
     if ( bInputLine )
     {
-        sSecStr = comphelper::string::stripEnd(sSecStr, '0');
-        if ( sSecStr.Len() < xub_StrLen(rInfo.nCntPost) )
-            sSecStr.Expand( xub_StrLen(rInfo.nCntPost), '0' );
+        using namespace comphelper::string;
+        OUStringBuffer aBuf(stripEnd(sSecStr, '0'));
+        if (aBuf.getLength() < rInfo.nCntPost)
+            padToLength(aBuf, rInfo.nCntPost, '0');
+        sSecStr = aBuf.makeStringAndClear();
         ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() );
         nCntPost = sSecStr.Len();
     }
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 5d94f12..2cf6ebb 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -1632,10 +1632,14 @@ int HTMLParser::FilterPRE( int nToken )
 
     case HTML_TABCHAR:
         {
-            xub_StrLen nSpaces = sal::static_int_cast< xub_StrLen >(
-                8 - (nPre_LinePos % 8));
+            sal_Int32 nSpaces = (8 - (nPre_LinePos % 8));
             DBG_ASSERT( !aToken.Len(), "Why is the token not empty?" );
-            aToken.Expand( nSpaces, ' ' );
+            if (aToken.Len() < nSpaces)
+            {
+                using comphelper::string::padToLength;
+                OUStringBuffer aBuf(aToken);
+                aToken = padToLength(aBuf, nSpaces, ' ').makeStringAndClear();
+            }
             nPre_LinePos += nSpaces;
             nToken = HTML_TEXTTOKEN;
         }
diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx
index 48541e7..75c7541 100644
--- a/svx/source/svdraw/svdotxat.cxx
+++ b/svx/source/svdraw/svdotxat.cxx
@@ -251,11 +251,12 @@ void SdrTextObj::ImpSetTextStyleSheetListeners()
 
                 if(aStyleName.Len())
                 {
-                    XubString aFam = UniString::CreateFromInt32((sal_uInt16)eStyleFam);
-                    aFam.Expand(5);
+                    OUStringBuffer aFam;
+                    aFam.append(static_cast<sal_Int32>(eStyleFam));
+                    comphelper::string::padToLength(aFam, 5, ' ');
 
                     aStyleName += sal_Unicode('|');
-                    aStyleName += aFam;
+                    aStyleName += aFam.makeStringAndClear();
 
                     sal_Bool bFnd(sal_False);
                     sal_uInt32 nNum(aStyleNames.size());
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index b30e275..ec5ad7e 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -753,10 +753,12 @@ void PatternFormatter::ImplSetMask(const rtl::OString& rEditMask,
 
     if ( m_aEditMask.getLength() != maLiteralMask.Len() )
     {
-        if ( m_aEditMask.getLength() < maLiteralMask.Len() )
-            maLiteralMask.Erase(m_aEditMask.getLength());
+        OUStringBuffer aBuf(maLiteralMask);
+        if (m_aEditMask.getLength() < aBuf.getLength())
+            aBuf.remove(m_aEditMask.getLength(), aBuf.getLength() - m_aEditMask.getLength());
         else
-            maLiteralMask.Expand(m_aEditMask.getLength(), ' ');
+            comphelper::string::padToLength(aBuf, m_aEditMask.getLength(), ' ');
+        maLiteralMask = aBuf.makeStringAndClear();
     }
 
     // Strict mode allows only the input mode if only equal characters are allowed as mask and if
commit 2fa8271155450894ed1716a6cce97540950518b0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 29 10:36:27 2012 +0100

    Related: #i113785# add regression test for ligatures
    
    Change-Id: I46fca6dc8e77571afda5ceb230dc6c93f730703d

diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
index 52dc05f..3fb555d 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -212,7 +212,7 @@ void TestBreakIterator::testWordBoundaries()
 
     //See https://issues.apache.org/ooo/show_bug.cgi?id=14904
     {
-        const sal_Unicode TEST1[] =
+        const sal_Unicode TEST[] =
         {
             'W', 'o', 'r', 'k', 'i', 'n', 'g', ' ', 0x201C, 'W', 'o', 'r', 'd', 's',
             ' ', 's', 't', 'a', 'r', 't', 'i', 'n', 'g', ' ', 'w', 'i', 't',
@@ -223,7 +223,7 @@ void TestBreakIterator::testWordBoundaries()
             't', ' ', 'e', 'v', 'e', 'n', ' ' , 0x00BF, 'r', 'e', 'a', 'l', '?', ' ',
             'S', 'p', 'a', 'n', 'i', 's', 'h'
         };
-        rtl::OUString aTest(TEST1, SAL_N_ELEMENTS(TEST1));
+        rtl::OUString aTest(TEST, SAL_N_ELEMENTS(TEST));
 
         aBounds = m_xBreak->getWordBoundary(aTest, 4, aLocale, i18n::WordType::DICTIONARY_WORD, false);
         CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 7);
@@ -527,6 +527,24 @@ void TestBreakIterator::testWordBoundaries()
             CPPUNIT_ASSERT(i == SAL_N_ELEMENTS(aExpected));
         }
     }
+
+    //See https://issues.apache.org/ooo/show_bug.cgi?id=113785
+    {
+        aLocale.Language = rtl::OUString("en");
+        aLocale.Country = rtl::OUString("US");
+
+        const sal_Unicode TEST[] =
+        {
+            'r', 'u', 0xFB00, 'l', 'e', ' ', 0xFB01, 's', 'h'
+        };
+        rtl::OUString aTest(TEST, SAL_N_ELEMENTS(TEST));
+
+        aBounds = m_xBreak->getWordBoundary(aTest, 1, aLocale, i18n::WordType::DICTIONARY_WORD, false);
+        CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 5);
+
+        aBounds = m_xBreak->getWordBoundary(aTest, 7, aLocale, i18n::WordType::DICTIONARY_WORD, false);
+        CPPUNIT_ASSERT(aBounds.startPos == 6 && aBounds.endPos == 9);
+    }
 }
 
 //See http://qa.openoffice.org/issues/show_bug.cgi?id=111152
diff --git a/i18npool/source/breakiterator/data/README b/i18npool/source/breakiterator/data/README
index 6858f7a..4899f60 100644
--- a/i18npool/source/breakiterator/data/README
+++ b/i18npool/source/breakiterator/data/README
@@ -16,24 +16,6 @@ latest versions.
 
 to-review, later are ok:
 
-commit 681082b57612ef325c7f695846369d44c68dda11
-Author: Caolán McNamara <caolanm at redhat.com>
-Date:   Sat Jan 29 12:51:52 2011 +0000
-
-    Resolves: fdo#31271 wrong line break with (
-
-commit 42be5541baf18e3292a14a9d478eda33f61e10ab
-Author: Mattias Johnsson <m.t.johnsson at gmail.com>
-Date:   Thu Nov 4 23:25:02 2010 +1100
-
-    An opening quote should not be counted as a word by word count tool
-
-commit 600c6460a6ffa169ad0cc9bed4b77c545cc50f52
-Author: Thomas Lange [tl] <tl at openoffice.org>
-Date:   Tue Aug 24 16:46:29 2010 +0200
-
-    cws tl82: #i113785# ligatures for spell checking will no longer break words
-
 commit ae9d7c2cef9ecd42687d64f985b9e2dcbc68a034
 Author: Thomas Lange [tl] <tl at openoffice.org>
 Date:   Tue Apr 27 10:09:22 2010 +0200
@@ -579,6 +561,9 @@ Date:   Mon Mar 8 16:17:05 2004 +0000
 
 done, regression tests added:
 
+#i113785# ligatures for spell checking will no longer break words
+An opening quote should not be counted as a word by word count tool (regression test in in writer)
+fdo#31271 wrong line break with (
 #i89042# word count fix (regression test is in writer)
 #i58513# add break iterator rules for Finish
 #i19716# fix wrong line break on bracket characters


More information about the Libreoffice-commits mailing list