summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorLuke Deller <luke@deller.id.au>2013-02-10 02:19:46 +1100
committerTor Lillqvist <tml@iki.fi>2013-02-11 10:26:34 +0000
commit532e25f8b0ef1daeca1f9f84c7084812b72841d5 (patch)
treef09399e895cb8d80b6c40e7ce89a4c7a471d11a2 /sw
parentfdo#55430 switches off text mode when clicking an other object. (diff)
downloadcore-532e25f8b0ef1daeca1f9f84c7084812b72841d5.tar.gz
core-532e25f8b0ef1daeca1f9f84c7084812b72841d5.zip
export different first page header/footer to doc/docx
Change-Id: Iba39bf12c2419bb480e91ccb45851ec869c40e01 Reviewed-on: https://gerrit.libreoffice.org/2062 Reviewed-by: Tor Lillqvist <tml@iki.fi> Tested-by: Tor Lillqvist <tml@iki.fi>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx33
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx2
2 files changed, 18 insertions, 17 deletions
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index f002c1ff4226..b0e4e9242f8a 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1525,7 +1525,6 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
sal_uInt8 nBreakCode = 2; // default neue Seite beginnen
bool bOutPgDscSet = true, bLeftRightPgChain = false;
const SwFrmFmt* pPdFmt = &pPd->GetMaster();
- const SwFrmFmt* pPdFirstPgFmt = pPdFmt;
if ( rSepInfo.pSectionFmt )
{
// ist pSectionFmt gesetzt, dann gab es einen SectionNode
@@ -1584,7 +1583,15 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
}
}
- bool titlePage = false;
+ // Libreoffice 4.0 introduces support for page styles (SwPageDesc) with
+ // a different header/footer for the first page. The same effect can be
+ // achieved by chaining two page styles together (SwPageDesc::GetFollow)
+ // which are identical except for header/footer.
+ // The latter method is still used by the doc/docx import filter.
+ // In both of these cases, we emit a single Word section with different
+ // first page header/footer.
+ const SwFrmFmt* pPdFirstPgFmt = &pPd->GetFirst();
+ bool titlePage = !pPd->IsFirstShared();
if ( bOutPgDscSet )
{
// es ist ein Follow gesetzt und dieser zeigt nicht auf sich
@@ -1600,7 +1607,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
{
const SwPageDesc *pFollow = pPd->GetFollow();
const SwFrmFmt& rFollowFmt = pFollow->GetMaster();
- if ( sw::util::IsPlausableSingleWordSection( *pPdFmt, rFollowFmt ) )
+ if ( sw::util::IsPlausableSingleWordSection( *pPdFirstPgFmt, rFollowFmt ) )
{
if (rSepInfo.pPDNd)
pPdFirstPgFmt = pPd->GetPageFmtOfNode( *rSepInfo.pPDNd );
@@ -1629,7 +1636,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
AttrOutput().SectionPageBorders( pPdFmt, pPdFirstPgFmt );
const SfxPoolItem* pItem;
- if ( pPdFmt != pPdFirstPgFmt && SFX_ITEM_SET ==
+ if ( titlePage && SFX_ITEM_SET ==
pPdFirstPgFmt->GetItemState( RES_PAPER_BIN, true, &pItem ) )
{
pISet = &pPdFirstPgFmt->GetAttrSet();
@@ -1703,20 +1710,14 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_HEADER_FIRST );
MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_FOOTER_FIRST );
}
- // write other headers/footers only if it's not on the first page - I'm not quite sure
- // this is technically correct, but it avoids first-page headers/footers
- // extending to all pages (bnc#654230)
- if( !titlePage || pPdFmt != pPdFirstPgFmt )
- {
- MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFmt, WW8_HEADER_ODD );
- MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFmt, WW8_FOOTER_ODD );
+ MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFmt, WW8_HEADER_ODD );
+ MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFmt, WW8_FOOTER_ODD );
- if ( !pPd->IsHeaderShared() || bLeftRightPgChain )
- MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdLeftFmt, WW8_HEADER_EVEN );
+ if ( !pPd->IsHeaderShared() || bLeftRightPgChain )
+ MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdLeftFmt, WW8_HEADER_EVEN );
- if ( !pPd->IsFooterShared() || bLeftRightPgChain )
- MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFmt, WW8_FOOTER_EVEN );
- }
+ if ( !pPd->IsFooterShared() || bLeftRightPgChain )
+ MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFmt, WW8_FOOTER_EVEN );
AttrOutput().SectionWW6HeaderFooterFlags( nHeadFootFlags );
}
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 003bde16b230..096f012af09e 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -364,7 +364,7 @@ bool MSWordExportBase::SetAktPageDescFromNode(const SwNode &rNd)
bNewPageDesc = true;
else
{
- const SwFrmFmt& rTitleFmt = pAktPageDesc->GetMaster();
+ const SwFrmFmt& rTitleFmt = pAktPageDesc->GetFirst();
const SwFrmFmt& rFollowFmt = pCurrent->GetMaster();
bNewPageDesc = !IsPlausableSingleWordSection(rTitleFmt,