chart2/qa/extras/chart2export.cxx | 28 ++++++++++++++++++++++++++++ chart2/qa/extras/chart2import.cxx | 2 -- chart2/qa/extras/data/ods/tdf72776.ods |binary svx/source/svdraw/svdoashp.cxx | 10 ++++------ svx/source/unodraw/unoshtxt.cxx | 5 ++++- sw/qa/extras/layout/layout.cxx | 11 +++++++++-- 6 files changed, 45 insertions(+), 11 deletions(-)
New commits: commit 0c0b538eb51e1e720a315743e49ccd62caf234b9 Author: Balazs Varga <balazs.varga...@gmail.com> AuthorDate: Tue Oct 27 21:19:36 2020 +0100 Commit: Gabor Kelemen <kelemen.gab...@nisz.hu> CommitDate: Mon Mar 1 14:56:43 2021 +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 (cherry picked from commit 1aacd856ab0cf7217e2435c2e8c84d2e00963cb2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111706 Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu> diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 1456b5cf33d9..4d8903bfaff4 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -177,6 +177,12 @@ public: void testTdf134255(); void testTdf134977(); void testTdf137917(); +<<<<<<< HEAD (800bdf tdf#135198 tdf#138050 sw editing: fix text box position sync) +======= + void testTdf138204(); + void testTdf138181(); + void testCustomShapeText(); +>>>>>>> CHANGE (1aacd8 tdf#138307 Chart import: fix lost custom shape text) CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(testErrorBarXLSX); @@ -317,6 +323,12 @@ public: CPPUNIT_TEST(testTdf134255); CPPUNIT_TEST(testTdf134977); CPPUNIT_TEST(testTdf137917); +<<<<<<< HEAD (800bdf tdf#135198 tdf#138050 sw editing: fix text box position sync) +======= + CPPUNIT_TEST(testTdf138204); + CPPUNIT_TEST(testTdf138181); + CPPUNIT_TEST(testCustomShapeText); +>>>>>>> CHANGE (1aacd8 tdf#138307 Chart import: fix lost custom shape text) CPPUNIT_TEST_SUITE_END(); @@ -2899,6 +2911,22 @@ void Chart2ExportTest::testTdf137917() assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:dateAx/c:minorTimeUnit", "val", "days"); } +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 4e5cc49edae4..cb319ae08928 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -31,8 +31,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 4e44f1658c7b..78a5dccee1d8 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -2177,10 +2177,10 @@ void SdrObjCustomShape::SetVerticalWriting( bool bVertical ) DBG_ASSERT( pOutlinerParaObject, "SdrTextObj::SetVerticalWriting() without OutlinerParaObject!" ); - if( pOutlinerParaObject ) - { - if(pOutlinerParaObject->IsVertical() != bVertical) - { + if( !pOutlinerParaObject || + (pOutlinerParaObject->IsVertical() == bVertical) ) + return; + // get item settings const SfxItemSet& rSet = GetObjectItemSet(); @@ -2224,8 +2224,6 @@ void SdrObjCustomShape::SetVerticalWriting( bool bVertical ) // restore object size SetSnapRect(aObjectRect); - } - } } void SdrObjCustomShape::SuggestTextFrameSize(Size aSuggestedTextFrameSize) diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index 61fdc3636b74..ee46b244f350 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/layout.cxx b/sw/qa/extras/layout/layout.cxx index c41681b93f36..02c754b8404c 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.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 <fmtanchr.hxx> #include <fmtfsize.hxx> #include <fmtcntnt.hxx> @@ -40,6 +42,7 @@ #include <unoframe.hxx> #include <drawdoc.hxx> #include <svx/svdpage.hxx> +#include <svx/svdotext.hxx> #include <dcontact.hxx> #include <config_features.h> @@ -4503,8 +4506,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, 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_PLUGIN_IMPLEMENT(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits