summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-05-31 12:38:32 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-05-31 23:35:52 +0200
commit379ada9ed447a71bee2ffd81dbd09214ce3dcd8d (patch)
tree73bbf515c21d69a636af87ab115fd478e19de259 /sw
parent1348dde6cea4bd3f436ee7657fa51b580ce50787 (diff)
Simplify and optimize (no need to count footnotes/endnotes)
Change-Id: I4b539ec929e62a3d65c8a3fa2e9eb7794abf2a37
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/html/css1atr.cxx27
1 files changed, 18 insertions, 9 deletions
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index c9c1061373d8..574b4b234c05 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -123,7 +123,7 @@ static Writer& OutCSS1_SwPageDesc( Writer& rWrt, const SwPageDesc& rFormat,
sal_uInt16 nRefPoolId, bool bExtRef,
bool bPseudo=true );
static Writer& OutCSS1_SwFootnoteInfo( Writer& rWrt, const SwEndNoteInfo& rInfo,
- SwDoc *pDoc, sal_uInt16 nNotes, bool bEndNote );
+ SwDoc *pDoc, bool bHasNotes, bool bEndNote );
static void OutCSS1_SwFormatDropAttrs( SwHTMLWriter& rHWrt,
const SwFormatDrop& rDrop,
const SfxItemSet *pCharFormatItemSet=0 );
@@ -622,17 +622,26 @@ void SwHTMLWriter::OutStyleSheet( const SwPageDesc& rPageDesc, bool bUsed )
OutCSS1_SwFormat( *this, *pCFormat, &pDoc->getIDocumentStylePoolAccess(), pTemplate );
}
+ bool bHasEndNotes {false};
+ bool bHasFootNotes {false};
const SwFootnoteIdxs& rIdxs = pDoc->GetFootnoteIdxs();
- sal_uInt16 nEnd = 0, nFootnote = 0;
for( auto pIdx : rIdxs )
{
if( pIdx->GetFootnote().IsEndNote() )
- nEnd++;
+ {
+ bHasEndNotes = true;
+ if (bHasFootNotes)
+ break;
+ }
else
- nFootnote++;
+ {
+ bHasFootNotes = true;
+ if (bHasEndNotes)
+ break;
+ }
}
- OutCSS1_SwFootnoteInfo( *this, pDoc->GetFootnoteInfo(), pDoc, nFootnote, false );
- OutCSS1_SwFootnoteInfo( *this, pDoc->GetEndNoteInfo(), pDoc, nEnd, true );
+ OutCSS1_SwFootnoteInfo( *this, pDoc->GetFootnoteInfo(), pDoc, bHasFootNotes, false );
+ OutCSS1_SwFootnoteInfo( *this, pDoc->GetEndNoteInfo(), pDoc, bHasEndNotes, true );
if( !bFirstCSS1Rule )
{
@@ -1775,13 +1784,13 @@ static Writer& OutCSS1_SwPageDesc( Writer& rWrt, const SwPageDesc& rPageDesc,
}
static Writer& OutCSS1_SwFootnoteInfo( Writer& rWrt, const SwEndNoteInfo& rInfo,
- SwDoc *pDoc, sal_uInt16 nNotes, bool bEndNote )
+ SwDoc *pDoc, bool bHasNotes, bool bEndNote )
{
SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
OUString aSelector;
- if( nNotes > 0 )
+ if( bHasNotes )
{
aSelector = OOO_STRING_SVTOOLS_HTML_anchor "." +
( bEndNote ? OUString(OOO_STRING_SVTOOLS_HTML_sdendnote_anc)
@@ -1804,7 +1813,7 @@ static Writer& OutCSS1_SwFootnoteInfo( Writer& rWrt, const SwEndNoteInfo& rInfo,
// exported, so that Netscape displays the document correctly.
// Otherwise it is sufficient, to export the differences to the
// footnote and endnote template.
- if( nNotes == 0 && rHTMLWrt.pTemplate )
+ if( !bHasNotes && rHTMLWrt.pTemplate )
{
SwFormat *pRefFormat = rHTMLWrt.pTemplate->getIDocumentStylePoolAccess().GetCharFormatFromPool(
static_cast< sal_uInt16 >(bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE) );