[PATCH libreoffice-3-6] fdo#62288 fix RTF import of table paragraph margins

Miklos Vajna (via Code Review) gerrit at gerrit.libreoffice.org
Tue Apr 23 01:46:46 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3572

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/72/3572/1

fdo#62288 fix RTF import of table paragraph margins

Regression from 4a507f732d82c188ad81b022cbe3037951e58ac3. The problem
was that in some cases \pard can't reset all paragraph properties. The
original commit just made this keyword a noop when it occurred between
\cell and \row, but this is too much. At least margins do need
resetting.

(cherry picked from commit 24d5261f5a122e22675210445056cdf67663237b)

Change-Id: I5cbb1df72bf1211f85ef69ab64d5b46cbce5c742
---
M writerfilter/source/rtftok/rtfdocumentimpl.cxx
1 file changed, 9 insertions(+), 0 deletions(-)



diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index a7677d1..8deabf7 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1937,11 +1937,20 @@
             // \pard is allowed between \cell and \row, but in that case it should not reset the fact that we're inside a table.
             if (m_aStates.top().nCells == 0)
             {
+                // Reset everything.
                 m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms;
                 m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes;
                 if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT)
                     m_pCurrentBuffer = 0;
             }
+            else
+            {
+                // Reset only margins.
+                lcl_eraseNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_before);
+                lcl_eraseNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_after);
+                m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PDxaLeft);
+                m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PDxaRight);
+            }
             m_aStates.top().resetFrame();
             break;
         case RTF_SECTD:

-- 
To view, visit https://gerrit.libreoffice.org/3572
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5cbb1df72bf1211f85ef69ab64d5b46cbce5c742
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-3-6
Gerrit-Owner: Miklos Vajna <vmiklos at suse.cz>



More information about the LibreOffice mailing list