xref: /AOO41X/main/xmloff/source/text/txtparae.cxx (revision c45df7c4d83ad42fac597959ca4c329ba5d8db89)
163bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
363bba73cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
463bba73cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
563bba73cSAndrew Rist  * distributed with this work for additional information
663bba73cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
763bba73cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
863bba73cSAndrew Rist  * "License"); you may not use this file except in compliance
963bba73cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
1163bba73cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
1363bba73cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1463bba73cSAndrew Rist  * software distributed under the License is distributed on an
1563bba73cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1663bba73cSAndrew Rist  * KIND, either express or implied.  See the License for the
1763bba73cSAndrew Rist  * specific language governing permissions and limitations
1863bba73cSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
2063bba73cSAndrew Rist  *************************************************************/
2163bba73cSAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
24cdf0e10cSrcweir #include "unointerfacetouniqueidentifiermapper.hxx"
25cdf0e10cSrcweir #include <tools/debug.hxx>
26cdf0e10cSrcweir #ifndef _SVSTDARR_LONGS_DECL
27cdf0e10cSrcweir #define _SVSTDARR_LONGS
28cdf0e10cSrcweir #include <svl/svstdarr.hxx>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #include <svl/svarray.hxx>
31cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
32cdf0e10cSrcweir #include <sal/types.h>
33cdf0e10cSrcweir #include <vector>
34cdf0e10cSrcweir #include <list>
35cdf0e10cSrcweir #include <hash_map>
36cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
37cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp>
38cdf0e10cSrcweir #include <com/sun/star/container/XEnumeration.hpp>
39cdf0e10cSrcweir #include <com/sun/star/container/XIndexReplace.hpp>
40cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
41cdf0e10cSrcweir #include <com/sun/star/beans/XMultiPropertySet.hpp>
42cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp>
43cdf0e10cSrcweir #include <com/sun/star/text/XTextDocument.hpp>
44cdf0e10cSrcweir #include <com/sun/star/text/XTextSectionsSupplier.hpp>
45cdf0e10cSrcweir #include <com/sun/star/text/XTextTablesSupplier.hpp>
46cdf0e10cSrcweir #include <com/sun/star/text/XNumberingRulesSupplier.hpp>
47cdf0e10cSrcweir #include <com/sun/star/text/XChapterNumberingSupplier.hpp>//#outline level,add by zhaojianwei
48cdf0e10cSrcweir #include <com/sun/star/text/XTextTable.hpp>
49cdf0e10cSrcweir #include <com/sun/star/text/XText.hpp>
50cdf0e10cSrcweir #include <com/sun/star/text/XTextContent.hpp>
51cdf0e10cSrcweir #include <com/sun/star/text/XTextRange.hpp>
52cdf0e10cSrcweir #include <com/sun/star/text/XTextField.hpp>
53cdf0e10cSrcweir #include <com/sun/star/text/XFootnote.hpp>
54cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp>
55cdf0e10cSrcweir #include <com/sun/star/container/XContentEnumerationAccess.hpp>
56cdf0e10cSrcweir #include <com/sun/star/text/XTextFrame.hpp>
57cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
58cdf0e10cSrcweir #include <com/sun/star/text/SizeType.hpp>
59cdf0e10cSrcweir #include <com/sun/star/text/HoriOrientation.hpp>
60cdf0e10cSrcweir #include <com/sun/star/text/VertOrientation.hpp>
61cdf0e10cSrcweir #include <com/sun/star/text/TextContentAnchorType.hpp>
62cdf0e10cSrcweir #include <com/sun/star/text/XTextFramesSupplier.hpp>
63cdf0e10cSrcweir #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
64cdf0e10cSrcweir #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
65cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
66cdf0e10cSrcweir #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
67cdf0e10cSrcweir #include <com/sun/star/document/XEventsSupplier.hpp>
68cdf0e10cSrcweir #include <com/sun/star/document/XRedlinesSupplier.hpp>
69cdf0e10cSrcweir #include <com/sun/star/text/XBookmarksSupplier.hpp>
70cdf0e10cSrcweir #include <com/sun/star/text/XFormField.hpp>
71cdf0e10cSrcweir #include <com/sun/star/text/XTextSection.hpp>
72cdf0e10cSrcweir #include <com/sun/star/text/SectionFileLink.hpp>
73cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp>
74cdf0e10cSrcweir #include <com/sun/star/text/XTextShapesSupplier.hpp>
75cdf0e10cSrcweir #include <com/sun/star/style/XAutoStylesSupplier.hpp>
76cdf0e10cSrcweir #include <com/sun/star/style/XAutoStyleFamily.hpp>
77cdf0e10cSrcweir #include <com/sun/star/text/XTextFieldsSupplier.hpp>
78cdf0e10cSrcweir #include <com/sun/star/text/XFootnotesSupplier.hpp>
79cdf0e10cSrcweir #include <com/sun/star/text/XEndnotesSupplier.hpp>
80cdf0e10cSrcweir #include <com/sun/star/drawing/XControlShape.hpp>
81cdf0e10cSrcweir #include <com/sun/star/util/DateTime.hpp>
82cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
83cdf0e10cSrcweir #include <xmloff/xmlaustp.hxx>
84cdf0e10cSrcweir #include <xmloff/families.hxx>
85cdf0e10cSrcweir #include "txtexppr.hxx"
86cdf0e10cSrcweir #include <xmloff/xmlnumfe.hxx>
87cdf0e10cSrcweir #include <xmloff/xmlnume.hxx>
88cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
89cdf0e10cSrcweir #include "XMLAnchorTypePropHdl.hxx"
90cdf0e10cSrcweir #include "xexptran.hxx"
91cdf0e10cSrcweir #include <xmloff/ProgressBarHelper.hxx>
92cdf0e10cSrcweir #include <xmloff/nmspmap.hxx>
93cdf0e10cSrcweir #include <xmloff/xmlexp.hxx>
94cdf0e10cSrcweir #include "txtflde.hxx"
95cdf0e10cSrcweir #include <xmloff/txtprmap.hxx>
96cdf0e10cSrcweir #include "XMLImageMapExport.hxx"
97cdf0e10cSrcweir #include "XMLTextNumRuleInfo.hxx"
98cdf0e10cSrcweir #include "xmloff/XMLTextListAutoStylePool.hxx"
99cdf0e10cSrcweir #include <xmloff/txtparae.hxx>
100cdf0e10cSrcweir #include "XMLSectionExport.hxx"
101cdf0e10cSrcweir #include "XMLIndexMarkExport.hxx"
102cdf0e10cSrcweir #include <xmloff/XMLEventExport.hxx>
103cdf0e10cSrcweir #include "XMLRedlineExport.hxx"
104cdf0e10cSrcweir #include "MultiPropertySetHelper.hxx"
105cdf0e10cSrcweir #include <xmloff/formlayerexport.hxx>
106cdf0e10cSrcweir #include "XMLTextCharStyleNamesElementExport.hxx"
107cdf0e10cSrcweir #include <comphelper/stlunosequence.hxx>
108cdf0e10cSrcweir #include <txtlists.hxx>
109cdf0e10cSrcweir #include <com/sun/star/rdf/XMetadatable.hpp>
1101f882ec4SArmin Le Grand #include <basegfx/polygon/b2dpolypolygon.hxx>
1111f882ec4SArmin Le Grand #include <basegfx/polygon/b2dpolypolygontools.hxx>
1121f882ec4SArmin Le Grand #include <basegfx/polygon/b2dpolygontools.hxx>
113cdf0e10cSrcweir 
114cdf0e10cSrcweir using ::rtl::OUString;
115cdf0e10cSrcweir using ::rtl::OUStringBuffer;
116cdf0e10cSrcweir 
117cdf0e10cSrcweir using namespace ::std;
118cdf0e10cSrcweir using namespace ::com::sun::star;
119cdf0e10cSrcweir using namespace ::com::sun::star::uno;
120cdf0e10cSrcweir using namespace ::com::sun::star::lang;
121cdf0e10cSrcweir using namespace ::com::sun::star::beans;
122cdf0e10cSrcweir using namespace ::com::sun::star::container;
123cdf0e10cSrcweir using namespace ::com::sun::star::text;
124cdf0e10cSrcweir using namespace ::com::sun::star::style;
125cdf0e10cSrcweir using namespace ::com::sun::star::util;
126cdf0e10cSrcweir using namespace ::com::sun::star::drawing;
127cdf0e10cSrcweir using namespace ::com::sun::star::document;
128cdf0e10cSrcweir using namespace ::com::sun::star::frame;
129cdf0e10cSrcweir using namespace ::xmloff;
130cdf0e10cSrcweir using namespace ::xmloff::token;
131cdf0e10cSrcweir 
132cdf0e10cSrcweir namespace
133cdf0e10cSrcweir {
134cdf0e10cSrcweir     class TextContentSet
135cdf0e10cSrcweir     {
136cdf0e10cSrcweir         public:
137cdf0e10cSrcweir             typedef Reference<XTextContent> text_content_ref_t;
138cdf0e10cSrcweir             typedef list<text_content_ref_t> contents_t;
139cdf0e10cSrcweir             typedef back_insert_iterator<contents_t> inserter_t;
140cdf0e10cSrcweir             typedef contents_t::const_iterator const_iterator_t;
141cdf0e10cSrcweir 
getInserter()142cdf0e10cSrcweir             inserter_t getInserter()
143cdf0e10cSrcweir                 { return back_insert_iterator<contents_t>(m_vTextContents); };
getBegin() const144cdf0e10cSrcweir             const_iterator_t getBegin() const
145cdf0e10cSrcweir                 { return m_vTextContents.begin(); };
getEnd() const146cdf0e10cSrcweir             const_iterator_t getEnd() const
147cdf0e10cSrcweir                 { return m_vTextContents.end(); };
148cdf0e10cSrcweir 
149cdf0e10cSrcweir         private:
150cdf0e10cSrcweir             contents_t m_vTextContents;
151cdf0e10cSrcweir     };
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     struct FrameRefHash
154cdf0e10cSrcweir         : public unary_function<Reference<XTextFrame>, size_t>
155cdf0e10cSrcweir     {
operator ()__anon20557f370111::FrameRefHash156cdf0e10cSrcweir         size_t operator()(const Reference<XTextFrame> xFrame) const
157cdf0e10cSrcweir             { return sal::static_int_cast<size_t>(reinterpret_cast<sal_uIntPtr>(xFrame.get())); }
158cdf0e10cSrcweir     };
159cdf0e10cSrcweir 
lcl_TextContentsUnfiltered(const Reference<XTextContent> &)160cdf0e10cSrcweir     static bool lcl_TextContentsUnfiltered(const Reference<XTextContent>&)
161cdf0e10cSrcweir         { return true; };
162cdf0e10cSrcweir 
lcl_ShapeFilter(const Reference<XTextContent> & xTxtContent)163cdf0e10cSrcweir     static bool lcl_ShapeFilter(const Reference<XTextContent>& xTxtContent)
164cdf0e10cSrcweir     {
165cdf0e10cSrcweir         static const OUString sTextFrameService = OUString::createFromAscii("com.sun.star.text.TextFrame");
166cdf0e10cSrcweir         static const OUString sTextGraphicService = OUString::createFromAscii("com.sun.star.text.TextGraphicObject");
167cdf0e10cSrcweir         static const OUString sTextEmbeddedService = OUString::createFromAscii("com.sun.star.text.TextEmbeddedObject");
168cdf0e10cSrcweir         Reference<XShape> xShape(xTxtContent, UNO_QUERY);
169cdf0e10cSrcweir         if(!xShape.is())
170cdf0e10cSrcweir             return false;
171cdf0e10cSrcweir         Reference<XServiceInfo> xServiceInfo(xTxtContent, UNO_QUERY);
172cdf0e10cSrcweir         if(xServiceInfo->supportsService(sTextFrameService) ||
173cdf0e10cSrcweir             xServiceInfo->supportsService(sTextGraphicService) ||
174cdf0e10cSrcweir             xServiceInfo->supportsService(sTextEmbeddedService) )
175cdf0e10cSrcweir             return false;
176cdf0e10cSrcweir         return true;
177cdf0e10cSrcweir     };
178cdf0e10cSrcweir 
179cdf0e10cSrcweir     class BoundFrames
180cdf0e10cSrcweir     {
181cdf0e10cSrcweir         public:
182cdf0e10cSrcweir             typedef bool (*filter_t)(const Reference<XTextContent>&);
BoundFrames(const Reference<XEnumerationAccess> xEnumAccess,const filter_t & rFilter)183cdf0e10cSrcweir             BoundFrames(
184cdf0e10cSrcweir                 const Reference<XEnumerationAccess> xEnumAccess,
185cdf0e10cSrcweir                 const filter_t& rFilter)
186cdf0e10cSrcweir                 : m_xEnumAccess(xEnumAccess)
187cdf0e10cSrcweir             {
188cdf0e10cSrcweir                 Fill(rFilter);
189cdf0e10cSrcweir             };
BoundFrames()190cdf0e10cSrcweir             BoundFrames()
191cdf0e10cSrcweir                 {};
GetPageBoundContents() const192cdf0e10cSrcweir             const TextContentSet* GetPageBoundContents() const
193cdf0e10cSrcweir                 { return &m_vPageBounds; };
GetFrameBoundContents(const Reference<XTextFrame> & rParentFrame) const194cdf0e10cSrcweir             const TextContentSet* GetFrameBoundContents(const Reference<XTextFrame>& rParentFrame) const
195cdf0e10cSrcweir             {
196cdf0e10cSrcweir                 framebound_map_t::const_iterator it = m_vFrameBoundsOf.find(rParentFrame);
197cdf0e10cSrcweir                 if(it == m_vFrameBoundsOf.end())
198cdf0e10cSrcweir                     return NULL;
199cdf0e10cSrcweir                 return &(it->second);
200cdf0e10cSrcweir             };
createEnumeration() const201cdf0e10cSrcweir             Reference<XEnumeration> createEnumeration() const
202cdf0e10cSrcweir             {
203cdf0e10cSrcweir                 if(!m_xEnumAccess.is())
204cdf0e10cSrcweir                     return Reference<XEnumeration>();
205cdf0e10cSrcweir                 return m_xEnumAccess->createEnumeration();
206cdf0e10cSrcweir             };
207cdf0e10cSrcweir 
208cdf0e10cSrcweir         private:
209cdf0e10cSrcweir             typedef hash_map<
210cdf0e10cSrcweir                 Reference<XTextFrame>,
211cdf0e10cSrcweir                 TextContentSet,
212cdf0e10cSrcweir                 FrameRefHash> framebound_map_t;
213cdf0e10cSrcweir             TextContentSet m_vPageBounds;
214cdf0e10cSrcweir             framebound_map_t m_vFrameBoundsOf;
215cdf0e10cSrcweir             const Reference<XEnumerationAccess> m_xEnumAccess;
216cdf0e10cSrcweir             void Fill(const filter_t& rFilter);
217cdf0e10cSrcweir             static const OUString our_sAnchorType;
218cdf0e10cSrcweir             static const OUString our_sAnchorFrame;
219cdf0e10cSrcweir     };
220cdf0e10cSrcweir     const OUString BoundFrames::our_sAnchorType = OUString::createFromAscii("AnchorType");
221cdf0e10cSrcweir     const OUString BoundFrames::our_sAnchorFrame = OUString::createFromAscii("AnchorFrame");
222cdf0e10cSrcweir 
223cdf0e10cSrcweir     class FieldParamExporter
224cdf0e10cSrcweir     {
225cdf0e10cSrcweir         public:
FieldParamExporter(SvXMLExport * const pExport,Reference<XNameContainer> xFieldParams)226cdf0e10cSrcweir             FieldParamExporter(SvXMLExport* const pExport, Reference<XNameContainer> xFieldParams)
227cdf0e10cSrcweir                 : m_pExport(pExport)
228cdf0e10cSrcweir                 , m_xFieldParams(xFieldParams)
229cdf0e10cSrcweir                 { };
230cdf0e10cSrcweir             void Export();
231cdf0e10cSrcweir 
232cdf0e10cSrcweir         private:
233cdf0e10cSrcweir             SvXMLExport* const m_pExport;
234cdf0e10cSrcweir             const Reference<XNameContainer> m_xFieldParams;
235cdf0e10cSrcweir 
236cdf0e10cSrcweir             void ExportParameter(const OUString& sKey, const OUString& sValue);
237cdf0e10cSrcweir     };
238cdf0e10cSrcweir }
239cdf0e10cSrcweir 
240cdf0e10cSrcweir namespace xmloff
241cdf0e10cSrcweir {
242cdf0e10cSrcweir     class BoundFrameSets
243cdf0e10cSrcweir     {
244cdf0e10cSrcweir         public:
245cdf0e10cSrcweir             BoundFrameSets(const Reference<XInterface> xModel);
GetTexts() const246cdf0e10cSrcweir             const BoundFrames* GetTexts() const
247cdf0e10cSrcweir                 { return m_pTexts.get(); };
GetGraphics() const248cdf0e10cSrcweir             const BoundFrames* GetGraphics() const
249cdf0e10cSrcweir                 { return m_pGraphics.get(); };
GetEmbeddeds() const250cdf0e10cSrcweir             const BoundFrames* GetEmbeddeds() const
251cdf0e10cSrcweir                 { return m_pEmbeddeds.get(); };
GetShapes() const252cdf0e10cSrcweir             const BoundFrames* GetShapes() const
253cdf0e10cSrcweir                 { return m_pShapes.get(); };
254cdf0e10cSrcweir         private:
255cdf0e10cSrcweir             auto_ptr<BoundFrames> m_pTexts;
256cdf0e10cSrcweir             auto_ptr<BoundFrames> m_pGraphics;
257cdf0e10cSrcweir             auto_ptr<BoundFrames> m_pEmbeddeds;
258cdf0e10cSrcweir             auto_ptr<BoundFrames> m_pShapes;
259cdf0e10cSrcweir     };
260cdf0e10cSrcweir }
261cdf0e10cSrcweir 
262cdf0e10cSrcweir typedef OUString *OUStringPtr;
263cdf0e10cSrcweir SV_DECL_PTRARR_DEL( OUStrings_Impl, OUStringPtr, 20, 10 )
264cdf0e10cSrcweir SV_IMPL_PTRARR( OUStrings_Impl, OUStringPtr )
265cdf0e10cSrcweir 
266cdf0e10cSrcweir SV_DECL_PTRARR_SORT_DEL( OUStringsSort_Impl, OUStringPtr, 20, 10 )
267cdf0e10cSrcweir SV_IMPL_OP_PTRARR_SORT( OUStringsSort_Impl, OUStringPtr )
268cdf0e10cSrcweir 
269cdf0e10cSrcweir #ifdef DBG_UTIL
270cdf0e10cSrcweir static int txtparae_bContainsIllegalCharacters = sal_False;
271cdf0e10cSrcweir #endif
272cdf0e10cSrcweir 
273cdf0e10cSrcweir // The following map shows which property values are required:
274cdf0e10cSrcweir //
275cdf0e10cSrcweir // property						auto style pass		export
276cdf0e10cSrcweir // --------------------------------------------------------
277cdf0e10cSrcweir // ParaStyleName				if style exists		always
278cdf0e10cSrcweir // ParaConditionalStyleName		if style exists		always
279cdf0e10cSrcweir // NumberingRules				if style exists		always
280cdf0e10cSrcweir // TextSection					always				always
281cdf0e10cSrcweir // ParaChapterNumberingLevel	never				always
282cdf0e10cSrcweir // NumberingIsNumber            never               always
283cdf0e10cSrcweir 
284cdf0e10cSrcweir // The conclusion is that for auto styles the first three properties
285cdf0e10cSrcweir // should be queried using a multi property set if, and only if, an
286cdf0e10cSrcweir // auto style needs to be exported. TextSection should be queried by
287cdf0e10cSrcweir // an individual call to getPropertyvalue, because this seems to be
288cdf0e10cSrcweir // less expensive than querying the first three properties if they aren't
289cdf0e10cSrcweir // required.
290cdf0e10cSrcweir 
291cdf0e10cSrcweir // For the export pass all properties can be queried using a multi property
292cdf0e10cSrcweir // set.
293cdf0e10cSrcweir 
294cdf0e10cSrcweir static const sal_Char* aParagraphPropertyNamesAuto[] =
295cdf0e10cSrcweir {
296cdf0e10cSrcweir 	"NumberingRules",
297cdf0e10cSrcweir 	"ParaConditionalStyleName",
298cdf0e10cSrcweir 	"ParaStyleName",
299cdf0e10cSrcweir 	NULL
300cdf0e10cSrcweir };
301cdf0e10cSrcweir 
302cdf0e10cSrcweir enum eParagraphPropertyNamesEnumAuto
303cdf0e10cSrcweir {
304cdf0e10cSrcweir 	NUMBERING_RULES_AUTO = 0,
305cdf0e10cSrcweir 	PARA_CONDITIONAL_STYLE_NAME_AUTO = 1,
306cdf0e10cSrcweir 	PARA_STYLE_NAME_AUTO = 2
307cdf0e10cSrcweir };
308cdf0e10cSrcweir 
309cdf0e10cSrcweir static const sal_Char* aParagraphPropertyNames[] =
310cdf0e10cSrcweir {
311cdf0e10cSrcweir     "NumberingIsNumber",
312cdf0e10cSrcweir 	"NumberingStyleName",			//#outline level,add by zhaojianwei
313cdf0e10cSrcweir 
314cdf0e10cSrcweir 	//"ParaChapterNumberingLevel",	//#outline level,remove by zhaojianwei
315cdf0e10cSrcweir 	"OutlineLevel",					//<-end,add by zhaojianwei
316cdf0e10cSrcweir 	"ParaConditionalStyleName",
317cdf0e10cSrcweir 	"ParaStyleName",
318cdf0e10cSrcweir 	"TextSection",
319cdf0e10cSrcweir     NULL
320cdf0e10cSrcweir };
321cdf0e10cSrcweir 
322cdf0e10cSrcweir enum eParagraphPropertyNamesEnum
323cdf0e10cSrcweir {
324cdf0e10cSrcweir 	NUMBERING_IS_NUMBER = 0,
325cdf0e10cSrcweir 	PARA_NUMBERING_STYLENAME = 1,		//#outline level,add by zhaojianwei
326cdf0e10cSrcweir 	//PARA_CHAPTER_NUMERBING_LEVEL = 1,	//#outline level,remove by zhaojianwei
327cdf0e10cSrcweir 	PARA_OUTLINE_LEVEL=2,				//<-end.add by zhaojianwei
328cdf0e10cSrcweir 	PARA_CONDITIONAL_STYLE_NAME = 3,
329cdf0e10cSrcweir 	PARA_STYLE_NAME = 4,
330cdf0e10cSrcweir 	TEXT_SECTION = 5
331cdf0e10cSrcweir };
332cdf0e10cSrcweir 
Fill(const filter_t & rFilter)333cdf0e10cSrcweir void BoundFrames::Fill(const filter_t& rFilter)
334cdf0e10cSrcweir {
335cdf0e10cSrcweir     if(!m_xEnumAccess.is())
336cdf0e10cSrcweir         return;
337cdf0e10cSrcweir     const Reference< XEnumeration > xEnum = m_xEnumAccess->createEnumeration();
338cdf0e10cSrcweir     if(!xEnum.is())
339cdf0e10cSrcweir         return;
340cdf0e10cSrcweir     while(xEnum->hasMoreElements())
341cdf0e10cSrcweir     {
342cdf0e10cSrcweir         Reference<XPropertySet> xPropSet(xEnum->nextElement(), UNO_QUERY);
343cdf0e10cSrcweir         Reference<XTextContent> xTextContent(xPropSet, UNO_QUERY);
344cdf0e10cSrcweir         if(!xPropSet.is() || !xTextContent.is())
345cdf0e10cSrcweir             continue;
346cdf0e10cSrcweir         TextContentAnchorType eAnchor;
347cdf0e10cSrcweir         xPropSet->getPropertyValue(our_sAnchorType) >>= eAnchor;
348cdf0e10cSrcweir         if(TextContentAnchorType_AT_PAGE != eAnchor && TextContentAnchorType_AT_FRAME != eAnchor)
349cdf0e10cSrcweir             continue;
350cdf0e10cSrcweir         if(!rFilter(xTextContent))
351cdf0e10cSrcweir             continue;
352cdf0e10cSrcweir 
353cdf0e10cSrcweir         TextContentSet::inserter_t pInserter = m_vPageBounds.getInserter();
354cdf0e10cSrcweir         if(TextContentAnchorType_AT_FRAME == eAnchor)
355cdf0e10cSrcweir         {
356cdf0e10cSrcweir             Reference<XTextFrame> xAnchorTxtFrame(
357cdf0e10cSrcweir                 xPropSet->getPropertyValue(our_sAnchorFrame),
358cdf0e10cSrcweir                 uno::UNO_QUERY);
359cdf0e10cSrcweir             pInserter = m_vFrameBoundsOf[xAnchorTxtFrame].getInserter();
360cdf0e10cSrcweir         }
361cdf0e10cSrcweir         *pInserter++ = xTextContent;
362cdf0e10cSrcweir     }
363cdf0e10cSrcweir }
364cdf0e10cSrcweir 
BoundFrameSets(const Reference<XInterface> xModel)365cdf0e10cSrcweir BoundFrameSets::BoundFrameSets(const Reference<XInterface> xModel)
366cdf0e10cSrcweir     : m_pTexts(new BoundFrames())
367cdf0e10cSrcweir     , m_pGraphics(new BoundFrames())
368cdf0e10cSrcweir     , m_pEmbeddeds(new BoundFrames())
369cdf0e10cSrcweir     , m_pShapes(new BoundFrames())
370cdf0e10cSrcweir {
371cdf0e10cSrcweir     const Reference<XTextFramesSupplier> xTFS(xModel, UNO_QUERY);
372cdf0e10cSrcweir     const Reference<XTextGraphicObjectsSupplier> xGOS(xModel, UNO_QUERY);
373cdf0e10cSrcweir     const Reference<XTextEmbeddedObjectsSupplier> xEOS(xModel, UNO_QUERY);
374cdf0e10cSrcweir     const Reference<XDrawPageSupplier> xDPS(xModel, UNO_QUERY);
375cdf0e10cSrcweir     if(xTFS.is())
376cdf0e10cSrcweir         m_pTexts = auto_ptr<BoundFrames>(new BoundFrames(
377cdf0e10cSrcweir             Reference<XEnumerationAccess>(xTFS->getTextFrames(), UNO_QUERY),
378cdf0e10cSrcweir             &lcl_TextContentsUnfiltered));
379cdf0e10cSrcweir     if(xGOS.is())
380cdf0e10cSrcweir         m_pGraphics = auto_ptr<BoundFrames>(new BoundFrames(
381cdf0e10cSrcweir             Reference<XEnumerationAccess>(xGOS->getGraphicObjects(), UNO_QUERY),
382cdf0e10cSrcweir             &lcl_TextContentsUnfiltered));
383cdf0e10cSrcweir     if(xEOS.is())
384cdf0e10cSrcweir         m_pEmbeddeds = auto_ptr<BoundFrames>(new BoundFrames(
385cdf0e10cSrcweir             Reference<XEnumerationAccess>(xEOS->getEmbeddedObjects(), UNO_QUERY),
386cdf0e10cSrcweir             &lcl_TextContentsUnfiltered));
387cdf0e10cSrcweir     if(xDPS.is())
388cdf0e10cSrcweir         m_pShapes = auto_ptr<BoundFrames>(new BoundFrames(
389cdf0e10cSrcweir             Reference<XEnumerationAccess>(xDPS->getDrawPage(), UNO_QUERY),
390cdf0e10cSrcweir             &lcl_ShapeFilter));
391cdf0e10cSrcweir };
392cdf0e10cSrcweir 
Export()393cdf0e10cSrcweir void FieldParamExporter::Export()
394cdf0e10cSrcweir {
395cdf0e10cSrcweir     static const Type aStringType = ::getCppuType((OUString*)0);
396cdf0e10cSrcweir     static const Type aBoolType = ::getCppuType((sal_Bool*)0);
397cdf0e10cSrcweir     static const Type aSeqType = ::getCppuType((Sequence<OUString>*)0);
398cdf0e10cSrcweir     static const Type aIntType = ::getCppuType((sal_Int32*)0);
399cdf0e10cSrcweir     Sequence<OUString> vParameters(m_xFieldParams->getElementNames());
400cdf0e10cSrcweir     for(const OUString* pCurrent=::comphelper::stl_begin(vParameters); pCurrent!=::comphelper::stl_end(vParameters); ++pCurrent)
401cdf0e10cSrcweir     {
402cdf0e10cSrcweir         const Any aValue = m_xFieldParams->getByName(*pCurrent);
403cdf0e10cSrcweir         const Type aValueType = aValue.getValueType();
404cdf0e10cSrcweir         if(aValueType == aStringType)
405cdf0e10cSrcweir         {
406cdf0e10cSrcweir             OUString sValue;
407cdf0e10cSrcweir             aValue >>= sValue;
408cdf0e10cSrcweir             ExportParameter(*pCurrent,sValue);
409cdf0e10cSrcweir         }
410cdf0e10cSrcweir         else if(aValueType == aBoolType)
411cdf0e10cSrcweir         {
412cdf0e10cSrcweir             sal_Bool bValue = false;
413cdf0e10cSrcweir             aValue >>= bValue;
414cdf0e10cSrcweir             ExportParameter(*pCurrent,OUString::createFromAscii(bValue ? "true" : "false"));
415cdf0e10cSrcweir         }
416cdf0e10cSrcweir         else if(aValueType == aSeqType)
417cdf0e10cSrcweir         {
418cdf0e10cSrcweir             Sequence<OUString> vValue;
419cdf0e10cSrcweir             aValue >>= vValue;
420cdf0e10cSrcweir             for(OUString* pSeqCurrent = ::comphelper::stl_begin(vValue); pSeqCurrent != ::comphelper::stl_end(vValue); ++pSeqCurrent)
421cdf0e10cSrcweir             {
422cdf0e10cSrcweir                 ExportParameter(*pCurrent, *pSeqCurrent);
423cdf0e10cSrcweir             }
424cdf0e10cSrcweir         }
425cdf0e10cSrcweir         else if(aValueType == aIntType)
426cdf0e10cSrcweir         {
427cdf0e10cSrcweir             sal_Int32 nValue = 0;
428cdf0e10cSrcweir             aValue >>= nValue;
429cdf0e10cSrcweir             ExportParameter(*pCurrent, OUStringBuffer().append(nValue).makeStringAndClear());
430cdf0e10cSrcweir         }
431cdf0e10cSrcweir     }
432cdf0e10cSrcweir }
433cdf0e10cSrcweir 
ExportParameter(const OUString & sKey,const OUString & sValue)434cdf0e10cSrcweir void FieldParamExporter::ExportParameter(const OUString& sKey, const OUString& sValue)
435cdf0e10cSrcweir {
436cdf0e10cSrcweir     m_pExport->AddAttribute(XML_NAMESPACE_FIELD, XML_NAME, sKey);
437cdf0e10cSrcweir     m_pExport->AddAttribute(XML_NAMESPACE_FIELD, XML_VALUE, sValue);
438cdf0e10cSrcweir     m_pExport->StartElement(XML_NAMESPACE_FIELD, XML_PARAM, sal_False);
439cdf0e10cSrcweir     m_pExport->EndElement(XML_NAMESPACE_FIELD, XML_PARAM, sal_False);
440cdf0e10cSrcweir }
441cdf0e10cSrcweir 
Add(sal_uInt16 nFamily,const Reference<XPropertySet> & rPropSet,const XMLPropertyState ** ppAddStates,bool bDontSeek)442cdf0e10cSrcweir void XMLTextParagraphExport::Add( sal_uInt16 nFamily,
443cdf0e10cSrcweir 								  const Reference < XPropertySet > & rPropSet,
444cdf0e10cSrcweir 								  const XMLPropertyState** ppAddStates, bool bDontSeek )
445cdf0e10cSrcweir {
446cdf0e10cSrcweir 	UniReference < SvXMLExportPropertyMapper > xPropMapper;
447cdf0e10cSrcweir 	switch( nFamily )
448cdf0e10cSrcweir 	{
449cdf0e10cSrcweir 	case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
450cdf0e10cSrcweir 		xPropMapper = GetParaPropMapper();
451cdf0e10cSrcweir 		break;
452cdf0e10cSrcweir 	case XML_STYLE_FAMILY_TEXT_TEXT:
453cdf0e10cSrcweir 		xPropMapper = GetTextPropMapper();
454cdf0e10cSrcweir 		break;
455cdf0e10cSrcweir 	case XML_STYLE_FAMILY_TEXT_FRAME:
456cdf0e10cSrcweir 		xPropMapper = GetAutoFramePropMapper();
457cdf0e10cSrcweir 		break;
458cdf0e10cSrcweir 	case XML_STYLE_FAMILY_TEXT_SECTION:
459cdf0e10cSrcweir 		xPropMapper = GetSectionPropMapper();
460cdf0e10cSrcweir 		break;
461cdf0e10cSrcweir 	case XML_STYLE_FAMILY_TEXT_RUBY:
462cdf0e10cSrcweir 		xPropMapper = GetRubyPropMapper();
463cdf0e10cSrcweir 		break;
464cdf0e10cSrcweir 	}
465cdf0e10cSrcweir 	DBG_ASSERT( xPropMapper.is(), "There is the property mapper?" );
466cdf0e10cSrcweir 
467cdf0e10cSrcweir 	vector< XMLPropertyState > xPropStates =
468cdf0e10cSrcweir 			xPropMapper->Filter( rPropSet );
469cdf0e10cSrcweir 
470cdf0e10cSrcweir 	if( ppAddStates )
471cdf0e10cSrcweir 	{
472cdf0e10cSrcweir 		while( *ppAddStates )
473cdf0e10cSrcweir 		{
474cdf0e10cSrcweir 			xPropStates.push_back( **ppAddStates );
475cdf0e10cSrcweir 			ppAddStates++;
476cdf0e10cSrcweir 		}
477cdf0e10cSrcweir 	}
478cdf0e10cSrcweir 
479cdf0e10cSrcweir 	if( !xPropStates.empty() )
480cdf0e10cSrcweir 	{
481cdf0e10cSrcweir 		Reference< XPropertySetInfo > xPropSetInfo(rPropSet->getPropertySetInfo());
482cdf0e10cSrcweir 		OUString sParent, sCondParent;
483cdf0e10cSrcweir 		sal_uInt16 nIgnoreProps = 0;
484cdf0e10cSrcweir 		switch( nFamily )
485cdf0e10cSrcweir 		{
486cdf0e10cSrcweir 		case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
487cdf0e10cSrcweir 			if( xPropSetInfo->hasPropertyByName( sParaStyleName ) )
488cdf0e10cSrcweir 			{
489cdf0e10cSrcweir 				rPropSet->getPropertyValue( sParaStyleName ) >>= sParent;
490cdf0e10cSrcweir 			}
491cdf0e10cSrcweir 			if( xPropSetInfo->hasPropertyByName( sParaConditionalStyleName ) )
492cdf0e10cSrcweir 			{
493cdf0e10cSrcweir 				rPropSet->getPropertyValue( sParaConditionalStyleName ) >>= sCondParent;
494cdf0e10cSrcweir 			}
495cdf0e10cSrcweir 			if( xPropSetInfo->hasPropertyByName( sNumberingRules ) )
496cdf0e10cSrcweir 			{
497cdf0e10cSrcweir                 Reference < XIndexReplace > xNumRule(rPropSet->getPropertyValue( sNumberingRules ), uno::UNO_QUERY);
498cdf0e10cSrcweir 				if( xNumRule.is() && xNumRule->getCount() )
499cdf0e10cSrcweir 				{
500cdf0e10cSrcweir 					Reference < XNamed > xNamed( xNumRule, UNO_QUERY );
501cdf0e10cSrcweir 					OUString sName;
502cdf0e10cSrcweir 					if( xNamed.is() )
503cdf0e10cSrcweir 						sName = xNamed->getName();
504cdf0e10cSrcweir 					sal_Bool bAdd = !sName.getLength();
505cdf0e10cSrcweir 					if( !bAdd )
506cdf0e10cSrcweir 					{
507cdf0e10cSrcweir 						Reference < XPropertySet > xNumPropSet( xNumRule,
508cdf0e10cSrcweir 																UNO_QUERY );
509cdf0e10cSrcweir                         const OUString sIsAutomatic( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) );
510cdf0e10cSrcweir 						if( xNumPropSet.is() &&
511cdf0e10cSrcweir 							xNumPropSet->getPropertySetInfo()
512cdf0e10cSrcweir 									   ->hasPropertyByName( sIsAutomatic ) )
513cdf0e10cSrcweir 						{
514cdf0e10cSrcweir 							bAdd = *(sal_Bool *)xNumPropSet->getPropertyValue( sIsAutomatic ).getValue();
515cdf0e10cSrcweir                             // --> OD 2007-01-12 #i73361# - check on outline style
516cdf0e10cSrcweir                             const OUString sNumberingIsOutline( RTL_CONSTASCII_USTRINGPARAM( "NumberingIsOutline" ) );
517cdf0e10cSrcweir                             if ( bAdd &&
518cdf0e10cSrcweir                                  xNumPropSet->getPropertySetInfo()
519cdf0e10cSrcweir                                            ->hasPropertyByName( sNumberingIsOutline ) )
520cdf0e10cSrcweir                             {
521cdf0e10cSrcweir                                 bAdd = !(*(sal_Bool *)xNumPropSet->getPropertyValue( sNumberingIsOutline ).getValue());
522cdf0e10cSrcweir                             }
523cdf0e10cSrcweir                             // <--
524cdf0e10cSrcweir 						}
525cdf0e10cSrcweir 						else
526cdf0e10cSrcweir 						{
527cdf0e10cSrcweir 							bAdd = sal_True;
528cdf0e10cSrcweir 						}
529cdf0e10cSrcweir 					}
530cdf0e10cSrcweir 					if( bAdd )
531cdf0e10cSrcweir 						pListAutoPool->Add( xNumRule );
532cdf0e10cSrcweir 				}
533cdf0e10cSrcweir 			}
534cdf0e10cSrcweir 			break;
535cdf0e10cSrcweir 		case XML_STYLE_FAMILY_TEXT_TEXT:
536cdf0e10cSrcweir 			{
537cdf0e10cSrcweir 				// Get parent and remove hyperlinks (they aren't of interest)
538cdf0e10cSrcweir 				UniReference< XMLPropertySetMapper > xPM(xPropMapper->getPropertySetMapper());
539cdf0e10cSrcweir 				for( ::std::vector< XMLPropertyState >::iterator i(xPropStates.begin());
540cdf0e10cSrcweir 		 			 nIgnoreProps < 2 && i != xPropStates.end(); )
541cdf0e10cSrcweir 				{
542cdf0e10cSrcweir 					if( i->mnIndex == -1 )
543cdf0e10cSrcweir                     {
544cdf0e10cSrcweir                         ++i;
545cdf0e10cSrcweir 						continue;
546cdf0e10cSrcweir                     }
547cdf0e10cSrcweir 
548cdf0e10cSrcweir 					switch( xPM->GetEntryContextId(i->mnIndex) )
549cdf0e10cSrcweir 					{
550cdf0e10cSrcweir 					case CTF_CHAR_STYLE_NAME:
551cdf0e10cSrcweir 					case CTF_HYPERLINK_URL:
552cdf0e10cSrcweir 						i->mnIndex = -1;
553cdf0e10cSrcweir 						nIgnoreProps++;
554cdf0e10cSrcweir                         i = xPropStates.erase( i );
555cdf0e10cSrcweir 						break;
556cdf0e10cSrcweir                     default:
557cdf0e10cSrcweir                         ++i;
558cdf0e10cSrcweir                         break;
559cdf0e10cSrcweir 					}
560cdf0e10cSrcweir 				}
561cdf0e10cSrcweir 			}
562cdf0e10cSrcweir 			break;
563cdf0e10cSrcweir 		case XML_STYLE_FAMILY_TEXT_FRAME:
564cdf0e10cSrcweir 			if( xPropSetInfo->hasPropertyByName( sFrameStyleName ) )
565cdf0e10cSrcweir 			{
566cdf0e10cSrcweir 				rPropSet->getPropertyValue( sFrameStyleName ) >>= sParent;
567cdf0e10cSrcweir 			}
568cdf0e10cSrcweir 			break;
569cdf0e10cSrcweir 		case XML_STYLE_FAMILY_TEXT_SECTION:
570cdf0e10cSrcweir 		case XML_STYLE_FAMILY_TEXT_RUBY:
571cdf0e10cSrcweir 			; // section styles have no parents
572cdf0e10cSrcweir 			break;
573cdf0e10cSrcweir 		}
574cdf0e10cSrcweir 		if( (xPropStates.size() - nIgnoreProps) > 0 )
575cdf0e10cSrcweir 		{
576cdf0e10cSrcweir 			GetAutoStylePool().Add( nFamily, sParent, xPropStates, bDontSeek );
577cdf0e10cSrcweir 			if( sCondParent.getLength() && sParent != sCondParent )
578cdf0e10cSrcweir 				GetAutoStylePool().Add( nFamily, sCondParent, xPropStates );
579cdf0e10cSrcweir 		}
580cdf0e10cSrcweir 	}
581cdf0e10cSrcweir }
582cdf0e10cSrcweir 
lcl_validPropState(const XMLPropertyState & rState)583cdf0e10cSrcweir bool lcl_validPropState( const XMLPropertyState& rState )
584cdf0e10cSrcweir {
585cdf0e10cSrcweir     return rState.mnIndex != -1;
586cdf0e10cSrcweir }
587cdf0e10cSrcweir 
Add(sal_uInt16 nFamily,MultiPropertySetHelper & rPropSetHelper,const Reference<XPropertySet> & rPropSet,const XMLPropertyState ** ppAddStates)588cdf0e10cSrcweir void XMLTextParagraphExport::Add( sal_uInt16 nFamily,
589cdf0e10cSrcweir 								  MultiPropertySetHelper& rPropSetHelper,
590cdf0e10cSrcweir 								  const Reference < XPropertySet > & rPropSet,
591cdf0e10cSrcweir 								  const XMLPropertyState** ppAddStates)
592cdf0e10cSrcweir {
593cdf0e10cSrcweir 	UniReference < SvXMLExportPropertyMapper > xPropMapper;
594cdf0e10cSrcweir 	switch( nFamily )
595cdf0e10cSrcweir 	{
596cdf0e10cSrcweir 	case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
597cdf0e10cSrcweir 		xPropMapper = GetParaPropMapper();
598cdf0e10cSrcweir 		break;
599cdf0e10cSrcweir 	}
600cdf0e10cSrcweir 	DBG_ASSERT( xPropMapper.is(), "There is the property mapper?" );
601cdf0e10cSrcweir 
602cdf0e10cSrcweir 	vector< XMLPropertyState > xPropStates(xPropMapper->Filter( rPropSet ));
603cdf0e10cSrcweir 	if( ppAddStates )
604cdf0e10cSrcweir 	{
605cdf0e10cSrcweir 		while( *ppAddStates )
606cdf0e10cSrcweir 		{
607cdf0e10cSrcweir 			xPropStates.push_back( **ppAddStates );
608cdf0e10cSrcweir 			++ppAddStates;
609cdf0e10cSrcweir 		}
610cdf0e10cSrcweir 	}
611cdf0e10cSrcweir 
612cdf0e10cSrcweir 	if( rPropSetHelper.hasProperty( NUMBERING_RULES_AUTO ) )
613cdf0e10cSrcweir 	{
614cdf0e10cSrcweir 		Reference < XIndexReplace > xNumRule(rPropSetHelper.getValue( NUMBERING_RULES_AUTO,
615cdf0e10cSrcweir             rPropSet, sal_True ), uno::UNO_QUERY);
616cdf0e10cSrcweir 		if( xNumRule.is() && xNumRule->getCount() )
617cdf0e10cSrcweir 		{
618cdf0e10cSrcweir 			Reference < XNamed > xNamed( xNumRule, UNO_QUERY );
619cdf0e10cSrcweir 			OUString sName;
620cdf0e10cSrcweir 			if( xNamed.is() )
621cdf0e10cSrcweir 				sName = xNamed->getName();
622cdf0e10cSrcweir 			sal_Bool bAdd = !sName.getLength();
623cdf0e10cSrcweir 			if( !bAdd )
624cdf0e10cSrcweir 			{
625cdf0e10cSrcweir 				Reference < XPropertySet > xNumPropSet( xNumRule,
626cdf0e10cSrcweir 														UNO_QUERY );
627cdf0e10cSrcweir                 const OUString sIsAutomatic( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) );
628cdf0e10cSrcweir 				if( xNumPropSet.is() &&
629cdf0e10cSrcweir 					xNumPropSet->getPropertySetInfo()
630cdf0e10cSrcweir 							   ->hasPropertyByName( sIsAutomatic ) )
631cdf0e10cSrcweir 				{
632cdf0e10cSrcweir 					bAdd = *(sal_Bool *)xNumPropSet->getPropertyValue( sIsAutomatic ).getValue();
633cdf0e10cSrcweir                     // --> OD 2007-01-12 #i73361# - check on outline style
634cdf0e10cSrcweir                     const OUString sNumberingIsOutline( RTL_CONSTASCII_USTRINGPARAM( "NumberingIsOutline" ) );
635cdf0e10cSrcweir                     if ( bAdd &&
636cdf0e10cSrcweir                          xNumPropSet->getPropertySetInfo()
637cdf0e10cSrcweir                                    ->hasPropertyByName( sNumberingIsOutline ) )
638cdf0e10cSrcweir                     {
639cdf0e10cSrcweir                         bAdd = !(*(sal_Bool *)xNumPropSet->getPropertyValue( sNumberingIsOutline ).getValue());
640cdf0e10cSrcweir                     }
641cdf0e10cSrcweir                     // <--
642cdf0e10cSrcweir 				}
643cdf0e10cSrcweir 				else
644cdf0e10cSrcweir 				{
645cdf0e10cSrcweir 					bAdd = sal_True;
646cdf0e10cSrcweir 				}
647cdf0e10cSrcweir 			}
648cdf0e10cSrcweir 			if( bAdd )
649cdf0e10cSrcweir 				pListAutoPool->Add( xNumRule );
650cdf0e10cSrcweir 		}
651cdf0e10cSrcweir 	}
652cdf0e10cSrcweir 
653cdf0e10cSrcweir 	if( !xPropStates.empty() )
654cdf0e10cSrcweir 	{
655cdf0e10cSrcweir 		OUString sParent, sCondParent;
656cdf0e10cSrcweir 		switch( nFamily )
657cdf0e10cSrcweir 		{
658cdf0e10cSrcweir 		case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
659cdf0e10cSrcweir 			if( rPropSetHelper.hasProperty( PARA_STYLE_NAME_AUTO ) )
660cdf0e10cSrcweir 			{
661cdf0e10cSrcweir 				rPropSetHelper.getValue( PARA_STYLE_NAME_AUTO, rPropSet,
662cdf0e10cSrcweir 												sal_True ) >>= sParent;
663cdf0e10cSrcweir 			}
664cdf0e10cSrcweir 			if( rPropSetHelper.hasProperty( PARA_CONDITIONAL_STYLE_NAME_AUTO ) )
665cdf0e10cSrcweir 			{
666cdf0e10cSrcweir 				rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME_AUTO,
667cdf0e10cSrcweir 											 	rPropSet, sal_True ) >>= sCondParent;
668cdf0e10cSrcweir 			}
669cdf0e10cSrcweir 
670cdf0e10cSrcweir 			break;
671cdf0e10cSrcweir 		}
672cdf0e10cSrcweir 
673cdf0e10cSrcweir         if( find_if( xPropStates.begin(), xPropStates.end(), lcl_validPropState ) != xPropStates.end() )
674cdf0e10cSrcweir 		{
675cdf0e10cSrcweir 			GetAutoStylePool().Add( nFamily, sParent, xPropStates );
676cdf0e10cSrcweir 			if( sCondParent.getLength() && sParent != sCondParent )
677cdf0e10cSrcweir 				GetAutoStylePool().Add( nFamily, sCondParent, xPropStates );
678cdf0e10cSrcweir 		}
679cdf0e10cSrcweir 	}
680cdf0e10cSrcweir }
681cdf0e10cSrcweir 
Find(sal_uInt16 nFamily,const Reference<XPropertySet> & rPropSet,const OUString & rParent,const XMLPropertyState ** ppAddStates) const682cdf0e10cSrcweir OUString XMLTextParagraphExport::Find(
683cdf0e10cSrcweir 		sal_uInt16 nFamily,
684cdf0e10cSrcweir 	   	const Reference < XPropertySet > & rPropSet,
685cdf0e10cSrcweir 		const OUString& rParent,
686cdf0e10cSrcweir 		const XMLPropertyState** ppAddStates) const
687cdf0e10cSrcweir {
688cdf0e10cSrcweir 	OUString sName( rParent );
689cdf0e10cSrcweir 	UniReference < SvXMLExportPropertyMapper > xPropMapper;
690cdf0e10cSrcweir 	switch( nFamily )
691cdf0e10cSrcweir 	{
692cdf0e10cSrcweir 	case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
693cdf0e10cSrcweir 		xPropMapper = GetParaPropMapper();
694cdf0e10cSrcweir 		break;
695cdf0e10cSrcweir 	case XML_STYLE_FAMILY_TEXT_FRAME:
696cdf0e10cSrcweir 		xPropMapper = GetAutoFramePropMapper();
697cdf0e10cSrcweir 		break;
698cdf0e10cSrcweir 	case XML_STYLE_FAMILY_TEXT_SECTION:
699cdf0e10cSrcweir 		xPropMapper = GetSectionPropMapper();
700cdf0e10cSrcweir 		break;
701cdf0e10cSrcweir 	case XML_STYLE_FAMILY_TEXT_RUBY:
702cdf0e10cSrcweir 		xPropMapper = GetRubyPropMapper();
703cdf0e10cSrcweir 		break;
704cdf0e10cSrcweir 	}
705cdf0e10cSrcweir 	DBG_ASSERT( xPropMapper.is(), "There is the property mapper?" );
706cdf0e10cSrcweir 	if( !xPropMapper.is() )
707cdf0e10cSrcweir 		return sName;
708cdf0e10cSrcweir 	vector< XMLPropertyState > xPropStates(xPropMapper->Filter( rPropSet ));
709cdf0e10cSrcweir 	if( ppAddStates )
710cdf0e10cSrcweir 	{
711cdf0e10cSrcweir 		while( *ppAddStates )
712cdf0e10cSrcweir 		{
713cdf0e10cSrcweir 			xPropStates.push_back( **ppAddStates );
714cdf0e10cSrcweir 			++ppAddStates;
715cdf0e10cSrcweir 		}
716cdf0e10cSrcweir 	}
717cdf0e10cSrcweir     if( find_if( xPropStates.begin(), xPropStates.end(), lcl_validPropState ) != xPropStates.end() )
718cdf0e10cSrcweir 		sName = GetAutoStylePool().Find( nFamily, sName, xPropStates );
719cdf0e10cSrcweir 
720cdf0e10cSrcweir 	return sName;
721cdf0e10cSrcweir }
722cdf0e10cSrcweir 
FindTextStyleAndHyperlink(const Reference<XPropertySet> & rPropSet,sal_Bool & rbHyperlink,sal_Bool & rbHasCharStyle,sal_Bool & rbHasAutoStyle,const XMLPropertyState ** ppAddStates) const723cdf0e10cSrcweir OUString XMLTextParagraphExport::FindTextStyleAndHyperlink(
724cdf0e10cSrcweir 	   	const Reference < XPropertySet > & rPropSet,
725cdf0e10cSrcweir         sal_Bool& rbHyperlink,
726cdf0e10cSrcweir         sal_Bool& rbHasCharStyle,
727cdf0e10cSrcweir         sal_Bool& rbHasAutoStyle,
728cdf0e10cSrcweir 		const XMLPropertyState** ppAddStates ) const
729cdf0e10cSrcweir {
730cdf0e10cSrcweir 	UniReference < SvXMLExportPropertyMapper > xPropMapper(GetTextPropMapper());
731cdf0e10cSrcweir 	vector< XMLPropertyState > xPropStates(xPropMapper->Filter( rPropSet ));
732cdf0e10cSrcweir 
733cdf0e10cSrcweir 	// Get parent and remove hyperlinks (they aren't of interest)
734cdf0e10cSrcweir 	OUString sName;
735cdf0e10cSrcweir     rbHyperlink = rbHasCharStyle = rbHasAutoStyle = sal_False;
736cdf0e10cSrcweir 	sal_uInt16 nIgnoreProps = 0;
737cdf0e10cSrcweir 	UniReference< XMLPropertySetMapper > xPM(xPropMapper->getPropertySetMapper());
738cdf0e10cSrcweir     ::std::vector< XMLPropertyState >::iterator aFirstDel = xPropStates.end();
739cdf0e10cSrcweir     ::std::vector< XMLPropertyState >::iterator aSecondDel = xPropStates.end();
740cdf0e10cSrcweir 
741cdf0e10cSrcweir 	for( ::std::vector< XMLPropertyState >::iterator
742cdf0e10cSrcweir 			i = xPropStates.begin();
743cdf0e10cSrcweir 		 nIgnoreProps < 2 && i != xPropStates.end();
744cdf0e10cSrcweir 		 i++ )
745cdf0e10cSrcweir 	{
746cdf0e10cSrcweir 		if( i->mnIndex == -1 )
747cdf0e10cSrcweir 			continue;
748cdf0e10cSrcweir 
749cdf0e10cSrcweir 		switch( xPM->GetEntryContextId(i->mnIndex) )
750cdf0e10cSrcweir 		{
751cdf0e10cSrcweir 		case CTF_CHAR_STYLE_NAME:
752cdf0e10cSrcweir 			i->maValue >>= sName;
753cdf0e10cSrcweir 			i->mnIndex = -1;
754cdf0e10cSrcweir             rbHasCharStyle = sName.getLength() > 0;
755cdf0e10cSrcweir             if( nIgnoreProps )
756cdf0e10cSrcweir                 aSecondDel = i;
757cdf0e10cSrcweir             else
758cdf0e10cSrcweir                 aFirstDel = i;
759cdf0e10cSrcweir 			nIgnoreProps++;
760cdf0e10cSrcweir 			break;
761cdf0e10cSrcweir 		case CTF_HYPERLINK_URL:
762cdf0e10cSrcweir             rbHyperlink = sal_True;
763cdf0e10cSrcweir 			i->mnIndex = -1;
764cdf0e10cSrcweir             if( nIgnoreProps )
765cdf0e10cSrcweir                 aSecondDel = i;
766cdf0e10cSrcweir             else
767cdf0e10cSrcweir                 aFirstDel = i;
768cdf0e10cSrcweir 			nIgnoreProps++;
769cdf0e10cSrcweir 			break;
770cdf0e10cSrcweir 		}
771cdf0e10cSrcweir 	}
772cdf0e10cSrcweir 	if( ppAddStates )
773cdf0e10cSrcweir 	{
774cdf0e10cSrcweir 		while( *ppAddStates )
775cdf0e10cSrcweir 		{
776cdf0e10cSrcweir 			xPropStates.push_back( **ppAddStates );
777cdf0e10cSrcweir 			ppAddStates++;
778cdf0e10cSrcweir 		}
779cdf0e10cSrcweir 	}
780cdf0e10cSrcweir 	if( (xPropStates.size() - nIgnoreProps) > 0L )
781cdf0e10cSrcweir     {
782cdf0e10cSrcweir         // erase the character style, otherwise the autostyle cannot be found!
783cdf0e10cSrcweir         // erase the hyperlink, otherwise the autostyle cannot be found!
784cdf0e10cSrcweir         if ( nIgnoreProps )
785cdf0e10cSrcweir         {
786cdf0e10cSrcweir             // If two elements of a vector have to be deleted,
787cdf0e10cSrcweir             // we should delete the second one first.
788cdf0e10cSrcweir             if( --nIgnoreProps )
789cdf0e10cSrcweir                 xPropStates.erase( aSecondDel );
790cdf0e10cSrcweir             xPropStates.erase( aFirstDel );
791cdf0e10cSrcweir         }
792cdf0e10cSrcweir         OUString sParent; // AutoStyles should not have parents!
793cdf0e10cSrcweir 		sName = GetAutoStylePool().Find( XML_STYLE_FAMILY_TEXT_TEXT, sParent, xPropStates );
794cdf0e10cSrcweir         DBG_ASSERT( sName.getLength(), "AutoStyle could not be found" );
795cdf0e10cSrcweir         rbHasAutoStyle = sal_True;
796cdf0e10cSrcweir     }
797cdf0e10cSrcweir 
798cdf0e10cSrcweir 	return sName;
799cdf0e10cSrcweir }
800cdf0e10cSrcweir 
FindTextStyle(const Reference<XPropertySet> & rPropSet,sal_Bool & rHasCharStyle) const801cdf0e10cSrcweir OUString XMLTextParagraphExport::FindTextStyle(
802cdf0e10cSrcweir 	   	const Reference < XPropertySet > & rPropSet,
803cdf0e10cSrcweir 		sal_Bool& rHasCharStyle ) const
804cdf0e10cSrcweir {
805cdf0e10cSrcweir     sal_Bool bDummy;
806cdf0e10cSrcweir     sal_Bool bDummy2;
807cdf0e10cSrcweir     return FindTextStyleAndHyperlink( rPropSet, bDummy, rHasCharStyle, bDummy2 );
808cdf0e10cSrcweir }
809cdf0e10cSrcweir 
810cdf0e10cSrcweir 
811cdf0e10cSrcweir // --> OD 2008-04-25 #refactorlists#
812cdf0e10cSrcweir // adjustments to support lists independent from list style
exportListChange(const XMLTextNumRuleInfo & rPrevInfo,const XMLTextNumRuleInfo & rNextInfo)813cdf0e10cSrcweir void XMLTextParagraphExport::exportListChange(
814cdf0e10cSrcweir 		const XMLTextNumRuleInfo& rPrevInfo,
815cdf0e10cSrcweir 	    const XMLTextNumRuleInfo& rNextInfo )
816cdf0e10cSrcweir {
817cdf0e10cSrcweir 	// end a list
818cdf0e10cSrcweir     if ( rPrevInfo.GetLevel() > 0 )
819cdf0e10cSrcweir     {
820cdf0e10cSrcweir         bool bRootListToBeClosed = false;
821cdf0e10cSrcweir         sal_Int16 nListLevelsToBeClosed = 0;
822cdf0e10cSrcweir         if ( !rNextInfo.BelongsToSameList( rPrevInfo ) ||
823cdf0e10cSrcweir              rNextInfo.GetLevel() <= 0 )
824cdf0e10cSrcweir         {
825cdf0e10cSrcweir             // close complete previous list
826cdf0e10cSrcweir             bRootListToBeClosed = true;
827cdf0e10cSrcweir             nListLevelsToBeClosed = rPrevInfo.GetLevel();
828cdf0e10cSrcweir         }
829cdf0e10cSrcweir         else if ( rPrevInfo.GetLevel() > rNextInfo.GetLevel() )
830cdf0e10cSrcweir         {
831cdf0e10cSrcweir             // close corresponding sub lists
832cdf0e10cSrcweir             DBG_ASSERT( rNextInfo.GetLevel() > 0,
833cdf0e10cSrcweir                         "<rPrevInfo.GetLevel() > 0> not hold. Serious defect -> please inform OD." );
834cdf0e10cSrcweir             nListLevelsToBeClosed = rPrevInfo.GetLevel() - rNextInfo.GetLevel();
835cdf0e10cSrcweir         }
836cdf0e10cSrcweir 
837cdf0e10cSrcweir         if ( nListLevelsToBeClosed > 0 &&
838cdf0e10cSrcweir              pListElements &&
839cdf0e10cSrcweir              pListElements->Count() >= ( 2 * nListLevelsToBeClosed ) )
840cdf0e10cSrcweir         {
841cdf0e10cSrcweir             do {
842cdf0e10cSrcweir                 for( sal_uInt16 j = 0; j < 2; ++j )
843cdf0e10cSrcweir                 {
844cdf0e10cSrcweir                     OUString *pElem = (*pListElements)[pListElements->Count()-1];
845cdf0e10cSrcweir                     pListElements->Remove( pListElements->Count()-1 );
846cdf0e10cSrcweir 
847cdf0e10cSrcweir                     GetExport().EndElement( *pElem, sal_True );
848cdf0e10cSrcweir 
849cdf0e10cSrcweir                     delete pElem;
850cdf0e10cSrcweir                 }
851cdf0e10cSrcweir 
852cdf0e10cSrcweir                 // remove closed list from list stack
853cdf0e10cSrcweir                 mpTextListsHelper->PopListFromStack();
854cdf0e10cSrcweir 
855cdf0e10cSrcweir                 --nListLevelsToBeClosed;
856cdf0e10cSrcweir             } while ( nListLevelsToBeClosed > 0 );
857cdf0e10cSrcweir         }
858cdf0e10cSrcweir     }
859cdf0e10cSrcweir 
860cdf0e10cSrcweir     const bool bExportODF =
861cdf0e10cSrcweir                 ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0;
862cdf0e10cSrcweir     const SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion =
863cdf0e10cSrcweir                                     GetExport().getDefaultVersion();
864cdf0e10cSrcweir 
865cdf0e10cSrcweir     // start a new list
866cdf0e10cSrcweir     if ( rNextInfo.GetLevel() > 0 )
867cdf0e10cSrcweir     {
868cdf0e10cSrcweir         bool bRootListToBeStarted = false;
869cdf0e10cSrcweir         sal_Int16 nListLevelsToBeOpened = 0;
870cdf0e10cSrcweir         if ( !rPrevInfo.BelongsToSameList( rNextInfo ) ||
871cdf0e10cSrcweir              rPrevInfo.GetLevel() <= 0 )
872cdf0e10cSrcweir         {
873cdf0e10cSrcweir             // new root list
874cdf0e10cSrcweir             bRootListToBeStarted = true;
875cdf0e10cSrcweir             nListLevelsToBeOpened = rNextInfo.GetLevel();
876cdf0e10cSrcweir         }
877cdf0e10cSrcweir         else if ( rNextInfo.GetLevel() > rPrevInfo.GetLevel() )
878cdf0e10cSrcweir         {
879cdf0e10cSrcweir             // open corresponding sub lists
880cdf0e10cSrcweir             DBG_ASSERT( rPrevInfo.GetLevel() > 0,
881cdf0e10cSrcweir                         "<rPrevInfo.GetLevel() > 0> not hold. Serious defect -> please inform OD." );
882cdf0e10cSrcweir             nListLevelsToBeOpened = rNextInfo.GetLevel() - rPrevInfo.GetLevel();
883cdf0e10cSrcweir         }
884cdf0e10cSrcweir 
885cdf0e10cSrcweir         if ( nListLevelsToBeOpened > 0 )
886cdf0e10cSrcweir         {
887cdf0e10cSrcweir             const ::rtl::OUString sListStyleName( rNextInfo.GetNumRulesName() );
888cdf0e10cSrcweir             // Currently only the text documents support <ListId>.
889cdf0e10cSrcweir             // Thus, for other document types <sListId> is empty.
890cdf0e10cSrcweir             const ::rtl::OUString sListId( rNextInfo.GetListId() );
891cdf0e10cSrcweir             bool bExportListStyle( true );
892cdf0e10cSrcweir             bool bRestartNumberingAtContinuedRootList( false );
893cdf0e10cSrcweir             sal_Int16 nRestartValueForContinuedRootList( -1 );
894cdf0e10cSrcweir             // --> OD 2008-11-26 #158694#
895cdf0e10cSrcweir             bool bContinueingPreviousSubList = !bRootListToBeStarted &&
896cdf0e10cSrcweir                                                rNextInfo.IsContinueingPreviousSubTree();
897cdf0e10cSrcweir             // <--
898cdf0e10cSrcweir             do {
899cdf0e10cSrcweir                 GetExport().CheckAttrList();
900cdf0e10cSrcweir 
901cdf0e10cSrcweir                 if ( bRootListToBeStarted )
902cdf0e10cSrcweir                 {
903cdf0e10cSrcweir                     if ( !mpTextListsHelper->IsListProcessed( sListId ) )
904cdf0e10cSrcweir                     {
905cdf0e10cSrcweir                         if ( bExportODF &&
906cdf0e10cSrcweir                              eODFDefaultVersion >= SvtSaveOptions::ODFVER_012 &&
907cdf0e10cSrcweir                              sListId.getLength() > 0 )
908cdf0e10cSrcweir                         {
909cdf0e10cSrcweir                             // --> OD 2008-07-31 #i92221#
910cdf0e10cSrcweir                             GetExport().AddAttribute( XML_NAMESPACE_XML,
911cdf0e10cSrcweir                                                       XML_ID,
912cdf0e10cSrcweir                                                       sListId );
913cdf0e10cSrcweir                             // <--
914cdf0e10cSrcweir                         }
915cdf0e10cSrcweir                         mpTextListsHelper->KeepListAsProcessed( sListId,
916cdf0e10cSrcweir                                                                 sListStyleName,
917cdf0e10cSrcweir                                                                 ::rtl::OUString() );
918cdf0e10cSrcweir                     }
919cdf0e10cSrcweir                     else
920cdf0e10cSrcweir                     {
921cdf0e10cSrcweir                         const ::rtl::OUString sNewListId(
922cdf0e10cSrcweir                                         mpTextListsHelper->GenerateNewListId() );
923cdf0e10cSrcweir                         if ( bExportODF &&
924cdf0e10cSrcweir                              eODFDefaultVersion >= SvtSaveOptions::ODFVER_012 &&
925cdf0e10cSrcweir                              sListId.getLength() > 0 )
926cdf0e10cSrcweir                         {
927cdf0e10cSrcweir                             // --> OD 2008-07-31 #i92221#
928cdf0e10cSrcweir                             GetExport().AddAttribute( XML_NAMESPACE_XML,
929cdf0e10cSrcweir                                                       XML_ID,
930cdf0e10cSrcweir                                                       sNewListId );
931cdf0e10cSrcweir                             // <--
932cdf0e10cSrcweir                         }
933cdf0e10cSrcweir 
934cdf0e10cSrcweir                         const ::rtl::OUString sContinueListId =
935cdf0e10cSrcweir                             mpTextListsHelper->GetLastContinuingListId( sListId );
936cdf0e10cSrcweir                         // store that list with list id <sNewListId> is last list,
937cdf0e10cSrcweir                         // which has continued list with list id <sListId>
938cdf0e10cSrcweir                         mpTextListsHelper->StoreLastContinuingList( sListId,
939cdf0e10cSrcweir                                                                     sNewListId );
940cdf0e10cSrcweir                         if ( sListStyleName ==
941cdf0e10cSrcweir                                 mpTextListsHelper->GetListStyleOfLastProcessedList() &&
942cdf0e10cSrcweir                              // --> OD 2008-08-15 #i92811#
943cdf0e10cSrcweir                              sContinueListId ==
944cdf0e10cSrcweir                                 mpTextListsHelper->GetLastProcessedListId() &&
945cdf0e10cSrcweir                              // <--
946cdf0e10cSrcweir                              !rNextInfo.IsRestart() )
947cdf0e10cSrcweir                         {
948cdf0e10cSrcweir                             GetExport().AddAttribute( XML_NAMESPACE_TEXT,
949cdf0e10cSrcweir                                                       XML_CONTINUE_NUMBERING,
950cdf0e10cSrcweir                                                       XML_TRUE );
951cdf0e10cSrcweir                         }
952cdf0e10cSrcweir                         else
953cdf0e10cSrcweir                         {
954cdf0e10cSrcweir                             if ( bExportODF &&
955cdf0e10cSrcweir                                  eODFDefaultVersion >= SvtSaveOptions::ODFVER_012 &&
956cdf0e10cSrcweir                                  sListId.getLength() > 0 )
957cdf0e10cSrcweir                             {
958cdf0e10cSrcweir                                 GetExport().AddAttribute( XML_NAMESPACE_TEXT,
959cdf0e10cSrcweir                                                           XML_CONTINUE_LIST,
960cdf0e10cSrcweir                                                           sContinueListId );
961cdf0e10cSrcweir                             }
962cdf0e10cSrcweir 
963cdf0e10cSrcweir                             if ( rNextInfo.IsRestart() &&
964cdf0e10cSrcweir                                  ( nListLevelsToBeOpened != 1 ||
965cdf0e10cSrcweir                                    !rNextInfo.HasStartValue() ) )
966cdf0e10cSrcweir                             {
967cdf0e10cSrcweir                                 bRestartNumberingAtContinuedRootList = true;
968cdf0e10cSrcweir                                 nRestartValueForContinuedRootList =
969cdf0e10cSrcweir                                                 rNextInfo.GetListLevelStartValue();
970cdf0e10cSrcweir                             }
971cdf0e10cSrcweir                         }
972cdf0e10cSrcweir 
973cdf0e10cSrcweir                         mpTextListsHelper->KeepListAsProcessed( sNewListId,
974cdf0e10cSrcweir                                                                 sListStyleName,
975cdf0e10cSrcweir                                                                 sContinueListId );
976cdf0e10cSrcweir                     }
977cdf0e10cSrcweir 
978cdf0e10cSrcweir                     GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
979cdf0e10cSrcweir                             GetExport().EncodeStyleName( sListStyleName ) );
980cdf0e10cSrcweir                     bExportListStyle = false;
981cdf0e10cSrcweir 
982cdf0e10cSrcweir                     bRootListToBeStarted = false;
983cdf0e10cSrcweir                 }
984cdf0e10cSrcweir                 else if ( bExportListStyle &&
985cdf0e10cSrcweir                           !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) )
986cdf0e10cSrcweir                 {
987cdf0e10cSrcweir                     GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
988cdf0e10cSrcweir                             GetExport().EncodeStyleName( sListStyleName ) );
989cdf0e10cSrcweir                     bExportListStyle = false;
990cdf0e10cSrcweir                 }
991cdf0e10cSrcweir 
992cdf0e10cSrcweir                 // --> OD 2008-11-26 #158694#
993cdf0e10cSrcweir                 if ( bContinueingPreviousSubList )
994cdf0e10cSrcweir                 {
995cdf0e10cSrcweir                     GetExport().AddAttribute( XML_NAMESPACE_TEXT,
996cdf0e10cSrcweir                                               XML_CONTINUE_NUMBERING, XML_TRUE );
997cdf0e10cSrcweir                     bContinueingPreviousSubList = false;
998cdf0e10cSrcweir                 }
999cdf0e10cSrcweir                 // <--
1000cdf0e10cSrcweir 
1001cdf0e10cSrcweir                 enum XMLTokenEnum eLName = XML_LIST;
1002cdf0e10cSrcweir 
1003cdf0e10cSrcweir                 OUString *pElem = new OUString(
1004cdf0e10cSrcweir                         GetExport().GetNamespaceMap().GetQNameByKey(
1005cdf0e10cSrcweir                                             XML_NAMESPACE_TEXT,
1006cdf0e10cSrcweir                                             GetXMLToken(eLName) ) );
1007cdf0e10cSrcweir                 GetExport().IgnorableWhitespace();
1008cdf0e10cSrcweir                 GetExport().StartElement( *pElem, sal_False );
1009cdf0e10cSrcweir 
1010cdf0e10cSrcweir                 if( !pListElements )
1011cdf0e10cSrcweir                     pListElements = new OUStrings_Impl;
1012cdf0e10cSrcweir                 pListElements->Insert( pElem, pListElements->Count() );
1013cdf0e10cSrcweir 
1014cdf0e10cSrcweir                 mpTextListsHelper->PushListOnStack( sListId,
1015cdf0e10cSrcweir                                                     sListStyleName );
1016cdf0e10cSrcweir 
1017cdf0e10cSrcweir                 // <text:list-header> or <text:list-item>
1018cdf0e10cSrcweir                 GetExport().CheckAttrList();
1019cdf0e10cSrcweir 
1020cdf0e10cSrcweir                 // --> OD 2009-06-24 #i97309#
1021cdf0e10cSrcweir                 // export start value in case of <bRestartNumberingAtContinuedRootList>
1022cdf0e10cSrcweir                 // at correct list item
1023cdf0e10cSrcweir                 if ( nListLevelsToBeOpened == 1 )
1024cdf0e10cSrcweir                 {
1025cdf0e10cSrcweir                     if ( rNextInfo.HasStartValue() )
1026cdf0e10cSrcweir                     {
1027cdf0e10cSrcweir                         OUStringBuffer aBuffer;
1028cdf0e10cSrcweir                         aBuffer.append( (sal_Int32)rNextInfo.GetStartValue() );
1029cdf0e10cSrcweir                         GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
1030cdf0e10cSrcweir                                       aBuffer.makeStringAndClear() );
1031cdf0e10cSrcweir                     }
1032cdf0e10cSrcweir                     else if ( bRestartNumberingAtContinuedRootList )
1033cdf0e10cSrcweir                     {
1034cdf0e10cSrcweir                         OUStringBuffer aBuffer;
1035cdf0e10cSrcweir                         aBuffer.append( (sal_Int32)nRestartValueForContinuedRootList );
1036cdf0e10cSrcweir                         GetExport().AddAttribute( XML_NAMESPACE_TEXT,
1037cdf0e10cSrcweir                                                   XML_START_VALUE,
1038cdf0e10cSrcweir                                                   aBuffer.makeStringAndClear() );
1039cdf0e10cSrcweir                         bRestartNumberingAtContinuedRootList = false;
1040cdf0e10cSrcweir                     }
1041cdf0e10cSrcweir                 }
1042cdf0e10cSrcweir                 // <--
1043cdf0e10cSrcweir 
1044cdf0e10cSrcweir                 eLName = ( rNextInfo.IsNumbered() || nListLevelsToBeOpened > 1 )
1045cdf0e10cSrcweir                          ? XML_LIST_ITEM
1046cdf0e10cSrcweir                          : XML_LIST_HEADER;
1047cdf0e10cSrcweir                 pElem = new OUString(  GetExport().GetNamespaceMap().GetQNameByKey(
1048cdf0e10cSrcweir                                             XML_NAMESPACE_TEXT,
1049cdf0e10cSrcweir                                             GetXMLToken(eLName) ) );
1050cdf0e10cSrcweir                 GetExport().IgnorableWhitespace();
1051cdf0e10cSrcweir                 GetExport().StartElement( *pElem, sal_False );
1052cdf0e10cSrcweir 
1053cdf0e10cSrcweir                 pListElements->Insert( pElem, pListElements->Count() );
1054cdf0e10cSrcweir 
1055cdf0e10cSrcweir                 // --> OD 2008-11-26 #158694#
1056cdf0e10cSrcweir                 // export of <text:number> element for last opened <text:list-item>, if requested
1057cdf0e10cSrcweir                 if ( GetExport().exportTextNumberElement() &&
1058cdf0e10cSrcweir                      eLName == XML_LIST_ITEM && nListLevelsToBeOpened == 1 && // last iteration --> last opened <text:list-item>
1059cdf0e10cSrcweir                      rNextInfo.ListLabelString().getLength() > 0 )
1060cdf0e10cSrcweir                 {
1061cdf0e10cSrcweir                     const ::rtl::OUString aTextNumberElem =
1062cdf0e10cSrcweir                             OUString( GetExport().GetNamespaceMap().GetQNameByKey(
1063cdf0e10cSrcweir                                       XML_NAMESPACE_TEXT,
1064cdf0e10cSrcweir                                       GetXMLToken(XML_NUMBER) ) );
1065cdf0e10cSrcweir                     GetExport().IgnorableWhitespace();
1066cdf0e10cSrcweir                     GetExport().StartElement( aTextNumberElem, sal_False );
1067cdf0e10cSrcweir                     GetExport().Characters( rNextInfo.ListLabelString() );
1068cdf0e10cSrcweir                     GetExport().EndElement( aTextNumberElem, sal_True );
1069cdf0e10cSrcweir                 }
1070cdf0e10cSrcweir                 // <--
1071cdf0e10cSrcweir 
1072cdf0e10cSrcweir                 --nListLevelsToBeOpened;
1073cdf0e10cSrcweir             } while ( nListLevelsToBeOpened > 0 );
1074cdf0e10cSrcweir         }
1075cdf0e10cSrcweir 	}
1076cdf0e10cSrcweir 
1077cdf0e10cSrcweir     if ( rNextInfo.GetLevel() > 0 &&
1078cdf0e10cSrcweir          rNextInfo.IsNumbered() &&
1079cdf0e10cSrcweir          rPrevInfo.BelongsToSameList( rNextInfo ) &&
1080cdf0e10cSrcweir          rPrevInfo.GetLevel() >= rNextInfo.GetLevel() )
1081cdf0e10cSrcweir 	{
1082cdf0e10cSrcweir         // close previous list-item
1083cdf0e10cSrcweir         DBG_ASSERT( pListElements && pListElements->Count() >= 2,
1084cdf0e10cSrcweir 				"SwXMLExport::ExportListChange: list elements missing" );
1085cdf0e10cSrcweir 
1086cdf0e10cSrcweir 		OUString *pElem = (*pListElements)[pListElements->Count()-1];
1087cdf0e10cSrcweir 		GetExport().EndElement( *pElem, sal_True );
1088cdf0e10cSrcweir 
1089cdf0e10cSrcweir 		pListElements->Remove( pListElements->Count()-1 );
1090cdf0e10cSrcweir 		delete pElem;
1091cdf0e10cSrcweir 
1092cdf0e10cSrcweir         // --> OD 2009-11-12 #i103745# - only for sub lists
1093cdf0e10cSrcweir         if ( rNextInfo.IsRestart() && !rNextInfo.HasStartValue() &&
1094cdf0e10cSrcweir              rNextInfo.GetLevel() != 1 )
1095cdf0e10cSrcweir         // <--
1096cdf0e10cSrcweir         {
1097cdf0e10cSrcweir             // start new sub list respectively list on same list level
1098cdf0e10cSrcweir             pElem = (*pListElements)[pListElements->Count()-1];
1099cdf0e10cSrcweir             GetExport().EndElement( *pElem, sal_True );
1100cdf0e10cSrcweir             GetExport().IgnorableWhitespace();
1101cdf0e10cSrcweir             GetExport().StartElement( *pElem, sal_False );
1102cdf0e10cSrcweir         }
1103cdf0e10cSrcweir 
1104cdf0e10cSrcweir         // open new list-item
1105cdf0e10cSrcweir 		GetExport().CheckAttrList();
1106cdf0e10cSrcweir 		if( rNextInfo.HasStartValue() )
1107cdf0e10cSrcweir 		{
1108cdf0e10cSrcweir 			OUStringBuffer aBuffer;
1109cdf0e10cSrcweir 			aBuffer.append( (sal_Int32)rNextInfo.GetStartValue() );
1110cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
1111cdf0e10cSrcweir                                       aBuffer.makeStringAndClear() );
1112cdf0e10cSrcweir 		}
1113cdf0e10cSrcweir         // --> OD 2009-11-12 #i103745# - handle restart without start value on list level 1
1114cdf0e10cSrcweir         else if ( rNextInfo.IsRestart() && /*!rNextInfo.HasStartValue() &&*/
1115cdf0e10cSrcweir                   rNextInfo.GetLevel() == 1 )
1116cdf0e10cSrcweir         {
1117cdf0e10cSrcweir             OUStringBuffer aBuffer;
1118cdf0e10cSrcweir             aBuffer.append( (sal_Int32)rNextInfo.GetListLevelStartValue() );
1119cdf0e10cSrcweir             GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
1120cdf0e10cSrcweir                                       aBuffer.makeStringAndClear() );
1121cdf0e10cSrcweir         }
1122cdf0e10cSrcweir         // <--
1123cdf0e10cSrcweir         if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0 &&
1124cdf0e10cSrcweir              GetExport().getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
1125cdf0e10cSrcweir         {
1126cdf0e10cSrcweir             const ::rtl::OUString sListStyleName( rNextInfo.GetNumRulesName() );
1127cdf0e10cSrcweir             if ( !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) )
1128cdf0e10cSrcweir             {
1129cdf0e10cSrcweir                 GetExport().AddAttribute( XML_NAMESPACE_TEXT,
1130cdf0e10cSrcweir                                           XML_STYLE_OVERRIDE,
1131cdf0e10cSrcweir                                           GetExport().EncodeStyleName( sListStyleName ) );
1132cdf0e10cSrcweir             }
1133cdf0e10cSrcweir         }
1134cdf0e10cSrcweir 		pElem = new OUString( GetExport().GetNamespaceMap().GetQNameByKey(
1135cdf0e10cSrcweir 								XML_NAMESPACE_TEXT,
1136cdf0e10cSrcweir 								GetXMLToken(XML_LIST_ITEM) ) );
1137cdf0e10cSrcweir 		GetExport().IgnorableWhitespace();
1138cdf0e10cSrcweir 		GetExport().StartElement( *pElem, sal_False );
1139cdf0e10cSrcweir 
1140cdf0e10cSrcweir 		pListElements->Insert( pElem, pListElements->Count() );
1141cdf0e10cSrcweir 
1142cdf0e10cSrcweir         // --> OD 2008-11-26 #158694#
1143cdf0e10cSrcweir         // export of <text:number> element for <text:list-item>, if requested
1144cdf0e10cSrcweir         if ( GetExport().exportTextNumberElement() &&
1145cdf0e10cSrcweir              rNextInfo.ListLabelString().getLength() > 0 )
1146cdf0e10cSrcweir         {
1147cdf0e10cSrcweir             const ::rtl::OUString aTextNumberElem =
1148cdf0e10cSrcweir                     OUString( GetExport().GetNamespaceMap().GetQNameByKey(
1149cdf0e10cSrcweir                               XML_NAMESPACE_TEXT,
1150cdf0e10cSrcweir                               GetXMLToken(XML_NUMBER) ) );
1151cdf0e10cSrcweir             GetExport().IgnorableWhitespace();
1152cdf0e10cSrcweir             GetExport().StartElement( aTextNumberElem, sal_False );
1153cdf0e10cSrcweir             GetExport().Characters( rNextInfo.ListLabelString() );
1154cdf0e10cSrcweir             GetExport().EndElement( aTextNumberElem, sal_True );
1155cdf0e10cSrcweir         }
1156cdf0e10cSrcweir         // <--
1157cdf0e10cSrcweir     }
1158cdf0e10cSrcweir }
1159cdf0e10cSrcweir // <--
1160cdf0e10cSrcweir 
XMLTextParagraphExport(SvXMLExport & rExp,SvXMLAutoStylePoolP & rASP)1161cdf0e10cSrcweir XMLTextParagraphExport::XMLTextParagraphExport(
1162cdf0e10cSrcweir 		SvXMLExport& rExp,
1163cdf0e10cSrcweir 		SvXMLAutoStylePoolP & rASP
1164cdf0e10cSrcweir 	    ) :
1165cdf0e10cSrcweir 	XMLStyleExport( rExp, OUString(), &rASP ),
1166cdf0e10cSrcweir 	rAutoStylePool( rASP ),
1167cdf0e10cSrcweir     pBoundFrameSets(new BoundFrameSets(GetExport().GetModel())),
1168cdf0e10cSrcweir 	pFieldExport( 0 ),
1169cdf0e10cSrcweir 	pListElements( 0 ),
1170cdf0e10cSrcweir     // --> OD 2008-05-07 #refactorlists# - no longer needed
1171cdf0e10cSrcweir //    pExportedLists( 0 ),
1172cdf0e10cSrcweir     // <--
1173cdf0e10cSrcweir 	pListAutoPool( new XMLTextListAutoStylePool( this->GetExport() ) ),
1174cdf0e10cSrcweir 	pSectionExport( NULL ),
1175cdf0e10cSrcweir 	pIndexMarkExport( NULL ),
1176cdf0e10cSrcweir 
1177cdf0e10cSrcweir 	pRedlineExport( NULL ),
1178cdf0e10cSrcweir 	pHeadingStyles( NULL ),
1179cdf0e10cSrcweir 
1180cdf0e10cSrcweir 	bProgress( sal_False ),
1181cdf0e10cSrcweir 	bBlock( sal_False ),
1182cdf0e10cSrcweir 
1183cdf0e10cSrcweir 	bOpenRuby( sal_False ),
1184cdf0e10cSrcweir     // --> OD 2008-04-25 #refactorlists#
1185cdf0e10cSrcweir     mpTextListsHelper( 0 ),
1186cdf0e10cSrcweir     maTextListsHelperStack(),
1187cdf0e10cSrcweir     // <--
1188cdf0e10cSrcweir 
1189cdf0e10cSrcweir 	sActualSize(RTL_CONSTASCII_USTRINGPARAM("ActualSize")),
1190cdf0e10cSrcweir     // --> OD 2009-07-22 #i73249#
1191cdf0e10cSrcweir //    sAlternativeText(RTL_CONSTASCII_USTRINGPARAM("AlternativeText")),
1192cdf0e10cSrcweir     sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")),
1193cdf0e10cSrcweir     sDescription(RTL_CONSTASCII_USTRINGPARAM("Description")),
1194cdf0e10cSrcweir     // <--
1195cdf0e10cSrcweir 	sAnchorCharStyleName(RTL_CONSTASCII_USTRINGPARAM("AnchorCharStyleName")),
1196cdf0e10cSrcweir 	sAnchorPageNo(RTL_CONSTASCII_USTRINGPARAM("AnchorPageNo")),
1197cdf0e10cSrcweir 	sAnchorType(RTL_CONSTASCII_USTRINGPARAM("AnchorType")),
1198cdf0e10cSrcweir 	sBeginNotice(RTL_CONSTASCII_USTRINGPARAM("BeginNotice")),
1199cdf0e10cSrcweir 	sBookmark(RTL_CONSTASCII_USTRINGPARAM("Bookmark")),
1200cdf0e10cSrcweir 	sCategory(RTL_CONSTASCII_USTRINGPARAM("Category")),
1201cdf0e10cSrcweir 	sChainNextName(RTL_CONSTASCII_USTRINGPARAM("ChainNextName")),
1202cdf0e10cSrcweir 	sCharStyleName(RTL_CONSTASCII_USTRINGPARAM("CharStyleName")),
1203cdf0e10cSrcweir 	sCharStyleNames(RTL_CONSTASCII_USTRINGPARAM("CharStyleNames")),
1204cdf0e10cSrcweir 	sContourPolyPolygon(RTL_CONSTASCII_USTRINGPARAM("ContourPolyPolygon")),
1205cdf0e10cSrcweir 	sDocumentIndex(RTL_CONSTASCII_USTRINGPARAM("DocumentIndex")),
1206cdf0e10cSrcweir 	sDocumentIndexMark(RTL_CONSTASCII_USTRINGPARAM("DocumentIndexMark")),
1207cdf0e10cSrcweir 	sEndNotice(RTL_CONSTASCII_USTRINGPARAM("EndNotice")),
1208cdf0e10cSrcweir 	sFootnote(RTL_CONSTASCII_USTRINGPARAM("Footnote")),
1209cdf0e10cSrcweir 	sFootnoteCounting(RTL_CONSTASCII_USTRINGPARAM("FootnoteCounting")),
1210cdf0e10cSrcweir 	sFrame(RTL_CONSTASCII_USTRINGPARAM("Frame")),
1211cdf0e10cSrcweir 	sFrameHeightAbsolute(RTL_CONSTASCII_USTRINGPARAM("FrameHeightAbsolute")),
1212cdf0e10cSrcweir 	sFrameHeightPercent(RTL_CONSTASCII_USTRINGPARAM("FrameHeightPercent")),
1213cdf0e10cSrcweir 	sFrameStyleName(RTL_CONSTASCII_USTRINGPARAM("FrameStyleName")),
1214cdf0e10cSrcweir 	sFrameWidthAbsolute(RTL_CONSTASCII_USTRINGPARAM("FrameWidthAbsolute")),
1215cdf0e10cSrcweir 	sFrameWidthPercent(RTL_CONSTASCII_USTRINGPARAM("FrameWidthPercent")),
1216cdf0e10cSrcweir 	sGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("GraphicFilter")),
1217cdf0e10cSrcweir 	sGraphicRotation(RTL_CONSTASCII_USTRINGPARAM("GraphicRotation")),
1218cdf0e10cSrcweir 	sGraphicURL(RTL_CONSTASCII_USTRINGPARAM("GraphicURL")),
1219ddde725dSArmin Le Grand 	sReplacementGraphicURL(RTL_CONSTASCII_USTRINGPARAM("ReplacementGraphicURL")),
1220cdf0e10cSrcweir 	sHeight(RTL_CONSTASCII_USTRINGPARAM("Height")),
1221cdf0e10cSrcweir 	sHoriOrient(RTL_CONSTASCII_USTRINGPARAM("HoriOrient")),
1222cdf0e10cSrcweir 	sHoriOrientPosition(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")),
1223cdf0e10cSrcweir 	sHyperLinkName(RTL_CONSTASCII_USTRINGPARAM("HyperLinkName")),
1224cdf0e10cSrcweir 	sHyperLinkTarget(RTL_CONSTASCII_USTRINGPARAM("HyperLinkTarget")),
1225cdf0e10cSrcweir 	sHyperLinkURL(RTL_CONSTASCII_USTRINGPARAM("HyperLinkURL")),
1226cdf0e10cSrcweir 	sIsAutomaticContour(RTL_CONSTASCII_USTRINGPARAM("IsAutomaticContour")),
1227cdf0e10cSrcweir 	sIsCollapsed(RTL_CONSTASCII_USTRINGPARAM("IsCollapsed")),
1228cdf0e10cSrcweir 	sIsPixelContour(RTL_CONSTASCII_USTRINGPARAM("IsPixelContour")),
1229cdf0e10cSrcweir 	sIsStart(RTL_CONSTASCII_USTRINGPARAM("IsStart")),
1230cdf0e10cSrcweir 	sIsSyncHeightToWidth(RTL_CONSTASCII_USTRINGPARAM("IsSyncHeightToWidth")),
1231cdf0e10cSrcweir 	sIsSyncWidthToHeight(RTL_CONSTASCII_USTRINGPARAM("IsSyncWidthToHeight")),
1232cdf0e10cSrcweir 	sNumberingRules(RTL_CONSTASCII_USTRINGPARAM("NumberingRules")),
1233cdf0e10cSrcweir 	sNumberingType(RTL_CONSTASCII_USTRINGPARAM("NumberingType")),
1234cdf0e10cSrcweir 	sPageDescName(RTL_CONSTASCII_USTRINGPARAM("PageDescName")),
1235cdf0e10cSrcweir 	sPageStyleName(RTL_CONSTASCII_USTRINGPARAM("PageStyleName")),
1236cdf0e10cSrcweir 	sParaChapterNumberingLevel(RTL_CONSTASCII_USTRINGPARAM("ParaChapterNumberingLevel")),
1237cdf0e10cSrcweir 	sParaConditionalStyleName(RTL_CONSTASCII_USTRINGPARAM("ParaConditionalStyleName")),
1238cdf0e10cSrcweir 	sParagraphService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph")),
1239cdf0e10cSrcweir 	sParaStyleName(RTL_CONSTASCII_USTRINGPARAM("ParaStyleName")),
1240cdf0e10cSrcweir 	sPositionEndOfDoc(RTL_CONSTASCII_USTRINGPARAM("PositionEndOfDoc")),
1241cdf0e10cSrcweir 	sPrefix(RTL_CONSTASCII_USTRINGPARAM("Prefix")),
1242cdf0e10cSrcweir 	sRedline(RTL_CONSTASCII_USTRINGPARAM("Redline")),
1243cdf0e10cSrcweir 	sReferenceId(RTL_CONSTASCII_USTRINGPARAM("ReferenceId")),
1244cdf0e10cSrcweir 	sReferenceMark(RTL_CONSTASCII_USTRINGPARAM("ReferenceMark")),
1245cdf0e10cSrcweir 	sRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("RelativeHeight")),
1246cdf0e10cSrcweir 	sRelativeWidth(RTL_CONSTASCII_USTRINGPARAM("RelativeWidth")),
1247cdf0e10cSrcweir 	sRuby(RTL_CONSTASCII_USTRINGPARAM("Ruby")),
1248cdf0e10cSrcweir 	sRubyAdjust(RTL_CONSTASCII_USTRINGPARAM("RubyAdjust")),
1249cdf0e10cSrcweir 	sRubyCharStyleName(RTL_CONSTASCII_USTRINGPARAM("RubyCharStyleName")),
1250cdf0e10cSrcweir 	sRubyText(RTL_CONSTASCII_USTRINGPARAM("RubyText")),
1251cdf0e10cSrcweir 	sServerMap(RTL_CONSTASCII_USTRINGPARAM("ServerMap")),
1252cdf0e10cSrcweir 	sShapeService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Shape")),
1253cdf0e10cSrcweir 	sSizeType(RTL_CONSTASCII_USTRINGPARAM("SizeType")),
1254cdf0e10cSrcweir 	sSoftPageBreak( RTL_CONSTASCII_USTRINGPARAM( "SoftPageBreak" ) ),
1255cdf0e10cSrcweir 	sStartAt(RTL_CONSTASCII_USTRINGPARAM("StartAt")),
1256cdf0e10cSrcweir 	sSuffix(RTL_CONSTASCII_USTRINGPARAM("Suffix")),
1257cdf0e10cSrcweir 	sTableService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable")),
1258cdf0e10cSrcweir 	sText(RTL_CONSTASCII_USTRINGPARAM("Text")),
1259cdf0e10cSrcweir 	sTextContentService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextContent")),
1260cdf0e10cSrcweir 	sTextEmbeddedService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextEmbeddedObject")),
1261cdf0e10cSrcweir 	sTextEndnoteService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Endnote")),
1262cdf0e10cSrcweir 	sTextField(RTL_CONSTASCII_USTRINGPARAM("TextField")),
1263cdf0e10cSrcweir 	sTextFieldService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextField")),
1264cdf0e10cSrcweir 	sTextFrameService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame")),
1265cdf0e10cSrcweir 	sTextGraphicService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextGraphicObject")),
1266cdf0e10cSrcweir 	sTextPortionType(RTL_CONSTASCII_USTRINGPARAM("TextPortionType")),
1267cdf0e10cSrcweir 	sTextSection(RTL_CONSTASCII_USTRINGPARAM("TextSection")),
1268cdf0e10cSrcweir 	sUnvisitedCharStyleName(RTL_CONSTASCII_USTRINGPARAM("UnvisitedCharStyleName")),
1269cdf0e10cSrcweir 	sVertOrient(RTL_CONSTASCII_USTRINGPARAM("VertOrient")),
1270cdf0e10cSrcweir 	sVertOrientPosition(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition")),
1271cdf0e10cSrcweir 	sVisitedCharStyleName(RTL_CONSTASCII_USTRINGPARAM("VisitedCharStyleName")),
1272cdf0e10cSrcweir 	sWidth(RTL_CONSTASCII_USTRINGPARAM("Width")),
1273cdf0e10cSrcweir 	sWidthType( RTL_CONSTASCII_USTRINGPARAM( "WidthType" ) ),
1274cdf0e10cSrcweir 	sTextFieldStart( RTL_CONSTASCII_USTRINGPARAM( "TextFieldStart" ) ),
1275cdf0e10cSrcweir 	sTextFieldEnd( RTL_CONSTASCII_USTRINGPARAM( "TextFieldEnd" ) ),
1276cdf0e10cSrcweir 	sTextFieldStartEnd( RTL_CONSTASCII_USTRINGPARAM( "TextFieldStartEnd" ) ),
1277cdf0e10cSrcweir 	aCharStyleNamesPropInfoCache( sCharStyleNames )
1278cdf0e10cSrcweir {
1279cdf0e10cSrcweir 	UniReference < XMLPropertySetMapper > xPropMapper(new XMLTextPropertySetMapper( TEXT_PROP_MAP_PARA ));
1280cdf0e10cSrcweir 	xParaPropMapper = new XMLTextExportPropertySetMapper( xPropMapper,
1281cdf0e10cSrcweir 								   						  GetExport() );
1282cdf0e10cSrcweir 
1283cdf0e10cSrcweir 	OUString sFamily( GetXMLToken(XML_PARAGRAPH) );
1284cdf0e10cSrcweir 	OUString aPrefix( String( 'P' ) );
1285cdf0e10cSrcweir 	rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_PARAGRAPH, sFamily,
1286cdf0e10cSrcweir 							  xParaPropMapper, aPrefix );
1287cdf0e10cSrcweir 
1288cdf0e10cSrcweir 	xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT );
1289cdf0e10cSrcweir 	xTextPropMapper = new XMLTextExportPropertySetMapper( xPropMapper,
1290cdf0e10cSrcweir 								   						  GetExport() );
1291cdf0e10cSrcweir 	sFamily = OUString( GetXMLToken(XML_TEXT) );
1292cdf0e10cSrcweir 	aPrefix = OUString( String( 'T' ) );
1293cdf0e10cSrcweir 	rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_TEXT, sFamily,
1294cdf0e10cSrcweir 							  xTextPropMapper, aPrefix );
1295cdf0e10cSrcweir 
1296cdf0e10cSrcweir 	xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_AUTO_FRAME );
1297cdf0e10cSrcweir 	xAutoFramePropMapper = new XMLTextExportPropertySetMapper( xPropMapper,
1298cdf0e10cSrcweir 								   							   GetExport() );
1299cdf0e10cSrcweir 	sFamily = OUString( RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME) );
1300cdf0e10cSrcweir 	aPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM( "fr" ) );
1301cdf0e10cSrcweir 	rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_FRAME, sFamily,
1302cdf0e10cSrcweir 							  xAutoFramePropMapper, aPrefix );
1303cdf0e10cSrcweir 
1304cdf0e10cSrcweir 	xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_SECTION );
1305cdf0e10cSrcweir 	xSectionPropMapper = new XMLTextExportPropertySetMapper( xPropMapper,
1306cdf0e10cSrcweir 															 GetExport() );
1307cdf0e10cSrcweir 	sFamily = OUString( GetXMLToken( XML_SECTION ) );
1308cdf0e10cSrcweir 	aPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM( "Sect" ) );
1309cdf0e10cSrcweir 	rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_SECTION, sFamily,
1310cdf0e10cSrcweir 							  xSectionPropMapper, aPrefix );
1311cdf0e10cSrcweir 
1312cdf0e10cSrcweir 	xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_RUBY );
1313cdf0e10cSrcweir 	xRubyPropMapper = new SvXMLExportPropertyMapper( xPropMapper );
1314cdf0e10cSrcweir 	sFamily = OUString( GetXMLToken( XML_RUBY ) );
1315cdf0e10cSrcweir 	aPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM( "Ru" ) );
1316cdf0e10cSrcweir 	rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_RUBY, sFamily,
1317cdf0e10cSrcweir 							  xRubyPropMapper, aPrefix );
1318cdf0e10cSrcweir 
1319cdf0e10cSrcweir 	xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_FRAME );
1320cdf0e10cSrcweir 	xFramePropMapper = new XMLTextExportPropertySetMapper( xPropMapper,
1321cdf0e10cSrcweir 								   						   GetExport() );
1322cdf0e10cSrcweir 
1323cdf0e10cSrcweir 	pSectionExport = new XMLSectionExport( rExp, *this );
1324cdf0e10cSrcweir 	pIndexMarkExport = new XMLIndexMarkExport( rExp, *this );
1325cdf0e10cSrcweir 
1326cdf0e10cSrcweir     if( ! IsBlockMode() &&
1327cdf0e10cSrcweir         Reference<XRedlinesSupplier>( GetExport().GetModel(), UNO_QUERY ).is())
1328cdf0e10cSrcweir         pRedlineExport = new XMLRedlineExport( rExp );
1329cdf0e10cSrcweir 
1330cdf0e10cSrcweir 	// The text field helper needs a pre-constructed XMLPropertyState
1331cdf0e10cSrcweir 	// to export the combined characters field. We construct that
1332cdf0e10cSrcweir 	// here, because we need the text property mapper to do it.
1333cdf0e10cSrcweir 
1334cdf0e10cSrcweir 	// construct Any value, then find index
1335cdf0e10cSrcweir 	sal_Int32 nIndex = xTextPropMapper->getPropertySetMapper()->FindEntryIndex(
1336cdf0e10cSrcweir 								"", XML_NAMESPACE_STYLE,
1337cdf0e10cSrcweir                                 GetXMLToken(XML_TEXT_COMBINE));
1338cdf0e10cSrcweir     pFieldExport = new XMLTextFieldExport( rExp, new XMLPropertyState( nIndex, uno::makeAny(sal_True) ) );
1339cdf0e10cSrcweir 
1340cdf0e10cSrcweir     // --> OD 2008-05-08 #refactorlists#
1341cdf0e10cSrcweir     PushNewTextListsHelper();
1342cdf0e10cSrcweir     // <--
1343cdf0e10cSrcweir }
1344cdf0e10cSrcweir 
~XMLTextParagraphExport()1345cdf0e10cSrcweir XMLTextParagraphExport::~XMLTextParagraphExport()
1346cdf0e10cSrcweir {
1347cdf0e10cSrcweir 	delete pHeadingStyles;
1348cdf0e10cSrcweir 	delete pRedlineExport;
1349cdf0e10cSrcweir 	delete pIndexMarkExport;
1350cdf0e10cSrcweir 	delete pSectionExport;
1351cdf0e10cSrcweir 	delete pFieldExport;
1352cdf0e10cSrcweir 	delete pListElements;
1353cdf0e10cSrcweir     // --> OD 2008-05-07 #refactorlists# - no longer needed
1354cdf0e10cSrcweir //    delete pExportedLists;
1355cdf0e10cSrcweir     // <--
1356cdf0e10cSrcweir 	delete pListAutoPool;
1357cdf0e10cSrcweir #ifdef DBG_UTIL
1358cdf0e10cSrcweir 	txtparae_bContainsIllegalCharacters = sal_False;
1359cdf0e10cSrcweir #endif
1360cdf0e10cSrcweir     // --> OD 2008-04-25 #refactorlists#
1361cdf0e10cSrcweir     // also deletes <mpTextListsHelper>
1362cdf0e10cSrcweir     PopTextListsHelper();
1363cdf0e10cSrcweir     DBG_ASSERT( maTextListsHelperStack.size() == 0,
1364cdf0e10cSrcweir                 "misusage of text lists helper stack - it is not empty. Serious defect - please inform OD" );
1365cdf0e10cSrcweir     // <--
1366cdf0e10cSrcweir }
1367cdf0e10cSrcweir 
CreateShapeExtPropMapper(SvXMLExport & rExport)1368cdf0e10cSrcweir SvXMLExportPropertyMapper *XMLTextParagraphExport::CreateShapeExtPropMapper(
1369cdf0e10cSrcweir 		SvXMLExport& rExport )
1370cdf0e10cSrcweir {
1371cdf0e10cSrcweir 	UniReference < XMLPropertySetMapper > xPropMapper =
1372cdf0e10cSrcweir 		new XMLTextPropertySetMapper( TEXT_PROP_MAP_SHAPE );
1373cdf0e10cSrcweir 	return new XMLTextExportPropertySetMapper( xPropMapper, rExport );
1374cdf0e10cSrcweir }
1375cdf0e10cSrcweir 
CreateCharExtPropMapper(SvXMLExport & rExport)1376cdf0e10cSrcweir SvXMLExportPropertyMapper *XMLTextParagraphExport::CreateCharExtPropMapper(
1377cdf0e10cSrcweir 		SvXMLExport& rExport)
1378cdf0e10cSrcweir {
1379cdf0e10cSrcweir 	XMLPropertySetMapper *pPropMapper =
1380cdf0e10cSrcweir 		new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT );
1381cdf0e10cSrcweir 	return new XMLTextExportPropertySetMapper( pPropMapper, rExport );
1382cdf0e10cSrcweir }
1383cdf0e10cSrcweir 
CreateParaExtPropMapper(SvXMLExport & rExport)1384cdf0e10cSrcweir SvXMLExportPropertyMapper *XMLTextParagraphExport::CreateParaExtPropMapper(
1385cdf0e10cSrcweir 		SvXMLExport& rExport)
1386cdf0e10cSrcweir {
1387cdf0e10cSrcweir 	XMLPropertySetMapper *pPropMapper =
1388cdf0e10cSrcweir 		new XMLTextPropertySetMapper( TEXT_PROP_MAP_SHAPE_PARA );
1389cdf0e10cSrcweir 	return new XMLTextExportPropertySetMapper( pPropMapper, rExport );
1390cdf0e10cSrcweir }
1391cdf0e10cSrcweir 
CreateParaDefaultExtPropMapper(SvXMLExport & rExport)1392cdf0e10cSrcweir SvXMLExportPropertyMapper *XMLTextParagraphExport::CreateParaDefaultExtPropMapper(
1393cdf0e10cSrcweir 		SvXMLExport& rExport)
1394cdf0e10cSrcweir {
1395cdf0e10cSrcweir 	XMLPropertySetMapper *pPropMapper =
1396cdf0e10cSrcweir 		new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT_ADDITIONAL_DEFAULTS );
1397cdf0e10cSrcweir 	return new XMLTextExportPropertySetMapper( pPropMapper, rExport );
1398cdf0e10cSrcweir }
1399cdf0e10cSrcweir 
exportPageFrames(sal_Bool bAutoStyles,sal_Bool bIsProgress)1400cdf0e10cSrcweir void XMLTextParagraphExport::exportPageFrames( sal_Bool bAutoStyles,
1401cdf0e10cSrcweir 											   sal_Bool bIsProgress )
1402cdf0e10cSrcweir {
1403cdf0e10cSrcweir     const TextContentSet* const pTexts = pBoundFrameSets->GetTexts()->GetPageBoundContents();
1404cdf0e10cSrcweir     const TextContentSet* const pGraphics = pBoundFrameSets->GetGraphics()->GetPageBoundContents();
1405cdf0e10cSrcweir     const TextContentSet* const pEmbeddeds = pBoundFrameSets->GetEmbeddeds()->GetPageBoundContents();
1406cdf0e10cSrcweir     const TextContentSet* const pShapes = pBoundFrameSets->GetShapes()->GetPageBoundContents();
1407cdf0e10cSrcweir     for(TextContentSet::const_iterator_t it = pTexts->getBegin();
1408cdf0e10cSrcweir         it != pTexts->getEnd();
1409cdf0e10cSrcweir         ++it)
1410cdf0e10cSrcweir         exportTextFrame(*it, bAutoStyles, bIsProgress, sal_True);
1411cdf0e10cSrcweir     for(TextContentSet::const_iterator_t it = pGraphics->getBegin();
1412cdf0e10cSrcweir         it != pGraphics->getEnd();
1413cdf0e10cSrcweir         ++it)
1414cdf0e10cSrcweir         exportTextGraphic(*it, bAutoStyles);
1415cdf0e10cSrcweir     for(TextContentSet::const_iterator_t it = pEmbeddeds->getBegin();
1416cdf0e10cSrcweir         it != pEmbeddeds->getEnd();
1417cdf0e10cSrcweir         ++it)
1418cdf0e10cSrcweir         exportTextEmbedded(*it, bAutoStyles);
1419cdf0e10cSrcweir     for(TextContentSet::const_iterator_t it = pShapes->getBegin();
1420cdf0e10cSrcweir         it != pShapes->getEnd();
1421cdf0e10cSrcweir         ++it)
1422cdf0e10cSrcweir         exportShape(*it, bAutoStyles);
1423cdf0e10cSrcweir }
1424cdf0e10cSrcweir 
exportFrameFrames(sal_Bool bAutoStyles,sal_Bool bIsProgress,const Reference<XTextFrame> * pParentTxtFrame)1425cdf0e10cSrcweir void XMLTextParagraphExport::exportFrameFrames(
1426cdf0e10cSrcweir 		sal_Bool bAutoStyles,
1427cdf0e10cSrcweir 		sal_Bool bIsProgress,
1428cdf0e10cSrcweir 		const Reference < XTextFrame > *pParentTxtFrame )
1429cdf0e10cSrcweir {
1430cdf0e10cSrcweir     const TextContentSet* const pTexts = pBoundFrameSets->GetTexts()->GetFrameBoundContents(*pParentTxtFrame);
1431cdf0e10cSrcweir     if(pTexts)
1432cdf0e10cSrcweir         for(TextContentSet::const_iterator_t it = pTexts->getBegin();
1433cdf0e10cSrcweir             it != pTexts->getEnd();
1434cdf0e10cSrcweir             ++it)
1435cdf0e10cSrcweir             exportTextFrame(*it, bAutoStyles, bIsProgress, sal_True);
1436cdf0e10cSrcweir     const TextContentSet* const pGraphics = pBoundFrameSets->GetGraphics()->GetFrameBoundContents(*pParentTxtFrame);
1437cdf0e10cSrcweir     if(pGraphics)
1438cdf0e10cSrcweir         for(TextContentSet::const_iterator_t it = pGraphics->getBegin();
1439cdf0e10cSrcweir             it != pGraphics->getEnd();
1440cdf0e10cSrcweir             ++it)
1441cdf0e10cSrcweir             exportTextGraphic(*it, bAutoStyles);
1442cdf0e10cSrcweir     const TextContentSet* const pEmbeddeds = pBoundFrameSets->GetEmbeddeds()->GetFrameBoundContents(*pParentTxtFrame);
1443cdf0e10cSrcweir     if(pEmbeddeds)
1444cdf0e10cSrcweir         for(TextContentSet::const_iterator_t it = pEmbeddeds->getBegin();
1445cdf0e10cSrcweir             it != pEmbeddeds->getEnd();
1446cdf0e10cSrcweir             ++it)
1447cdf0e10cSrcweir             exportTextEmbedded(*it, bAutoStyles);
1448cdf0e10cSrcweir     const TextContentSet* const pShapes = pBoundFrameSets->GetShapes()->GetFrameBoundContents(*pParentTxtFrame);
1449cdf0e10cSrcweir     if(pShapes)
1450cdf0e10cSrcweir         for(TextContentSet::const_iterator_t it = pShapes->getBegin();
1451cdf0e10cSrcweir             it != pShapes->getEnd();
1452cdf0e10cSrcweir             ++it)
1453cdf0e10cSrcweir             exportShape(*it, bAutoStyles);
1454cdf0e10cSrcweir }
1455cdf0e10cSrcweir 
1456cdf0e10cSrcweir // bookmarks, reference marks (and TOC marks) are the same except for the
1457cdf0e10cSrcweir // element names. We use the same method for export and it an array with
1458cdf0e10cSrcweir // the proper element names
1459cdf0e10cSrcweir static const enum XMLTokenEnum lcl_XmlReferenceElements[] = {
1460cdf0e10cSrcweir     XML_REFERENCE_MARK, XML_REFERENCE_MARK_START, XML_REFERENCE_MARK_END };
1461cdf0e10cSrcweir static const enum XMLTokenEnum lcl_XmlBookmarkElements[] = {
1462cdf0e10cSrcweir     XML_BOOKMARK, XML_BOOKMARK_START, XML_BOOKMARK_END };
1463cdf0e10cSrcweir 
1464cdf0e10cSrcweir // This function replaces the text portion iteration during auto style
1465cdf0e10cSrcweir // collection.
collectTextAutoStylesOptimized(sal_Bool bIsProgress)1466cdf0e10cSrcweir bool XMLTextParagraphExport::collectTextAutoStylesOptimized( sal_Bool bIsProgress )
1467cdf0e10cSrcweir {
1468cdf0e10cSrcweir 	GetExport().GetShapeExport(); // make sure the graphics styles family is added
1469cdf0e10cSrcweir 
1470cdf0e10cSrcweir     const sal_Bool bAutoStyles = sal_True;
1471cdf0e10cSrcweir     const sal_Bool bExportContent = sal_False;
1472cdf0e10cSrcweir 
1473cdf0e10cSrcweir     // Export AutoStyles:
1474cdf0e10cSrcweir     Reference< XAutoStylesSupplier > xAutoStylesSupp( GetExport().GetModel(), UNO_QUERY );
1475cdf0e10cSrcweir     if ( xAutoStylesSupp.is() )
1476cdf0e10cSrcweir     {
1477cdf0e10cSrcweir         Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles();
1478cdf0e10cSrcweir         OUString sName;
1479cdf0e10cSrcweir         sal_uInt16 nFamily;
1480cdf0e10cSrcweir 
1481cdf0e10cSrcweir         for ( int i = 0; i < 3; ++i )
1482cdf0e10cSrcweir         {
1483cdf0e10cSrcweir             if ( 0 == i )
1484cdf0e10cSrcweir             {
1485cdf0e10cSrcweir                 sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "CharacterStyles" ) );
1486cdf0e10cSrcweir                 nFamily = XML_STYLE_FAMILY_TEXT_TEXT;
1487cdf0e10cSrcweir             }
1488cdf0e10cSrcweir             else if ( 1 == i )
1489cdf0e10cSrcweir             {
1490cdf0e10cSrcweir                 sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "RubyStyles" ) );
1491cdf0e10cSrcweir                 nFamily = XML_STYLE_FAMILY_TEXT_RUBY;
1492cdf0e10cSrcweir             }
1493cdf0e10cSrcweir             else
1494cdf0e10cSrcweir             {
1495cdf0e10cSrcweir                 sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) );
1496cdf0e10cSrcweir                 nFamily = XML_STYLE_FAMILY_TEXT_PARAGRAPH;
1497cdf0e10cSrcweir             }
1498cdf0e10cSrcweir 
1499cdf0e10cSrcweir             Any aAny = xAutoStyleFamilies->getByName( sName );
1500cdf0e10cSrcweir             Reference< XAutoStyleFamily > xAutoStyles = *(Reference<XAutoStyleFamily>*)aAny.getValue();
1501cdf0e10cSrcweir             Reference < XEnumeration > xAutoStylesEnum( xAutoStyles->createEnumeration() );
1502cdf0e10cSrcweir 
1503cdf0e10cSrcweir             while ( xAutoStylesEnum->hasMoreElements() )
1504cdf0e10cSrcweir             {
1505cdf0e10cSrcweir                 aAny = xAutoStylesEnum->nextElement();
1506cdf0e10cSrcweir                 Reference< XAutoStyle > xAutoStyle = *(Reference<XAutoStyle>*)aAny.getValue();
1507cdf0e10cSrcweir                 Reference < XPropertySet > xPSet( xAutoStyle, uno::UNO_QUERY );
1508cdf0e10cSrcweir                 Add( nFamily, xPSet, 0, true );
1509cdf0e10cSrcweir             }
1510cdf0e10cSrcweir         }
1511cdf0e10cSrcweir     }
1512cdf0e10cSrcweir 
1513cdf0e10cSrcweir     // Export Field AutoStyles:
1514cdf0e10cSrcweir     Reference< XTextFieldsSupplier > xTextFieldsSupp( GetExport().GetModel(), UNO_QUERY );
1515cdf0e10cSrcweir     if ( xTextFieldsSupp.is() )
1516cdf0e10cSrcweir     {
1517cdf0e10cSrcweir         Reference< XEnumerationAccess > xTextFields = xTextFieldsSupp->getTextFields();
1518cdf0e10cSrcweir         Reference < XEnumeration > xTextFieldsEnum( xTextFields->createEnumeration() );
1519cdf0e10cSrcweir 
1520cdf0e10cSrcweir         while ( xTextFieldsEnum->hasMoreElements() )
1521cdf0e10cSrcweir         {
1522cdf0e10cSrcweir             Any aAny = xTextFieldsEnum->nextElement();
1523cdf0e10cSrcweir             Reference< XTextField > xTextField = *(Reference<XTextField>*)aAny.getValue();
1524cdf0e10cSrcweir             exportTextField( xTextField, bAutoStyles, bIsProgress,
1525cdf0e10cSrcweir                 !xAutoStylesSupp.is() );
1526cdf0e10cSrcweir 			try
1527cdf0e10cSrcweir 			{
1528cdf0e10cSrcweir 				Reference < XPropertySet > xSet( xTextField, UNO_QUERY );
1529cdf0e10cSrcweir 				Reference < XText > xText;
1530cdf0e10cSrcweir 				Any a = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("TextRange") );
1531cdf0e10cSrcweir 				a >>= xText;
1532cdf0e10cSrcweir 				if ( xText.is() )
1533cdf0e10cSrcweir                 {
1534cdf0e10cSrcweir 					exportText( xText, sal_True, bIsProgress, bExportContent );
1535cdf0e10cSrcweir                     GetExport().GetTextParagraphExport()
1536cdf0e10cSrcweir                         ->collectTextAutoStyles( xText );
1537cdf0e10cSrcweir                 }
1538cdf0e10cSrcweir 			}
1539cdf0e10cSrcweir 			catch (Exception&)
1540cdf0e10cSrcweir 			{
1541cdf0e10cSrcweir 			}
1542cdf0e10cSrcweir         }
1543cdf0e10cSrcweir     }
1544cdf0e10cSrcweir 
1545cdf0e10cSrcweir     // Export text frames:
1546cdf0e10cSrcweir     Reference<XEnumeration> xTextFramesEnum = pBoundFrameSets->GetTexts()->createEnumeration();
1547cdf0e10cSrcweir     if(xTextFramesEnum.is())
1548cdf0e10cSrcweir         while(xTextFramesEnum->hasMoreElements())
1549cdf0e10cSrcweir         {
1550cdf0e10cSrcweir             Reference<XTextContent> xTxtCntnt(xTextFramesEnum->nextElement(), UNO_QUERY);
1551cdf0e10cSrcweir             if(xTxtCntnt.is())
1552cdf0e10cSrcweir                 exportTextFrame(xTxtCntnt, bAutoStyles, bIsProgress, bExportContent, 0);
1553cdf0e10cSrcweir         }
1554cdf0e10cSrcweir 
1555cdf0e10cSrcweir     // Export graphic objects:
1556cdf0e10cSrcweir     Reference<XEnumeration> xGraphicsEnum = pBoundFrameSets->GetGraphics()->createEnumeration();
1557cdf0e10cSrcweir     if(xGraphicsEnum.is())
1558cdf0e10cSrcweir         while(xGraphicsEnum->hasMoreElements())
1559cdf0e10cSrcweir         {
1560cdf0e10cSrcweir             Reference<XTextContent> xTxtCntnt(xGraphicsEnum->nextElement(), UNO_QUERY);
1561cdf0e10cSrcweir             if(xTxtCntnt.is())
1562cdf0e10cSrcweir                 exportTextGraphic(xTxtCntnt, true, 0);
1563cdf0e10cSrcweir         }
1564cdf0e10cSrcweir 
1565cdf0e10cSrcweir     // Export embedded objects:
1566cdf0e10cSrcweir     Reference<XEnumeration> xEmbeddedsEnum = pBoundFrameSets->GetEmbeddeds()->createEnumeration();
1567cdf0e10cSrcweir     if(xEmbeddedsEnum.is())
1568cdf0e10cSrcweir         while(xEmbeddedsEnum->hasMoreElements())
1569cdf0e10cSrcweir         {
1570cdf0e10cSrcweir             Reference<XTextContent> xTxtCntnt(xEmbeddedsEnum->nextElement(), UNO_QUERY);
1571cdf0e10cSrcweir             if(xTxtCntnt.is())
1572cdf0e10cSrcweir                 exportTextEmbedded(xTxtCntnt, true, 0);
1573cdf0e10cSrcweir         }
1574cdf0e10cSrcweir 
1575cdf0e10cSrcweir     // Export shapes:
1576cdf0e10cSrcweir     Reference<XEnumeration> xShapesEnum = pBoundFrameSets->GetShapes()->createEnumeration();
1577cdf0e10cSrcweir     if(xShapesEnum.is())
1578cdf0e10cSrcweir         while(xShapesEnum->hasMoreElements())
1579cdf0e10cSrcweir         {
1580cdf0e10cSrcweir             Reference<XTextContent> xTxtCntnt(xShapesEnum->nextElement(), UNO_QUERY);
1581cdf0e10cSrcweir             if(xTxtCntnt.is())
1582cdf0e10cSrcweir             {
1583cdf0e10cSrcweir                 Reference<XServiceInfo> xServiceInfo(xTxtCntnt, UNO_QUERY);
1584cdf0e10cSrcweir                 if( xServiceInfo->supportsService(sShapeService))
1585cdf0e10cSrcweir                     exportShape(xTxtCntnt, true, 0);
1586cdf0e10cSrcweir             }
1587cdf0e10cSrcweir         }
1588cdf0e10cSrcweir 
1589cdf0e10cSrcweir     sal_Int32 nCount;
1590cdf0e10cSrcweir     // AutoStyles for sections
1591cdf0e10cSrcweir     Reference< XTextSectionsSupplier > xSectionsSupp( GetExport().GetModel(), UNO_QUERY );
1592cdf0e10cSrcweir     if ( xSectionsSupp.is() )
1593cdf0e10cSrcweir     {
1594cdf0e10cSrcweir         Reference< XIndexAccess > xSections( xSectionsSupp->getTextSections(), UNO_QUERY );
1595cdf0e10cSrcweir         if ( xSections.is() )
1596cdf0e10cSrcweir         {
1597cdf0e10cSrcweir             nCount = xSections->getCount();
1598cdf0e10cSrcweir             for( sal_Int32 i = 0; i < nCount; ++i )
1599cdf0e10cSrcweir             {
1600cdf0e10cSrcweir                 Any aAny = xSections->getByIndex( i );
1601cdf0e10cSrcweir                 Reference< XTextSection > xSection = *(Reference<XTextSection>*)aAny.getValue();
1602cdf0e10cSrcweir                 Reference < XPropertySet > xPSet( xSection, uno::UNO_QUERY );
1603cdf0e10cSrcweir                 Add( XML_STYLE_FAMILY_TEXT_SECTION, xPSet );
1604cdf0e10cSrcweir             }
1605cdf0e10cSrcweir         }
1606cdf0e10cSrcweir     }
1607cdf0e10cSrcweir 
1608cdf0e10cSrcweir     // AutoStyles for tables (Note: suppress autostyle collection for paragraphs in exportTable)
1609cdf0e10cSrcweir     Reference< XTextTablesSupplier > xTablesSupp( GetExport().GetModel(), UNO_QUERY );
1610cdf0e10cSrcweir     if ( xTablesSupp.is() )
1611cdf0e10cSrcweir     {
1612cdf0e10cSrcweir         Reference< XIndexAccess > xTables( xTablesSupp->getTextTables(), UNO_QUERY );
1613cdf0e10cSrcweir         if ( xTables.is() )
1614cdf0e10cSrcweir         {
1615cdf0e10cSrcweir             nCount = xTables->getCount();
1616cdf0e10cSrcweir             for( sal_Int32 i = 0; i < nCount; ++i )
1617cdf0e10cSrcweir             {
1618cdf0e10cSrcweir                 Any aAny = xTables->getByIndex( i );
1619cdf0e10cSrcweir                 Reference< XTextTable > xTable = *(Reference<XTextTable>*)aAny.getValue();
1620cdf0e10cSrcweir                 Reference < XTextContent > xTextContent( xTable, uno::UNO_QUERY );
1621cdf0e10cSrcweir                 exportTable( xTextContent, sal_True, sal_True );
1622cdf0e10cSrcweir             }
1623cdf0e10cSrcweir         }
1624cdf0e10cSrcweir     }
1625cdf0e10cSrcweir 
1626cdf0e10cSrcweir     Reference< XNumberingRulesSupplier > xNumberingRulesSupp( GetExport().GetModel(), UNO_QUERY );
1627cdf0e10cSrcweir     if ( xNumberingRulesSupp.is() )
1628cdf0e10cSrcweir     {
1629cdf0e10cSrcweir         Reference< XIndexAccess > xNumberingRules = xNumberingRulesSupp->getNumberingRules();
1630cdf0e10cSrcweir         nCount = xNumberingRules->getCount();
1631cdf0e10cSrcweir         // --> OD 2007-01-12 #i73361#
1632cdf0e10cSrcweir         const OUString sNumberingIsOutline( RTL_CONSTASCII_USTRINGPARAM( "NumberingIsOutline" ) );
1633cdf0e10cSrcweir         // <--
1634cdf0e10cSrcweir         for( sal_Int32 i = 0; i < nCount; ++i )
1635cdf0e10cSrcweir         {
1636cdf0e10cSrcweir             Reference< XIndexReplace > xNumRule( xNumberingRules->getByIndex( i ), UNO_QUERY );
1637cdf0e10cSrcweir             if( xNumRule.is() && xNumRule->getCount() )
1638cdf0e10cSrcweir             {
1639cdf0e10cSrcweir                 Reference < XNamed > xNamed( xNumRule, UNO_QUERY );
1640cdf0e10cSrcweir                 OUString sName;
1641cdf0e10cSrcweir                 if( xNamed.is() )
1642cdf0e10cSrcweir                     sName = xNamed->getName();
1643cdf0e10cSrcweir                 sal_Bool bAdd = !sName.getLength();
1644cdf0e10cSrcweir                 if( !bAdd )
1645cdf0e10cSrcweir                 {
1646cdf0e10cSrcweir                     Reference < XPropertySet > xNumPropSet( xNumRule,
1647cdf0e10cSrcweir                                                             UNO_QUERY );
1648cdf0e10cSrcweir                     const OUString sIsAutomatic( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) );
1649cdf0e10cSrcweir                     if( xNumPropSet.is() &&
1650cdf0e10cSrcweir                         xNumPropSet->getPropertySetInfo()
1651cdf0e10cSrcweir                                    ->hasPropertyByName( sIsAutomatic ) )
1652cdf0e10cSrcweir                     {
1653cdf0e10cSrcweir                         bAdd = *(sal_Bool *)xNumPropSet->getPropertyValue( sIsAutomatic ).getValue();
1654cdf0e10cSrcweir                         // --> OD 2007-01-12 #i73361# - check on outline style
1655cdf0e10cSrcweir                         if ( bAdd &&
1656cdf0e10cSrcweir                              xNumPropSet->getPropertySetInfo()
1657cdf0e10cSrcweir                                        ->hasPropertyByName( sNumberingIsOutline ) )
1658cdf0e10cSrcweir                         {
1659cdf0e10cSrcweir                             bAdd = !(*(sal_Bool *)xNumPropSet->getPropertyValue( sNumberingIsOutline ).getValue());
1660cdf0e10cSrcweir                         }
1661cdf0e10cSrcweir                         // <--
1662cdf0e10cSrcweir                     }
1663cdf0e10cSrcweir                     else
1664cdf0e10cSrcweir                     {
1665cdf0e10cSrcweir                         bAdd = sal_True;
1666cdf0e10cSrcweir                     }
1667cdf0e10cSrcweir                 }
1668cdf0e10cSrcweir                 if( bAdd )
1669cdf0e10cSrcweir                     pListAutoPool->Add( xNumRule );
1670cdf0e10cSrcweir             }
1671cdf0e10cSrcweir         }
1672cdf0e10cSrcweir     }
1673cdf0e10cSrcweir 
1674cdf0e10cSrcweir     return true;
1675cdf0e10cSrcweir }
1676cdf0e10cSrcweir 
exportText(const Reference<XText> & rText,sal_Bool bAutoStyles,sal_Bool bIsProgress,sal_Bool bExportParagraph)1677cdf0e10cSrcweir void XMLTextParagraphExport::exportText(
1678cdf0e10cSrcweir 		const Reference < XText > & rText,
1679cdf0e10cSrcweir 		sal_Bool bAutoStyles,
1680cdf0e10cSrcweir         sal_Bool bIsProgress,
1681cdf0e10cSrcweir 		sal_Bool bExportParagraph )
1682cdf0e10cSrcweir {
1683cdf0e10cSrcweir 	if( bAutoStyles )
1684cdf0e10cSrcweir 		GetExport().GetShapeExport(); // make sure the graphics styles family
1685cdf0e10cSrcweir 									  // is added
1686cdf0e10cSrcweir 	Reference < XEnumerationAccess > xEA( rText, UNO_QUERY );
1687cdf0e10cSrcweir 	Reference < XEnumeration > xParaEnum(xEA->createEnumeration());
1688cdf0e10cSrcweir 	Reference < XPropertySet > xPropertySet( rText, UNO_QUERY );
1689cdf0e10cSrcweir 	Reference < XTextSection > xBaseSection;
1690cdf0e10cSrcweir 
1691cdf0e10cSrcweir 	// #97718# footnotes don't supply paragraph enumerations in some cases
1692cdf0e10cSrcweir 	// This is always a bug, but at least we don't want to crash.
1693cdf0e10cSrcweir 	DBG_ASSERT( xParaEnum.is(), "We need a paragraph enumeration" );
1694cdf0e10cSrcweir 	if( ! xParaEnum.is() )
1695cdf0e10cSrcweir 		return;
1696cdf0e10cSrcweir 
1697cdf0e10cSrcweir 	sal_Bool bExportLevels = sal_True;
1698cdf0e10cSrcweir 
1699cdf0e10cSrcweir 	if (xPropertySet.is())
1700cdf0e10cSrcweir 	{
1701cdf0e10cSrcweir 		Reference < XPropertySetInfo > xInfo ( xPropertySet->getPropertySetInfo() );
1702cdf0e10cSrcweir 
1703cdf0e10cSrcweir 		if( xInfo.is() )
1704cdf0e10cSrcweir 		{
1705cdf0e10cSrcweir 			if (xInfo->hasPropertyByName( sTextSection ))
1706cdf0e10cSrcweir 			{
1707cdf0e10cSrcweir 				xPropertySet->getPropertyValue(sTextSection) >>= xBaseSection ;
1708cdf0e10cSrcweir 			}
1709cdf0e10cSrcweir 
1710cdf0e10cSrcweir /* #i35937#
1711cdf0e10cSrcweir 			// for applications that use the outliner we need to check if
1712cdf0e10cSrcweir 			// the current text object needs the level information exported
1713cdf0e10cSrcweir 			if( !bAutoStyles )
1714cdf0e10cSrcweir 			{
1715cdf0e10cSrcweir 				// fixme: move string to class member, couldn't do now because
1716cdf0e10cSrcweir 				//		  of no incompatible build
1717cdf0e10cSrcweir 				OUString sHasLevels( RTL_CONSTASCII_USTRINGPARAM("HasLevels") );
1718cdf0e10cSrcweir 				if (xInfo->hasPropertyByName( sHasLevels ) )
1719cdf0e10cSrcweir 				{
1720cdf0e10cSrcweir 					xPropertySet->getPropertyValue(sHasLevels) >>= bExportLevels;
1721cdf0e10cSrcweir 				}
1722cdf0e10cSrcweir 			}
1723cdf0e10cSrcweir */
1724cdf0e10cSrcweir 		}
1725cdf0e10cSrcweir 	}
1726cdf0e10cSrcweir 
1727cdf0e10cSrcweir     // #96530# Export redlines at start & end of XText before & after
1728cdf0e10cSrcweir     // exporting the text content enumeration
1729cdf0e10cSrcweir     if( !bAutoStyles && (pRedlineExport != NULL) )
1730cdf0e10cSrcweir         pRedlineExport->ExportStartOrEndRedline( xPropertySet, sal_True );
1731cdf0e10cSrcweir 	exportTextContentEnumeration( xParaEnum, bAutoStyles, xBaseSection,
1732cdf0e10cSrcweir                                   bIsProgress, bExportParagraph, 0, bExportLevels );
1733cdf0e10cSrcweir     if( !bAutoStyles && (pRedlineExport != NULL) )
1734cdf0e10cSrcweir         pRedlineExport->ExportStartOrEndRedline( xPropertySet, sal_False );
1735cdf0e10cSrcweir }
1736cdf0e10cSrcweir 
exportText(const Reference<XText> & rText,const Reference<XTextSection> & rBaseSection,sal_Bool bAutoStyles,sal_Bool bIsProgress,sal_Bool bExportParagraph)1737cdf0e10cSrcweir void XMLTextParagraphExport::exportText(
1738cdf0e10cSrcweir 		const Reference < XText > & rText,
1739cdf0e10cSrcweir 		const Reference < XTextSection > & rBaseSection,
1740cdf0e10cSrcweir 		sal_Bool bAutoStyles,
1741cdf0e10cSrcweir 		sal_Bool bIsProgress,
1742cdf0e10cSrcweir 		sal_Bool bExportParagraph )
1743cdf0e10cSrcweir {
1744cdf0e10cSrcweir 	if( bAutoStyles )
1745cdf0e10cSrcweir 		GetExport().GetShapeExport(); // make sure the graphics styles family
1746cdf0e10cSrcweir 									  // is added
1747cdf0e10cSrcweir 	Reference < XEnumerationAccess > xEA( rText, UNO_QUERY );
1748cdf0e10cSrcweir 	Reference < XEnumeration > xParaEnum(xEA->createEnumeration());
1749cdf0e10cSrcweir 
1750cdf0e10cSrcweir     // #98165# don't continue without a paragraph enumeration
1751cdf0e10cSrcweir     if( ! xParaEnum.is() )
1752cdf0e10cSrcweir         return;
1753cdf0e10cSrcweir 
1754cdf0e10cSrcweir     // #96530# Export redlines at start & end of XText before & after
1755cdf0e10cSrcweir     // exporting the text content enumeration
1756cdf0e10cSrcweir     Reference<XPropertySet> xPropertySet;
1757cdf0e10cSrcweir     if( !bAutoStyles && (pRedlineExport != NULL) )
1758cdf0e10cSrcweir     {
1759cdf0e10cSrcweir         xPropertySet.set(rText, uno::UNO_QUERY );
1760cdf0e10cSrcweir         pRedlineExport->ExportStartOrEndRedline( xPropertySet, sal_True );
1761cdf0e10cSrcweir     }
1762cdf0e10cSrcweir 	exportTextContentEnumeration( xParaEnum, bAutoStyles, rBaseSection,
1763cdf0e10cSrcweir 							      bIsProgress, bExportParagraph );
1764cdf0e10cSrcweir     if( !bAutoStyles && (pRedlineExport != NULL) )
1765cdf0e10cSrcweir         pRedlineExport->ExportStartOrEndRedline( xPropertySet, sal_False );
1766cdf0e10cSrcweir }
1767cdf0e10cSrcweir 
exportTextContentEnumeration(const Reference<XEnumeration> & rContEnum,sal_Bool bAutoStyles,const Reference<XTextSection> & rBaseSection,sal_Bool bIsProgress,sal_Bool bExportParagraph,const Reference<XPropertySet> * pRangePropSet,sal_Bool bExportLevels)1768cdf0e10cSrcweir sal_Bool XMLTextParagraphExport::exportTextContentEnumeration(
1769cdf0e10cSrcweir 		const Reference < XEnumeration > & rContEnum,
1770cdf0e10cSrcweir 		sal_Bool bAutoStyles,
1771cdf0e10cSrcweir 		const Reference < XTextSection > & rBaseSection,
1772cdf0e10cSrcweir 		sal_Bool bIsProgress,
1773cdf0e10cSrcweir 		sal_Bool bExportParagraph,
1774cdf0e10cSrcweir 		const Reference < XPropertySet > *pRangePropSet,
1775cdf0e10cSrcweir         sal_Bool bExportLevels )
1776cdf0e10cSrcweir {
1777cdf0e10cSrcweir 	DBG_ASSERT( rContEnum.is(), "No enumeration to export!" );
1778cdf0e10cSrcweir 	sal_Bool bHasMoreElements = rContEnum->hasMoreElements();
1779cdf0e10cSrcweir 	if( !bHasMoreElements )
1780cdf0e10cSrcweir 		return sal_False;
1781cdf0e10cSrcweir 
1782cdf0e10cSrcweir 	XMLTextNumRuleInfo aPrevNumInfo;
1783cdf0e10cSrcweir 	XMLTextNumRuleInfo aNextNumInfo;
1784cdf0e10cSrcweir 
1785cdf0e10cSrcweir     sal_Bool bHasContent = sal_False;
1786cdf0e10cSrcweir 	Reference<XTextSection> xCurrentTextSection(rBaseSection);
1787cdf0e10cSrcweir 
1788cdf0e10cSrcweir     MultiPropertySetHelper aPropSetHelper(
1789cdf0e10cSrcweir 		   					bAutoStyles ? aParagraphPropertyNamesAuto :
1790cdf0e10cSrcweir 										  aParagraphPropertyNames );
1791cdf0e10cSrcweir 
1792cdf0e10cSrcweir 	sal_Bool bHoldElement = sal_False;
1793cdf0e10cSrcweir 	Reference < XTextContent > xTxtCntnt;
1794cdf0e10cSrcweir 	while( bHoldElement || bHasMoreElements )
1795cdf0e10cSrcweir 	{
1796cdf0e10cSrcweir 		if (bHoldElement)
1797cdf0e10cSrcweir 		{
1798cdf0e10cSrcweir 			bHoldElement = sal_False;
1799cdf0e10cSrcweir 		}
1800cdf0e10cSrcweir 		else
1801cdf0e10cSrcweir 		{
1802cdf0e10cSrcweir             xTxtCntnt.set(rContEnum->nextElement(), uno::UNO_QUERY);
1803cdf0e10cSrcweir 
1804cdf0e10cSrcweir 			aPropSetHelper.resetValues();
1805cdf0e10cSrcweir 
1806cdf0e10cSrcweir 		}
1807cdf0e10cSrcweir 
1808cdf0e10cSrcweir 		Reference<XServiceInfo> xServiceInfo( xTxtCntnt, UNO_QUERY );
1809cdf0e10cSrcweir 		if( xServiceInfo->supportsService( sParagraphService ) )
1810cdf0e10cSrcweir 		{
1811cdf0e10cSrcweir 			if( bExportLevels )
1812cdf0e10cSrcweir 			{
1813cdf0e10cSrcweir 				if( bAutoStyles )
1814cdf0e10cSrcweir 				{
1815cdf0e10cSrcweir 					exportListAndSectionChange( xCurrentTextSection, xTxtCntnt,
1816cdf0e10cSrcweir 												aPrevNumInfo, aNextNumInfo,
1817cdf0e10cSrcweir 												bAutoStyles );
1818cdf0e10cSrcweir 				}
1819cdf0e10cSrcweir 				else
1820cdf0e10cSrcweir 				{
1821cdf0e10cSrcweir                     // --> OD 2006-09-27 #i69627#
1822cdf0e10cSrcweir                     // --> OD 2008-04-24 #refactorlists#
1823cdf0e10cSrcweir                     // pass list auto style pool to <XMLTextNumRuleInfo> instance
1824cdf0e10cSrcweir                     // --> OD 2008-11-26 #158694#
1825cdf0e10cSrcweir                     // pass info about request to export <text:number> element
1826cdf0e10cSrcweir                     // to <XMLTextNumRuleInfo> instance
1827cdf0e10cSrcweir                     aNextNumInfo.Set( xTxtCntnt,
1828cdf0e10cSrcweir                                       GetExport().writeOutlineStyleAsNormalListStyle(),
1829cdf0e10cSrcweir                                       GetListAutoStylePool(),
1830cdf0e10cSrcweir                                       GetExport().exportTextNumberElement() );
1831cdf0e10cSrcweir                     // <--
1832cdf0e10cSrcweir 
1833cdf0e10cSrcweir 					exportListAndSectionChange( xCurrentTextSection, aPropSetHelper,
1834cdf0e10cSrcweir 												TEXT_SECTION, xTxtCntnt,
1835cdf0e10cSrcweir 												aPrevNumInfo, aNextNumInfo,
1836cdf0e10cSrcweir 												bAutoStyles );
1837cdf0e10cSrcweir 				}
1838cdf0e10cSrcweir 			}
1839cdf0e10cSrcweir 
1840cdf0e10cSrcweir 			// if we found a mute section: skip all section content
1841cdf0e10cSrcweir 			if (pSectionExport->IsMuteSection(xCurrentTextSection))
1842cdf0e10cSrcweir 			{
1843cdf0e10cSrcweir 				// Make sure headings are exported anyway.
1844cdf0e10cSrcweir 				if( !bAutoStyles )
1845cdf0e10cSrcweir 					pSectionExport->ExportMasterDocHeadingDummies();
1846cdf0e10cSrcweir 
1847cdf0e10cSrcweir 				while (rContEnum->hasMoreElements() &&
1848cdf0e10cSrcweir 					   pSectionExport->IsInSection( xCurrentTextSection,
1849cdf0e10cSrcweir 													xTxtCntnt, sal_True ))
1850cdf0e10cSrcweir 				{
1851cdf0e10cSrcweir                     xTxtCntnt.set(rContEnum->nextElement(), uno::UNO_QUERY);
1852cdf0e10cSrcweir 					aPropSetHelper.resetValues();
1853cdf0e10cSrcweir 					aNextNumInfo.Reset();
1854cdf0e10cSrcweir 				}
1855cdf0e10cSrcweir 				// the first non-mute element still needs to be processed
1856cdf0e10cSrcweir 				bHoldElement =
1857cdf0e10cSrcweir 					! pSectionExport->IsInSection( xCurrentTextSection,
1858cdf0e10cSrcweir 												   xTxtCntnt, sal_False );
1859cdf0e10cSrcweir 			}
1860cdf0e10cSrcweir 			else
1861cdf0e10cSrcweir                 exportParagraph( xTxtCntnt, bAutoStyles, bIsProgress,
1862cdf0e10cSrcweir                                  bExportParagraph, aPropSetHelper );
1863cdf0e10cSrcweir             bHasContent = sal_True;
1864cdf0e10cSrcweir 		}
1865cdf0e10cSrcweir 		else if( xServiceInfo->supportsService( sTableService ) )
1866cdf0e10cSrcweir 		{
1867cdf0e10cSrcweir 			if( !bAutoStyles )
1868cdf0e10cSrcweir 			{
1869cdf0e10cSrcweir 				aNextNumInfo.Reset();
1870cdf0e10cSrcweir 			}
1871cdf0e10cSrcweir 
1872cdf0e10cSrcweir 			exportListAndSectionChange( xCurrentTextSection, xTxtCntnt,
1873cdf0e10cSrcweir 										aPrevNumInfo, aNextNumInfo,
1874cdf0e10cSrcweir 										bAutoStyles );
1875cdf0e10cSrcweir 
1876cdf0e10cSrcweir 			if (! pSectionExport->IsMuteSection(xCurrentTextSection))
1877cdf0e10cSrcweir 			{
1878cdf0e10cSrcweir 				// export start + end redlines (for wholly redlined tables)
1879cdf0e10cSrcweir 				if ((! bAutoStyles) && (NULL != pRedlineExport))
1880cdf0e10cSrcweir 					pRedlineExport->ExportStartOrEndRedline(xTxtCntnt, sal_True);
1881cdf0e10cSrcweir 
1882cdf0e10cSrcweir 				exportTable( xTxtCntnt, bAutoStyles, bIsProgress  );
1883cdf0e10cSrcweir 
1884cdf0e10cSrcweir 				if ((! bAutoStyles) && (NULL != pRedlineExport))
1885cdf0e10cSrcweir 					pRedlineExport->ExportStartOrEndRedline(xTxtCntnt, sal_False);
1886cdf0e10cSrcweir 			}
1887cdf0e10cSrcweir 			else if( !bAutoStyles )
1888cdf0e10cSrcweir 			{
1889cdf0e10cSrcweir 				// Make sure headings are exported anyway.
1890cdf0e10cSrcweir 				pSectionExport->ExportMasterDocHeadingDummies();
1891cdf0e10cSrcweir 			}
1892cdf0e10cSrcweir 
1893cdf0e10cSrcweir 			bHasContent = sal_True;
1894cdf0e10cSrcweir 		}
1895cdf0e10cSrcweir 		else if( xServiceInfo->supportsService( sTextFrameService ) )
1896cdf0e10cSrcweir 		{
1897cdf0e10cSrcweir             exportTextFrame( xTxtCntnt, bAutoStyles, bIsProgress, sal_True, pRangePropSet );
1898cdf0e10cSrcweir         }
1899cdf0e10cSrcweir 		else if( xServiceInfo->supportsService( sTextGraphicService ) )
1900cdf0e10cSrcweir 		{
1901cdf0e10cSrcweir 			exportTextGraphic( xTxtCntnt, bAutoStyles, pRangePropSet );
1902cdf0e10cSrcweir 		}
1903cdf0e10cSrcweir 		else if( xServiceInfo->supportsService( sTextEmbeddedService ) )
1904cdf0e10cSrcweir 		{
1905cdf0e10cSrcweir 			exportTextEmbedded( xTxtCntnt, bAutoStyles, pRangePropSet );
1906cdf0e10cSrcweir 		}
1907cdf0e10cSrcweir 		else if( xServiceInfo->supportsService( sShapeService ) )
1908cdf0e10cSrcweir 		{
1909cdf0e10cSrcweir 			exportShape( xTxtCntnt, bAutoStyles, pRangePropSet );
1910cdf0e10cSrcweir 		}
1911cdf0e10cSrcweir 		else
1912cdf0e10cSrcweir 		{
1913cdf0e10cSrcweir 			DBG_ASSERT( !xTxtCntnt.is(), "unknown text content" );
1914cdf0e10cSrcweir 		}
1915cdf0e10cSrcweir 
1916cdf0e10cSrcweir 		if( !bAutoStyles )
1917cdf0e10cSrcweir 		{
1918cdf0e10cSrcweir 			aPrevNumInfo = aNextNumInfo;
1919cdf0e10cSrcweir 		}
1920cdf0e10cSrcweir 
1921cdf0e10cSrcweir 		bHasMoreElements = rContEnum->hasMoreElements();
1922cdf0e10cSrcweir 	}
1923cdf0e10cSrcweir 
1924cdf0e10cSrcweir 	if( bExportLevels && bHasContent && !bAutoStyles )
1925cdf0e10cSrcweir 	{
1926cdf0e10cSrcweir 		aNextNumInfo.Reset();
1927cdf0e10cSrcweir 
1928cdf0e10cSrcweir 		// close open lists and sections; no new styles
1929cdf0e10cSrcweir 		exportListAndSectionChange( xCurrentTextSection, rBaseSection,
1930cdf0e10cSrcweir 									aPrevNumInfo, aNextNumInfo,
1931cdf0e10cSrcweir 									bAutoStyles );
1932cdf0e10cSrcweir 	}
1933cdf0e10cSrcweir 
1934cdf0e10cSrcweir 	return sal_True;
1935cdf0e10cSrcweir }
1936cdf0e10cSrcweir 
exportParagraph(const Reference<XTextContent> & rTextContent,sal_Bool bAutoStyles,sal_Bool bIsProgress,sal_Bool bExportParagraph,MultiPropertySetHelper & rPropSetHelper)1937cdf0e10cSrcweir void XMLTextParagraphExport::exportParagraph(
1938cdf0e10cSrcweir 		const Reference < XTextContent > & rTextContent,
1939cdf0e10cSrcweir         sal_Bool bAutoStyles, sal_Bool bIsProgress, sal_Bool bExportParagraph,
1940cdf0e10cSrcweir         MultiPropertySetHelper& rPropSetHelper)
1941cdf0e10cSrcweir {
1942cdf0e10cSrcweir 	sal_Int16 nOutlineLevel = -1;
1943cdf0e10cSrcweir 
1944cdf0e10cSrcweir 	if( bIsProgress )
1945cdf0e10cSrcweir 	{
1946cdf0e10cSrcweir 		ProgressBarHelper *pProgress = GetExport().GetProgressBarHelper();
1947cdf0e10cSrcweir 		pProgress->SetValue( pProgress->GetValue()+1 );
1948cdf0e10cSrcweir 	}
1949cdf0e10cSrcweir 
1950cdf0e10cSrcweir 	// get property set or multi property set and initialize helper
1951cdf0e10cSrcweir 	Reference<XMultiPropertySet> xMultiPropSet( rTextContent, UNO_QUERY );
1952cdf0e10cSrcweir 	Reference<XPropertySet> xPropSet( rTextContent, UNO_QUERY );
1953cdf0e10cSrcweir 
1954cdf0e10cSrcweir 	// check for supported properties
1955cdf0e10cSrcweir     if( !rPropSetHelper.checkedProperties() )
1956cdf0e10cSrcweir 		rPropSetHelper.hasProperties( xPropSet->getPropertySetInfo() );
1957cdf0e10cSrcweir 
1958cdf0e10cSrcweir //	if( xMultiPropSet.is() )
1959cdf0e10cSrcweir //		rPropSetHelper.getValues( xMultiPropSet );
1960cdf0e10cSrcweir //	else
1961cdf0e10cSrcweir //		rPropSetHelper.getValues( xPropSet );
1962cdf0e10cSrcweir 
1963cdf0e10cSrcweir 	if( bExportParagraph )
1964cdf0e10cSrcweir 	{
1965cdf0e10cSrcweir 		if( bAutoStyles )
1966cdf0e10cSrcweir 		{
1967cdf0e10cSrcweir 			Add( XML_STYLE_FAMILY_TEXT_PARAGRAPH, rPropSetHelper, xPropSet );
1968cdf0e10cSrcweir 		}
1969cdf0e10cSrcweir 		else
1970cdf0e10cSrcweir 		{
1971cdf0e10cSrcweir             // xml:id for RDF metadata
1972cdf0e10cSrcweir             GetExport().AddAttributeXmlId(rTextContent);
1973cdf0e10cSrcweir             GetExport().AddAttributesRDFa(rTextContent);
1974cdf0e10cSrcweir 
1975cdf0e10cSrcweir 			OUString sStyle;
1976cdf0e10cSrcweir 			if( rPropSetHelper.hasProperty( PARA_STYLE_NAME ) )
1977cdf0e10cSrcweir 			{
1978cdf0e10cSrcweir 				if( xMultiPropSet.is() )
1979cdf0e10cSrcweir 					rPropSetHelper.getValue( PARA_STYLE_NAME,
1980cdf0e10cSrcweir 													xMultiPropSet ) >>= sStyle;
1981cdf0e10cSrcweir 				else
1982cdf0e10cSrcweir 					rPropSetHelper.getValue( PARA_STYLE_NAME,
1983cdf0e10cSrcweir 													xPropSet ) >>= sStyle;
1984cdf0e10cSrcweir 			}
1985cdf0e10cSrcweir 
1986cdf0e10cSrcweir 			Reference< XInterface > xRef( rTextContent, UNO_QUERY );
1987cdf0e10cSrcweir 			if( xRef.is() )
1988cdf0e10cSrcweir 			{
1989cdf0e10cSrcweir 				const OUString& rIdentifier = GetExport().getInterfaceToIdentifierMapper().getIdentifier( xRef );
1990cdf0e10cSrcweir 				if( rIdentifier.getLength() )
1991cdf0e10cSrcweir                 {
1992cdf0e10cSrcweir                     // FIXME: this is just temporary until EditEngine
1993cdf0e10cSrcweir                     // paragraphs implement XMetadatable.
1994cdf0e10cSrcweir                     // then that must be used and not the mapper, because
1995cdf0e10cSrcweir                     // when both can be used we get two xml:id!
1996cdf0e10cSrcweir                     uno::Reference<rdf::XMetadatable> const xMeta(xRef,
1997cdf0e10cSrcweir                         uno::UNO_QUERY);
1998cdf0e10cSrcweir                     OSL_ENSURE(!xMeta.is(), "paragraph that implements "
1999cdf0e10cSrcweir                         "XMetadatable used in interfaceToIdentifierMapper?");
2000cdf0e10cSrcweir                     GetExport().AddAttributeIdLegacy(XML_NAMESPACE_TEXT,
2001cdf0e10cSrcweir                         rIdentifier);
2002cdf0e10cSrcweir                 }
2003cdf0e10cSrcweir 			}
2004cdf0e10cSrcweir 
2005cdf0e10cSrcweir 			OUString sAutoStyle( sStyle );
2006cdf0e10cSrcweir 			sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, xPropSet, sStyle );
2007cdf0e10cSrcweir 			if( sAutoStyle.getLength() )
2008cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
2009cdf0e10cSrcweir 							  GetExport().EncodeStyleName( sAutoStyle ) );
2010cdf0e10cSrcweir 
2011cdf0e10cSrcweir 			if( rPropSetHelper.hasProperty( PARA_CONDITIONAL_STYLE_NAME ) )
2012cdf0e10cSrcweir 			{
2013cdf0e10cSrcweir 				OUString sCondStyle;
2014cdf0e10cSrcweir 				if( xMultiPropSet.is() )
2015cdf0e10cSrcweir 					rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME,
2016cdf0e10cSrcweir 												 	xMultiPropSet ) >>= sCondStyle;
2017cdf0e10cSrcweir 				else
2018cdf0e10cSrcweir 					rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME,
2019cdf0e10cSrcweir 												 	xPropSet ) >>= sCondStyle;
2020cdf0e10cSrcweir 				if( sCondStyle != sStyle )
2021cdf0e10cSrcweir 				{
2022cdf0e10cSrcweir 					sCondStyle = Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, xPropSet,
2023cdf0e10cSrcweir 								   	   sCondStyle );
2024cdf0e10cSrcweir 					if( sCondStyle.getLength() )
2025cdf0e10cSrcweir 						GetExport().AddAttribute( XML_NAMESPACE_TEXT,
2026cdf0e10cSrcweir 												  XML_COND_STYLE_NAME,
2027cdf0e10cSrcweir 							  GetExport().EncodeStyleName( sCondStyle ) );
2028cdf0e10cSrcweir 				}
2029cdf0e10cSrcweir 			}
2030cdf0e10cSrcweir 
2031cdf0e10cSrcweir 			//if( rPropSetHelper.hasProperty( PARA_CHAPTER_NUMERBING_LEVEL ) )	//#outline level,zhaojianwei
2032cdf0e10cSrcweir 			if( rPropSetHelper.hasProperty( PARA_OUTLINE_LEVEL ) )				//<-end
2033cdf0e10cSrcweir 			{
2034cdf0e10cSrcweir 				if( xMultiPropSet.is() )
2035cdf0e10cSrcweir 					//rPropSetHelper.getValue( PARA_CHAPTER_NUMERBING_LEVEL,	//#outline level,zhaojianwei
2036cdf0e10cSrcweir 					rPropSetHelper.getValue( PARA_OUTLINE_LEVEL,				//<-end
2037cdf0e10cSrcweir 												 	xMultiPropSet ) >>= nOutlineLevel;
2038cdf0e10cSrcweir 				else
2039cdf0e10cSrcweir 					//rPropSetHelper.getValue( PARA_CHAPTER_NUMERBING_LEVEL,	//#outline level,zhaojianwei
2040cdf0e10cSrcweir 					rPropSetHelper.getValue( PARA_OUTLINE_LEVEL,				//<-end
2041cdf0e10cSrcweir 												 	xPropSet ) >>= nOutlineLevel;
2042cdf0e10cSrcweir 
2043cdf0e10cSrcweir 				//if( -1 != nOutlineLevel )	//#outline level,zhaojianwei
2044cdf0e10cSrcweir 				if( 0 < nOutlineLevel )	//<-end,zhaojianwei
2045cdf0e10cSrcweir 				{
2046cdf0e10cSrcweir 					OUStringBuffer sTmp;
2047cdf0e10cSrcweir 					//sTmp.append( sal_Int32( nOutlineLevel + 1 ) );	//#outline level,zhaojianwei
2048cdf0e10cSrcweir 					sTmp.append( sal_Int32( nOutlineLevel) );		//<-end,zhaojianwei
2049cdf0e10cSrcweir 					GetExport().AddAttribute( XML_NAMESPACE_TEXT,
2050cdf0e10cSrcweir 											  XML_OUTLINE_LEVEL,
2051cdf0e10cSrcweir 								  sTmp.makeStringAndClear() );
2052cdf0e10cSrcweir 
2053cdf0e10cSrcweir                     if( rPropSetHelper.hasProperty( NUMBERING_IS_NUMBER ) )
2054cdf0e10cSrcweir                     {
2055cdf0e10cSrcweir                         bool bIsNumber = false;
2056cdf0e10cSrcweir                         if( xMultiPropSet.is() )
2057cdf0e10cSrcweir                             rPropSetHelper.getValue(
2058cdf0e10cSrcweir                                        NUMBERING_IS_NUMBER, xMultiPropSet ) >>= bIsNumber;
2059cdf0e10cSrcweir                         else
2060cdf0e10cSrcweir                             rPropSetHelper.getValue(
2061cdf0e10cSrcweir                                        NUMBERING_IS_NUMBER, xPropSet ) >>= bIsNumber;
2062cdf0e10cSrcweir 
2063cdf0e10cSrcweir                         OUString sListStyleName;
2064cdf0e10cSrcweir                         if( xMultiPropSet.is() )
2065cdf0e10cSrcweir                             rPropSetHelper.getValue(
2066cdf0e10cSrcweir                                        PARA_NUMBERING_STYLENAME, xMultiPropSet ) >>= sListStyleName;
2067cdf0e10cSrcweir                         else
2068cdf0e10cSrcweir                             rPropSetHelper.getValue(
2069cdf0e10cSrcweir                                        PARA_NUMBERING_STYLENAME, xPropSet ) >>= sListStyleName;
2070cdf0e10cSrcweir 
2071cdf0e10cSrcweir 
2072cdf0e10cSrcweir 
2073cdf0e10cSrcweir 				        bool bAssignedtoOutlineStyle = false;//#outline level,add by zhaojianwei
2074cdf0e10cSrcweir 						{
2075cdf0e10cSrcweir                             Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(), UNO_QUERY );
2076cdf0e10cSrcweir 
2077cdf0e10cSrcweir                             OUString sOutlineName;
2078cdf0e10cSrcweir                             if (xCNSupplier.is())
2079cdf0e10cSrcweir                             {
2080cdf0e10cSrcweir                                 Reference< XIndexReplace > xNumRule ( xCNSupplier->getChapterNumberingRules() );
2081cdf0e10cSrcweir                                 DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
2082cdf0e10cSrcweir 
2083cdf0e10cSrcweir                                 if (xNumRule.is())
2084cdf0e10cSrcweir                                 {
2085cdf0e10cSrcweir                                     Reference< XPropertySet > xNumRulePropSet( xNumRule, UNO_QUERY );
2086cdf0e10cSrcweir                                     xNumRulePropSet->getPropertyValue(
2087cdf0e10cSrcweir 										OUString(RTL_CONSTASCII_USTRINGPARAM("Name")) ) >>= sOutlineName;
2088cdf0e10cSrcweir                                     bAssignedtoOutlineStyle = ( sListStyleName == sOutlineName );
2089cdf0e10cSrcweir                                 }
2090cdf0e10cSrcweir 							}
2091cdf0e10cSrcweir 
2092cdf0e10cSrcweir 						}	//<end,zhaojianwei
2093cdf0e10cSrcweir 
2094cdf0e10cSrcweir 						//if( ! bIsNumber )			//#outline level,removed by zhaojianwei
2095cdf0e10cSrcweir 						if( ! bIsNumber && bAssignedtoOutlineStyle )	//#outline level,add by zhaojianwei
2096cdf0e10cSrcweir                             GetExport().AddAttribute( XML_NAMESPACE_TEXT,
2097cdf0e10cSrcweir                                                       XML_IS_LIST_HEADER,
2098cdf0e10cSrcweir                                                       XML_TRUE );
2099cdf0e10cSrcweir                     }
2100cdf0e10cSrcweir 
2101cdf0e10cSrcweir                     {
2102cdf0e10cSrcweir                         String sParaIsNumberingRestart
2103cdf0e10cSrcweir                             (RTL_CONSTASCII_USTRINGPARAM
2104cdf0e10cSrcweir                              ("ParaIsNumberingRestart"));
2105cdf0e10cSrcweir                         bool bIsRestartNumbering = false;
2106cdf0e10cSrcweir 
2107cdf0e10cSrcweir                         Reference< XPropertySetInfo >
2108cdf0e10cSrcweir                         xPropSetInfo(xMultiPropSet.is() ?
2109cdf0e10cSrcweir                                      xMultiPropSet->getPropertySetInfo():
2110cdf0e10cSrcweir                                      xPropSet->getPropertySetInfo());
2111cdf0e10cSrcweir 
2112cdf0e10cSrcweir                         if (xPropSetInfo->
2113cdf0e10cSrcweir                             hasPropertyByName(sParaIsNumberingRestart))
2114cdf0e10cSrcweir                         {
2115cdf0e10cSrcweir                             xPropSet->getPropertyValue(sParaIsNumberingRestart)
2116cdf0e10cSrcweir                                 >>= bIsRestartNumbering;
2117cdf0e10cSrcweir                         }
2118cdf0e10cSrcweir 
2119cdf0e10cSrcweir                         if (bIsRestartNumbering)
2120cdf0e10cSrcweir                         {
2121cdf0e10cSrcweir                             GetExport().AddAttribute(XML_NAMESPACE_TEXT,
2122cdf0e10cSrcweir                                                      XML_RESTART_NUMBERING,
2123cdf0e10cSrcweir                                                      XML_TRUE);
2124cdf0e10cSrcweir 
2125cdf0e10cSrcweir                             String sNumberingStartValue
2126cdf0e10cSrcweir                                 (RTL_CONSTASCII_USTRINGPARAM
2127cdf0e10cSrcweir                                  ("NumberingStartValue"));
2128cdf0e10cSrcweir 
2129cdf0e10cSrcweir 
2130cdf0e10cSrcweir                             sal_Int32 nStartValue = 0;
2131cdf0e10cSrcweir 
2132cdf0e10cSrcweir                             if (xPropSetInfo->
2133cdf0e10cSrcweir                                 hasPropertyByName(sNumberingStartValue))
2134cdf0e10cSrcweir                             {
2135cdf0e10cSrcweir                                 xPropSet->getPropertyValue(sNumberingStartValue)
2136cdf0e10cSrcweir                                     >>= nStartValue;
2137cdf0e10cSrcweir 
2138cdf0e10cSrcweir                                 OUStringBuffer sTmpStartValue;
2139cdf0e10cSrcweir 
2140cdf0e10cSrcweir                                 sTmpStartValue.append(nStartValue);
2141cdf0e10cSrcweir 
2142cdf0e10cSrcweir                                 GetExport().
2143cdf0e10cSrcweir                                     AddAttribute(XML_NAMESPACE_TEXT,
2144cdf0e10cSrcweir                                                  XML_START_VALUE,
2145cdf0e10cSrcweir                                                  sTmpStartValue.
2146cdf0e10cSrcweir                                                  makeStringAndClear());
2147cdf0e10cSrcweir                             }
2148cdf0e10cSrcweir                         }
2149cdf0e10cSrcweir                     }
2150cdf0e10cSrcweir 				}
2151cdf0e10cSrcweir 			}
2152cdf0e10cSrcweir 		}
2153cdf0e10cSrcweir 	}
2154cdf0e10cSrcweir 
2155cdf0e10cSrcweir 	Reference < XEnumerationAccess > xEA( rTextContent, UNO_QUERY );
2156cdf0e10cSrcweir 	Reference < XEnumeration > xTextEnum;
2157cdf0e10cSrcweir     xTextEnum = xEA->createEnumeration();
2158cdf0e10cSrcweir     const sal_Bool bHasPortions = xTextEnum.is();
2159cdf0e10cSrcweir 
2160cdf0e10cSrcweir 	Reference < XEnumeration> xContentEnum;
2161cdf0e10cSrcweir 	Reference < XContentEnumerationAccess > xCEA( rTextContent, UNO_QUERY );
2162cdf0e10cSrcweir 	if( xCEA.is() )
2163cdf0e10cSrcweir 		xContentEnum.set(xCEA->createContentEnumeration( sTextContentService ));
2164cdf0e10cSrcweir 	const sal_Bool bHasContentEnum = xContentEnum.is() &&
2165cdf0e10cSrcweir 	   	                             xContentEnum->hasMoreElements();
2166cdf0e10cSrcweir 
2167cdf0e10cSrcweir 	Reference < XTextSection > xSection;
2168cdf0e10cSrcweir 	if( bHasContentEnum )
2169cdf0e10cSrcweir 	{
2170cdf0e10cSrcweir 		// For the auto styles, the multi property set helper is only used
2171cdf0e10cSrcweir 		// if hard attributes are existing. Therfor, it seems to be a better
2172cdf0e10cSrcweir 		// strategy to have the TextSection property seperate, because otherwise
2173cdf0e10cSrcweir 		// we always retrieve the style names even if they are not required.
2174cdf0e10cSrcweir 		if( bAutoStyles )
2175cdf0e10cSrcweir 		{
2176cdf0e10cSrcweir 			if( xPropSet->getPropertySetInfo()->hasPropertyByName( sTextSection ) )
2177cdf0e10cSrcweir 			{
2178cdf0e10cSrcweir                 xSection.set(xPropSet->getPropertyValue( sTextSection ), uno::UNO_QUERY);
2179cdf0e10cSrcweir 			}
2180cdf0e10cSrcweir 		}
2181cdf0e10cSrcweir 		else
2182cdf0e10cSrcweir 		{
2183cdf0e10cSrcweir 			if( rPropSetHelper.hasProperty( TEXT_SECTION ) )
2184cdf0e10cSrcweir 			{
2185cdf0e10cSrcweir                 xSection.set(rPropSetHelper.getValue( TEXT_SECTION ), uno::UNO_QUERY);
2186cdf0e10cSrcweir 			}
2187cdf0e10cSrcweir 		}
2188cdf0e10cSrcweir 	}
2189cdf0e10cSrcweir 
2190cdf0e10cSrcweir 	if( bAutoStyles )
2191cdf0e10cSrcweir 	{
2192cdf0e10cSrcweir 		sal_Bool bPrevCharIsSpace = sal_True;
2193cdf0e10cSrcweir 		if( bHasContentEnum )
2194cdf0e10cSrcweir 			bPrevCharIsSpace = !exportTextContentEnumeration(
2195cdf0e10cSrcweir 									xContentEnum, bAutoStyles, xSection,
2196cdf0e10cSrcweir                                     bIsProgress, sal_True, 0, sal_True );
2197cdf0e10cSrcweir 		if ( bHasPortions )
2198cdf0e10cSrcweir             exportTextRangeEnumeration( xTextEnum, bAutoStyles, bIsProgress );
2199cdf0e10cSrcweir     }
2200cdf0e10cSrcweir 	else
2201cdf0e10cSrcweir 	{
2202cdf0e10cSrcweir 		sal_Bool bPrevCharIsSpace = sal_True;
2203cdf0e10cSrcweir 		enum XMLTokenEnum eElem =
2204cdf0e10cSrcweir 			//-1 == nOutlineLevel ? XML_P : XML_H;	//#outline level,zhaojianwei
2205cdf0e10cSrcweir 			0 < nOutlineLevel ? XML_H : XML_P;	//<-end,zhaojianwei
2206cdf0e10cSrcweir 		SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, eElem,
2207cdf0e10cSrcweir 								  sal_True, sal_False );
2208cdf0e10cSrcweir 		if( bHasContentEnum )
2209cdf0e10cSrcweir 			bPrevCharIsSpace = !exportTextContentEnumeration(
2210cdf0e10cSrcweir 									xContentEnum, bAutoStyles, xSection,
2211cdf0e10cSrcweir 									bIsProgress );
2212cdf0e10cSrcweir 		exportTextRangeEnumeration( xTextEnum, bAutoStyles, bIsProgress,
2213cdf0e10cSrcweir 								 	bPrevCharIsSpace );
2214cdf0e10cSrcweir 	}
2215cdf0e10cSrcweir }
2216cdf0e10cSrcweir 
exportTextRangeEnumeration(const Reference<XEnumeration> & rTextEnum,sal_Bool bAutoStyles,sal_Bool bIsProgress,sal_Bool bPrvChrIsSpc)2217cdf0e10cSrcweir void XMLTextParagraphExport::exportTextRangeEnumeration(
2218cdf0e10cSrcweir     const Reference < XEnumeration > & rTextEnum,
22193b32dd21SOliver-Rainer Wittmann     sal_Bool bAutoStyles,
22203b32dd21SOliver-Rainer Wittmann     sal_Bool bIsProgress,
2221cdf0e10cSrcweir     sal_Bool bPrvChrIsSpc )
2222cdf0e10cSrcweir {
2223cdf0e10cSrcweir     static OUString sMeta(RTL_CONSTASCII_USTRINGPARAM("InContentMetadata"));
2224dec99bbdSOliver-Rainer Wittmann     static OUString sAnnotation(RTL_CONSTASCII_USTRINGPARAM("Annotation"));
2225dec99bbdSOliver-Rainer Wittmann     static OUString sAnnotationEnd(RTL_CONSTASCII_USTRINGPARAM("AnnotationEnd"));
2226dec99bbdSOliver-Rainer Wittmann 
2227cdf0e10cSrcweir     sal_Bool bPrevCharIsSpace = bPrvChrIsSpc;
2228cdf0e10cSrcweir 
2229cdf0e10cSrcweir     while( rTextEnum->hasMoreElements() )
2230cdf0e10cSrcweir     {
2231cdf0e10cSrcweir         Reference<XPropertySet> xPropSet(rTextEnum->nextElement(), UNO_QUERY);
2232cdf0e10cSrcweir         Reference < XTextRange > xTxtRange(xPropSet, uno::UNO_QUERY);
2233cdf0e10cSrcweir         Reference<XPropertySetInfo> xPropInfo(xPropSet->getPropertySetInfo());
2234cdf0e10cSrcweir 
2235cdf0e10cSrcweir         if (xPropInfo->hasPropertyByName(sTextPortionType))
2236cdf0e10cSrcweir         {
2237cdf0e10cSrcweir             rtl::OUString sType;
2238cdf0e10cSrcweir             xPropSet->getPropertyValue(sTextPortionType) >>= sType;
2239cdf0e10cSrcweir 
2240cdf0e10cSrcweir             if( sType.equals(sText))
2241cdf0e10cSrcweir             {
22423b32dd21SOliver-Rainer Wittmann                 exportTextRange( xTxtRange, bAutoStyles, bPrevCharIsSpace );
2243cdf0e10cSrcweir             }
2244cdf0e10cSrcweir             else if( sType.equals(sTextField))
2245cdf0e10cSrcweir             {
2246dec99bbdSOliver-Rainer Wittmann                 exportTextField( xTxtRange, bAutoStyles, bIsProgress );
2247dec99bbdSOliver-Rainer Wittmann                 bPrevCharIsSpace = false;
22483b32dd21SOliver-Rainer Wittmann             }
2249dec99bbdSOliver-Rainer Wittmann             else if ( sType.equals( sAnnotation ) )
22503b32dd21SOliver-Rainer Wittmann             {
2251cdf0e10cSrcweir                 exportTextField( xTxtRange, bAutoStyles, bIsProgress );
22523b32dd21SOliver-Rainer Wittmann                 bPrevCharIsSpace = false;
22533b32dd21SOliver-Rainer Wittmann             }
2254dec99bbdSOliver-Rainer Wittmann             else if ( sType.equals( sAnnotationEnd ) )
2255dec99bbdSOliver-Rainer Wittmann             {
2256dec99bbdSOliver-Rainer Wittmann                 Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
2257dec99bbdSOliver-Rainer Wittmann                 const OUString& rName = xBookmark->getName();
2258dec99bbdSOliver-Rainer Wittmann                 if ( rName.getLength() > 0 )
2259dec99bbdSOliver-Rainer Wittmann                 {
2260dec99bbdSOliver-Rainer Wittmann                     GetExport().AddAttribute(XML_NAMESPACE_OFFICE, XML_NAME, rName);
2261dec99bbdSOliver-Rainer Wittmann                 }
2262dec99bbdSOliver-Rainer Wittmann                 SvXMLElementExport aElem( GetExport(), !bAutoStyles, XML_NAMESPACE_OFFICE, XML_ANNOTATION_END, sal_False, sal_False );
2263cdf0e10cSrcweir             }
2264cdf0e10cSrcweir             else if( sType.equals( sFrame ) )
2265cdf0e10cSrcweir             {
2266cdf0e10cSrcweir                 Reference < XEnumeration> xContentEnum;
22673b32dd21SOliver-Rainer Wittmann                 Reference < XContentEnumerationAccess > xCEA( xTxtRange, UNO_QUERY );
2268cdf0e10cSrcweir                 if( xCEA.is() )
22693b32dd21SOliver-Rainer Wittmann                     xContentEnum.set(xCEA->createContentEnumeration( sTextContentService ));
2270cdf0e10cSrcweir                 // frames are never in sections
2271cdf0e10cSrcweir                 Reference<XTextSection> xSection;
2272cdf0e10cSrcweir                 if( xContentEnum.is() )
22733b32dd21SOliver-Rainer Wittmann                     exportTextContentEnumeration(
22743b32dd21SOliver-Rainer Wittmann                     xContentEnum,
2275cdf0e10cSrcweir                     bAutoStyles,
22763b32dd21SOliver-Rainer Wittmann                     xSection,
22773b32dd21SOliver-Rainer Wittmann                     bIsProgress,
22783b32dd21SOliver-Rainer Wittmann                     sal_True,
2279cdf0e10cSrcweir                     &xPropSet );
2280cdf0e10cSrcweir 
2281cdf0e10cSrcweir                 bPrevCharIsSpace = sal_False;
2282cdf0e10cSrcweir             }
2283cdf0e10cSrcweir             else if (sType.equals(sFootnote))
2284cdf0e10cSrcweir             {
22853b32dd21SOliver-Rainer Wittmann                 exportTextFootnote( xPropSet, xTxtRange->getString(), bAutoStyles, bIsProgress );
2286cdf0e10cSrcweir                 bPrevCharIsSpace = sal_False;
2287cdf0e10cSrcweir             }
2288cdf0e10cSrcweir             else if (sType.equals(sBookmark))
2289cdf0e10cSrcweir             {
22903b32dd21SOliver-Rainer Wittmann                 exportTextMark( xPropSet, sBookmark, lcl_XmlBookmarkElements, bAutoStyles );
2291cdf0e10cSrcweir             }
2292cdf0e10cSrcweir             else if (sType.equals(sReferenceMark))
2293cdf0e10cSrcweir             {
22943b32dd21SOliver-Rainer Wittmann                 exportTextMark( xPropSet, sReferenceMark, lcl_XmlReferenceElements, bAutoStyles);
2295cdf0e10cSrcweir             }
2296cdf0e10cSrcweir             else if (sType.equals(sDocumentIndexMark))
2297cdf0e10cSrcweir             {
2298cdf0e10cSrcweir                 pIndexMarkExport->ExportIndexMark( xPropSet, bAutoStyles);
2299cdf0e10cSrcweir             }
2300cdf0e10cSrcweir             else if (sType.equals(sRedline))
2301cdf0e10cSrcweir             {
2302cdf0e10cSrcweir                 if (NULL != pRedlineExport)
2303cdf0e10cSrcweir                     pRedlineExport->ExportChange( xPropSet, bAutoStyles );
2304cdf0e10cSrcweir             }
2305cdf0e10cSrcweir             else if (sType.equals(sRuby))
2306cdf0e10cSrcweir             {
2307cdf0e10cSrcweir                 exportRuby( xPropSet, bAutoStyles );
2308cdf0e10cSrcweir             }
2309cdf0e10cSrcweir             else if (sType.equals(sMeta))
2310cdf0e10cSrcweir             {
2311cdf0e10cSrcweir                 exportMeta( xPropSet, bAutoStyles, bIsProgress );
2312cdf0e10cSrcweir             }
2313cdf0e10cSrcweir             else if (sType.equals(sTextFieldStart))
2314cdf0e10cSrcweir             {
2315cdf0e10cSrcweir                 Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
2316cdf0e10cSrcweir                 if (xBookmark.is())
2317cdf0e10cSrcweir                 {
2318cdf0e10cSrcweir                     GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
2319cdf0e10cSrcweir                 }
23203b32dd21SOliver-Rainer Wittmann 
2321dec99bbdSOliver-Rainer Wittmann                 Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
2322cdf0e10cSrcweir                 if (xFormField.is())
2323cdf0e10cSrcweir                 {
2324cdf0e10cSrcweir                     GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
2325cdf0e10cSrcweir                 }
23263b32dd21SOliver-Rainer Wittmann 
2327cdf0e10cSrcweir                 GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_START, sal_False);
2328cdf0e10cSrcweir                 if (xFormField.is())
2329cdf0e10cSrcweir                 {
2330cdf0e10cSrcweir                     FieldParamExporter(&GetExport(), xFormField->getParameters()).Export();
2331cdf0e10cSrcweir                 }
2332cdf0e10cSrcweir                 GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_START, sal_False);
2333cdf0e10cSrcweir             }
2334cdf0e10cSrcweir             else if (sType.equals(sTextFieldEnd))
2335cdf0e10cSrcweir             {
2336cdf0e10cSrcweir                 GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_END, sal_False);
2337cdf0e10cSrcweir                 GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_END, sal_False);
2338cdf0e10cSrcweir             }
2339cdf0e10cSrcweir             else if (sType.equals(sTextFieldStartEnd))
2340cdf0e10cSrcweir             {
2341cdf0e10cSrcweir                 Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
2342cdf0e10cSrcweir                 if (xBookmark.is())
2343cdf0e10cSrcweir                 {
2344cdf0e10cSrcweir                     GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
2345cdf0e10cSrcweir                 }
2346cdf0e10cSrcweir                 Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
2347cdf0e10cSrcweir                 if (xFormField.is())
2348cdf0e10cSrcweir                 {
2349cdf0e10cSrcweir                     GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
2350cdf0e10cSrcweir                 }
2351cdf0e10cSrcweir                 GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK, sal_False);
2352cdf0e10cSrcweir                 if (xFormField.is())
2353cdf0e10cSrcweir                 {
2354cdf0e10cSrcweir                     FieldParamExporter(&GetExport(), xFormField->getParameters()).Export();
2355cdf0e10cSrcweir                 }
2356cdf0e10cSrcweir                 GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK, sal_False);
2357cdf0e10cSrcweir             }
2358cdf0e10cSrcweir             else if (sType.equals(sSoftPageBreak))
2359cdf0e10cSrcweir             {
2360cdf0e10cSrcweir                 exportSoftPageBreak(xPropSet,	bAutoStyles);
2361cdf0e10cSrcweir             }
2362cdf0e10cSrcweir             else {
2363cdf0e10cSrcweir                 DBG_ERROR("unknown text portion type");
2364cdf0e10cSrcweir             }
2365cdf0e10cSrcweir         }
2366cdf0e10cSrcweir         else
2367cdf0e10cSrcweir         {
2368cdf0e10cSrcweir             Reference<XServiceInfo> xServiceInfo( xTxtRange, UNO_QUERY );
2369cdf0e10cSrcweir             if( xServiceInfo->supportsService( sTextFieldService ) )
2370cdf0e10cSrcweir             {
2371cdf0e10cSrcweir                 exportTextField( xTxtRange, bAutoStyles, bIsProgress );
2372cdf0e10cSrcweir                 bPrevCharIsSpace = sal_False;
2373cdf0e10cSrcweir             }
2374cdf0e10cSrcweir             else
2375cdf0e10cSrcweir             {
2376cdf0e10cSrcweir                 // no TextPortionType property -> non-Writer app -> text
2377cdf0e10cSrcweir                 exportTextRange( xTxtRange, bAutoStyles, bPrevCharIsSpace );
2378cdf0e10cSrcweir             }
2379cdf0e10cSrcweir         }
2380cdf0e10cSrcweir     }
2381cdf0e10cSrcweir 
2382cdf0e10cSrcweir // now that there are nested enumerations for meta(-field), this may be valid!
2383cdf0e10cSrcweir //	DBG_ASSERT( !bOpenRuby, "Red Alert: Ruby still open!" );
2384cdf0e10cSrcweir }
2385cdf0e10cSrcweir 
exportTable(const Reference<XTextContent> &,sal_Bool,sal_Bool)2386cdf0e10cSrcweir void XMLTextParagraphExport::exportTable(
2387cdf0e10cSrcweir 		const Reference < XTextContent > &,
2388cdf0e10cSrcweir 		sal_Bool /*bAutoStyles*/, sal_Bool /*bIsProgress*/ )
2389cdf0e10cSrcweir {
2390cdf0e10cSrcweir }
2391cdf0e10cSrcweir 
exportTextField(const Reference<XTextRange> & rTextRange,sal_Bool bAutoStyles,sal_Bool bIsProgress)2392cdf0e10cSrcweir void XMLTextParagraphExport::exportTextField(
2393cdf0e10cSrcweir 		const Reference < XTextRange > & rTextRange,
2394cdf0e10cSrcweir         sal_Bool bAutoStyles, sal_Bool bIsProgress )
2395cdf0e10cSrcweir {
2396cdf0e10cSrcweir 	Reference < XPropertySet > xPropSet( rTextRange, UNO_QUERY );
2397cdf0e10cSrcweir 	// non-Writer apps need not support Property TextField, so test first
2398cdf0e10cSrcweir 	if (xPropSet->getPropertySetInfo()->hasPropertyByName( sTextField ))
2399cdf0e10cSrcweir 	{
2400cdf0e10cSrcweir         Reference < XTextField > xTxtFld(xPropSet->getPropertyValue( sTextField ), uno::UNO_QUERY);
2401cdf0e10cSrcweir 		DBG_ASSERT( xTxtFld.is(), "text field missing" );
2402cdf0e10cSrcweir 		if( xTxtFld.is() )
2403cdf0e10cSrcweir 		{
2404cdf0e10cSrcweir             exportTextField(xTxtFld, bAutoStyles, bIsProgress, sal_True);
2405cdf0e10cSrcweir 		}
2406cdf0e10cSrcweir 		else
2407cdf0e10cSrcweir 		{
2408cdf0e10cSrcweir 			// write only characters
2409cdf0e10cSrcweir 			GetExport().Characters(rTextRange->getString());
2410cdf0e10cSrcweir 		}
2411cdf0e10cSrcweir 	}
2412cdf0e10cSrcweir }
2413cdf0e10cSrcweir 
exportTextField(const Reference<XTextField> & xTextField,const sal_Bool bAutoStyles,const sal_Bool bIsProgress,const sal_Bool bRecursive)2414cdf0e10cSrcweir void XMLTextParagraphExport::exportTextField(
2415cdf0e10cSrcweir         const Reference < XTextField > & xTextField,
2416cdf0e10cSrcweir         const sal_Bool bAutoStyles, const sal_Bool bIsProgress,
2417cdf0e10cSrcweir         const sal_Bool bRecursive )
2418cdf0e10cSrcweir {
2419cdf0e10cSrcweir     if ( bAutoStyles )
2420cdf0e10cSrcweir     {
2421cdf0e10cSrcweir         pFieldExport->ExportFieldAutoStyle( xTextField, bIsProgress,
2422cdf0e10cSrcweir                 bRecursive );
2423cdf0e10cSrcweir     }
2424cdf0e10cSrcweir     else
2425cdf0e10cSrcweir     {
2426cdf0e10cSrcweir         pFieldExport->ExportField( xTextField, bIsProgress );
2427cdf0e10cSrcweir     }
2428cdf0e10cSrcweir }
2429cdf0e10cSrcweir 
exportSoftPageBreak(const Reference<XPropertySet> &,sal_Bool)2430cdf0e10cSrcweir void XMLTextParagraphExport::exportSoftPageBreak(
2431cdf0e10cSrcweir 	const Reference<XPropertySet> & ,
2432cdf0e10cSrcweir 	sal_Bool )
2433cdf0e10cSrcweir {
2434cdf0e10cSrcweir     SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
2435cdf0e10cSrcweir                               XML_SOFT_PAGE_BREAK, sal_False,
2436cdf0e10cSrcweir                               sal_False );
2437cdf0e10cSrcweir }
2438cdf0e10cSrcweir 
exportTextMark(const Reference<XPropertySet> & rPropSet,const OUString sProperty,const enum XMLTokenEnum pElements[],sal_Bool bAutoStyles)2439cdf0e10cSrcweir void XMLTextParagraphExport::exportTextMark(
2440cdf0e10cSrcweir 	const Reference<XPropertySet> & rPropSet,
2441cdf0e10cSrcweir 	const OUString sProperty,
2442cdf0e10cSrcweir 	const enum XMLTokenEnum pElements[],
2443cdf0e10cSrcweir 	sal_Bool bAutoStyles)
2444cdf0e10cSrcweir {
2445cdf0e10cSrcweir 	// mib said: "Hau wech!"
2446cdf0e10cSrcweir 	//
2447cdf0e10cSrcweir 	// (Originally, I'd export a span element in case the (book|reference)mark
2448cdf0e10cSrcweir 	//	was formatted. This actually makes a difference in case some pervert
2449cdf0e10cSrcweir 	//	sets a point reference mark in the document and, say, formats it bold.
2450cdf0e10cSrcweir 	//  This basically meaningless formatting will now been thrown away
2451cdf0e10cSrcweir 	//	(aka cleaned up), since mib said: ...					dvo
2452cdf0e10cSrcweir 
2453cdf0e10cSrcweir  	if (!bAutoStyles)
2454cdf0e10cSrcweir 	{
2455cdf0e10cSrcweir 		// name element
2456cdf0e10cSrcweir 		Reference<XNamed> xName(rPropSet->getPropertyValue(sProperty), UNO_QUERY);
2457cdf0e10cSrcweir 		GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME,
2458cdf0e10cSrcweir 								 xName->getName());
2459cdf0e10cSrcweir 
2460cdf0e10cSrcweir 		// start, end, or point-reference?
2461cdf0e10cSrcweir 		sal_Int8 nElement;
2462cdf0e10cSrcweir 		if( *(sal_Bool *)rPropSet->getPropertyValue(sIsCollapsed).getValue() )
2463cdf0e10cSrcweir 		{
2464cdf0e10cSrcweir 			nElement = 0;
2465cdf0e10cSrcweir 		}
2466cdf0e10cSrcweir 		else
2467cdf0e10cSrcweir 		{
2468cdf0e10cSrcweir 			nElement = *(sal_Bool *)rPropSet->getPropertyValue(sIsStart).getValue() ? 1 : 2;
2469cdf0e10cSrcweir 		}
2470cdf0e10cSrcweir 
2471cdf0e10cSrcweir         // bookmark, bookmark-start: xml:id and RDFa for RDF metadata
2472cdf0e10cSrcweir         if( nElement < 2 ) {
2473cdf0e10cSrcweir             GetExport().AddAttributeXmlId(xName);
2474cdf0e10cSrcweir             const uno::Reference<text::XTextContent> xTextContent(
2475cdf0e10cSrcweir                     xName, uno::UNO_QUERY_THROW);
2476cdf0e10cSrcweir             GetExport().AddAttributesRDFa(xTextContent);
2477cdf0e10cSrcweir         }
2478cdf0e10cSrcweir 
2479cdf0e10cSrcweir 		// export element
2480cdf0e10cSrcweir 		DBG_ASSERT(pElements != NULL, "illegal element array");
2481cdf0e10cSrcweir 		DBG_ASSERT(nElement >= 0, "illegal element number");
2482cdf0e10cSrcweir 		DBG_ASSERT(nElement <= 2, "illegal element number");
2483cdf0e10cSrcweir 		SvXMLElementExport aElem(GetExport(),
2484cdf0e10cSrcweir 								 XML_NAMESPACE_TEXT, pElements[nElement],
2485cdf0e10cSrcweir 								 sal_False, sal_False);
2486cdf0e10cSrcweir 	}
2487cdf0e10cSrcweir 	// else: no styles. (see above)
2488cdf0e10cSrcweir }
2489cdf0e10cSrcweir 
lcl_txtpara_isBoundAsChar(const Reference<XPropertySet> & rPropSet,const Reference<XPropertySetInfo> & rPropSetInfo)2490cdf0e10cSrcweir sal_Bool lcl_txtpara_isBoundAsChar(
2491cdf0e10cSrcweir 		const Reference < XPropertySet > & rPropSet,
2492cdf0e10cSrcweir 		const Reference < XPropertySetInfo > & rPropSetInfo )
2493cdf0e10cSrcweir {
2494cdf0e10cSrcweir 	sal_Bool bIsBoundAsChar = sal_False;
2495cdf0e10cSrcweir 	OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) );
2496cdf0e10cSrcweir 	if( rPropSetInfo->hasPropertyByName( sAnchorType ) )
2497cdf0e10cSrcweir 	{
2498cdf0e10cSrcweir 		TextContentAnchorType eAnchor;
2499cdf0e10cSrcweir 		rPropSet->getPropertyValue( sAnchorType ) >>= eAnchor;
2500cdf0e10cSrcweir 		bIsBoundAsChar = TextContentAnchorType_AS_CHARACTER == eAnchor;
2501cdf0e10cSrcweir 	}
2502cdf0e10cSrcweir 
2503cdf0e10cSrcweir 	return bIsBoundAsChar;
2504cdf0e10cSrcweir }
2505cdf0e10cSrcweir 
addTextFrameAttributes(const Reference<XPropertySet> & rPropSet,sal_Bool bShape,OUString * pMinHeightValue)2506cdf0e10cSrcweir sal_Int32 XMLTextParagraphExport::addTextFrameAttributes(
2507cdf0e10cSrcweir 	const Reference < XPropertySet >& rPropSet,
2508cdf0e10cSrcweir 	sal_Bool bShape,
2509cdf0e10cSrcweir 	OUString *pMinHeightValue )
2510cdf0e10cSrcweir {
2511cdf0e10cSrcweir 	sal_Int32 nShapeFeatures = SEF_DEFAULT;
2512cdf0e10cSrcweir 
2513cdf0e10cSrcweir 	// draw:name (#97662#: not for shapes, since those names will be
2514cdf0e10cSrcweir 	// treated in the shape export)
2515cdf0e10cSrcweir     if( !bShape )
2516cdf0e10cSrcweir     {
2517cdf0e10cSrcweir         Reference < XNamed > xNamed( rPropSet, UNO_QUERY );
2518cdf0e10cSrcweir         if( xNamed.is() )
2519cdf0e10cSrcweir         {
2520cdf0e10cSrcweir             OUString sName( xNamed->getName() );
2521cdf0e10cSrcweir             if( sName.getLength() )
2522cdf0e10cSrcweir                 GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_NAME,
2523cdf0e10cSrcweir                                           xNamed->getName() );
2524cdf0e10cSrcweir         }
2525cdf0e10cSrcweir     }
2526cdf0e10cSrcweir 
2527cdf0e10cSrcweir 	OUStringBuffer sValue;
2528cdf0e10cSrcweir 
2529cdf0e10cSrcweir 	// text:anchor-type
2530cdf0e10cSrcweir 	TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH;
2531cdf0e10cSrcweir 	rPropSet->getPropertyValue( sAnchorType ) >>= eAnchor;
2532cdf0e10cSrcweir 	{
2533cdf0e10cSrcweir 		XMLAnchorTypePropHdl aAnchorTypeHdl;
2534cdf0e10cSrcweir 		OUString sTmp;
2535cdf0e10cSrcweir         aAnchorTypeHdl.exportXML( sTmp, uno::makeAny(eAnchor),
2536cdf0e10cSrcweir 								  GetExport().GetMM100UnitConverter() );
2537cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_ANCHOR_TYPE, sTmp );
2538cdf0e10cSrcweir 	}
2539cdf0e10cSrcweir 
2540cdf0e10cSrcweir 	// text:anchor-page-number
2541cdf0e10cSrcweir 	if( TextContentAnchorType_AT_PAGE == eAnchor )
2542cdf0e10cSrcweir 	{
2543cdf0e10cSrcweir 		sal_Int16 nPage = 0;
2544cdf0e10cSrcweir 		rPropSet->getPropertyValue( sAnchorPageNo ) >>= nPage;
2545cdf0e10cSrcweir 		GetExport().GetMM100UnitConverter().convertNumber( sValue,
2546cdf0e10cSrcweir 														   (sal_Int32)nPage );
2547cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_ANCHOR_PAGE_NUMBER,
2548cdf0e10cSrcweir 								  sValue.makeStringAndClear() );
2549cdf0e10cSrcweir 	}
2550cdf0e10cSrcweir 	else
2551cdf0e10cSrcweir 	{
2552cdf0e10cSrcweir 		// #92210#
2553cdf0e10cSrcweir 		nShapeFeatures |= SEF_EXPORT_NO_WS;
2554cdf0e10cSrcweir 	}
2555cdf0e10cSrcweir 
2556cdf0e10cSrcweir     // OD 2004-06-01 #i27691# - correction: no export of svg:x, if object
2557cdf0e10cSrcweir     // is anchored as-character.
2558cdf0e10cSrcweir     if ( !bShape &&
2559cdf0e10cSrcweir          eAnchor != TextContentAnchorType_AS_CHARACTER )
2560cdf0e10cSrcweir 	{
2561cdf0e10cSrcweir 		// svg:x
2562cdf0e10cSrcweir 		sal_Int16 nHoriOrient =  HoriOrientation::NONE;
2563cdf0e10cSrcweir 		rPropSet->getPropertyValue( sHoriOrient ) >>= nHoriOrient;
2564cdf0e10cSrcweir 		if( HoriOrientation::NONE == nHoriOrient )
2565cdf0e10cSrcweir 		{
2566cdf0e10cSrcweir 			sal_Int32 nPos = 0;
2567cdf0e10cSrcweir 			rPropSet->getPropertyValue( sHoriOrientPosition ) >>= nPos;
2568cdf0e10cSrcweir 			GetExport().GetMM100UnitConverter().convertMeasure( sValue, nPos );
2569cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_X,
2570cdf0e10cSrcweir 									  sValue.makeStringAndClear() );
2571cdf0e10cSrcweir 		}
2572cdf0e10cSrcweir 	}
2573cdf0e10cSrcweir 	else if( TextContentAnchorType_AS_CHARACTER == eAnchor )
2574cdf0e10cSrcweir 		nShapeFeatures = (nShapeFeatures & ~SEF_EXPORT_X);
2575cdf0e10cSrcweir 
2576cdf0e10cSrcweir 	if( !bShape || TextContentAnchorType_AS_CHARACTER == eAnchor  )
2577cdf0e10cSrcweir 	{
2578cdf0e10cSrcweir 		// svg:y
2579cdf0e10cSrcweir 		sal_Int16 nVertOrient =  VertOrientation::NONE;
2580cdf0e10cSrcweir 		rPropSet->getPropertyValue( sVertOrient ) >>= nVertOrient;
2581cdf0e10cSrcweir 		if( VertOrientation::NONE == nVertOrient )
2582cdf0e10cSrcweir 		{
2583cdf0e10cSrcweir 			sal_Int32 nPos = 0;
2584cdf0e10cSrcweir 			rPropSet->getPropertyValue( sVertOrientPosition ) >>= nPos;
2585cdf0e10cSrcweir 			GetExport().GetMM100UnitConverter().convertMeasure( sValue, nPos );
2586cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_Y,
2587cdf0e10cSrcweir 									  sValue.makeStringAndClear() );
2588cdf0e10cSrcweir 		}
2589cdf0e10cSrcweir 		if( bShape )
2590cdf0e10cSrcweir 			nShapeFeatures = (nShapeFeatures & ~SEF_EXPORT_Y);
2591cdf0e10cSrcweir 	}
2592cdf0e10cSrcweir 
2593cdf0e10cSrcweir 
2594cdf0e10cSrcweir 	Reference< XPropertySetInfo > xPropSetInfo(rPropSet->getPropertySetInfo());
2595cdf0e10cSrcweir 
2596cdf0e10cSrcweir 	// svg:width
2597cdf0e10cSrcweir 	sal_Int16 nWidthType = SizeType::FIX;
2598cdf0e10cSrcweir 	if( xPropSetInfo->hasPropertyByName( sWidthType ) )
2599cdf0e10cSrcweir 	{
2600cdf0e10cSrcweir 		rPropSet->getPropertyValue( sWidthType ) >>= nWidthType;
2601cdf0e10cSrcweir 	}
2602cdf0e10cSrcweir 	if( xPropSetInfo->hasPropertyByName( sWidth ) )
2603cdf0e10cSrcweir 	{
2604cdf0e10cSrcweir 		sal_Int32 nWidth =  0;
2605cdf0e10cSrcweir         // VAR size will be written as zero min-size
2606cdf0e10cSrcweir         if( SizeType::VARIABLE != nWidthType )
2607cdf0e10cSrcweir         {
2608cdf0e10cSrcweir     		rPropSet->getPropertyValue( sWidth ) >>= nWidth;
2609cdf0e10cSrcweir         }
2610cdf0e10cSrcweir 		GetExport().GetMM100UnitConverter().convertMeasure( sValue, nWidth );
2611cdf0e10cSrcweir 		if( SizeType::FIX != nWidthType )
2612cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_WIDTH,
2613cdf0e10cSrcweir 									  sValue.makeStringAndClear() );
2614cdf0e10cSrcweir 		else
2615cdf0e10cSrcweir             GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH,
2616cdf0e10cSrcweir                                       sValue.makeStringAndClear() );
2617cdf0e10cSrcweir 	}
2618cdf0e10cSrcweir 	sal_Bool bSyncWidth = sal_False;
2619cdf0e10cSrcweir 	if( xPropSetInfo->hasPropertyByName( sIsSyncWidthToHeight ) )
2620cdf0e10cSrcweir 	{
2621cdf0e10cSrcweir 		bSyncWidth = *(sal_Bool *)rPropSet->getPropertyValue( sIsSyncWidthToHeight ).getValue();
2622cdf0e10cSrcweir 		if( bSyncWidth )
2623cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_WIDTH,
2624cdf0e10cSrcweir                                       XML_SCALE );
2625cdf0e10cSrcweir 	}
2626cdf0e10cSrcweir 	if( !bSyncWidth && xPropSetInfo->hasPropertyByName( sRelativeWidth ) )
2627cdf0e10cSrcweir 	{
2628cdf0e10cSrcweir 		sal_Int16 nRelWidth =  0;
2629cdf0e10cSrcweir 		rPropSet->getPropertyValue( sRelativeWidth ) >>= nRelWidth;
2630cdf0e10cSrcweir 		DBG_ASSERT( nRelWidth >= 0 && nRelWidth <= 254,
2631cdf0e10cSrcweir 					"Got illegal relative width from API" );
2632cdf0e10cSrcweir 		if( nRelWidth > 0 )
2633cdf0e10cSrcweir 		{
2634cdf0e10cSrcweir 			GetExport().GetMM100UnitConverter().convertPercent( sValue,
2635cdf0e10cSrcweir 																nRelWidth );
2636cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_WIDTH,
2637cdf0e10cSrcweir 									  sValue.makeStringAndClear() );
2638cdf0e10cSrcweir 		}
2639cdf0e10cSrcweir 	}
2640cdf0e10cSrcweir 
2641cdf0e10cSrcweir 	// svg:height, fo:min-height or style:rel-height
2642cdf0e10cSrcweir 	sal_Int16 nSizeType = SizeType::FIX;
2643cdf0e10cSrcweir 	if( xPropSetInfo->hasPropertyByName( sSizeType ) )
2644cdf0e10cSrcweir 	{
2645cdf0e10cSrcweir 		rPropSet->getPropertyValue( sSizeType ) >>= nSizeType;
2646cdf0e10cSrcweir 	}
2647cdf0e10cSrcweir 	sal_Bool bSyncHeight = sal_False;
2648cdf0e10cSrcweir 	if( xPropSetInfo->hasPropertyByName( sIsSyncHeightToWidth ) )
2649cdf0e10cSrcweir 	{
2650cdf0e10cSrcweir 		bSyncHeight = *(sal_Bool *)rPropSet->getPropertyValue( sIsSyncHeightToWidth ).getValue();
2651cdf0e10cSrcweir 	}
2652cdf0e10cSrcweir 	sal_Int16 nRelHeight =  0;
2653cdf0e10cSrcweir 	if( !bSyncHeight && xPropSetInfo->hasPropertyByName( sRelativeHeight ) )
2654cdf0e10cSrcweir 	{
2655cdf0e10cSrcweir 		rPropSet->getPropertyValue( sRelativeHeight ) >>= nRelHeight;
2656cdf0e10cSrcweir 	}
2657cdf0e10cSrcweir 	if( xPropSetInfo->hasPropertyByName( sHeight ) )
2658cdf0e10cSrcweir 	{
2659cdf0e10cSrcweir 		sal_Int32 nHeight =  0;
2660cdf0e10cSrcweir         if( SizeType::VARIABLE != nSizeType )
2661cdf0e10cSrcweir         {
2662cdf0e10cSrcweir     		rPropSet->getPropertyValue( sHeight ) >>= nHeight;
2663cdf0e10cSrcweir         }
2664cdf0e10cSrcweir 		GetExport().GetMM100UnitConverter().convertMeasure( sValue,
2665cdf0e10cSrcweir 															nHeight );
2666cdf0e10cSrcweir 		if( SizeType::FIX != nSizeType && 0==nRelHeight && !bSyncHeight &&
2667cdf0e10cSrcweir 		 	pMinHeightValue )
2668cdf0e10cSrcweir 			*pMinHeightValue = sValue.makeStringAndClear();
2669cdf0e10cSrcweir 		else
2670cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT,
2671cdf0e10cSrcweir 									  sValue.makeStringAndClear() );
2672cdf0e10cSrcweir 	}
2673cdf0e10cSrcweir 	if( bSyncHeight )
2674cdf0e10cSrcweir 	{
2675cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_HEIGHT,
2676cdf0e10cSrcweir 				SizeType::MIN == nSizeType ? XML_SCALE_MIN : XML_SCALE );
2677cdf0e10cSrcweir 
2678cdf0e10cSrcweir 	}
2679cdf0e10cSrcweir 	else if( nRelHeight > 0 )
2680cdf0e10cSrcweir 	{
2681cdf0e10cSrcweir 		GetExport().GetMM100UnitConverter().convertPercent( sValue,
2682cdf0e10cSrcweir 															nRelHeight );
2683cdf0e10cSrcweir 		if( SizeType::MIN == nSizeType )
2684cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_HEIGHT,
2685cdf0e10cSrcweir 									  sValue.makeStringAndClear() );
2686cdf0e10cSrcweir 		else
2687cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_HEIGHT,
2688cdf0e10cSrcweir 									  sValue.makeStringAndClear() );
2689cdf0e10cSrcweir 	}
2690cdf0e10cSrcweir 
2691cdf0e10cSrcweir 	OUString sZOrder( RTL_CONSTASCII_USTRINGPARAM( "ZOrder" ) );
2692cdf0e10cSrcweir 	if( xPropSetInfo->hasPropertyByName( sZOrder ) )
2693cdf0e10cSrcweir 	{
2694cdf0e10cSrcweir 		sal_Int32 nZIndex = 0;
2695cdf0e10cSrcweir 		rPropSet->getPropertyValue( sZOrder ) >>= nZIndex;
2696cdf0e10cSrcweir 		if( -1 != nZIndex )
2697cdf0e10cSrcweir 		{
2698cdf0e10cSrcweir 			GetExport().GetMM100UnitConverter().convertNumber( sValue,
2699cdf0e10cSrcweir 																nZIndex );
2700cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_ZINDEX,
2701cdf0e10cSrcweir 									  sValue.makeStringAndClear() );
2702cdf0e10cSrcweir 		}
2703cdf0e10cSrcweir 	}
2704cdf0e10cSrcweir 
2705cdf0e10cSrcweir 	return nShapeFeatures;
2706cdf0e10cSrcweir }
2707cdf0e10cSrcweir 
exportAnyTextFrame(const Reference<XTextContent> & rTxtCntnt,FrameType eType,sal_Bool bAutoStyles,sal_Bool bIsProgress,sal_Bool bExportContent,const Reference<XPropertySet> * pRangePropSet)2708cdf0e10cSrcweir void XMLTextParagraphExport::exportAnyTextFrame(
2709cdf0e10cSrcweir 		const Reference < XTextContent > & rTxtCntnt,
2710cdf0e10cSrcweir 		FrameType eType,
2711cdf0e10cSrcweir 		sal_Bool bAutoStyles,
2712cdf0e10cSrcweir         sal_Bool bIsProgress,
2713cdf0e10cSrcweir         sal_Bool bExportContent,
2714cdf0e10cSrcweir         const Reference < XPropertySet > *pRangePropSet)
2715cdf0e10cSrcweir {
2716cdf0e10cSrcweir 	Reference < XPropertySet > xPropSet( rTxtCntnt, UNO_QUERY );
2717cdf0e10cSrcweir 
2718cdf0e10cSrcweir 	if( bAutoStyles )
2719cdf0e10cSrcweir 	{
2720cdf0e10cSrcweir 		if( FT_EMBEDDED == eType )
2721cdf0e10cSrcweir 			_collectTextEmbeddedAutoStyles( xPropSet );
2722cdf0e10cSrcweir         // --> OD 2004-08-09 #i28745# - no text frame style for shapes
2723cdf0e10cSrcweir         else if ( FT_SHAPE != eType )
2724cdf0e10cSrcweir 			Add( XML_STYLE_FAMILY_TEXT_FRAME, xPropSet );
2725cdf0e10cSrcweir         // <--
2726cdf0e10cSrcweir 
2727cdf0e10cSrcweir 		if( pRangePropSet && lcl_txtpara_isBoundAsChar( xPropSet,
2728cdf0e10cSrcweir 											xPropSet->getPropertySetInfo() ) )
2729cdf0e10cSrcweir 			Add( XML_STYLE_FAMILY_TEXT_TEXT, *pRangePropSet );
2730cdf0e10cSrcweir 
2731cdf0e10cSrcweir 		switch( eType )
2732cdf0e10cSrcweir 		{
2733cdf0e10cSrcweir 		case FT_TEXT:
2734cdf0e10cSrcweir 			{
2735cdf0e10cSrcweir 				// frame bound frames
2736cdf0e10cSrcweir                 if ( bExportContent )
2737cdf0e10cSrcweir                 {
2738cdf0e10cSrcweir     				Reference < XTextFrame > xTxtFrame( rTxtCntnt, UNO_QUERY );
2739cdf0e10cSrcweir 	    			Reference < XText > xTxt(xTxtFrame->getText());
2740cdf0e10cSrcweir                     exportFrameFrames( sal_True, bIsProgress, &xTxtFrame );
2741cdf0e10cSrcweir                     exportText( xTxt, bAutoStyles, bIsProgress, sal_True );
2742cdf0e10cSrcweir                 }
2743cdf0e10cSrcweir             }
2744cdf0e10cSrcweir 			break;
2745cdf0e10cSrcweir 		case FT_SHAPE:
2746cdf0e10cSrcweir 			{
2747cdf0e10cSrcweir 				Reference < XShape > xShape( rTxtCntnt, UNO_QUERY );
2748cdf0e10cSrcweir 				GetExport().GetShapeExport()->collectShapeAutoStyles( xShape );
2749cdf0e10cSrcweir 			}
2750cdf0e10cSrcweir 			break;
2751cdf0e10cSrcweir 		default:
2752cdf0e10cSrcweir 			break;
2753cdf0e10cSrcweir 		}
2754cdf0e10cSrcweir 	}
2755cdf0e10cSrcweir 	else
2756cdf0e10cSrcweir 	{
2757cdf0e10cSrcweir 		Reference< XPropertySetInfo > xPropSetInfo(xPropSet->getPropertySetInfo());
2758cdf0e10cSrcweir 		Reference< XPropertyState > xPropState( xPropSet, UNO_QUERY );
2759cdf0e10cSrcweir 		{
2760cdf0e10cSrcweir 			sal_Bool bAddCharStyles = pRangePropSet &&
2761cdf0e10cSrcweir 				lcl_txtpara_isBoundAsChar( xPropSet, xPropSetInfo );
2762cdf0e10cSrcweir 
2763cdf0e10cSrcweir             sal_Bool bIsUICharStyle;
2764cdf0e10cSrcweir             sal_Bool bHasAutoStyle = sal_False;
2765cdf0e10cSrcweir             sal_Bool bDummy;
2766cdf0e10cSrcweir 
2767cdf0e10cSrcweir 			OUString sStyle;
2768cdf0e10cSrcweir 
2769cdf0e10cSrcweir 			if( bAddCharStyles )
2770cdf0e10cSrcweir 		   		sStyle = FindTextStyleAndHyperlink( *pRangePropSet, bDummy, bIsUICharStyle, bHasAutoStyle );
2771cdf0e10cSrcweir 			else
2772cdf0e10cSrcweir 				bIsUICharStyle = sal_False;
2773cdf0e10cSrcweir 
2774cdf0e10cSrcweir 			XMLTextCharStyleNamesElementExport aCharStylesExport(
2775cdf0e10cSrcweir 				GetExport(), bIsUICharStyle &&
2776cdf0e10cSrcweir 							 aCharStyleNamesPropInfoCache.hasProperty(
2777cdf0e10cSrcweir                                             *pRangePropSet ), bHasAutoStyle,
2778cdf0e10cSrcweir 				*pRangePropSet, sCharStyleNames );
2779cdf0e10cSrcweir 
2780cdf0e10cSrcweir 			if( sStyle.getLength() )
2781cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
2782cdf0e10cSrcweir 								  GetExport().EncodeStyleName( sStyle ) );
2783cdf0e10cSrcweir 			{
2784cdf0e10cSrcweir 				SvXMLElementExport aElem( GetExport(), sStyle.getLength() > 0,
2785cdf0e10cSrcweir 					XML_NAMESPACE_TEXT, XML_SPAN, sal_False, sal_False );
2786cdf0e10cSrcweir 				{
2787cdf0e10cSrcweir 					SvXMLElementExport aElement( GetExport(),
2788cdf0e10cSrcweir 						FT_SHAPE != eType &&
2789cdf0e10cSrcweir 						addHyperlinkAttributes( xPropSet,
2790cdf0e10cSrcweir 												xPropState,xPropSetInfo ),
2791cdf0e10cSrcweir 						XML_NAMESPACE_DRAW, XML_A, sal_False, sal_False );
2792cdf0e10cSrcweir 					switch( eType )
2793cdf0e10cSrcweir 					{
2794cdf0e10cSrcweir 					case FT_TEXT:
2795cdf0e10cSrcweir 						_exportTextFrame( xPropSet, xPropSetInfo, bIsProgress );
2796cdf0e10cSrcweir 						break;
2797cdf0e10cSrcweir 					case FT_GRAPHIC:
2798cdf0e10cSrcweir 						_exportTextGraphic( xPropSet, xPropSetInfo );
2799cdf0e10cSrcweir 						break;
2800cdf0e10cSrcweir 					case FT_EMBEDDED:
2801cdf0e10cSrcweir 						_exportTextEmbedded( xPropSet, xPropSetInfo );
2802cdf0e10cSrcweir 						break;
2803cdf0e10cSrcweir 					case FT_SHAPE:
2804cdf0e10cSrcweir 						{
2805cdf0e10cSrcweir 							Reference < XShape > xShape( rTxtCntnt, UNO_QUERY );
2806cdf0e10cSrcweir 							sal_Int32 nFeatures =
2807cdf0e10cSrcweir 								addTextFrameAttributes( xPropSet, sal_True );
2808cdf0e10cSrcweir 							GetExport().GetShapeExport()
2809cdf0e10cSrcweir 								->exportShape( xShape, nFeatures );
2810cdf0e10cSrcweir 						}
2811cdf0e10cSrcweir 						break;
2812cdf0e10cSrcweir 					}
2813cdf0e10cSrcweir 				}
2814cdf0e10cSrcweir 			}
2815cdf0e10cSrcweir 		}
2816cdf0e10cSrcweir 	}
2817cdf0e10cSrcweir }
2818cdf0e10cSrcweir 
_exportTextFrame(const Reference<XPropertySet> & rPropSet,const Reference<XPropertySetInfo> & rPropSetInfo,sal_Bool bIsProgress)2819cdf0e10cSrcweir void XMLTextParagraphExport::_exportTextFrame(
2820cdf0e10cSrcweir 		const Reference < XPropertySet > & rPropSet,
2821cdf0e10cSrcweir 		const Reference < XPropertySetInfo > & rPropSetInfo,
2822cdf0e10cSrcweir 		sal_Bool bIsProgress )
2823cdf0e10cSrcweir {
2824cdf0e10cSrcweir 	Reference < XTextFrame > xTxtFrame( rPropSet, UNO_QUERY );
2825cdf0e10cSrcweir 	Reference < XText > xTxt(xTxtFrame->getText());
2826cdf0e10cSrcweir 
2827cdf0e10cSrcweir 	OUString sStyle;
2828cdf0e10cSrcweir 	if( rPropSetInfo->hasPropertyByName( sFrameStyleName ) )
2829cdf0e10cSrcweir 	{
2830cdf0e10cSrcweir 		rPropSet->getPropertyValue( sFrameStyleName ) >>= sStyle;
2831cdf0e10cSrcweir 	}
2832cdf0e10cSrcweir 
2833cdf0e10cSrcweir 	OUString sAutoStyle( sStyle );
2834cdf0e10cSrcweir 	OUString aMinHeightValue;
2835cdf0e10cSrcweir 	sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, sStyle );
2836cdf0e10cSrcweir 	if( sAutoStyle.getLength() )
2837cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE_NAME,
2838cdf0e10cSrcweir 							  GetExport().EncodeStyleName( sAutoStyle ) );
2839cdf0e10cSrcweir 	addTextFrameAttributes( rPropSet, sal_False, &aMinHeightValue );
2840cdf0e10cSrcweir 
2841cdf0e10cSrcweir 	SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW,
2842cdf0e10cSrcweir 							  XML_FRAME, sal_False, sal_True );
2843cdf0e10cSrcweir 
2844cdf0e10cSrcweir 	if( aMinHeightValue.getLength() )
2845cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_HEIGHT,
2846cdf0e10cSrcweir 								  aMinHeightValue );
2847cdf0e10cSrcweir 
2848cdf0e10cSrcweir 	// draw:chain-next-name
2849cdf0e10cSrcweir 	if( rPropSetInfo->hasPropertyByName( sChainNextName ) )
2850cdf0e10cSrcweir 	{
2851cdf0e10cSrcweir 		OUString sNext;
2852cdf0e10cSrcweir 		if( (rPropSet->getPropertyValue( sChainNextName ) >>= sNext) && sNext.getLength() > 0 )
2853cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_DRAW,
2854cdf0e10cSrcweir 									  XML_CHAIN_NEXT_NAME,
2855cdf0e10cSrcweir 									  sNext );
2856cdf0e10cSrcweir 	}
2857cdf0e10cSrcweir 
2858cdf0e10cSrcweir 	{
2859cdf0e10cSrcweir 		SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_DRAW,
2860cdf0e10cSrcweir 								  XML_TEXT_BOX, sal_True, sal_True );
2861cdf0e10cSrcweir 
2862cdf0e10cSrcweir 		// frame bound frames
2863cdf0e10cSrcweir 		exportFramesBoundToFrame( xTxtFrame, bIsProgress );
2864cdf0e10cSrcweir 
2865cdf0e10cSrcweir 		exportText( xTxt, sal_False, bIsProgress, sal_True );
2866cdf0e10cSrcweir 	}
2867cdf0e10cSrcweir 
2868cdf0e10cSrcweir 	// script:events
2869cdf0e10cSrcweir 	Reference<XEventsSupplier> xEventsSupp( xTxtFrame, UNO_QUERY );
2870cdf0e10cSrcweir 	GetExport().GetEventExport().Export(xEventsSupp);
2871cdf0e10cSrcweir 
2872cdf0e10cSrcweir 	// image map
2873cdf0e10cSrcweir 	GetExport().GetImageMapExport().Export( rPropSet );
2874cdf0e10cSrcweir 
2875cdf0e10cSrcweir     // --> OD 2009-07-22 #i73249#
2876cdf0e10cSrcweir     // svg:title and svg:desc
2877cdf0e10cSrcweir     exportTitleAndDescription( rPropSet, rPropSetInfo );
2878cdf0e10cSrcweir     // <--
2879cdf0e10cSrcweir }
2880cdf0e10cSrcweir 
exportContour(const Reference<XPropertySet> & rPropSet,const Reference<XPropertySetInfo> & rPropSetInfo)2881cdf0e10cSrcweir void XMLTextParagraphExport::exportContour(
2882cdf0e10cSrcweir     const Reference < XPropertySet > & rPropSet,
2883cdf0e10cSrcweir     const Reference < XPropertySetInfo > & rPropSetInfo )
2884cdf0e10cSrcweir {
2885cdf0e10cSrcweir     if( !rPropSetInfo->hasPropertyByName( sContourPolyPolygon ) )
28861f882ec4SArmin Le Grand     {
2887cdf0e10cSrcweir         return;
28881f882ec4SArmin Le Grand     }
2889cdf0e10cSrcweir 
2890cdf0e10cSrcweir     PointSequenceSequence aSourcePolyPolygon;
2891cdf0e10cSrcweir     rPropSet->getPropertyValue( sContourPolyPolygon ) >>= aSourcePolyPolygon;
28921f882ec4SArmin Le Grand     const basegfx::B2DPolyPolygon aPolyPolygon(
28931f882ec4SArmin Le Grand         basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(
28941f882ec4SArmin Le Grand             aSourcePolyPolygon));
28951f882ec4SArmin Le Grand     const sal_uInt32 nPolygonCount(aPolyPolygon.count());
2896cdf0e10cSrcweir 
28971f882ec4SArmin Le Grand     if(!nPolygonCount)
28981f882ec4SArmin Le Grand     {
2899cdf0e10cSrcweir         return;
2900cdf0e10cSrcweir     }
2901cdf0e10cSrcweir 
29021f882ec4SArmin Le Grand     const basegfx::B2DRange aPolyPolygonRange(aPolyPolygon.getB2DRange());
29031f882ec4SArmin Le Grand     bool bPixel(false);
29041f882ec4SArmin Le Grand 
2905cdf0e10cSrcweir     if( rPropSetInfo->hasPropertyByName( sIsPixelContour ) )
2906cdf0e10cSrcweir     {
2907cdf0e10cSrcweir         bPixel = *(sal_Bool *)rPropSet->getPropertyValue( sIsPixelContour ).getValue();
2908cdf0e10cSrcweir     }
2909cdf0e10cSrcweir 
2910cdf0e10cSrcweir     // svg: width
2911cdf0e10cSrcweir     OUStringBuffer aStringBuffer( 10 );
29121f882ec4SArmin Le Grand 
2913cdf0e10cSrcweir     if(bPixel)
29141f882ec4SArmin Le Grand     {
29151f882ec4SArmin Le Grand         GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, basegfx::fround(aPolyPolygonRange.getWidth()));
29161f882ec4SArmin Le Grand     }
2917cdf0e10cSrcweir     else
29181f882ec4SArmin Le Grand     {
29191f882ec4SArmin Le Grand         GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, basegfx::fround(aPolyPolygonRange.getWidth()));
29201f882ec4SArmin Le Grand     }
29211f882ec4SArmin Le Grand 
29221f882ec4SArmin Le Grand     GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStringBuffer.makeStringAndClear());
2923cdf0e10cSrcweir 
2924cdf0e10cSrcweir     // svg: height
2925cdf0e10cSrcweir     if(bPixel)
29261f882ec4SArmin Le Grand     {
29271f882ec4SArmin Le Grand         GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, basegfx::fround(aPolyPolygonRange.getHeight()));
29281f882ec4SArmin Le Grand     }
2929cdf0e10cSrcweir     else
29301f882ec4SArmin Le Grand     {
29311f882ec4SArmin Le Grand         GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, basegfx::fround(aPolyPolygonRange.getHeight()));
29321f882ec4SArmin Le Grand     }
29331f882ec4SArmin Le Grand 
29341f882ec4SArmin Le Grand     GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStringBuffer.makeStringAndClear());
2935cdf0e10cSrcweir 
2936cdf0e10cSrcweir     // svg:viewbox
29371f882ec4SArmin Le Grand     SdXMLImExViewBox aViewBox(0.0, 0.0, aPolyPolygonRange.getWidth(), aPolyPolygonRange.getHeight());
29381f882ec4SArmin Le Grand     GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
2939cdf0e10cSrcweir     enum XMLTokenEnum eElem = XML_TOKEN_INVALID;
29401f882ec4SArmin Le Grand 
29411f882ec4SArmin Le Grand     if(1 == nPolygonCount )
2942cdf0e10cSrcweir     {
2943cdf0e10cSrcweir         // simple polygon shape, can be written as svg:points sequence
29441f882ec4SArmin Le Grand         const ::rtl::OUString aPointString(
29451f882ec4SArmin Le Grand             basegfx::tools::exportToSvgPoints(
29461f882ec4SArmin Le Grand                 aPolyPolygon.getB2DPolygon(0)));
2947cdf0e10cSrcweir 
2948cdf0e10cSrcweir         // write point array
29491f882ec4SArmin Le Grand         GetExport().AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString);
2950cdf0e10cSrcweir         eElem = XML_CONTOUR_POLYGON;
2951cdf0e10cSrcweir     }
2952cdf0e10cSrcweir     else
2953cdf0e10cSrcweir     {
2954cdf0e10cSrcweir         // polypolygon, needs to be written as a svg:path sequence
29551f882ec4SArmin Le Grand         const ::rtl::OUString aPolygonString(
29561f882ec4SArmin Le Grand             basegfx::tools::exportToSvgD(
29571f882ec4SArmin Le Grand                 aPolyPolygon,
29581f882ec4SArmin Le Grand                 true,           // bUseRelativeCoordinates
29591f882ec4SArmin Le Grand                 false,          // bDetectQuadraticBeziers: not used in old, but maybe activated now
29601f882ec4SArmin Le Grand                 true));         // bHandleRelativeNextPointCompatible
2961cdf0e10cSrcweir 
2962cdf0e10cSrcweir         // write point array
29631f882ec4SArmin Le Grand         GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_D, aPolygonString);
2964cdf0e10cSrcweir         eElem = XML_CONTOUR_PATH;
2965cdf0e10cSrcweir     }
2966cdf0e10cSrcweir 
2967cdf0e10cSrcweir     if( rPropSetInfo->hasPropertyByName( sIsAutomaticContour ) )
2968cdf0e10cSrcweir     {
2969cdf0e10cSrcweir         sal_Bool bTmp = *(sal_Bool *)rPropSet->getPropertyValue(
2970cdf0e10cSrcweir                                             sIsAutomaticContour ).getValue();
2971cdf0e10cSrcweir         GetExport().AddAttribute( XML_NAMESPACE_DRAW,
2972cdf0e10cSrcweir                       XML_RECREATE_ON_EDIT, bTmp ? XML_TRUE : XML_FALSE );
2973cdf0e10cSrcweir     }
2974cdf0e10cSrcweir 
2975cdf0e10cSrcweir     // write object now
2976cdf0e10cSrcweir     SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW, eElem,
2977cdf0e10cSrcweir                               sal_True, sal_True );
2978cdf0e10cSrcweir }
2979cdf0e10cSrcweir 
_exportTextGraphic(const Reference<XPropertySet> & rPropSet,const Reference<XPropertySetInfo> & rPropSetInfo)2980cdf0e10cSrcweir void XMLTextParagraphExport::_exportTextGraphic(
2981cdf0e10cSrcweir 		const Reference < XPropertySet > & rPropSet,
2982cdf0e10cSrcweir 		const Reference < XPropertySetInfo > & rPropSetInfo )
2983cdf0e10cSrcweir {
2984cdf0e10cSrcweir 	OUString sStyle;
2985cdf0e10cSrcweir 	if( rPropSetInfo->hasPropertyByName( sFrameStyleName ) )
2986cdf0e10cSrcweir 	{
2987cdf0e10cSrcweir 		rPropSet->getPropertyValue( sFrameStyleName ) >>= sStyle;
2988cdf0e10cSrcweir 	}
2989cdf0e10cSrcweir 
2990cdf0e10cSrcweir 	OUString sAutoStyle( sStyle );
2991cdf0e10cSrcweir 	sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, sStyle );
2992cdf0e10cSrcweir 	if( sAutoStyle.getLength() )
2993cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE_NAME,
2994cdf0e10cSrcweir 								  GetExport().EncodeStyleName( sAutoStyle ) );
2995cdf0e10cSrcweir 	addTextFrameAttributes( rPropSet, sal_False );
2996cdf0e10cSrcweir 
2997cdf0e10cSrcweir 	// svg:transform
2998cdf0e10cSrcweir 	sal_Int16 nVal = 0;
2999cdf0e10cSrcweir 	rPropSet->getPropertyValue( sGraphicRotation ) >>= nVal;
3000cdf0e10cSrcweir 	if( nVal != 0 )
3001cdf0e10cSrcweir 	{
3002cdf0e10cSrcweir 		OUStringBuffer sRet( GetXMLToken(XML_ROTATE).getLength()+4 );
3003cdf0e10cSrcweir 		sRet.append( GetXMLToken(XML_ROTATE));
3004cdf0e10cSrcweir 		sRet.append( (sal_Unicode)'(' );
3005cdf0e10cSrcweir 		GetExport().GetMM100UnitConverter().convertNumber( sRet, (sal_Int32)nVal );
3006cdf0e10cSrcweir 		sRet.append( (sal_Unicode)')' );
3007cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_TRANSFORM,
3008cdf0e10cSrcweir 								  sRet.makeStringAndClear() );
3009cdf0e10cSrcweir 	}
3010cdf0e10cSrcweir 
3011ddde725dSArmin Le Grand     // original content
3012ddde725dSArmin Le Grand     SvXMLElementExport aElem(GetExport(), XML_NAMESPACE_DRAW, XML_FRAME, sal_False, sal_True);
3013cdf0e10cSrcweir 
3014ddde725dSArmin Le Grand     // replacement graphic for backwards compatibility, but
3015ddde725dSArmin Le Grand     // only for SVG currently
3016ddde725dSArmin Le Grand     OUString sReplacementOrigURL;
3017ddde725dSArmin Le Grand     rPropSet->getPropertyValue( sReplacementGraphicURL ) >>= sReplacementOrigURL;
3018ddde725dSArmin Le Grand 
3019ddde725dSArmin Le Grand     if(sReplacementOrigURL.getLength())
3020ddde725dSArmin Le Grand     {
3021ddde725dSArmin Le Grand         const OUString sReplacementURL(GetExport().AddEmbeddedGraphicObject( sReplacementOrigURL ));
3022ddde725dSArmin Le Grand 
3023ddde725dSArmin Le Grand         // If there is no url, then then graphic is empty
3024ddde725dSArmin Le Grand         if(sReplacementURL.getLength())
3025ddde725dSArmin Le Grand         {
3026ddde725dSArmin Le Grand             GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sReplacementURL);
3027ddde725dSArmin Le Grand             GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE);
3028ddde725dSArmin Le Grand             GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED);
3029ddde725dSArmin Le Grand             GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD);
3030ddde725dSArmin Le Grand 
3031ddde725dSArmin Le Grand             // xlink:href for replacement, only written for Svg content
3032ddde725dSArmin Le Grand             SvXMLElementExport aElement(GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, sal_False, sal_True);
3033ddde725dSArmin Le Grand 
3034ddde725dSArmin Le Grand             // optional office:binary-data
3035ddde725dSArmin Le Grand             GetExport().AddEmbeddedGraphicObjectAsBase64(sReplacementURL);
3036ddde725dSArmin Le Grand         }
3037ddde725dSArmin Le Grand     }
3038cdf0e10cSrcweir 
3039cdf0e10cSrcweir 	// xlink:href
3040cdf0e10cSrcweir 	OUString sOrigURL;
3041cdf0e10cSrcweir 	rPropSet->getPropertyValue( sGraphicURL ) >>= sOrigURL;
3042cdf0e10cSrcweir 	OUString sURL(GetExport().AddEmbeddedGraphicObject( sOrigURL ));
3043cdf0e10cSrcweir 	setTextEmbeddedGraphicURL( rPropSet, sURL );
3044cdf0e10cSrcweir 
3045cdf0e10cSrcweir 	// If there still is no url, then then graphic is empty
3046cdf0e10cSrcweir 	if( sURL.getLength() )
3047cdf0e10cSrcweir 	{
3048cdf0e10cSrcweir 		GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
3049cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
3050cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
3051cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE,
3052cdf0e10cSrcweir                                                        XML_ONLOAD );
3053cdf0e10cSrcweir 	}
3054cdf0e10cSrcweir 
3055cdf0e10cSrcweir 	// draw:filter-name
3056cdf0e10cSrcweir 	OUString sGrfFilter;
3057cdf0e10cSrcweir 	rPropSet->getPropertyValue( sGraphicFilter ) >>= sGrfFilter;
3058cdf0e10cSrcweir 	if( sGrfFilter.getLength() )
3059cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_FILTER_NAME,
3060cdf0e10cSrcweir 								  sGrfFilter );
3061cdf0e10cSrcweir 
3062cdf0e10cSrcweir 	{
3063cdf0e10cSrcweir 		SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_DRAW,
3064cdf0e10cSrcweir 								  XML_IMAGE, sal_False, sal_True );
3065cdf0e10cSrcweir 
3066cdf0e10cSrcweir 		// optional office:binary-data
3067cdf0e10cSrcweir 		GetExport().AddEmbeddedGraphicObjectAsBase64( sOrigURL );
3068cdf0e10cSrcweir 	}
3069cdf0e10cSrcweir 
3070cdf0e10cSrcweir 	// script:events
3071cdf0e10cSrcweir 	Reference<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY );
3072cdf0e10cSrcweir 	GetExport().GetEventExport().Export(xEventsSupp);
3073cdf0e10cSrcweir 
3074cdf0e10cSrcweir 	// image map
3075cdf0e10cSrcweir 	GetExport().GetImageMapExport().Export( rPropSet );
3076cdf0e10cSrcweir 
3077cdf0e10cSrcweir     // --> OD 2009-07-22 #i73249#
3078cdf0e10cSrcweir     // svg:title and svg:desc
3079cdf0e10cSrcweir     exportTitleAndDescription( rPropSet, rPropSetInfo );
3080cdf0e10cSrcweir     // <--
3081cdf0e10cSrcweir 
3082cdf0e10cSrcweir 	// draw:contour
3083cdf0e10cSrcweir 	exportContour( rPropSet, rPropSetInfo );
3084cdf0e10cSrcweir }
3085cdf0e10cSrcweir 
_collectTextEmbeddedAutoStyles(const Reference<XPropertySet> &)3086cdf0e10cSrcweir void XMLTextParagraphExport::_collectTextEmbeddedAutoStyles(const Reference < XPropertySet > & )
3087cdf0e10cSrcweir {
3088cdf0e10cSrcweir 	DBG_ASSERT( !this, "no API implementation avialable" );
3089cdf0e10cSrcweir }
3090cdf0e10cSrcweir 
_exportTextEmbedded(const Reference<XPropertySet> &,const Reference<XPropertySetInfo> &)3091cdf0e10cSrcweir void XMLTextParagraphExport::_exportTextEmbedded(
3092cdf0e10cSrcweir 		const Reference < XPropertySet > &,
3093cdf0e10cSrcweir 		const Reference < XPropertySetInfo > & )
3094cdf0e10cSrcweir {
3095cdf0e10cSrcweir 	DBG_ASSERT( !this, "no API implementation avialable" );
3096cdf0e10cSrcweir }
3097cdf0e10cSrcweir 
exportEvents(const Reference<XPropertySet> & rPropSet)3098cdf0e10cSrcweir void XMLTextParagraphExport::exportEvents( const Reference < XPropertySet > & rPropSet )
3099cdf0e10cSrcweir {
3100cdf0e10cSrcweir 	// script:events
3101cdf0e10cSrcweir 	Reference<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY );
3102cdf0e10cSrcweir 	GetExport().GetEventExport().Export(xEventsSupp);
3103cdf0e10cSrcweir 
3104cdf0e10cSrcweir 	// image map
3105cdf0e10cSrcweir 	OUString sImageMap(RTL_CONSTASCII_USTRINGPARAM("ImageMap"));
3106cdf0e10cSrcweir 	if (rPropSet->getPropertySetInfo()->hasPropertyByName(sImageMap))
3107cdf0e10cSrcweir 		GetExport().GetImageMapExport().Export( rPropSet );
3108cdf0e10cSrcweir }
3109cdf0e10cSrcweir 
3110cdf0e10cSrcweir // --> OD 2009-07-22 #i73249#
exportTitleAndDescription(const Reference<XPropertySet> & rPropSet,const Reference<XPropertySetInfo> & rPropSetInfo)3111cdf0e10cSrcweir void XMLTextParagraphExport::exportTitleAndDescription(
3112cdf0e10cSrcweir 		const Reference < XPropertySet > & rPropSet,
3113cdf0e10cSrcweir 		const Reference < XPropertySetInfo > & rPropSetInfo )
3114cdf0e10cSrcweir {
3115cdf0e10cSrcweir 	// svg:title
3116cdf0e10cSrcweir     if( rPropSetInfo->hasPropertyByName( sTitle ) )
3117cdf0e10cSrcweir 	{
3118cdf0e10cSrcweir         OUString sObjTitle;
3119cdf0e10cSrcweir         rPropSet->getPropertyValue( sTitle ) >>= sObjTitle;
3120cdf0e10cSrcweir         if( sObjTitle.getLength() )
3121cdf0e10cSrcweir 		{
3122cdf0e10cSrcweir 			SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_SVG,
3123cdf0e10cSrcweir 									  XML_TITLE, sal_True, sal_False );
3124cdf0e10cSrcweir             GetExport().Characters( sObjTitle );
3125cdf0e10cSrcweir 		}
3126cdf0e10cSrcweir 	}
3127cdf0e10cSrcweir 
3128cdf0e10cSrcweir     // svg:description
3129cdf0e10cSrcweir     if( rPropSetInfo->hasPropertyByName( sDescription ) )
3130cdf0e10cSrcweir     {
3131cdf0e10cSrcweir         OUString sObjDesc;
3132cdf0e10cSrcweir         rPropSet->getPropertyValue( sDescription ) >>= sObjDesc;
3133cdf0e10cSrcweir         if( sObjDesc.getLength() )
3134cdf0e10cSrcweir         {
3135cdf0e10cSrcweir             SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_SVG,
3136cdf0e10cSrcweir                                       XML_DESC, sal_True, sal_False );
3137cdf0e10cSrcweir             GetExport().Characters( sObjDesc );
3138cdf0e10cSrcweir         }
3139cdf0e10cSrcweir     }
3140cdf0e10cSrcweir }
3141cdf0e10cSrcweir // <--
3142cdf0e10cSrcweir 
setTextEmbeddedGraphicURL(const Reference<XPropertySet> &,OUString &) const3143cdf0e10cSrcweir void XMLTextParagraphExport::setTextEmbeddedGraphicURL(
3144cdf0e10cSrcweir 	const Reference < XPropertySet >&,
3145cdf0e10cSrcweir 	OUString& /*rStreamName*/ ) const
3146cdf0e10cSrcweir {
3147cdf0e10cSrcweir }
3148cdf0e10cSrcweir 
addHyperlinkAttributes(const Reference<XPropertySet> & rPropSet,const Reference<XPropertyState> & rPropState,const Reference<XPropertySetInfo> & rPropSetInfo)3149cdf0e10cSrcweir sal_Bool XMLTextParagraphExport::addHyperlinkAttributes(
3150cdf0e10cSrcweir     const Reference< XPropertySet > & rPropSet,
3151cdf0e10cSrcweir     const Reference< XPropertyState > & rPropState,
3152cdf0e10cSrcweir     const Reference< XPropertySetInfo > & rPropSetInfo )
3153cdf0e10cSrcweir {
3154cdf0e10cSrcweir     sal_Bool bExport = sal_False;
3155cdf0e10cSrcweir     OUString sHRef, sName, sTargetFrame, sUStyleName, sVStyleName;
3156cdf0e10cSrcweir     sal_Bool bServerMap = sal_False;
3157cdf0e10cSrcweir 
3158*c45df7c4SOliver-Rainer Wittmann     if ( rPropSetInfo->hasPropertyByName( sHyperLinkURL )
3159*c45df7c4SOliver-Rainer Wittmann          && ( !rPropState.is()
3160*c45df7c4SOliver-Rainer Wittmann               || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( sHyperLinkURL ) ) )
3161cdf0e10cSrcweir     {
3162cdf0e10cSrcweir         rPropSet->getPropertyValue( sHyperLinkURL ) >>= sHRef;
3163*c45df7c4SOliver-Rainer Wittmann         if ( !sHRef.isEmpty() )
3164cdf0e10cSrcweir             bExport = sal_True;
3165cdf0e10cSrcweir     }
3166*c45df7c4SOliver-Rainer Wittmann     if ( sHRef.isEmpty() )
3167*c45df7c4SOliver-Rainer Wittmann     {
3168*c45df7c4SOliver-Rainer Wittmann         // hyperlink without an URL does not make sense
3169*c45df7c4SOliver-Rainer Wittmann         OSL_ENSURE( false, "hyperlink without an URL --> no export to ODF" );
3170*c45df7c4SOliver-Rainer Wittmann         return sal_False;
3171*c45df7c4SOliver-Rainer Wittmann     }
3172cdf0e10cSrcweir 
3173*c45df7c4SOliver-Rainer Wittmann 
3174*c45df7c4SOliver-Rainer Wittmann     if ( rPropSetInfo->hasPropertyByName( sHyperLinkName )
3175*c45df7c4SOliver-Rainer Wittmann          && ( !rPropState.is()
3176*c45df7c4SOliver-Rainer Wittmann               || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( sHyperLinkName ) ) )
3177cdf0e10cSrcweir     {
3178cdf0e10cSrcweir         rPropSet->getPropertyValue( sHyperLinkName ) >>= sName;
3179*c45df7c4SOliver-Rainer Wittmann         if ( !sName.isEmpty() )
3180cdf0e10cSrcweir             bExport = sal_True;
3181cdf0e10cSrcweir     }
3182cdf0e10cSrcweir 
3183*c45df7c4SOliver-Rainer Wittmann     if ( rPropSetInfo->hasPropertyByName( sHyperLinkTarget )
3184*c45df7c4SOliver-Rainer Wittmann          && ( !rPropState.is()
3185*c45df7c4SOliver-Rainer Wittmann               || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( sHyperLinkTarget ) ) )
3186cdf0e10cSrcweir     {
3187cdf0e10cSrcweir         rPropSet->getPropertyValue( sHyperLinkTarget ) >>= sTargetFrame;
3188*c45df7c4SOliver-Rainer Wittmann         if ( !sTargetFrame.isEmpty() )
3189cdf0e10cSrcweir             bExport = sal_True;
3190cdf0e10cSrcweir     }
3191cdf0e10cSrcweir 
3192*c45df7c4SOliver-Rainer Wittmann     if ( rPropSetInfo->hasPropertyByName( sServerMap )
3193*c45df7c4SOliver-Rainer Wittmann          && ( !rPropState.is()
3194*c45df7c4SOliver-Rainer Wittmann               || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( sServerMap ) ) )
3195cdf0e10cSrcweir     {
3196cdf0e10cSrcweir         bServerMap = *(sal_Bool *) rPropSet->getPropertyValue( sServerMap ).getValue();
3197cdf0e10cSrcweir         if ( bServerMap )
3198cdf0e10cSrcweir             bExport = sal_True;
3199cdf0e10cSrcweir     }
3200cdf0e10cSrcweir 
3201*c45df7c4SOliver-Rainer Wittmann     if ( rPropSetInfo->hasPropertyByName( sUnvisitedCharStyleName )
3202*c45df7c4SOliver-Rainer Wittmann          && ( !rPropState.is()
3203*c45df7c4SOliver-Rainer Wittmann               || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( sUnvisitedCharStyleName ) ) )
3204cdf0e10cSrcweir     {
3205cdf0e10cSrcweir         rPropSet->getPropertyValue( sUnvisitedCharStyleName ) >>= sUStyleName;
3206*c45df7c4SOliver-Rainer Wittmann         if ( !sUStyleName.isEmpty() )
3207cdf0e10cSrcweir             bExport = sal_True;
3208cdf0e10cSrcweir     }
3209cdf0e10cSrcweir 
3210*c45df7c4SOliver-Rainer Wittmann     if ( rPropSetInfo->hasPropertyByName( sVisitedCharStyleName )
3211*c45df7c4SOliver-Rainer Wittmann          && ( !rPropState.is()
3212*c45df7c4SOliver-Rainer Wittmann               || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( sVisitedCharStyleName ) ) )
3213cdf0e10cSrcweir     {
3214cdf0e10cSrcweir         rPropSet->getPropertyValue( sVisitedCharStyleName ) >>= sVStyleName;
3215*c45df7c4SOliver-Rainer Wittmann         if ( !sVStyleName.isEmpty() )
3216cdf0e10cSrcweir             bExport = sal_True;
3217cdf0e10cSrcweir     }
3218cdf0e10cSrcweir 
3219cdf0e10cSrcweir     if ( bExport )
3220cdf0e10cSrcweir 	{
3221cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
3222cdf0e10cSrcweir 		GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference( sHRef ) );
3223cdf0e10cSrcweir 
3224*c45df7c4SOliver-Rainer Wittmann 		if( !sName.isEmpty() )
3225cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_OFFICE, XML_NAME, sName );
3226cdf0e10cSrcweir 
3227*c45df7c4SOliver-Rainer Wittmann 		if( !sTargetFrame.isEmpty() )
3228cdf0e10cSrcweir 		{
3229cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_OFFICE,
3230cdf0e10cSrcweir 									  XML_TARGET_FRAME_NAME, sTargetFrame );
3231cdf0e10cSrcweir 			enum XMLTokenEnum eTok =
3232cdf0e10cSrcweir 				sTargetFrame.equalsAsciiL( "_blank", sizeof("_blank")-1 )
3233cdf0e10cSrcweir 					? XML_NEW : XML_REPLACE;
3234cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, eTok );
3235cdf0e10cSrcweir 		}
3236cdf0e10cSrcweir 
3237cdf0e10cSrcweir 		if( bServerMap  )
3238cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_OFFICE,
3239cdf0e10cSrcweir                                       XML_SERVER_MAP, XML_TRUE );
3240cdf0e10cSrcweir 
3241*c45df7c4SOliver-Rainer Wittmann 		if( !sUStyleName.isEmpty() )
3242cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_TEXT,
3243cdf0e10cSrcweir 			  XML_STYLE_NAME, GetExport().EncodeStyleName( sUStyleName ) );
3244cdf0e10cSrcweir 
3245*c45df7c4SOliver-Rainer Wittmann 		if( !sVStyleName.isEmpty() )
3246cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_TEXT,
3247cdf0e10cSrcweir 			  XML_VISITED_STYLE_NAME, GetExport().EncodeStyleName( sVStyleName ) );
3248cdf0e10cSrcweir 	}
3249cdf0e10cSrcweir 
3250cdf0e10cSrcweir 	return bExport;
3251cdf0e10cSrcweir }
3252cdf0e10cSrcweir 
exportTextRangeSpan(const com::sun::star::uno::Reference<com::sun::star::text::XTextRange> & rTextRange,Reference<XPropertySet> & xPropSet,Reference<XPropertySetInfo> & xPropSetInfo,const sal_Bool bIsUICharStyle,const sal_Bool bHasAutoStyle,const OUString & sStyle,sal_Bool & rPrevCharIsSpace)3253*c45df7c4SOliver-Rainer Wittmann void XMLTextParagraphExport::exportTextRangeSpan(
3254*c45df7c4SOliver-Rainer Wittmann     const com::sun::star::uno::Reference< com::sun::star::text::XTextRange > & rTextRange,
3255*c45df7c4SOliver-Rainer Wittmann     Reference< XPropertySet > & xPropSet,
3256*c45df7c4SOliver-Rainer Wittmann     Reference < XPropertySetInfo > & xPropSetInfo,
3257*c45df7c4SOliver-Rainer Wittmann     const sal_Bool bIsUICharStyle,
3258*c45df7c4SOliver-Rainer Wittmann     const sal_Bool bHasAutoStyle,
3259*c45df7c4SOliver-Rainer Wittmann     const OUString& sStyle,
3260*c45df7c4SOliver-Rainer Wittmann     sal_Bool& rPrevCharIsSpace )
3261*c45df7c4SOliver-Rainer Wittmann {
3262*c45df7c4SOliver-Rainer Wittmann     XMLTextCharStyleNamesElementExport aCharStylesExport(
3263*c45df7c4SOliver-Rainer Wittmann             GetExport(),
3264*c45df7c4SOliver-Rainer Wittmann             bIsUICharStyle && aCharStyleNamesPropInfoCache.hasProperty( xPropSet, xPropSetInfo ),
3265*c45df7c4SOliver-Rainer Wittmann             bHasAutoStyle,
3266*c45df7c4SOliver-Rainer Wittmann             xPropSet,
3267*c45df7c4SOliver-Rainer Wittmann             sCharStyleNames );
3268*c45df7c4SOliver-Rainer Wittmann 
3269*c45df7c4SOliver-Rainer Wittmann     if ( !sStyle.isEmpty() )
3270*c45df7c4SOliver-Rainer Wittmann     {
3271*c45df7c4SOliver-Rainer Wittmann         GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, GetExport().EncodeStyleName( sStyle ) );
3272*c45df7c4SOliver-Rainer Wittmann     }
3273*c45df7c4SOliver-Rainer Wittmann     {
3274*c45df7c4SOliver-Rainer Wittmann         SvXMLElementExport aElement( GetExport(), !sStyle.isEmpty(), XML_NAMESPACE_TEXT, XML_SPAN, sal_False, sal_False );
3275*c45df7c4SOliver-Rainer Wittmann         const OUString aText( rTextRange->getString() );
3276*c45df7c4SOliver-Rainer Wittmann         exportText( aText, rPrevCharIsSpace );
3277*c45df7c4SOliver-Rainer Wittmann     }
3278*c45df7c4SOliver-Rainer Wittmann }
3279*c45df7c4SOliver-Rainer Wittmann 
exportTextRange(const Reference<XTextRange> & rTextRange,sal_Bool bAutoStyles,sal_Bool & rPrevCharIsSpace)3280cdf0e10cSrcweir void XMLTextParagraphExport::exportTextRange(
3281cdf0e10cSrcweir         const Reference< XTextRange > & rTextRange,
3282cdf0e10cSrcweir         sal_Bool bAutoStyles,
3283cdf0e10cSrcweir         sal_Bool& rPrevCharIsSpace )
3284cdf0e10cSrcweir {
3285cdf0e10cSrcweir     Reference< XPropertySet > xPropSet( rTextRange, UNO_QUERY );
3286cdf0e10cSrcweir     if ( bAutoStyles )
3287cdf0e10cSrcweir     {
3288cdf0e10cSrcweir         Add( XML_STYLE_FAMILY_TEXT_TEXT, xPropSet );
3289cdf0e10cSrcweir     }
3290cdf0e10cSrcweir     else
3291cdf0e10cSrcweir     {
3292cdf0e10cSrcweir         sal_Bool bHyperlink = sal_False;
3293cdf0e10cSrcweir         sal_Bool bIsUICharStyle = sal_False;
3294cdf0e10cSrcweir         sal_Bool bHasAutoStyle = sal_False;
3295*c45df7c4SOliver-Rainer Wittmann         const OUString sStyle(
3296*c45df7c4SOliver-Rainer Wittmann             FindTextStyleAndHyperlink( xPropSet, bHyperlink, bIsUICharStyle, bHasAutoStyle ) );
3297cdf0e10cSrcweir 
3298cdf0e10cSrcweir         Reference < XPropertySetInfo > xPropSetInfo;
3299*c45df7c4SOliver-Rainer Wittmann         sal_Bool bHyperlinkAttrsAdded = sal_False;
3300cdf0e10cSrcweir         if ( bHyperlink )
3301cdf0e10cSrcweir         {
3302cdf0e10cSrcweir             Reference< XPropertyState > xPropState( xPropSet, UNO_QUERY );
3303cdf0e10cSrcweir             xPropSetInfo.set( xPropSet->getPropertySetInfo() );
3304*c45df7c4SOliver-Rainer Wittmann             bHyperlinkAttrsAdded = addHyperlinkAttributes( xPropSet, xPropState, xPropSetInfo );
3305cdf0e10cSrcweir         }
3306*c45df7c4SOliver-Rainer Wittmann 
3307*c45df7c4SOliver-Rainer Wittmann         if ( bHyperlink && bHyperlinkAttrsAdded )
3308cdf0e10cSrcweir         {
3309*c45df7c4SOliver-Rainer Wittmann             SvXMLElementExport aElem( GetExport(), sal_True, XML_NAMESPACE_TEXT, XML_A, sal_False, sal_False );
3310*c45df7c4SOliver-Rainer Wittmann 
3311cdf0e10cSrcweir             // export events (if supported)
3312*c45df7c4SOliver-Rainer Wittmann             static const OUString sHyperLinkEvents( RTL_CONSTASCII_USTRINGPARAM( "HyperLinkEvents" ) );
3313cdf0e10cSrcweir             if ( xPropSetInfo->hasPropertyByName( sHyperLinkEvents ) )
3314cdf0e10cSrcweir             {
3315cdf0e10cSrcweir                 Reference< XNameReplace > xName( xPropSet->getPropertyValue( sHyperLinkEvents ), uno::UNO_QUERY );
3316cdf0e10cSrcweir                 GetExport().GetEventExport().Export( xName, sal_False );
3317cdf0e10cSrcweir             }
3318cdf0e10cSrcweir 
3319*c45df7c4SOliver-Rainer Wittmann             exportTextRangeSpan( rTextRange, xPropSet, xPropSetInfo, bIsUICharStyle, bHasAutoStyle, sStyle, rPrevCharIsSpace );
3320cdf0e10cSrcweir         }
3321*c45df7c4SOliver-Rainer Wittmann         else
3322*c45df7c4SOliver-Rainer Wittmann         {
3323*c45df7c4SOliver-Rainer Wittmann             exportTextRangeSpan( rTextRange, xPropSet, xPropSetInfo, bIsUICharStyle, bHasAutoStyle, sStyle, rPrevCharIsSpace );
3324cdf0e10cSrcweir         }
3325cdf0e10cSrcweir     }
3326cdf0e10cSrcweir }
3327cdf0e10cSrcweir 
exportText(const OUString & rText,sal_Bool & rPrevCharIsSpace)3328cdf0e10cSrcweir void XMLTextParagraphExport::exportText( const OUString& rText,
3329cdf0e10cSrcweir 									  	 sal_Bool& rPrevCharIsSpace )
3330cdf0e10cSrcweir {
3331cdf0e10cSrcweir     sal_Int32 nExpStartPos = 0;
3332cdf0e10cSrcweir 	sal_Int32 nEndPos = rText.getLength();
3333cdf0e10cSrcweir 	sal_Int32 nSpaceChars = 0;
3334cdf0e10cSrcweir 	for( sal_Int32 nPos = 0; nPos < nEndPos; nPos++ )
3335cdf0e10cSrcweir 	{
3336cdf0e10cSrcweir 		sal_Unicode cChar = rText[nPos];
3337cdf0e10cSrcweir 		sal_Bool bExpCharAsText = sal_True;
3338cdf0e10cSrcweir 		sal_Bool bExpCharAsElement = sal_False;
3339cdf0e10cSrcweir 		sal_Bool bCurrCharIsSpace = sal_False;
3340cdf0e10cSrcweir 		switch( cChar )
3341cdf0e10cSrcweir 		{
3342cdf0e10cSrcweir 		case 0x0009:	// Tab
3343cdf0e10cSrcweir 		case 0x000A:	// LF
3344cdf0e10cSrcweir 			// These characters are exported as text.
3345cdf0e10cSrcweir 			bExpCharAsElement = sal_True;
3346cdf0e10cSrcweir 			bExpCharAsText = sal_False;
3347cdf0e10cSrcweir 			break;
3348cdf0e10cSrcweir 		case 0x000D:
3349cdf0e10cSrcweir 			break;	// legal character
3350cdf0e10cSrcweir 		case 0x0020:	// Blank
3351cdf0e10cSrcweir 			if( rPrevCharIsSpace )
3352cdf0e10cSrcweir 			{
3353cdf0e10cSrcweir 				// If the previous character is a space character,
3354cdf0e10cSrcweir 				// too, export a special space element.
3355cdf0e10cSrcweir 				bExpCharAsText = sal_False;
3356cdf0e10cSrcweir 			}
3357cdf0e10cSrcweir 			bCurrCharIsSpace = sal_True;
3358cdf0e10cSrcweir 			break;
3359cdf0e10cSrcweir 		default:
3360cdf0e10cSrcweir 			if( cChar < 0x0020 )
3361cdf0e10cSrcweir 			{
3362cdf0e10cSrcweir #ifdef DBG_UTIL
3363cdf0e10cSrcweir 				OSL_ENSURE( txtparae_bContainsIllegalCharacters ||
3364cdf0e10cSrcweir 							cChar >= 0x0020,
3365cdf0e10cSrcweir 							"illegal character in text content" );
3366cdf0e10cSrcweir 				txtparae_bContainsIllegalCharacters = sal_True;
3367cdf0e10cSrcweir #endif
3368cdf0e10cSrcweir 				bExpCharAsText = sal_False;
3369cdf0e10cSrcweir 			}
3370cdf0e10cSrcweir 			break;
3371cdf0e10cSrcweir 		}
3372cdf0e10cSrcweir 
3373cdf0e10cSrcweir 		// If the current character is not exported as text
3374cdf0e10cSrcweir 	   	// the text that has not been exported by now has to be exported now.
3375cdf0e10cSrcweir 		if( nPos > nExpStartPos && !bExpCharAsText )
3376cdf0e10cSrcweir 		{
3377cdf0e10cSrcweir 			DBG_ASSERT( 0==nSpaceChars, "pending spaces" );
3378cdf0e10cSrcweir 			OUString sExp( rText.copy( nExpStartPos, nPos - nExpStartPos ) );
3379cdf0e10cSrcweir 			GetExport().Characters( sExp );
3380cdf0e10cSrcweir 			nExpStartPos = nPos;
3381cdf0e10cSrcweir 		}
3382cdf0e10cSrcweir 
3383cdf0e10cSrcweir 		// If there are spaces left that have not been exported and the
3384cdf0e10cSrcweir 		// current chracter is not a space , the pending spaces have to be
3385cdf0e10cSrcweir 		// exported now.
3386cdf0e10cSrcweir 		if( nSpaceChars > 0 && !bCurrCharIsSpace )
3387cdf0e10cSrcweir 		{
3388cdf0e10cSrcweir 			DBG_ASSERT( nExpStartPos == nPos, " pending characters" );
3389cdf0e10cSrcweir 
3390cdf0e10cSrcweir 			if( nSpaceChars > 1 )
3391cdf0e10cSrcweir 			{
3392cdf0e10cSrcweir 				OUStringBuffer sTmp;
3393cdf0e10cSrcweir 				sTmp.append( (sal_Int32)nSpaceChars );
3394cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_C,
3395cdf0e10cSrcweir 							  sTmp.makeStringAndClear() );
3396cdf0e10cSrcweir 			}
3397cdf0e10cSrcweir 
3398cdf0e10cSrcweir 			SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
3399cdf0e10cSrcweir 									  XML_S, sal_False, sal_False );
3400cdf0e10cSrcweir 
3401cdf0e10cSrcweir 			nSpaceChars = 0;
3402cdf0e10cSrcweir 		}
3403cdf0e10cSrcweir 
3404cdf0e10cSrcweir 		// If the current character has to be exported as a special
3405cdf0e10cSrcweir 		// element, the elemnt will be exported now.
3406cdf0e10cSrcweir 		if( bExpCharAsElement )
3407cdf0e10cSrcweir 		{
3408cdf0e10cSrcweir 			switch( cChar )
3409cdf0e10cSrcweir 			{
3410cdf0e10cSrcweir 			case 0x0009:	// Tab
3411cdf0e10cSrcweir 				{
3412cdf0e10cSrcweir 					SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
3413cdf0e10cSrcweir 											  XML_TAB, sal_False,
3414cdf0e10cSrcweir 											  sal_False );
3415cdf0e10cSrcweir 				}
3416cdf0e10cSrcweir 				break;
3417cdf0e10cSrcweir 			case 0x000A:	// LF
3418cdf0e10cSrcweir 				{
3419cdf0e10cSrcweir 					SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
3420cdf0e10cSrcweir 											  XML_LINE_BREAK, sal_False,
3421cdf0e10cSrcweir 											  sal_False );
3422cdf0e10cSrcweir 				}
3423cdf0e10cSrcweir 				break;
3424cdf0e10cSrcweir 			}
3425cdf0e10cSrcweir 		}
3426cdf0e10cSrcweir 
3427cdf0e10cSrcweir 		// If the current character is a space, and the previous one
3428cdf0e10cSrcweir 		// is a space, too, the number of pending spaces is incremented
3429cdf0e10cSrcweir 		// only.
3430cdf0e10cSrcweir 		if( bCurrCharIsSpace && rPrevCharIsSpace )
3431cdf0e10cSrcweir 			nSpaceChars++;
3432cdf0e10cSrcweir 		rPrevCharIsSpace = bCurrCharIsSpace;
3433cdf0e10cSrcweir 
3434cdf0e10cSrcweir 		// If the currect character is not exported as text, the start
3435cdf0e10cSrcweir 		// position for text is the position behind the current position.
3436cdf0e10cSrcweir 		if( !bExpCharAsText )
3437cdf0e10cSrcweir 		{
3438cdf0e10cSrcweir 			DBG_ASSERT( nExpStartPos == nPos, "wrong export start pos" );
3439cdf0e10cSrcweir 			nExpStartPos = nPos+1;
3440cdf0e10cSrcweir 		}
3441cdf0e10cSrcweir 	}
3442cdf0e10cSrcweir 
3443cdf0e10cSrcweir 	if( nExpStartPos < nEndPos )
3444cdf0e10cSrcweir 	{
3445cdf0e10cSrcweir 		DBG_ASSERT( 0==nSpaceChars, " pending spaces " );
3446cdf0e10cSrcweir 		OUString sExp( rText.copy( nExpStartPos, nEndPos - nExpStartPos ) );
3447cdf0e10cSrcweir 		GetExport().Characters( sExp );
3448cdf0e10cSrcweir 	}
3449cdf0e10cSrcweir 
3450cdf0e10cSrcweir 	// If there are some spaces left, they have to be exported now.
3451cdf0e10cSrcweir 	if( nSpaceChars > 0 )
3452cdf0e10cSrcweir 	{
3453cdf0e10cSrcweir 		if( nSpaceChars > 1 )
3454cdf0e10cSrcweir 		{
3455cdf0e10cSrcweir 			OUStringBuffer sTmp;
3456cdf0e10cSrcweir 			sTmp.append( (sal_Int32)nSpaceChars );
3457cdf0e10cSrcweir 			GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_C,
3458cdf0e10cSrcweir 						  sTmp.makeStringAndClear() );
3459cdf0e10cSrcweir 		}
3460cdf0e10cSrcweir 
3461cdf0e10cSrcweir 		SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, XML_S,
3462cdf0e10cSrcweir 								  sal_False, sal_False );
3463cdf0e10cSrcweir 	}
3464cdf0e10cSrcweir }
3465cdf0e10cSrcweir 
exportTextDeclarations()3466cdf0e10cSrcweir void XMLTextParagraphExport::exportTextDeclarations()
3467cdf0e10cSrcweir {
3468cdf0e10cSrcweir 	pFieldExport->ExportFieldDeclarations();
3469cdf0e10cSrcweir 
3470cdf0e10cSrcweir 	// get XPropertySet from the document and ask for AutoMarkFileURL.
3471cdf0e10cSrcweir 	// If it exists, export the auto-mark-file element.
3472cdf0e10cSrcweir 	Reference<XPropertySet> xPropertySet( GetExport().GetModel(), UNO_QUERY );
3473cdf0e10cSrcweir 	if (xPropertySet.is())
3474cdf0e10cSrcweir 	{
3475cdf0e10cSrcweir 		OUString sUrl;
3476cdf0e10cSrcweir 		OUString sIndexAutoMarkFileURL(
3477cdf0e10cSrcweir 			RTL_CONSTASCII_USTRINGPARAM("IndexAutoMarkFileURL"));
3478cdf0e10cSrcweir 		if (xPropertySet->getPropertySetInfo()->hasPropertyByName(
3479cdf0e10cSrcweir 			sIndexAutoMarkFileURL))
3480cdf0e10cSrcweir 		{
3481cdf0e10cSrcweir 			xPropertySet->getPropertyValue(sIndexAutoMarkFileURL) >>= sUrl;
3482cdf0e10cSrcweir 			if (sUrl.getLength() > 0)
3483cdf0e10cSrcweir 			{
3484cdf0e10cSrcweir 				GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF,
3485cdf0e10cSrcweir 										  GetExport().GetRelativeReference(sUrl) );
3486cdf0e10cSrcweir 				SvXMLElementExport aAutoMarkElement(
3487cdf0e10cSrcweir 					GetExport(), XML_NAMESPACE_TEXT,
3488cdf0e10cSrcweir 					XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE,
3489cdf0e10cSrcweir 					sal_True, sal_True );
3490cdf0e10cSrcweir 			}
3491cdf0e10cSrcweir 		}
3492cdf0e10cSrcweir 	}
3493cdf0e10cSrcweir }
3494cdf0e10cSrcweir 
exportTextDeclarations(const Reference<XText> & rText)3495cdf0e10cSrcweir void XMLTextParagraphExport::exportTextDeclarations(
3496cdf0e10cSrcweir 	const Reference<XText> & rText )
3497cdf0e10cSrcweir {
3498cdf0e10cSrcweir 	pFieldExport->ExportFieldDeclarations(rText);
3499cdf0e10cSrcweir }
3500cdf0e10cSrcweir 
exportUsedDeclarations(sal_Bool bOnlyUsed)3501cdf0e10cSrcweir void XMLTextParagraphExport::exportUsedDeclarations( sal_Bool bOnlyUsed )
3502cdf0e10cSrcweir {
3503cdf0e10cSrcweir 	pFieldExport->SetExportOnlyUsedFieldDeclarations( bOnlyUsed );
3504cdf0e10cSrcweir }
3505cdf0e10cSrcweir 
3506cdf0e10cSrcweir 
exportTrackedChanges(sal_Bool bAutoStyles)3507cdf0e10cSrcweir void XMLTextParagraphExport::exportTrackedChanges(sal_Bool bAutoStyles)
3508cdf0e10cSrcweir {
3509cdf0e10cSrcweir 	if (NULL != pRedlineExport)
3510cdf0e10cSrcweir 		pRedlineExport->ExportChangesList( bAutoStyles );
3511cdf0e10cSrcweir }
3512cdf0e10cSrcweir 
exportTrackedChanges(const Reference<XText> & rText,sal_Bool bAutoStyle)3513cdf0e10cSrcweir void XMLTextParagraphExport::exportTrackedChanges(
3514cdf0e10cSrcweir 	const Reference<XText> & rText,
3515cdf0e10cSrcweir 	sal_Bool bAutoStyle)
3516cdf0e10cSrcweir {
3517cdf0e10cSrcweir 	if (NULL != pRedlineExport)
3518cdf0e10cSrcweir 		pRedlineExport->ExportChangesList(rText, bAutoStyle);
3519cdf0e10cSrcweir }
3520cdf0e10cSrcweir 
recordTrackedChangesForXText(const Reference<XText> & rText)3521cdf0e10cSrcweir void XMLTextParagraphExport::recordTrackedChangesForXText(
3522cdf0e10cSrcweir 	const Reference<XText> & rText )
3523cdf0e10cSrcweir {
3524cdf0e10cSrcweir 	if (NULL != pRedlineExport)
3525cdf0e10cSrcweir 		pRedlineExport->SetCurrentXText(rText);
3526cdf0e10cSrcweir }
3527cdf0e10cSrcweir 
recordTrackedChangesNoXText()3528cdf0e10cSrcweir void XMLTextParagraphExport::recordTrackedChangesNoXText()
3529cdf0e10cSrcweir {
3530cdf0e10cSrcweir 	if (NULL != pRedlineExport)
3531cdf0e10cSrcweir 		pRedlineExport->SetCurrentXText();
3532cdf0e10cSrcweir }
3533cdf0e10cSrcweir 
3534cdf0e10cSrcweir 
exportTextAutoStyles()3535cdf0e10cSrcweir void XMLTextParagraphExport::exportTextAutoStyles()
3536cdf0e10cSrcweir {
3537cdf0e10cSrcweir 	GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_PARAGRAPH,
3538cdf0e10cSrcweir 								   GetExport().GetDocHandler(),
3539cdf0e10cSrcweir 								   GetExport().GetMM100UnitConverter(),
3540cdf0e10cSrcweir 								   GetExport().GetNamespaceMap() );
3541cdf0e10cSrcweir 
3542cdf0e10cSrcweir 	GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_TEXT,
3543cdf0e10cSrcweir 								   GetExport().GetDocHandler(),
3544cdf0e10cSrcweir 								   GetExport().GetMM100UnitConverter(),
3545cdf0e10cSrcweir 								   GetExport().GetNamespaceMap() );
3546cdf0e10cSrcweir 
3547cdf0e10cSrcweir 	GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_FRAME,
3548cdf0e10cSrcweir 								   GetExport().GetDocHandler(),
3549cdf0e10cSrcweir 								   GetExport().GetMM100UnitConverter(),
3550cdf0e10cSrcweir 								   GetExport().GetNamespaceMap() );
3551cdf0e10cSrcweir 
3552cdf0e10cSrcweir 	GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_SECTION,
3553cdf0e10cSrcweir 								  GetExport().GetDocHandler(),
3554cdf0e10cSrcweir 								  GetExport().GetMM100UnitConverter(),
3555cdf0e10cSrcweir 								  GetExport().GetNamespaceMap() );
3556cdf0e10cSrcweir 
3557cdf0e10cSrcweir 	GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_RUBY,
3558cdf0e10cSrcweir 								  GetExport().GetDocHandler(),
3559cdf0e10cSrcweir 								  GetExport().GetMM100UnitConverter(),
3560cdf0e10cSrcweir 								  GetExport().GetNamespaceMap() );
3561cdf0e10cSrcweir 
3562cdf0e10cSrcweir 	pListAutoPool->exportXML();
3563cdf0e10cSrcweir }
3564cdf0e10cSrcweir 
exportRuby(const Reference<XPropertySet> & rPropSet,sal_Bool bAutoStyles)3565cdf0e10cSrcweir void XMLTextParagraphExport::exportRuby(
3566cdf0e10cSrcweir 	const Reference<XPropertySet> & rPropSet,
3567cdf0e10cSrcweir 	sal_Bool bAutoStyles )
3568cdf0e10cSrcweir {
3569cdf0e10cSrcweir 	// early out: a collapsed ruby makes no sense
3570cdf0e10cSrcweir 	if (*(sal_Bool*)rPropSet->getPropertyValue(sIsCollapsed).getValue())
3571cdf0e10cSrcweir 		return;
3572cdf0e10cSrcweir 
3573cdf0e10cSrcweir 	// start value ?
3574cdf0e10cSrcweir 	sal_Bool bStart = (*(sal_Bool*)rPropSet->getPropertyValue(sIsStart).getValue());
3575cdf0e10cSrcweir 
3576cdf0e10cSrcweir 	if (bAutoStyles)
3577cdf0e10cSrcweir 	{
3578cdf0e10cSrcweir 		// ruby auto styles
3579cdf0e10cSrcweir 		if (bStart)
3580cdf0e10cSrcweir 			Add( XML_STYLE_FAMILY_TEXT_RUBY, rPropSet );
3581cdf0e10cSrcweir 	}
3582cdf0e10cSrcweir 	else
3583cdf0e10cSrcweir 	{
3584cdf0e10cSrcweir 		// prepare element names
3585cdf0e10cSrcweir 		OUString aRuby(GetXMLToken(XML_RUBY));
3586cdf0e10cSrcweir 		OUString sTextRuby(GetExport().GetNamespaceMap().
3587cdf0e10cSrcweir 						   GetQNameByKey(XML_NAMESPACE_TEXT, aRuby));
3588cdf0e10cSrcweir 		OUString sRubyBase(GetXMLToken(XML_RUBY_BASE));
3589cdf0e10cSrcweir 		OUString sTextRubyBase(GetExport().GetNamespaceMap().
3590cdf0e10cSrcweir 						   GetQNameByKey(XML_NAMESPACE_TEXT, sRubyBase));
3591cdf0e10cSrcweir 
3592cdf0e10cSrcweir 		if (bStart)
3593cdf0e10cSrcweir 		{
3594cdf0e10cSrcweir 			// ruby start
3595cdf0e10cSrcweir 
3596cdf0e10cSrcweir 			// we can only start a ruby if none is open
3597cdf0e10cSrcweir 			DBG_ASSERT(! bOpenRuby, "Can't open a ruby inside of ruby!");
3598cdf0e10cSrcweir 			if( bOpenRuby )
3599cdf0e10cSrcweir 				return;
3600cdf0e10cSrcweir 
3601cdf0e10cSrcweir 			// save ruby text + ruby char style
3602cdf0e10cSrcweir 			rPropSet->getPropertyValue(sRubyText) >>= sOpenRubyText;
3603cdf0e10cSrcweir 			rPropSet->getPropertyValue(sRubyCharStyleName) >>= sOpenRubyCharStyle;
3604cdf0e10cSrcweir 
3605cdf0e10cSrcweir 			// ruby style
3606cdf0e10cSrcweir 			GetExport().CheckAttrList();
3607cdf0e10cSrcweir 			OUString sEmpty;
3608cdf0e10cSrcweir 			OUString sStyleName(Find( XML_STYLE_FAMILY_TEXT_RUBY, rPropSet,
3609cdf0e10cSrcweir 										sEmpty ));
3610cdf0e10cSrcweir 			DBG_ASSERT(sStyleName.getLength() > 0, "I can't find the style!");
3611cdf0e10cSrcweir 			GetExport().AddAttribute(XML_NAMESPACE_TEXT,
3612cdf0e10cSrcweir 									 XML_STYLE_NAME, sStyleName);
3613cdf0e10cSrcweir 
3614cdf0e10cSrcweir 			// export <text:ruby> and <text:ruby-base> start elements
3615cdf0e10cSrcweir 			GetExport().StartElement( XML_NAMESPACE_TEXT, XML_RUBY, sal_False);
3616cdf0e10cSrcweir 			GetExport().ClearAttrList();
3617cdf0e10cSrcweir 			GetExport().StartElement( XML_NAMESPACE_TEXT, XML_RUBY_BASE,
3618cdf0e10cSrcweir                                       sal_False );
3619cdf0e10cSrcweir 			bOpenRuby = sal_True;
3620cdf0e10cSrcweir 		}
3621cdf0e10cSrcweir 		else
3622cdf0e10cSrcweir 		{
3623cdf0e10cSrcweir 			// ruby end
3624cdf0e10cSrcweir 
3625cdf0e10cSrcweir 			// check for an open ruby
3626cdf0e10cSrcweir 			DBG_ASSERT(bOpenRuby, "Can't close a ruby if none is open!");
3627cdf0e10cSrcweir 			if( !bOpenRuby )
3628cdf0e10cSrcweir 				return;
3629cdf0e10cSrcweir 
3630cdf0e10cSrcweir 			// close <text:ruby-base>
3631cdf0e10cSrcweir 			GetExport().EndElement(XML_NAMESPACE_TEXT, XML_RUBY_BASE,
3632cdf0e10cSrcweir                                    sal_False);
3633cdf0e10cSrcweir 
3634cdf0e10cSrcweir 			// write the ruby text (with char style)
3635cdf0e10cSrcweir 			{
3636cdf0e10cSrcweir 				if (sOpenRubyCharStyle.getLength() > 0)
3637cdf0e10cSrcweir 					GetExport().AddAttribute(
3638cdf0e10cSrcweir 						XML_NAMESPACE_TEXT, XML_STYLE_NAME,
3639cdf0e10cSrcweir         				GetExport().EncodeStyleName( sOpenRubyCharStyle) );
3640cdf0e10cSrcweir 
3641cdf0e10cSrcweir 				SvXMLElementExport aRubyElement(
3642cdf0e10cSrcweir 					GetExport(), XML_NAMESPACE_TEXT, XML_RUBY_TEXT,
3643cdf0e10cSrcweir 					sal_False, sal_False);
3644cdf0e10cSrcweir 
3645cdf0e10cSrcweir 				GetExport().Characters(sOpenRubyText);
3646cdf0e10cSrcweir 			}
3647cdf0e10cSrcweir 
3648cdf0e10cSrcweir 			// and finally, close the ruby
3649cdf0e10cSrcweir 			GetExport().EndElement(XML_NAMESPACE_TEXT, XML_RUBY, sal_False);
3650cdf0e10cSrcweir 			bOpenRuby = sal_False;
3651cdf0e10cSrcweir 		}
3652cdf0e10cSrcweir 	}
3653cdf0e10cSrcweir }
3654cdf0e10cSrcweir 
exportMeta(const Reference<XPropertySet> & i_xPortion,sal_Bool i_bAutoStyles,sal_Bool i_isProgress)3655cdf0e10cSrcweir void XMLTextParagraphExport::exportMeta(
3656cdf0e10cSrcweir     const Reference<XPropertySet> & i_xPortion,
3657cdf0e10cSrcweir     sal_Bool i_bAutoStyles, sal_Bool i_isProgress)
3658cdf0e10cSrcweir {
3659cdf0e10cSrcweir     static OUString sMeta(RTL_CONSTASCII_USTRINGPARAM("InContentMetadata"));
3660cdf0e10cSrcweir 
3661cdf0e10cSrcweir     bool doExport(!i_bAutoStyles); // do not export element if autostyles
3662cdf0e10cSrcweir     // check version >= 1.2
3663cdf0e10cSrcweir     switch (GetExport().getDefaultVersion()) {
3664cdf0e10cSrcweir         case SvtSaveOptions::ODFVER_011: // fall thru
3665cdf0e10cSrcweir         case SvtSaveOptions::ODFVER_010: doExport = false; break;
3666cdf0e10cSrcweir         default: break;
3667cdf0e10cSrcweir     }
3668cdf0e10cSrcweir 
3669cdf0e10cSrcweir     const Reference< XTextContent > xTextContent(
3670cdf0e10cSrcweir             i_xPortion->getPropertyValue(sMeta), UNO_QUERY_THROW);
3671cdf0e10cSrcweir     const Reference< XEnumerationAccess > xEA( xTextContent, UNO_QUERY_THROW );
3672cdf0e10cSrcweir     const Reference< XEnumeration > xTextEnum( xEA->createEnumeration() );
3673cdf0e10cSrcweir 
3674cdf0e10cSrcweir     if (doExport)
3675cdf0e10cSrcweir     {
3676cdf0e10cSrcweir         const Reference<rdf::XMetadatable> xMeta(xTextContent, UNO_QUERY_THROW);
3677cdf0e10cSrcweir 
3678cdf0e10cSrcweir         // text:meta with neither xml:id nor RDFa is invalid
3679cdf0e10cSrcweir         xMeta->ensureMetadataReference();
3680cdf0e10cSrcweir 
3681cdf0e10cSrcweir         // xml:id and RDFa for RDF metadata
3682cdf0e10cSrcweir         GetExport().AddAttributeXmlId(xMeta);
3683cdf0e10cSrcweir         GetExport().AddAttributesRDFa(xTextContent);
3684cdf0e10cSrcweir     }
3685cdf0e10cSrcweir 
3686cdf0e10cSrcweir     SvXMLElementExport aElem( GetExport(), doExport,
3687cdf0e10cSrcweir         XML_NAMESPACE_TEXT, XML_META, sal_False, sal_False );
3688cdf0e10cSrcweir 
3689cdf0e10cSrcweir     // recurse to export content
3690cdf0e10cSrcweir     exportTextRangeEnumeration( xTextEnum, i_bAutoStyles, i_isProgress );
3691cdf0e10cSrcweir }
3692cdf0e10cSrcweir 
3693cdf0e10cSrcweir 
PreventExportOfControlsInMuteSections(const Reference<XIndexAccess> & rShapes,UniReference<xmloff::OFormLayerXMLExport> xFormExport)3694cdf0e10cSrcweir void XMLTextParagraphExport::PreventExportOfControlsInMuteSections(
3695cdf0e10cSrcweir     const Reference<XIndexAccess> & rShapes,
3696cdf0e10cSrcweir     UniReference<xmloff::OFormLayerXMLExport> xFormExport   )
3697cdf0e10cSrcweir {
3698cdf0e10cSrcweir     // check parameters ad pre-conditions
3699cdf0e10cSrcweir     if( ( ! rShapes.is() ) || ( ! xFormExport.is() ) )
3700cdf0e10cSrcweir     {
3701cdf0e10cSrcweir         // if we don't have shapes or a form export, there's nothing to do
3702cdf0e10cSrcweir         return;
3703cdf0e10cSrcweir     }
3704cdf0e10cSrcweir     DBG_ASSERT( pSectionExport != NULL, "We need the section export." );
3705cdf0e10cSrcweir 
3706cdf0e10cSrcweir     Reference<XEnumeration> xShapesEnum = pBoundFrameSets->GetShapes()->createEnumeration();
3707cdf0e10cSrcweir     if(!xShapesEnum.is())
3708cdf0e10cSrcweir         return;
3709cdf0e10cSrcweir     while( xShapesEnum->hasMoreElements() )
3710cdf0e10cSrcweir     {
3711cdf0e10cSrcweir         // now we need to check
3712cdf0e10cSrcweir         // 1) if this is a control shape, and
3713cdf0e10cSrcweir         // 2) if it's in a mute section
3714cdf0e10cSrcweir         // if both answers are 'yes', notify the form layer export
3715cdf0e10cSrcweir 
3716cdf0e10cSrcweir         // we join accessing the shape and testing for control
3717cdf0e10cSrcweir         Reference<XControlShape> xControlShape(xShapesEnum->nextElement(), UNO_QUERY);
3718cdf0e10cSrcweir         if( xControlShape.is() )
3719cdf0e10cSrcweir         {
3720cdf0e10cSrcweir             //            Reference<XPropertySet> xPropSet( xControlShape, UNO_QUERY );
3721cdf0e10cSrcweir             //            Reference<XTextContent> xTextContent;
3722cdf0e10cSrcweir             //            xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TextRange" ) ) ) >>= xTextContent;
3723cdf0e10cSrcweir 
3724cdf0e10cSrcweir             Reference<XTextContent> xTextContent( xControlShape, UNO_QUERY );
3725cdf0e10cSrcweir             if( xTextContent.is() )
3726cdf0e10cSrcweir             {
3727cdf0e10cSrcweir                 if( pSectionExport->IsMuteSection( xTextContent, sal_False ) )
3728cdf0e10cSrcweir                 {
3729cdf0e10cSrcweir                     // Ah, we've found a shape that
3730cdf0e10cSrcweir                     // 1) is a control shape
3731cdf0e10cSrcweir                     // 2) is anchored in a mute section
3732cdf0e10cSrcweir                     // so: don't export it!
3733cdf0e10cSrcweir                     xFormExport->excludeFromExport(
3734cdf0e10cSrcweir                         xControlShape->getControl() );
3735cdf0e10cSrcweir                 }
3736cdf0e10cSrcweir                 // else: not in mute section -> should be exported -> nothing
3737cdf0e10cSrcweir                 // to do
3738cdf0e10cSrcweir             }
3739cdf0e10cSrcweir             // else: no anchor -> ignore
3740cdf0e10cSrcweir         }
3741cdf0e10cSrcweir         // else: no control shape -> nothing to do
3742cdf0e10cSrcweir     }
3743cdf0e10cSrcweir }
GetHeadingLevel(const OUString & rStyleName)3744cdf0e10cSrcweir sal_Int32 XMLTextParagraphExport::GetHeadingLevel( const OUString& rStyleName )
3745cdf0e10cSrcweir {
3746cdf0e10cSrcweir 	if( !pHeadingStyles )
3747cdf0e10cSrcweir 	{
3748cdf0e10cSrcweir 		pHeadingStyles = new XMLStringVector;
3749cdf0e10cSrcweir 		SvxXMLNumRuleExport::GetOutlineStyles( *pHeadingStyles,
3750cdf0e10cSrcweir 											   GetExport().GetModel() );
3751cdf0e10cSrcweir 	}
3752cdf0e10cSrcweir 	for( XMLStringVector::size_type i=0; i < pHeadingStyles->size(); ++i )
3753cdf0e10cSrcweir 	{
3754cdf0e10cSrcweir 		if( (*pHeadingStyles)[i] == rStyleName )
3755cdf0e10cSrcweir 			return static_cast < sal_Int32 >( i );
3756cdf0e10cSrcweir 	}
3757cdf0e10cSrcweir 
3758cdf0e10cSrcweir 	return -1;
3759cdf0e10cSrcweir }
3760cdf0e10cSrcweir 
3761cdf0e10cSrcweir // --> OD 2008-05-08 #refactorlists#
PushNewTextListsHelper()3762cdf0e10cSrcweir void XMLTextParagraphExport::PushNewTextListsHelper()
3763cdf0e10cSrcweir {
3764cdf0e10cSrcweir     mpTextListsHelper = new XMLTextListsHelper();
3765cdf0e10cSrcweir     maTextListsHelperStack.push_back( mpTextListsHelper );
3766cdf0e10cSrcweir }
3767cdf0e10cSrcweir 
PopTextListsHelper()3768cdf0e10cSrcweir void XMLTextParagraphExport::PopTextListsHelper()
3769cdf0e10cSrcweir {
3770cdf0e10cSrcweir     delete mpTextListsHelper;
3771cdf0e10cSrcweir     mpTextListsHelper = 0;
3772cdf0e10cSrcweir     maTextListsHelperStack.pop_back();
3773cdf0e10cSrcweir     if ( !maTextListsHelperStack.empty() )
3774cdf0e10cSrcweir     {
3775cdf0e10cSrcweir         mpTextListsHelper = maTextListsHelperStack.back();
3776cdf0e10cSrcweir     }
3777cdf0e10cSrcweir }
3778cdf0e10cSrcweir // <--
3779