[PATCH libreoffice-4-0] fdo#62147: sw: ODF import: apply styles in cells with string...

Michael Stahl (via Code Review) gerrit at gerrit.libreoffice.org
Tue Apr 23 04:49:50 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3575

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/75/3575/1

fdo#62147: sw: ODF import: apply styles in cells with string-value

Apply the table-cell-style to paragraphs inside the table cell
for cells with value-type="string" and office:string-value attribute.
This should complete commit 1b5839f49c07beb6fbde6c7370a5636d22f9ab77.

Change-Id: Ief34de1e7c5087906ea597ce3ca96e020f6eebe6
(cherry picked from commit 84217e299724b8ee80dff63cb561b4bae0f44835)
---
M sw/source/filter/xml/xmltbli.cxx
M sw/source/filter/xml/xmltbli.hxx
2 files changed, 17 insertions(+), 4 deletions(-)



diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 9ffba48..6cd2cdc 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -589,8 +589,11 @@
 
 inline void SwXMLTableCellContext_Impl::_InsertContent()
 {
+    SwStartNode const*const pStartNode( GetTable()->InsertTableSection(0,
+            (m_bHasStringValue && m_bValueTypeIsString &&
+             !aStyleName.isEmpty()) ? & aStyleName : 0) );
     GetTable()->InsertCell( aStyleName, nRowSpan, nColSpan,
-                            GetTable()->InsertTableSection(),
+                            pStartNode,
                             mXmlId,
                             NULL, bProtect, &sFormula, bHasValue, fValue,
             (m_bHasStringValue && m_bValueTypeIsString) ? &m_StringValue : 0);
@@ -2883,12 +2886,14 @@
 }
 
 const SwStartNode *SwXMLTableContext::InsertTableSection(
-                                            const SwStartNode *pPrevSttNd )
+        const SwStartNode *const pPrevSttNd,
+        OUString const*const pStringValueStyleName)
 {
     // The topmost table is the only table that maintains the two members
     // pBox1 and bFirstSection.
     if( xParentTable.Is() )
-        return ((SwXMLTableContext *)&xParentTable)->InsertTableSection( pPrevSttNd );
+        return static_cast<SwXMLTableContext *>(&xParentTable)
+                    ->InsertTableSection(pPrevSttNd, pStringValueStyleName);
 
     const SwStartNode *pStNd;
     Reference<XUnoTunnel> xCrsrTunnel( GetImport().GetTextImport()->GetCursor(),
@@ -2943,6 +2948,13 @@
         }
     }
 
+    if (pStringValueStyleName)
+    {   // fdo#62147: apply style to paragraph on string-value cell
+        GetImport().GetTextImport()->SetStyleAndAttrs( GetImport(),
+            GetImport().GetTextImport()->GetCursor(), *pStringValueStyleName,
+            true, false, -1, false); // parameters same as sCellParaStyleName
+    }
+
     return pStNd;
 }
 
diff --git a/sw/source/filter/xml/xmltbli.hxx b/sw/source/filter/xml/xmltbli.hxx
index e9854cc..cfd886b 100644
--- a/sw/source/filter/xml/xmltbli.hxx
+++ b/sw/source/filter/xml/xmltbli.hxx
@@ -186,7 +186,8 @@
     void InsertRepRows( sal_uInt32 nCount );
     const SwXMLTableCell_Impl *GetCell( sal_uInt32 nRow, sal_uInt32 nCol ) const;
     SwXMLTableCell_Impl *GetCell( sal_uInt32 nRow, sal_uInt32 nCol );
-    const SwStartNode *InsertTableSection( const SwStartNode *pPrevSttNd=0 );
+    const SwStartNode *InsertTableSection(const SwStartNode *pPrevSttNd = 0,
+                                  OUString const* pStringValueStyleName = 0);
 
     virtual void EndElement();
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief34de1e7c5087906ea597ce3ca96e020f6eebe6
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Michael Stahl <mstahl at redhat.com>



More information about the LibreOffice mailing list