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

Caolán McNamara caolanm at redhat.com
Tue Mar 12 04:55:06 PDT 2013


 svtools/inc/svtools/fmtfield.hxx        |   12 ++++----
 svtools/inc/svtools/tabbar.hxx          |    6 ++--
 svtools/source/control/fmtfield.cxx     |   48 ++++++++++++++++----------------
 svtools/source/control/tabbar.cxx       |    4 +-
 sw/qa/extras/ww8import/data/i120158.doc |binary
 sw/qa/extras/ww8import/ww8import.cxx    |   15 ++++++++++
 6 files changed, 50 insertions(+), 35 deletions(-)

New commits:
commit cf098d619a6ac5ea1499e05f7d9a71913eb2ed29
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 12 11:53:23 2013 +0000

    Related: #i120158# add a test-case for tricky am/pm escape problem
    
    Change-Id: I4905fb384694c3f1dadccc6d8513c9a050e3f67b

diff --git a/sw/qa/extras/ww8import/data/i120158.doc b/sw/qa/extras/ww8import/data/i120158.doc
new file mode 100644
index 0000000..6adf3ec
Binary files /dev/null and b/sw/qa/extras/ww8import/data/i120158.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index d471b7b..b6f0166 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -48,6 +48,7 @@ public:
     void testN757905();
     void testAllGapsWord();
     void testFdo59530();
+    void testI120158();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -70,6 +71,7 @@ void Test::run()
         {"n757905.doc", &Test::testN757905},
         {"all_gaps_word.doc", &Test::testAllGapsWord},
         {"fdo59530.doc", &Test::testFdo59530},
+        {"i120158.doc", &Test::testI120158}
     };
     header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -253,6 +255,19 @@ void Test::testFdo59530()
     CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials"));
 }
 
