include/svx/svdedtv.hxx | 2 - sc/qa/unit/tiledrendering/tiledrendering.cxx | 31 ++++++++++++++++++++++++++- sc/source/ui/view/tabvwsh2.cxx | 11 +++++++-- svx/sdi/svx.sdi | 2 - svx/source/svdraw/svdedtv.cxx | 7 +++--- 5 files changed, 45 insertions(+), 8 deletions(-)
New commits: commit a743d338c24407b4dec62f12dfff49621102eeac Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Mar 9 16:41:36 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Mar 28 13:07:01 2022 +0200 svx: don't remove object right after insertion This is regression from: commit 2d95b3846eac367d2baadc194ab258dc31e7bd33 Author: Tomaz Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Thu Oct 7 16:48:46 2021 +0200 svx: Don't end text edit mode for all views It was visible with "direct insertion" where user doesn't need to draw anything but textbox is inserted in the center of a screen (eg. used in LOK case) Object was inserted into a view and right after that was removed when EndTextEditCurrentView was called Change-Id: I9943d46746aabadf96d76d6e74770b56d648b79d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131263 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Mert Tumer <mert.tu...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131537 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131596 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx index 6f80c3aca0fa..d2c9b3816f6a 100644 --- a/include/svx/svdedtv.hxx +++ b/include/svx/svdedtv.hxx @@ -188,7 +188,7 @@ public: * Checks if this or other views have an active text edit, if true, end them. */ void EndTextEditAllViews() const; - void EndTextEditCurrentView(); + void EndTextEditCurrentView(bool bDontDeleteReally = false); std::vector< std::unique_ptr<SdrUndoAction> > CreateConnectorUndo( const SdrObject& rO ); void AddUndoActions( std::vector< std::unique_ptr<SdrUndoAction> > ); diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index c4e0da7b9f87..6c6cd5990c3c 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -121,6 +121,7 @@ public: void testEditCursorBounds(); void testTextSelectionBounds(); void testSheetViewDataCrash(); + void testTextBoxInsert(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnHeaders); @@ -175,6 +176,7 @@ public: CPPUNIT_TEST(testEditCursorBounds); CPPUNIT_TEST(testTextSelectionBounds); CPPUNIT_TEST(testSheetViewDataCrash); + CPPUNIT_TEST(testTextBoxInsert); CPPUNIT_TEST_SUITE_END(); private: @@ -458,7 +460,12 @@ struct EditCursorMessage final { std::stringstream aStream(pMessage); boost::property_tree::ptree aTree; boost::property_tree::read_json(aStream, aTree); - std::string aVal = aTree.get_child("refpoint").get_value<std::string>(); + std::string aVal; + boost::property_tree::ptree::const_assoc_iterator it = aTree.find("refpoint"); + if (it != aTree.not_found()) + aVal = aTree.get_child("refpoint").get_value<std::string>(); + else + return; // happens in testTextBoxInsert test uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(aVal.c_str())); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aSeq.getLength()); @@ -2868,6 +2875,28 @@ void ScTiledRenderingTest::testSheetViewDataCrash() Scheduler::ProcessEventsToIdle(); } +void ScTiledRenderingTest::testTextBoxInsert() +{ + comphelper::LibreOfficeKit::setActive(); + + createDoc("empty.ods"); + ViewCallback aView1; + + // insert textbox + uno::Sequence<beans::PropertyValue> aArgs( + comphelper::InitPropertySequence({ + { "CreateDirectly", uno::Any(true) } + })); + comphelper::dispatchCommand(".uno:DrawText", aArgs); + Scheduler::ProcessEventsToIdle(); + + // check if we have textbox selected + CPPUNIT_ASSERT(!aView1.m_ShapeSelection.isEmpty()); + CPPUNIT_ASSERT(aView1.m_ShapeSelection != "EMPTY"); + + Scheduler::ProcessEventsToIdle(); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index 47f5c971e543..420f024f2064 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -1000,7 +1000,8 @@ bool SdrEditView::InsertObjectAtView(SdrObject* pObj, SdrPageView& rPV, SdrInser } if( IsUndoEnabled()) { - EndTextEditCurrentView(); + bool bDontDeleteReally = true; + EndTextEditCurrentView(bDontDeleteReally); AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pObj)); } @@ -1080,13 +1081,13 @@ void SdrEditView::EndTextEditAllViews() const } } -void SdrEditView::EndTextEditCurrentView() +void SdrEditView::EndTextEditCurrentView(bool bDontDeleteReally) { if (IsTextEdit()) { SdrView* pSdrView = dynamic_cast<SdrView*>(this); if (pSdrView) - pSdrView->SdrEndTextEdit(); + pSdrView->SdrEndTextEdit(bDontDeleteReally); } } commit 10ee1f9d52f28db0aff61fb6f4e08b3fedfd9d19 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Mar 9 21:32:35 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Mar 28 13:06:47 2022 +0200 lok: insert textbox directly in Calc Change-Id: I3ae00b255dfbaa34ab8d973356d12dfd0f71d345 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131267 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Mert Tumer <mert.tu...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131536 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132101 diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index a096a766ea7d..9060fa98e65c 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -265,6 +265,7 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) case SID_DRAW_TEXT_MARQUEE: case SID_DRAW_NOTEEDIT: pTabView->SetDrawFuncPtr(new FuText(*this, pWin, pView, pDoc, aNewReq)); + bCreateDirectly = comphelper::LibreOfficeKit::isActive(); break; case SID_FM_CREATE_CONTROL: @@ -335,7 +336,6 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) } else { - GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON); ScViewData& rViewData = GetViewData(); aInsertPos = rViewData.getLOKVisibleArea().Center(); if (comphelper::LibreOfficeKit::isCompatFlagSet( @@ -370,13 +370,20 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq) // insert into page pView->InsertObjectAtView(pObj.release(), *pPageView); - if ( nNewId == SID_DRAW_CAPTION || nNewId == SID_DRAW_CAPTION_VERTICAL ) + switch ( nNewId ) { + case SID_DRAW_CAPTION: + case SID_DRAW_CAPTION_VERTICAL: + case SID_DRAW_TEXT: + case SID_DRAW_TEXT_VERTICAL: // use KeyInput to start edit mode (FuText is created). // For FuText objects, edit mode is handled within CreateDefaultObject. // KEY_F2 is handled in FuDraw::KeyInput. pFuActual->KeyInput( KeyEvent( 0, vcl::KeyCode( KEY_F2 ) ) ); + break; + default: + break; } } diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 1e08145d3644..135efb8a845a 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -8520,7 +8520,7 @@ SfxBoolItem Text SID_ATTR_CHAR SfxBoolItem DrawText SID_DRAW_TEXT - +(SfxBoolItem CreateDirectly FN_PARAM_1) [ AutoUpdate = TRUE, FastCall = FALSE,