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