summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2010-11-04 17:29:36 +0100
committerLuboš Luňák <l.lunak@suse.cz>2010-11-04 18:06:11 +0100
commit185865ab0073d8e06f338a5fd4df00641944fe97 (patch)
tree66cc88f579601ae51566df8fa99e688da3a215ef /sw
parent9e2d9edb05e0793bd32a84cde0a18dfd6fe0adde (diff)
setup xml namespaces also for footers and headers (bnc#581954)
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/docxexport.cxx30
-rw-r--r--sw/source/filter/ww8/docxexport.hxx6
2 files changed, 20 insertions, 16 deletions
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index c836cd15d2..146f123859 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -63,6 +63,7 @@
#include <rtl/ustrbuf.hxx>
#include <vcl/font.hxx>
+using namespace sax_fastparser;
using namespace ::comphelper;
using namespace ::com::sun::star;
@@ -552,9 +553,7 @@ void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char*
pFS = m_pFilter->openFragmentStreamWithSerializer( OUStringBuffer().appendAscii( "word/" ).append( aName ).makeStringAndClear(),
S( "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" ) );
- pFS->startElementNS( XML_w, XML_hdr,
- FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
- FSEND );
+ pFS->startElementNS( XML_w, XML_hdr, MainXmlNamespaces( pFS ));
}
else
{
@@ -567,9 +566,7 @@ void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char*
pFS = m_pFilter->openFragmentStreamWithSerializer( OUStringBuffer().appendAscii( "word/" ).append( aName ).makeStringAndClear(),
S( "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" ) );
- pFS->startElementNS( XML_w, XML_ftr,
- FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
- FSEND );
+ pFS->startElementNS( XML_w, XML_ftr, MainXmlNamespaces( pFS ));
}
// switch the serializer to redirect the output to word/styles.xml
@@ -651,14 +648,7 @@ VMLExport& DocxExport::VMLExporter()
void DocxExport::WriteMainText()
{
// setup the namespaces
- m_pDocumentFS->startElementNS( XML_w, XML_document,
- FSNS( XML_xmlns, XML_o ), "urn:schemas-microsoft-com:office:office",
- FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
- FSNS( XML_xmlns, XML_v ), "urn:schemas-microsoft-com:vml",
- FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
- FSNS( XML_xmlns, XML_w10 ), "urn:schemas-microsoft-com:office:word",
- FSNS( XML_xmlns, XML_wp ), "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
- FSEND );
+ m_pDocumentFS->startElementNS( XML_w, XML_document, MainXmlNamespaces( m_pDocumentFS ));
// body
m_pDocumentFS->startElementNS( XML_w, XML_body, FSEND );
@@ -678,6 +668,18 @@ void DocxExport::WriteMainText()
m_pDocumentFS->endElementNS( XML_w, XML_document );
}
+XFastAttributeListRef DocxExport::MainXmlNamespaces( FSHelperPtr serializer )
+{
+ FastAttributeList* pAttr = serializer->createAttrList();
+ pAttr->add( FSNS( XML_xmlns, XML_o ), "urn:schemas-microsoft-com:office:office" );
+ pAttr->add( FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships" );
+ pAttr->add( FSNS( XML_xmlns, XML_v ), "urn:schemas-microsoft-com:vml" );
+ pAttr->add( FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main" );
+ pAttr->add( FSNS( XML_xmlns, XML_w10 ), "urn:schemas-microsoft-com:office:word" );
+ pAttr->add( FSNS( XML_xmlns, XML_wp ), "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" );
+ return XFastAttributeListRef( pAttr );
+}
+
DocxExport::DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam )
: MSWordExportBase( pDocument, pCurrentPam, pOriginalPam ),
m_pFilter( pFilter ),
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 81d2a02385..2a7fcd024a 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -33,6 +33,7 @@
#include "wrtww8.hxx"
#include <sax/fshelper.hxx>
+#include <sax/fastattribs.hxx>
#include <rtl/ustring.hxx>
#include <cstdio>
@@ -157,8 +158,6 @@ protected:
virtual void OutputLinkedOLE( const rtl::OUString& );
-
-
virtual void AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, ULONG nLnNum );
virtual void SectionBreaksAndFrames( const SwTxtNode& /*rNode*/ ) {}
@@ -188,6 +187,9 @@ private:
/// Write docProps/core.xml
void WriteProperties();
+ /// All xml namespaces to be used at the top of any text .xml file (main doc, headers, footers,...)
+ sax_fastparser::XFastAttributeListRef MainXmlNamespaces( sax_fastparser::FSHelperPtr serializer );
+
public:
/// FIXME this is temporary, remotely reminding the method of the same
/// name in WW8Export.