[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - 2 commits - sc/inc sc/qa sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Thu Mar 14 14:57:47 PDT 2013


 sc/inc/column.hxx                |    3 +++
 sc/inc/document.hxx              |    3 ++-
 sc/inc/table.hxx                 |    3 +++
 sc/qa/unit/ucalc.cxx             |    3 ++-
 sc/source/core/data/column2.cxx  |   14 ++++++++++++++
 sc/source/core/data/document.cxx |    9 +++++++++
 sc/source/core/data/table1.cxx   |   16 ++++++++++++++++
 sc/source/ui/view/viewfunc.cxx   |    2 +-
 sc/source/ui/view/viewutil.cxx   |    2 +-
 9 files changed, 51 insertions(+), 4 deletions(-)

New commits:
commit ee57861950aad365ad572492aa30f1b99d4c98c7
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Mar 14 17:56:51 2013 -0400

    Create skeleton accessors for cell text script types.
    
    Change-Id: I5408cdd87f06423a6bb287c855237878859da880

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 114a39b..ca68e7f 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -387,6 +387,9 @@ public:
     sal_uInt16 GetTextWidth(SCROW nRow) const;
     void SetTextWidth(SCROW nRow, sal_uInt16 nWidth);
 
+    sal_uInt8 GetScriptType( SCROW nRow ) const;
+    void SetScriptType( SCROW nRow, sal_uInt8 nType );
+
 private:
     ScBaseCell* CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos) const;
 
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 541ec05..cb8aac7 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1177,7 +1177,8 @@ public:
     bool            HasStringWeakCharacters( const rtl::OUString& rString );
     SC_DLLPUBLIC sal_uInt8          GetStringScriptType( const rtl::OUString& rString );
     SC_DLLPUBLIC sal_uInt8          GetCellScriptType( ScBaseCell* pCell, sal_uLong nNumberFormat );
-    SC_DLLPUBLIC sal_uInt8          GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell = NULL );
+    SC_DLLPUBLIC sal_uInt8 GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell );
+    sal_uInt8 GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
 
     bool            HasDetectiveOperations() const;
     void            AddDetectiveOperation( const ScDetOpData& rData );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 3e4d1eb..25f4f7a 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -793,6 +793,9 @@ public:
 
     sal_uLong          AddCondFormat( ScConditionalFormat* pNew );
 
+    sal_uInt8 GetScriptType( SCCOL nCol, SCROW nRow ) const;
+    void SetScriptType( SCCOL nCol, SCROW nRow, sal_uInt8 nType );
+
 private:
     void        FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                                 sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd,
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index c586b34..9190b31 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1396,6 +1396,20 @@ void ScColumn::SetTextWidth(SCROW nRow, unsigned short nWidth)
     maTextWidths.set(nRow, nWidth);
 }
 
+sal_uInt8 ScColumn::GetScriptType( SCROW nRow ) const
+{
+    if (!ValidRow(nRow))
+        return SC_SCRIPTTYPE_UNKNOWN;
+
+    return SC_SCRIPTTYPE_UNKNOWN;
+}
+
+void ScColumn::SetScriptType( SCROW nRow, sal_uInt8 nType )
+{
+    if (!ValidRow(nRow))
+        return;
+}
+
 void ScColumn::FindDataAreaPos(SCROW& rRow, bool bDown) const
 {
     // check if we are in a data area
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index a73cd60..ec9c7c6 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -5767,4 +5767,13 @@ void ScDocument::SetAutoNameCache(  ScAutoNameCache* pCache )
     delete pAutoNameCache;
     pAutoNameCache = pCache;
 }
+
+sal_uInt8 ScDocument::GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
+{
+    if (!ValidTab(nTab) || nTab >= static_cast<SCTAB>(maTabs.size()) || !maTabs[nTab])
+        return SC_SCRIPTTYPE_UNKNOWN;
+
+    return maTabs[nTab]->GetScriptType(nCol, nRow);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index b50380a..cfe0e57 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -2080,6 +2080,22 @@ sal_uLong ScTable::AddCondFormat( ScConditionalFormat* pNew )
     return nMax + 1;
 }
 
+sal_uInt8 ScTable::GetScriptType( SCCOL nCol, SCROW nRow ) const
+{
+    if (!ValidCol(nCol))
+        return SC_SCRIPTTYPE_UNKNOWN;
+
+    return aCol[nCol].GetScriptType(nRow);
+}
+
+void ScTable::SetScriptType( SCCOL nCol, SCROW nRow, sal_uInt8 nType )
+{
+    if (!ValidCol(nCol))
+        return;
+
+    aCol[nCol].SetScriptType(nRow, nType);
+}
+
 void ScTable::DeleteConditionalFormat( sal_uLong nIndex )
 {
     mpCondFormatList->erase(nIndex);
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 4b7c02a..fcd76aa 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -823,7 +823,7 @@ sal_uInt8 ScViewFunc::GetSelectionScriptType()
         // no selection -> cursor
 
         nScript = pDoc->GetScriptType( GetViewData()->GetCurX(),
-                            GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
+                            GetViewData()->GetCurY(), GetViewData()->GetTabNo(), NULL );
     }
     else
     {
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index e740079..d24d080 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -71,7 +71,7 @@ sal_uInt16 ScViewUtil::GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos )
 {
     //  used for thesaurus
 
-    sal_uInt8 nScript = pDoc->GetScriptType( rPos.Col(), rPos.Row(), rPos.Tab() );
+    sal_uInt8 nScript = pDoc->GetScriptType( rPos.Col(), rPos.Row(), rPos.Tab(), NULL );
     sal_uInt16 nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? ATTR_CJK_FONT_LANGUAGE :
                     ( ( nScript == SCRIPTTYPE_COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE : ATTR_FONT_LANGUAGE );
     const SfxPoolItem* pItem = pDoc->GetAttr( rPos.Col(), rPos.Row(), rPos.Tab(), nWhich);
commit a422f5b672410613478941acfb7f0a4daac668d6
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu Mar 14 16:19:31 2013 -0400

    Remove ambiguity for the windows build.
    
    Change-Id: I9b94281f7acd2223686508baa219b87c13838d5c

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 57b00f4..f34dfb5 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -6042,7 +6042,8 @@ void Test::testCellTextWidth()
     m_pDoc->SetString(0, 0, 0, "Only one cell");
     pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, MAXROW));
     CPPUNIT_ASSERT_MESSAGE("Column should have a cell.", pIter->hasCell());
-    CPPUNIT_ASSERT_EQUAL(0, pIter->getPos());
+    SCROW nTestRow = 0;
+    CPPUNIT_ASSERT_EQUAL(nTestRow, pIter->getPos());
 
     // Setting a text width here should commit it to the column.
     sal_uInt16 nTestVal = 432;


More information about the Libreoffice-commits mailing list