sw/qa/extras/ooxmlexport/data/tdf139759_commentHighlightBackground.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx                              |   12 
++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx                            |    4 
+++
 3 files changed, 16 insertions(+)

New commits:
commit 386a9fadffa446caf40fd4f40b865c8c9432fa27
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Thu Jul 14 10:02:35 2022 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Fri Jul 15 13:41:34 2022 +0200

    tdf#139759 writerfilter: avoid exception importing w:shd in comments
    
    The unit test depends on the two previous fixes in this bug report.
    -initial load tests highlight import
    -export tests saving the character background
    -reload tests this shade import
    
    Change-Id: Iceb405841efc6814654061659e5551ac89f3c7b5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137091
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf139759_commentHighlightBackground.docx 
b/sw/qa/extras/ooxmlexport/data/tdf139759_commentHighlightBackground.docx
new file mode 100644
index 000000000000..487439a5cff8
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf139759_commentHighlightBackground.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 93ad3abf2da6..038dca7cc92b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -191,6 +191,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf114734_commentFormating, 
"tdf114734_commentForma
                                  getProperty<sal_Int16>(xParagraph, 
"ParaAdjust"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf139759_commentHighlightBackground, 
"tdf139759_commentHighlightBackground.docx")
+{
+    uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+    auto xFieldsAccess(xTextFieldsSupplier->getTextFields());
+    uno::Reference<container::XEnumeration> 
xFields(xFieldsAccess->createEnumeration());
+    uno::Reference<text::XTextField> xField(xFields->nextElement(), 
uno::UNO_QUERY);
+
+    uno::Reference<text::XText> xText = 
getProperty<uno::Reference<text::XText>>(xField, "TextRange");
+    uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText);
+    CPPUNIT_ASSERT_EQUAL(COL_YELLOW, getProperty<Color>(getRun(xParagraph, 2), 
"CharBackColor"));
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf135906)
 {
     loadAndReload("tdf135906.docx");
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 969578a4e73c..c3742cdbaa47 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1988,6 +1988,10 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
                 pProperties->resolve(*pCellColorHandler);
                 
rContext->InsertProps(pCellColorHandler->getProperties().get());
                 m_pImpl->GetTopContext()->Insert(PROP_CHAR_SHADING_MARKER, 
uno::Any(true), true, CHAR_GRAB_BAG );
+
+                // EditEng doesn't have a corresponding property for Shading 
Value, so eliminate it.
+                if (m_pImpl->IsInComments())
+                    rContext->Erase(PROP_CHAR_SHADING_VALUE);
             }
             break;
         }

Reply via email to