[Libreoffice-commits] core.git: oox/qa writerfilter/source

2023-11-28 Thread Regina Henschel (via logerrit)
 oox/qa/unit/data/WPC_tdf158348_shape_text_in_table_cell.docx |binary
 oox/qa/unit/wpc_drawing_canvas.cxx   |   32 ++-
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx|4 -
 3 files changed, 33 insertions(+), 3 deletions(-)

New commits:
commit bf6350ef7f9856abc4d6a085bd2d2f95d6b0c84e
Author: Regina Henschel 
AuthorDate: Mon Nov 27 02:22:29 2023 +0100
Commit: Regina Henschel 
CommitDate: Tue Nov 28 14:07:30 2023 +0100

tdf#158348 Treat wordprocessing canvas like group shape

getFullWPGSupport() is always false for mrShapeContext in case of a
shape on wordprocessing canvas in table cell. On the other hand we do
not need the test, because a wordprocessing canvas only occurs in docx
and thus the replacement group always has FullWPGSupport.

Change-Id: I0e7a9cf1c1c91a893ad7411fda7607947f053e05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159979
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/oox/qa/unit/data/WPC_tdf158348_shape_text_in_table_cell.docx 
b/oox/qa/unit/data/WPC_tdf158348_shape_text_in_table_cell.docx
new file mode 100644
index ..e8f2cf73d3d5
Binary files /dev/null and 
b/oox/qa/unit/data/WPC_tdf158348_shape_text_in_table_cell.docx differ
diff --git a/oox/qa/unit/wpc_drawing_canvas.cxx 
b/oox/qa/unit/wpc_drawing_canvas.cxx
index 1d00123e14a1..d1fde534034c 100644
--- a/oox/qa/unit/wpc_drawing_canvas.cxx
+++ b/oox/qa/unit/wpc_drawing_canvas.cxx
@@ -20,9 +20,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
+#include 
 #include 
-#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -276,6 +278,34 @@ CPPUNIT_TEST_FIXTURE(TestWPC, 
WPC_tdf158339_shape_text_in_group)
 CPPUNIT_ASSERT(xTextFrame.is());
 CPPUNIT_ASSERT_EQUAL(OUString("Group"), 
xTextFrame->getText()->getString());
 }
+
+CPPUNIT_TEST_FIXTURE(TestWPC, WPC_tdf158348_shape_text_in_table_cell)
+{
+// The document has a shape with text on a drawing canvas in a table cell.
+// Without fix the text of the shape becomes part of the paragraph of the 
table cell.
+loadFromURL(u"WPC_tdf158348_shape_text_in_table_cell.docx");
+
+uno::Reference 
xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY);
+
+// Get the shape and make sure it has text.
+uno::Reference xCanvas(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xShapeProps(xCanvas->getByIndex(1), 
uno::UNO_QUERY);
+uno::Reference xTextFrame;
+xShapeProps->getPropertyValue(u"TextBoxContent"_ustr) >>= xTextFrame;
+CPPUNIT_ASSERT(xTextFrame.is());
+// The string was empty without fix.
+CPPUNIT_ASSERT_EQUAL(u"Inside shape"_ustr, 
xTextFrame->getText()->getString());
+
+// Get the table and make sure the cell has only its own text.
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTextTable(
+xTablesSupplier->getTextTables()->getByName(u"Table1"_ustr), 
uno::UNO_QUERY);
+uno::Reference xCellA1(xTextTable->getCellByName("A1"), 
uno::UNO_QUERY);
+// The string had started with "Inside shape" without fix.
+CPPUNIT_ASSERT(xCellA1->getString().startsWith("Inside table"));
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 30ed3a70e63c..cbc75c14070a 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1840,8 +1840,8 @@ void OOXMLFastContextHandlerShape::sendShape( Token_t 
Element )
 
 bool OOXMLFastContextHandlerShape::isDMLGroupShape() const
 {
-return (mrShapeContext->getFullWPGSupport()
-   && (mrShapeContext->isWordProcessingGroupShape() || 
mrShapeContext->isWordprocessingCanvas()));
+return (mrShapeContext->getFullWPGSupport() && 
mrShapeContext->isWordProcessingGroupShape())
+|| mrShapeContext->isWordprocessingCanvas();
 };
 
 void OOXMLFastContextHandlerShape::lcl_endFastElement


[Libreoffice-commits] core.git: oox/qa writerfilter/source

2019-11-26 Thread Miklos Vajna (via logerrit)
 oox/qa/unit/mathml.cxx |5 -
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 --
 2 files changed, 7 deletions(-)

New commits:
commit 87156783e5bc89709a1933efbbde82817715d5dc
Author: Miklos Vajna 
AuthorDate: Tue Nov 26 16:05:38 2019 +0100
Commit: Miklos Vajna 
CommitDate: Tue Nov 26 18:56:47 2019 +0100

Remove some unused includes

Change-Id: Ia24c806f227570f7a000e85eece75c9d02d25a4b
Reviewed-on: https://gerrit.libreoffice.org/83782
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/oox/qa/unit/mathml.cxx b/oox/qa/unit/mathml.cxx
index 0352c7a84ec4..3a5f928dad06 100644
--- a/oox/qa/unit/mathml.cxx
+++ b/oox/qa/unit/mathml.cxx
@@ -11,14 +11,9 @@
 #include 
 
 #include 
-#include 
 #include 
 
-#include 
 #include 
-#include 
-#include 
-#include 
 
 using namespace ::com::sun::star;
 
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e4fdc1d755eb..af97169166ed 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -10,13 +10,11 @@
 #include "rtfdocumentimpl.hxx"
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits