docxexport.hxx (1d2dbeb0) docxexport.hxx (68128652)
1/**************************************************************
1/**************************************************************
2 *
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
19 *
20 *************************************************************/
21
22
23
24#ifndef _DOCXEXPORT_HXX_
25#define _DOCXEXPORT_HXX_
26
27#include "docxattributeoutput.hxx"

--- 11 unchanged lines hidden (view full) ---

39class SwTableNode;
40class SwTxtNode;
41class SwGrfNode;
42class SwOLENode;
43class SwSectionNode;
44class SwNumRuleTbl;
45
46namespace oox {
20 *************************************************************/
21
22
23
24#ifndef _DOCXEXPORT_HXX_
25#define _DOCXEXPORT_HXX_
26
27#include "docxattributeoutput.hxx"

--- 11 unchanged lines hidden (view full) ---

39class SwTableNode;
40class SwTxtNode;
41class SwGrfNode;
42class SwOLENode;
43class SwSectionNode;
44class SwNumRuleTbl;
45
46namespace oox {
47 namespace drawingml { class DrawingML; }
48 namespace vml { class VMLExport; }
47 namespace drawingml { class DrawingML; }
48 namespace vml { class VMLExport; }
49}
50
49}
50
51/// The class that does all the actual DOCX export-related work.
51// The class that does all the actual DOCX export-related work.
52class DocxExport : public MSWordExportBase
53{
52class DocxExport : public MSWordExportBase
53{
54 /// Pointer to the filter that owns us.
55 DocxExportFilter *m_pFilter;
54 // Pointer to the filter that owns us.
55 DocxExportFilter *m_pFilter;
56
56
57 /// Fast serializer for the document output.
58 ::sax_fastparser::FSHelperPtr m_pDocumentFS;
57 // Fast serializer for the document output.
58 ::sax_fastparser::FSHelperPtr m_pDocumentFS;
59
59
60 /// Access to the DrawingML writer.
61 oox::drawingml::DrawingML *m_pDrawingML;
60 // Access to the DrawingML writer.
61 oox::drawingml::DrawingML *m_pDrawingML;
62
62
63 /// Attribute output for document.
64 DocxAttributeOutput *m_pAttrOutput;
63 // Attribute output for document.
64 DocxAttributeOutput *m_pAttrOutput;
65
65
66 /// Sections/headers/footers
67 MSWordSections *m_pSections;
66 // Sections/headers/footers
67 MSWordSections *m_pSections;
68
68
69 /// Header counter.
70 sal_Int32 m_nHeaders;
69 // Header counter.
70 sal_Int32 m_nHeaders;
71
71
72 /// Footer counter.
73 sal_Int32 m_nFooters;
72 // Footer counter.
73 sal_Int32 m_nFooters;
74
74
75 /// Exporter of the VML shapes.
76 oox::vml::VMLExport *m_pVMLExport;
75 // Exporter of the VML shapes.
76 oox::vml::VMLExport *m_pVMLExport;
77
78public:
77
78public:
79 /// Access to the attribute output class.
80 virtual AttributeOutputBase& AttrOutput() const;
79 // Access to the attribute output class.
80 virtual AttributeOutputBase& AttrOutput() const;
81
81
82 /// Access to the sections/headers/footres.
83 virtual MSWordSections& Sections() const;
82 // Access to the sections/headers/footres.
83 virtual MSWordSections& Sections() const;
84
84
85 /// Hack, unfortunately necessary at some places for now.
86 /// FIXME remove it when possible.
87 virtual bool HackIsWW8OrHigher() const { return true; }
85 // Hack, unfortunately necessary at some places for now.
86 // FIXME remove it when possible.
87 virtual bool HackIsWW8OrHigher() const { return true; }
88
88
89 /// Guess the script (asian/western).
90 virtual bool CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich );
89 // Guess the script (asian/western).
90 virtual bool CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich );
91
91
92 virtual void AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen );
92 virtual void AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen );
93
93
94 virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false );
94 virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false );
95
95
96 /// Returns the relationd id
97 rtl::OString AddRelation( const rtl::OUString& rType, const rtl::OUString& rTarget, const rtl::OUString& rMode );
96 // Returns the relationd id
97 rtl::OString AddRelation( const rtl::OUString& rType, const rtl::OUString& rTarget, const rtl::OUString& rMode );
98
98
99 virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t()*/ ) { /* FIXME no-op for docx, most probably should not even be in MSWordExportBase */ }
100 virtual void WriteChar( sal_Unicode ) { /* FIXME */ fprintf( stderr, "HACK! WriteChar() has nothing to do for docx.\n" ); }
99 virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t()*/ ) { /* FIXME no-op for docx, most probably should not even be in MSWordExportBase */ }
100 virtual void WriteChar( sal_Unicode ) { /* FIXME */ fprintf( stderr, "HACK! WriteChar() has nothing to do for docx.\n" ); }
101
101
102 /// Return value indicates if an inherited outline numbering is suppressed.
103 virtual bool DisallowInheritingOutlineNumbering( const SwFmt &rFmt );
102 // Return value indicates if an inherited outline numbering is suppressed.
103 virtual bool DisallowInheritingOutlineNumbering( const SwFmt &rFmt );
104
104
105 /// Output the actual headers and footers.
106 virtual void WriteHeadersFooters( sal_uInt8 nHeadFootFlags,
107 const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt );
105 // Output the actual headers and footers.
106 virtual void WriteHeadersFooters( sal_uInt8 nHeadFootFlags,
107 const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt );
108
108
109 /// Write the field
110 virtual void OutputField( const SwField* pFld, ww::eField eFldType,
111 const String& rFldCmd, sal_uInt8 nMode = nsFieldFlags::WRITEFIELD_ALL );
109 // Write the field
110 virtual void OutputField( const SwField* pFld, ww::eField eFldType,
111 const String& rFldCmd, sal_uInt8 nMode = nsFieldFlags::WRITEFIELD_ALL );
112
112
113 /// Write the data of the form field
114 virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark );
115
116 virtual void DoComboBox(const rtl::OUString &rName,
117 const rtl::OUString &rHelp,
118 const rtl::OUString &ToolTip,
119 const rtl::OUString &rSelected,
120 com::sun::star::uno::Sequence<rtl::OUString> &rListItems);
113 // Write the data of the form field
114 virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark );
121
115
122 virtual void DoFormText(const SwInputField * pFld);
123
124 virtual sal_uLong ReplaceCr( sal_uInt8 nChar );
116 virtual void DoComboBox(const rtl::OUString &rName,
117 const rtl::OUString &rHelp,
118 const rtl::OUString &ToolTip,
119 const rtl::OUString &rSelected,
120 com::sun::star::uno::Sequence<rtl::OUString> &rListItems);
125
121
122 virtual void DoFormText(const SwInputField * pFld);
123
124 virtual sal_uLong ReplaceCr( sal_uInt8 nChar );
125
126protected:
126protected:
127 /// Format-dependant part of the actual export.
128 virtual void ExportDocument_Impl();
127 // Format-dependent part of the actual export.
128 virtual void ExportDocument_Impl();
129
129
130 /// Output page/section breaks
131 virtual void OutputPageSectionBreaks( const SwTxtNode& );
132
133 /// Output SwEndNode
134 virtual void OutputEndNode( const SwEndNode& );
130 // Output page/section breaks
131 virtual void OutputPageSectionBreaks( const SwTxtNode& );
135
132
136 /// Output SwTableNode
137 virtual void OutputTableNode( const SwTableNode& );
133 // Output SwEndNode
134 virtual void OutputEndNode( const SwEndNode& );
138
135
139 /// Output SwGrfNode
140 virtual void OutputGrfNode( const SwGrfNode& );
136 // Output SwTableNode
137 virtual void OutputTableNode( const SwTableNode& );
141
138
142 /// Output SwOLENode
143 virtual void OutputOLENode( const SwOLENode& );
139 // Output SwGrfNode
140 virtual void OutputGrfNode( const SwGrfNode& );
144
141
142 // Output SwOLENode
143 virtual void OutputOLENode( const SwOLENode& );
145
144
146 virtual void AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, sal_uLong nLnNum );
147
145
148 virtual void SectionBreaksAndFrames( const SwTxtNode& rNode ) {}
146 virtual void AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, sal_uLong nLnNum );
149
147
150 /// Get ready for a new section.
151 virtual void PrepareNewPageDesc( const SfxItemSet* pSet,
152 const SwNode& rNd,
153 const SwFmtPageDesc* pNewPgDescFmt = 0,
154 const SwPageDesc* pNewPgDesc = 0 );
148 virtual void SectionBreaksAndFrames( const SwTxtNode& rNode ) {}
155
149
150 // Get ready for a new section.
151 virtual void PrepareNewPageDesc( const SfxItemSet* pSet,
152 const SwNode& rNd,
153 const SwFmtPageDesc* pNewPgDescFmt = 0,
154 const SwPageDesc* pNewPgDesc = 0 );
155
156private:
156private:
157 /// Setup pStyles and write styles.xml
158 void InitStyles();
157 // Setup pStyles and write styles.xml
158 void InitStyles();
159
159
160 /// Write footnotes.xml and endnotes.xml.
161 void WriteFootnotesEndnotes();
160 // Write footnotes.xml and endnotes.xml.
161 void WriteFootnotesEndnotes();
162
162
163 /// Write the numbering table.
164 virtual void WriteNumbering();
163 // Write the numbering table.
164 virtual void WriteNumbering();
165
165
166 /// Write reference to a header/foorter + the actual xml containing the text.
167 void WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char* pType );
166 // Write reference to a header/foorter + the actual xml containing the text.
167 void WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char* pType );
168
168
169 /// Write word/fontTable.xml.
170 void WriteFonts();
169 // Write word/fontTable.xml.
170 void WriteFonts();
171
171
172 /// Write docProps/core.xml
173 void WriteProperties();
172 // Write docProps/core.xml
173 void WriteProperties();
174
175public:
174
175public:
176 /// FIXME this is temporary, remotely reminding the method of the same
177 /// name in WW8Export.
178 void WriteMainText();
176 // FIXME this is temporary, remotely reminding the method of the same
177 // name in WW8Export.
178 void WriteMainText();
179
179
180 /// Pass the pDocument, pCurrentPam and pOriginalPam to the base class.
181 DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument,
182 SwPaM *pCurrentPam, SwPaM *pOriginalPam );
180 // Pass the pDocument, pCurrentPam and pOriginalPam to the base class.
181 DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument,
182 SwPaM *pCurrentPam, SwPaM *pOriginalPam );
183
183
184 /// Destructor.
185 virtual ~DocxExport();
184 // Destructor.
185 virtual ~DocxExport();
186
186
187 /// Reference to the VMLExport instance for the main document.
188 oox::vml::VMLExport& VMLExporter();
187 // Reference to the VMLExport instance for the main document.
188 oox::vml::VMLExport& VMLExporter();
189
190private:
189
190private:
191 /// No copying.
192 DocxExport( const DocxExport& );
191 // No copying.
192 DocxExport( const DocxExport& );
193
193
194 /// No copying.
195 DocxExport& operator=( const DocxExport& );
194 // No copying.
195 DocxExport& operator=( const DocxExport& );
196};
197
198#endif // _DOCXEXPORT_HXX_
196};
197
198#endif // _DOCXEXPORT_HXX_
199/* vi:set tabstop=4 shiftwidth=4 expandtab: */
199
200/* vim: set noet sw=4 ts=4: */