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

Kohei Yoshida kohei.yoshida at gmail.com
Wed Mar 20 18:29:55 PDT 2013


 sc/source/ui/collab/sendfunc.cxx  |   26 ++-----------
 sc/source/ui/collab/sendfunc.hxx  |    8 +---
 sc/source/ui/docshell/docfunc.cxx |   73 ++------------------------------------
 sc/source/ui/inc/docfunc.hxx      |    8 +---
 sc/source/ui/unoobj/cellsuno.cxx  |    4 +-
 5 files changed, 16 insertions(+), 103 deletions(-)

New commits:
commit 0af9e90ba5e89fc6348579955478bab72ed8feb4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Mar 20 21:29:37 2013 -0400

    String to OUString.
    
    Change-Id: Ib31cd61f960a73924988aa35c24e106cf668b78b

diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index 4c27a3e..f5cde9b 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -189,7 +189,7 @@ sal_Bool ScDocFuncSend::PutData( const ScAddress& rPos, ScEditEngineDefaulter& r
 }
 
 bool ScDocFuncSend::SetCellText(
-    const ScAddress& rPos, const String& rText, bool bInterpret, bool bEnglish, bool bApi,
+    const ScAddress& rPos, const OUString& rText, bool bInterpret, bool bEnglish, bool bApi,
     const formula::FormulaGrammar::Grammar eGrammar )
 {
     SAL_INFO( "sc.tubes", "SetCellText not implemented!" );
diff --git a/sc/source/ui/collab/sendfunc.hxx b/sc/source/ui/collab/sendfunc.hxx
index 9ce2c2c..e1866ff 100644
--- a/sc/source/ui/collab/sendfunc.hxx
+++ b/sc/source/ui/collab/sendfunc.hxx
@@ -280,7 +280,7 @@ public:
     virtual sal_Bool    PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
                                 sal_Bool bInterpret, sal_Bool bApi );
     virtual bool SetCellText(
-        const ScAddress& rPos, const String& rText, bool bInterpret, bool bEnglish,
+        const ScAddress& rPos, const OUString& rText, bool bInterpret, bool bEnglish,
         bool bApi, const formula::FormulaGrammar::Grammar eGrammar );
     virtual bool        ShowNote( const ScAddress& rPos, bool bShow = true );
     virtual bool        SetNoteText( const ScAddress& rPos, const String& rNoteText, sal_Bool bApi );
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 8eec7c1..1357c96 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1163,7 +1163,7 @@ ScBaseCell* ScDocFunc::InterpretEnglishString( const ScAddress& rPos,
 
 
 bool ScDocFunc::SetCellText(
-    const ScAddress& rPos, const String& rText, bool bInterpret, bool bEnglish, bool bApi,
+    const ScAddress& rPos, const OUString& rText, bool bInterpret, bool bEnglish, bool bApi,
     const formula::FormulaGrammar::Grammar eGrammar )
 {
     if ( bInterpret )
@@ -1196,7 +1196,7 @@ bool ScDocFunc::SetCellText(
         }
         // sonst Null behalten -> SetString mit lokalen Formeln/Zahlformat
     }
-    else if ( rText.Len() )
+    else if (!rText.isEmpty())
     {
         SetStringOrEditCell(rPos, rText, !bApi);
     }
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index fa2807f..964a839 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -103,7 +103,7 @@ public:
     virtual sal_Bool        PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
                                       sal_Bool bInterpret, sal_Bool bApi );
     virtual bool SetCellText(
-        const ScAddress& rPos, const String& rText, bool bInterpret, bool bEnglish, bool bApi,
+        const ScAddress& rPos, const OUString& rText, bool bInterpret, bool bEnglish, bool bApi,
         const formula::FormulaGrammar::Grammar eGrammar );
 
     // creates a new cell for use with PutCell
commit 8d50b08241f34f1f06ea1411080458ca6370ab7d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Mar 20 21:26:04 2013 -0400

    Remove unused method parameter.
    
    Change-Id: Ib297f38ab5428f4251d5f482c87bcac926250aa9

diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index 294f71c..4c27a3e 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -188,13 +188,12 @@ sal_Bool ScDocFuncSend::PutData( const ScAddress& rPos, ScEditEngineDefaulter& r
     return ScDocFunc::PutData( rPos, rEngine, bInterpret, bApi );
 }
 
-sal_Bool ScDocFuncSend::SetCellText( const ScAddress& rPos, const String& rText,
-                              sal_Bool bInterpret, sal_Bool bEnglish, sal_Bool bApi,
-                              const String& rFormulaNmsp,
-                              const formula::FormulaGrammar::Grammar eGrammar )
+bool ScDocFuncSend::SetCellText(
+    const ScAddress& rPos, const String& rText, bool bInterpret, bool bEnglish, bool bApi,
+    const formula::FormulaGrammar::Grammar eGrammar )
 {
     SAL_INFO( "sc.tubes", "SetCellText not implemented!" );
-    return ScDocFunc::SetCellText( rPos, rText, bInterpret, bEnglish, bApi, rFormulaNmsp, eGrammar );
+    return ScDocFunc::SetCellText( rPos, rText, bInterpret, bEnglish, bApi, eGrammar );
 }
 
 bool ScDocFuncSend::ShowNote( const ScAddress& rPos, bool bShow )
