[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa sw/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jan 8 10:46:38 UTC 2020
sw/qa/extras/unowriter/unowriter.cxx | 35 +++++++++++++++++++++++++++++++++++
sw/source/core/unocore/unomap1.cxx | 6 +++---
2 files changed, 38 insertions(+), 3 deletions(-)
New commits:
commit fd3be6be5c9dc9a96834261c280fc291ed089835
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Jan 7 01:23:03 2020 +0300
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Wed Jan 8 11:45:42 2020 +0100
tdf#129841: fix GetTextTableCursorPropertyMap cell background values
... which were accidentally broken in 2003 in commit
eba784710e92597282a2284b56dce3a45ac38776.
Change-Id: I3dc96dff0a8935f927933bb3946528fb8ac9aed0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86315
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86330
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx
index 630a72afa6b1..faaac078bff6 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -9,6 +9,7 @@
#include <swmodeltestbase.hxx>
#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <com/sun/star/text/AutoTextContainer.hpp>
#include <com/sun/star/text/XAutoTextGroup.hpp>
@@ -762,6 +763,40 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testShapeAllowOverlap)
CPPUNIT_ASSERT(getProperty<bool>(xShapeProperties, "AllowOverlap"));
}
+CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf129841)
+{
+ // Create a new document and add a table
+ loadURL("private:factory/swriter", nullptr);
+ css::uno::Reference<css::text::XTextDocument> xTextDocument(mxComponent,
+ css::uno::UNO_QUERY_THROW);
+ css::uno::Reference<css::lang::XMultiServiceFactory> xFac(xTextDocument,
+ css::uno::UNO_QUERY_THROW);
+ css::uno::Reference<css::text::XTextTable> xTable(
+ xFac->createInstance("com.sun.star.text.TextTable"), css::uno::UNO_QUERY_THROW);
+ xTable->initialize(4, 4);
+ auto xSimpleText = xTextDocument->getText();
+ xSimpleText->insertTextContent(xSimpleText->createTextCursor(), xTable, true);
+ // Get SwXTextTableCursor
+ css::uno::Reference<css::beans::XPropertySet> xTableCursor(xTable->createCursorByCellName("A1"),
+ css::uno::UNO_QUERY_THROW);
+ css::uno::Reference<css::table::XCellRange> xTableCellRange(xTable, css::uno::UNO_QUERY_THROW);
+ // Get SwXCellRange for the same cell
+ css::uno::Reference<css::beans::XPropertySet> xCellRange(
+ xTableCellRange->getCellRangeByName("A1:A1"), css::uno::UNO_QUERY_THROW);
+ const OUString sBackColor = "BackColor";
+ // Apply background color to table cursor, and read background color from cell range
+ css::uno::Any aRefColor(sal_Int32(0x00FF0000));
+ xTableCursor->setPropertyValue(sBackColor, aRefColor);
+ css::uno::Any aColor = xCellRange->getPropertyValue(sBackColor);
+ // This failed
+ CPPUNIT_ASSERT_EQUAL(aRefColor, aColor);
+ // Now the other way round
+ aRefColor <<= sal_Int32(0x0000FF00);
+ xCellRange->setPropertyValue(sBackColor, aRefColor);
+ aColor = xTableCursor->getPropertyValue(sBackColor);
+ CPPUNIT_ASSERT_EQUAL(aRefColor, aColor);
+}
+
CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTextConvertToTableLineSpacing)
{
// Load a document which has a table with a single cell.
diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx
index 0c0e3e054bcc..7796adb8e798 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -971,13 +971,13 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetTextTableCursorProp
TABSTOPS_MAP_ENTRY
// attributes from PROPERTY_MAP_TABLE_CELL:
- { OUString(UNO_NAME_BACK_COLOR), RES_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE , MID_BACK_COLOR },
+ { OUString(UNO_NAME_BACK_COLOR), FN_UNO_TABLE_CELL_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE , MID_BACK_COLOR },
{ OUString(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_URL },
{ OUString(UNO_NAME_BACK_GRAPHIC), RES_BACKGROUND, cppu::UnoType<graphic::XGraphic>::get(), PROPERTY_NONE, MID_GRAPHIC },
{ OUString(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
- { OUString(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, cppu::UnoType<css::style::GraphicLocation>::get(), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { OUString(UNO_NAME_BACK_GRAPHIC_LOCATION), FN_UNO_TABLE_CELL_BACKGROUND, cppu::UnoType<css::style::GraphicLocation>::get(), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
{ OUString(UNO_NAME_NUMBER_FORMAT), RES_BOXATR_FORMAT, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID ,0 },
- { OUString(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE , MID_GRAPHIC_TRANSPARENT },
+ { OUString(UNO_NAME_BACK_TRANSPARENT), FN_UNO_TABLE_CELL_BACKGROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE , MID_GRAPHIC_TRANSPARENT },
{ OUString(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, cppu::UnoType<css::container::XNameContainer>::get(), PropertyAttribute::MAYBEVOID, 0 },
{ OUString(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, cppu::UnoType<css::text::XTextSection>::get(), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },
{ OUString(UNO_NAME_IS_PROTECTED), RES_PROTECT, cppu::UnoType<bool>::get(), 0, MID_PROTECT_CONTENT},
More information about the Libreoffice-commits
mailing list