diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-03-02 20:22:30 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-03-03 05:52:55 +0100 |
commit | e17224501e9f4f783d5be3f5aa9c7f6decd8a405 (patch) | |
tree | a71050673f3bc76a5956a728262b12f9991247fe /sc | |
parent | 300eaa533eed3f9e07cf24d53e4e4c561be2fc3b (diff) |
Revert "Make Chart Creation Wizard async"
This reverts commit ed86b6250cd00ed6b7bdb81307bc66adba129cae.
Reason for revert: Most Jenkins builds for that change were aborted
after timing out, and many other Gerrit Jenkins and tinderbox builds
now time out, too. It very much smells like that commit was the
culprit.
Change-Id: I5473c58957f92d63113e32f862ad9c114f9c844c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89803
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/drawfunc/fuins2.cxx | 132 | ||||
-rw-r--r-- | sc/source/ui/inc/fuinsert.hxx | 14 | ||||
-rw-r--r-- | sc/source/ui/inc/tabvwsh.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh4.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshb.cxx | 2 |
5 files changed, 65 insertions, 87 deletions
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index d926a1eb7258..80753e59c3cd 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -53,12 +53,10 @@ #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> -#include <com/sun/star/ui/dialogs/XDialogClosedListener.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <cppuhelper/bootstrap.hxx> -#include <svtools/dialogclosedlistener.hxx> #include <PivotTableDataProvider.hxx> #include <chart2uno.hxx> @@ -400,58 +398,8 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* rReq.Ignore(); } -IMPL_LINK( FuInsertChart, DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, pEvent, void ) -{ - bool bAddUndo = true; - - if( pEvent->DialogResult == ui::dialogs::ExecutableDialogResults::CANCEL ) - { - // leave OLE inplace mode and unmark - OSL_ASSERT( pView ); - rViewShell.DeactivateOle(); - pView->UnMarkAll(); - - // old page view pointer is invalid after switching sheets - SdrPageView* pPV = pView->GetSdrPageView(); - - // remove the chart - OSL_ASSERT( pPV ); - SdrPage * pPage( pPV->GetPage()); - OSL_ASSERT( pPage ); - OSL_ASSERT( m_pInsertedObject ); - if( pPage ) - { - // Remove the OLE2 object from the sdr page. - SdrObject* pRemoved = pPage->RemoveObject( m_pInsertedObject->GetOrdNum() ); - OSL_ASSERT( pRemoved == m_pInsertedObject ); - SdrObject::Free( pRemoved ); - } - - bAddUndo = false; - - // leave the draw shell - rViewShell.SetDrawShell( false ); - - // reset marked cell area - ScMarkData aMark = rViewShell.GetViewData().GetMarkData(); - rViewShell.GetViewData().GetViewShell()->SetMarkData(aMark); - } - else - { - OSL_ASSERT( pEvent->DialogResult == ui::dialogs::ExecutableDialogResults::OK ); - //@todo maybe move chart to different table - } - - if ( bAddUndo ) - { - // add undo action the same way as in SdrEditView::InsertObjectAtView - // (using UndoActionHdl etc.) - pView->AddUndo(std::make_unique<SdrUndoNewObj>(*m_pInsertedObject)); - } -} - FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pViewP, - SdrModel* pDoc, SfxRequest& rReq) + SdrModel* pDoc, SfxRequest& rReq) : FuPoor(rViewSh, pWin, pViewP, pDoc, rReq) { const SfxItemSet* pReqArgs = rReq.GetArgs(); @@ -635,7 +583,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV Point aStart = rViewSh.GetChartInsertPos( aSize, aPositionRange ); tools::Rectangle aRect (aStart, aSize); - m_pInsertedObject = new SdrOle2Obj( + SdrOle2Obj* pObj = new SdrOle2Obj( *pDoc, // TTTT should be reference svt::EmbeddedObjectRef(xObj, nAspect), aName, @@ -649,10 +597,11 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV // pView->InsertObjectAtView(pObj, *pPV);//this call leads to an immediate redraw and asks the chart for a visual representation // use the page instead of the view to insert, so no undo action is created yet - SdrPage* m_pPage = pPV->GetPage(); - m_pPage->InsertObject( m_pInsertedObject ); + SdrPage* pInsPage = pPV->GetPage(); + pInsPage->InsertObject( pObj ); pView->UnmarkAllObj(); - pView->MarkObj( m_pInsertedObject, pPV ); + pView->MarkObj( pObj, pPV ); + bool bAddUndo = true; // add undo action later, unless the dialog is canceled if (rReq.IsAPI()) { @@ -665,7 +614,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV // only activate object if not called via API (e.g. macro) if (!comphelper::LibreOfficeKit::isActive()) - rViewShell.ActivateObject(m_pInsertedObject, embed::EmbedVerbs::MS_OLEVERB_SHOW); + rViewShell.ActivateObject(pObj, embed::EmbedVerbs::MS_OLEVERB_SHOW); //open wizard //@todo get context from calc if that has one @@ -676,11 +625,11 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV uno::Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() ); if(xMCF.is()) { - m_xDialog = uno::Reference< ui::dialogs::XAsynchronousExecutableDialog >( + uno::Reference< ui::dialogs::XExecutableDialog > xDialog( xMCF->createInstanceWithContext( "com.sun.star.comp.chart2.WizardDialog" , xContext), uno::UNO_QUERY); - uno::Reference< lang::XInitialization > xInit( m_xDialog, uno::UNO_QUERY ); + uno::Reference< lang::XInitialization > xInit( xDialog, uno::UNO_QUERY ); if( xChartModel.is() && xInit.is() ) { uno::Sequence<uno::Any> aSeq(comphelper::InitAnyPropertySequence( @@ -691,7 +640,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV xInit->initialize( aSeq ); // try to set the dialog's position so it doesn't hide the chart - uno::Reference < beans::XPropertySet > xDialogProps( m_xDialog, uno::UNO_QUERY ); + uno::Reference < beans::XPropertySet > xDialogProps( xDialog, uno::UNO_QUERY ); if ( xDialogProps.is() ) { try @@ -721,21 +670,62 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV } } - ::svt::DialogClosedListener* pListener = new ::svt::DialogClosedListener(); - pListener->SetDialogClosedLink( LINK( this, FuInsertChart, DialogClosedHdl ) ); - css::uno::Reference<css::ui::dialogs::XDialogClosedListener> xListener( pListener ); + sal_Int16 nDialogRet = xDialog->execute(); + if( nDialogRet == ui::dialogs::ExecutableDialogResults::CANCEL ) + { + // leave OLE inplace mode and unmark + OSL_ASSERT( pView ); + rViewShell.DeactivateOle(); + pView->UnmarkAll(); + + // old page view pointer is invalid after switching sheets + pPV = pView->GetSdrPageView(); + + // remove the chart + OSL_ASSERT( pPV ); + SdrPage * pPage( pPV->GetPage()); + OSL_ASSERT( pPage ); + OSL_ASSERT( pObj ); + if( pPage ) + { + // Remove the OLE2 object from the sdr page. + SdrObject* pRemoved = pPage->RemoveObject(pObj->GetOrdNum()); + OSL_ASSERT(pRemoved == pObj); + SdrObject::Free(pRemoved); // Don't forget to free it. + } - m_xDialog->startExecuteModal( xListener ); - } - else - { - uno::Reference< lang::XComponent > xComponent( m_xDialog, uno::UNO_QUERY ); - if( xComponent.is()) - xComponent->dispose(); + bAddUndo = false; // don't create the undo action for inserting + + // leave the draw shell + rViewShell.SetDrawShell( false ); + + // reset marked cell area + + rViewSh.GetViewData().GetViewShell()->SetMarkData(aMark); + } + else + { + OSL_ASSERT( nDialogRet == ui::dialogs::ExecutableDialogResults::OK ); + //@todo maybe move chart to different table + } } + uno::Reference< lang::XComponent > xComponent( xDialog, uno::UNO_QUERY ); + if( xComponent.is()) + xComponent->dispose(); } } } + else if( xChartModel.is() ) + xChartModel->unlockControllers(); + + if ( bAddUndo ) + { + // add undo action the same way as in SdrEditView::InsertObjectAtView + // (using UndoActionHdl etc.) + pView->AddUndo(std::make_unique<SdrUndoNewObj>(*pObj)); + } + + // BM/IHA -- } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/fuinsert.hxx b/sc/source/ui/inc/fuinsert.hxx index cfad23933836..863aa6d88cb1 100644 --- a/sc/source/ui/inc/fuinsert.hxx +++ b/sc/source/ui/inc/fuinsert.hxx @@ -22,9 +22,6 @@ #include "fupoor.hxx" #include <scdllapi.h> -#include <svx/svdoole2.hxx> -#include <com/sun/star/ui/dialogs/DialogClosedEvent.hpp> -#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> class FuInsertGraphic : public FuPoor { @@ -43,14 +40,9 @@ public: class FuInsertChart : public FuPoor { - css::uno::Reference<css::ui::dialogs::XAsynchronousExecutableDialog> m_xDialog; - SdrOle2Obj* m_pInsertedObject; - - DECL_LINK( DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void ); - - public: - FuInsertChart( ScTabViewShell& pViewSh, vcl::Window* pWin, ScDrawView* pView, - SdrModel* pDoc, SfxRequest& rReq); +public: + FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pView, + SdrModel* pDoc, SfxRequest& rReq); }; class FuInsertMedia : public FuPoor diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index df33dac2c00e..210cf689d2c1 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -59,7 +59,6 @@ class ScPageBreakShell; class ScDPObject; class ScNavigatorSettings; class ScRangeName; -class FuInsertChart; struct ScHeaderFieldData; @@ -98,7 +97,6 @@ private: sal_uInt16 nDrawSfxId; sal_uInt16 nFormSfxId; OUString sDrawCustom; // current custom shape type - std::unique_ptr<ScDrawShell> pDrawShell; std::unique_ptr<ScDrawTextObjectBar> pDrawTextShell; std::unique_ptr<ScEditShell> pEditShell; @@ -113,7 +111,6 @@ private: std::unique_ptr<ScPageBreakShell> pPageBreakShell; std::unique_ptr<svx::ExtrusionBar> pExtrusionBarShell; std::unique_ptr<svx::FontworkBar> pFontworkBarShell; - std::unique_ptr<FuInsertChart> pFuInsertChart; std::unique_ptr<FmFormShell> pFormShell; diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index e190b3fdb684..f4f61330b4fb 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -56,7 +56,6 @@ #include <inputwin.hxx> #include <dbdata.hxx> #include <reffact.hxx> -#include <fuinsert.hxx> #include <viewuno.hxx> #include <dispuno.hxx> #include <chgtrack.hxx> diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 6b4f3b4a8045..545fce092934 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -333,7 +333,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) break; case SID_INSERT_DIAGRAM: - pFuInsertChart.reset(new FuInsertChart(*this, pWin, pView, pDrModel, rReq)); + FuInsertChart(*this, pWin, pView, pDrModel, rReq); break; case SID_INSERT_OBJECT: |