From 35657f636580227e364ccf089ef434d3dbeee6ba Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 28 Aug 2013 15:28:38 +0200 Subject: docx export: simplify pgBorders handling, and fix pgSz bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a document had page borders, pgSz was wrongly exported as a child of pgBorders. Change-Id: Ibd47d3efd387f942274c0162fd0cbc46662348d5 Reviewed-on: https://gerrit.libreoffice.org/5664 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/source/filter/ww8/docxattributeoutput.cxx | 32 +++++++++++++--------------- sw/source/filter/ww8/wrtw8sty.cxx | 3 +-- 2 files changed, 16 insertions(+), 19 deletions(-) (limited to 'sw') diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 2cf7058cabe3..342bd750215e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3230,10 +3230,22 @@ void DocxAttributeOutput::SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmF FSNS( XML_w, XML_offsetFrom ), bExportDistanceFromPageEdge ? "page" : "text", FSEND ); - m_pSerializer->mark(); + OutputBorderOptions aOutputBorderOptions = lcl_getBoxBorderOptions(); + + // Check if the distance is larger than 31 points + aOutputBorderOptions.bCheckDistanceSize = true; + + // Check if there is a shadow item + const SfxPoolItem* pItem = GetExport().HasItem( RES_SHADOW ); + if ( pItem ) + { + const SvxShadowItem* pShadowItem = (const SvxShadowItem*)pItem; + aOutputBorderOptions.aShadowLocation = pShadowItem->GetLocation(); + } + + impl_borders( m_pSerializer, rBox, aOutputBorderOptions, &m_pageMargins ); m_pSerializer->endElementNS( XML_w, XML_pgBorders ); - m_pSerializer->mark(); } } @@ -5177,21 +5189,7 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox ) aOutputBorderOptions.aShadowLocation = pShadowItem->GetLocation(); } - - if ( m_bOpenedSectPr && GetWritingHeaderFooter() == false) - { - // Inside a section - - // Check if the distance is larger than 31 points - aOutputBorderOptions.bCheckDistanceSize = true; - - impl_borders( m_pSerializer, rBox, aOutputBorderOptions, &m_pageMargins ); - - // Special handling for pgBorder - m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND ); - m_pSerializer->mergeTopMarks( ); - } - else + if ( !m_bOpenedSectPr || GetWritingHeaderFooter()) { // Not inside a section diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 9f29d9132281..573e98a1bdcb 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1664,8 +1664,6 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt const SfxItemSet* pOldI = pISet; - AttrOutput().SectionPageBorders( pPdFmt, pPdFirstPgFmt ); - const SfxPoolItem* pItem; if ( titlePage && SFX_ITEM_SET == pPdFirstPgFmt->GetItemState( RES_PAPER_BIN, true, &pItem ) ) @@ -1700,6 +1698,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt pISet = &pPdFmt->GetAttrSet(); AttrOutput().OutputStyleItemSet( pPdFmt->GetAttrSet(), true, false ); + AttrOutput().SectionPageBorders( pPdFmt, pPdFirstPgFmt ); pISet = pOldI; // then the rest of the settings from PageDesc -- cgit