diff --git a/sc/source/ui/collab/sendfunc.hxx b/sc/source/ui/collab/sendfunc.hxx
index e574407..9ce2c2c 100644
--- a/sc/source/ui/collab/sendfunc.hxx
+++ b/sc/source/ui/collab/sendfunc.hxx
@@ -279,10 +279,9 @@ public:
     virtual bool SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, bool bInteraction );
     virtual sal_Bool    PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
                                 sal_Bool bInterpret, sal_Bool bApi );
-    virtual sal_Bool    SetCellText( const ScAddress& rPos, const String& rText,
-                                sal_Bool bInterpret, sal_Bool bEnglish, sal_Bool bApi,
-                                const String& rFormulaNmsp,
-                                const formula::FormulaGrammar::Grammar eGrammar );
+    virtual bool SetCellText(
+        const ScAddress& rPos, const String& rText, bool bInterpret, bool bEnglish,
+        bool bApi, const formula::FormulaGrammar::Grammar eGrammar );
     virtual bool        ShowNote( const ScAddress& rPos, bool bShow = true );
     virtual bool        SetNoteText( const ScAddress& rPos, const String& rNoteText, sal_Bool bApi );
     virtual sal_Bool    RenameTable( SCTAB nTab, const String& rName, sal_Bool bRecord, sal_Bool bApi );
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 1dacb5a..8eec7c1 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1162,9 +1162,9 @@ ScBaseCell* ScDocFunc::InterpretEnglishString( const ScAddress& rPos,
 }
 
 
-sal_Bool ScDocFunc::SetCellText( const ScAddress& rPos, const String& rText,
-        sal_Bool bInterpret, sal_Bool bEnglish, sal_Bool bApi,
-        const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
+bool ScDocFunc::SetCellText(
+    const ScAddress& rPos, const String& rText, bool bInterpret, bool bEnglish, bool bApi,
+    const formula::FormulaGrammar::Grammar eGrammar )
 {
     if ( bInterpret )
     {
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index fcd176e..fa2807f 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -102,10 +102,9 @@ public:
     virtual bool SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, bool bInteraction );
     virtual sal_Bool        PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
                                       sal_Bool bInterpret, sal_Bool bApi );
-    virtual sal_Bool        SetCellText( const ScAddress& rPos, const String& rText,
-                                         sal_Bool bInterpret, sal_Bool bEnglish, sal_Bool bApi,
-                                         const String& rFormulaNmsp,
-                                         const formula::FormulaGrammar::Grammar eGrammar );
+    virtual bool SetCellText(
+        const ScAddress& rPos, const String& rText, bool bInterpret, bool bEnglish, bool bApi,
+        const formula::FormulaGrammar::Grammar eGrammar );
 
     // creates a new cell for use with PutCell
     ScBaseCell* InterpretEnglishString( const ScAddress& rPos, const String& rText,
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 450c681..298b61a 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -6312,8 +6312,8 @@ void ScCellObj::SetString_Impl(const String& rString, sal_Bool bInterpret, sal_B
     if ( pDocSh )
     {
         // GRAM_PODF_A1 for API compatibility.
-        (void)pDocSh->GetDocFunc().SetCellText( aCellPos, rString, bInterpret, bEnglish,
-                                                   sal_True, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
+        (void)pDocSh->GetDocFunc().SetCellText(
+            aCellPos, rString, bInterpret, bEnglish, true, formula::FormulaGrammar::GRAM_PODF_A1 );
     }
 }
 
commit 68ae2fbd9b4cc65444922fbfd7d5bbf272557fb2
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Mar 20 21:21:09 2013 -0400

    ScDocFunc::PutCell() is no longer used. Remove it.
    
    Change-Id: Id76a8cfe2d67c3461aab6ea0bb71a99abba65e84

diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index ca79471..294f71c 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -47,12 +47,6 @@ void ScDocFuncSend::RecvMessage( const rtl::OString &rString )
             mpDirect->SetNormalString( bNumFmtSet, aReader.getAddress( 1 ), aReader.getString( 2 ),
                                       aReader.getBool( 3 ) );
         }
-        else if ( aReader.getMethod() == "putCell" )
-        {
-            ScBaseCell *pNewCell = aReader.getCell( 2 );
-            if ( pNewCell )
-                mpDirect->PutCell( aReader.getAddress( 1 ), pNewCell, aReader.getBool( 3 ) );
-        }
         else if (aReader.getMethod() == "setValueCell")
         {
             mpDirect->SetValueCell(
@@ -187,17 +181,6 @@ bool ScDocFuncSend::SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell,
     return true; // needs some code auditing action
 }
 
-sal_Bool ScDocFuncSend::PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, sal_Bool bApi )
-{
-    ScChangeOpWriter aOp( "putCell" );
-    aOp.appendAddress( rPos );
-    aOp.appendCell( pNewCell );
-    aOp.appendBool( bApi );
-    SendMessage( aOp );
-    pCell->Delete();
-    return true; // needs some code auditing action
-}
-
 sal_Bool ScDocFuncSend::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
                           sal_Bool bInterpret, sal_Bool bApi )
 {
diff --git a/sc/source/ui/collab/sendfunc.hxx b/sc/source/ui/collab/sendfunc.hxx
index 5499fd0..e574407 100644
--- a/sc/source/ui/collab/sendfunc.hxx
+++ b/sc/source/ui/collab/sendfunc.hxx
@@ -277,7 +277,6 @@ public:
     virtual bool SetStringCell( const ScAddress& rPos, const OUString& rStr, bool bInteraction );
     virtual bool SetEditCell( const ScAddress& rPos, const EditTextObject& rStr, bool bInteraction );
     virtual bool SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, bool bInteraction );
-    virtual sal_Bool    PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, sal_Bool bApi );
     virtual sal_Bool    PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
                                 sal_Bool bInterpret, sal_Bool bApi );
     virtual sal_Bool    SetCellText( const ScAddress& rPos, const String& rText,
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index ea63f54..1dacb5a 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -975,71 +975,6 @@ bool ScDocFunc::SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, boo
     return true;
 }
 
