chart2/source/controller/main/ChartController.cxx | 13 +++ chart2/source/controller/main/ChartController.hxx | 4 + chart2/source/controller/main/ChartController_Window.cxx | 16 ++++ sc/qa/unit/ucalc_sharedformula.cxx | 26 +++++++ sc/source/core/data/column4.cxx | 54 ++++++++------- 5 files changed, 88 insertions(+), 25 deletions(-)
New commits: commit a5120eb4a2f14ee59222ada0b46144a6b80986b7 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Fri Apr 11 09:27:59 2014 -0400 Several more Window events to intercept for the GL3D chart. But not painting or resizing events. Those are generic enough that no branching is needed. Change-Id: I0fb186da61c583c5326d2608b2153aced3fab77b diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 8786b3f..9c8c490 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -1410,6 +1410,19 @@ void ChartController::queryGL3DChart() m_bGL3DChart = GL3DHelper::isGL3DDiagram(xDiagram); } +void ChartController::executeGL3D_Tracking( const TrackingEvent& /*rTEvt*/ ) +{ +} + +void ChartController::executeGL3D_Command( const CommandEvent& /*rCEvt*/ ) +{ +} + +bool ChartController::executeGL3D_KeyInput( const KeyEvent& /*rKEvt*/ ) +{ + return false; +} + void ChartController::executeGL3D_MouseButtonUp( const MouseEvent& /*rMEvt*/ ) { } diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx index e62904a..0698d56 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/main/ChartController.hxx @@ -433,6 +433,10 @@ private: void queryGL3DChart(); + void executeGL3D_Tracking( const TrackingEvent& rTEvt ); + void executeGL3D_Command( const CommandEvent& rCEvt ); + bool executeGL3D_KeyInput( const KeyEvent& rKEvt ); + void executeGL3D_MouseButtonUp( const MouseEvent& rMEvt ); void executeGL3D_MouseButtonDown( const MouseEvent& rMEvt ); void executeGL3D_MouseMove( const MouseEvent& rMEvt ); diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index e420b3b..66ea74f 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -746,8 +746,13 @@ void ChartController::execute_MouseMove( const MouseEvent& rMEvt ) impl_SetMousePointer( rMEvt ); } -void ChartController::execute_Tracking( const TrackingEvent& /* rTEvt */ ) +void ChartController::execute_Tracking( const TrackingEvent& rTEvt ) { + if (m_bGL3DChart) + { + executeGL3D_Tracking(rTEvt); + return; + } } void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) @@ -988,6 +993,12 @@ void ChartController::execute_LoseFocus() void ChartController::execute_Command( const CommandEvent& rCEvt ) { + if (m_bGL3DChart) + { + executeGL3D_Command(rCEvt); + return; + } + bool bIsAction = false; { SolarMutexGuard aGuard; @@ -1303,6 +1314,9 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) { + if (m_bGL3DChart) + return executeGL3D_KeyInput(rKEvt); + bool bReturn=false; DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; commit 4fc780b4d861e0ea0fece5f5e4ff11dc73153470 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Fri Apr 11 00:55:10 2014 -0400 fdo#77300: Do the same for the shared formula case as well. Change-Id: I560b0beabe81907e3f85d8845041a9df25d2200d diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index 7d87177..ec938d8 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -637,23 +637,26 @@ public: ScFormulaCell* pTop = *rEntry.mpCells; OUString aFormula = pTop->GetHybridFormula(); - // Create a new token array from the hybrid formula string, and - // set it to the group. - ScCompiler aComp(mrCompileFormulaCxt, pTop->aPos); - ScTokenArray* pNewCode = aComp.CompileString(aFormula); - ScFormulaCellGroupRef xGroup = pTop->GetCellGroup(); - assert(xGroup); - xGroup->setCode(pNewCode); - xGroup->compileCode(*mpDoc, pTop->aPos, mpDoc->GetGrammar()); - - // Propagate the new token array to all formula cells in the group. - ScFormulaCell** pp = rEntry.mpCells; - ScFormulaCell** ppEnd = pp + rEntry.mnLength; - for (; pp != ppEnd; ++pp) + if (!aFormula.isEmpty()) { - ScFormulaCell* p = *pp; - p->SyncSharedCode(); - p->SetDirty(); + // Create a new token array from the hybrid formula string, and + // set it to the group. + ScCompiler aComp(mrCompileFormulaCxt, pTop->aPos); + ScTokenArray* pNewCode = aComp.CompileString(aFormula); + ScFormulaCellGroupRef xGroup = pTop->GetCellGroup(); + assert(xGroup); + xGroup->setCode(pNewCode); + xGroup->compileCode(*mpDoc, pTop->aPos, mpDoc->GetGrammar()); + + // Propagate the new token array to all formula cells in the group. + ScFormulaCell** pp = rEntry.mpCells; + ScFormulaCell** ppEnd = pp + rEntry.mnLength; + for (; pp != ppEnd; ++pp) + { + ScFormulaCell* p = *pp; + p->SyncSharedCode(); + p->SetDirty(); + } } } else commit 567f256a48e2f5a697792b8aa1b9edc6e56f5332 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Fri Apr 11 00:53:49 2014 -0400 fdo#77300: Add more test to cover the shared formula case. Change-Id: I076cb7b8d5f9b51e7337a512bb86efbabee021a8 diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 603e26e..d482216 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -1225,17 +1225,29 @@ void Test::testSharedFormulaUpdateOnNamedRangeChange() // Set single formula with no named range to B5. m_pDoc->SetString(ScAddress(1,4,0), "=ROW()"); + // Set shared formula with no named range to B7:B8. + m_pDoc->SetString(ScAddress(1,6,0), "=ROW()"); + m_pDoc->SetString(ScAddress(1,7,0), "=ROW()"); + // B1:B3 should be grouped. ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1,0,0)); CPPUNIT_ASSERT(pFC); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pFC->GetSharedTopRow()); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(3), pFC->GetSharedLength()); + // B7:B8 should be grouped. + pFC = m_pDoc->GetFormulaCell(ScAddress(1,6,0)); + CPPUNIT_ASSERT(pFC); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(6), pFC->GetSharedTopRow()); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength()); + CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,0,0))); CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,1,0))); CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,2,0))); CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(1,4,0))); + CPPUNIT_ASSERT_EQUAL(7.0, m_pDoc->GetValue(ScAddress(1,6,0))); + CPPUNIT_ASSERT_EQUAL(8.0, m_pDoc->GetValue(ScAddress(1,7,0))); // Set a single formula to C1. m_pDoc->SetString(ScAddress(2,0,0), "=AVERAGE(MyRange)"); @@ -1267,6 +1279,10 @@ void Test::testSharedFormulaUpdateOnNamedRangeChange() CPPUNIT_FAIL("Wrong formula!"); if (!checkFormula(*m_pDoc, ScAddress(1,4,0), "ROW()")) CPPUNIT_FAIL("Wrong formula!"); + if (!checkFormula(*m_pDoc, ScAddress(1,6,0), "ROW()")) + CPPUNIT_FAIL("Wrong formula!"); + if (!checkFormula(*m_pDoc, ScAddress(1,7,0), "ROW()")) + CPPUNIT_FAIL("Wrong formula!"); if (!checkFormula(*m_pDoc, ScAddress(2,0,0), "AVERAGE(MyRange)")) CPPUNIT_FAIL("Wrong formula!"); @@ -1275,6 +1291,8 @@ void Test::testSharedFormulaUpdateOnNamedRangeChange() CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(1,1,0))); CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(1,2,0))); CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(1,4,0))); + CPPUNIT_ASSERT_EQUAL(7.0, m_pDoc->GetValue(ScAddress(1,6,0))); + CPPUNIT_ASSERT_EQUAL(8.0, m_pDoc->GetValue(ScAddress(1,7,0))); CPPUNIT_ASSERT_EQUAL(2.5, m_pDoc->GetValue(ScAddress(2,0,0))); m_pDoc->DeleteTab(0); commit b04edce60dab90ab15390e202c8848f943260b2f Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Fri Apr 11 00:43:18 2014 -0400 fdo#77300: Don't re-compile formulas when the hybrid formula is not there. Change-Id: I9b0f8d031fec08bb8d92333ff67074fdc739e034 diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index c658124..7d87177 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -661,16 +661,19 @@ public: ScFormulaCell* pCell = rEntry.mpCell; OUString aFormula = pCell->GetHybridFormula(); - // Create token array from formula string. - ScCompiler aComp(mrCompileFormulaCxt, pCell->aPos); - ScTokenArray* pNewCode = aComp.CompileString(aFormula); + if (!aFormula.isEmpty()) + { + // Create token array from formula string. + ScCompiler aComp(mrCompileFormulaCxt, pCell->aPos); + ScTokenArray* pNewCode = aComp.CompileString(aFormula); - // Generate RPN tokens. - ScCompiler aComp2(mpDoc, pCell->aPos, *pNewCode); - aComp2.CompileTokenArray(); + // Generate RPN tokens. + ScCompiler aComp2(mpDoc, pCell->aPos, *pNewCode); + aComp2.CompileTokenArray(); - pCell->SetCode(pNewCode); - pCell->SetDirty(); + pCell->SetCode(pNewCode); + pCell->SetDirty(); + } } } }; commit a85348c5e5334292e26ef67ff027c98131f478aa Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Fri Apr 11 00:34:37 2014 -0400 fdo#77300: Add test for this. Change-Id: Ib870d8f115b074a4ad80ee6910f92ba8d4b0c01e diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index acb249a..603e26e 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -1222,6 +1222,9 @@ void Test::testSharedFormulaUpdateOnNamedRangeChange() m_pDoc->SetString(ScAddress(1,1,0), "=SUM(MyRange)"); m_pDoc->SetString(ScAddress(1,2,0), "=SUM(MyRange)"); + // Set single formula with no named range to B5. + m_pDoc->SetString(ScAddress(1,4,0), "=ROW()"); + // B1:B3 should be grouped. ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1,0,0)); CPPUNIT_ASSERT(pFC); @@ -1232,6 +1235,8 @@ void Test::testSharedFormulaUpdateOnNamedRangeChange() CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,1,0))); CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,2,0))); + CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(1,4,0))); + // Set a single formula to C1. m_pDoc->SetString(ScAddress(2,0,0), "=AVERAGE(MyRange)"); pFC = m_pDoc->GetFormulaCell(ScAddress(2,0,0)); @@ -1260,6 +1265,8 @@ void Test::testSharedFormulaUpdateOnNamedRangeChange() CPPUNIT_FAIL("Wrong formula!"); if (!checkFormula(*m_pDoc, ScAddress(1,2,0), "SUM(MyRange)")) CPPUNIT_FAIL("Wrong formula!"); + if (!checkFormula(*m_pDoc, ScAddress(1,4,0), "ROW()")) + CPPUNIT_FAIL("Wrong formula!"); if (!checkFormula(*m_pDoc, ScAddress(2,0,0), "AVERAGE(MyRange)")) CPPUNIT_FAIL("Wrong formula!"); @@ -1267,6 +1274,7 @@ void Test::testSharedFormulaUpdateOnNamedRangeChange() CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(1,0,0))); CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(1,1,0))); CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(1,2,0))); + CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(1,4,0))); CPPUNIT_ASSERT_EQUAL(2.5, m_pDoc->GetValue(ScAddress(2,0,0))); m_pDoc->DeleteTab(0); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits