sw/qa/extras/rtfexport/data/noparaborder.rtf        |   35 ++++++++++++++++++++
 sw/qa/extras/rtfexport/rtfexport3.cxx               |   23 +++++++++++++
 sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx |    3 +
 3 files changed, 60 insertions(+), 1 deletion(-)

New commits:
commit 30385a6d670365652f7f91c034c2028664206751
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Mar 12 14:59:16 2025 +0100
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Thu Mar 13 16:42:51 2025 +0100

    tdf#164945 writerfilter: RTF import: fix erroneous default paragraph...
    
    ... properties in empty table cell.
    
    The problem is that for an empty table cell, there is a sequence of
    buffer entries SETSTYLE, PROPS, SETSTYLE, PROPS, and the 2nd PROPS
    sets a default value of the LN_CT_PrBase_pBdr SPRM, and that overwrites
    the rdrs value that was contained in the 1st PROPS.
    
    All these buffer entries originate in     ST_StyleType_character when 
buffering the character properties, then no
    paragraph properties will be generated in getProperties() for the 2nd
    PROPS.
    
    (regression from commit 6f42a2c8631bace1caa4fac0b3ea554942f1fca3)
    
    Change-Id: Iefb939d8d8dace6dc58cb665b4bd1575f09701c1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182835
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit 1a7346e7f14b54cf5d9b74798d41cff2a3a05872)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182859
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/sw/qa/extras/rtfexport/data/noparaborder.rtf 
b/sw/qa/extras/rtfexport/data/noparaborder.rtf
new file mode 100644
index 000000000000..4c6322ffa88e
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/noparaborder.rtf
@@ -0,0 +1,35 @@
+{ 
tf1deflang1025nsinsicpg1252\uc1deff0\deff0\stshfdbch31505\stshfloch46\stshfhich46\stshfbi0\deflang1031\deflangfe1041
     hemelang1031    hemelangfe1041  hemelangcs0
+{onttbl{0bidi romancharset0prq2{\*\panose 02020603050405020304}Times New 
Roman{\*alt Arial};}
+{35bidi swisscharset128prq2{\*\panose 020b0400000000000000}Yu Gothic{\*
alt ?a?S?V?b?N};}
+{46bidi swisscharset0prq2{\*\panose 020b0604020202020204}Liberation Sans;}
+{dbminor31505bidi swisscharset128prq2{\*\panose 020b0400000000000000}Yu 
Gothic{\*alt ?a?S?V?b?N};}
+}
+{\*\defchp s24\kerning2\lochf46\hichf46\dbchf31505 }{\*\defpap \ql \li0 
i0\sa160\sl278\slmult1
+\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 }
oqfpromote {\stylesheet{\ql \li0 
i0\sa160\sl278\slmult1\widctlpar\wrapdefaultspalphaspnumaautodjustright 
in0\lin0\itap0  tlchcs1 f0fs24lang1025 \ltrchcs0 
+s24\lang1031\langfe1041\kerning2\loch46\hichf46\dbchf31505+        s11     
srowd   rftsWidthB3     rpaddl108       rpaddr108       rpaddfl3        
rpaddft3        rpaddfb3        rpaddfr3        blind0  blindtype3      
svertalt \ql \li0 i0\sa160\sl278\slmult1
+\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0  tlchcs1 
f0fs24lang1025 \ltrchcs0 s24\lang1031\langfe1041\kerning2\loch
46\hichf46\dbchf31505+Normal Table;}
+{\s36\q \li0 i0\widctlparrdrbrdrsrdrw10rsp20 \wrapdefaultspalphaspnum
aautodjustright in0\lin0\itap0  tlchcs1 f0fs24lang1025 \ltrchcs0 
+s24\lang1031\langfe1041\kerning2\loch46\hichf46\dbchf31505+
+\paperw11906\paperh16838\margl1417\margr1417\margt1417\margb1134\gutter0\ltrsect
 
+\deftab708\widowctrltnbjenddoc\hyphhotz425   rackmoves0      
rackformatting1\donotembedsysfont1 elyonvml0\donotembedlingdata0\grfdocevents0
alidatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0
+\showxmlerrors1
oxlattoyenxpshrtn
oultrlspc\dntblnsbdb
ospaceforul
ormshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1417\dgvorigin1417\dghshow1\dgvshow1
+\jexpandiewkind1iewscale270\pgbrdrhead\pgbrdrfoot\splytwnine
tnlytwnine\htmautsp
olnhtadjtbl\useltbalnlntblind\lytcalctblwd\lyttblrtgr\lnbrkrule
obrkwrptbl\snaptogridincellllowfieldendsel\wrppunct
+sianbrkrule
ewtblstyruls
ogrowautofit\usenormstyforlist
oindnmbrtselnbrelev
ocxsptable\indrlsweleven
oafcnsttblfelev\utinl\hwelev\spltpgpar
otcvasp
otbrkcnstfrctbl
otvatxbx\krnprsnet+{\*\wgrffmtfilter 2450}
ofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\headery708
ootery708+
+\ltrrow        rowd \irow0\irowband0\lastrow \ltrrow
+       s35     rgaph70 rleft-108       rftsWidth1      rftsWidthB3     
rautofit1       rpaddl108       rpaddr108       rpaddfl3        rpaddft3        
rpaddfb3        rpaddfr3        bllkhdrrows     bllkhdrcols     bllknocolband   
blind0  blindtype3 +rdrtbl +\s36\qc \li0 
i0\widctlpar\intblrdrbrdrsrdrw10rsp20 \wrapdefaultspalphaspnum
aautodjustright in0\lin0\yts35  tlchcs1 f0fs24lang1025 \ltrchcs0 
+
s24\lang1031\langfe1041\kerning2\lochf46\hichf46\dbchf31505+\wrapdefaultspalphaspnum
aautodjustright in0\lin0\yts35 { tlchcs1 f0 \ltrchcs0 
\hichf46\dbchf31505\loch46 xxx}{ tlchcs1 f0 \ltrchcs0 +\ql \li0 
i0\sa160\sl278\slmult1\widctlpar\intbl\wrapdefaultspalphaspnum
aautodjustright in0\lin0  tlchcs1 f0fs24lang1025 \ltrchcs0 
s24\lang1031\langfe1041\kerning2\lochf46\hichf46\dbchf31505+ tlchcs1 f0 
\ltrchcs0  rowd \irow0\irowband0\lastrow \ltrrow
+       s35     rgaph70 rleft-108       rftsWidth1      rftsWidthB3     
rautofit1       rpaddl108       rpaddr108       rpaddfl3        rpaddft3        
rpaddfb3        rpaddfr3        bllkhdrrows     bllkhdrcols     bllknocolband   
blind0  blindtype3 +rdrtbl +\ql \li0 
i0\sa160\sl278\slmult1\widctlpar\wrapdefaultspalphaspnumaautodjustright 
in0\lin0\itap0 { tlchcs1 f0 \ltrchcs0 
+\par }
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx 
b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 6b97dca453aa..665d95bcf00c 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -200,6 +200,29 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf116436_tableBackground)
     verify(/*bIsExport*/ true);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf164945)
+{
+    auto verify = [this]() {
+        uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), 
uno::UNO_QUERY_THROW);
+        uno::Reference<text::XText> xA1(xTable->getCellByName(u"A1"_ustr), 
uno::UNO_QUERY_THROW);
+        auto borderA1(
+            getProperty<table::BorderLine2>(getParagraphOfText(1, xA1), 
u"BottomBorder"_ustr));
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(0), borderA1.InnerLineWidth);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(18), borderA1.OuterLineWidth);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(0), borderA1.LineDistance);
+        uno::Reference<text::XText> xB1(xTable->getCellByName(u"B1"_ustr), 
uno::UNO_QUERY_THROW);
+        auto borderB1(
+            getProperty<table::BorderLine2>(getParagraphOfText(1, xB1), 
u"BottomBorder"_ustr));
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(0), borderB1.InnerLineWidth);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(18), borderB1.OuterLineWidth);
+        CPPUNIT_ASSERT_EQUAL(sal_Int16(0), borderB1.LineDistance);
+    };
+    createSwDoc("noparaborder.rtf");
+    verify();
+    saveAndReload(mpFilter);
+    verify();
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf122589_firstSection)
 {
     auto verify = [this]() {
diff --git a/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx 
b/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx
index f1f53d626c91..2df10c35482b 100644
--- a/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx
+++ b/sw/source/writerfilter/rtftok/rtfdispatchsymbol.cxx
@@ -202,7 +202,8 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword 
nKeyword)
                 bufferProperties(m_aTableBufferStack.back(), pPValue, nullptr);
                 auto pCValue = new 
RTFValue(m_aStates.top().getCharacterAttributes(),
                                             
m_aStates.top().getCharacterSprms());
-                bufferProperties(m_aTableBufferStack.back(), pCValue, nullptr);
+                bufferProperties(m_aTableBufferStack.back(), pCValue, nullptr,
+                                 NS_ooxml::LN_Value_ST_StyleType_character);
             }
 
             RTFValue::Pointer_t pValue;

Reply via email to