LibreOffice Module xmloff (master) 1
txtparae.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sal/config.h>
21
22#include <o3tl/any.hxx>
24#include <rtl/ustrbuf.hxx>
25#include <sal/types.h>
26#include <sal/log.hxx>
27#include <osl/diagnose.h>
28#include <com/sun/star/lang/XServiceInfo.hpp>
29#include <com/sun/star/container/XEnumerationAccess.hpp>
30#include <com/sun/star/container/XEnumeration.hpp>
31#include <com/sun/star/container/XIndexReplace.hpp>
32#include <com/sun/star/beans/XPropertySet.hpp>
33#include <com/sun/star/beans/XMultiPropertySet.hpp>
34#include <com/sun/star/beans/XPropertyState.hpp>
35#include <com/sun/star/graphic/XGraphic.hpp>
36#include <com/sun/star/text/XTextDocument.hpp>
37#include <com/sun/star/text/XTextSectionsSupplier.hpp>
38#include <com/sun/star/text/XTextTablesSupplier.hpp>
39#include <com/sun/star/text/XNumberingRulesSupplier.hpp>
40#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
41#include <com/sun/star/text/XTextTable.hpp>
42#include <com/sun/star/text/XText.hpp>
43#include <com/sun/star/text/XTextContent.hpp>
44#include <com/sun/star/text/XTextRange.hpp>
45#include <com/sun/star/text/XTextField.hpp>
46#include <com/sun/star/container/XNamed.hpp>
47#include <com/sun/star/container/XContentEnumerationAccess.hpp>
48#include <com/sun/star/text/XTextFrame.hpp>
49#include <com/sun/star/container/XNameAccess.hpp>
50#include <com/sun/star/text/SizeType.hpp>
51#include <com/sun/star/text/HoriOrientation.hpp>
52#include <com/sun/star/text/VertOrientation.hpp>
53#include <com/sun/star/text/TextContentAnchorType.hpp>
54#include <com/sun/star/text/XTextFramesSupplier.hpp>
55#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
56#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
57#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
58#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
59#include <com/sun/star/document/XEventsSupplier.hpp>
60#include <com/sun/star/document/XRedlinesSupplier.hpp>
61#include <com/sun/star/text/XFormField.hpp>
62#include <com/sun/star/text/XTextSection.hpp>
63#include <com/sun/star/drawing/XShape.hpp>
64#include <com/sun/star/style/XAutoStylesSupplier.hpp>
65#include <com/sun/star/style/XAutoStyleFamily.hpp>
66#include <com/sun/star/text/XTextFieldsSupplier.hpp>
67#include <com/sun/star/drawing/XControlShape.hpp>
68#include <com/sun/star/util/DateTime.hpp>
69
71
73#include <xmloff/xmlaustp.hxx>
74#include <xmloff/families.hxx>
75#include "txtexppr.hxx"
76#include <xmloff/xmluconv.hxx>
78#include <xexptran.hxx>
81#include <xmloff/xmlexp.hxx>
82#include <txtflde.hxx>
83#include <xmloff/txtprmap.hxx>
84#include <XMLImageMapExport.hxx>
87#include <xmloff/txtparae.hxx>
88#include "XMLSectionExport.hxx"
91#include "XMLRedlineExport.hxx"
95#include <xmloff/odffields.hxx>
96#include <xmloff/maptype.hxx>
100#include <com/sun/star/embed/ElementModes.hpp>
101#include <com/sun/star/embed/XTransactedObject.hpp>
102#include <com/sun/star/document/XStorageBasedDocument.hpp>
103#include <txtlists.hxx>
104#include <com/sun/star/rdf/XMetadatable.hpp>
105#include <list>
106#include <unordered_map>
107#include <memory>
108#include <vector>
109#include <algorithm>
110#include <iterator>
111#include <officecfg/Office/Common.hxx>
112#include <o3tl/safeint.hxx>
114
115using namespace ::std;
116using namespace ::com::sun::star;
117using namespace ::com::sun::star::uno;
118using namespace ::com::sun::star::lang;
119using namespace ::com::sun::star::beans;
120using namespace ::com::sun::star::container;
121using namespace ::com::sun::star::text;
122using namespace ::com::sun::star::style;
123using namespace ::com::sun::star::util;
124using namespace ::com::sun::star::drawing;
125using namespace ::com::sun::star::document;
126using namespace ::com::sun::star::graphic;
127using namespace ::xmloff;
128using namespace ::xmloff::token;
129
130// Implement Title/Description Elements UI (#i73249#)
131constexpr OUStringLiteral gsTitle(u"Title");
132constexpr OUStringLiteral gsDescription(u"Description");
133constexpr OUStringLiteral gsAnchorPageNo(u"AnchorPageNo");
134constexpr OUStringLiteral gsAnchorType(u"AnchorType");
135constexpr OUStringLiteral gsBookmark(u"Bookmark");
136constexpr OUStringLiteral gsChainNextName(u"ChainNextName");
137constexpr OUStringLiteral gsContourPolyPolygon(u"ContourPolyPolygon");
138constexpr OUStringLiteral gsDocumentIndexMark(u"DocumentIndexMark");
139constexpr OUStringLiteral gsFrame(u"Frame");
140constexpr OUStringLiteral gsGraphicFilter(u"GraphicFilter");
141constexpr OUStringLiteral gsGraphicRotation(u"GraphicRotation");
142constexpr OUStringLiteral gsHeight(u"Height");
143constexpr OUStringLiteral gsHoriOrient(u"HoriOrient");
144constexpr OUStringLiteral gsHoriOrientPosition(u"HoriOrientPosition");
145constexpr OUStringLiteral gsHyperLinkName(u"HyperLinkName");
146constexpr OUStringLiteral gsHyperLinkTarget(u"HyperLinkTarget");
147constexpr OUStringLiteral gsHyperLinkURL(u"HyperLinkURL");
148constexpr OUStringLiteral gsIsAutomaticContour(u"IsAutomaticContour");
149constexpr OUStringLiteral gsIsCollapsed(u"IsCollapsed");
150constexpr OUStringLiteral gsIsPixelContour(u"IsPixelContour");
151constexpr OUStringLiteral gsIsStart(u"IsStart");
152constexpr OUStringLiteral gsIsSyncHeightToWidth(u"IsSyncHeightToWidth");
153constexpr OUStringLiteral gsIsSyncWidthToHeight(u"IsSyncWidthToHeight");
154constexpr OUStringLiteral gsNumberingRules(u"NumberingRules");
155constexpr OUStringLiteral gsParaConditionalStyleName(u"ParaConditionalStyleName");
156constexpr OUStringLiteral gsParagraphService(u"com.sun.star.text.Paragraph");
157constexpr OUStringLiteral gsRedline(u"Redline");
158constexpr OUStringLiteral gsReferenceMark(u"ReferenceMark");
159constexpr OUStringLiteral gsRelativeHeight(u"RelativeHeight");
160constexpr OUStringLiteral gsRelativeWidth(u"RelativeWidth");
161constexpr OUStringLiteral gsRuby(u"Ruby");
162constexpr OUStringLiteral gsRubyCharStyleName(u"RubyCharStyleName");
163constexpr OUStringLiteral gsRubyText(u"RubyText");
164constexpr OUStringLiteral gsServerMap(u"ServerMap");
165constexpr OUStringLiteral gsShapeService(u"com.sun.star.drawing.Shape");
166constexpr OUStringLiteral gsSizeType(u"SizeType");
167constexpr OUStringLiteral gsSoftPageBreak( u"SoftPageBreak" );
168constexpr OUStringLiteral gsTableService(u"com.sun.star.text.TextTable");
169constexpr OUStringLiteral gsText(u"Text");
170constexpr OUStringLiteral gsTextContentService(u"com.sun.star.text.TextContent");
171constexpr OUStringLiteral gsTextEmbeddedService(u"com.sun.star.text.TextEmbeddedObject");
172constexpr OUStringLiteral gsTextField(u"TextField");
173constexpr OUStringLiteral gsTextFieldService(u"com.sun.star.text.TextField");
174constexpr OUStringLiteral gsTextFrameService(u"com.sun.star.text.TextFrame");
175constexpr OUStringLiteral gsTextGraphicService(u"com.sun.star.text.TextGraphicObject");
176constexpr OUStringLiteral gsTextPortionType(u"TextPortionType");
177constexpr OUStringLiteral gsUnvisitedCharStyleName(u"UnvisitedCharStyleName");
178constexpr OUStringLiteral gsVertOrient(u"VertOrient");
179constexpr OUStringLiteral gsVertOrientPosition(u"VertOrientPosition");
180constexpr OUStringLiteral gsVisitedCharStyleName(u"VisitedCharStyleName");
181constexpr OUStringLiteral gsWidth(u"Width");
182constexpr OUStringLiteral gsWidthType( u"WidthType" );
183constexpr OUStringLiteral gsTextFieldStart( u"TextFieldStart" );
184constexpr OUStringLiteral gsTextFieldSep(u"TextFieldSeparator");
185constexpr OUStringLiteral gsTextFieldEnd( u"TextFieldEnd" );
186constexpr OUStringLiteral gsTextFieldStartEnd( u"TextFieldStartEnd" );
187
188namespace
189{
190 class TextContentSet
191 {
192 public:
193 typedef list<Reference<XTextContent>> contents_t;
194 typedef back_insert_iterator<contents_t> inserter_t;
195 typedef contents_t::const_iterator const_iterator_t;
196
197 inserter_t getInserter()
198 { return back_insert_iterator<contents_t>(m_vTextContents); };
199 const_iterator_t getBegin() const
200 { return m_vTextContents.begin(); };
201 const_iterator_t getEnd() const
202 { return m_vTextContents.end(); };
203
204 private:
205 contents_t m_vTextContents;
206 };
207
208 struct FrameRefHash
209 {
210 size_t operator()(const Reference<XTextFrame>& rFrame) const
211 { return sal::static_int_cast<size_t>(reinterpret_cast<sal_uIntPtr>(rFrame.get())); }
212 };
213
214 bool lcl_TextContentsUnfiltered(const Reference<XTextContent>&)
215 { return true; };
216
217 bool lcl_ShapeFilter(const Reference<XTextContent>& xTxtContent)
218 {
219 Reference<XShape> xShape(xTxtContent, UNO_QUERY);
220 if(!xShape.is())
221 return false;
222 Reference<XServiceInfo> xServiceInfo(xTxtContent, UNO_QUERY);
223 return !xServiceInfo->supportsService("com.sun.star.text.TextFrame") &&
224 !xServiceInfo->supportsService("com.sun.star.text.TextGraphicObject") &&
225 !xServiceInfo->supportsService("com.sun.star.text.TextEmbeddedObject");
226 };
227
228 class BoundFrames
229 {
230 public:
231 typedef bool (*filter_t)(const Reference<XTextContent>&);
232 BoundFrames(
233 const Reference<XEnumerationAccess>& rEnumAccess,
234 const filter_t& rFilter)
235 : m_xEnumAccess(rEnumAccess)
236 {
237 Fill(rFilter);
238 };
239 BoundFrames()
240 {};
241 const TextContentSet& GetPageBoundContents() const
242 { return m_vPageBounds; };
243 const TextContentSet* GetFrameBoundContents(const Reference<XTextFrame>& rParentFrame) const
244 {
245 framebound_map_t::const_iterator it = m_vFrameBoundsOf.find(rParentFrame);
246 if(it == m_vFrameBoundsOf.end())
247 return nullptr;
248 return &(it->second);
249 };
250 Reference<XEnumeration> createEnumeration() const
251 {
252 if(!m_xEnumAccess.is())
253 return Reference<XEnumeration>();
254 return m_xEnumAccess->createEnumeration();
255 };
256
257 private:
258 typedef std::unordered_map<
259 Reference<XTextFrame>,
260 TextContentSet,
261 FrameRefHash> framebound_map_t;
262 TextContentSet m_vPageBounds;
263 framebound_map_t m_vFrameBoundsOf;
264 const Reference<XEnumerationAccess> m_xEnumAccess;
265 void Fill(const filter_t& rFilter);
266 };
267
268 class FieldParamExporter
269 {
270 public:
271 FieldParamExporter(SvXMLExport* const pExport, Reference<XNameContainer> const & xFieldParams)
272 : m_pExport(pExport)
273 , m_xFieldParams(xFieldParams)
274 { };
275 void Export();
276
277 private:
278 SvXMLExport* const m_pExport;
279 const Reference<XNameContainer> m_xFieldParams;
280
281 void ExportParameter(const OUString& sKey, const OUString& sValue);
282 };
283
284 struct HyperlinkData
285 {
286 OUString href, name, targetFrame, ustyleName, vstyleName;
287 bool serverMap = false;
288 css::uno::Reference<css::container::XNameReplace> events;
289
290 HyperlinkData() = default;
291 HyperlinkData(const css::uno::Reference<css::beans::XPropertySet>& rPropSet);
292
293 bool operator==(const HyperlinkData&);
294 bool operator!=(const HyperlinkData& rOther) { return !operator==(rOther); }
295
296 bool addHyperlinkAttributes(SvXMLExport& rExport);
297 void exportEvents(SvXMLExport& rExport);
298 };
299
300 HyperlinkData::HyperlinkData(const css::uno::Reference<css::beans::XPropertySet>& rPropSet)
301 {
302 const css::uno::Reference<css::beans::XPropertyState> xPropState(rPropSet, UNO_QUERY);
303 const auto xPropSetInfo(rPropSet->getPropertySetInfo());
304 if (xPropSetInfo->hasPropertyByName(gsHyperLinkURL)
305 && (!xPropState.is()
306 || PropertyState_DIRECT_VALUE == xPropState->getPropertyState(gsHyperLinkURL)))
307 {
308 rPropSet->getPropertyValue(gsHyperLinkURL) >>= href;
309 }
310
311 if (href.isEmpty())
312 return;
313
314 if (xPropSetInfo->hasPropertyByName(gsHyperLinkName)
315 && (!xPropState.is()
316 || PropertyState_DIRECT_VALUE == xPropState->getPropertyState(gsHyperLinkName)))
317 {
318 rPropSet->getPropertyValue(gsHyperLinkName) >>= name;
319 }
320
321 if (xPropSetInfo->hasPropertyByName(gsHyperLinkTarget)
322 && (!xPropState.is()
323 || PropertyState_DIRECT_VALUE == xPropState->getPropertyState(gsHyperLinkTarget)))
324 {
325 rPropSet->getPropertyValue(gsHyperLinkTarget) >>= targetFrame;
326 }
327
328 if (xPropSetInfo->hasPropertyByName(gsServerMap)
329 && (!xPropState.is()
330 || PropertyState_DIRECT_VALUE == xPropState->getPropertyState(gsServerMap)))
331 {
332 serverMap = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(gsServerMap));
333 }
334
335 if (xPropSetInfo->hasPropertyByName(gsUnvisitedCharStyleName)
336 && (!xPropState.is()
337 || PropertyState_DIRECT_VALUE
338 == xPropState->getPropertyState(gsUnvisitedCharStyleName)))
339 {
340 rPropSet->getPropertyValue(gsUnvisitedCharStyleName) >>= ustyleName;
341 }
342
343 if (xPropSetInfo->hasPropertyByName(gsVisitedCharStyleName)
344 && (!xPropState.is()
345 || PropertyState_DIRECT_VALUE
346 == xPropState->getPropertyState(gsVisitedCharStyleName)))
347 {
348 rPropSet->getPropertyValue(gsVisitedCharStyleName) >>= vstyleName;
349 }
350
351 static constexpr OUStringLiteral sHyperLinkEvents(u"HyperLinkEvents");
352 if (xPropSetInfo->hasPropertyByName(sHyperLinkEvents))
353 {
354 events.set(rPropSet->getPropertyValue(sHyperLinkEvents), uno::UNO_QUERY);
355 }
356 }
357
358 bool HyperlinkData::operator==(const HyperlinkData& rOther)
359 {
360 if (href != rOther.href || name != rOther.name || targetFrame != rOther.targetFrame
361 || ustyleName != rOther.ustyleName || vstyleName != rOther.vstyleName
362 || serverMap != rOther.serverMap)
363 return false;
364
365 if (events == rOther.events)
366 return true;
367 if (!events || !rOther.events)
368 return false;
369
370 const css::uno::Sequence<OUString> aNames = events->getElementNames();
371 if (aNames != rOther.events->getElementNames())
372 return false;
373 for (const auto& rName : aNames)
374 {
375 const css::uno::Any aAny = events->getByName(rName);
376 const css::uno::Any aOtherAny = rOther.events->getByName(rName);
377 if (aAny != aOtherAny)
378 return false;
379 }
380 return true;
381 }
382
383 bool HyperlinkData::addHyperlinkAttributes(SvXMLExport& rExport)
384 {
385 if (href.isEmpty())
386 {
387 // hyperlink without a URL does not make sense
388 OSL_ENSURE(false, "hyperlink without a URL --> no export to ODF");
389 return false;
390 }
391
394
395 if (!name.isEmpty())
397
398 if (!targetFrame.isEmpty())
399 {
401 enum XMLTokenEnum eTok = targetFrame == "_blank" ? XML_NEW : XML_REPLACE;
403 }
404
405 if (serverMap)
407
408 if (!ustyleName.isEmpty())
410 rExport.EncodeStyleName(ustyleName));
411
412 if (!vstyleName.isEmpty())
414 rExport.EncodeStyleName(vstyleName));
415
416 return true;
417 }
418
419 void HyperlinkData::exportEvents(SvXMLExport& rExport)
420 {
421 // export events (if supported)
422 if (events)
423 rExport.GetEventExport().Export(events, false);
424 }
425}
426
427namespace xmloff
428{
430 {
431 public:
432 explicit BoundFrameSets(const Reference<XInterface>& rModel);
433 const BoundFrames* GetTexts() const
434 { return m_pTexts.get(); };
435 const BoundFrames* GetGraphics() const
436 { return m_pGraphics.get(); };
437 const BoundFrames* GetEmbeddeds() const
438 { return m_pEmbeddeds.get(); };
439 const BoundFrames* GetShapes() const
440 { return m_pShapes.get(); };
441 private:
442 unique_ptr<BoundFrames> m_pTexts;
443 unique_ptr<BoundFrames> m_pGraphics;
444 unique_ptr<BoundFrames> m_pEmbeddeds;
445 unique_ptr<BoundFrames> m_pShapes;
446 };
447}
448
449#ifdef DBG_UTIL
451#endif
452
453// The following map shows which property values are required:
454
455// property auto style pass export
456
457// ParaStyleName if style exists always
458// ParaConditionalStyleName if style exists always
459// NumberingRules if style exists always
460// TextSection always always
461// ParaChapterNumberingLevel never always
462// NumberingIsNumber never always
463
464// The conclusion is that for auto styles the first three properties
465// should be queried using a multi property set if, and only if, an
466// auto style needs to be exported. TextSection should be queried by
467// an individual call to getPropertyvalue, because this seems to be
468// less expensive than querying the first three properties if they aren't
469// required.
470
471// For the export pass all properties can be queried using a multi property
472// set.
473
474static const char* aParagraphPropertyNamesAuto[] =
475{
476 "NumberingRules",
477 "ParaConditionalStyleName",
478 "ParaStyleName",
479 nullptr
480};
481
482namespace {
483
484enum eParagraphPropertyNamesEnumAuto
485{
486 NUMBERING_RULES_AUTO = 0,
487 PARA_CONDITIONAL_STYLE_NAME_AUTO = 1,
488 PARA_STYLE_NAME_AUTO = 2
489};
490
491}
492
493static const char* aParagraphPropertyNames[] =
494{
495 "NumberingIsNumber",
496 "NumberingStyleName",
497 "OutlineLevel",
498 "ParaConditionalStyleName",
499 "ParaStyleName",
500 "TextSection",
501 "OutlineContentVisible",
502 nullptr
503};
504
505namespace {
506
507enum eParagraphPropertyNamesEnum
508{
509 NUMBERING_IS_NUMBER = 0,
510 PARA_NUMBERING_STYLENAME = 1,
511 PARA_OUTLINE_LEVEL=2,
512 PARA_CONDITIONAL_STYLE_NAME = 3,
513 PARA_STYLE_NAME = 4,
514 TEXT_SECTION = 5,
515 PARA_OUTLINE_CONTENT_VISIBLE = 6
516};
517
518}
519
520void BoundFrames::Fill(const filter_t& rFilter)
521{
522 if(!m_xEnumAccess.is())
523 return;
524 const Reference< XEnumeration > xEnum = m_xEnumAccess->createEnumeration();
525 if(!xEnum.is())
526 return;
527 static const OUStringLiteral our_sAnchorType(u"AnchorType");
528 static const OUStringLiteral our_sAnchorFrame(u"AnchorFrame");
529 while(xEnum->hasMoreElements())
530 {
531 Reference<XPropertySet> xPropSet(xEnum->nextElement(), UNO_QUERY);
532 Reference<XTextContent> xTextContent(xPropSet, UNO_QUERY);
533 if(!xPropSet.is() || !xTextContent.is())
534 continue;
535 TextContentAnchorType eAnchor;
536 xPropSet->getPropertyValue(our_sAnchorType) >>= eAnchor;
537 if(TextContentAnchorType_AT_PAGE != eAnchor && TextContentAnchorType_AT_FRAME != eAnchor)
538 continue;
539 if(!rFilter(xTextContent))
540 continue;
541
542 TextContentSet::inserter_t pInserter = m_vPageBounds.getInserter();
543 if(TextContentAnchorType_AT_FRAME == eAnchor)
544 {
545 Reference<XTextFrame> xAnchorTxtFrame(
546 xPropSet->getPropertyValue(our_sAnchorFrame),
547 uno::UNO_QUERY);
548 pInserter = m_vFrameBoundsOf[xAnchorTxtFrame].getInserter();
549 }
550 *pInserter++ = xTextContent;
551 }
552}
553
554BoundFrameSets::BoundFrameSets(const Reference<XInterface>& rModel)
555 : m_pTexts(new BoundFrames())
556 , m_pGraphics(new BoundFrames())
557 , m_pEmbeddeds(new BoundFrames())
558 , m_pShapes(new BoundFrames())
559{
560 const Reference<XTextFramesSupplier> xTFS(rModel, UNO_QUERY);
561 const Reference<XTextGraphicObjectsSupplier> xGOS(rModel, UNO_QUERY);
562 const Reference<XTextEmbeddedObjectsSupplier> xEOS(rModel, UNO_QUERY);
563 const Reference<XDrawPageSupplier> xDPS(rModel, UNO_QUERY);
564 if(xTFS.is())
565 m_pTexts.reset(new BoundFrames(
566 Reference<XEnumerationAccess>(xTFS->getTextFrames(), UNO_QUERY),
567 &lcl_TextContentsUnfiltered));
568 if(xGOS.is())
569 m_pGraphics.reset(new BoundFrames(
570 Reference<XEnumerationAccess>(xGOS->getGraphicObjects(), UNO_QUERY),
571 &lcl_TextContentsUnfiltered));
572 if(xEOS.is())
573 m_pEmbeddeds.reset(new BoundFrames(
574 Reference<XEnumerationAccess>(xEOS->getEmbeddedObjects(), UNO_QUERY),
575 &lcl_TextContentsUnfiltered));
576 if(xDPS.is())
577 m_pShapes.reset(new BoundFrames(
578 Reference<XEnumerationAccess>(xDPS->getDrawPage(), UNO_QUERY),
579 &lcl_ShapeFilter));
580};
581
582void FieldParamExporter::Export()
583{
584 const Type aStringType = ::cppu::UnoType<OUString>::get();
585 const Type aBoolType = cppu::UnoType<sal_Bool>::get();
586 const Type aSeqType = cppu::UnoType<Sequence<OUString>>::get();
587 const Type aIntType = ::cppu::UnoType<sal_Int32>::get();
588 const Sequence<OUString> vParameters(m_xFieldParams->getElementNames());
589 for(const auto & rParameter : vParameters)
590 {
591 const Any aValue = m_xFieldParams->getByName(rParameter);
592 const Type& aValueType = aValue.getValueType();
593 if(aValueType == aStringType)
594 {
595 OUString sValue;
596 aValue >>= sValue;
597 ExportParameter(rParameter,sValue);
598
599 if ( rParameter == ODF_OLE_PARAM )
600 {
601 // Save the OLE object
602 Reference< embed::XStorage > xTargetStg = m_pExport->GetTargetStorage();
603 if (xTargetStg.is()) {
604 Reference< embed::XStorage > xDstStg = xTargetStg->openStorageElement(
605 "OLELinks", embed::ElementModes::WRITE );
606
607 if ( !xDstStg->hasByName( sValue ) ) {
608 Reference< XStorageBasedDocument > xStgDoc (
609 m_pExport->GetModel( ), UNO_QUERY );
610 Reference< embed::XStorage > xDocStg = xStgDoc->getDocumentStorage();
611 Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement(
612 "OLELinks", embed::ElementModes::READ );
613
614 xOleStg->copyElementTo( sValue, xDstStg, sValue );
615 Reference< embed::XTransactedObject > xTransact( xDstStg, UNO_QUERY );
616 if ( xTransact.is( ) )
617 xTransact->commit( );
618 }
619 } else {
620 SAL_WARN("xmloff", "no target storage");
621 }
622 }
623 }
624 else if(aValueType == aBoolType)
625 {
626 bool bValue = false;
627 aValue >>= bValue;
628 ExportParameter(rParameter, OUString::boolean(bValue) );
629 }
630 else if(aValueType == aSeqType)
631 {
632 Sequence<OUString> vValue;
633 aValue >>= vValue;
634 for(const OUString & i : std::as_const(vValue))
635 {
636 ExportParameter(rParameter, i);
637 }
638 }
639 else if(aValueType == aIntType)
640 {
641 sal_Int32 nValue = 0;
642 aValue >>= nValue;
643 ExportParameter(rParameter, OUString::number(nValue));
644 }
645 }
646}
647
648void FieldParamExporter::ExportParameter(const OUString& sKey, const OUString& sValue)
649{
650 m_pExport->AddAttribute(XML_NAMESPACE_FIELD, XML_NAME, sKey);
651 m_pExport->AddAttribute(XML_NAMESPACE_FIELD, XML_VALUE, sValue);
652 m_pExport->StartElement(XML_NAMESPACE_FIELD, XML_PARAM, false);
653 m_pExport->EndElement(XML_NAMESPACE_FIELD, XML_PARAM, false);
654}
655
657 const Reference < XPropertySet > & rPropSet,
658 const o3tl::span<const XMLPropertyState> aAddStates,
659 bool bDontSeek )
660{
662 switch( nFamily )
663 {
665 xPropMapper = GetParaPropMapper();
666 break;
668 xPropMapper = GetTextPropMapper();
669 break;
671 xPropMapper = GetAutoFramePropMapper();
672 break;
674 xPropMapper = GetSectionPropMapper();
675 break;
677 xPropMapper = GetRubyPropMapper();
678 break;
679 default: break;
680 }
681 SAL_WARN_IF( !xPropMapper.is(), "xmloff", "There is the property mapper?" );
682
683 vector< XMLPropertyState > aPropStates =
684 xPropMapper->Filter(GetExport(), rPropSet);
685
686 aPropStates.insert( aPropStates.end(), aAddStates.begin(), aAddStates.end() );
687
688 if( aPropStates.empty() )
689 return;
690
691 Reference< XPropertySetInfo > xPropSetInfo(rPropSet->getPropertySetInfo());
692 OUString sParent, sCondParent;
693 sal_uInt16 nIgnoreProps = 0;
694 switch( nFamily )
695 {
697 if( xPropSetInfo->hasPropertyByName( gsParaStyleName ) )
698 {
699 rPropSet->getPropertyValue( gsParaStyleName ) >>= sParent;
700 }
701 if( xPropSetInfo->hasPropertyByName( gsParaConditionalStyleName ) )
702 {
703 rPropSet->getPropertyValue( gsParaConditionalStyleName ) >>= sCondParent;
704 }
705 if( xPropSetInfo->hasPropertyByName( gsNumberingRules ) )
706 {
707 Reference < XIndexReplace > xNumRule(rPropSet->getPropertyValue( gsNumberingRules ), uno::UNO_QUERY);
708 if( xNumRule.is() && xNumRule->getCount() )
709 {
710 Reference < XNamed > xNamed( xNumRule, UNO_QUERY );
711 OUString sName;
712 if( xNamed.is() )
713 sName = xNamed->getName();
714 bool bAdd = sName.isEmpty();
715 if( !bAdd )
716 {
717 Reference < XPropertySet > xNumPropSet( xNumRule,
718 UNO_QUERY );
719 if( xNumPropSet.is() &&
720 xNumPropSet->getPropertySetInfo()
721 ->hasPropertyByName( "IsAutomatic" ) )
722 {
723 bAdd = *o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "IsAutomatic" ));
724 // Check on outline style (#i73361#)
725 if ( bAdd &&
726 xNumPropSet->getPropertySetInfo()
727 ->hasPropertyByName( "NumberingIsOutline" ) )
728 {
729 bAdd = !(*o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "NumberingIsOutline" )));
730 }
731 }
732 else
733 {
734 bAdd = true;
735 }
736 }
737 if( bAdd )
738 maListAutoPool.Add( xNumRule );
739 }
740 }
741 break;
743 {
744 // Get parent and remove hyperlinks (they aren't of interest)
745 rtl::Reference< XMLPropertySetMapper > xPM(xPropMapper->getPropertySetMapper());
746 for( ::std::vector< XMLPropertyState >::iterator i(aPropStates.begin());
747 nIgnoreProps < 2 && i != aPropStates.end(); )
748 {
749 if( i->mnIndex == -1 )
750 {
751 ++i;
752 continue;
753 }
754
755 switch( xPM->GetEntryContextId(i->mnIndex) )
756 {
759 i->mnIndex = -1;
760 nIgnoreProps++;
761 i = aPropStates.erase( i );
762 break;
763 default:
764 ++i;
765 break;
766 }
767 }
768 }
769 break;
771 if( xPropSetInfo->hasPropertyByName( gsFrameStyleName ) )
772 {
773 rPropSet->getPropertyValue( gsFrameStyleName ) >>= sParent;
774 }
775 break;
778 ; // section styles have no parents
779 break;
780 default: break;
781 }
782 if (aPropStates.size() - nIgnoreProps)
783 {
784 GetAutoStylePool().Add( nFamily, sParent, std::vector(aPropStates), bDontSeek );
785 if( !sCondParent.isEmpty() && sParent != sCondParent )
786 GetAutoStylePool().Add( nFamily, sCondParent, std::move(aPropStates) );
787 }
788}
789
790static bool lcl_validPropState( const XMLPropertyState& rState )
791{
792 return rState.mnIndex != -1;
793}
794
796 MultiPropertySetHelper& rPropSetHelper,
797 const Reference < XPropertySet > & rPropSet)
798{
800 switch( nFamily )
801 {
803 xPropMapper = GetParaPropMapper();
804 break;
805 default: break;
806 }
807 SAL_WARN_IF( !xPropMapper.is(), "xmloff", "There is the property mapper?" );
808
809 vector<XMLPropertyState> aPropStates(xPropMapper->Filter(GetExport(), rPropSet));
810
811 if( rPropSetHelper.hasProperty( NUMBERING_RULES_AUTO ) )
812 {
813 Reference < XIndexReplace > xNumRule(rPropSetHelper.getValue( NUMBERING_RULES_AUTO,
814 rPropSet, true ), uno::UNO_QUERY);
815 if( xNumRule.is() && xNumRule->getCount() )
816 {
817 Reference < XNamed > xNamed( xNumRule, UNO_QUERY );
818 OUString sName;
819 if( xNamed.is() )
820 sName = xNamed->getName();
821 bool bAdd = sName.isEmpty();
822 if( !bAdd )
823 {
824 Reference < XPropertySet > xNumPropSet( xNumRule,
825 UNO_QUERY );
826 if( xNumPropSet.is() &&
827 xNumPropSet->getPropertySetInfo()
828 ->hasPropertyByName( "IsAutomatic" ) )
829 {
830 bAdd = *o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "IsAutomatic" ));
831 // Check on outline style (#i73361#)
832 if ( bAdd &&
833 xNumPropSet->getPropertySetInfo()
834 ->hasPropertyByName( "NumberingIsOutline" ) )
835 {
836 bAdd = !(*o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "NumberingIsOutline" )));
837 }
838 }
839 else
840 {
841 bAdd = true;
842 }
843 }
844 if( bAdd )
845 maListAutoPool.Add( xNumRule );
846 }
847 }
848
849 if( aPropStates.empty() )
850 return;
851
852 OUString sParent, sCondParent;
853 switch( nFamily )
854 {
856 if( rPropSetHelper.hasProperty( PARA_STYLE_NAME_AUTO ) )
857 {
858 rPropSetHelper.getValue( PARA_STYLE_NAME_AUTO, rPropSet,
859 true ) >>= sParent;
860 }
861 if( rPropSetHelper.hasProperty( PARA_CONDITIONAL_STYLE_NAME_AUTO ) )
862 {
863 rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME_AUTO,
864 rPropSet, true ) >>= sCondParent;
865 }
866
867 break;
868 default: break;
869 }
870
871 if( std::any_of( aPropStates.begin(), aPropStates.end(), lcl_validPropState ) )
872 {
873 GetAutoStylePool().Add( nFamily, sParent, std::vector(aPropStates) );
874 if( !sCondParent.isEmpty() && sParent != sCondParent )
875 GetAutoStylePool().Add( nFamily, sCondParent, std::move(aPropStates) );
876 }
877}
878
880 XmlStyleFamily nFamily,
881 const Reference < XPropertySet > & rPropSet,
882 const OUString& rParent,
883 const o3tl::span<const XMLPropertyState> aAddStates) const
884{
885 OUString sName( rParent );
887 switch( nFamily )
888 {
890 xPropMapper = GetParaPropMapper();
891 break;
893 xPropMapper = GetAutoFramePropMapper();
894 break;
896 xPropMapper = GetSectionPropMapper();
897 break;
899 xPropMapper = GetRubyPropMapper();
900 break;
901 default: break;
902 }
903 SAL_WARN_IF( !xPropMapper.is(), "xmloff", "There is the property mapper?" );
904 if( !xPropMapper.is() )
905 return sName;
906 vector<XMLPropertyState> aPropStates(xPropMapper->Filter(GetExport(), rPropSet));
907 aPropStates.insert( aPropStates.end(), aAddStates.begin(), aAddStates.end() );
908 if( std::any_of( aPropStates.begin(), aPropStates.end(), lcl_validPropState ) )
909 sName = GetAutoStylePool().Find( nFamily, sName, aPropStates );
910
911 return sName;
912}
913
915 const Reference < XPropertySet > & rPropSet,
916 bool& rbHasCharStyle,
917 bool& rbHasAutoStyle,
918 const XMLPropertyState** ppAddStates ) const
919{
920 rtl::Reference < SvXMLExportPropertyMapper > xPropMapper(GetTextPropMapper());
921 vector<XMLPropertyState> aPropStates(xPropMapper->Filter(GetExport(), rPropSet));
922
923 // Get parent and remove hyperlinks (they aren't of interest)
924 OUString sName;
925 rbHasCharStyle = rbHasAutoStyle = false;
926 sal_uInt16 nIgnoreProps = 0;
927 rtl::Reference< XMLPropertySetMapper > xPM(xPropMapper->getPropertySetMapper());
928 ::std::vector< XMLPropertyState >::iterator aFirstDel = aPropStates.end();
929 ::std::vector< XMLPropertyState >::iterator aSecondDel = aPropStates.end();
930
931 for( ::std::vector< XMLPropertyState >::iterator
932 i = aPropStates.begin();
933 nIgnoreProps < 2 && i != aPropStates.end();
934 ++i )
935 {
936 if( i->mnIndex == -1 )
937 continue;
938
939 switch( xPM->GetEntryContextId(i->mnIndex) )
940 {
942 i->maValue >>= sName;
943 i->mnIndex = -1;
944 rbHasCharStyle = !sName.isEmpty();
945 if( nIgnoreProps )
946 aSecondDel = i;
947 else
948 aFirstDel = i;
949 nIgnoreProps++;
950 break;
952 i->mnIndex = -1;
953 if( nIgnoreProps )
954 aSecondDel = i;
955 else
956 aFirstDel = i;
957 nIgnoreProps++;
958 break;
959 }
960 }
961 if( ppAddStates )
962 {
963 while( *ppAddStates )
964 {
965 aPropStates.push_back( **ppAddStates );
966 ppAddStates++;
967 }
968 }
969 if (aPropStates.size() - nIgnoreProps)
970 {
971 // erase the character style, otherwise the autostyle cannot be found!
972 // erase the hyperlink, otherwise the autostyle cannot be found!
973 if ( nIgnoreProps )
974 {
975 // If two elements of a vector have to be deleted,
976 // we should delete the second one first.
977 if( --nIgnoreProps )
978 aPropStates.erase( aSecondDel );
979 aPropStates.erase( aFirstDel );
980 }
981 sName = GetAutoStylePool().Find(
983 OUString(), // AutoStyles should not have parents!
984 aPropStates );
985 rbHasAutoStyle = true;
986 }
987
988 return sName;
989}
990
991// adjustments to support lists independent from list style
993 const XMLTextNumRuleInfo& rPrevInfo,
994 const XMLTextNumRuleInfo& rNextInfo )
995{
996 // end a list
997 if ( rPrevInfo.GetLevel() > 0 )
998 {
999 sal_Int16 nListLevelsToBeClosed = 0;
1000 if ( !rNextInfo.BelongsToSameList( rPrevInfo ) ||
1001 rNextInfo.GetLevel() <= 0 )
1002 {
1003 // close complete previous list
1004 nListLevelsToBeClosed = rPrevInfo.GetLevel();
1005 }
1006 else if ( rPrevInfo.GetLevel() > rNextInfo.GetLevel() )
1007 {
1008 // close corresponding sub lists
1009 SAL_WARN_IF( rNextInfo.GetLevel() <= 0, "xmloff",
1010 "<rPrevInfo.GetLevel() > 0> not hold. Serious defect." );
1011 nListLevelsToBeClosed = rPrevInfo.GetLevel() - rNextInfo.GetLevel();
1012 }
1013
1014 if ( nListLevelsToBeClosed > 0 &&
1015 maListElements.size() >= sal::static_int_cast< sal_uInt32 >( 2 * nListLevelsToBeClosed ) )
1016 {
1017 do {
1018 for(size_t j = 0; j < 2; ++j)
1019 {
1020 OUString aElem(maListElements.back());
1021 maListElements.pop_back();
1022 GetExport().EndElement(aElem, true);
1023 }
1024
1025 // remove closed list from list stack
1026 mpTextListsHelper->PopListFromStack();
1027
1028 --nListLevelsToBeClosed;
1029 } while ( nListLevelsToBeClosed > 0 );
1030 }
1031 }
1032
1033 const bool bExportODF =
1034 bool( GetExport().getExportFlags() & SvXMLExportFlags::OASIS );
1035 const SvtSaveOptions::ODFSaneDefaultVersion eODFDefaultVersion =
1036 GetExport().getSaneDefaultVersion();
1037
1038 // start a new list
1039 if ( rNextInfo.GetLevel() > 0 )
1040 {
1041 bool bRootListToBeStarted = false;
1042 sal_Int16 nListLevelsToBeOpened = 0;
1043 if ( !rPrevInfo.BelongsToSameList( rNextInfo ) ||
1044 rPrevInfo.GetLevel() <= 0 )
1045 {
1046 // new root list
1047 bRootListToBeStarted = true;
1048 nListLevelsToBeOpened = rNextInfo.GetLevel();
1049 }
1050 else if ( rNextInfo.GetLevel() > rPrevInfo.GetLevel() )
1051 {
1052 // open corresponding sub lists
1053 SAL_WARN_IF( rPrevInfo.GetLevel() <= 0, "xmloff",
1054 "<rPrevInfo.GetLevel() > 0> not hold. Serious defect." );
1055 nListLevelsToBeOpened = rNextInfo.GetLevel() - rPrevInfo.GetLevel();
1056 }
1057
1058 if ( nListLevelsToBeOpened > 0 )
1059 {
1060 const OUString& sListStyleName( rNextInfo.GetNumRulesName() );
1061 // Currently only the text documents support <ListId>.
1062 // Thus, for other document types <sListId> is empty.
1063 const OUString& sListId( rNextInfo.GetListId() );
1064 bool bExportListStyle( true );
1065 bool bRestartNumberingAtContinuedList( false );
1066 sal_Int32 nRestartValueForContinuedList( -1 );
1067 bool bContinueingPreviousSubList = !bRootListToBeStarted &&
1068 rNextInfo.IsContinueingPreviousSubTree();
1069 do {
1070 GetExport().CheckAttrList();
1071
1072 if ( bRootListToBeStarted )
1073 {
1074 if ( !mpTextListsHelper->IsListProcessed( sListId ) )
1075 {
1076 if ( bExportODF &&
1077 eODFDefaultVersion >= SvtSaveOptions::ODFSVER_012 &&
1078 !sListId.isEmpty() && !rNextInfo.IsListIdDefault() )
1079 {
1080 /* Property text:id at element <text:list> has to be
1081 replaced by property xml:id (#i92221#)
1082 */
1083 GetExport().AddAttribute( XML_NAMESPACE_XML,
1084 XML_ID,
1085 sListId );
1086 }
1087 mpTextListsHelper->KeepListAsProcessed( sListId,
1088 sListStyleName,
1089 OUString() );
1090 }
1091 else
1092 {
1093 const OUString sNewListId(
1094 mpTextListsHelper->GenerateNewListId() );
1095 if ( bExportODF &&
1096 eODFDefaultVersion >= SvtSaveOptions::ODFSVER_012 &&
1097 !sListId.isEmpty() && !rNextInfo.IsListIdDefault() )
1098 {
1099 /* Property text:id at element <text:list> has to be
1100 replaced by property xml:id (#i92221#)
1101 */
1102 GetExport().AddAttribute( XML_NAMESPACE_XML,
1103 XML_ID,
1104 sNewListId );
1105 }
1106
1107 const OUString sContinueListId =
1108 mpTextListsHelper->GetLastContinuingListId( sListId );
1109 // store that list with list id <sNewListId> is last list,
1110 // which has continued list with list id <sListId>
1111 mpTextListsHelper->StoreLastContinuingList( sListId,
1112 sNewListId );
1113 if ( sListStyleName ==
1114 mpTextListsHelper->GetListStyleOfLastProcessedList() &&
1115 // Inconsistent behavior regarding lists (#i92811#)
1116 sContinueListId ==
1117 mpTextListsHelper->GetLastProcessedListId() &&
1118 !rNextInfo.IsRestart() )
1119 {
1120 GetExport().AddAttribute( XML_NAMESPACE_TEXT,
1122 XML_TRUE );
1123 }
1124 else
1125 {
1126 if ( bExportODF &&
1127 eODFDefaultVersion >= SvtSaveOptions::ODFSVER_012 &&
1128 !sListId.isEmpty() )
1129 {
1130 GetExport().AddAttribute( XML_NAMESPACE_TEXT,
1132 sContinueListId );
1133 }
1134
1135 if ( rNextInfo.IsRestart() &&
1136 ( nListLevelsToBeOpened != 1 ||
1137 !rNextInfo.HasStartValue() ) )
1138 {
1139 bRestartNumberingAtContinuedList = true;
1140 nRestartValueForContinuedList =
1141 rNextInfo.GetListLevelStartValue();
1142 }
1143 }
1144
1145 mpTextListsHelper->KeepListAsProcessed( sNewListId,
1146 sListStyleName,
1147 sContinueListId );
1148 }
1149
1150 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
1151 GetExport().EncodeStyleName( sListStyleName ) );
1152 bExportListStyle = false;
1153
1154 bRootListToBeStarted = false;
1155 }
1156 else if ( bExportListStyle &&
1157 !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) )
1158 {
1159 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
1160 GetExport().EncodeStyleName( sListStyleName ) );
1161 bExportListStyle = false;
1162
1163 }
1164 else
1165 {
1166 // rhbz#746174: also export list restart for non root list
1167 if (rNextInfo.IsRestart() && !rNextInfo.HasStartValue())
1168 {
1169 bRestartNumberingAtContinuedList = true;
1170 nRestartValueForContinuedList =
1171 rNextInfo.GetListLevelStartValue();
1172 }
1173 }
1174
1175 if ( bContinueingPreviousSubList )
1176 {
1177 GetExport().AddAttribute( XML_NAMESPACE_TEXT,
1179 bContinueingPreviousSubList = false;
1180 }
1181
1182 enum XMLTokenEnum eLName = XML_LIST;
1183
1184 OUString aElem(GetExport().GetNamespaceMap().GetQNameByKey(
1186 GetXMLToken(eLName) ) );
1187 GetExport().IgnorableWhitespace();
1188 GetExport().StartElement(aElem, false);
1189
1190 maListElements.push_back(aElem);
1191
1192 mpTextListsHelper->PushListOnStack( sListId,
1193 sListStyleName );
1194
1195 // <text:list-header> or <text:list-item>
1196 GetExport().CheckAttrList();
1197
1198 /* Export start value at correct list item (#i97309#) */
1199 if ( nListLevelsToBeOpened == 1 )
1200 {
1201 if ( rNextInfo.HasStartValue() )
1202 {
1203 OUStringBuffer aBuffer;
1204 aBuffer.append( static_cast<sal_Int32>(rNextInfo.GetStartValue()) );
1205 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
1206 aBuffer.makeStringAndClear() );
1207 }
1208 else if (bRestartNumberingAtContinuedList)
1209 {
1210 GetExport().AddAttribute( XML_NAMESPACE_TEXT,
1212 OUString::number(nRestartValueForContinuedList) );
1213 bRestartNumberingAtContinuedList = false;
1214 }
1215 }
1216
1217 eLName = ( rNextInfo.IsNumbered() || nListLevelsToBeOpened > 1 )
1220 aElem = GetExport().GetNamespaceMap().GetQNameByKey(
1222 GetXMLToken(eLName) );
1223 GetExport().IgnorableWhitespace();
1224 GetExport().StartElement(aElem, false);
1225 maListElements.push_back(aElem);
1226
1227 // export of <text:number> element for last opened <text:list-item>, if requested
1228 if ( GetExport().exportTextNumberElement() &&
1229 eLName == XML_LIST_ITEM && nListLevelsToBeOpened == 1 && // last iteration --> last opened <text:list-item>
1230 !rNextInfo.ListLabelString().isEmpty() )
1231 {
1232 const OUString aTextNumberElem =
1233 GetExport().GetNamespaceMap().GetQNameByKey(
1236 GetExport().IgnorableWhitespace();
1237 GetExport().StartElement( aTextNumberElem, false );
1238 GetExport().Characters( rNextInfo.ListLabelString() );
1239 GetExport().EndElement( aTextNumberElem, true );
1240 }
1241 --nListLevelsToBeOpened;
1242 } while ( nListLevelsToBeOpened > 0 );
1243 }
1244 }
1245
1246 bool bEndElement = false;
1247
1248 if ( rNextInfo.GetLevel() > 0 &&
1249 rNextInfo.IsNumbered() &&
1250 rPrevInfo.BelongsToSameList( rNextInfo ) &&
1251 rPrevInfo.GetLevel() >= rNextInfo.GetLevel() )
1252 {
1253 assert(maListElements.size() >= 2 && "list elements missing");
1254 bEndElement = maListElements.size() >= 2;
1255 }
1256
1257 if (!bEndElement)
1258 return;
1259
1260 // close previous list-item
1261 GetExport().EndElement(maListElements.back(), true );
1262 maListElements.pop_back();
1263
1264 // Only for sub lists (#i103745#)
1265 if ( rNextInfo.IsRestart() && !rNextInfo.HasStartValue() &&
1266 rNextInfo.GetLevel() != 1 )
1267 {
1268 // start new sub list respectively list on same list level
1269 GetExport().EndElement(maListElements.back(), true );
1270 GetExport().IgnorableWhitespace();
1271 GetExport().StartElement(maListElements.back(), false);
1272 }
1273
1274 // open new list-item
1275 GetExport().CheckAttrList();
1276 if( rNextInfo.HasStartValue() )
1277 {
1278 OUStringBuffer aBuffer;
1279 aBuffer.append( static_cast<sal_Int32>(rNextInfo.GetStartValue()) );
1280 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
1281 aBuffer.makeStringAndClear() );
1282 }
1283 // Handle restart without start value on list level 1 (#i103745#)
1284 else if ( rNextInfo.IsRestart() &&
1285 rNextInfo.GetLevel() == 1 )
1286 {
1287 OUStringBuffer aBuffer;
1288 aBuffer.append( static_cast<sal_Int32>(rNextInfo.GetListLevelStartValue()) );
1289 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
1290 aBuffer.makeStringAndClear() );
1291 }
1292 if ( ( GetExport().getExportFlags() & SvXMLExportFlags::OASIS ) &&
1293 GetExport().getSaneDefaultVersion() >= SvtSaveOptions::ODFSVER_012)
1294 {
1295 const OUString& sListStyleName( rNextInfo.GetNumRulesName() );
1296 if ( !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) )
1297 {
1298 GetExport().AddAttribute( XML_NAMESPACE_TEXT,
1300 GetExport().EncodeStyleName( sListStyleName ) );
1301 }
1302 }
1303 OUString aElem( GetExport().GetNamespaceMap().GetQNameByKey(
1306 GetExport().IgnorableWhitespace();
1307 GetExport().StartElement(aElem, false );
1308 maListElements.push_back(aElem);
1309
1310 // export of <text:number> element for <text:list-item>, if requested
1311 if ( GetExport().exportTextNumberElement() &&
1312 !rNextInfo.ListLabelString().isEmpty() )
1313 {
1314 const OUString aTextNumberElem =
1315 GetExport().GetNamespaceMap().GetQNameByKey(
1318 GetExport().IgnorableWhitespace();
1319 GetExport().StartElement( aTextNumberElem, false );
1320 GetExport().Characters( rNextInfo.ListLabelString() );
1321 GetExport().EndElement( aTextNumberElem, true );
1322 }
1323
1324}
1325
1327{
1328 typedef ::std::map<Reference<XFormField>, sal_Int32> FieldMarkMap_t;
1330
1331 explicit Impl() {}
1332 sal_Int32 AddFieldMarkStart(Reference<XFormField> const& i_xFieldMark)
1333 {
1334 assert(m_FieldMarkMap.find(i_xFieldMark) == m_FieldMarkMap.end());
1335 sal_Int32 const ret(m_FieldMarkMap.size());
1336 m_FieldMarkMap.insert(::std::make_pair(i_xFieldMark, ret));
1337 return ret;
1338 }
1339 sal_Int32 GetFieldMarkIndex(Reference<XFormField> const& i_xFieldMark)
1340 {
1341 FieldMarkMap_t::const_iterator const it(
1342 m_FieldMarkMap.find(i_xFieldMark));
1343 // rely on SwXFieldmark::CreateXFieldmark returning the same instance
1344 // because the Reference in m_FieldMarkMap will keep it alive
1345 assert(it != m_FieldMarkMap.end());
1346 return it->second;
1347 }
1348};
1349
1351 SvXMLExport& rExp,
1352 SvXMLAutoStylePoolP & rASP
1353 ) :
1354 XMLStyleExport( rExp, &rASP ),
1355 m_xImpl(new Impl),
1356 rAutoStylePool( rASP ),
1357 pBoundFrameSets(new BoundFrameSets(GetExport().GetModel())),
1358 maListAutoPool( GetExport() ),
1359 bProgress( false ),
1360 bBlock( false ),
1361 bOpenRuby( false ),
1362 mpTextListsHelper( nullptr ),
1363 mbCollected(false),
1364 aCharStyleNamesPropInfoCache( gsCharStyleNames )
1365{
1368 GetExport() );
1369
1370 OUString sFamily( GetXMLToken(XML_PARAGRAPH) );
1371 OUString aPrefix(u'P');
1373 xParaPropMapper, aPrefix );
1374
1375 xPropMapper = new XMLTextPropertySetMapper( TextPropMap::TEXT, true );
1377 GetExport() );
1378 sFamily = GetXMLToken(XML_TEXT);
1379 aPrefix = "T";
1381 xTextPropMapper, aPrefix );
1382
1383 xPropMapper = new XMLTextPropertySetMapper( TextPropMap::AUTO_FRAME, true );
1385 GetExport() );
1387 aPrefix = "fr";
1389 xAutoFramePropMapper, aPrefix );
1390
1391 xPropMapper = new XMLTextPropertySetMapper( TextPropMap::SECTION, true );
1393 GetExport() );
1394 sFamily = GetXMLToken( XML_SECTION );
1395 aPrefix = "Sect" ;
1397 xSectionPropMapper, aPrefix );
1398
1399 xPropMapper = new XMLTextPropertySetMapper( TextPropMap::RUBY, true );
1400 xRubyPropMapper = new SvXMLExportPropertyMapper( xPropMapper );
1401 sFamily = GetXMLToken( XML_RUBY );
1402 aPrefix = "Ru";
1404 xRubyPropMapper, aPrefix );
1405
1406 xPropMapper = new XMLTextPropertySetMapper( TextPropMap::FRAME, true );
1408 GetExport() );
1409
1410 pSectionExport.reset( new XMLSectionExport( rExp, *this ) );
1411 pIndexMarkExport.reset( new XMLIndexMarkExport( rExp ) );
1412
1413 if( ! IsBlockMode() &&
1414 Reference<XRedlinesSupplier>( GetExport().GetModel(), UNO_QUERY ).is())
1415 pRedlineExport.reset( new XMLRedlineExport( rExp ) );
1416
1417 // The text field helper needs a pre-constructed XMLPropertyState
1418 // to export the combined characters field. We construct that
1419 // here, because we need the text property mapper to do it.
1420
1421 // construct Any value, then find index
1422 sal_Int32 nIndex = xTextPropMapper->getPropertySetMapper()->FindEntryIndex(
1425 pFieldExport.reset( new XMLTextFieldExport( rExp, std::make_unique<XMLPropertyState>( nIndex, uno::Any(true) ) ) );
1427}
1428
1430{
1431 pRedlineExport.reset();
1432 pIndexMarkExport.reset();
1433 pSectionExport.reset();
1434 pFieldExport.reset();
1435#ifdef DBG_UTIL
1437#endif
1439 SAL_WARN_IF( !maTextListsHelperStack.empty(), "xmloff",
1440 "misusage of text lists helper stack - it is not empty. Serious defect" );
1441}
1442
1444 SvXMLExport& rExport )
1445{
1448 return new XMLTextExportPropertySetMapper( xPropMapper, rExport );
1449}
1450
1452 SvXMLExport& rExport)
1453{
1454 XMLPropertySetMapper *pPropMapper =
1456 return new XMLTextExportPropertySetMapper( pPropMapper, rExport );
1457}
1458
1460 SvXMLExport& rExport)
1461{
1462 XMLPropertySetMapper *pPropMapper =
1464 return new XMLTextExportPropertySetMapper( pPropMapper, rExport );
1465}
1466
1468 SvXMLExport& rExport)
1469{
1470 XMLPropertySetMapper *pPropMapper =
1472 return new XMLTextExportPropertySetMapper( pPropMapper, rExport );
1473}
1474
1476{
1477 const TextContentSet& rTexts = pBoundFrameSets->GetTexts()->GetPageBoundContents();
1478 const TextContentSet& rGraphics = pBoundFrameSets->GetGraphics()->GetPageBoundContents();
1479 const TextContentSet& rEmbeddeds = pBoundFrameSets->GetEmbeddeds()->GetPageBoundContents();
1480 const TextContentSet& rShapes = pBoundFrameSets->GetShapes()->GetPageBoundContents();
1481 for(TextContentSet::const_iterator_t it = rTexts.getBegin();
1482 it != rTexts.getEnd();
1483 ++it)
1484 exportTextFrame(*it, false/*bAutoStyles*/, bIsProgress, true);
1485 for(TextContentSet::const_iterator_t it = rGraphics.getBegin();
1486 it != rGraphics.getEnd();
1487 ++it)
1488 exportTextGraphic(*it, false/*bAutoStyles*/);
1489 for(TextContentSet::const_iterator_t it = rEmbeddeds.getBegin();
1490 it != rEmbeddeds.getEnd();
1491 ++it)
1492 exportTextEmbedded(*it, false/*bAutoStyles*/);
1493 for(TextContentSet::const_iterator_t it = rShapes.getBegin();
1494 it != rShapes.getEnd();
1495 ++it)
1496 exportShape(*it, false/*bAutoStyles*/);
1497}
1498
1500 bool bAutoStyles,
1501 bool bIsProgress,
1502 const Reference < XTextFrame > *pParentTxtFrame )
1503{
1504 const TextContentSet* const pTexts = pBoundFrameSets->GetTexts()->GetFrameBoundContents(*pParentTxtFrame);
1505 if(pTexts)
1506 for(TextContentSet::const_iterator_t it = pTexts->getBegin();
1507 it != pTexts->getEnd();
1508 ++it)
1509 exportTextFrame(*it, bAutoStyles, bIsProgress, true);
1510 const TextContentSet* const pGraphics = pBoundFrameSets->GetGraphics()->GetFrameBoundContents(*pParentTxtFrame);
1511 if(pGraphics)
1512 for(TextContentSet::const_iterator_t it = pGraphics->getBegin();
1513 it != pGraphics->getEnd();
1514 ++it)
1515 exportTextGraphic(*it, bAutoStyles);
1516 const TextContentSet* const pEmbeddeds = pBoundFrameSets->GetEmbeddeds()->GetFrameBoundContents(*pParentTxtFrame);
1517 if(pEmbeddeds)
1518 for(TextContentSet::const_iterator_t it = pEmbeddeds->getBegin();
1519 it != pEmbeddeds->getEnd();
1520 ++it)
1521 exportTextEmbedded(*it, bAutoStyles);
1522 const TextContentSet* const pShapes = pBoundFrameSets->GetShapes()->GetFrameBoundContents(*pParentTxtFrame);
1523 if(pShapes)
1524 for(TextContentSet::const_iterator_t it = pShapes->getBegin();
1525 it != pShapes->getEnd();
1526 ++it)
1527 exportShape(*it, bAutoStyles);
1528}
1529
1530// bookmarks, reference marks (and TOC marks) are the same except for the
1531// element names. We use the same method for export and it an array with
1532// the proper element names
1537
1538// This function replaces the text portion iteration during auto style
1539// collection.
1541{
1542 GetExport().GetShapeExport(); // make sure the graphics styles family is added
1543
1544 if (mbCollected)
1545 return;
1546
1547 const bool bAutoStyles = true;
1548 const bool bExportContent = false;
1549
1550 // Export AutoStyles:
1551 Reference< XAutoStylesSupplier > xAutoStylesSupp( GetExport().GetModel(), UNO_QUERY );
1552 if ( xAutoStylesSupp.is() )
1553 {
1554 Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles();
1555 const auto collectFamily = [this, &xAutoStyleFamilies](const OUString& sName,
1556 XmlStyleFamily nFamily) {
1557 Any aAny = xAutoStyleFamilies->getByName( sName );
1558 Reference< XAutoStyleFamily > xAutoStyles = *o3tl::doAccess<Reference<XAutoStyleFamily>>(aAny);
1559 Reference < XEnumeration > xAutoStylesEnum( xAutoStyles->createEnumeration() );
1560
1561 while ( xAutoStylesEnum->hasMoreElements() )
1562 {
1563 aAny = xAutoStylesEnum->nextElement();
1564 Reference< XAutoStyle > xAutoStyle = *o3tl::doAccess<Reference<XAutoStyle>>(aAny);
1565 Reference < XPropertySet > xPSet( xAutoStyle, uno::UNO_QUERY );
1566 Add( nFamily, xPSet, {}, true );
1567 }
1568 };
1569 collectFamily("CharacterStyles", XmlStyleFamily::TEXT_TEXT);
1570 collectFamily("RubyStyles", XmlStyleFamily::TEXT_RUBY);
1571 collectFamily("ParagraphStyles", XmlStyleFamily::TEXT_PARAGRAPH);
1572 }
1573
1574 // Export Field AutoStyles:
1575 Reference< XTextFieldsSupplier > xTextFieldsSupp( GetExport().GetModel(), UNO_QUERY );
1576 if ( xTextFieldsSupp.is() )
1577 {
1578 Reference< XEnumerationAccess > xTextFields = xTextFieldsSupp->getTextFields();
1579 Reference < XEnumeration > xTextFieldsEnum( xTextFields->createEnumeration() );
1580
1581 while ( xTextFieldsEnum->hasMoreElements() )
1582 {
1583 Any aAny = xTextFieldsEnum->nextElement();
1584 Reference< XTextField > xTextField = *o3tl::doAccess<Reference<XTextField>>(aAny);
1585 exportTextField( xTextField, bAutoStyles, bIsProgress,
1586 !xAutoStylesSupp.is(), nullptr );
1587 try
1588 {
1589 Reference < XPropertySet > xSet( xTextField, UNO_QUERY );
1590 Reference < XText > xText;
1591 Any a = xSet->getPropertyValue("TextRange");
1592 a >>= xText;
1593 if ( xText.is() )
1594 {
1595 exportText( xText, true, bIsProgress, bExportContent );
1597 ->collectTextAutoStyles( xText );
1598 }
1599 }
1600 catch (Exception&)
1601 {
1602 }
1603 }
1604 }
1605
1606 // Export text frames:
1607 Reference<XEnumeration> xTextFramesEnum = pBoundFrameSets->GetTexts()->createEnumeration();
1608 if(xTextFramesEnum.is())
1609 while(xTextFramesEnum->hasMoreElements())
1610 {
1611 Reference<XTextContent> xTxtCntnt(xTextFramesEnum->nextElement(), UNO_QUERY);
1612 if(xTxtCntnt.is())
1613 exportTextFrame(xTxtCntnt, bAutoStyles, bIsProgress, bExportContent);
1614 }
1615
1616 // Export graphic objects:
1617 Reference<XEnumeration> xGraphicsEnum = pBoundFrameSets->GetGraphics()->createEnumeration();
1618 if(xGraphicsEnum.is())
1619 while(xGraphicsEnum->hasMoreElements())
1620 {
1621 Reference<XTextContent> xTxtCntnt(xGraphicsEnum->nextElement(), UNO_QUERY);
1622 if(xTxtCntnt.is())
1623 exportTextGraphic(xTxtCntnt, true);
1624 }
1625
1626 // Export embedded objects:
1627 Reference<XEnumeration> xEmbeddedsEnum = pBoundFrameSets->GetEmbeddeds()->createEnumeration();
1628 if(xEmbeddedsEnum.is())
1629 while(xEmbeddedsEnum->hasMoreElements())
1630 {
1631 Reference<XTextContent> xTxtCntnt(xEmbeddedsEnum->nextElement(), UNO_QUERY);
1632 if(xTxtCntnt.is())
1633 exportTextEmbedded(xTxtCntnt, true);
1634 }
1635
1636 // Export shapes:
1637 Reference<XEnumeration> xShapesEnum = pBoundFrameSets->GetShapes()->createEnumeration();
1638 if(xShapesEnum.is())
1639 while(xShapesEnum->hasMoreElements())
1640 {
1641 Reference<XTextContent> xTxtCntnt(xShapesEnum->nextElement(), UNO_QUERY);
1642 if(xTxtCntnt.is())
1643 {
1644 Reference<XServiceInfo> xServiceInfo(xTxtCntnt, UNO_QUERY);
1645 if( xServiceInfo->supportsService(gsShapeService))
1646 exportShape(xTxtCntnt, true);
1647 }
1648 }
1649
1650 sal_Int32 nCount;
1651 // AutoStyles for sections
1652 Reference< XTextSectionsSupplier > xSectionsSupp( GetExport().GetModel(), UNO_QUERY );
1653 if ( xSectionsSupp.is() )
1654 {
1655 Reference< XIndexAccess > xSections( xSectionsSupp->getTextSections(), UNO_QUERY );
1656 if ( xSections.is() )
1657 {
1658 nCount = xSections->getCount();
1659 for( sal_Int32 i = 0; i < nCount; ++i )
1660 {
1661 Any aAny = xSections->getByIndex( i );
1662 Reference< XTextSection > xSection = *o3tl::doAccess<Reference<XTextSection>>(aAny);
1663 Reference < XPropertySet > xPSet( xSection, uno::UNO_QUERY );
1665 }
1666 }
1667 }
1668
1669 // AutoStyles for tables (Note: suppress autostyle collection for paragraphs in exportTable)
1670 Reference< XTextTablesSupplier > xTablesSupp( GetExport().GetModel(), UNO_QUERY );
1671 if ( xTablesSupp.is() )
1672 {
1673 Reference< XIndexAccess > xTables( xTablesSupp->getTextTables(), UNO_QUERY );
1674 if ( xTables.is() )
1675 {
1676 nCount = xTables->getCount();
1677 for( sal_Int32 i = 0; i < nCount; ++i )
1678 {
1679 Any aAny = xTables->getByIndex( i );
1680 Reference< XTextTable > xTable = *o3tl::doAccess<Reference<XTextTable>>(aAny);
1681 exportTable( xTable, true, true );
1682 }
1683 }
1684 }
1685
1686 Reference< XNumberingRulesSupplier > xNumberingRulesSupp( GetExport().GetModel(), UNO_QUERY );
1687 if ( xNumberingRulesSupp.is() )
1688 {
1689 Reference< XIndexAccess > xNumberingRules = xNumberingRulesSupp->getNumberingRules();
1690 nCount = xNumberingRules->getCount();
1691 // Custom outline assignment lost after re-importing sxw (#i73361#)
1692 for( sal_Int32 i = 0; i < nCount; ++i )
1693 {
1694 Reference< XIndexReplace > xNumRule( xNumberingRules->getByIndex( i ), UNO_QUERY );
1695 if( xNumRule.is() && xNumRule->getCount() )
1696 {
1697 Reference < XNamed > xNamed( xNumRule, UNO_QUERY );
1698 OUString sName;
1699 if( xNamed.is() )
1700 sName = xNamed->getName();
1701 bool bAdd = sName.isEmpty();
1702 if( !bAdd )
1703 {
1704 Reference < XPropertySet > xNumPropSet( xNumRule,
1705 UNO_QUERY );
1706 if( xNumPropSet.is() &&
1707 xNumPropSet->getPropertySetInfo()
1708 ->hasPropertyByName( "IsAutomatic" ) )
1709 {
1710 bAdd = *o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "IsAutomatic" ));
1711 // Check on outline style (#i73361#)
1712 if ( bAdd &&
1713 xNumPropSet->getPropertySetInfo()
1714 ->hasPropertyByName( "NumberingIsOutline" ) )
1715 {
1716 bAdd = !(*o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "NumberingIsOutline" )));
1717 }
1718 }
1719 else
1720 {
1721 bAdd = true;
1722 }
1723 }
1724 if( bAdd )
1725 maListAutoPool.Add( xNumRule );
1726 }
1727 }
1728 }
1729 mbCollected = true;
1730}
1731
1733 const Reference < XText > & rText,
1734 bool bAutoStyles,
1735 bool bIsProgress,
1736 bool bExportParagraph,
1737 TextPNS eExtensionNS)
1738{
1739 if( bAutoStyles )
1740 GetExport().GetShapeExport(); // make sure the graphics styles family
1741 // is added
1742 Reference < XEnumerationAccess > xEA( rText, UNO_QUERY );
1743 if( ! xEA.is() )
1744 return;
1745
1746 Reference < XEnumeration > xParaEnum(xEA->createEnumeration());
1747 Reference < XPropertySet > xPropertySet( rText, UNO_QUERY );
1748 Reference < XTextSection > xBaseSection;
1749
1750 // #97718# footnotes don't supply paragraph enumerations in some cases
1751 // This is always a bug, but at least we don't want to crash.
1752 SAL_WARN_IF( !xParaEnum.is(), "xmloff", "We need a paragraph enumeration" );
1753 if( ! xParaEnum.is() )
1754 return;
1755
1756 if (xPropertySet.is())
1757 {
1758 Reference < XPropertySetInfo > xInfo ( xPropertySet->getPropertySetInfo() );
1759
1760 if( xInfo.is() )
1761 {
1762 if (xInfo->hasPropertyByName( gsTextSection ))
1763 {
1764 xPropertySet->getPropertyValue(gsTextSection) >>= xBaseSection ;
1765 }
1766 }
1767 }
1768
1769 // #96530# Export redlines at start & end of XText before & after
1770 // exporting the text content enumeration
1771 if( !bAutoStyles && (pRedlineExport != nullptr) )
1772 pRedlineExport->ExportStartOrEndRedline( xPropertySet, true );
1773 exportTextContentEnumeration( xParaEnum, bAutoStyles, xBaseSection,
1774 bIsProgress, bExportParagraph, nullptr, eExtensionNS );
1775 if( !bAutoStyles && (pRedlineExport != nullptr) )
1776 pRedlineExport->ExportStartOrEndRedline( xPropertySet, false );
1777}
1778
1780 const Reference < XText > & rText,
1781 const Reference < XTextSection > & rBaseSection,
1782 bool bAutoStyles,
1783 bool bIsProgress,
1784 bool bExportParagraph)
1785{
1786 if( bAutoStyles )
1787 GetExport().GetShapeExport(); // make sure the graphics styles family
1788 // is added
1789 Reference < XEnumerationAccess > xEA( rText, UNO_QUERY );
1790 Reference < XEnumeration > xParaEnum(xEA->createEnumeration());
1791
1792 // #98165# don't continue without a paragraph enumeration
1793 if( ! xParaEnum.is() )
1794 return;
1795
1796 // #96530# Export redlines at start & end of XText before & after
1797 // exporting the text content enumeration
1798 Reference<XPropertySet> xPropertySet;
1799 if( !bAutoStyles && (pRedlineExport != nullptr) )
1800 {
1801 xPropertySet.set(rText, uno::UNO_QUERY );
1802 pRedlineExport->ExportStartOrEndRedline( xPropertySet, true );
1803 }
1804 exportTextContentEnumeration( xParaEnum, bAutoStyles, rBaseSection,
1805 bIsProgress, bExportParagraph );
1806 if( !bAutoStyles && (pRedlineExport != nullptr) )
1807 pRedlineExport->ExportStartOrEndRedline( xPropertySet, false );
1808}
1809
1811 const Reference < XEnumeration > & rContEnum,
1812 bool bAutoStyles,
1813 const Reference < XTextSection > & rBaseSection,
1814 bool bIsProgress,
1815 bool bExportParagraph,
1816 const Reference < XPropertySet > *pRangePropSet,
1817 TextPNS eExtensionNS )
1818{
1819 SAL_WARN_IF( !rContEnum.is(), "xmloff", "No enumeration to export!" );
1820 bool bHasMoreElements = rContEnum->hasMoreElements();
1821 if( !bHasMoreElements )
1822 return;
1823
1824 XMLTextNumRuleInfo aPrevNumInfo;
1825 XMLTextNumRuleInfo aNextNumInfo;
1826
1827 bool bHasContent = false;
1828 Reference<XTextSection> xCurrentTextSection(rBaseSection);
1829
1830 MultiPropertySetHelper aPropSetHelper(
1831 bAutoStyles ? aParagraphPropertyNamesAuto :
1833
1834 bool bHoldElement = false;
1835 Reference < XTextContent > xTxtCntnt;
1836 while( bHoldElement || bHasMoreElements )
1837 {
1838 if (bHoldElement)
1839 {
1840 bHoldElement = false;
1841 }
1842 else
1843 {
1844 xTxtCntnt.set(rContEnum->nextElement(), uno::UNO_QUERY);
1845
1846 aPropSetHelper.resetValues();
1847
1848 }
1849
1850 Reference<XServiceInfo> xServiceInfo( xTxtCntnt, UNO_QUERY );
1851 if( xServiceInfo->supportsService( gsParagraphService ) )
1852 {
1853 if( bAutoStyles )
1854 {
1855 exportListAndSectionChange( xCurrentTextSection, xTxtCntnt,
1856 aPrevNumInfo, aNextNumInfo,
1857 bAutoStyles );
1858 }
1859 else
1860 {
1861 /* Pass list auto style pool to <XMLTextNumRuleInfo> instance
1862 Pass info about request to export <text:number> element
1863 to <XMLTextNumRuleInfo> instance (#i69627#)
1864 */
1865 aNextNumInfo.Set( xTxtCntnt,
1866 GetExport().writeOutlineStyleAsNormalListStyle(),
1868 GetExport().exportTextNumberElement() );
1869
1870 exportListAndSectionChange( xCurrentTextSection, aPropSetHelper,
1871 TEXT_SECTION, xTxtCntnt,
1872 aPrevNumInfo, aNextNumInfo,
1873 bAutoStyles );
1874 }
1875
1876 // if we found a mute section: skip all section content
1877 if (pSectionExport->IsMuteSection(xCurrentTextSection))
1878 {
1879 // Make sure headings are exported anyway.
1880 if( !bAutoStyles )
1881 pSectionExport->ExportMasterDocHeadingDummies();
1882
1883 while (rContEnum->hasMoreElements() &&
1884 XMLSectionExport::IsInSection( xCurrentTextSection,
1885 xTxtCntnt, true ))
1886 {
1887 xTxtCntnt.set(rContEnum->nextElement(), uno::UNO_QUERY);
1888 aPropSetHelper.resetValues();
1889 aNextNumInfo.Reset();
1890 }
1891 // the first non-mute element still needs to be processed
1892 bHoldElement =
1893 ! XMLSectionExport::IsInSection( xCurrentTextSection,
1894 xTxtCntnt, false );
1895 }
1896 else
1897 exportParagraph( xTxtCntnt, bAutoStyles, bIsProgress,
1898 bExportParagraph, aPropSetHelper, eExtensionNS );
1899 bHasContent = true;
1900 }
1901 else if( xServiceInfo->supportsService( gsTableService ) )
1902 {
1903 if( !bAutoStyles )
1904 {
1905 aNextNumInfo.Reset();
1906 }
1907
1908 exportListAndSectionChange( xCurrentTextSection, xTxtCntnt,
1909 aPrevNumInfo, aNextNumInfo,
1910 bAutoStyles );
1911
1912 if (! pSectionExport->IsMuteSection(xCurrentTextSection))
1913 {
1914 // export start + end redlines (for wholly redlined tables)
1915 if ((! bAutoStyles) && (nullptr != pRedlineExport))
1916 pRedlineExport->ExportStartOrEndRedline(xTxtCntnt, true);
1917
1918 exportTable( xTxtCntnt, bAutoStyles, bIsProgress );
1919
1920 if ((! bAutoStyles) && (nullptr != pRedlineExport))
1921 pRedlineExport->ExportStartOrEndRedline(xTxtCntnt, false);
1922 }
1923 else if( !bAutoStyles )
1924 {
1925 // Make sure headings are exported anyway.
1926 pSectionExport->ExportMasterDocHeadingDummies();
1927 }
1928
1929 bHasContent = true;
1930 }
1931 else if( xServiceInfo->supportsService( gsTextFrameService ) )
1932 {
1933 exportTextFrame( xTxtCntnt, bAutoStyles, bIsProgress, true, pRangePropSet );
1934 }
1935 else if( xServiceInfo->supportsService( gsTextGraphicService ) )
1936 {
1937 exportTextGraphic( xTxtCntnt, bAutoStyles, pRangePropSet );
1938 }
1939 else if( xServiceInfo->supportsService( gsTextEmbeddedService ) )
1940 {
1941 exportTextEmbedded( xTxtCntnt, bAutoStyles, pRangePropSet );
1942 }
1943 else if( xServiceInfo->supportsService( gsShapeService ) )
1944 {
1945 exportShape( xTxtCntnt, bAutoStyles, pRangePropSet );
1946 }
1947 else
1948 {
1949 SAL_WARN_IF( xTxtCntnt.is(), "xmloff", "unknown text content" );
1950 }
1951
1952 if( !bAutoStyles )
1953 {
1954 aPrevNumInfo = aNextNumInfo;
1955 }
1956
1957 bHasMoreElements = rContEnum->hasMoreElements();
1958 }
1959
1960 if( bHasContent && !bAutoStyles )
1961 {
1962 aNextNumInfo.Reset();
1963
1964 // close open lists and sections; no new styles
1965 exportListAndSectionChange( xCurrentTextSection, rBaseSection,
1966 aPrevNumInfo, aNextNumInfo,
1967 bAutoStyles );
1968 }
1969}
1970
1972 const Reference < XTextContent > & rTextContent,
1973 bool bAutoStyles, bool bIsProgress, bool bExportParagraph,
1974 MultiPropertySetHelper& rPropSetHelper, TextPNS eExtensionNS)
1975{
1976 sal_Int16 nOutlineLevel = -1;
1977
1978 if( bIsProgress )
1979 {
1981 pProgress->SetValue( pProgress->GetValue()+1 );
1982 }
1983
1984 // get property set or multi property set and initialize helper
1985 Reference<XMultiPropertySet> xMultiPropSet( rTextContent, UNO_QUERY );
1986 Reference<XPropertySet> xPropSet( rTextContent, UNO_QUERY );
1987
1988 // check for supported properties
1989 if( !rPropSetHelper.checkedProperties() )
1990 rPropSetHelper.hasProperties( xPropSet->getPropertySetInfo() );
1991
1992// if( xMultiPropSet.is() )
1993// rPropSetHelper.getValues( xMultiPropSet );
1994// else
1995// rPropSetHelper.getValues( xPropSet );
1996
1997 if( bExportParagraph )
1998 {
1999 if( bAutoStyles )
2000 {
2001 Add( XmlStyleFamily::TEXT_PARAGRAPH, rPropSetHelper, xPropSet );
2002 }
2003 else
2004 {
2005 // xml:id for RDF metadata
2006 GetExport().AddAttributeXmlId(rTextContent);
2007 GetExport().AddAttributesRDFa(rTextContent);
2008
2009 OUString sStyle;
2010 if( rPropSetHelper.hasProperty( PARA_STYLE_NAME ) )
2011 {
2012 if( xMultiPropSet.is() )
2013 rPropSetHelper.getValue( PARA_STYLE_NAME,
2014 xMultiPropSet ) >>= sStyle;
2015 else
2016 rPropSetHelper.getValue( PARA_STYLE_NAME,
2017 xPropSet ) >>= sStyle;
2018 }
2019
2020 if( rTextContent.is() )
2021 {
2022 const OUString& rIdentifier = GetExport().getInterfaceToIdentifierMapper().getIdentifier( rTextContent );
2023 if( !rIdentifier.isEmpty() )
2024 {
2025 // FIXME: this is just temporary until EditEngine
2026 // paragraphs implement XMetadatable.
2027 // then that must be used and not the mapper, because
2028 // when both can be used we get two xml:id!
2029 uno::Reference<rdf::XMetadatable> const xMeta(rTextContent,
2030 uno::UNO_QUERY);
2031 OSL_ENSURE(!xMeta.is(), "paragraph that implements "
2032 "XMetadatable used in interfaceToIdentifierMapper?");
2034 rIdentifier);
2035 }
2036 }
2037
2038 OUString sAutoStyle = Find( XmlStyleFamily::TEXT_PARAGRAPH, xPropSet, sStyle );
2039 if ( sAutoStyle.isEmpty() )
2040 sAutoStyle = sStyle;
2041 if( !sAutoStyle.isEmpty() )
2043 GetExport().EncodeStyleName( sAutoStyle ) );
2044
2045 if( rPropSetHelper.hasProperty( PARA_CONDITIONAL_STYLE_NAME ) )
2046 {
2047 OUString sCondStyle;
2048 if( xMultiPropSet.is() )
2049 rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME,
2050 xMultiPropSet ) >>= sCondStyle;
2051 else
2052 rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME,
2053 xPropSet ) >>= sCondStyle;
2054 if( sCondStyle != sStyle )
2055 {
2056 sCondStyle = Find( XmlStyleFamily::TEXT_PARAGRAPH, xPropSet,
2057 sCondStyle );
2058 if( !sCondStyle.isEmpty() )
2061 GetExport().EncodeStyleName( sCondStyle ) );
2062 }
2063 }
2064
2065 if( rPropSetHelper.hasProperty( PARA_OUTLINE_LEVEL ) )
2066 {
2067 if( xMultiPropSet.is() )
2068 rPropSetHelper.getValue( PARA_OUTLINE_LEVEL,
2069 xMultiPropSet ) >>= nOutlineLevel;
2070 else
2071 rPropSetHelper.getValue( PARA_OUTLINE_LEVEL,
2072 xPropSet ) >>= nOutlineLevel;
2073
2074 if( 0 < nOutlineLevel )
2075 {
2078 OUString::number( sal_Int32( nOutlineLevel) ) );
2079
2080 if ( rPropSetHelper.hasProperty( PARA_OUTLINE_CONTENT_VISIBLE ) )
2081 {
2082 uno::Sequence<beans::PropertyValue> propList;
2083 bool bIsOutlineContentVisible = true;
2084 if( xMultiPropSet.is() )
2085 rPropSetHelper.getValue(
2086 PARA_OUTLINE_CONTENT_VISIBLE, xMultiPropSet ) >>= propList;
2087 else
2088 rPropSetHelper.getValue(
2089 PARA_OUTLINE_CONTENT_VISIBLE, xPropSet ) >>= propList;
2090 for (const auto& rProp : std::as_const(propList))
2091 {
2092 OUString propName = rProp.Name;
2093 if (propName == "OutlineContentVisibleAttr")
2094 {
2095 rProp.Value >>= bIsOutlineContentVisible;
2096 break;
2097 }
2098 }
2099 if (!bIsOutlineContentVisible)
2100 {
2103 XML_FALSE);
2104 }
2105 }
2106
2107 if( rPropSetHelper.hasProperty( NUMBERING_IS_NUMBER ) )
2108 {
2109 bool bIsNumber = false;
2110 if( xMultiPropSet.is() )
2111 rPropSetHelper.getValue(
2112 NUMBERING_IS_NUMBER, xMultiPropSet ) >>= bIsNumber;
2113 else
2114 rPropSetHelper.getValue(
2115 NUMBERING_IS_NUMBER, xPropSet ) >>= bIsNumber;
2116
2117 OUString sListStyleName;
2118 if( xMultiPropSet.is() )
2119 rPropSetHelper.getValue(
2120 PARA_NUMBERING_STYLENAME, xMultiPropSet ) >>= sListStyleName;
2121 else
2122 rPropSetHelper.getValue(
2123 PARA_NUMBERING_STYLENAME, xPropSet ) >>= sListStyleName;
2124
2125 bool bAssignedtoOutlineStyle = false;
2126 {
2127 Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(), UNO_QUERY );
2128
2129 if (xCNSupplier.is())
2130 {
2131 Reference< XIndexReplace > xNumRule ( xCNSupplier->getChapterNumberingRules() );
2132 SAL_WARN_IF( !xNumRule.is(), "xmloff", "no chapter numbering rules" );
2133
2134 if (xNumRule.is())
2135 {
2136 Reference< XPropertySet > xNumRulePropSet( xNumRule, UNO_QUERY );
2137 OUString sOutlineName;
2138 xNumRulePropSet->getPropertyValue(
2139 "Name" ) >>= sOutlineName;
2140 bAssignedtoOutlineStyle = ( sListStyleName == sOutlineName );
2141 }
2142 }
2143 }
2144
2145 if( ! bIsNumber && bAssignedtoOutlineStyle )
2148 XML_TRUE );
2149 }
2150
2151 {
2152 bool bIsRestartNumbering = false;
2153
2154 Reference< XPropertySetInfo >
2155 xPropSetInfo(xMultiPropSet.is() ?
2156 xMultiPropSet->getPropertySetInfo():
2157 xPropSet->getPropertySetInfo());
2158
2159 if (xPropSetInfo->
2160 hasPropertyByName("ParaIsNumberingRestart"))
2161 {
2162 xPropSet->getPropertyValue("ParaIsNumberingRestart")
2163 >>= bIsRestartNumbering;
2164 }
2165
2166 if (bIsRestartNumbering)
2167 {
2170 XML_TRUE);
2171
2172 if (xPropSetInfo->
2173 hasPropertyByName("NumberingStartValue"))
2174 {
2175 sal_Int32 nStartValue = 0;
2176
2177 xPropSet->getPropertyValue("NumberingStartValue")
2178 >>= nStartValue;
2179
2180 GetExport().
2181 AddAttribute(XML_NAMESPACE_TEXT,
2183 OUString::number(nStartValue));
2184 }
2185 }
2186 }
2187 }
2188 }
2189 }
2190 }
2191
2192 Reference < XEnumerationAccess > xEA( rTextContent, UNO_QUERY );
2193 Reference < XEnumeration > xTextEnum = xEA->createEnumeration();
2194 const bool bHasPortions = xTextEnum.is();
2195
2196 Reference < XEnumeration> xContentEnum;
2197 Reference < XContentEnumerationAccess > xCEA( rTextContent, UNO_QUERY );
2198 if( xCEA.is() )
2199 xContentEnum.set(xCEA->createContentEnumeration( gsTextContentService ));
2200 const bool bHasContentEnum = xContentEnum.is() &&
2201 xContentEnum->hasMoreElements();
2202
2203 Reference < XTextSection > xSection;
2204 if( bHasContentEnum )
2205 {
2206 // For the auto styles, the multi property set helper is only used
2207 // if hard attributes are existing. Therefore, it seems to be a better
2208 // strategy to have the TextSection property separate, because otherwise
2209 // we always retrieve the style names even if they are not required.
2210 if( bAutoStyles )
2211 {
2212 if( xPropSet->getPropertySetInfo()->hasPropertyByName( gsTextSection ) )
2213 {
2214 xSection.set(xPropSet->getPropertyValue( gsTextSection ), uno::UNO_QUERY);
2215 }
2216 }
2217 else
2218 {
2219 if( rPropSetHelper.hasProperty( TEXT_SECTION ) )
2220 {
2221 xSection.set(rPropSetHelper.getValue( TEXT_SECTION ), uno::UNO_QUERY);
2222 }
2223 }
2224 }
2225
2226 bool bPrevCharIsSpace(true); // true because whitespace at start is ignored
2227
2228 if( bAutoStyles )
2229 {
2230 if( bHasContentEnum )
2232 xContentEnum, bAutoStyles, xSection,
2233 bIsProgress );
2234 if ( bHasPortions )
2235 {
2236 exportTextRangeEnumeration(xTextEnum, bAutoStyles, bIsProgress, bPrevCharIsSpace);
2237 }
2238 }
2239 else
2240 {
2241 enum XMLTokenEnum eElem =
2242 0 < nOutlineLevel ? XML_H : XML_P;
2244 true, false );
2245 if( bHasContentEnum )
2246 {
2248 xContentEnum, bAutoStyles, xSection,
2249 bIsProgress );
2250 }
2251 exportTextRangeEnumeration(xTextEnum, bAutoStyles, bIsProgress, bPrevCharIsSpace);
2252 }
2253}
2254
2256 const Reference < XEnumeration > & rTextEnum,
2257 bool bAutoStyles, bool bIsProgress,
2258 bool & rPrevCharIsSpace)
2259{
2260 static const char sFieldMarkName[] = "__FieldMark_";
2261
2262 /* This is used for exporting to strict OpenDocument 1.2, in which case traditional
2263 * bookmarks are used instead of fieldmarks. */
2264 FieldmarkType openFieldMark = NONE;
2265
2266 std::optional<SvXMLElementExport> oTextA;
2267 HyperlinkData aHyperlinkData;
2268
2269 while( rTextEnum->hasMoreElements() )
2270 {
2271 Reference<XPropertySet> xPropSet(rTextEnum->nextElement(), UNO_QUERY);
2272 Reference < XTextRange > xTxtRange(xPropSet, uno::UNO_QUERY);
2273 Reference<XPropertySetInfo> xPropInfo(xPropSet->getPropertySetInfo());
2274
2275 if (!bAutoStyles)
2276 {
2277 if (HyperlinkData aNewHyperlinkData(xPropSet); aNewHyperlinkData != aHyperlinkData)
2278 {
2279 aHyperlinkData = aNewHyperlinkData;
2280 oTextA.reset();
2281 if (aHyperlinkData.addHyperlinkAttributes(GetExport()))
2282 {
2283 oTextA.emplace(GetExport(), true, XML_NAMESPACE_TEXT, XML_A, false, false);
2284 aHyperlinkData.exportEvents(GetExport());
2285 }
2286 }
2287 }
2288
2289 if (xPropInfo->hasPropertyByName(gsTextPortionType))
2290 {
2291 OUString sType;
2292 xPropSet->getPropertyValue(gsTextPortionType) >>= sType;
2293
2294 if( sType == gsText)
2295 {
2296 exportTextRange( xTxtRange, bAutoStyles,
2297 rPrevCharIsSpace, openFieldMark);
2298 }
2299 else if( sType == gsTextField)
2300 {
2301 exportTextField(xTxtRange, bAutoStyles, bIsProgress, &rPrevCharIsSpace);
2302 }
2303 else if ( sType == "Annotation" )
2304 {
2305 exportTextField(xTxtRange, bAutoStyles, bIsProgress, &rPrevCharIsSpace);
2306 }
2307 else if ( sType == "AnnotationEnd" )
2308 {
2309 if (!bAutoStyles)
2310 {
2311 Reference<XNamed> xBookmark(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2312 const OUString& rName = xBookmark->getName();
2313 if (!rName.isEmpty())
2314 {
2316 }
2318 }
2319 }
2320 else if( sType == gsFrame )
2321 {
2322 Reference < XEnumeration> xContentEnum;
2323 Reference < XContentEnumerationAccess > xCEA( xTxtRange,
2324 UNO_QUERY );
2325 if( xCEA.is() )
2326 xContentEnum.set(xCEA->createContentEnumeration(
2328 // frames are never in sections
2329 Reference<XTextSection> xSection;
2330 if( xContentEnum.is() )
2331 exportTextContentEnumeration( xContentEnum,
2332 bAutoStyles,
2333 xSection, bIsProgress, true,
2334 &xPropSet );
2335
2336 }
2337 else if (sType == gsFootnote)
2338 {
2339 exportTextFootnote(xPropSet,
2340 xTxtRange->getString(),
2341 bAutoStyles, bIsProgress );
2342 }
2343 else if (sType == gsBookmark)
2344 {
2345 exportTextMark(xPropSet,
2346 gsBookmark,
2348 bAutoStyles);
2349 }
2350 else if (sType == gsReferenceMark)
2351 {
2352 exportTextMark(xPropSet,
2355 bAutoStyles);
2356 }
2357 else if (sType == gsDocumentIndexMark)
2358 {
2359 pIndexMarkExport->ExportIndexMark(xPropSet, bAutoStyles);
2360 }
2361 else if (sType == gsRedline)
2362 {
2363 if (nullptr != pRedlineExport)
2364 pRedlineExport->ExportChange(xPropSet, bAutoStyles);
2365 }
2366 else if (sType == gsRuby)
2367 {
2368 exportRuby(xPropSet, bAutoStyles);
2369 }
2370 else if (sType == "InContentMetadata")
2371 {
2372 exportMeta(xPropSet, bAutoStyles, bIsProgress, rPrevCharIsSpace);
2373 }
2374 else if (sType == "ContentControl")
2375 {
2376 ExportContentControl(xPropSet, bAutoStyles, bIsProgress, rPrevCharIsSpace);
2377 }
2378 else if (sType == gsTextFieldStart)
2379 {
2380 Reference< css::text::XFormField > xFormField(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2381
2382 /* As of now, textmarks are a proposed extension to the OpenDocument standard. */
2383 if (!bAutoStyles)
2384 {
2385 if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
2386 {
2387 Reference<XNamed> xBookmark(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2388 if (xBookmark.is())
2389 {
2390 GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
2391 }
2392
2393 if (xFormField.is())
2394 {
2395 GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
2396 }
2397
2399 if (xFormField.is())
2400 {
2401 FieldParamExporter(&GetExport(), xFormField->getParameters()).Export();
2402 }
2404 }
2405 /* The OpenDocument standard does not include support for TextMarks for now, so use bookmarks instead. */
2406 else
2407 {
2408 if (xFormField.is())
2409 {
2410 OUString sName;
2411 Reference< css::container::XNameAccess > xParameters = xFormField->getParameters();
2412 if (xParameters.is() && xParameters->hasByName("Name"))
2413 {
2414 const Any aValue = xParameters->getByName("Name");
2415 aValue >>= sName;
2416 }
2417 if (sName.isEmpty())
2418 { // name attribute is mandatory, so have to pull a
2419 // rabbit out of the hat here
2420 sName = sFieldMarkName + OUString::number(
2421 m_xImpl->AddFieldMarkStart(xFormField));
2422 }
2424 sName);
2425 SvXMLElementExport aElem( GetExport(), !bAutoStyles,
2427 false, false );
2428 const OUString sFieldType = xFormField->getFieldType();
2429 if (sFieldType == ODF_FORMTEXT)
2430 {
2431 openFieldMark = TEXT;
2432 }
2433 else if (sFieldType == ODF_FORMCHECKBOX)
2434 {
2435 openFieldMark = CHECK;
2436 }
2437 else
2438 {
2439 openFieldMark = NONE;
2440 }
2441 }
2442 }
2443 }
2444 }
2445 else if (sType == gsTextFieldSep)
2446 {
2447 Reference<text::XFormField> const xFormField(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2448 if (!bAutoStyles)
2449 {
2450 if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
2451 {
2452 SvXMLElementExport aElem( GetExport(), !bAutoStyles,
2454 false, false );
2455 }
2456 }
2457 }
2458 else if (sType == gsTextFieldEnd)
2459 {
2460 if (!bAutoStyles)
2461 {
2462 Reference< css::text::XFormField > xFormField(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2463
2464 if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
2465 {
2466 SvXMLElementExport aElem( GetExport(), !bAutoStyles,
2468 false, false );
2469 }
2470 else
2471 {
2472 if (xFormField.is())
2473 {
2474 OUString sName;
2475 Reference< css::container::XNameAccess > xParameters = xFormField->getParameters();
2476 if (xParameters.is() && xParameters->hasByName("Name"))
2477 {
2478 const Any aValue = xParameters->getByName("Name");
2479 aValue >>= sName;
2480 }
2481 if (sName.isEmpty())
2482 { // name attribute is mandatory, so have to pull a
2483 // rabbit out of the hat here
2484 sName = sFieldMarkName + OUString::number(
2485 m_xImpl->GetFieldMarkIndex(xFormField));
2486 }
2488 sName);
2489 SvXMLElementExport aElem( GetExport(), !bAutoStyles,
2491 false, false );
2492 }
2493 }
2494 }
2495 }
2496 else if (sType == gsTextFieldStartEnd)
2497 {
2498 if (!bAutoStyles)
2499 {
2500 if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
2501 {
2502 Reference<XNamed> xBookmark(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2503 if (xBookmark.is())
2504 {
2505 GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
2506 }
2507 Reference< css::text::XFormField > xFormField(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2508 if (xFormField.is())
2509 {
2510 GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
2511 }
2513 if (xFormField.is())
2514 {
2515 FieldParamExporter(&GetExport(), xFormField->getParameters()).Export();
2516 }
2518 }
2519 else
2520 {
2521 Reference<XNamed> xBookmark(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2522 if (xBookmark.is())
2523 {
2524 GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
2525 SvXMLElementExport aElem( GetExport(), !bAutoStyles,
2527 false, false );
2528 }
2529 }
2530 }
2531 }
2532 else if (sType == gsSoftPageBreak)
2533 {
2534 if (!bAutoStyles)
2536 }
2537 else if (sType == "LineBreak")
2538 {
2539 if (!bAutoStyles)
2540 exportTextLineBreak(xPropSet);
2541 }
2542 else {
2543 OSL_FAIL("unknown text portion type");
2544 }
2545 }
2546 else
2547 {
2548 Reference<XServiceInfo> xServiceInfo( xTxtRange, UNO_QUERY );
2549 if( xServiceInfo->supportsService( gsTextFieldService ) )
2550 {
2551 exportTextField(xTxtRange, bAutoStyles, bIsProgress, &rPrevCharIsSpace);
2552 }
2553 else
2554 {
2555 // no TextPortionType property -> non-Writer app -> text
2556 exportTextRange(xTxtRange, bAutoStyles, rPrevCharIsSpace, openFieldMark);
2557 }
2558 }
2559 }
2560
2561// now that there are nested enumerations for meta(-field), this may be valid!
2562// SAL_WARN_IF( bOpenRuby, "xmloff", "Red Alert: Ruby still open!" );
2563}
2564
2566 const Reference < XTextContent > &,
2567 bool /*bAutoStyles*/, bool /*bIsProgress*/ )
2568{
2569}
2570
2572 const Reference < XTextRange > & rTextRange,
2573 bool bAutoStyles, bool bIsProgress, bool *const pPrevCharIsSpace)
2574{
2575 Reference < XPropertySet > xPropSet( rTextRange, UNO_QUERY );
2576 // non-Writer apps need not support Property TextField, so test first
2577 if (!xPropSet->getPropertySetInfo()->hasPropertyByName( gsTextField ))
2578 return;
2579
2580 Reference < XTextField > xTxtFld(xPropSet->getPropertyValue( gsTextField ), uno::UNO_QUERY);
2581 SAL_WARN_IF( !xTxtFld.is(), "xmloff", "text field missing" );
2582 if( xTxtFld.is() )
2583 {
2584 exportTextField(xTxtFld, bAutoStyles, bIsProgress, true, pPrevCharIsSpace);
2585 }
2586 else
2587 {
2588 // write only characters
2589 GetExport().Characters(rTextRange->getString());
2590 }
2591}
2592
2594 const Reference < XTextField > & xTextField,
2595 const bool bAutoStyles, const bool bIsProgress,
2596 const bool bRecursive, bool *const pPrevCharIsSpace)
2597{
2598 if ( bAutoStyles )
2599 {
2600 pFieldExport->ExportFieldAutoStyle( xTextField, bIsProgress,
2601 bRecursive );
2602 }
2603 else
2604 {
2605 assert(pPrevCharIsSpace);
2606 pFieldExport->ExportField(xTextField, bIsProgress, *pPrevCharIsSpace);
2607 }
2608}
2609
2611{
2613 XML_SOFT_PAGE_BREAK, false,
2614 false );
2615}
2616
2618 const uno::Reference<beans::XPropertySet>& xPropSet)
2619{
2620 static const XMLTokenEnum aLineBreakClears[] = {
2621 XML_NONE,
2622 XML_LEFT,
2623 XML_RIGHT,
2624 XML_ALL,
2625 };
2626
2627 uno::Reference<text::XTextContent> xLineBreak;
2628 xPropSet->getPropertyValue("LineBreak") >>= xLineBreak;
2629 if (!xLineBreak.is())
2630 {
2631 return;
2632 }
2633
2634 uno::Reference<beans::XPropertySet> xLineBreakProps(xLineBreak, uno::UNO_QUERY);
2635 if (!xLineBreakProps.is())
2636 {
2637 return;
2638 }
2639
2640 sal_Int16 eClear{};
2641 xLineBreakProps->getPropertyValue("Clear") >>= eClear;
2642 if (eClear >= 0 && o3tl::make_unsigned(eClear) < SAL_N_ELEMENTS(aLineBreakClears))
2643 {
2645 GetXMLToken(aLineBreakClears[eClear]));
2646 }
2648 /*bIgnWSOutside=*/false, /*bIgnWSInside=*/false);
2649}
2650
2652 const Reference<XPropertySet> & rPropSet,
2653 const OUString& rProperty,
2655 bool bAutoStyles)
2656{
2657 // mib said: "Hau wech!"
2658
2659 // (Originally, I'd export a span element in case the (book|reference)mark
2660 // was formatted. This actually makes a difference in case some pervert
2661 // sets a point reference mark in the document and, say, formats it bold.
2662 // This basically meaningless formatting will now been thrown away
2663 // (aka cleaned up), since mib said: ... dvo
2664
2665 if (bAutoStyles)
2666 return;
2667
2668 // name element
2669 Reference<XNamed> xName(rPropSet->getPropertyValue(rProperty), UNO_QUERY);
2671 xName->getName());
2672
2673 // start, end, or point-reference?
2674 sal_Int8 nElement;
2675 if( *o3tl::doAccess<bool>(rPropSet->getPropertyValue(gsIsCollapsed)) )
2676 {
2677 nElement = 0;
2678 }
2679 else
2680 {
2681 nElement = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(gsIsStart)) ? 1 : 2;
2682 }
2683
2684 // bookmark, bookmark-start: xml:id and RDFa for RDF metadata
2685 if( nElement < 2 ) {
2687 const uno::Reference<text::XTextContent> xTextContent(
2688 xName, uno::UNO_QUERY_THROW);
2689 GetExport().AddAttributesRDFa(xTextContent);
2690 }
2691
2692 // bookmark-start: add attributes hidden and condition
2693 if (nElement == 1)
2694 {
2695 Reference<XPropertySet> bkmkProps(rPropSet->getPropertyValue(rProperty), UNO_QUERY);
2696 Reference<XPropertySetInfo> bkmkPropInfo = bkmkProps->getPropertySetInfo();
2697 OUString sHidden("BookmarkHidden");
2698 if (bkmkPropInfo->hasPropertyByName(sHidden))
2699 {
2700 bool bHidden = false;
2701 bkmkProps->getPropertyValue(sHidden) >>= bHidden;
2702 if (bHidden)
2703 {
2704 GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, "hidden", "true");
2705 OUString sCondition("BookmarkCondition");
2706 if (bkmkPropInfo->hasPropertyByName(sCondition))
2707 {
2708 OUString sBookmarkCondition;
2709 bkmkProps->getPropertyValue(sCondition) >>= sBookmarkCondition;
2710 GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, "condition", sBookmarkCondition);
2711 }
2712 }
2713 }
2714 }
2715
2716 // export element
2717 assert(pElements != nullptr);
2718 assert(0 <= nElement && nElement <= 2);
2720 XML_NAMESPACE_TEXT, pElements[nElement],
2721 false, false);
2722 // else: no styles. (see above)
2723}
2724
2726 const Reference < XPropertySet > & rPropSet,
2727 const Reference < XPropertySetInfo > & rPropSetInfo )
2728{
2729 bool bIsBoundAsChar = false;
2730 OUString sAnchorType( "AnchorType" );
2731 if( rPropSetInfo->hasPropertyByName( sAnchorType ) )
2732 {
2733 TextContentAnchorType eAnchor;
2734 rPropSet->getPropertyValue( sAnchorType ) >>= eAnchor;
2735 bIsBoundAsChar = TextContentAnchorType_AS_CHARACTER == eAnchor;
2736 }
2737
2738 return bIsBoundAsChar;
2739}
2740
2742 const Reference < XPropertySet >& rPropSet,
2743 bool bShape,
2744 basegfx::B2DPoint* pCenter,
2745 OUString* pMinHeightValue,
2746 OUString* pMinWidthValue)
2747{
2748 XMLShapeExportFlags nShapeFeatures = SEF_DEFAULT;
2749
2750 // draw:name (#97662#: not for shapes, since those names will be
2751 // treated in the shape export)
2752 if( !bShape )
2753 {
2754 Reference < XNamed > xNamed( rPropSet, UNO_QUERY );
2755 if( xNamed.is() )
2756 {
2757 OUString sName( xNamed->getName() );
2758 if( !sName.isEmpty() )
2760 xNamed->getName() );
2761 }
2762 }
2763
2764 OUStringBuffer sValue;
2765
2766 // text:anchor-type
2767 TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH;
2768 rPropSet->getPropertyValue( gsAnchorType ) >>= eAnchor;
2769 {
2770 XMLAnchorTypePropHdl aAnchorTypeHdl;
2771 OUString sTmp;
2772 aAnchorTypeHdl.exportXML( sTmp, uno::Any(eAnchor),
2773 GetExport().GetMM100UnitConverter() );
2775 }
2776
2777 // text:anchor-page-number
2778 if( TextContentAnchorType_AT_PAGE == eAnchor )
2779 {
2780 sal_Int16 nPage = 0;
2781 rPropSet->getPropertyValue( gsAnchorPageNo ) >>= nPage;
2782 SAL_WARN_IF(nPage <= 0, "xmloff",
2783 "ERROR: writing invalid anchor-page-number 0");
2785 OUString::number( nPage ) );
2786 }
2787 else
2788 {
2789 nShapeFeatures |= XMLShapeExportFlags::NO_WS;
2790 }
2791
2792 // OD 2004-06-01 #i27691# - correction: no export of svg:x, if object
2793 // is anchored as-character.
2794 if ( !bShape &&
2795 eAnchor != TextContentAnchorType_AS_CHARACTER )
2796 {
2797 // svg:x
2798 sal_Int16 nHoriOrient = HoriOrientation::NONE;
2799 rPropSet->getPropertyValue( gsHoriOrient ) >>= nHoriOrient;
2800 if( HoriOrientation::NONE == nHoriOrient )
2801 {
2802 sal_Int32 nPos = 0;
2803 rPropSet->getPropertyValue( gsHoriOrientPosition ) >>= nPos;
2805 sValue, nPos );
2807 sValue.makeStringAndClear() );
2808 if(nullptr != pCenter)
2809 {
2810 // add left edge to Center
2811 pCenter->setX(pCenter->getX() + nPos);
2812 }
2813 }
2814 }
2815 else if( TextContentAnchorType_AS_CHARACTER == eAnchor )
2816 nShapeFeatures = (nShapeFeatures & ~XMLShapeExportFlags::X);
2817
2818 if( !bShape || TextContentAnchorType_AS_CHARACTER == eAnchor )
2819 {
2820 // svg:y
2821 sal_Int16 nVertOrient = VertOrientation::NONE;
2822 rPropSet->getPropertyValue( gsVertOrient ) >>= nVertOrient;
2823 if( VertOrientation::NONE == nVertOrient )
2824 {
2825 sal_Int32 nPos = 0;
2826 rPropSet->getPropertyValue( gsVertOrientPosition ) >>= nPos;
2828 sValue, nPos );
2830 sValue.makeStringAndClear() );
2831 if(nullptr != pCenter)
2832 {
2833 // add top edge to Center
2834 pCenter->setY(pCenter->getY() + nPos);
2835 }
2836 }
2837 if( bShape )
2838 nShapeFeatures = (nShapeFeatures & ~XMLShapeExportFlags::Y);
2839 }
2840
2841 Reference< XPropertySetInfo > xPropSetInfo(rPropSet->getPropertySetInfo());
2842
2843 bool bSyncWidth = false;
2844 if (xPropSetInfo->hasPropertyByName(gsIsSyncWidthToHeight))
2845 {
2846 bSyncWidth = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(gsIsSyncWidthToHeight));
2847 }
2848 sal_Int16 nRelWidth = 0;
2849 if (!bSyncWidth && xPropSetInfo->hasPropertyByName(gsRelativeWidth))
2850 {
2851 rPropSet->getPropertyValue(gsRelativeWidth) >>= nRelWidth;
2852 }
2853 bool bSyncHeight = false;
2854 if (xPropSetInfo->hasPropertyByName(gsIsSyncHeightToWidth))
2855 {
2856 bSyncHeight = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(gsIsSyncHeightToWidth));
2857 }
2858 sal_Int16 nRelHeight = 0;
2859 if (!bSyncHeight && xPropSetInfo->hasPropertyByName(gsRelativeHeight))
2860 {
2861 rPropSet->getPropertyValue(gsRelativeHeight) >>= nRelHeight;
2862 }
2863 awt::Size aLayoutSize;
2864 if ((nRelWidth > 0 || nRelHeight > 0) && xPropSetInfo->hasPropertyByName("LayoutSize"))
2865 {
2866 rPropSet->getPropertyValue("LayoutSize") >>= aLayoutSize;
2867 }
2868
2869 bool bUseLayoutSize = true;
2870 if (bSyncWidth && bSyncHeight)
2871 {
2872 // This is broken, width depends on height and height depends on width. Don't use the
2873 // invalid layout size we got.
2874 bUseLayoutSize = false;
2875 }
2876 if (aLayoutSize.Width <= 0 || aLayoutSize.Height <= 0)
2877 {
2878 // This is broken, Writer frames have a minimal size, see MINFLY.
2879 bUseLayoutSize = false;
2880 }
2881
2882 // svg:width
2883 sal_Int16 nWidthType = SizeType::FIX;
2884 if( xPropSetInfo->hasPropertyByName( gsWidthType ) )
2885 {
2886 rPropSet->getPropertyValue( gsWidthType ) >>= nWidthType;
2887 }
2888 if( xPropSetInfo->hasPropertyByName( gsWidth ) )
2889 {
2890 sal_Int32 nWidth = 0;
2891 // VAR size will be written as zero min-size
2892 if( SizeType::VARIABLE != nWidthType )
2893 {
2894 rPropSet->getPropertyValue( gsWidth ) >>= nWidth;
2895 }
2897 if( SizeType::FIX != nWidthType )
2898 {
2899 assert(pMinWidthValue);
2900 if (pMinWidthValue)
2901 {
2902 *pMinWidthValue = sValue.makeStringAndClear();
2903 }
2904 }
2905 else
2906 {
2907 if ((nRelWidth > 0 || bSyncWidth) && bUseLayoutSize)
2908 {
2909 // Relative width: write the layout size for the fallback width.
2910 sValue.setLength(0);
2911 GetExport().GetMM100UnitConverter().convertMeasureToXML(sValue, aLayoutSize.Width);
2912 }
2913
2915 sValue.makeStringAndClear() );
2916 if(nullptr != pCenter)
2917 {
2918 // add half width to Center
2919 pCenter->setX(pCenter->getX() + (0.5 * nWidth));
2920 }
2921 }
2922 }
2923 if( xPropSetInfo->hasPropertyByName( gsIsSyncWidthToHeight ) )
2924 {
2925 if( bSyncWidth )
2927 XML_SCALE );
2928 }
2929 if( !bSyncWidth && xPropSetInfo->hasPropertyByName( gsRelativeWidth ) )
2930 {
2931 SAL_WARN_IF( nRelWidth < 0 || nRelWidth > 254, "xmloff",
2932 "Got illegal relative width from API" );
2933 if( nRelWidth > 0 )
2934 {
2935 ::sax::Converter::convertPercent( sValue, nRelWidth );
2937 sValue.makeStringAndClear() );
2938 }
2939 }
2940
2941 // svg:height, fo:min-height or style:rel-height
2942 sal_Int16 nSizeType = SizeType::FIX;
2943 if( xPropSetInfo->hasPropertyByName( gsSizeType ) )
2944 {
2945 rPropSet->getPropertyValue( gsSizeType ) >>= nSizeType;
2946 }
2947 if( xPropSetInfo->hasPropertyByName( gsHeight ) )
2948 {
2949 sal_Int32 nHeight = 0;
2950 if( SizeType::VARIABLE != nSizeType )
2951 {
2952 rPropSet->getPropertyValue( gsHeight ) >>= nHeight;
2953 }
2955 nHeight );
2956 if( SizeType::FIX != nSizeType && 0==nRelHeight && !bSyncHeight &&
2957 pMinHeightValue )
2958 {
2959 *pMinHeightValue = sValue.makeStringAndClear();
2960 }
2961 else
2962 {
2963 if ((nRelHeight > 0 || bSyncHeight) && bUseLayoutSize)
2964 {
2965 // Relative height: write the layout size for the fallback height.
2966 sValue.setLength(0);
2967 GetExport().GetMM100UnitConverter().convertMeasureToXML(sValue, aLayoutSize.Height);
2968 }
2969
2971 sValue.makeStringAndClear() );
2972 if(nullptr != pCenter)
2973 {
2974 // add half height to Center
2975 pCenter->setY(pCenter->getY() + (0.5 * nHeight));
2976 }
2977 }
2978 }
2979 if( bSyncHeight )
2980 {
2982 SizeType::MIN == nSizeType ? XML_SCALE_MIN : XML_SCALE );
2983
2984 }
2985 else if( nRelHeight > 0 )
2986 {
2987 ::sax::Converter::convertPercent( sValue, nRelHeight );
2988 if( SizeType::MIN == nSizeType )
2989 {
2990 assert(pMinHeightValue);
2991 if (pMinHeightValue)
2992 {
2993 *pMinHeightValue = sValue.makeStringAndClear();
2994 }
2995 }
2996 else
2998 sValue.makeStringAndClear() );
2999 }
3000
3001 OUString sZOrder( "ZOrder" );
3002 if( xPropSetInfo->hasPropertyByName( sZOrder ) )
3003 {
3004 sal_Int32 nZIndex = 0;
3005 rPropSet->getPropertyValue( sZOrder ) >>= nZIndex;
3006 if( -1 != nZIndex )
3007 {
3009 OUString::number( nZIndex ) );
3010 }
3011 }
3012
3013 if (xPropSetInfo->hasPropertyByName("Decorative")
3014 && rPropSet->getPropertyValue("Decorative").get<bool>())
3015 {
3017 }
3018
3019 return nShapeFeatures;
3020}
3021
3023 const Reference < XTextContent > & rTxtCntnt,
3024 FrameType eType,
3025 bool bAutoStyles,
3026 bool bIsProgress,
3027 bool bExportContent,
3028 const Reference < XPropertySet > *pRangePropSet)
3029{
3030 Reference < XPropertySet > xPropSet( rTxtCntnt, UNO_QUERY );
3031
3032 if( bAutoStyles )
3033 {
3034 if( FrameType::Embedded == eType )
3036 // No text frame style for shapes (#i28745#)
3037 else if ( FrameType::Shape != eType )
3038 Add( XmlStyleFamily::TEXT_FRAME, xPropSet );
3039
3040 if( pRangePropSet && lcl_txtpara_isBoundAsChar( xPropSet,
3041 xPropSet->getPropertySetInfo() ) )
3042 Add( XmlStyleFamily::TEXT_TEXT, *pRangePropSet );
3043
3044 switch( eType )
3045 {
3046 case FrameType::Text:
3047 {
3048 // frame bound frames
3049 if ( bExportContent )
3050 {
3051 Reference < XTextFrame > xTxtFrame( rTxtCntnt, UNO_QUERY );
3052 Reference < XText > xTxt(xTxtFrame->getText());
3053 exportFrameFrames( true, bIsProgress, &xTxtFrame );
3054 exportText( xTxt, bAutoStyles, bIsProgress, true );
3055 }
3056 }
3057 break;
3058 case FrameType::Shape:
3059 {
3060 Reference < XShape > xShape( rTxtCntnt, UNO_QUERY );
3061 css::uno::Sequence<OUString> aAutoStylePropNames = GetAutoStylePool().GetPropertyNames();
3062 GetExport().GetShapeExport()->collectShapeAutoStyles( xShape, aAutoStylePropNames );
3063 }
3064 break;
3065 default:
3066 break;
3067 }
3068 }
3069 else
3070 {
3071 Reference< XPropertySetInfo > xPropSetInfo(xPropSet->getPropertySetInfo());
3072 {
3073 bool bAddCharStyles = pRangePropSet &&
3074 lcl_txtpara_isBoundAsChar( xPropSet, xPropSetInfo );
3075
3076 bool bIsUICharStyle;
3077 bool bHasAutoStyle = false;
3078
3079 OUString sStyle;
3080
3081 if( bAddCharStyles )
3082 sStyle = FindTextStyle( *pRangePropSet, bIsUICharStyle, bHasAutoStyle );
3083 else
3084 bIsUICharStyle = false;
3085
3086 bool bDoSomething = bIsUICharStyle
3087 && aCharStyleNamesPropInfoCache.hasProperty( *pRangePropSet );
3088 XMLTextCharStyleNamesElementExport aCharStylesExport(
3089 GetExport(), bDoSomething, bHasAutoStyle,
3090 bDoSomething ? *pRangePropSet : Reference<XPropertySet>(),
3092
3093 if( !sStyle.isEmpty() )
3095 GetExport().EncodeStyleName( sStyle ) );
3096 {
3097 SvXMLElementExport aElem( GetExport(), !sStyle.isEmpty(),
3098 XML_NAMESPACE_TEXT, XML_SPAN, false, false );
3099 {
3100 SvXMLElementExport aElement( GetExport(),
3102 HyperlinkData(xPropSet).addHyperlinkAttributes(GetExport()),
3103 XML_NAMESPACE_DRAW, XML_A, false, false );
3104 switch( eType )
3105 {
3106 case FrameType::Text:
3107 _exportTextFrame( xPropSet, xPropSetInfo, bIsProgress );
3108 break;
3109 case FrameType::Graphic:
3110 _exportTextGraphic( xPropSet, xPropSetInfo );
3111 break;
3113 _exportTextEmbedded( xPropSet, xPropSetInfo );
3114 break;
3115 case FrameType::Shape:
3116 {
3117 Reference < XShape > xShape( rTxtCntnt, UNO_QUERY );
3118 XMLShapeExportFlags nFeatures =
3119 addTextFrameAttributes( xPropSet, true );
3121 ->exportShape( xShape, nFeatures );
3122 }
3123 break;
3124 }
3125 }
3126 }
3127 }
3128 }
3129}
3130
3132 const Reference < XPropertySet > & rPropSet,
3133 const Reference < XPropertySetInfo > & rPropSetInfo,
3134 bool bIsProgress )
3135{
3136 Reference < XTextFrame > xTxtFrame( rPropSet, UNO_QUERY );
3137 Reference < XText > xTxt(xTxtFrame->getText());
3138
3139 OUString sStyle;
3140 if( rPropSetInfo->hasPropertyByName( gsFrameStyleName ) )
3141 {
3142 rPropSet->getPropertyValue( gsFrameStyleName ) >>= sStyle;
3143 }
3144
3145 OUString aMinHeightValue;
3146 OUString sMinWidthValue;
3147 OUString sAutoStyle = Find( XmlStyleFamily::TEXT_FRAME, rPropSet, sStyle );
3148 if ( sAutoStyle.isEmpty() )
3149 sAutoStyle = sStyle;
3150 if( !sAutoStyle.isEmpty() )
3152 GetExport().EncodeStyleName( sAutoStyle ) );
3153 addTextFrameAttributes(rPropSet, false, nullptr, &aMinHeightValue, &sMinWidthValue);
3154
3156 XML_FRAME, false, true );
3157
3158 if( !aMinHeightValue.isEmpty() )
3160 aMinHeightValue );
3161
3162 if (!sMinWidthValue.isEmpty())
3163 {
3165 sMinWidthValue );
3166 }
3167
3168 // draw:chain-next-name
3169 if( rPropSetInfo->hasPropertyByName( gsChainNextName ) )
3170 {
3171 OUString sNext;
3172 if( (rPropSet->getPropertyValue( gsChainNextName ) >>= sNext) && !sNext.isEmpty() )
3175 sNext );
3176 }
3177
3178 {
3180 XML_TEXT_BOX, true, true );
3181
3182 // frames bound to frame
3183 exportFrameFrames( false, bIsProgress, &xTxtFrame );
3184
3185 exportText( xTxt, false, bIsProgress, true );
3186 }
3187
3188 // script:events
3189 Reference<XEventsSupplier> xEventsSupp( xTxtFrame, UNO_QUERY );
3190 GetExport().GetEventExport().Export(xEventsSupp);
3191
3192 // image map
3193 GetExport().GetImageMapExport().Export( rPropSet );
3194
3195 // svg:title and svg:desc (#i73249#)
3196 exportTitleAndDescription( rPropSet, rPropSetInfo );
3197}
3198
3200 const Reference < XPropertySet > & rPropSet,
3201 const Reference < XPropertySetInfo > & rPropSetInfo )
3202{
3203 if( !rPropSetInfo->hasPropertyByName( gsContourPolyPolygon ) )
3204 {
3205 return;
3206 }
3207
3208 PointSequenceSequence aSourcePolyPolygon;
3209 rPropSet->getPropertyValue( gsContourPolyPolygon ) >>= aSourcePolyPolygon;
3210 const basegfx::B2DPolyPolygon aPolyPolygon(
3212 aSourcePolyPolygon));
3213 const sal_uInt32 nPolygonCount(aPolyPolygon.count());
3214
3215 if(!nPolygonCount)
3216 {
3217 return;
3218 }
3219
3220 const basegfx::B2DRange aPolyPolygonRange(aPolyPolygon.getB2DRange());
3221 bool bPixel(false);
3222
3223 if( rPropSetInfo->hasPropertyByName( gsIsPixelContour ) )
3224 {
3225 bPixel = *o3tl::doAccess<bool>(rPropSet->getPropertyValue( gsIsPixelContour ));
3226 }
3227
3228 // svg: width
3229 OUStringBuffer aStringBuffer( 10 );
3230
3231 if(bPixel)
3232 {
3233 ::sax::Converter::convertMeasurePx(aStringBuffer, basegfx::fround(aPolyPolygonRange.getWidth()));
3234 }
3235 else
3236 {
3237 GetExport().GetMM100UnitConverter().convertMeasureToXML(aStringBuffer, basegfx::fround(aPolyPolygonRange.getWidth()));
3238 }
3239
3240 GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStringBuffer.makeStringAndClear());
3241
3242 // svg: height
3243 if(bPixel)
3244 {
3245 ::sax::Converter::convertMeasurePx(aStringBuffer, basegfx::fround(aPolyPolygonRange.getHeight()));
3246 }
3247 else
3248 {
3249 GetExport().GetMM100UnitConverter().convertMeasureToXML(aStringBuffer, basegfx::fround(aPolyPolygonRange.getHeight()));
3250 }
3251
3252 GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStringBuffer.makeStringAndClear());
3253
3254 // svg:viewbox
3255 SdXMLImExViewBox aViewBox(0.0, 0.0, aPolyPolygonRange.getWidth(), aPolyPolygonRange.getHeight());
3257 enum XMLTokenEnum eElem = XML_TOKEN_INVALID;
3258
3259 if(1 == nPolygonCount )
3260 {
3261 // simple polygon shape, can be written as svg:points sequence
3262 const OUString aPointString(
3264 aPolyPolygon.getB2DPolygon(0)));
3265
3266 // write point array
3268 eElem = XML_CONTOUR_POLYGON;
3269 }
3270 else
3271 {
3272 // polypolygon, needs to be written as a svg:path sequence
3273 const OUString aPolygonString(
3275 aPolyPolygon,
3276 true, // bUseRelativeCoordinates
3277 false, // bDetectQuadraticBeziers: not used in old, but maybe activated now
3278 true)); // bHandleRelativeNextPointCompatible
3279
3280 // write point array
3281 GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_D, aPolygonString);
3282 eElem = XML_CONTOUR_PATH;
3283 }
3284
3285 if( rPropSetInfo->hasPropertyByName( gsIsAutomaticContour ) )
3286 {
3287 bool bTmp = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(
3291 }
3292
3293 // write object now
3295 true, true );
3296}
3297
3299 const Reference < XPropertySet > & rPropSet,
3300 const Reference < XPropertySetInfo > & rPropSetInfo )
3301{
3302 OUString sStyle;
3303 if( rPropSetInfo->hasPropertyByName( gsFrameStyleName ) )
3304 {
3305 rPropSet->getPropertyValue( gsFrameStyleName ) >>= sStyle;
3306 }
3307
3308 OUString sAutoStyle = Find( XmlStyleFamily::TEXT_FRAME, rPropSet, sStyle );
3309 if ( sAutoStyle.isEmpty() )
3310 sAutoStyle = sStyle;
3311 if( !sAutoStyle.isEmpty() )
3313 GetExport().EncodeStyleName( sAutoStyle ) );
3314
3315 // check if we need to use svg:transform
3316 sal_Int16 nRotation(0);
3317 rPropSet->getPropertyValue( gsGraphicRotation ) >>= nRotation;
3318 const bool bUseRotation(0 != nRotation);
3319 basegfx::B2DPoint aCenter(0.0, 0.0);
3320
3321 // add TextFrame attributes like svg:x/y/width/height, also get back
3322 // object's center point if rotation is used and has to be exported
3323 addTextFrameAttributes(rPropSet, false, bUseRotation ? &aCenter : nullptr);
3324
3325 // svg:transform
3326 if(bUseRotation)
3327 {
3328 // RotateFlyFrameFix: im/export full 'draw:transform' using existing tooling.
3329 // Currently only rotation is used, but combinations with 'draw:transform'
3330 // may be necessary in the future, so that svg:x/svg:y/svg:width/svg:height
3331 // may be extended/replaced with 'draw:transform' (see draw objects)
3332 SdXMLImExTransform2D aSdXMLImExTransform2D;
3333
3334 // Convert from 10th degree integer to deg.
3335 // CAUTION: internal rotation is classically mathematically 'wrong' defined by ignoring that
3336 // we have a right-handed coordinate system, so need to correct this by mirroring
3337 // the rotation to get the correct transformation. See also case XML_TOK_TEXT_FRAME_TRANSFORM
3338 // in XMLTextFrameContext_Impl::XMLTextFrameContext_Impl and #i78696#
3339 // CAUTION-II: due to tdf#115782 it is better for current ODF to indeed write it with the wrong
3340 // orientation as in all other cases - ARGH! We will need to correct this in future ODF ASAP!
3341 const double fRotate(basegfx::deg2rad<10>(nRotation));
3342
3343 // transform to rotation center which is the object's center
3344 aSdXMLImExTransform2D.AddTranslate(-aCenter);
3345
3346 // add rotation itself
3347 // tdf#115529 but correct value modulo 2PI to have it positive and in the range of [0.0 .. 2PI[
3348 aSdXMLImExTransform2D.AddRotate(basegfx::normalizeToRange(fRotate, 2 * M_PI));
3349
3350 // back-transform after rotation
3351 aSdXMLImExTransform2D.AddTranslate(aCenter);
3352
3353 // Note: using GetTwipUnitConverter instead of GetMM100UnitConverter may be needed,
3354 // but is not generally available (as it should be, a 'current' UnitConverter should
3355 // be available at GetExport() - and maybe was once). May have to be addressed as soon
3356 // as translate transformations are used here.
3360 aSdXMLImExTransform2D.GetExportString(GetExport().GetMM100UnitConverter()));
3361 }
3362
3363 // original content
3365
3366 {
3367 // xlink:href
3368 uno::Reference<graphic::XGraphic> xGraphic;
3369 rPropSet->getPropertyValue("Graphic") >>= xGraphic;
3370
3371 OUString sInternalURL;
3372 OUString sOutMimeType;
3373
3374 if (xGraphic.is())
3375 {
3376 sInternalURL = GetExport().AddEmbeddedXGraphic(xGraphic, sOutMimeType);
3377 }
3378
3379 // If there still is no url, then graphic is empty
3380 if (!sInternalURL.isEmpty())
3381 {
3386 }
3387
3388 // draw:filter-name
3389 OUString sGrfFilter;
3390 rPropSet->getPropertyValue( gsGraphicFilter ) >>= sGrfFilter;
3391 if( !sGrfFilter.isEmpty() )
3393 sGrfFilter );
3394
3395 if (GetExport().getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
3396 {
3397 if (sOutMimeType.isEmpty())
3398 {
3399 GetExport().GetGraphicMimeTypeFromStream(xGraphic, sOutMimeType);
3400 }
3401 if (!sOutMimeType.isEmpty())
3402 { // ODF 1.3 OFFICE-3943
3404 SvtSaveOptions::ODFSVER_013 <= GetExport().getSaneDefaultVersion()
3407 "mime-type", sOutMimeType);
3408 }
3409 }
3410
3411
3412 // optional office:binary-data
3413 if (xGraphic.is())
3414 {
3415 SvXMLElementExport aElement(GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, false, true );
3417 }
3418 }
3419
3420 const bool bAddReplacementImages = officecfg::Office::Common::Save::Graphic::AddReplacementImages::get();
3421 if (bAddReplacementImages)
3422 {
3423 // replacement graphic for backwards compatibility, but
3424 // only for SVG and metafiles currently
3425 uno::Reference<graphic::XGraphic> xReplacementGraphic;
3426 rPropSet->getPropertyValue("ReplacementGraphic") >>= xReplacementGraphic;
3427
3428 OUString sInternalURL;
3429 OUString sOutMimeType;
3430
3431 //Resolves: fdo#62461 put preferred image first above, followed by
3432 //fallback here
3433 if (xReplacementGraphic.is())
3434 {
3435 sInternalURL = GetExport().AddEmbeddedXGraphic(xReplacementGraphic, sOutMimeType);
3436 }
3437
3438 // If there is no url, then graphic is empty
3439 if (!sInternalURL.isEmpty())
3440 {
3445 }
3446
3447 if (GetExport().getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
3448 {
3449 if (sOutMimeType.isEmpty())
3450 {
3451 GetExport().GetGraphicMimeTypeFromStream(xReplacementGraphic, sOutMimeType);
3452 }
3453 if (!sOutMimeType.isEmpty())
3454 { // ODF 1.3 OFFICE-3943
3456 SvtSaveOptions::ODFSVER_013 <= GetExport().getSaneDefaultVersion()
3459 "mime-type", sOutMimeType);
3460 }
3461 }
3462
3463
3464 // optional office:binary-data
3465 if (xReplacementGraphic.is())
3466 {
3467 SvXMLElementExport aElement(GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, true, true);
3468 GetExport().AddEmbeddedXGraphicAsBase64(xReplacementGraphic);
3469 }
3470 }
3471
3472 // script:events
3473 Reference<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY );
3474 GetExport().GetEventExport().Export(xEventsSupp);
3475
3476 // image map
3477 GetExport().GetImageMapExport().Export( rPropSet );
3478
3479 // svg:title and svg:desc (#i73249#)
3480 exportTitleAndDescription( rPropSet, rPropSetInfo );
3481
3482 // draw:contour
3483 exportContour( rPropSet, rPropSetInfo );
3484}
3485
3486void XMLTextParagraphExport::_collectTextEmbeddedAutoStyles(const Reference < XPropertySet > & )
3487{
3488 SAL_WARN( "xmloff", "no API implementation available" );
3489}
3490
3492 const Reference < XPropertySet > &,
3493 const Reference < XPropertySetInfo > & )
3494{
3495 SAL_WARN( "xmloff", "no API implementation available" );
3496}
3497
3498void XMLTextParagraphExport::exportEvents( const Reference < XPropertySet > & rPropSet )
3499{
3500 // script:events
3501 Reference<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY );
3502 GetExport().GetEventExport().Export(xEventsSupp);
3503
3504 // image map
3505 if (rPropSet->getPropertySetInfo()->hasPropertyByName("ImageMap"))
3506 GetExport().GetImageMapExport().Export( rPropSet );
3507}
3508
3509// Implement Title/Description Elements UI (#i73249#)
3511 const Reference < XPropertySet > & rPropSet,
3512 const Reference < XPropertySetInfo > & rPropSetInfo )
3513{
3514 // svg:title
3515 if( rPropSetInfo->hasPropertyByName( gsTitle ) )
3516 {
3517 OUString sObjTitle;
3518 rPropSet->getPropertyValue( gsTitle ) >>= sObjTitle;
3519 if( !sObjTitle.isEmpty() )
3520 {
3522 XML_TITLE, true, false );
3523 GetExport().Characters( sObjTitle );
3524 }
3525 }
3526
3527 // svg:description
3528 if( rPropSetInfo->hasPropertyByName( gsDescription ) )
3529 {
3530 OUString sObjDesc;
3531 rPropSet->getPropertyValue( gsDescription ) >>= sObjDesc;
3532 if( !sObjDesc.isEmpty() )
3533 {
3535 XML_DESC, true, false );
3536 GetExport().Characters( sObjDesc );
3537 }
3538 }
3539}
3540
3542 const css::uno::Reference< css::text::XTextRange > & rTextRange,
3543 Reference< XPropertySet > const & xPropSet,
3544 Reference < XPropertySetInfo > & xPropSetInfo,
3545 const bool bIsUICharStyle,
3546 const bool bHasAutoStyle,
3547 const OUString& sStyle,
3548 bool& rPrevCharIsSpace,
3549 FieldmarkType& openFieldMark )
3550{
3551 XMLTextCharStyleNamesElementExport aCharStylesExport(
3552 GetExport(),
3553 bIsUICharStyle && aCharStyleNamesPropInfoCache.hasProperty( xPropSet, xPropSetInfo ),
3554 bHasAutoStyle,
3555 xPropSet,
3557
3558 if ( !sStyle.isEmpty() )
3559 {
3560 GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, GetExport().EncodeStyleName( sStyle ) );
3561 }
3562 {
3563 SvXMLElementExport aElement( GetExport(), !sStyle.isEmpty(), XML_NAMESPACE_TEXT, XML_SPAN, false, false );
3564 const OUString aText( rTextRange->getString() );
3565 SvXMLElementExport aElem2( GetExport(), TEXT == openFieldMark,
3567 false, false );
3568 exportCharacterData(aText, rPrevCharIsSpace);
3569 openFieldMark = NONE;
3570 }
3571}
3572
3574 const Reference< XTextRange > & rTextRange,
3575 bool bAutoStyles,
3576 bool& rPrevCharIsSpace,
3577 FieldmarkType& openFieldMark )
3578{
3579 Reference< XPropertySet > xPropSet( rTextRange, UNO_QUERY );
3580 if ( bAutoStyles )
3581 {
3582 Add( XmlStyleFamily::TEXT_TEXT, xPropSet );
3583 }
3584 else
3585 {
3586 bool bIsUICharStyle = false;
3587 bool bHasAutoStyle = false;
3588 const OUString sStyle(
3589 FindTextStyle( xPropSet, bIsUICharStyle, bHasAutoStyle ) );
3590
3591 Reference < XPropertySetInfo > xPropSetInfo;
3592 exportTextRangeSpan( rTextRange, xPropSet, xPropSetInfo, bIsUICharStyle, bHasAutoStyle, sStyle, rPrevCharIsSpace, openFieldMark );
3593 }
3594}
3595
3597 bool& rPrevCharIsSpace )
3598{
3599 sal_Int32 nExpStartPos = 0;
3600 sal_Int32 nEndPos = rText.getLength();
3601 sal_Int32 nSpaceChars = 0;
3602 for( sal_Int32 nPos = 0; nPos < nEndPos; nPos++ )
3603 {
3604 sal_Unicode cChar = rText[nPos];
3605 bool bExpCharAsText = true;
3606 bool bExpCharAsElement = false;
3607 bool bCurrCharIsSpace = false;
3608 switch( cChar )
3609 {
3610 case 0x0009: // Tab
3611 case 0x000A: // LF
3612 // These characters are exported as text.
3613 bExpCharAsElement = true;
3614 bExpCharAsText = false;
3615 break;
3616 case 0x000D:
3617 break; // legal character
3618 case 0x0020: // Blank
3619 if( rPrevCharIsSpace )
3620 {
3621 // If the previous character is a space character,
3622 // too, export a special space element.
3623 bExpCharAsText = false;
3624 }
3625 bCurrCharIsSpace = true;
3626 break;
3627 default:
3628 if( cChar < 0x0020 )
3629 {
3630#ifdef DBG_UTIL
3632 cChar >= 0x0020,
3633 "illegal character in text content" );
3635#endif
3636 bExpCharAsText = false;
3637 }
3638 break;
3639 }
3640
3641 // If the current character is not exported as text
3642 // the text that has not been exported by now has to be exported now.
3643 if( nPos > nExpStartPos && !bExpCharAsText )
3644 {
3645 SAL_WARN_IF( 0 != nSpaceChars, "xmloff", "pending spaces" );
3646 OUString sExp( rText.copy( nExpStartPos, nPos - nExpStartPos ) );
3647 GetExport().Characters( sExp );
3648 nExpStartPos = nPos;
3649 }
3650
3651 // If there are spaces left that have not been exported and the
3652 // current character is not a space , the pending spaces have to be
3653 // exported now.
3654 if( nSpaceChars > 0 && !bCurrCharIsSpace )
3655 {
3656 SAL_WARN_IF( nExpStartPos != nPos, "xmloff", " pending characters" );
3657
3658 if( nSpaceChars > 1 )
3659 {
3661 OUString::number(nSpaceChars) );
3662 }
3663
3665 XML_S, false, false );
3666
3667 nSpaceChars = 0;
3668 }
3669
3670 // If the current character has to be exported as a special
3671 // element, the element will be exported now.
3672 if( bExpCharAsElement )
3673 {
3674 switch( cChar )
3675 {
3676 case 0x0009: // Tab
3677 {
3679 XML_TAB, false,
3680 false );
3681 }
3682 break;
3683 case 0x000A: // LF
3684 {
3686 XML_LINE_BREAK, false,
3687 false );
3688 }
3689 break;
3690 }
3691 }
3692
3693 // If the current character is a space, and the previous one
3694 // is a space, too, the number of pending spaces is incremented
3695 // only.
3696 if( bCurrCharIsSpace && rPrevCharIsSpace )
3697 nSpaceChars++;
3698 rPrevCharIsSpace = bCurrCharIsSpace;
3699
3700 // If the current character is not exported as text, the start
3701 // position for text is the position behind the current position.
3702 if( !bExpCharAsText )
3703 {
3704 SAL_WARN_IF( nExpStartPos != nPos, "xmloff", "wrong export start pos" );
3705 nExpStartPos = nPos+1;
3706 }
3707 }
3708
3709 if( nExpStartPos < nEndPos )
3710 {
3711 SAL_WARN_IF( 0 != nSpaceChars, "xmloff", " pending spaces " );
3712 OUString sExp( rText.copy( nExpStartPos, nEndPos - nExpStartPos ) );
3713 GetExport().Characters( sExp );
3714 }
3715
3716 // If there are some spaces left, they have to be exported now.
3717 if( nSpaceChars > 0 )
3718 {
3719 if( nSpaceChars > 1 )
3720 {
3722 OUString::number(nSpaceChars) );
3723 }
3724
3726 false, false );
3727 }
3728}
3729
3731{
3732 pFieldExport->ExportFieldDeclarations();
3733
3734 // get XPropertySet from the document and ask for AutoMarkFileURL.
3735 // If it exists, export the auto-mark-file element.
3736 Reference<XPropertySet> xPropertySet( GetExport().GetModel(), UNO_QUERY );
3737 if (!xPropertySet.is())
3738 return;
3739
3740 OUString sUrl;
3741 OUString sIndexAutoMarkFileURL(
3742 "IndexAutoMarkFileURL");
3743 if (!xPropertySet->getPropertySetInfo()->hasPropertyByName(
3744 sIndexAutoMarkFileURL))
3745 return;
3746
3747 xPropertySet->getPropertyValue(sIndexAutoMarkFileURL) >>= sUrl;
3748 if (!sUrl.isEmpty())
3749 {
3751 GetExport().GetRelativeReference(sUrl) );
3752 SvXMLElementExport aAutoMarkElement(
3755 true, true );
3756 }
3757}
3758
3760 const Reference<XText> & rText )
3761{
3762 pFieldExport->ExportFieldDeclarations(rText);
3763}
3764
3766{
3767 pFieldExport->SetExportOnlyUsedFieldDeclarations( false/*bOnlyUsed*/ );
3768}
3769
3771{
3772 if (nullptr != pRedlineExport)
3773 pRedlineExport->ExportChangesList( bAutoStyles );
3774}
3775
3777 const Reference<XText> & rText,
3778 bool bAutoStyle)
3779{
3780 if (nullptr != pRedlineExport)
3781 pRedlineExport->ExportChangesList(rText, bAutoStyle);
3782}
3783
3785 const Reference<XText> & rText )
3786{
3787 if (nullptr != pRedlineExport)
3788 pRedlineExport->SetCurrentXText(rText);
3789}
3790
3792{
3793 if (nullptr != pRedlineExport)
3794 pRedlineExport->SetCurrentXText();
3795}
3796
3798
3800{
3801 // tdf#135942: do not collect styles during their export: this may modify iterated containers
3802 mbCollected = true;
3804
3806
3808
3810
3812
3814
3816}
3817
3819 const Reference<XPropertySet> & rPropSet,
3820 bool bAutoStyles )
3821{
3822 // early out: a collapsed ruby makes no sense
3823 if (*o3tl::doAccess<bool>(rPropSet->getPropertyValue(gsIsCollapsed)))
3824 return;
3825
3826 // start value ?
3827 bool bStart = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(gsIsStart));
3828
3829 if (bAutoStyles)
3830 {
3831 // ruby auto styles
3832 if (bStart)
3833 Add( XmlStyleFamily::TEXT_RUBY, rPropSet );
3834 }
3835 else
3836 {
3837 if (bStart)
3838 {
3839 // ruby start
3840
3841 // we can only start a ruby if none is open
3842 assert(!bOpenRuby && "Can't open a ruby inside of ruby!");
3843 if( bOpenRuby )
3844 return;
3845
3846 // save ruby text + ruby char style
3847 rPropSet->getPropertyValue(gsRubyText) >>= sOpenRubyText;
3848 rPropSet->getPropertyValue(gsRubyCharStyleName) >>= sOpenRubyCharStyle;
3849
3850 // ruby style
3852 OUString sStyleName(Find(XmlStyleFamily::TEXT_RUBY, rPropSet, ""));
3853 SAL_WARN_IF(sStyleName.isEmpty(), "xmloff", "Can't find ruby style!");
3855 XML_STYLE_NAME, sStyleName);
3856
3857 // export <text:ruby> and <text:ruby-base> start elements
3861 false );
3862 bOpenRuby = true;
3863 }
3864 else
3865 {
3866 // ruby end
3867
3868 // check for an open ruby
3869 assert(bOpenRuby && "Can't close a ruby if none is open!");
3870 if( !bOpenRuby )
3871 return;
3872
3873 // close <text:ruby-base>
3875 false);
3876
3877 // write the ruby text (with char style)
3878 {
3879 if (!sOpenRubyCharStyle.isEmpty())
3882 GetExport().EncodeStyleName( sOpenRubyCharStyle) );
3883
3884 SvXMLElementExport aRubyElement(
3886 false, false);
3887
3889 }
3890
3891 // and finally, close the ruby
3893 bOpenRuby = false;
3894 }
3895 }
3896}
3897
3899 const Reference<XPropertySet> & i_xPortion,
3900 bool i_bAutoStyles, bool i_isProgress, bool & rPrevCharIsSpace)
3901{
3902 bool doExport(!i_bAutoStyles); // do not export element if autostyles
3903 // check version >= 1.2
3904 switch (GetExport().getSaneDefaultVersion()) {
3905 case SvtSaveOptions::ODFSVER_011: // fall through
3906 case SvtSaveOptions::ODFSVER_010: doExport = false; break;
3907 default: break;
3908 }
3909
3910 const Reference< XTextContent > xTextContent(
3911 i_xPortion->getPropertyValue("InContentMetadata"), UNO_QUERY_THROW);
3912 const Reference< XEnumerationAccess > xEA( xTextContent, UNO_QUERY_THROW );
3913 const Reference< XEnumeration > xTextEnum( xEA->createEnumeration() );
3914
3915 if (doExport)
3916 {
3917 const Reference<rdf::XMetadatable> xMeta(xTextContent, UNO_QUERY_THROW);
3918
3919 // text:meta with neither xml:id nor RDFa is invalid
3920 xMeta->ensureMetadataReference();
3921
3922 // xml:id and RDFa for RDF metadata
3924 GetExport().AddAttributesRDFa(xTextContent);
3925 }
3926
3927 SvXMLElementExport aElem( GetExport(), doExport,
3928 XML_NAMESPACE_TEXT, XML_META, false, false );
3929
3930 // recurse to export content
3931 exportTextRangeEnumeration(xTextEnum, i_bAutoStyles, i_isProgress, rPrevCharIsSpace);
3932}
3933
3935 const uno::Reference<beans::XPropertySet>& xPortion, bool bAutoStyles, bool isProgress,
3936 bool& rPrevCharIsSpace)
3937{
3938 // Do not export the element in the autostyle case.
3939 bool bExport = !bAutoStyles;
3940 if (!(GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED))
3941 {
3942 bExport = false;
3943 }
3944
3945 uno::Reference<text::XTextContent> xTextContent(xPortion->getPropertyValue("ContentControl"),
3946 uno::UNO_QUERY_THROW);
3947 uno::Reference<container::XEnumerationAccess> xEA(xTextContent, uno::UNO_QUERY_THROW);
3948 uno::Reference<container::XEnumeration> xTextEnum = xEA->createEnumeration();
3949
3950 uno::Reference<beans::XPropertySet> xPropertySet(xTextContent, uno::UNO_QUERY_THROW);
3951 if (bExport)
3952 {
3953 bool bShowingPlaceHolder = false;
3954 xPropertySet->getPropertyValue("ShowingPlaceHolder") >>= bShowingPlaceHolder;
3955 if (bShowingPlaceHolder)
3956 {
3957 OUStringBuffer aBuffer;
3958 sax::Converter::convertBool(aBuffer, bShowingPlaceHolder);
3960 aBuffer.makeStringAndClear());
3961 }
3962
3963 bool bCheckbox = false;
3964 xPropertySet->getPropertyValue("Checkbox") >>= bCheckbox;
3965 if (bCheckbox)
3966 {
3967 OUStringBuffer aBuffer;
3970 }
3971
3972 bool bChecked = false;
3973 xPropertySet->getPropertyValue("Checked") >>= bChecked;
3974 if (bChecked)
3975 {
3976 OUStringBuffer aBuffer;
3979 }
3980
3981 OUString aCheckedState;
3982 xPropertySet->getPropertyValue("CheckedState") >>= aCheckedState;
3983 if (!aCheckedState.isEmpty())
3984 {
3986 }
3987
3988 OUString aUncheckedState;
3989 xPropertySet->getPropertyValue("UncheckedState") >>= aUncheckedState;
3990 if (!aUncheckedState.isEmpty())
3991 {
3993 }
3994
3995 bool bPicture = false;
3996 xPropertySet->getPropertyValue("Picture") >>= bPicture;
3997 if (bPicture)
3998 {
3999 OUStringBuffer aBuffer;
4002 aBuffer.makeStringAndClear());
4003 }
4004
4005 bool bDate = false;
4006 xPropertySet->getPropertyValue("Date") >>= bDate;
4007 if (bDate)
4008 {
4009 OUStringBuffer aBuffer;
4012 }
4013
4014 OUString aDateFormat;
4015 xPropertySet->getPropertyValue("DateFormat") >>= aDateFormat;
4016 if (!aDateFormat.isEmpty())
4017 {
4019 }
4020
4021 OUString aDateLanguage;
4022 xPropertySet->getPropertyValue("DateLanguage") >>= aDateLanguage;
4023 if (!aDateLanguage.isEmpty())
4024 {
4026 }
4027 OUString aCurrentDate;
4028 xPropertySet->getPropertyValue("CurrentDate") >>= aCurrentDate;
4029 if (!aCurrentDate.isEmpty())
4030 {
4032 }
4033
4034 bool bPlainText = false;
4035 xPropertySet->getPropertyValue("PlainText") >>= bPlainText;
4036 if (bPlainText)
4037 {
4038 OUStringBuffer aBuffer;
4041 }
4042
4043 bool bComboBox = false;
4044 xPropertySet->getPropertyValue("ComboBox") >>= bComboBox;
4045 if (bComboBox)
4046 {
4047 OUStringBuffer aBuffer;
4050 }
4051
4052 bool bDropDown = false;
4053 xPropertySet->getPropertyValue("DropDown") >>= bDropDown;
4054 if (bDropDown)
4055 {
4056 OUStringBuffer aBuffer;
4059 }
4060
4061 OUString aAlias;
4062 xPropertySet->getPropertyValue("Alias") >>= aAlias;
4063 if (!aAlias.isEmpty())
4064 {
4066 }
4067
4068 OUString aTag;
4069 xPropertySet->getPropertyValue("Tag") >>= aTag;
4070 if (!aTag.isEmpty())
4071 {
4073 }
4074
4075 sal_Int32 nId = 0;
4076 xPropertySet->getPropertyValue("Id") >>= nId;
4077 if (nId)
4078 {
4079 GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_ID, OUString::number(nId));
4080 }
4081
4082 sal_uInt32 nTabIndex;
4083 if ((xPropertySet->getPropertyValue("TabIndex") >>= nTabIndex) && nTabIndex)
4084 {
4086 OUString::number(nTabIndex));
4087 }
4088
4089 OUString aLock;
4090 xPropertySet->getPropertyValue("Lock") >>= aLock;
4091 if (!aLock.isEmpty())
4092 {
4094 }
4095 }
4096
4098 false);
4099
4100 if (bExport)
4101 {
4102 // Export list items of dropdowns.
4103 uno::Sequence<beans::PropertyValues> aListItems;
4104 xPropertySet->getPropertyValue("ListItems") >>= aListItems;
4105 for (const auto& rListItem : aListItems)
4106 {
4108 auto it = aMap.find("DisplayText");
4109 OUString aValue;
4110 if (it != aMap.end() && (it->second >>= aValue) && !aValue.isEmpty())
4111 {
4113 }
4114
4115 it = aMap.find("Value");
4116 if (it != aMap.end() && (it->second >>= aValue))
4117 {
4119 }
4120
4122 false);
4123 }
4124 }
4125
4126 // Recurse to export content.
4127 exportTextRangeEnumeration(xTextEnum, bAutoStyles, isProgress, rPrevCharIsSpace);
4128}
4129
4131 const Reference<XIndexAccess> & rShapes,
4133{
4134 // check parameters ad pre-conditions
4135 if( ( ! rShapes.is() ) || ( ! xFormExport.is() ) )
4136 {
4137 // if we don't have shapes or a form export, there's nothing to do
4138 return;
4139 }
4140 SAL_WARN_IF( pSectionExport == nullptr, "xmloff", "We need the section export." );
4141
4142 Reference<XEnumeration> xShapesEnum = pBoundFrameSets->GetShapes()->createEnumeration();
4143 if(!xShapesEnum.is())
4144 return;
4145 while( xShapesEnum->hasMoreElements() )
4146 {
4147 // now we need to check
4148 // 1) if this is a control shape, and
4149 // 2) if it's in a mute section
4150 // if both answers are 'yes', notify the form layer export
4151
4152 // we join accessing the shape and testing for control
4153 Reference<XControlShape> xControlShape(xShapesEnum->nextElement(), UNO_QUERY);
4154 if( xControlShape.is() )
4155 {
4156 // Reference<XPropertySet> xPropSet( xControlShape, UNO_QUERY );
4157 // Reference<XTextContent> xTextContent;
4158 // xPropSet->getPropertyValue("TextRange") >>= xTextContent;
4159
4160 Reference<XTextContent> xTextContent( xControlShape, UNO_QUERY );
4161 if( xTextContent.is() )
4162 {
4163 if( pSectionExport->IsMuteSection( xTextContent, false ) )
4164 {
4165 // Ah, we've found a shape that
4166 // 1) is a control shape
4167 // 2) is anchored in a mute section
4168 // so: don't export it!
4169 xFormExport->excludeFromExport(
4170 xControlShape->getControl() );
4171 }
4172 // else: not in mute section -> should be exported -> nothing
4173 // to do
4174 }
4175 // else: no anchor -> ignore
4176 }
4177 // else: no control shape -> nothing to do
4178 }
4179}
4180
4182{
4183 maTextListsHelperStack.emplace_back( new XMLTextListsHelper() );
4185}
4186
4188{
4189 mpTextListsHelper = nullptr;
4190 maTextListsHelperStack.pop_back();
4191 if ( !maTextListsHelperStack.empty() )
4192 {
4194 }
4195}
4196
4197/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sType
constexpr OUStringLiteral sHidden
The MultiPropertySetHelper performs the following functions:
void hasProperties(const css::uno::Reference< css::beans::XPropertySetInfo > &)
Call hasPropertiesByName for the provided XPropertySetInfo and build list of allowed properties.
const css::uno::Any & getValue(sal_Int16 nIndex)
Get a value from the values array.
bool hasProperty(sal_Int16 nIndex)
Find out if this property is supported.
bool checkedProperties()
Return whether hasProperties was called (i.e.
void SetValue(sal_Int32 nValue)
sal_Int32 GetValue() const
void AddTranslate(const ::basegfx::B2DTuple &rNew)
Definition: xexptran.cxx:234
void AddRotate(double fNew)
Definition: xexptran.cxx:228
const OUString & GetExportString(const SvXMLUnitConverter &rConv)
Definition: xexptran.cxx:247
const OUString & GetExportString()
Definition: xexptran.cxx:1036
bool hasProperty(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, css::uno::Reference< css::beans::XPropertySetInfo > &rPropSetInfo)
void AddFamily(XmlStyleFamily nFamily, const OUString &rStrName, SvXMLExportPropertyMapper *pMapper, const OUString &aStrPrefix)
register a new family with its appropriate instance of a derivation of XMLPropertySetMapper for famil...
Definition: xmlaustp.cxx:273
void exportXML(XmlStyleFamily nFamily) const
Export all item sets ofs a certain class in the order in that they have been added.
Definition: xmlaustp.cxx:375
css::uno::Sequence< OUString > GetPropertyNames()
retrieve the names of the properties used in the styles
Definition: xmlaustp.cxx:334
ProgressBarHelper * GetProgressBarHelper()
Definition: xmlexp.cxx:1944
::comphelper::UnoInterfaceToUniqueIdentifierMapper & getInterfaceToIdentifierMapper()
Definition: xmlexp.cxx:2251
OUString GetRelativeReference(const OUString &rValue)
Definition: xmlexp.cxx:2060
void AddAttributeXmlId(css::uno::Reference< css::uno::XInterface > const &i_xIfc)
add xml:id attribute (for RDF metadata)
Definition: xmlexp.cxx:2293
XMLEventExport & GetEventExport()
get Event export, with handlers for script types "None" and "StarBasic" already registered; other han...
Definition: xmlexp.cxx:1992
void StartElement(sal_uInt16 nPrefix, enum ::xmloff::token::XMLTokenEnum eName, bool bIgnWSOutside)
Definition: xmlexp.cxx:2094
rtl::Reference< XMLTextParagraphExport > const & GetTextParagraphExport()
Definition: xmlexp.hxx:557
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
Definition: xmlexp.cxx:910
void Characters(const OUString &rChars)
Definition: xmlexp.cxx:2129
bool GetGraphicMimeTypeFromStream(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, OUString &rOutMimeType)
Definition: xmlexp.cxx:1863
void ClearAttrList()
Definition: xmlexp.cxx:1009
void SAL_DLLPRIVATE AddAttributeIdLegacy(sal_uInt16 const nLegacyPrefix, OUString const &rValue)
add xml:id and legacy namespace id
Definition: xmlexp.cxx:2277
rtl::Reference< XMLShapeExport > const & GetShapeExport()
Definition: xmlexp.hxx:565
OUString EncodeStyleName(const OUString &rName, bool *pEncoded=nullptr) const
Definition: xmlexp.cxx:1937
bool AddEmbeddedXGraphicAsBase64(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic)
Definition: xmlexp.cxx:1878
void CheckAttrList()
Definition: xmlexp.cxx:1015
XMLImageMapExport & GetImageMapExport()
get the export for image maps
Definition: xmlexp.cxx:2008
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlexp.hxx:391
void AddAttributesRDFa(css::uno::Reference< css::text::XTextContent > const &i_xTextContent)
add RDFa attributes for a metadatable text content
Definition: xmlexp.cxx:2343
void EndElement(sal_uInt16 nPrefix, enum ::xmloff::token::XMLTokenEnum eName, bool bIgnWSInside)
Definition: xmlexp.cxx:2151
OUString AddEmbeddedXGraphic(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, OUString &rOutMimeType, OUString const &rRequestedName=OUString())
Definition: xmlexp.cxx:1841
void convertMeasureToXML(OUStringBuffer &rBuffer, sal_Int32 nMeasure) const
convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit
Definition: xmluconv.cxx:207
virtual bool exportXML(OUString &rStrExpValue, const css::uno::Any &rValue, const SvXMLUnitConverter &rUnitConverter) const override
Exports the given value according to the XML-data-type corresponding to the derived class.
Definition: txtprhdl.cxx:614
void Export(css::uno::Reference< css::document::XEventsSupplier > const &xAccess, bool bUseWhitespace=true)
export the events (calls EventExport::Export(Reference<XNameAccess>) )
void Export(const css::uno::Reference< css::beans::XPropertySet > &rPropertySet)
Get the ImageMap object from the "ImageMap" property and subsequently export the map (if present).
This class handles the export of index marks for table of content, alphabetical and user index.
This class handles the export of redline portions.
This class handles the export of sections and indices (which are, internally, just sections).
static bool IsInSection(const css::uno::Reference< css::text::XTextSection > &rEnclosingSection, const css::uno::Reference< css::text::XTextContent > &rContent, bool bDefault)
Determine whether rContent is contained in rEnclosingSection.
SvXMLExport & rExport
Definition: styleexp.hxx:55
SvXMLExport & GetExport()
Definition: styleexp.hxx:59
OUString Add(const css::uno::Reference< css::container::XIndexReplace > &rNumRules)
information about list and list style for a certain paragraph
const OUString & GetNumRulesName() const
void Set(const css::uno::Reference< css::text::XTextContent > &rTextContent, const bool bOutlineStyleAsNormalListStyle, const XMLTextListAutoStylePool &rListAutoPool, const bool bExportTextNumberElement)
const OUString & ListLabelString() const
const OUString & GetListId() const
sal_Int16 GetListLevelStartValue() const
sal_Int16 GetLevel() const
bool IsListIdDefault() const
bool BelongsToSameList(const XMLTextNumRuleInfo &rCmp) const
sal_uInt32 GetStartValue() const
bool IsContinueingPreviousSubTree() const
void recordTrackedChangesForXText(const css::uno::Reference< css::text::XText > &rText)
Record tracked changes for this particular XText (empty reference stop recording) This should be used...
Definition: txtparae.cxx:3784
std::unique_ptr< XMLRedlineExport > pRedlineExport
may be NULL (if no redlines should be exported; e.g. in block mode)
Definition: txtparae.hxx:99
SvXMLAutoStylePoolP & GetAutoStylePool()
Definition: txtparae.hxx:158
void exportTextFrame(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, bool bProgress, bool bExportContent, const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet=nullptr)
Definition: txtparae.hxx:544
virtual void _exportTextEmbedded(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const css::uno::Reference< css::beans::XPropertySetInfo > &rPropSetInfo)
Definition: txtparae.cxx:3491
void exportShape(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet=nullptr)
Definition: txtparae.hxx:571
virtual void _collectTextEmbeddedAutoStyles(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Definition: txtparae.cxx:3486
void exportTextField(const css::uno::Reference< css::text::XTextRange > &rTextRange, bool bAutoStyles, bool bProgress, bool *pPrevCharIsSpace)
rtl::Reference< SvXMLExportPropertyMapper > xSectionPropMapper
Definition: txtparae.hxx:88
virtual void exportTableAutoStyles()
Definition: txtparae.cxx:3797
void PreventExportOfControlsInMuteSections(const css::uno::Reference< css::container::XIndexAccess > &rShapes, const rtl::Reference< xmloff::OFormLayerXMLExport > &xFormExport)
exclude form controls which are in mute sections.
Definition: txtparae.cxx:4130
SinglePropertySetInfoCache aCharStyleNamesPropInfoCache
Definition: txtparae.hxx:156
const ::std::unique_ptr< ::xmloff::BoundFrameSets > pBoundFrameSets
Definition: txtparae.hxx:91
void exportTextDeclarations()
This method exports (text field) declarations etc.
Definition: txtparae.cxx:3730
void exportTitleAndDescription(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const css::uno::Reference< css::beans::XPropertySetInfo > &rPropSetInfo)
Definition: txtparae.cxx:3510
static constexpr OUStringLiteral gsCharStyleNames
Definition: txtparae.hxx:138
rtl::Reference< SvXMLExportPropertyMapper > xRubyPropMapper
Definition: txtparae.hxx:89
std::unique_ptr< XMLIndexMarkExport > pIndexMarkExport
Definition: txtparae.hxx:96
virtual ~XMLTextParagraphExport() override
Definition: txtparae.cxx:1429
XMLTextListsHelper * mpTextListsHelper
Definition: txtparae.hxx:110
::std::vector< std::unique_ptr< XMLTextListsHelper > > maTextListsHelperStack
Definition: txtparae.hxx:111
void exportTextGraphic(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet=nullptr)
Definition: txtparae.hxx:553
std::unique_ptr< XMLTextFieldExport > pFieldExport
Definition: txtparae.hxx:92
rtl::Reference< SvXMLExportPropertyMapper > xParaPropMapper
Definition: txtparae.hxx:84
void exportContour(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const css::uno::Reference< css::beans::XPropertySetInfo > &rPropSetInfo)
Definition: txtparae.cxx:3199
virtual void exportTable(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, bool bProgress)
Definition: txtparae.cxx:2565
SvXMLAutoStylePoolP & rAutoStylePool
Definition: txtparae.hxx:83
rtl::Reference< SvXMLExportPropertyMapper > xTextPropMapper
Definition: txtparae.hxx:85
void collectTextAutoStylesOptimized(bool bIsProgress)
Definition: txtparae.cxx:1540
void exportTextRangeEnumeration(const css::uno::Reference< css::container::XEnumeration > &rRangeEnum, bool bAutoStyles, bool bProgress, bool &rPrevCharIsSpace)
Definition: txtparae.cxx:2255
static constexpr OUStringLiteral gsFootnote
Definition: txtparae.hxx:140
void _exportTextFrame(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const css::uno::Reference< css::beans::XPropertySetInfo > &rPropSetInfo, bool bProgress)
Definition: txtparae.cxx:3131
void exportMeta(const css::uno::Reference< css::beans::XPropertySet > &i_xPortion, bool i_bAutoStyles, bool i_isProgress, bool &rPrevCharIsSpace)
export a text:meta
Definition: txtparae.cxx:3898
void exportListAndSectionChange(css::uno::Reference< css::text::XTextSection > &rOldSection, const css::uno::Reference< css::text::XTextSection > &rNewSection, const XMLTextNumRuleInfo &rOldList, const XMLTextNumRuleInfo &rNewList, bool bAutoStyles)
check if current section or current list has changed; calls exportListChange as appropriate
void exportTextRange(const css::uno::Reference< css::text::XTextRange > &rTextRange, bool bAutoStyles, bool &rPrevCharWasSpace, FieldmarkType &openFieldmarkType)
Definition: txtparae.cxx:3573
void exportTextContentEnumeration(const css::uno::Reference< css::container::XEnumeration > &rContentEnum, bool bAutoStyles, const css::uno::Reference< css::text::XTextSection > &rBaseSection, bool bProgress, bool bExportParagraph=true, const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet=nullptr, TextPNS eExtensionNS=TextPNS::ODF)
Definition: txtparae.cxx:1810
void exportTextLineBreak(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
Definition: txtparae.cxx:2617
void exportTextEmbedded(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet=nullptr)
Definition: txtparae.hxx:562
OUString FindTextStyle(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, bool &rbHasCharStyle, bool &rbHasAutoStyle, const XMLPropertyState **pAddState=nullptr) const
Definition: txtparae.cxx:914
bool IsBlockMode() const
Definition: txtparae.hxx:504
static SvXMLExportPropertyMapper * CreateShapeExtPropMapper(SvXMLExport &rExport)
Definition: txtparae.cxx:1443
void exportRuby(const css::uno::Reference< css::beans::XPropertySet > &rPortionPropSet, bool bAutoStyles)
export a ruby
Definition: txtparae.cxx:3818
void exportTextFootnote(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const OUString &sString, bool bAutoStyles, bool bProgress)
export a footnote and styles
Definition: txtftne.cxx:64
XMLTextListAutoStylePool maListAutoPool
Definition: txtparae.hxx:94
static SvXMLExportPropertyMapper * CreateParaDefaultExtPropMapper(SvXMLExport &rExport)
Definition: txtparae.cxx:1467
void exportPageFrames(bool bProgress)
Definition: txtparae.cxx:1475
const XMLTextListAutoStylePool & GetListAutoStylePool() const
Definition: txtparae.hxx:539
rtl::Reference< SvXMLExportPropertyMapper > xAutoFramePropMapper
Definition: txtparae.hxx:87
static constexpr OUStringLiteral gsFrameStyleName
Definition: txtparae.hxx:155
static constexpr OUStringLiteral gsTextSection
Definition: txtparae.hxx:152
void ExportContentControl(const css::uno::Reference< css::beans::XPropertySet > &xPortion, bool bAutoStyles, bool isProgress, bool &rPrevCharIsSpace)
Exports a <loext:content-control> element.
Definition: txtparae.cxx:3934
void exportCharacterData(const OUString &rText, bool &rPrevCharWasSpace)
Definition: txtparae.cxx:3596
void recordTrackedChangesNoXText()
Stop recording tracked changes.
Definition: txtparae.cxx:3791
OUString sOpenRubyCharStyle
Definition: txtparae.hxx:107
std::unique_ptr< Impl > m_xImpl
Definition: txtparae.hxx:79
void Add(XmlStyleFamily nFamily, MultiPropertySetHelper &rPropSetHelper, const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
add autostyle for specified family
XMLShapeExportFlags addTextFrameAttributes(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, bool bShape, basegfx::B2DPoint *pCenter=nullptr, OUString *pMinHeightValue=nullptr, OUString *pMinWidthValue=nullptr)
Definition: txtparae.cxx:2741
void exportTextMark(const css::uno::Reference< css::beans::XPropertySet > &xPropSet, const OUString &rProperty, const enum ::xmloff::token::XMLTokenEnum pElements[], bool bAutoStyles)
Definition: txtparae.cxx:2651
static SvXMLExportPropertyMapper * CreateCharExtPropMapper(SvXMLExport &rExport)
Definition: txtparae.cxx:1451
void exportListChange(const XMLTextNumRuleInfo &rPrvInfo, const XMLTextNumRuleInfo &rNextInfo)
Definition: txtparae.cxx:992
OUString Find(XmlStyleFamily nFamily, const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const OUString &rParent, const o3tl::span< const XMLPropertyState > aAddStates={}) const
find style name for specified family and parent
Definition: txtparae.cxx:879
void exportUsedDeclarations()
export all declarations
Definition: txtparae.cxx:3765
std::unique_ptr< XMLSectionExport > pSectionExport
Definition: txtparae.hxx:95
void exportTextRangeSpan(const css::uno::Reference< css::text::XTextRange > &rTextRange, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, css::uno::Reference< css::beans::XPropertySetInfo > &xPropSetInfo, const bool bIsUICharStyle, const bool bHasAutoStyle, const OUString &sStyle, bool &rPrevCharIsSpace, FieldmarkType &openFieldMark)
Definition: txtparae.cxx:3541
void exportEvents(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Definition: txtparae.cxx:3498
void _exportTextGraphic(const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const css::uno::Reference< css::beans::XPropertySetInfo > &rPropSetInfo)
Definition: txtparae.cxx:3298
void exportTrackedChanges(bool bAutoStyle)
Export the list of change information (enclosed by <tracked-changes>) (or the necessary automatic sty...
Definition: txtparae.cxx:3770
rtl::Reference< SvXMLExportPropertyMapper > xFramePropMapper
Definition: txtparae.hxx:86
XMLTextParagraphExport(SvXMLExport &rExp, SvXMLAutoStylePoolP &rASP)
Definition: txtparae.cxx:1350
void exportAnyTextFrame(const css::uno::Reference< css::text::XTextContent > &rTextContent, FrameType eTxpe, bool bAutoStyles, bool bProgress, bool bExportContent, const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet)
Definition: txtparae.cxx:3022
void exportParagraph(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, bool bProgress, bool bExportParagraph, MultiPropertySetHelper &rPropSetHelper, TextPNS eExtensionNS)
Definition: txtparae.cxx:1971
void exportText(const css::uno::Reference< css::text::XText > &rText, bool bAutoStyles, bool bProgress, bool bExportParagraph, TextPNS eExtensionNS=TextPNS::ODF)
void exportFrameFrames(bool bAutoStyles, bool bProgress, const css::uno::Reference< css::text::XTextFrame > *pParentTxtFrame)
Definition: txtparae.cxx:1499
static SvXMLExportPropertyMapper * CreateParaExtPropMapper(SvXMLExport &rExport)
Definition: txtparae.cxx:1459
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
B2DRange getB2DRange() const
sal_uInt32 count() const
TYPE getWidth() const
TYPE getHeight() const
TYPE getX() const
void setY(TYPE fY)
TYPE getY() const
void setX(TYPE fX)
const OUString & getIdentifier(const css::uno::Reference< css::uno::XInterface > &rInterface) const
css::uno::Type const & get()
constexpr iterator begin() const noexcept
constexpr iterator end() const noexcept
static bool convertMeasurePx(sal_Int32 &rValue, std::u16string_view rString)
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
static bool convertBool(bool &rBool, std::u16string_view rString)
unique_ptr< BoundFrames > m_pTexts
Definition: txtparae.cxx:440
const BoundFrames * GetShapes() const
Definition: txtparae.cxx:439
const BoundFrames * GetGraphics() const
Definition: txtparae.cxx:435
const BoundFrames * GetEmbeddeds() const
Definition: txtparae.cxx:437
BoundFrameSets(const Reference< XInterface > &rModel)
Definition: txtparae.cxx:554
unique_ptr< BoundFrames > m_pGraphics
Definition: txtparae.cxx:443
const BoundFrames * GetTexts() const
Definition: txtparae.cxx:433
unique_ptr< BoundFrames > m_pShapes
Definition: txtparae.cxx:445
unique_ptr< BoundFrames > m_pEmbeddeds
Definition: txtparae.cxx:444
int nCount
float u
XmlStyleFamily
Definition: families.hxx:50
constexpr OUStringLiteral XML_STYLE_FAMILY_SD_GRAPHICS_NAME
Definition: families.hxx:38
DocumentType eType
sal_Int16 nValue
const char * name
sal_Int32 nIndex
uno_Any a
sal_uInt16 nPos
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
const char * sName
OUString exportToSvgD(const B2DPolyPolygon &rPolyPoly, bool bUseRelativeCoordinates, bool bDetectQuadraticBeziers, bool bHandleRelativeNextPointCompatible, bool bOOXMLMotionPath=false)
OUString exportToSvgPoints(const B2DPolygon &rPoly)
B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon(const css::drawing::PointSequenceSequence &rPointSequenceSequenceSource)
double normalizeToRange(double v, const double fRange)
B2IRange fround(const B2DRange &rRange)
Fill
@ Exception
Type
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
Handling of tokens in XML:
XMLTokenEnum
The enumeration of all XML tokens.
Definition: xmltoken.hxx:50
@ XML_CONTINUE_NUMBERING
Definition: xmltoken.hxx:511
@ XML_SHOWING_PLACE_HOLDER
Definition: xmltoken.hxx:3501
@ XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE
Definition: xmltoken.hxx:237
@ XML_OUTLINE_CONTENT_VISIBLE
Definition: xmltoken.hxx:1452
@ XML_FIELDMARK_SEPARATOR
Definition: xmltoken.hxx:3318
@ XML_REFERENCE_MARK_START
Definition: xmltoken.hxx:1599
@ XML_DATE_RFC_LANGUAGE_TAG
Definition: xmltoken.hxx:3507
@ XML_VISITED_STYLE_NAME
Definition: xmltoken.hxx:2134
@ XML_ANCHOR_PAGE_NUMBER
Definition: xmltoken.hxx:247
@ XML_REFERENCE_MARK_END
Definition: xmltoken.hxx:1598
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3525
bool operator==(const AttributeDescription &i_lhs, const AttributeDescription &i_rhs)
HashMap_OWString_Interface aMap
constexpr OUStringLiteral ODF_FORMTEXT
Definition: odffields.hxx:25
constexpr OUStringLiteral ODF_FORMCHECKBOX
Definition: odffields.hxx:28
constexpr OUStringLiteral ODF_OLE_PARAM
Definition: odffields.hxx:54
sal_Int16 nId
static void ExportParameter(OUStringBuffer &rStrBuffer, const css::drawing::EnhancedCustomShapeParameter &rParameter)
#define SEF_DEFAULT
Definition: shapeexport.hxx:68
XMLShapeExportFlags
Definition: shapeexport.hxx:49
Smart struct to transport an Any with an index to the appropriate property-name.
Definition: maptype.hxx:140
sal_Int32 mnIndex
Definition: maptype.hxx:141
sal_Int32 GetFieldMarkIndex(Reference< XFormField > const &i_xFieldMark)
Definition: txtparae.cxx:1339
sal_Int32 AddFieldMarkStart(Reference< XFormField > const &i_xFieldMark)
Definition: txtparae.cxx:1332
::std::map< Reference< XFormField >, sal_Int32 > FieldMarkMap_t
Definition: txtparae.cxx:1328
FieldMarkMap_t m_FieldMarkMap
Definition: txtparae.cxx:1329
constexpr OUStringLiteral gsTextFieldStartEnd(u"TextFieldStartEnd")
constexpr OUStringLiteral gsParagraphService(u"com.sun.star.text.Paragraph")
constexpr OUStringLiteral gsChainNextName(u"ChainNextName")
constexpr OUStringLiteral gsRelativeWidth(u"RelativeWidth")
constexpr OUStringLiteral gsVisitedCharStyleName(u"VisitedCharStyleName")
constexpr OUStringLiteral gsAnchorType(u"AnchorType")
constexpr OUStringLiteral gsVertOrientPosition(u"VertOrientPosition")
constexpr OUStringLiteral gsSizeType(u"SizeType")
static const char * aParagraphPropertyNamesAuto[]
Definition: txtparae.cxx:474
constexpr OUStringLiteral gsReferenceMark(u"ReferenceMark")
constexpr OUStringLiteral gsContourPolyPolygon(u"ContourPolyPolygon")
constexpr OUStringLiteral gsTextContentService(u"com.sun.star.text.TextContent")
enum XMLTokenEnum lcl_XmlBookmarkElements[]
Definition: txtparae.cxx:1535
constexpr OUStringLiteral gsTableService(u"com.sun.star.text.TextTable")
constexpr OUStringLiteral gsBookmark(u"Bookmark")
constexpr OUStringLiteral gsTextFieldSep(u"TextFieldSeparator")
constexpr OUStringLiteral gsHoriOrientPosition(u"HoriOrientPosition")
constexpr OUStringLiteral gsFrame(u"Frame")
constexpr OUStringLiteral gsHyperLinkURL(u"HyperLinkURL")
constexpr OUStringLiteral gsDescription(u"Description")
constexpr OUStringLiteral gsHoriOrient(u"HoriOrient")
constexpr OUStringLiteral gsNumberingRules(u"NumberingRules")
constexpr OUStringLiteral gsServerMap(u"ServerMap")
static bool lcl_txtpara_isBoundAsChar(const Reference< XPropertySet > &rPropSet, const Reference< XPropertySetInfo > &rPropSetInfo)
Definition: txtparae.cxx:2725
constexpr OUStringLiteral gsParaConditionalStyleName(u"ParaConditionalStyleName")
static const char * aParagraphPropertyNames[]
Definition: txtparae.cxx:493
constexpr OUStringLiteral gsDocumentIndexMark(u"DocumentIndexMark")
constexpr OUStringLiteral gsText(u"Text")
constexpr OUStringLiteral gsHyperLinkName(u"HyperLinkName")
constexpr OUStringLiteral gsRubyCharStyleName(u"RubyCharStyleName")
constexpr OUStringLiteral gsIsPixelContour(u"IsPixelContour")
constexpr OUStringLiteral gsWidthType(u"WidthType")
constexpr OUStringLiteral gsHeight(u"Height")
constexpr OUStringLiteral gsTextFieldStart(u"TextFieldStart")
constexpr OUStringLiteral gsTextField(u"TextField")
constexpr OUStringLiteral gsRuby(u"Ruby")
constexpr OUStringLiteral gsIsStart(u"IsStart")
constexpr OUStringLiteral gsGraphicRotation(u"GraphicRotation")
constexpr OUStringLiteral gsTextFieldEnd(u"TextFieldEnd")
constexpr OUStringLiteral gsIsSyncHeightToWidth(u"IsSyncHeightToWidth")
constexpr OUStringLiteral gsUnvisitedCharStyleName(u"UnvisitedCharStyleName")
static bool lcl_validPropState(const XMLPropertyState &rState)
Definition: txtparae.cxx:790
constexpr OUStringLiteral gsTextFrameService(u"com.sun.star.text.TextFrame")
constexpr OUStringLiteral gsTitle(u"Title")
constexpr OUStringLiteral gsTextGraphicService(u"com.sun.star.text.TextGraphicObject")
constexpr OUStringLiteral gsTextEmbeddedService(u"com.sun.star.text.TextEmbeddedObject")
constexpr OUStringLiteral gsIsAutomaticContour(u"IsAutomaticContour")
constexpr OUStringLiteral gsWidth(u"Width")
constexpr OUStringLiteral gsShapeService(u"com.sun.star.drawing.Shape")
constexpr OUStringLiteral gsTextFieldService(u"com.sun.star.text.TextField")
constexpr OUStringLiteral gsVertOrient(u"VertOrient")
static bool txtparae_bContainsIllegalCharacters
Definition: txtparae.cxx:450
constexpr OUStringLiteral gsHyperLinkTarget(u"HyperLinkTarget")
constexpr OUStringLiteral gsIsSyncWidthToHeight(u"IsSyncWidthToHeight")
constexpr OUStringLiteral gsRedline(u"Redline")
constexpr OUStringLiteral gsIsCollapsed(u"IsCollapsed")
constexpr OUStringLiteral gsGraphicFilter(u"GraphicFilter")
constexpr OUStringLiteral gsTextPortionType(u"TextPortionType")
constexpr OUStringLiteral gsRelativeHeight(u"RelativeHeight")
constexpr OUStringLiteral gsSoftPageBreak(u"SoftPageBreak")
constexpr OUStringLiteral gsAnchorPageNo(u"AnchorPageNo")
enum XMLTokenEnum lcl_XmlReferenceElements[]
Definition: txtparae.cxx:1533
constexpr OUStringLiteral gsRubyText(u"RubyText")
TextPNS
Definition: txtparae.hxx:72
#define CTF_HYPERLINK_URL
Definition: txtprmap.hxx:140
@ TEXT_ADDITIONAL_DEFAULTS
#define CTF_CHAR_STYLE_NAME
Definition: txtprmap.hxx:141
sal_uInt16 sal_Unicode
signed char sal_Int8
std::unique_ptr< char[]> aBuffer
bool operator!=(const XclExpString &rLeft, const XclExpString &rRight)
constexpr sal_uInt16 XML_NAMESPACE_DRAW
constexpr sal_uInt16 XML_NAMESPACE_FIELD
constexpr sal_uInt16 XML_NAMESPACE_XLINK
constexpr sal_uInt16 XML_NAMESPACE_SVG
constexpr sal_uInt16 XML_NAMESPACE_TEXT
constexpr sal_uInt16 XML_NAMESPACE_XML
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
constexpr sal_uInt16 XML_NAMESPACE_STYLE
constexpr sal_uInt16 XML_NAMESPACE_FO