[Libreoffice-commits] core.git: chart2/qa svx/source sw/qa
Balazs Varga (via logerrit)
logerrit at kemper.freedesktop.org
Fri Nov 27 12:10:17 UTC 2020
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 | 9 ++++++++-
6 files changed, 33 insertions(+), 9 deletions(-)
New commits:
commit 71b66b0039819f38c935b4eb5d5951ceaf6e8468
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Tue Oct 27 21:19:36 2020 +0100
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Fri Nov 27 13:09:33 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 <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
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 490b2ce2698d..cb8c08c0697e 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 3d0066d25339..b52ff9ecdb6c 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 <fmtfsize.hxx>
@@ -45,6 +47,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/";
@@ -2562,7 +2565,11 @@ 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());
+ 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.
}
More information about the Libreoffice-commits
mailing list