-sal_Bool ScDocFunc::PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, sal_Bool bApi )
-{
-    ScDocShellModificator aModificator( rDocShell );
-    ScDocument* pDoc = rDocShell.GetDocument();
-    bool bUndo (pDoc->IsUndoEnabled());
-    sal_Bool bXMLLoading(pDoc->IsImportingXML());
-
-    // #i925#; it is not necessary to test whether the cell is editable on loading a XML document
-    if (!bXMLLoading)
-    {
-        ScEditableTester aTester( pDoc, rPos.Tab(), rPos.Col(),rPos.Row(), rPos.Col(),rPos.Row() );
-        if (!aTester.IsEditable())
-        {
-            if (!bApi)
-                rDocShell.ErrorMessage(aTester.GetMessageId());
-            pNewCell->Delete();
-            return false;
-        }
-    }
-
-    sal_Bool bEditCell = ( pNewCell->GetCellType() == CELLTYPE_EDIT );
-    ScBaseCell* pDocCell = pDoc->GetCell( rPos );
-    sal_Bool bEditDeleted = (pDocCell && pDocCell->GetCellType() == CELLTYPE_EDIT);
-    sal_Bool bHeight = ( bEditDeleted || bEditCell ||
-                    pDoc->HasAttrib( ScRange(rPos), HASATTR_NEEDHEIGHT ) );
-
-    ScBaseCell* pUndoCell = (bUndo && pDocCell) ? pDocCell->Clone( *pDoc, rPos ) : 0;
-    ScBaseCell* pRedoCell = (bUndo && pNewCell) ? pNewCell->Clone( *pDoc, rPos ) : 0;
-
-    pDoc->PutCell( rPos, pNewCell );
-
-    // This "interpret once" block was moved from ScViewFunc::EnterData() where
-    // it was never executed from API, so don't do it here. For performance
-    // reasons API calls may disable calculation while operating and
-    // recalculate once when done.
-    if ( !bXMLLoading && !bApi && pNewCell->GetCellType() == CELLTYPE_FORMULA && !pDoc->GetAutoCalc() )
-    {
-        ScFormulaCell *pFormCell = static_cast<ScFormulaCell *>( pNewCell );
-        // calculate just the cell once and set Dirty again
-        pFormCell->Interpret();
-        pFormCell->SetDirtyVar();
-        pDoc->PutInFormulaTree( pFormCell );
-    }
-
-    // wegen ChangeTracking darf UndoAction erst nach PutCell angelegt werden
-    if (bUndo)
-        rDocShell.GetUndoManager()->AddUndoAction(
-                new ScUndoPutCell( &rDocShell, rPos, pUndoCell, pRedoCell ) );
-
-    if (bHeight)
-        AdjustRowHeight( ScRange(rPos) );
-
-    if (!bXMLLoading)
-        rDocShell.PostPaintCell( rPos );
-
-    aModificator.SetDocumentModified();
-
-    // #i925#; it is not necessary to notify on loading a XML document
-    // #103934#; notify editline and cell in edit mode
-    if (bApi && !bXMLLoading)
-        NotifyInputHandler( rPos );
-
-    return sal_True;
-}
-
 void ScDocFunc::NotifyInputHandler( const ScAddress& rPos )
 {
     ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index ca28cf0..fcd176e 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -100,7 +100,6 @@ public:
      * must not delete it after passing it to this call.
      */
     virtual bool SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, bool bInteraction );
-    virtual sal_Bool        PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, sal_Bool bApi );
     virtual sal_Bool        PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
                                       sal_Bool bInterpret, sal_Bool bApi );
     virtual sal_Bool        SetCellText( const ScAddress& rPos, const String& rText,


More information about the Libreoffice-commits mailing list