[Libreoffice-commits] .: 2 commits - sw/source
Lubos Lunak
llunak at kemper.freedesktop.org
Wed May 25 07:13:17 PDT 2011
sw/source/filter/ww8/attributeoutputbase.hxx | 3 +
sw/source/filter/ww8/docxattributeoutput.cxx | 58 +++++++++++++++++++++++++++
sw/source/filter/ww8/docxattributeoutput.hxx | 5 ++
sw/source/filter/ww8/docxexport.cxx | 49 ----------------------
sw/source/filter/ww8/wrtw8sty.cxx | 2
5 files changed, 70 insertions(+), 47 deletions(-)
New commits:
commit 5c862ab500c0febc4289ad638f26b3509cc6d9ae
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Wed May 25 16:04:57 2011 +0200
write special footnote/endnote list (17.11.3/8)
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index bbaaabb..2ba5ffd 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3406,6 +3406,8 @@ void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes )
m_pSerializer->endElementNS( XML_w, XML_p );
m_pSerializer->endElementNS( XML_w, nItem );
+ // if new special ones are added, update also WriteFootnoteEndnotePr()
+
// footnotes/endnotes themselves
for ( FootnotesVector::const_iterator i = rVector.begin(); i != rVector.end(); ++i, ++nIndex )
{
@@ -3428,7 +3430,8 @@ void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes )
}
-void DocxAttributeOutput::WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr fs, int tag, const SwEndNoteInfo& info )
+void DocxAttributeOutput::WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr fs, int tag,
+ const SwEndNoteInfo& info, int listtag )
{
fs->startElementNS( XML_w, tag, FSEND );
const char* fmt = NULL;
@@ -3467,15 +3470,20 @@ void DocxAttributeOutput::WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr
if( info.nFtnOffset != 0 )
fs->singleElementNS( XML_w, XML_numStart, FSNS( XML_w, XML_val ),
rtl::OString::valueOf( info.nFtnOffset + 1 ).getStr(), FSEND );
+ if( listtag != 0 ) // we are writting to settings.xml, write also special footnote/endnote list
+ { // there are currently only two hardcoded ones ( see FootnotesEndnotes())
+ fs->singleElementNS( XML_w, listtag, FSNS( XML_w, XML_id ), "0", FSEND );
+ fs->singleElementNS( XML_w, listtag, FSNS( XML_w, XML_id ), "1", FSEND );
+ }
fs->endElementNS( XML_w, tag );
}
void DocxAttributeOutput::SectFootnoteEndnotePr()
{
if( HasFootnotes())
- WriteFootnoteEndnotePr( m_pSerializer, XML_footnotePr, m_rExport.pDoc->GetFtnInfo());
+ WriteFootnoteEndnotePr( m_pSerializer, XML_footnotePr, m_rExport.pDoc->GetFtnInfo(), 0 );
if( HasEndnotes())
- WriteFootnoteEndnotePr( m_pSerializer, XML_endnotePr, m_rExport.pDoc->GetEndNoteInfo());
+ WriteFootnoteEndnotePr( m_pSerializer, XML_endnotePr, m_rExport.pDoc->GetEndNoteInfo(), 0 );
}
void DocxAttributeOutput::ParaLineSpacing_Impl( short nSpace, short nMulti )
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index cff7054..5554d1d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -608,7 +608,7 @@ public:
void FootnotesEndnotes( bool bFootnotes );
/// writes the footnotePr/endnotePr (depending on tag) section
- void WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr fs, int tag, const SwEndNoteInfo& info );
+ void WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr fs, int tag, const SwEndNoteInfo& info, int listtag );
};
#endif // _DOCXATTRIBUTEOUTPUT_HXX_
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 81cf7a8..5277af4 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -669,9 +669,9 @@ void DocxExport::WriteSettings()
pFS->singleElementNS( XML_w, XML_evenAndOddHeaders, FSEND );
if( m_pAttrOutput->HasFootnotes())
- m_pAttrOutput->WriteFootnoteEndnotePr( pFS, XML_footnotePr, pDoc->GetFtnInfo());
+ m_pAttrOutput->WriteFootnoteEndnotePr( pFS, XML_footnotePr, pDoc->GetFtnInfo(), XML_footnote );
if( m_pAttrOutput->HasEndnotes())
- m_pAttrOutput->WriteFootnoteEndnotePr( pFS, XML_endnotePr, pDoc->GetEndNoteInfo());
+ m_pAttrOutput->WriteFootnoteEndnotePr( pFS, XML_endnotePr, pDoc->GetEndNoteInfo(), XML_endnote );
pFS->endElementNS( XML_w, XML_settings );
}
commit a16cfa68f009b5d7a159bf2972e9f6aeb09094eb
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Wed May 25 15:53:45 2011 +0200
write footnotePr/endnotePr both to settings.xml and sectPr
apparently neither msof2k7 nor LO can actually use the one
written to settings.xml
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 25fc965..c002488 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -173,6 +173,9 @@ public:
/// docx requires footnoteRef/endnoteRef tag at the beginning of each of them
virtual void FootnoteEndnoteRefTag() {};
+ /// for docx footnotePr/endnotePr inside sectPr
+ virtual void SectFootnoteEndnotePr() {};
+
/// Output text (inside a run).
virtual void RunText( const String& rText, rtl_TextEncoding eCharSet ) = 0;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index d3cd2b3..bbaaabb 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3428,6 +3428,56 @@ void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes )
}
+void DocxAttributeOutput::WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr fs, int tag, const SwEndNoteInfo& info )
+{
+ fs->startElementNS( XML_w, tag, FSEND );
+ const char* fmt = NULL;
+ switch( info.aFmt.GetNumberingType())
+ {
+ case SVX_NUM_CHARS_UPPER_LETTER_N: // fall through, map to upper letters
+ case SVX_NUM_CHARS_UPPER_LETTER:
+ fmt = "upperLetter";
+ break;
+ case SVX_NUM_CHARS_LOWER_LETTER_N: // fall through, map to lower letters
+ case SVX_NUM_CHARS_LOWER_LETTER:
+ fmt = "lowerLetter";
+ break;
+ case SVX_NUM_ROMAN_UPPER:
+ fmt = "upperRoman";
+ break;
+ case SVX_NUM_ROMAN_LOWER:
+ fmt = "lowerRoman";
+ break;
+ case SVX_NUM_ARABIC:
+ fmt = "decimal";
+ break;
+ case SVX_NUM_NUMBER_NONE:
+ fmt = "none";
+ break;
+ case SVX_NUM_CHAR_SPECIAL:
+ fmt = "bullet";
+ break;
+ case SVX_NUM_PAGEDESC:
+ case SVX_NUM_BITMAP:
+ default:
+ break; // no format
+ }
+ if( fmt != NULL )
+ fs->singleElementNS( XML_w, XML_numFmt, FSNS( XML_w, XML_val ), fmt, FSEND );
+ if( info.nFtnOffset != 0 )
+ fs->singleElementNS( XML_w, XML_numStart, FSNS( XML_w, XML_val ),
+ rtl::OString::valueOf( info.nFtnOffset + 1 ).getStr(), FSEND );
+ fs->endElementNS( XML_w, tag );
+}
+
+void DocxAttributeOutput::SectFootnoteEndnotePr()
+{
+ if( HasFootnotes())
+ WriteFootnoteEndnotePr( m_pSerializer, XML_footnotePr, m_rExport.pDoc->GetFtnInfo());
+ if( HasEndnotes())
+ WriteFootnoteEndnotePr( m_pSerializer, XML_endnotePr, m_rExport.pDoc->GetEndNoteInfo());
+}
+
void DocxAttributeOutput::ParaLineSpacing_Impl( short nSpace, short nMulti )
{
if ( !m_pParagraphSpacingAttrList )
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 9fa0f8e..cff7054 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -102,6 +102,8 @@ public:
virtual void FootnoteEndnoteRefTag();
+ virtual void SectFootnoteEndnotePr();
+
/// Output text (inside a run).
virtual void RunText( const String& rText, rtl_TextEncoding eCharSet = RTL_TEXTENCODING_UTF8 );
@@ -604,6 +606,9 @@ public:
/// Output the content of the footnotes.xml resp. endnotes.xml
void FootnotesEndnotes( bool bFootnotes );
+
+ /// writes the footnotePr/endnotePr (depending on tag) section
+ void WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr fs, int tag, const SwEndNoteInfo& info );
};
#endif // _DOCXATTRIBUTEOUTPUT_HXX_
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 00bb541..81cf7a8 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -648,33 +648,6 @@ void DocxExport::WriteProperties( )
m_pFilter->exportDocumentProperties( xDocProps );
}
-static const char* numberingTypeToNumFmt( int type )
-{
- switch( type )
- {
- case SVX_NUM_CHARS_UPPER_LETTER_N: // fall through, map to upper letters
- case SVX_NUM_CHARS_UPPER_LETTER:
- return "upperLetter";
- case SVX_NUM_CHARS_LOWER_LETTER_N: // fall through, map to lower letters
- case SVX_NUM_CHARS_LOWER_LETTER:
- return "lowerLetter";
- case SVX_NUM_ROMAN_UPPER:
- return "upperRoman";
- case SVX_NUM_ROMAN_LOWER:
- return "lowerRoman";
- case SVX_NUM_ARABIC:
- return "decimal";
- case SVX_NUM_NUMBER_NONE:
- return "none";
- case SVX_NUM_CHAR_SPECIAL:
- return "bullet";
- case SVX_NUM_PAGEDESC:
- case SVX_NUM_BITMAP:
- default:
- return NULL;
- }
-}
-
void DocxExport::WriteSettings()
{
if( !settings.hasData() && !m_pAttrOutput->HasFootnotes() && !m_pAttrOutput->HasEndnotes())
@@ -696,27 +669,9 @@ void DocxExport::WriteSettings()
pFS->singleElementNS( XML_w, XML_evenAndOddHeaders, FSEND );
if( m_pAttrOutput->HasFootnotes())
- {
- const SwFtnInfo& ftnInfo = pDoc->GetFtnInfo();
- pFS->startElementNS( XML_w, XML_footnotePr, FSEND );
- if( const char* fmt = numberingTypeToNumFmt( ftnInfo.aFmt.GetNumberingType()))
- pFS->singleElementNS( XML_w, XML_numFmt, FSNS( XML_w, XML_val ), fmt, FSEND );
- if( ftnInfo.nFtnOffset != 0 )
- pFS->singleElementNS( XML_w, XML_numStart, FSNS( XML_w, XML_val ),
- rtl::OString::valueOf( ftnInfo.nFtnOffset + 1 ).getStr(), FSEND );
- pFS->endElementNS( XML_w, XML_footnotePr );
- }
+ m_pAttrOutput->WriteFootnoteEndnotePr( pFS, XML_footnotePr, pDoc->GetFtnInfo());
if( m_pAttrOutput->HasEndnotes())
- {
- const SwEndNoteInfo& endnoteInfo = pDoc->GetEndNoteInfo();
- pFS->startElementNS( XML_w, XML_endnotePr, FSEND );
- if( const char* fmt = numberingTypeToNumFmt( endnoteInfo.aFmt.GetNumberingType()))
- pFS->singleElementNS( XML_w, XML_numFmt, FSNS( XML_w, XML_val ), fmt, FSEND );
- if( endnoteInfo.nFtnOffset != 0 )
- pFS->singleElementNS( XML_w, XML_numStart, FSNS( XML_w, XML_val ),
- rtl::OString::valueOf( endnoteInfo.nFtnOffset + 1 ).getStr(), FSEND );
- pFS->endElementNS( XML_w, XML_endnotePr );
- }
+ m_pAttrOutput->WriteFootnoteEndnotePr( pFS, XML_endnotePr, pDoc->GetEndNoteInfo());
pFS->endElementNS( XML_w, XML_settings );
}
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 947b438..d297a9c 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1521,6 +1521,8 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
AttrOutput().StartSection();
+ AttrOutput().SectFootnoteEndnotePr();
+
// forms
AttrOutput().SectionFormProtection( rSepInfo.IsProtected() );
More information about the Libreoffice-commits
mailing list