diff options
-rw-r--r-- | sc/inc/document.hxx | 1 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 24 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 6 |
3 files changed, 31 insertions, 0 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index e2578afba085..aa4c5d4252cd 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -750,6 +750,7 @@ public: SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark); SC_DLLPUBLIC void GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString ); + SC_DLLPUBLIC void GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, rtl::OUString& rString ); SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString ); SC_DLLPUBLIC double GetValue( const ScAddress& ); SC_DLLPUBLIC void GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue ); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 358c4f10784c..f76148e0c676 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -228,6 +228,7 @@ public: bool testLoad(const rtl::OUString &rFilter, const rtl::OUString &rURL); void testCollator(); + void testInput(); void testSUM(); void testVolatileFunc(); void testNamedRange(); @@ -251,6 +252,7 @@ public: CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testCollator); + CPPUNIT_TEST(testInput); CPPUNIT_TEST(testSUM); CPPUNIT_TEST(testVolatileFunc); CPPUNIT_TEST(testNamedRange); @@ -333,6 +335,28 @@ void Test::testCollator() CPPUNIT_ASSERT_MESSAGE("these strings are supposed to be different!", nRes != 0); } +void Test::testInput() +{ + rtl::OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("foo")); + CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", + m_pDoc->InsertTab (0, aTabName)); + + OUString numstr(RTL_CONSTASCII_USTRINGPARAM("'10.5")); + OUString str(RTL_CONSTASCII_USTRINGPARAM("'apple'")); + OUString test; + + m_pDoc->SetString(0, 0, 0, numstr); + m_pDoc->GetString(0, 0, 0, test); + bool bTest = test.equalsAscii("10.5"); + CPPUNIT_ASSERT_MESSAGE("String number should have the first apostrophe stripped.", bTest); + m_pDoc->SetString(0, 0, 0, str); + m_pDoc->GetString(0, 0, 0, test); + bTest = test.equalsAscii("'apple'"); + CPPUNIT_ASSERT_MESSAGE("Text content should have retained the first apostrophe.", bTest); + + m_pDoc->DeleteTab(0); +} + void Test::testSUM() { rtl::OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("foo")); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 4e70f2b3e9e5..21a096c17297 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2764,6 +2764,12 @@ void ScDocument::GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString rString.Erase(); } +void ScDocument::GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, rtl::OUString& rString ) +{ + String aStr; + GetString(nCol, nRow, nTab, aStr); + rString = aStr; +} void ScDocument::GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString ) { |