diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-20 13:50:57 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-22 21:49:17 -0400 |
commit | 8aac68741b17a1d161137b12c78d47c8b3e91c68 (patch) | |
tree | abaa0b67a6cc732b2fb82505db505bce9389f354 | |
parent | 060c1f9048c713d03a9b051e4e9537d5992b8a13 (diff) |
Convert some of ScDocFunc::PutCell() to SetValueCell().
Also implement the telepathy serialization part.
Change-Id: Ie67b26d5f7778d0c1f09a9ef748e0fe846ac3dc5
-rw-r--r-- | sc/source/ui/Accessibility/AccessibleCellBase.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/collab/sendfunc.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/collab/sendfunc.hxx | 13 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/inc/docfunc.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/optsolver.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun6.cxx | 2 |
8 files changed, 32 insertions, 11 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/sc/source/ui/Accessibility/AccessibleCellBase.cxx index a109f4f53435..d6491d44c40c 100644 --- a/sc/source/ui/Accessibility/AccessibleCellBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleCellBase.cxx @@ -259,7 +259,7 @@ sal_Bool SAL_CALL if (IsEditable(xParentStates)) { ScDocShell* pDocShell = (ScDocShell*) mpDoc->GetDocumentShell(); - bResult = pDocShell->GetDocFunc().PutCell( maCellAddress, new ScValueCell(fValue), true); + bResult = pDocShell->GetDocFunc().SetValueCell(maCellAddress, fValue, false); } } return bResult; diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index f074c3d8637a..4b969346f5e4 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -53,6 +53,11 @@ void ScDocFuncSend::RecvMessage( const rtl::OString &rString ) if ( pNewCell ) mpDirect->PutCell( aReader.getAddress( 1 ), pNewCell, aReader.getBool( 3 ) ); } + else if (aReader.getMethod() == "setValueCell") + { + mpDirect->SetValueCell( + aReader.getAddress(1), aReader.getDouble(2), aReader.getBool(3)); + } else if ( aReader.getMethod() == "enterListAction" ) mpDirect->EnterListAction( aReader.getInt( 1 ) ); else if ( aReader.getMethod() == "endListAction" ) @@ -126,10 +131,13 @@ sal_Bool ScDocFuncSend::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& r return true; // needs some code auditing action } -void ScDocFuncSend::SetValueCell( const ScAddress& rPos, double fVal, bool bInteraction ) +bool ScDocFuncSend::SetValueCell( const ScAddress& rPos, double fVal, bool bInteraction ) { - // TODO: How do we implement this? - + ScChangeOpWriter aOp("setValueCell"); + aOp.appendAddress( rPos ); + aOp.appendDouble( fVal ); + aOp.appendBool( bInteraction ); + SendMessage( aOp ); return true; // needs some code auditing action } diff --git a/sc/source/ui/collab/sendfunc.hxx b/sc/source/ui/collab/sendfunc.hxx index 2a4ee4e13018..468414861850 100644 --- a/sc/source/ui/collab/sendfunc.hxx +++ b/sc/source/ui/collab/sendfunc.hxx @@ -86,6 +86,12 @@ public: appendString( cellToString( pCell ) ); } + void appendDouble( double fVal ) + { + aMessage.append(fVal); + appendSeparator(); + } + rtl::OString toString() { return rtl::OUStringToOString( aMessage.toString(), RTL_TEXTENCODING_UTF8 ); @@ -195,6 +201,11 @@ public: { return stringToCell( getString( n ) ); } + + double getDouble( sal_Int32 n ) + { + return getString(n).toDouble(); + } }; } // anonymous namespace @@ -217,7 +228,7 @@ public: virtual void EndListAction(); virtual sal_Bool SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, const String& rText, sal_Bool bApi ); - virtual void SetValueCell( const ScAddress& rPos, double fVal, bool bInteraction ); + virtual bool SetValueCell( const ScAddress& rPos, double fVal, 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 ); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index e37abb0bd4ee..5cc714af7a8b 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -808,7 +808,7 @@ sal_Bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, return sal_True; } -void ScDocFunc::SetValueCell( const ScAddress& rPos, double fVal, bool bInteraction ) +bool ScDocFunc::SetValueCell( const ScAddress& rPos, double fVal, bool bInteraction ) { ScDocShellModificator aModificator( rDocShell ); ScDocument* pDoc = rDocShell.GetDocument(); @@ -867,6 +867,8 @@ void ScDocFunc::SetValueCell( const ScAddress& rPos, double fVal, bool bInteract // #103934#; notify editline and cell in edit mode if (!bInteraction) NotifyInputHandler( rPos ); + + return true; } sal_Bool ScDocFunc::PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, sal_Bool bApi ) diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx index 67611acc174c..2b31f46ef3ce 100644 --- a/sc/source/ui/inc/docfunc.hxx +++ b/sc/source/ui/inc/docfunc.hxx @@ -88,7 +88,7 @@ public: sal_Bool bRecord, sal_Bool bApi ); virtual sal_Bool SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, const String& rText, sal_Bool bApi ); - virtual void SetValueCell( const ScAddress& rPos, double fVal, bool bInteraction ); + virtual bool SetValueCell( const ScAddress& rPos, double fVal, 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 ); diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index 0e871117593f..c9f7a796273e 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -1017,7 +1017,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal { ScAddress aCellPos; ScUnoConversion::FillScAddress( aCellPos, aVariables[nVarPos] ); - rFunc.PutCell( aCellPos, new ScValueCell( aSolution[nVarPos] ), sal_True ); + rFunc.SetValueCell(aCellPos, aSolution[nVarPos], false); } mpDocShell->UnlockPaint(); } @@ -1054,7 +1054,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal { ScAddress aCellPos; ScUnoConversion::FillScAddress( aCellPos, aVariables[nVarPos] ); - rFunc.PutCell( aCellPos, new ScValueCell( aOldValues[nVarPos] ), sal_True ); + rFunc.SetValueCell(aCellPos, aOldValues[nVarPos], false); } mpDocShell->UnlockPaint(); } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index ab082b59bb76..abfdbfe0991c 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -6313,7 +6313,7 @@ void ScCellObj::SetValue_Impl(double fValue) { ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) - (void)pDocSh->GetDocFunc().PutCell( aCellPos, new ScValueCell(fValue), sal_True ); + pDocSh->GetDocFunc().SetValueCell(aCellPos, fValue, false); } // only for XML import diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx index eeb93a9d2406..7a4a4ab58e04 100644 --- a/sc/source/ui/view/viewfun6.cxx +++ b/sc/source/ui/view/viewfun6.cxx @@ -259,7 +259,7 @@ void ScViewFunc::InsertCurrentTime(short nCellFmt, const OUString& rUndoStr) (aActTime.GetMin() * 60.0) + (aActTime.GetHour() * 3600.0); fTime /= D_TIMEFACTOR; pUndoMgr->EnterListAction(rUndoStr, rUndoStr); - pDocSh->GetDocFunc().PutCell(aCurPos, new ScValueCell(fDate+fTime), false); + pDocSh->GetDocFunc().SetValueCell(aCurPos, fDate+fTime, true); // Set the new cell format only when it differs from the current cell // format type. |