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