chart2/qa/extras/chart2export.cxx | 20 +++++++++++++++++++- chart2/qa/extras/chart2import.cxx | 2 -- chart2/qa/extras/data/ods/tdf72776.ods |binary svx/source/svdraw/svdoashp.cxx | 6 ++---- svx/source/unodraw/unoshtxt.cxx | 5 ++++- sw/qa/extras/layout/layout2.cxx | 11 +++++++++-- 6 files changed, 34 insertions(+), 10 deletions(-)
New commits: commit 1aacd856ab0cf7217e2435c2e8c84d2e00963cb2 Author: Balazs Varga <balazs.varga...@gmail.com> AuthorDate: Tue Oct 27 21:19:36 2020 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Nov 30 12:32:46 2020 +0100 tdf#138307 Chart import: fix lost custom shape text Do not set empty text to SdrOutliner, if it is already set. Note: Also fix the missing custom shape problem in tdf#72776 and tdf#93641. The wrong position (X:0, Y:0) of these shapes is another problem. Regression from commit 6f62a5c4ee2c1b7654c7fcaa618fb495e0d32f0a (tdf#128985: ODP: Style text directions revert to RTL on save and re-open) Change-Id: I07d8cb12836daf15db347f6bb19c17ed9373189e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104909 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106853 Tested-by: Jenkins diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index a39b36234862..d92e06cdc01c 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -184,6 +184,7 @@ public: void testTdf137917(); void testTdf138204(); void testTdf138181(); + void testCustomShapeText(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(testErrorBarXLSX); @@ -330,6 +331,7 @@ public: CPPUNIT_TEST(testTdf137917); CPPUNIT_TEST(testTdf138204); CPPUNIT_TEST(testTdf138181); + CPPUNIT_TEST(testCustomShapeText); CPPUNIT_TEST_SUITE_END(); @@ -3016,7 +3018,7 @@ void Chart2ExportTest::testTdf138181() { load("/chart2/qa/extras/data/xlsx/", "piechart_deleted_legendentry.xlsx"); Reference<chart::XChartDocument> xChartDoc(getChartDocFromSheet(0, mxComponent), - UNO_QUERY_THROW); + UNO_QUERY_THROW); Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW); Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW); Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), UNO_QUERY_THROW); @@ -3038,6 +3040,22 @@ void Chart2ExportTest::testTdf138181() CPPUNIT_ASSERT(xLegendEntry3.is()); } +void Chart2ExportTest::testCustomShapeText() +{ + load("/chart2/qa/extras/data/ods/", "tdf72776.ods"); + reload("calc8"); + Reference<chart::XChartDocument> xChartDoc(getChartDocFromSheet(0, mxComponent), + UNO_QUERY_THROW); + // test that the text of custom shape exists inside the chart + Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW); + Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW); + Reference<drawing::XShape> xCustomShape(xDrawPage->getByIndex(1), UNO_QUERY_THROW); + CPPUNIT_ASSERT(xCustomShape.is()); + + Reference< text::XText > xRange(xCustomShape, uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT(!xRange->getString().isEmpty()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 483a862fee1c..67f0d31197d2 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -30,8 +30,6 @@ #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/text/XTextRange.hpp> -#include <com/sun/star/text/XText.hpp> -#include <com/sun/star/text/XTextCursor.hpp> #include <iterator> #include <com/sun/star/util/Color.hpp> diff --git a/chart2/qa/extras/data/ods/tdf72776.ods b/chart2/qa/extras/data/ods/tdf72776.ods new file mode 100644 index 000000000000..4ddad64a5ef5 Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf72776.ods differ diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 29461df169a5..35812345b27b 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -2162,10 +2162,8 @@ void SdrObjCustomShape::SetVerticalWriting( bool bVertical ) DBG_ASSERT( pOutlinerParaObject, "SdrTextObj::SetVerticalWriting() without OutlinerParaObject!" ); - if( !pOutlinerParaObject ) - return; - - if(pOutlinerParaObject->IsVertical() == bVertical) + if( !pOutlinerParaObject || + (pOutlinerParaObject->IsVertical() == bVertical) ) return; // get item settings diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index e0ade5699832..7f2a8af49606 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -545,7 +545,10 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder() if( pOutlinerParaObject && ( bOwnParaObj || !mpObject->IsEmptyPresObj() || mpObject->getSdrPageFromSdrObject()->IsMasterPage() ) ) { - mpOutliner->SetText( *pOutlinerParaObject ); + // tdf#72776: do not set empty text to SdrOutliner, if it is already set + if( !mpOutliner->GetEditEngine().GetTextLen() || pOutlinerParaObject->Count() > 1 || ( pOutlinerParaObject->Count() == 1 && + !pOutlinerParaObject->GetTextObject().GetText(0).isEmpty() ) ) + mpOutliner->SetText( *pOutlinerParaObject ); // put text to object and set EmptyPresObj to FALSE if( mpText && bOwnParaObj && mpObject->IsEmptyPresObj() && pTextObj->IsReallyEdited() ) diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 4223724a2ab5..90990ffd6cd3 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -21,6 +21,8 @@ #include <editeng/fhgtitem.hxx> #include <editeng/postitem.hxx> #include <editeng/unolingu.hxx> +#include <editeng/outlobj.hxx> +#include <editeng/editobj.hxx> #include <comphelper/sequence.hxx> #include <fmtanchr.hxx> @@ -47,6 +49,7 @@ #include <unoframe.hxx> #include <drawdoc.hxx> #include <svx/svdpage.hxx> +#include <svx/svdotext.hxx> #include <dcontact.hxx> char const DATA_DIRECTORY[] = "/sw/qa/extras/layout/data/"; @@ -2561,8 +2564,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137185) auto xTextFrame = SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat); CPPUNIT_ASSERT_EQUAL(OUString("Align me!"), xTextFrame->getText()->getString()); - CPPUNIT_ASSERT_EQUAL(OUString(), xTxt->getText()->getString()); - // Before the patch it failled, because the text appeared 2 times on each other. + SdrTextObj* pTextObj = dynamic_cast<SdrTextObj*>(pObj); + CPPUNIT_ASSERT(pTextObj); + auto aOutStr = pTextObj->GetOutlinerParaObject()->GetTextObject(); + + CPPUNIT_ASSERT(aOutStr.GetText(0).isEmpty()); + // Before the patch it failed, because the text appeared 2 times on each other. } CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf135035) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits