diff options
-rw-r--r-- | sd/qa/unit/tiledrendering/data/tdf102223.odp | bin | 0 -> 17335 bytes | |||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 48 | ||||
-rw-r--r-- | svx/source/table/svdotable.cxx | 18 |
3 files changed, 50 insertions, 16 deletions
diff --git a/sd/qa/unit/tiledrendering/data/tdf102223.odp b/sd/qa/unit/tiledrendering/data/tdf102223.odp Binary files differnew file mode 100644 index 000000000000..6b8570f07023 --- /dev/null +++ b/sd/qa/unit/tiledrendering/data/tdf102223.odp diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 37d06072068e..3f1a08c8372d 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -20,7 +20,11 @@ #include <comphelper/string.hxx> #include <editeng/editids.hrc> #include <editeng/editview.hxx> +#include <editeng/editobj.hxx> #include <editeng/outliner.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/outlobj.hxx> #include <osl/conditn.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/viewfrm.hxx> @@ -72,6 +76,7 @@ public: void testUndoLimiting(); void testCreateViewGraphicSelection(); void testCreateViewTextCursor(); + void testTdf102223(); CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -99,6 +104,7 @@ public: CPPUNIT_TEST(testUndoLimiting); CPPUNIT_TEST(testCreateViewGraphicSelection); CPPUNIT_TEST(testCreateViewTextCursor); + CPPUNIT_TEST(testTdf102223); CPPUNIT_TEST_SUITE_END(); private: @@ -1242,6 +1248,48 @@ void SdTiledRenderingTest::testCreateViewTextCursor() comphelper::LibreOfficeKit::setActive(false); } +void SdTiledRenderingTest::testTdf102223() +{ + // Load the document. + comphelper::LibreOfficeKit::setActive(); + SdXImpressDocument* pXImpressDocument = createDoc("tdf102223.odp"); + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + SdPage* pActualPage = pViewShell->GetActualPage(); + auto pTableObject = dynamic_cast<sdr::table::SdrTableObj*>(pActualPage->GetObj(2)); + CPPUNIT_ASSERT(pTableObject); + SdrView* pView = pViewShell->GetView(); + + // select contents of cell + Rectangle aRect = pTableObject->GetCurrentBoundRect(); + pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, + convertMm100ToTwip(aRect.getX() + 2), convertMm100ToTwip(aRect.getY() + 2), + 1, MOUSE_LEFT, 0); + pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, + convertMm100ToTwip(aRect.getX() + 2), convertMm100ToTwip(aRect.getY() + 2), + 1, MOUSE_LEFT, 0); + pView->SdrBeginTextEdit(pTableObject); + CPPUNIT_ASSERT(pView->GetTextEditObject()); + EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView(); + rEditView.SetSelection(ESelection(0, 0, 0, 3)); // start para, start char, end para, end char. + CPPUNIT_ASSERT_EQUAL(OUString("Red"), rEditView.GetSelected()); + const SvxFontHeightItem& rItem = static_cast<const SvxFontHeightItem&>(rEditView.GetAttribs().Get(EE_CHAR_FONTHEIGHT)); + CPPUNIT_ASSERT_EQUAL((int)1411, (int)rItem.GetHeight()); + + // cut contents of cell + uno::Sequence<beans::PropertyValue> aArgs; + comphelper::dispatchCommand(".uno:Cut", aArgs); + + pView->SdrBeginTextEdit(pTableObject); + CPPUNIT_ASSERT(pView->GetTextEditObject()); + EditView& rEditView2 = pView->GetTextEditOutlinerView()->GetEditView(); + rEditView2.SetSelection(ESelection(0, 0, 0, 1)); // start para, start char, end para, end char. + const SvxFontHeightItem& rItem2 = static_cast<const SvxFontHeightItem&>(rEditView2.GetAttribs().Get(EE_CHAR_FONTHEIGHT)); + CPPUNIT_ASSERT_EQUAL((int)1411, (int)rItem2.GetHeight()); + + comphelper::LibreOfficeKit::setActive(false); +} + + CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index e4e3087010cc..34b64cd1db7a 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -1823,25 +1823,11 @@ void SdrTableObj::EndTextEdit(SdrOutliner& rOutl) if(p1stPara) { - if(nParaAnz == 1) - { - // if its only one paragraph, check if it is empty - OUString aStr(rOutl.GetText(p1stPara)); - if (aStr.isEmpty()) - { - // gotcha! - nParaAnz = 0; - } - } - // to remove the grey field background rOutl.UpdateFields(); - if(nParaAnz != 0) - { - // create new text object - pNewText = rOutl.CreateParaObject( 0, nParaAnz ); - } + // create new text object + pNewText = rOutl.CreateParaObject( 0, nParaAnz ); } SetOutlinerParaObject(pNewText); } |