[Libreoffice-commits] core.git: 2 commits - sw/qa sw/source xmlhelp/source

Alexander Wilms f.alexander.wilms at gmail.com
Wed Feb 26 01:50:35 PST 2014


 sw/qa/extras/ooxmlexport/data/fdo74566.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx      |   20 ++++++++++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx  |    5 +----
 sw/source/filter/ww8/wrtww8.hxx               |    2 +-
 sw/source/filter/ww8/ww8atr.cxx               |   17 +++++++++--------
 xmlhelp/source/cxxhelp/provider/databases.cxx |    8 ++++----
 6 files changed, 35 insertions(+), 17 deletions(-)

New commits:
commit 003342bfef0812454618f860a6e171c282d92d78
Author: Alexander Wilms <f.alexander.wilms at gmail.com>
Date:   Tue Feb 25 23:14:08 2014 +0100

    Remove visual noise from xmlhelp
    
    Change-Id: Idd4d9d556d6644350d1a14b9f81f5fd0df8ee2d1
    Reviewed-on: https://gerrit.libreoffice.org/8344
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index df174a4..7b69b85 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -1509,7 +1509,7 @@ helpdatafileproxy::Hdf* DataBaseIterator::nextHdf( OUString* o_pExtensionPath, O
 
             // Later:
             //case SHARED_MODULE
-                //...
+
 
             case USER_EXTENSIONS:
             {
@@ -1624,7 +1624,7 @@ OUString KeyDataBaseFileIterator::nextDbFile( bool& o_rbExtension )
 
             // Later:
             //case SHARED_MODULE
-                //...
+
 
             case USER_EXTENSIONS:
             {
@@ -1700,7 +1700,7 @@ Reference< XHierarchicalNameAccess > JarFileIterator::nextJarFile
 
             // Later:
             //case SHARED_MODULE
-                //...
+
 
             case USER_EXTENSIONS:
             {
@@ -1824,7 +1824,7 @@ OUString IndexFolderIterator::nextIndexFolder( bool& o_rbExtension, bool& o_rbTe
 
             // Later:
             //case SHARED_MODULE
-                //...
+
 
             case USER_EXTENSIONS:
             {
commit a31fbb53dba76736b37213b98b64937f05929a67
Author: Pallavi Jadhav <pallavi.jadhav at synerzip.com>
Date:   Thu Feb 6 13:58:03 2014 +0530

    fdo#74566:DOCX: Preservation <w:br> tag for Break to Next Page
    
    	Issue :
    	'Break to Next Page' gets converted to 'Page Break Before'
             in RT.
    
    	XML diffrenece :
    	- LO exports <w:br> as <w:pageBreakBefore /> in document.xml
    	- The page break is written into wrong paragraph.
    
    	Implementation :
    	1] Removed implementation to export <w:pageBreakBefore />.
    	2] Added a check to write <w:br> in correct paragraph.
    	3] Modified code to handle SectionBreak() even if Text node
           	   has no string.
    	   It is required when DOCX contains a PageBreak with footer.
    	4] Written Export Unit Test case.
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    Reviewed on:
    	https://gerrit.libreoffice.org/7891
    
    Change-Id: I237b9c5fdd3083b441f6e81cd8442f458eccf1a0

diff --git a/sw/qa/extras/ooxmlexport/data/fdo74566.docx b/sw/qa/extras/ooxmlexport/data/fdo74566.docx
new file mode 100644
index 0000000..b197b94
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo74566.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 194b7c6..73d3393 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3641,6 +3641,26 @@ DECLARE_OOXMLEXPORT_TEST(testFooterContainHyperlink,"footer-contain-hyperlink.do
     // Check the value of Target which is http://www.google.com/.
     assertXPath(pXmlRels,"/rels:Relationships/rels:Relationship","Target","http://www.google.com/");
 }
+
+DECLARE_OOXMLEXPORT_TEST(testPageBreak,"fdo74566.docx")
+{
+    /*  Break to next page was written into wrong paragraph as <w:pageBreakBefore />.
+     *  LO was not preserving Page Break as <w:br w:type="page" />.
+     *  Now after fix , LO writes Page Break as the new paragraph and also
+     *  preserves the xml tag <w:br>.
+     */
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+
+    uno::Reference<text::XTextRange> xParagraph2 = getParagraph(2);
+    uno::Reference<text::XTextRange> xParagraph4 = getParagraph(4);
+
+    getRun(xParagraph2, 1, "First Page Second Line");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/w:br","type","page");
+    getRun(xParagraph4, 1, "Second Page First line after Page Break");
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index b27aadc..46258f9 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -399,10 +399,7 @@ void DocxAttributeOutput::SectionBreaks(const SwTxtNode& rNode)
     if ( aNextIndex.GetNode().IsTxtNode() )
     {
         const SwTxtNode* pTxtNode = static_cast< SwTxtNode* >( &aNextIndex.GetNode() );
-        // If next node has no string - it is an empty node, so no need to output the section break
-
-        if (!pTxtNode->GetTxt().isEmpty())
-            m_rExport.OutputSectionBreaks( pTxtNode->GetpSwAttrSet(), *pTxtNode, m_tableReference->m_bTableCellOpen );
+        m_rExport.OutputSectionBreaks( pTxtNode->GetpSwAttrSet(), *pTxtNode, m_tableReference->m_bTableCellOpen, pTxtNode->GetTxt().isEmpty() );
     }
     else if ( aNextIndex.GetNode().IsTableNode() )
     {
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 755e36e..fb63531 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -699,7 +699,7 @@ public:
     sal_uLong GetSectionLineNo( const SfxItemSet* pSet, const SwNode& rNd ) const;
 
     /// Start new section.
-    void OutputSectionBreaks( const SfxItemSet *pSet, const SwNode& rNd, bool isCellOpen = false);
+    void OutputSectionBreaks( const SfxItemSet *pSet, const SwNode& rNd, bool isCellOpen = false, bool isTextNodeEmpty = false);
 
     /// Write section properties.
     ///
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 7f5f64e..7178b96 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -398,7 +398,7 @@ bool MSWordExportBase::SetAktPageDescFromNode(const SwNode &rNd)
 // Es duerfen nur Funktionen gerufen werden, die nicht in den
 // Ausgabebereich pO schreiben, da dieser nur einmal fuer CHP und PAP existiert
 // und damit im falschen landen wuerden.
-void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode& rNd, bool isCellOpen)
+void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode& rNd, bool isCellOpen, bool isTextNodeEmpty)
 {
     if ( bStyDef || bOutKF || bInWriteEscher || bOutPageDescs )
         return;
@@ -419,9 +419,11 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode
     // Even if pAktPageDesc != pPageDesc ,it might be because of the different header & footer types.
     if (pAktPageDesc != pPageDesc)
     {
-        if (isCellOpen && (pAktPageDesc->GetName() != pPageDesc->GetName()))
+        if ( (isCellOpen && (pAktPageDesc->GetName() != pPageDesc->GetName())) || isTextNodeEmpty )
         {
-           // Table cell is open and page header types are different,so do not output section break.
+           // Table cell is open and page header types are different,so do not output section break OR
+           // PageBreak is present but text node has no string - it is an empty node, do not prepare
+           // new page descriptor i.e. bNewPageDesc should be false.
         }
         else
         {
@@ -486,6 +488,8 @@ void MSWordExportBase::OutputSectionBreaks( const SfxItemSet *pSet, const SwNode
                     {
                         bNewPageDesc |= SetAktPageDescFromNode( rNd );
                     }
+                    if( isTextNodeEmpty )
+                       bNewPageDesc = false;
                 }
                 if ( !bNewPageDesc )
                     AttrOutput().OutputItem( *pItem );
@@ -3643,10 +3647,6 @@ void AttributeOutputBase::FormatBreak( const SvxFmtBreakItem& rBreak )
                 // From now on(fix for #i77900#) we prefer to save a page break as
                 // paragraph attribute, this has to be done after the export of the
                 // paragraph ( => !GetExport().bBreakBefore )
-                if ( !GetExport().bBreakBefore )
-                    PageBreakBefore( true );
-                break;
-
             case SVX_BREAK_PAGE_AFTER:
             case SVX_BREAK_PAGE_BOTH:
                 nC = msword::PageBreak;
@@ -3663,7 +3663,8 @@ void AttributeOutputBase::FormatBreak( const SvxFmtBreakItem& rBreak )
                 break;
         }
 
-        if ( ( bBefore == GetExport().bBreakBefore ) && nC )
+        if ( (( bBefore != GetExport().bBreakBefore ) && ( nC == msword::PageBreak)) ||
+             (( bBefore == GetExport().bBreakBefore ) && ( nC == msword::ColumnBreak)) )
         {
             // #i76300#
             bool bFollowPageDescWritten = false;


More information about the Libreoffice-commits mailing list