+void Test::testI120158()
+{
+    // See https://issues.apache.org/ooo/show_bug.cgi?id=120158
+    uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XEnumerationAccess> paraEnumAccess(textDocument->getText(), uno::UNO_QUERY);
+    // list of paragraphs
+    uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
+    // get contents of 1st paragraph as text
+    uno::Reference<uno::XInterface> paragraph0(paraEnum->nextElement(), uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> text0(paragraph0, uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL( OUString( "3/12/2013 10:48:00 AM" ), text0->getString());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit a67d0193ff3a4a317ca4a65045fcd2ae244560c6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 12 10:41:57 2013 +0000

    XubString->OUString
    
    Change-Id: Ie2b0060155eaeb4c8979731dd4c62bc269f7c501

diff --git a/svtools/inc/svtools/fmtfield.hxx b/svtools/inc/svtools/fmtfield.hxx
index b7cbc16..8486926 100644
--- a/svtools/inc/svtools/fmtfield.hxx
+++ b/svtools/inc/svtools/fmtfield.hxx
@@ -295,17 +295,17 @@ protected:
 //------------------------------------------------------------------------------
 class DoubleCurrencyField : public FormattedField
 {
-    XubString   m_sCurrencySymbol;
-    sal_Bool        m_bPrependCurrSym;
-    sal_Bool        m_bChangingFormat;
+    OUString   m_sCurrencySymbol;
+    sal_Bool   m_bPrependCurrSym;
+    sal_Bool   m_bChangingFormat;
 
 public:
     DoubleCurrencyField(Window* pParent, WinBits nStyle = 0);
 
-    XubString   getCurrencySymbol() const { return m_sCurrencySymbol; }
-    void        setCurrencySymbol(const XubString& _sSymbol);
+    OUString    getCurrencySymbol() const { return m_sCurrencySymbol; }
+    void        setCurrencySymbol(const OUString& rSymbol);
 
-    sal_Bool        getPrependCurrSym() const { return m_bPrependCurrSym; }
+    sal_Bool    getPrependCurrSym() const { return m_bPrependCurrSym; }
     void        setPrependCurrSym(sal_Bool _bPrepend);
 
 protected:
diff --git a/svtools/inc/svtools/tabbar.hxx b/svtools/inc/svtools/tabbar.hxx
index c7dbd56..0a95008 100644
--- a/svtools/inc/svtools/tabbar.hxx
+++ b/svtools/inc/svtools/tabbar.hxx
@@ -339,7 +339,7 @@ private:
     ImplTabButton*  mpLastBtn;
     TabBar_Impl*    mpImpl;
     TabBarEdit*     mpEdit;
-    XubString       maEditText;
+    OUString        maEditText;
     Color           maSelColor;
     Color           maSelTextColor;
     Size            maWinSize;
@@ -476,8 +476,8 @@ public:
     sal_Bool            IsEditModeEnabled() const { return mbAutoEditMode; }
     sal_Bool            StartEditMode( sal_uInt16 nPageId );
     void            EndEditMode( sal_Bool bCancel = sal_False );
-    void            SetEditText( const XubString& rText ) { maEditText = rText; }
-    const XubString& GetEditText() const { return maEditText; }
+    void            SetEditText( const OUString& rText ) { maEditText = rText; }
+    const OUString& GetEditText() const { return maEditText; }
     sal_Bool            IsInEditMode() const { return (mpEdit != NULL); }
     sal_Bool            IsEditModeCanceled() const { return mbEditCanceled; }
     sal_uInt16          GetEditPageId() const { return mnEditId; }
diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx
index 0b2c3e4..697075e 100644
--- a/svtools/source/control/fmtfield.cxx
+++ b/svtools/source/control/fmtfield.cxx
@@ -1209,12 +1209,12 @@ void DoubleCurrencyField::FormatChanged(FORMAT_CHANGE_TYPE nWhat)
 }
 
 //------------------------------------------------------------------------------
-void DoubleCurrencyField::setCurrencySymbol(const String& _sSymbol)
+void DoubleCurrencyField::setCurrencySymbol(const OUString& rSymbol)
 {
-    if (m_sCurrencySymbol == _sSymbol)
+    if (m_sCurrencySymbol == rSymbol)
         return;
 
-    m_sCurrencySymbol  = _sSymbol;
+    m_sCurrencySymbol = rSymbol;
     UpdateCurrencyFormat();
     FormatChanged(FCT_CURRENCY_SYMBOL);
 }
@@ -1248,61 +1248,61 @@ void DoubleCurrencyField::UpdateCurrencyFormat()
     LanguageTag aLanguageTag( eLanguage);
     LocaleDataWrapper aLocaleInfo( aLanguageTag );
 
-    XubString sNewFormat;
+    OUStringBuffer sNewFormat;
     if (bThSep)
     {
-        sNewFormat = '#';
-        sNewFormat += aLocaleInfo.getNumThousandSep();
-        sNewFormat.AppendAscii("##0");
+        sNewFormat.append('#');
+        sNewFormat.append(aLocaleInfo.getNumThousandSep());
+        sNewFormat.append("##0");
     }
     else
-        sNewFormat = '0';
+        sNewFormat.append('0');
 
     if (nDigits)
     {
-        sNewFormat += aLocaleInfo.getNumDecimalSep();
+        sNewFormat.append(aLocaleInfo.getNumDecimalSep());
 
         rtl::OUStringBuffer sTemp;
         comphelper::string::padToLength(sTemp, nDigits, '0');
-        sNewFormat += sTemp.makeStringAndClear();
+        sNewFormat.append(sTemp);
     }
 
     if (getPrependCurrSym())
     {
-        XubString sSymbol = getCurrencySymbol();
+        OUString sSymbol = getCurrencySymbol();
         sSymbol = comphelper::string::stripStart(sSymbol, ' ');
         sSymbol = comphelper::string::stripEnd(sSymbol, ' ');
 
-        XubString sTemp = rtl::OUString("[$");
-        sTemp += sSymbol;
-        sTemp.AppendAscii("] ");
-        sTemp += sNewFormat;
+        OUStringBuffer sTemp("[$");
+        sTemp.append(sSymbol);
+        sTemp.append("] ");
+        sTemp.append(sNewFormat);
 
         // for negative values : $ -0.00, not -$ 0.00 ...
         // (the real solution would be a possibility to choose a "positive currency format" and a "negative currency format" ...
         // But not now ... (and hey, you could take a formatted field for this ....))
         // FS - 31.03.00 74642
-        sTemp.AppendAscii(";[$");
-        sTemp += sSymbol;
-        sTemp.AppendAscii("] -");
-        sTemp += sNewFormat;
+        sTemp.append(";[$");
+        sTemp.append(sSymbol);
+        sTemp.append("] -");
+        sTemp.append(sNewFormat);
 
         sNewFormat = sTemp;
     }
     else
     {
-        XubString sTemp = getCurrencySymbol();
+        OUString sTemp = getCurrencySymbol();
         sTemp = comphelper::string::stripStart(sTemp, ' ');
         sTemp = comphelper::string::stripEnd(sTemp, ' ');
 
-        sNewFormat += rtl::OUString(" [$");
-        sNewFormat += sTemp;
-        sNewFormat += ']';
+        sNewFormat.append(" [$");
+        sNewFormat.append(sTemp);
+        sNewFormat.append(']');
     }
 
     // set this new basic format
     m_bChangingFormat = sal_True;
-    SetFormat(sNewFormat, eLanguage);
+    SetFormat(sNewFormat.makeStringAndClear(), eLanguage);
     m_bChangingFormat = sal_False;
 }
 
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 046cf5f..34ab290 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -2405,8 +2405,8 @@ void TabBar::EndEditMode( sal_Bool bCancel )
         }
 
         // reset
-        maEditText.Erase();
-        mbEditCanceled = sal_False;
+        maEditText = OUString();
+        mbEditCanceled = false;
     }
 }
 


More information about the Libreoffice-commits mailing list