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<const XMLPropertyState> aAddStates,
514  bool bDontSeek )
515 {
517  switch( nFamily )
518  {
520  xPropMapper = GetParaPropMapper();
521  break;
523  xPropMapper = GetTextPropMapper();
524  break;
526  xPropMapper = GetAutoFramePropMapper();
527  break;
529  xPropMapper = GetSectionPropMapper();
530  break;
532  xPropMapper = GetRubyPropMapper();
533  break;
534  default: break;
535  }
536  SAL_WARN_IF( !xPropMapper.is(), "xmloff", "There is the property mapper?" );
537 
538  vector< XMLPropertyState > aPropStates =
539  xPropMapper->Filter(GetExport(), rPropSet);
540 
541  aPropStates.insert( aPropStates.end(), aAddStates.begin(), aAddStates.end() );
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, std::vector(aPropStates), bDontSeek );
640  if( !sCondParent.isEmpty() && sParent != sCondParent )
641  GetAutoStylePool().Add( nFamily, sCondParent, std::move(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, std::vector(aPropStates) );
729  if( !sCondParent.isEmpty() && sParent != sCondParent )
730  GetAutoStylePool().Add( nFamily, sCondParent, std::move(aPropStates) );
731  }
732 }
733 
735  XmlStyleFamily nFamily,
736  const Reference < XPropertySet > & rPropSet,
737  const OUString& rParent,
738  const o3tl::span<const 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  aPropStates.insert( aPropStates.end(), aAddStates.begin(), aAddStates.end() );
763  if( std::any_of( aPropStates.begin(), aPropStates.end(), lcl_validPropState ) )
764  sName = GetAutoStylePool().Find( nFamily, sName, aPropStates );
765 
766  return sName;
767 }
768 
770  const Reference < XPropertySet > & rPropSet,
771  bool& rbHyperlink,
772  bool& rbHasCharStyle,
773  bool& rbHasAutoStyle,
774  const XMLPropertyState** ppAddStates ) const
775 {
776  rtl::Reference < SvXMLExportPropertyMapper > xPropMapper(GetTextPropMapper());
777  vector<XMLPropertyState> aPropStates(xPropMapper->Filter(GetExport(), rPropSet));
778 
779  // Get parent and remove hyperlinks (they aren't of interest)
780  OUString sName;
781  rbHyperlink = rbHasCharStyle = rbHasAutoStyle = false;
782  sal_uInt16 nIgnoreProps = 0;
783  rtl::Reference< XMLPropertySetMapper > xPM(xPropMapper->getPropertySetMapper());
784  ::std::vector< XMLPropertyState >::iterator aFirstDel = aPropStates.end();
785  ::std::vector< XMLPropertyState >::iterator aSecondDel = aPropStates.end();
786 
787  for( ::std::vector< XMLPropertyState >::iterator
788  i = aPropStates.begin();
789  nIgnoreProps < 2 && i != aPropStates.end();
790  ++i )
791  {
792  if( i->mnIndex == -1 )
793  continue;
794 
795  switch( xPM->GetEntryContextId(i->mnIndex) )
796  {
797  case CTF_CHAR_STYLE_NAME:
798  i->maValue >>= sName;
799  i->mnIndex = -1;
800  rbHasCharStyle = !sName.isEmpty();
801  if( nIgnoreProps )
802  aSecondDel = i;
803  else
804  aFirstDel = i;
805  nIgnoreProps++;
806  break;
807  case CTF_HYPERLINK_URL:
808  rbHyperlink = true;
809  i->mnIndex = -1;
810  if( nIgnoreProps )
811  aSecondDel = i;
812  else
813  aFirstDel = i;
814  nIgnoreProps++;
815  break;
816  }
817  }
818  if( ppAddStates )
819  {
820  while( *ppAddStates )
821  {
822  aPropStates.push_back( **ppAddStates );
823  ppAddStates++;
824  }
825  }
826  if (aPropStates.size() - nIgnoreProps)
827  {
828  // erase the character style, otherwise the autostyle cannot be found!
829  // erase the hyperlink, otherwise the autostyle cannot be found!
830  if ( nIgnoreProps )
831  {
832  // If two elements of a vector have to be deleted,
833  // we should delete the second one first.
834  if( --nIgnoreProps )
835  aPropStates.erase( aSecondDel );
836  aPropStates.erase( aFirstDel );
837  }
838  sName = GetAutoStylePool().Find(
840  OUString(), // AutoStyles should not have parents!
841  aPropStates );
842  rbHasAutoStyle = true;
843  }
844 
845  return sName;
846 }
847 
848 // adjustments to support lists independent from list style
850  const XMLTextNumRuleInfo& rPrevInfo,
851  const XMLTextNumRuleInfo& rNextInfo )
852 {
853  // end a list
854  if ( rPrevInfo.GetLevel() > 0 )
855  {
856  sal_Int16 nListLevelsToBeClosed = 0;
857  if ( !rNextInfo.BelongsToSameList( rPrevInfo ) ||
858  rNextInfo.GetLevel() <= 0 )
859  {
860  // close complete previous list
861  nListLevelsToBeClosed = rPrevInfo.GetLevel();
862  }
863  else if ( rPrevInfo.GetLevel() > rNextInfo.GetLevel() )
864  {
865  // close corresponding sub lists
866  SAL_WARN_IF( rNextInfo.GetLevel() <= 0, "xmloff",
867  "<rPrevInfo.GetLevel() > 0> not hold. Serious defect." );
868  nListLevelsToBeClosed = rPrevInfo.GetLevel() - rNextInfo.GetLevel();
869  }
870 
871  if ( nListLevelsToBeClosed > 0 &&
872  maListElements.size() >= sal::static_int_cast< sal_uInt32 >( 2 * nListLevelsToBeClosed ) )
873  {
874  do {
875  for(size_t j = 0; j < 2; ++j)
876  {
877  OUString aElem(maListElements.back());
878  maListElements.pop_back();
879  GetExport().EndElement(aElem, true);
880  }
881 
882  // remove closed list from list stack
883  mpTextListsHelper->PopListFromStack();
884 
885  --nListLevelsToBeClosed;
886  } while ( nListLevelsToBeClosed > 0 );
887  }
888  }
889 
890  const bool bExportODF =
891  bool( GetExport().getExportFlags() & SvXMLExportFlags::OASIS );
892  const SvtSaveOptions::ODFSaneDefaultVersion eODFDefaultVersion =
893  GetExport().getSaneDefaultVersion();
894 
895  // start a new list
896  if ( rNextInfo.GetLevel() > 0 )
897  {
898  bool bRootListToBeStarted = false;
899  sal_Int16 nListLevelsToBeOpened = 0;
900  if ( !rPrevInfo.BelongsToSameList( rNextInfo ) ||
901  rPrevInfo.GetLevel() <= 0 )
902  {
903  // new root list
904  bRootListToBeStarted = true;
905  nListLevelsToBeOpened = rNextInfo.GetLevel();
906  }
907  else if ( rNextInfo.GetLevel() > rPrevInfo.GetLevel() )
908  {
909  // open corresponding sub lists
910  SAL_WARN_IF( rPrevInfo.GetLevel() <= 0, "xmloff",
911  "<rPrevInfo.GetLevel() > 0> not hold. Serious defect." );
912  nListLevelsToBeOpened = rNextInfo.GetLevel() - rPrevInfo.GetLevel();
913  }
914 
915  if ( nListLevelsToBeOpened > 0 )
916  {
917  const OUString& sListStyleName( rNextInfo.GetNumRulesName() );
918  // Currently only the text documents support <ListId>.
919  // Thus, for other document types <sListId> is empty.
920  const OUString& sListId( rNextInfo.GetListId() );
921  bool bExportListStyle( true );
922  bool bRestartNumberingAtContinuedList( false );
923  sal_Int32 nRestartValueForContinuedList( -1 );
924  bool bContinueingPreviousSubList = !bRootListToBeStarted &&
925  rNextInfo.IsContinueingPreviousSubTree();
926  do {
927  GetExport().CheckAttrList();
928 
929  if ( bRootListToBeStarted )
930  {
931  if ( !mpTextListsHelper->IsListProcessed( sListId ) )
932  {
933  if ( bExportODF &&
934  eODFDefaultVersion >= SvtSaveOptions::ODFSVER_012 &&
935  !sListId.isEmpty() )
936  {
937  /* Property text:id at element <text:list> has to be
938  replaced by property xml:id (#i92221#)
939  */
940  GetExport().AddAttribute( XML_NAMESPACE_XML,
941  XML_ID,
942  sListId );
943  }
944  mpTextListsHelper->KeepListAsProcessed( sListId,
945  sListStyleName,
946  OUString() );
947  }
948  else
949  {
950  const OUString sNewListId(
951  mpTextListsHelper->GenerateNewListId() );
952  if ( bExportODF &&
953  eODFDefaultVersion >= SvtSaveOptions::ODFSVER_012 &&
954  !sListId.isEmpty() )
955  {
956  /* Property text:id at element <text:list> has to be
957  replaced by property xml:id (#i92221#)
958  */
959  GetExport().AddAttribute( XML_NAMESPACE_XML,
960  XML_ID,
961  sNewListId );
962  }
963 
964  const OUString sContinueListId =
965  mpTextListsHelper->GetLastContinuingListId( sListId );
966  // store that list with list id <sNewListId> is last list,
967  // which has continued list with list id <sListId>
968  mpTextListsHelper->StoreLastContinuingList( sListId,
969  sNewListId );
970  if ( sListStyleName ==
971  mpTextListsHelper->GetListStyleOfLastProcessedList() &&
972  // Inconsistent behavior regarding lists (#i92811#)
973  sContinueListId ==
974  mpTextListsHelper->GetLastProcessedListId() &&
975  !rNextInfo.IsRestart() )
976  {
977  GetExport().AddAttribute( XML_NAMESPACE_TEXT,
979  XML_TRUE );
980  }
981  else
982  {
983  if ( bExportODF &&
984  eODFDefaultVersion >= SvtSaveOptions::ODFSVER_012 &&
985  !sListId.isEmpty() )
986  {
987  GetExport().AddAttribute( XML_NAMESPACE_TEXT,
989  sContinueListId );
990  }
991 
992  if ( rNextInfo.IsRestart() &&
993  ( nListLevelsToBeOpened != 1 ||
994  !rNextInfo.HasStartValue() ) )
995  {
996  bRestartNumberingAtContinuedList = true;
997  nRestartValueForContinuedList =
998  rNextInfo.GetListLevelStartValue();
999  }
1000  }
1001 
1002  mpTextListsHelper->KeepListAsProcessed( sNewListId,
1003  sListStyleName,
1004  sContinueListId );
1005  }
1006 
1007  GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
1008  GetExport().EncodeStyleName( sListStyleName ) );
1009  bExportListStyle = false;
1010 
1011  bRootListToBeStarted = false;
1012  }
1013  else if ( bExportListStyle &&
1014  !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) )
1015  {
1016  GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME,
1017  GetExport().EncodeStyleName( sListStyleName ) );
1018  bExportListStyle = false;
1019 
1020  }
1021  else
1022  {
1023  // rhbz#746174: also export list restart for non root list
1024  if (rNextInfo.IsRestart() && !rNextInfo.HasStartValue())
1025  {
1026  bRestartNumberingAtContinuedList = true;
1027  nRestartValueForContinuedList =
1028  rNextInfo.GetListLevelStartValue();
1029  }
1030  }
1031 
1032  if ( bContinueingPreviousSubList )
1033  {
1034  GetExport().AddAttribute( XML_NAMESPACE_TEXT,
1036  bContinueingPreviousSubList = false;
1037  }
1038 
1039  enum XMLTokenEnum eLName = XML_LIST;
1040 
1041  OUString aElem(GetExport().GetNamespaceMap().GetQNameByKey(
1043  GetXMLToken(eLName) ) );
1044  GetExport().IgnorableWhitespace();
1045  GetExport().StartElement(aElem, false);
1046 
1047  maListElements.push_back(aElem);
1048 
1049  mpTextListsHelper->PushListOnStack( sListId,
1050  sListStyleName );
1051 
1052  // <text:list-header> or <text:list-item>
1053  GetExport().CheckAttrList();
1054 
1055  /* Export start value at correct list item (#i97309#) */
1056  if ( nListLevelsToBeOpened == 1 )
1057  {
1058  if ( rNextInfo.HasStartValue() )
1059  {
1060  OUStringBuffer aBuffer;
1061  aBuffer.append( static_cast<sal_Int32>(rNextInfo.GetStartValue()) );
1062  GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
1063  aBuffer.makeStringAndClear() );
1064  }
1065  else if (bRestartNumberingAtContinuedList)
1066  {
1067  GetExport().AddAttribute( XML_NAMESPACE_TEXT,
1069  OUString::number(nRestartValueForContinuedList) );
1070  bRestartNumberingAtContinuedList = false;
1071  }
1072  }
1073 
1074  eLName = ( rNextInfo.IsNumbered() || nListLevelsToBeOpened > 1 )
1075  ? XML_LIST_ITEM
1076  : XML_LIST_HEADER;
1077  aElem = GetExport().GetNamespaceMap().GetQNameByKey(
1079  GetXMLToken(eLName) );
1080  GetExport().IgnorableWhitespace();
1081  GetExport().StartElement(aElem, false);
1082  maListElements.push_back(aElem);
1083 
1084  // export of <text:number> element for last opened <text:list-item>, if requested
1085  if ( GetExport().exportTextNumberElement() &&
1086  eLName == XML_LIST_ITEM && nListLevelsToBeOpened == 1 && // last iteration --> last opened <text:list-item>
1087  !rNextInfo.ListLabelString().isEmpty() )
1088  {
1089  const OUString aTextNumberElem =
1090  GetExport().GetNamespaceMap().GetQNameByKey(
1093  GetExport().IgnorableWhitespace();
1094  GetExport().StartElement( aTextNumberElem, false );
1095  GetExport().Characters( rNextInfo.ListLabelString() );
1096  GetExport().EndElement( aTextNumberElem, true );
1097  }
1098  --nListLevelsToBeOpened;
1099  } while ( nListLevelsToBeOpened > 0 );
1100  }
1101  }
1102 
1103  bool bEndElement = false;
1104 
1105  if ( rNextInfo.GetLevel() > 0 &&
1106  rNextInfo.IsNumbered() &&
1107  rPrevInfo.BelongsToSameList( rNextInfo ) &&
1108  rPrevInfo.GetLevel() >= rNextInfo.GetLevel() )
1109  {
1110  assert(maListElements.size() >= 2 && "list elements missing");
1111  bEndElement = maListElements.size() >= 2;
1112  }
1113 
1114  if (!bEndElement)
1115  return;
1116 
1117  // close previous list-item
1118  GetExport().EndElement(maListElements.back(), true );
1119  maListElements.pop_back();
1120 
1121  // Only for sub lists (#i103745#)
1122  if ( rNextInfo.IsRestart() && !rNextInfo.HasStartValue() &&
1123  rNextInfo.GetLevel() != 1 )
1124  {
1125  // start new sub list respectively list on same list level
1126  GetExport().EndElement(maListElements.back(), true );
1127  GetExport().IgnorableWhitespace();
1128  GetExport().StartElement(maListElements.back(), false);
1129  }
1130 
1131  // open new list-item
1132  GetExport().CheckAttrList();
1133  if( rNextInfo.HasStartValue() )
1134  {
1135  OUStringBuffer aBuffer;
1136  aBuffer.append( static_cast<sal_Int32>(rNextInfo.GetStartValue()) );
1137  GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
1138  aBuffer.makeStringAndClear() );
1139  }
1140  // Handle restart without start value on list level 1 (#i103745#)
1141  else if ( rNextInfo.IsRestart() &&
1142  rNextInfo.GetLevel() == 1 )
1143  {
1144  OUStringBuffer aBuffer;
1145  aBuffer.append( static_cast<sal_Int32>(rNextInfo.GetListLevelStartValue()) );
1146  GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE,
1147  aBuffer.makeStringAndClear() );
1148  }
1149  if ( ( GetExport().getExportFlags() & SvXMLExportFlags::OASIS ) &&
1150  GetExport().getSaneDefaultVersion() >= SvtSaveOptions::ODFSVER_012)
1151  {
1152  const OUString& sListStyleName( rNextInfo.GetNumRulesName() );
1153  if ( !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) )
1154  {
1155  GetExport().AddAttribute( XML_NAMESPACE_TEXT,
1157  GetExport().EncodeStyleName( sListStyleName ) );
1158  }
1159  }
1160  OUString aElem( GetExport().GetNamespaceMap().GetQNameByKey(
1163  GetExport().IgnorableWhitespace();
1164  GetExport().StartElement(aElem, false );
1165  maListElements.push_back(aElem);
1166 
1167  // export of <text:number> element for <text:list-item>, if requested
1168  if ( GetExport().exportTextNumberElement() &&
1169  !rNextInfo.ListLabelString().isEmpty() )
1170  {
1171  const OUString aTextNumberElem =
1172  GetExport().GetNamespaceMap().GetQNameByKey(
1175  GetExport().IgnorableWhitespace();
1176  GetExport().StartElement( aTextNumberElem, false );
1177  GetExport().Characters( rNextInfo.ListLabelString() );
1178  GetExport().EndElement( aTextNumberElem, true );
1179  }
1180 
1181 }
1182 
1184 {
1185  typedef ::std::map<Reference<XFormField>, sal_Int32> FieldMarkMap_t;
1186  FieldMarkMap_t m_FieldMarkMap;
1187 
1188  explicit Impl() {}
1189  sal_Int32 AddFieldMarkStart(Reference<XFormField> const& i_xFieldMark)
1190  {
1191  assert(m_FieldMarkMap.find(i_xFieldMark) == m_FieldMarkMap.end());
1192  sal_Int32 const ret(m_FieldMarkMap.size());
1193  m_FieldMarkMap.insert(::std::make_pair(i_xFieldMark, ret));
1194  return ret;
1195  }
1196  sal_Int32 GetFieldMarkIndex(Reference<XFormField> const& i_xFieldMark)
1197  {
1198  FieldMarkMap_t::const_iterator const it(
1199  m_FieldMarkMap.find(i_xFieldMark));
1200  // rely on SwXFieldmark::CreateXFieldmark returning the same instance
1201  // because the Reference in m_FieldMarkMap will keep it alive
1202  assert(it != m_FieldMarkMap.end());
1203  return it->second;
1204  }
1205 };
1206 
1208  SvXMLExport& rExp,
1209  SvXMLAutoStylePoolP & rASP
1210  ) :
1211  XMLStyleExport( rExp, &rASP ),
1212  m_xImpl(new Impl),
1213  rAutoStylePool( rASP ),
1214  pBoundFrameSets(new BoundFrameSets(GetExport().GetModel())),
1215  maListAutoPool( GetExport() ),
1216  bProgress( false ),
1217  bBlock( false ),
1218  bOpenRuby( false ),
1219  mpTextListsHelper( nullptr ),
1220  mbCollected(false),
1221  aCharStyleNamesPropInfoCache( gsCharStyleNames )
1222 {
1225  GetExport() );
1226 
1227  OUString sFamily( GetXMLToken(XML_PARAGRAPH) );
1228  OUString aPrefix(u'P');
1230  xParaPropMapper, aPrefix );
1231 
1232  xPropMapper = new XMLTextPropertySetMapper( TextPropMap::TEXT, true );
1234  GetExport() );
1235  sFamily = GetXMLToken(XML_TEXT);
1236  aPrefix = "T";
1238  xTextPropMapper, aPrefix );
1239 
1240  xPropMapper = new XMLTextPropertySetMapper( TextPropMap::AUTO_FRAME, true );
1242  GetExport() );
1244  aPrefix = "fr";
1246  xAutoFramePropMapper, aPrefix );
1247 
1248  xPropMapper = new XMLTextPropertySetMapper( TextPropMap::SECTION, true );
1250  GetExport() );
1251  sFamily = GetXMLToken( XML_SECTION );
1252  aPrefix = "Sect" ;
1254  xSectionPropMapper, aPrefix );
1255 
1256  xPropMapper = new XMLTextPropertySetMapper( TextPropMap::RUBY, true );
1257  xRubyPropMapper = new SvXMLExportPropertyMapper( xPropMapper );
1258  sFamily = GetXMLToken( XML_RUBY );
1259  aPrefix = "Ru";
1261  xRubyPropMapper, aPrefix );
1262 
1263  xPropMapper = new XMLTextPropertySetMapper( TextPropMap::FRAME, true );
1265  GetExport() );
1266 
1267  pSectionExport.reset( new XMLSectionExport( rExp, *this ) );
1268  pIndexMarkExport.reset( new XMLIndexMarkExport( rExp ) );
1269 
1270  if( ! IsBlockMode() &&
1271  Reference<XRedlinesSupplier>( GetExport().GetModel(), UNO_QUERY ).is())
1272  pRedlineExport.reset( new XMLRedlineExport( rExp ) );
1273 
1274  // The text field helper needs a pre-constructed XMLPropertyState
1275  // to export the combined characters field. We construct that
1276  // here, because we need the text property mapper to do it.
1277 
1278  // construct Any value, then find index
1279  sal_Int32 nIndex = xTextPropMapper->getPropertySetMapper()->FindEntryIndex(
1280  "", XML_NAMESPACE_STYLE,
1282  pFieldExport.reset( new XMLTextFieldExport( rExp, std::make_unique<XMLPropertyState>( nIndex, uno::makeAny(true) ) ) );
1284 }
1285 
1287 {
1288  pRedlineExport.reset();
1289  pIndexMarkExport.reset();
1290  pSectionExport.reset();
1291  pFieldExport.reset();
1292 #ifdef DBG_UTIL
1293  txtparae_bContainsIllegalCharacters = false;
1294 #endif
1296  SAL_WARN_IF( !maTextListsHelperStack.empty(), "xmloff",
1297  "misusage of text lists helper stack - it is not empty. Serious defect" );
1298 }
1299 
1301  SvXMLExport& rExport )
1302 {
1305  return new XMLTextExportPropertySetMapper( xPropMapper, rExport );
1306 }
1307 
1309  SvXMLExport& rExport)
1310 {
1311  XMLPropertySetMapper *pPropMapper =
1313  return new XMLTextExportPropertySetMapper( pPropMapper, rExport );
1314 }
1315 
1317  SvXMLExport& rExport)
1318 {
1319  XMLPropertySetMapper *pPropMapper =
1321  return new XMLTextExportPropertySetMapper( pPropMapper, rExport );
1322 }
1323 
1325  SvXMLExport& rExport)
1326 {
1327  XMLPropertySetMapper *pPropMapper =
1329  return new XMLTextExportPropertySetMapper( pPropMapper, rExport );
1330 }
1331 
1333 {
1334  const TextContentSet& rTexts = pBoundFrameSets->GetTexts()->GetPageBoundContents();
1335  const TextContentSet& rGraphics = pBoundFrameSets->GetGraphics()->GetPageBoundContents();
1336  const TextContentSet& rEmbeddeds = pBoundFrameSets->GetEmbeddeds()->GetPageBoundContents();
1337  const TextContentSet& rShapes = pBoundFrameSets->GetShapes()->GetPageBoundContents();
1338  for(TextContentSet::const_iterator_t it = rTexts.getBegin();
1339  it != rTexts.getEnd();
1340  ++it)
1341  exportTextFrame(*it, false/*bAutoStyles*/, bIsProgress, true);
1342  for(TextContentSet::const_iterator_t it = rGraphics.getBegin();
1343  it != rGraphics.getEnd();
1344  ++it)
1345  exportTextGraphic(*it, false/*bAutoStyles*/);
1346  for(TextContentSet::const_iterator_t it = rEmbeddeds.getBegin();
1347  it != rEmbeddeds.getEnd();
1348  ++it)
1349  exportTextEmbedded(*it, false/*bAutoStyles*/);
1350  for(TextContentSet::const_iterator_t it = rShapes.getBegin();
1351  it != rShapes.getEnd();
1352  ++it)
1353  exportShape(*it, false/*bAutoStyles*/);
1354 }
1355 
1357  bool bAutoStyles,
1358  bool bIsProgress,
1359  const Reference < XTextFrame > *pParentTxtFrame )
1360 {
1361  const TextContentSet* const pTexts = pBoundFrameSets->GetTexts()->GetFrameBoundContents(*pParentTxtFrame);
1362  if(pTexts)
1363  for(TextContentSet::const_iterator_t it = pTexts->getBegin();
1364  it != pTexts->getEnd();
1365  ++it)
1366  exportTextFrame(*it, bAutoStyles, bIsProgress, true);
1367  const TextContentSet* const pGraphics = pBoundFrameSets->GetGraphics()->GetFrameBoundContents(*pParentTxtFrame);
1368  if(pGraphics)
1369  for(TextContentSet::const_iterator_t it = pGraphics->getBegin();
1370  it != pGraphics->getEnd();
1371  ++it)
1372  exportTextGraphic(*it, bAutoStyles);
1373  const TextContentSet* const pEmbeddeds = pBoundFrameSets->GetEmbeddeds()->GetFrameBoundContents(*pParentTxtFrame);
1374  if(pEmbeddeds)
1375  for(TextContentSet::const_iterator_t it = pEmbeddeds->getBegin();
1376  it != pEmbeddeds->getEnd();
1377  ++it)
1378  exportTextEmbedded(*it, bAutoStyles);
1379  const TextContentSet* const pShapes = pBoundFrameSets->GetShapes()->GetFrameBoundContents(*pParentTxtFrame);
1380  if(pShapes)
1381  for(TextContentSet::const_iterator_t it = pShapes->getBegin();
1382  it != pShapes->getEnd();
1383  ++it)
1384  exportShape(*it, bAutoStyles);
1385 }
1386 
1387 // bookmarks, reference marks (and TOC marks) are the same except for the
1388 // element names. We use the same method for export and it an array with
1389 // the proper element names
1394 
1395 // This function replaces the text portion iteration during auto style
1396 // collection.
1398 {
1399  GetExport().GetShapeExport(); // make sure the graphics styles family is added
1400 
1401  if (mbCollected)
1402  return;
1403 
1404  const bool bAutoStyles = true;
1405  const bool bExportContent = false;
1406 
1407  // Export AutoStyles:
1408  Reference< XAutoStylesSupplier > xAutoStylesSupp( GetExport().GetModel(), UNO_QUERY );
1409  if ( xAutoStylesSupp.is() )
1410  {
1411  Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles();
1412  const auto collectFamily = [this, &xAutoStyleFamilies](const OUString& sName,
1413  XmlStyleFamily nFamily) {
1414  Any aAny = xAutoStyleFamilies->getByName( sName );
1415  Reference< XAutoStyleFamily > xAutoStyles = *o3tl::doAccess<Reference<XAutoStyleFamily>>(aAny);
1416  Reference < XEnumeration > xAutoStylesEnum( xAutoStyles->createEnumeration() );
1417 
1418  while ( xAutoStylesEnum->hasMoreElements() )
1419  {
1420  aAny = xAutoStylesEnum->nextElement();
1421  Reference< XAutoStyle > xAutoStyle = *o3tl::doAccess<Reference<XAutoStyle>>(aAny);
1422  Reference < XPropertySet > xPSet( xAutoStyle, uno::UNO_QUERY );
1423  Add( nFamily, xPSet, {}, true );
1424  }
1425  };
1426  collectFamily("CharacterStyles", XmlStyleFamily::TEXT_TEXT);
1427  collectFamily("RubyStyles", XmlStyleFamily::TEXT_RUBY);
1428  collectFamily("ParagraphStyles", XmlStyleFamily::TEXT_PARAGRAPH);
1429  }
1430 
1431  // Export Field AutoStyles:
1432  Reference< XTextFieldsSupplier > xTextFieldsSupp( GetExport().GetModel(), UNO_QUERY );
1433  if ( xTextFieldsSupp.is() )
1434  {
1435  Reference< XEnumerationAccess > xTextFields = xTextFieldsSupp->getTextFields();
1436  Reference < XEnumeration > xTextFieldsEnum( xTextFields->createEnumeration() );
1437 
1438  while ( xTextFieldsEnum->hasMoreElements() )
1439  {
1440  Any aAny = xTextFieldsEnum->nextElement();
1441  Reference< XTextField > xTextField = *o3tl::doAccess<Reference<XTextField>>(aAny);
1442  exportTextField( xTextField, bAutoStyles, bIsProgress,
1443  !xAutoStylesSupp.is(), nullptr );
1444  try
1445  {
1446  Reference < XPropertySet > xSet( xTextField, UNO_QUERY );
1447  Reference < XText > xText;
1448  Any a = xSet->getPropertyValue("TextRange");
1449  a >>= xText;
1450  if ( xText.is() )
1451  {
1452  exportText( xText, true, bIsProgress, bExportContent );
1454  ->collectTextAutoStyles( xText );
1455  }
1456  }
1457  catch (Exception&)
1458  {
1459  }
1460  }
1461  }
1462 
1463  // Export text frames:
1464  Reference<XEnumeration> xTextFramesEnum = pBoundFrameSets->GetTexts()->createEnumeration();
1465  if(xTextFramesEnum.is())
1466  while(xTextFramesEnum->hasMoreElements())
1467  {
1468  Reference<XTextContent> xTxtCntnt(xTextFramesEnum->nextElement(), UNO_QUERY);
1469  if(xTxtCntnt.is())
1470  exportTextFrame(xTxtCntnt, bAutoStyles, bIsProgress, bExportContent);
1471  }
1472 
1473  // Export graphic objects:
1474  Reference<XEnumeration> xGraphicsEnum = pBoundFrameSets->GetGraphics()->createEnumeration();
1475  if(xGraphicsEnum.is())
1476  while(xGraphicsEnum->hasMoreElements())
1477  {
1478  Reference<XTextContent> xTxtCntnt(xGraphicsEnum->nextElement(), UNO_QUERY);
1479  if(xTxtCntnt.is())
1480  exportTextGraphic(xTxtCntnt, true);
1481  }
1482 
1483  // Export embedded objects:
1484  Reference<XEnumeration> xEmbeddedsEnum = pBoundFrameSets->GetEmbeddeds()->createEnumeration();
1485  if(xEmbeddedsEnum.is())
1486  while(xEmbeddedsEnum->hasMoreElements())
1487  {
1488  Reference<XTextContent> xTxtCntnt(xEmbeddedsEnum->nextElement(), UNO_QUERY);
1489  if(xTxtCntnt.is())
1490  exportTextEmbedded(xTxtCntnt, true);
1491  }
1492 
1493  // Export shapes:
1494  Reference<XEnumeration> xShapesEnum = pBoundFrameSets->GetShapes()->createEnumeration();
1495  if(xShapesEnum.is())
1496  while(xShapesEnum->hasMoreElements())
1497  {
1498  Reference<XTextContent> xTxtCntnt(xShapesEnum->nextElement(), UNO_QUERY);
1499  if(xTxtCntnt.is())
1500  {
1501  Reference<XServiceInfo> xServiceInfo(xTxtCntnt, UNO_QUERY);
1502  if( xServiceInfo->supportsService(gsShapeService))
1503  exportShape(xTxtCntnt, true);
1504  }
1505  }
1506 
1507  sal_Int32 nCount;
1508  // AutoStyles for sections
1509  Reference< XTextSectionsSupplier > xSectionsSupp( GetExport().GetModel(), UNO_QUERY );
1510  if ( xSectionsSupp.is() )
1511  {
1512  Reference< XIndexAccess > xSections( xSectionsSupp->getTextSections(), UNO_QUERY );
1513  if ( xSections.is() )
1514  {
1515  nCount = xSections->getCount();
1516  for( sal_Int32 i = 0; i < nCount; ++i )
1517  {
1518  Any aAny = xSections->getByIndex( i );
1519  Reference< XTextSection > xSection = *o3tl::doAccess<Reference<XTextSection>>(aAny);
1520  Reference < XPropertySet > xPSet( xSection, uno::UNO_QUERY );
1522  }
1523  }
1524  }
1525 
1526  // AutoStyles for tables (Note: suppress autostyle collection for paragraphs in exportTable)
1527  Reference< XTextTablesSupplier > xTablesSupp( GetExport().GetModel(), UNO_QUERY );
1528  if ( xTablesSupp.is() )
1529  {
1530  Reference< XIndexAccess > xTables( xTablesSupp->getTextTables(), UNO_QUERY );
1531  if ( xTables.is() )
1532  {
1533  nCount = xTables->getCount();
1534  for( sal_Int32 i = 0; i < nCount; ++i )
1535  {
1536  Any aAny = xTables->getByIndex( i );
1537  Reference< XTextTable > xTable = *o3tl::doAccess<Reference<XTextTable>>(aAny);
1538  exportTable( xTable, true, true );
1539  }
1540  }
1541  }
1542 
1543  Reference< XNumberingRulesSupplier > xNumberingRulesSupp( GetExport().GetModel(), UNO_QUERY );
1544  if ( xNumberingRulesSupp.is() )
1545  {
1546  Reference< XIndexAccess > xNumberingRules = xNumberingRulesSupp->getNumberingRules();
1547  nCount = xNumberingRules->getCount();
1548  // Custom outline assignment lost after re-importing sxw (#i73361#)
1549  for( sal_Int32 i = 0; i < nCount; ++i )
1550  {
1551  Reference< XIndexReplace > xNumRule( xNumberingRules->getByIndex( i ), UNO_QUERY );
1552  if( xNumRule.is() && xNumRule->getCount() )
1553  {
1554  Reference < XNamed > xNamed( xNumRule, UNO_QUERY );
1555  OUString sName;
1556  if( xNamed.is() )
1557  sName = xNamed->getName();
1558  bool bAdd = sName.isEmpty();
1559  if( !bAdd )
1560  {
1561  Reference < XPropertySet > xNumPropSet( xNumRule,
1562  UNO_QUERY );
1563  if( xNumPropSet.is() &&
1564  xNumPropSet->getPropertySetInfo()
1565  ->hasPropertyByName( "IsAutomatic" ) )
1566  {
1567  bAdd = *o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "IsAutomatic" ));
1568  // Check on outline style (#i73361#)
1569  if ( bAdd &&
1570  xNumPropSet->getPropertySetInfo()
1571  ->hasPropertyByName( "NumberingIsOutline" ) )
1572  {
1573  bAdd = !(*o3tl::doAccess<bool>(xNumPropSet->getPropertyValue( "NumberingIsOutline" )));
1574  }
1575  }
1576  else
1577  {
1578  bAdd = true;
1579  }
1580  }
1581  if( bAdd )
1582  maListAutoPool.Add( xNumRule );
1583  }
1584  }
1585  }
1586  mbCollected = true;
1587 }
1588 
1590  const Reference < XText > & rText,
1591  bool bAutoStyles,
1592  bool bIsProgress,
1593  bool bExportParagraph,
1594  TextPNS eExtensionNS)
1595 {
1596  if( bAutoStyles )
1597  GetExport().GetShapeExport(); // make sure the graphics styles family
1598  // is added
1599  Reference < XEnumerationAccess > xEA( rText, UNO_QUERY );
1600  if( ! xEA.is() )
1601  return;
1602 
1603  Reference < XEnumeration > xParaEnum(xEA->createEnumeration());
1604  Reference < XPropertySet > xPropertySet( rText, UNO_QUERY );
1605  Reference < XTextSection > xBaseSection;
1606 
1607  // #97718# footnotes don't supply paragraph enumerations in some cases
1608  // This is always a bug, but at least we don't want to crash.
1609  SAL_WARN_IF( !xParaEnum.is(), "xmloff", "We need a paragraph enumeration" );
1610  if( ! xParaEnum.is() )
1611  return;
1612 
1613  if (xPropertySet.is())
1614  {
1615  Reference < XPropertySetInfo > xInfo ( xPropertySet->getPropertySetInfo() );
1616 
1617  if( xInfo.is() )
1618  {
1619  if (xInfo->hasPropertyByName( gsTextSection ))
1620  {
1621  xPropertySet->getPropertyValue(gsTextSection) >>= xBaseSection ;
1622  }
1623  }
1624  }
1625 
1626  // #96530# Export redlines at start & end of XText before & after
1627  // exporting the text content enumeration
1628  if( !bAutoStyles && (pRedlineExport != nullptr) )
1629  pRedlineExport->ExportStartOrEndRedline( xPropertySet, true );
1630  exportTextContentEnumeration( xParaEnum, bAutoStyles, xBaseSection,
1631  bIsProgress, bExportParagraph, nullptr, eExtensionNS );
1632  if( !bAutoStyles && (pRedlineExport != nullptr) )
1633  pRedlineExport->ExportStartOrEndRedline( xPropertySet, false );
1634 }
1635 
1637  const Reference < XText > & rText,
1638  const Reference < XTextSection > & rBaseSection,
1639  bool bAutoStyles,
1640  bool bIsProgress,
1641  bool bExportParagraph)
1642 {
1643  if( bAutoStyles )
1644  GetExport().GetShapeExport(); // make sure the graphics styles family
1645  // is added
1646  Reference < XEnumerationAccess > xEA( rText, UNO_QUERY );
1647  Reference < XEnumeration > xParaEnum(xEA->createEnumeration());
1648 
1649  // #98165# don't continue without a paragraph enumeration
1650  if( ! xParaEnum.is() )
1651  return;
1652 
1653  // #96530# Export redlines at start & end of XText before & after
1654  // exporting the text content enumeration
1655  Reference<XPropertySet> xPropertySet;
1656  if( !bAutoStyles && (pRedlineExport != nullptr) )
1657  {
1658  xPropertySet.set(rText, uno::UNO_QUERY );
1659  pRedlineExport->ExportStartOrEndRedline( xPropertySet, true );
1660  }
1661  exportTextContentEnumeration( xParaEnum, bAutoStyles, rBaseSection,
1662  bIsProgress, bExportParagraph );
1663  if( !bAutoStyles && (pRedlineExport != nullptr) )
1664  pRedlineExport->ExportStartOrEndRedline( xPropertySet, false );
1665 }
1666 
1668  const Reference < XEnumeration > & rContEnum,
1669  bool bAutoStyles,
1670  const Reference < XTextSection > & rBaseSection,
1671  bool bIsProgress,
1672  bool bExportParagraph,
1673  const Reference < XPropertySet > *pRangePropSet,
1674  TextPNS eExtensionNS )
1675 {
1676  SAL_WARN_IF( !rContEnum.is(), "xmloff", "No enumeration to export!" );
1677  bool bHasMoreElements = rContEnum->hasMoreElements();
1678  if( !bHasMoreElements )
1679  return;
1680 
1681  XMLTextNumRuleInfo aPrevNumInfo;
1682  XMLTextNumRuleInfo aNextNumInfo;
1683 
1684  bool bHasContent = false;
1685  Reference<XTextSection> xCurrentTextSection(rBaseSection);
1686 
1687  MultiPropertySetHelper aPropSetHelper(
1688  bAutoStyles ? aParagraphPropertyNamesAuto :
1689  aParagraphPropertyNames );
1690 
1691  bool bHoldElement = false;
1692  Reference < XTextContent > xTxtCntnt;
1693  while( bHoldElement || bHasMoreElements )
1694  {
1695  if (bHoldElement)
1696  {
1697  bHoldElement = false;
1698  }
1699  else
1700  {
1701  xTxtCntnt.set(rContEnum->nextElement(), uno::UNO_QUERY);
1702 
1703  aPropSetHelper.resetValues();
1704 
1705  }
1706 
1707  Reference<XServiceInfo> xServiceInfo( xTxtCntnt, UNO_QUERY );
1708  if( xServiceInfo->supportsService( gsParagraphService ) )
1709  {
1710  if( bAutoStyles )
1711  {
1712  exportListAndSectionChange( xCurrentTextSection, xTxtCntnt,
1713  aPrevNumInfo, aNextNumInfo,
1714  bAutoStyles );
1715  }
1716  else
1717  {
1718  /* Pass list auto style pool to <XMLTextNumRuleInfo> instance
1719  Pass info about request to export <text:number> element
1720  to <XMLTextNumRuleInfo> instance (#i69627#)
1721  */
1722  aNextNumInfo.Set( xTxtCntnt,
1723  GetExport().writeOutlineStyleAsNormalListStyle(),
1725  GetExport().exportTextNumberElement() );
1726 
1727  exportListAndSectionChange( xCurrentTextSection, aPropSetHelper,
1728  TEXT_SECTION, xTxtCntnt,
1729  aPrevNumInfo, aNextNumInfo,
1730  bAutoStyles );
1731  }
1732 
1733  // if we found a mute section: skip all section content
1734  if (pSectionExport->IsMuteSection(xCurrentTextSection))
1735  {
1736  // Make sure headings are exported anyway.
1737  if( !bAutoStyles )
1738  pSectionExport->ExportMasterDocHeadingDummies();
1739 
1740  while (rContEnum->hasMoreElements() &&
1741  XMLSectionExport::IsInSection( xCurrentTextSection,
1742  xTxtCntnt, true ))
1743  {
1744  xTxtCntnt.set(rContEnum->nextElement(), uno::UNO_QUERY);
1745  aPropSetHelper.resetValues();
1746  aNextNumInfo.Reset();
1747  }
1748  // the first non-mute element still needs to be processed
1749  bHoldElement =
1750  ! XMLSectionExport::IsInSection( xCurrentTextSection,
1751  xTxtCntnt, false );
1752  }
1753  else
1754  exportParagraph( xTxtCntnt, bAutoStyles, bIsProgress,
1755  bExportParagraph, aPropSetHelper, eExtensionNS );
1756  bHasContent = true;
1757  }
1758  else if( xServiceInfo->supportsService( gsTableService ) )
1759  {
1760  if( !bAutoStyles )
1761  {
1762  aNextNumInfo.Reset();
1763  }
1764 
1765  exportListAndSectionChange( xCurrentTextSection, xTxtCntnt,
1766  aPrevNumInfo, aNextNumInfo,
1767  bAutoStyles );
1768 
1769  if (! pSectionExport->IsMuteSection(xCurrentTextSection))
1770  {
1771  // export start + end redlines (for wholly redlined tables)
1772  if ((! bAutoStyles) && (nullptr != pRedlineExport))
1773  pRedlineExport->ExportStartOrEndRedline(xTxtCntnt, true);
1774 
1775  exportTable( xTxtCntnt, bAutoStyles, bIsProgress );
1776 
1777  if ((! bAutoStyles) && (nullptr != pRedlineExport))
1778  pRedlineExport->ExportStartOrEndRedline(xTxtCntnt, false);
1779  }
1780  else if( !bAutoStyles )
1781  {
1782  // Make sure headings are exported anyway.
1783  pSectionExport->ExportMasterDocHeadingDummies();
1784  }
1785 
1786  bHasContent = true;
1787  }
1788  else if( xServiceInfo->supportsService( gsTextFrameService ) )
1789  {
1790  exportTextFrame( xTxtCntnt, bAutoStyles, bIsProgress, true, pRangePropSet );
1791  }
1792  else if( xServiceInfo->supportsService( gsTextGraphicService ) )
1793  {
1794  exportTextGraphic( xTxtCntnt, bAutoStyles, pRangePropSet );
1795  }
1796  else if( xServiceInfo->supportsService( gsTextEmbeddedService ) )
1797  {
1798  exportTextEmbedded( xTxtCntnt, bAutoStyles, pRangePropSet );
1799  }
1800  else if( xServiceInfo->supportsService( gsShapeService ) )
1801  {
1802  exportShape( xTxtCntnt, bAutoStyles, pRangePropSet );
1803  }
1804  else
1805  {
1806  SAL_WARN_IF( xTxtCntnt.is(), "xmloff", "unknown text content" );
1807  }
1808 
1809  if( !bAutoStyles )
1810  {
1811  aPrevNumInfo = aNextNumInfo;
1812  }
1813 
1814  bHasMoreElements = rContEnum->hasMoreElements();
1815  }
1816 
1817  if( bHasContent && !bAutoStyles )
1818  {
1819  aNextNumInfo.Reset();
1820 
1821  // close open lists and sections; no new styles
1822  exportListAndSectionChange( xCurrentTextSection, rBaseSection,
1823  aPrevNumInfo, aNextNumInfo,
1824  bAutoStyles );
1825  }
1826 }
1827 
1829  const Reference < XTextContent > & rTextContent,
1830  bool bAutoStyles, bool bIsProgress, bool bExportParagraph,
1831  MultiPropertySetHelper& rPropSetHelper, TextPNS eExtensionNS)
1832 {
1833  sal_Int16 nOutlineLevel = -1;
1834 
1835  if( bIsProgress )
1836  {
1838  pProgress->SetValue( pProgress->GetValue()+1 );
1839  }
1840 
1841  // get property set or multi property set and initialize helper
1842  Reference<XMultiPropertySet> xMultiPropSet( rTextContent, UNO_QUERY );
1843  Reference<XPropertySet> xPropSet( rTextContent, UNO_QUERY );
1844 
1845  // check for supported properties
1846  if( !rPropSetHelper.checkedProperties() )
1847  rPropSetHelper.hasProperties( xPropSet->getPropertySetInfo() );
1848 
1849 // if( xMultiPropSet.is() )
1850 // rPropSetHelper.getValues( xMultiPropSet );
1851 // else
1852 // rPropSetHelper.getValues( xPropSet );
1853 
1854  if( bExportParagraph )
1855  {
1856  if( bAutoStyles )
1857  {
1858  Add( XmlStyleFamily::TEXT_PARAGRAPH, rPropSetHelper, xPropSet );
1859  }
1860  else
1861  {
1862  // xml:id for RDF metadata
1863  GetExport().AddAttributeXmlId(rTextContent);
1864  GetExport().AddAttributesRDFa(rTextContent);
1865 
1866  OUString sStyle;
1867  if( rPropSetHelper.hasProperty( PARA_STYLE_NAME ) )
1868  {
1869  if( xMultiPropSet.is() )
1870  rPropSetHelper.getValue( PARA_STYLE_NAME,
1871  xMultiPropSet ) >>= sStyle;
1872  else
1873  rPropSetHelper.getValue( PARA_STYLE_NAME,
1874  xPropSet ) >>= sStyle;
1875  }
1876 
1877  if( rTextContent.is() )
1878  {
1879  const OUString& rIdentifier = GetExport().getInterfaceToIdentifierMapper().getIdentifier( rTextContent );
1880  if( !rIdentifier.isEmpty() )
1881  {
1882  // FIXME: this is just temporary until EditEngine
1883  // paragraphs implement XMetadatable.
1884  // then that must be used and not the mapper, because
1885  // when both can be used we get two xml:id!
1886  uno::Reference<rdf::XMetadatable> const xMeta(rTextContent,
1887  uno::UNO_QUERY);
1888  OSL_ENSURE(!xMeta.is(), "paragraph that implements "
1889  "XMetadatable used in interfaceToIdentifierMapper?");
1891  rIdentifier);
1892  }
1893  }
1894 
1895  OUString sAutoStyle = Find( XmlStyleFamily::TEXT_PARAGRAPH, xPropSet, sStyle );
1896  if ( sAutoStyle.isEmpty() )
1897  sAutoStyle = sStyle;
1898  if( !sAutoStyle.isEmpty() )
1900  GetExport().EncodeStyleName( sAutoStyle ) );
1901 
1902  if( rPropSetHelper.hasProperty( PARA_CONDITIONAL_STYLE_NAME ) )
1903  {
1904  OUString sCondStyle;
1905  if( xMultiPropSet.is() )
1906  rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME,
1907  xMultiPropSet ) >>= sCondStyle;
1908  else
1909  rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME,
1910  xPropSet ) >>= sCondStyle;
1911  if( sCondStyle != sStyle )
1912  {
1913  sCondStyle = Find( XmlStyleFamily::TEXT_PARAGRAPH, xPropSet,
1914  sCondStyle );
1915  if( !sCondStyle.isEmpty() )
1918  GetExport().EncodeStyleName( sCondStyle ) );
1919  }
1920  }
1921 
1922  if( rPropSetHelper.hasProperty( PARA_OUTLINE_LEVEL ) )
1923  {
1924  if( xMultiPropSet.is() )
1925  rPropSetHelper.getValue( PARA_OUTLINE_LEVEL,
1926  xMultiPropSet ) >>= nOutlineLevel;
1927  else
1928  rPropSetHelper.getValue( PARA_OUTLINE_LEVEL,
1929  xPropSet ) >>= nOutlineLevel;
1930 
1931  if( 0 < nOutlineLevel )
1932  {
1935  OUString::number( sal_Int32( nOutlineLevel) ) );
1936 
1937  if ( rPropSetHelper.hasProperty( PARA_OUTLINE_CONTENT_VISIBLE ) )
1938  {
1939  uno::Sequence<beans::PropertyValue> propList;
1940  bool bIsOutlineContentVisible = true;
1941  if( xMultiPropSet.is() )
1942  rPropSetHelper.getValue(
1943  PARA_OUTLINE_CONTENT_VISIBLE, xMultiPropSet ) >>= propList;
1944  else
1945  rPropSetHelper.getValue(
1946  PARA_OUTLINE_CONTENT_VISIBLE, xPropSet ) >>= propList;
1947  for (const auto& rProp : std::as_const(propList))
1948  {
1949  OUString propName = rProp.Name;
1950  if (propName == "OutlineContentVisibleAttr")
1951  {
1952  rProp.Value >>= bIsOutlineContentVisible;
1953  break;
1954  }
1955  }
1956  if (!bIsOutlineContentVisible)
1957  {
1960  XML_FALSE);
1961  }
1962  }
1963 
1964  if( rPropSetHelper.hasProperty( NUMBERING_IS_NUMBER ) )
1965  {
1966  bool bIsNumber = false;
1967  if( xMultiPropSet.is() )
1968  rPropSetHelper.getValue(
1969  NUMBERING_IS_NUMBER, xMultiPropSet ) >>= bIsNumber;
1970  else
1971  rPropSetHelper.getValue(
1972  NUMBERING_IS_NUMBER, xPropSet ) >>= bIsNumber;
1973 
1974  OUString sListStyleName;
1975  if( xMultiPropSet.is() )
1976  rPropSetHelper.getValue(
1977  PARA_NUMBERING_STYLENAME, xMultiPropSet ) >>= sListStyleName;
1978  else
1979  rPropSetHelper.getValue(
1980  PARA_NUMBERING_STYLENAME, xPropSet ) >>= sListStyleName;
1981 
1982  bool bAssignedtoOutlineStyle = false;
1983  {
1984  Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(), UNO_QUERY );
1985 
1986  if (xCNSupplier.is())
1987  {
1988  Reference< XIndexReplace > xNumRule ( xCNSupplier->getChapterNumberingRules() );
1989  SAL_WARN_IF( !xNumRule.is(), "xmloff", "no chapter numbering rules" );
1990 
1991  if (xNumRule.is())
1992  {
1993  Reference< XPropertySet > xNumRulePropSet( xNumRule, UNO_QUERY );
1994  OUString sOutlineName;
1995  xNumRulePropSet->getPropertyValue(
1996  "Name" ) >>= sOutlineName;
1997  bAssignedtoOutlineStyle = ( sListStyleName == sOutlineName );
1998  }
1999  }
2000  }
2001 
2002  if( ! bIsNumber && bAssignedtoOutlineStyle )
2005  XML_TRUE );
2006  }
2007 
2008  {
2009  bool bIsRestartNumbering = false;
2010 
2011  Reference< XPropertySetInfo >
2012  xPropSetInfo(xMultiPropSet.is() ?
2013  xMultiPropSet->getPropertySetInfo():
2014  xPropSet->getPropertySetInfo());
2015 
2016  if (xPropSetInfo->
2017  hasPropertyByName("ParaIsNumberingRestart"))
2018  {
2019  xPropSet->getPropertyValue("ParaIsNumberingRestart")
2020  >>= bIsRestartNumbering;
2021  }
2022 
2023  if (bIsRestartNumbering)
2024  {
2027  XML_TRUE);
2028 
2029  if (xPropSetInfo->
2030  hasPropertyByName("NumberingStartValue"))
2031  {
2032  sal_Int32 nStartValue = 0;
2033 
2034  xPropSet->getPropertyValue("NumberingStartValue")
2035  >>= nStartValue;
2036 
2037  GetExport().
2038  AddAttribute(XML_NAMESPACE_TEXT,
2040  OUString::number(nStartValue));
2041  }
2042  }
2043  }
2044  }
2045  }
2046  }
2047  }
2048 
2049  Reference < XEnumerationAccess > xEA( rTextContent, UNO_QUERY );
2050  Reference < XEnumeration > xTextEnum = xEA->createEnumeration();
2051  const bool bHasPortions = xTextEnum.is();
2052 
2053  Reference < XEnumeration> xContentEnum;
2054  Reference < XContentEnumerationAccess > xCEA( rTextContent, UNO_QUERY );
2055  if( xCEA.is() )
2056  xContentEnum.set(xCEA->createContentEnumeration( gsTextContentService ));
2057  const bool bHasContentEnum = xContentEnum.is() &&
2058  xContentEnum->hasMoreElements();
2059 
2060  Reference < XTextSection > xSection;
2061  if( bHasContentEnum )
2062  {
2063  // For the auto styles, the multi property set helper is only used
2064  // if hard attributes are existing. Therefore, it seems to be a better
2065  // strategy to have the TextSection property separate, because otherwise
2066  // we always retrieve the style names even if they are not required.
2067  if( bAutoStyles )
2068  {
2069  if( xPropSet->getPropertySetInfo()->hasPropertyByName( gsTextSection ) )
2070  {
2071  xSection.set(xPropSet->getPropertyValue( gsTextSection ), uno::UNO_QUERY);
2072  }
2073  }
2074  else
2075  {
2076  if( rPropSetHelper.hasProperty( TEXT_SECTION ) )
2077  {
2078  xSection.set(rPropSetHelper.getValue( TEXT_SECTION ), uno::UNO_QUERY);
2079  }
2080  }
2081  }
2082 
2083  bool bPrevCharIsSpace(true); // true because whitespace at start is ignored
2084 
2085  if( bAutoStyles )
2086  {
2087  if( bHasContentEnum )
2089  xContentEnum, bAutoStyles, xSection,
2090  bIsProgress );
2091  if ( bHasPortions )
2092  {
2093  exportTextRangeEnumeration(xTextEnum, bAutoStyles, bIsProgress, bPrevCharIsSpace);
2094  }
2095  }
2096  else
2097  {
2098  enum XMLTokenEnum eElem =
2099  0 < nOutlineLevel ? XML_H : XML_P;
2101  true, false );
2102  if( bHasContentEnum )
2103  {
2105  xContentEnum, bAutoStyles, xSection,
2106  bIsProgress );
2107  }
2108  exportTextRangeEnumeration(xTextEnum, bAutoStyles, bIsProgress, bPrevCharIsSpace);
2109  }
2110 }
2111 
2113  const Reference < XEnumeration > & rTextEnum,
2114  bool bAutoStyles, bool bIsProgress,
2115  bool & rPrevCharIsSpace)
2116 {
2117  static const char sFieldMarkName[] = "__FieldMark_";
2118 
2119  /* This is used for exporting to strict OpenDocument 1.2, in which case traditional
2120  * bookmarks are used instead of fieldmarks. */
2121  FieldmarkType openFieldMark = NONE;
2122 
2123  while( rTextEnum->hasMoreElements() )
2124  {
2125  Reference<XPropertySet> xPropSet(rTextEnum->nextElement(), UNO_QUERY);
2126  Reference < XTextRange > xTxtRange(xPropSet, uno::UNO_QUERY);
2127  Reference<XPropertySetInfo> xPropInfo(xPropSet->getPropertySetInfo());
2128 
2129  if (xPropInfo->hasPropertyByName(gsTextPortionType))
2130  {
2131  OUString sType;
2132  xPropSet->getPropertyValue(gsTextPortionType) >>= sType;
2133 
2134  if( sType == gsText)
2135  {
2136  exportTextRange( xTxtRange, bAutoStyles,
2137  rPrevCharIsSpace, openFieldMark);
2138  }
2139  else if( sType == gsTextField)
2140  {
2141  exportTextField(xTxtRange, bAutoStyles, bIsProgress, &rPrevCharIsSpace);
2142  }
2143  else if ( sType == "Annotation" )
2144  {
2145  exportTextField(xTxtRange, bAutoStyles, bIsProgress, &rPrevCharIsSpace);
2146  }
2147  else if ( sType == "AnnotationEnd" )
2148  {
2149  if (!bAutoStyles)
2150  {
2151  Reference<XNamed> xBookmark(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2152  const OUString& rName = xBookmark->getName();
2153  if (!rName.isEmpty())
2154  {
2156  }
2158  }
2159  }
2160  else if( sType == gsFrame )
2161  {
2162  Reference < XEnumeration> xContentEnum;
2163  Reference < XContentEnumerationAccess > xCEA( xTxtRange,
2164  UNO_QUERY );
2165  if( xCEA.is() )
2166  xContentEnum.set(xCEA->createContentEnumeration(
2168  // frames are never in sections
2169  Reference<XTextSection> xSection;
2170  if( xContentEnum.is() )
2171  exportTextContentEnumeration( xContentEnum,
2172  bAutoStyles,
2173  xSection, bIsProgress, true,
2174  &xPropSet );
2175 
2176  }
2177  else if (sType == gsFootnote)
2178  {
2179  exportTextFootnote(xPropSet,
2180  xTxtRange->getString(),
2181  bAutoStyles, bIsProgress );
2182  }
2183  else if (sType == gsBookmark)
2184  {
2185  exportTextMark(xPropSet,
2186  gsBookmark,
2187  lcl_XmlBookmarkElements,
2188  bAutoStyles);
2189  }
2190  else if (sType == gsReferenceMark)
2191  {
2192  exportTextMark(xPropSet,
2194  lcl_XmlReferenceElements,
2195  bAutoStyles);
2196  }
2197  else if (sType == gsDocumentIndexMark)
2198  {
2199  pIndexMarkExport->ExportIndexMark(xPropSet, bAutoStyles);
2200  }
2201  else if (sType == gsRedline)
2202  {
2203  if (nullptr != pRedlineExport)
2204  pRedlineExport->ExportChange(xPropSet, bAutoStyles);
2205  }
2206  else if (sType == gsRuby)
2207  {
2208  exportRuby(xPropSet, bAutoStyles);
2209  }
2210  else if (sType == "InContentMetadata")
2211  {
2212  exportMeta(xPropSet, bAutoStyles, bIsProgress, rPrevCharIsSpace);
2213  }
2214  else if (sType == gsTextFieldStart)
2215  {
2216  Reference< css::text::XFormField > xFormField(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2217 
2218  /* As of now, textmarks are a proposed extension to the OpenDocument standard. */
2219  if (!bAutoStyles)
2220  {
2222  {
2223  Reference<XNamed> xBookmark(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2224  if (xBookmark.is())
2225  {
2226  GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
2227  }
2228 
2229  if (xFormField.is())
2230  {
2231  GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
2232  }
2233 
2235  if (xFormField.is())
2236  {
2237  FieldParamExporter(&GetExport(), xFormField->getParameters()).Export();
2238  }
2240  }
2241  /* The OpenDocument standard does not include support for TextMarks for now, so use bookmarks instead. */
2242  else
2243  {
2244  if (xFormField.is())
2245  {
2246  OUString sName;
2247  Reference< css::container::XNameAccess > xParameters = xFormField->getParameters();
2248  if (xParameters.is() && xParameters->hasByName("Name"))
2249  {
2250  const Any aValue = xParameters->getByName("Name");
2251  aValue >>= sName;
2252  }
2253  if (sName.isEmpty())
2254  { // name attribute is mandatory, so have to pull a
2255  // rabbit out of the hat here
2256  sName = sFieldMarkName + OUString::number(
2257  m_xImpl->AddFieldMarkStart(xFormField));
2258  }
2260  sName);
2261  SvXMLElementExport aElem( GetExport(), !bAutoStyles,
2263  false, false );
2264  const OUString sFieldType = xFormField->getFieldType();
2265  if (sFieldType == ODF_FORMTEXT)
2266  {
2267  openFieldMark = TEXT;
2268  }
2269  else if (sFieldType == ODF_FORMCHECKBOX)
2270  {
2271  openFieldMark = CHECK;
2272  }
2273  else
2274  {
2275  openFieldMark = NONE;
2276  }
2277  }
2278  }
2279  }
2280  }
2281  else if (sType == gsTextFieldEnd)
2282  {
2283  if (!bAutoStyles)
2284  {
2285  Reference< css::text::XFormField > xFormField(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2286 
2288  {
2289  SvXMLElementExport aElem( GetExport(), !bAutoStyles,
2291  false, false );
2292  }
2293  else
2294  {
2295  if (xFormField.is())
2296  {
2297  OUString sName;
2298  Reference< css::container::XNameAccess > xParameters = xFormField->getParameters();
2299  if (xParameters.is() && xParameters->hasByName("Name"))
2300  {
2301  const Any aValue = xParameters->getByName("Name");
2302  aValue >>= sName;
2303  }
2304  if (sName.isEmpty())
2305  { // name attribute is mandatory, so have to pull a
2306  // rabbit out of the hat here
2307  sName = sFieldMarkName + OUString::number(
2308  m_xImpl->GetFieldMarkIndex(xFormField));
2309  }
2311  sName);
2312  SvXMLElementExport aElem( GetExport(), !bAutoStyles,
2314  false, false );
2315  }
2316  }
2317  }
2318  }
2319  else if (sType == gsTextFieldStartEnd)
2320  {
2321  if (!bAutoStyles)
2322  {
2323  if (GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
2324  {
2325  Reference<XNamed> xBookmark(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2326  if (xBookmark.is())
2327  {
2328  GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
2329  }
2330  Reference< css::text::XFormField > xFormField(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2331  if (xFormField.is())
2332  {
2333  GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType());
2334  }
2336  if (xFormField.is())
2337  {
2338  FieldParamExporter(&GetExport(), xFormField->getParameters()).Export();
2339  }
2341  }
2342  else
2343  {
2344  Reference<XNamed> xBookmark(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY);
2345  if (xBookmark.is())
2346  {
2347  GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName());
2348  SvXMLElementExport aElem( GetExport(), !bAutoStyles,
2350  false, false );
2351  }
2352  }
2353  }
2354  }
2355  else if (sType == gsSoftPageBreak)
2356  {
2358  }
2359  else {
2360  OSL_FAIL("unknown text portion type");
2361  }
2362  }
2363  else
2364  {
2365  Reference<XServiceInfo> xServiceInfo( xTxtRange, UNO_QUERY );
2366  if( xServiceInfo->supportsService( gsTextFieldService ) )
2367  {
2368  exportTextField(xTxtRange, bAutoStyles, bIsProgress, &rPrevCharIsSpace);
2369  }
2370  else
2371  {
2372  // no TextPortionType property -> non-Writer app -> text
2373  exportTextRange(xTxtRange, bAutoStyles, rPrevCharIsSpace, openFieldMark);
2374  }
2375  }
2376  }
2377 
2378 // now that there are nested enumerations for meta(-field), this may be valid!
2379 // SAL_WARN_IF( bOpenRuby, "xmloff", "Red Alert: Ruby still open!" );
2380 }
2381 
2383  const Reference < XTextContent > &,
2384  bool /*bAutoStyles*/, bool /*bIsProgress*/ )
2385 {
2386 }
2387 
2389  const Reference < XTextRange > & rTextRange,
2390  bool bAutoStyles, bool bIsProgress, bool *const pPrevCharIsSpace)
2391 {
2392  Reference < XPropertySet > xPropSet( rTextRange, UNO_QUERY );
2393  // non-Writer apps need not support Property TextField, so test first
2394  if (!xPropSet->getPropertySetInfo()->hasPropertyByName( gsTextField ))
2395  return;
2396 
2397  Reference < XTextField > xTxtFld(xPropSet->getPropertyValue( gsTextField ), uno::UNO_QUERY);
2398  SAL_WARN_IF( !xTxtFld.is(), "xmloff", "text field missing" );
2399  if( xTxtFld.is() )
2400  {
2401  exportTextField(xTxtFld, bAutoStyles, bIsProgress, true, pPrevCharIsSpace);
2402  }
2403  else
2404  {
2405  // write only characters
2406  GetExport().Characters(rTextRange->getString());
2407  }
2408 }
2409 
2411  const Reference < XTextField > & xTextField,
2412  const bool bAutoStyles, const bool bIsProgress,
2413  const bool bRecursive, bool *const pPrevCharIsSpace)
2414 {
2415  if ( bAutoStyles )
2416  {
2417  pFieldExport->ExportFieldAutoStyle( xTextField, bIsProgress,
2418  bRecursive );
2419  }
2420  else
2421  {
2422  assert(pPrevCharIsSpace);
2423  pFieldExport->ExportField(xTextField, bIsProgress, *pPrevCharIsSpace);
2424  }
2425 }
2426 
2428 {
2430  XML_SOFT_PAGE_BREAK, false,
2431  false );
2432 }
2433 
2435  const Reference<XPropertySet> & rPropSet,
2436  const OUString& rProperty,
2438  bool bAutoStyles)
2439 {
2440  // mib said: "Hau wech!"
2441 
2442  // (Originally, I'd export a span element in case the (book|reference)mark
2443  // was formatted. This actually makes a difference in case some pervert
2444  // sets a point reference mark in the document and, say, formats it bold.
2445  // This basically meaningless formatting will now been thrown away
2446  // (aka cleaned up), since mib said: ... dvo
2447 
2448  if (bAutoStyles)
2449  return;
2450 
2451  // name element
2452  Reference<XNamed> xName(rPropSet->getPropertyValue(rProperty), UNO_QUERY);
2454  xName->getName());
2455 
2456  // start, end, or point-reference?
2457  sal_Int8 nElement;
2458  if( *o3tl::doAccess<bool>(rPropSet->getPropertyValue(gsIsCollapsed)) )
2459  {
2460  nElement = 0;
2461  }
2462  else
2463  {
2464  nElement = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(gsIsStart)) ? 1 : 2;
2465  }
2466 
2467  // bookmark, bookmark-start: xml:id and RDFa for RDF metadata
2468  if( nElement < 2 ) {
2469  GetExport().AddAttributeXmlId(xName);
2470  const uno::Reference<text::XTextContent> xTextContent(
2471  xName, uno::UNO_QUERY_THROW);
2472  GetExport().AddAttributesRDFa(xTextContent);
2473  }
2474 
2475  // bookmark-start: add attributes hidden and condition
2476  if (nElement == 1)
2477  {
2478  Reference<XPropertySet> bkmkProps(rPropSet->getPropertyValue(rProperty), UNO_QUERY);
2479  Reference<XPropertySetInfo> bkmkPropInfo = bkmkProps->getPropertySetInfo();
2480  OUString sHidden("BookmarkHidden");
2481  if (bkmkPropInfo->hasPropertyByName(sHidden))
2482  {
2483  bool bHidden = false;
2484  bkmkProps->getPropertyValue(sHidden) >>= bHidden;
2485  if (bHidden)
2486  {
2487  GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, "hidden", "true");
2488  OUString sCondition("BookmarkCondition");
2489  if (bkmkPropInfo->hasPropertyByName(sCondition))
2490  {
2491  OUString sBookmarkCondition;
2492  bkmkProps->getPropertyValue(sCondition) >>= sBookmarkCondition;
2493  GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, "condition", sBookmarkCondition);
2494  }
2495  }
2496  }
2497  }
2498 
2499  // export element
2500  assert(pElements != nullptr);
2501  assert(0 <= nElement && nElement <= 2);
2502  SvXMLElementExport aElem(GetExport(),
2503  XML_NAMESPACE_TEXT, pElements[nElement],
2504  false, false);
2505  // else: no styles. (see above)
2506 }
2507 
2509  const Reference < XPropertySet > & rPropSet,
2510  const Reference < XPropertySetInfo > & rPropSetInfo )
2511 {
2512  bool bIsBoundAsChar = false;
2513  OUString sAnchorType( "AnchorType" );
2514  if( rPropSetInfo->hasPropertyByName( sAnchorType ) )
2515  {
2516  TextContentAnchorType eAnchor;
2517  rPropSet->getPropertyValue( sAnchorType ) >>= eAnchor;
2518  bIsBoundAsChar = TextContentAnchorType_AS_CHARACTER == eAnchor;
2519  }
2520 
2521  return bIsBoundAsChar;
2522 }
2523 
2525  const Reference < XPropertySet >& rPropSet,
2526  bool bShape,
2527  basegfx::B2DPoint* pCenter,
2528  OUString* pMinHeightValue,
2529  OUString* pMinWidthValue)
2530 {
2531  XMLShapeExportFlags nShapeFeatures = SEF_DEFAULT;
2532 
2533  // draw:name (#97662#: not for shapes, since those names will be
2534  // treated in the shape export)
2535  if( !bShape )
2536  {
2537  Reference < XNamed > xNamed( rPropSet, UNO_QUERY );
2538  if( xNamed.is() )
2539  {
2540  OUString sName( xNamed->getName() );
2541  if( !sName.isEmpty() )
2543  xNamed->getName() );
2544  }
2545  }
2546 
2547  OUStringBuffer sValue;
2548 
2549  // text:anchor-type
2550  TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH;
2551  rPropSet->getPropertyValue( gsAnchorType ) >>= eAnchor;
2552  {
2553  XMLAnchorTypePropHdl aAnchorTypeHdl;
2554  OUString sTmp;
2555  aAnchorTypeHdl.exportXML( sTmp, uno::makeAny(eAnchor),
2556  GetExport().GetMM100UnitConverter() );
2558  }
2559 
2560  // text:anchor-page-number
2561  if( TextContentAnchorType_AT_PAGE == eAnchor )
2562  {
2563  sal_Int16 nPage = 0;
2564  rPropSet->getPropertyValue( gsAnchorPageNo ) >>= nPage;
2565  SAL_WARN_IF(nPage <= 0, "xmloff",
2566  "ERROR: writing invalid anchor-page-number 0");
2568  OUString::number( nPage ) );
2569  }
2570  else
2571  {
2572  nShapeFeatures |= XMLShapeExportFlags::NO_WS;
2573  }
2574 
2575  // OD 2004-06-01 #i27691# - correction: no export of svg:x, if object
2576  // is anchored as-character.
2577  if ( !bShape &&
2578  eAnchor != TextContentAnchorType_AS_CHARACTER )
2579  {
2580  // svg:x
2581  sal_Int16 nHoriOrient = HoriOrientation::NONE;
2582  rPropSet->getPropertyValue( gsHoriOrient ) >>= nHoriOrient;
2583  if( HoriOrientation::NONE == nHoriOrient )
2584  {
2585  sal_Int32 nPos = 0;
2586  rPropSet->getPropertyValue( gsHoriOrientPosition ) >>= nPos;
2588  sValue, nPos );
2590  sValue.makeStringAndClear() );
2591  if(nullptr != pCenter)
2592  {
2593  // add left edge to Center
2594  pCenter->setX(pCenter->getX() + nPos);
2595  }
2596  }
2597  }
2598  else if( TextContentAnchorType_AS_CHARACTER == eAnchor )
2599  nShapeFeatures = (nShapeFeatures & ~XMLShapeExportFlags::X);
2600 
2601  if( !bShape || TextContentAnchorType_AS_CHARACTER == eAnchor )
2602  {
2603  // svg:y
2604  sal_Int16 nVertOrient = VertOrientation::NONE;
2605  rPropSet->getPropertyValue( gsVertOrient ) >>= nVertOrient;
2606  if( VertOrientation::NONE == nVertOrient )
2607  {
2608  sal_Int32 nPos = 0;
2609  rPropSet->getPropertyValue( gsVertOrientPosition ) >>= nPos;
2611  sValue, nPos );
2613  sValue.makeStringAndClear() );
2614  if(nullptr != pCenter)
2615  {
2616  // add top edge to Center
2617  pCenter->setY(pCenter->getY() + nPos);
2618  }
2619  }
2620  if( bShape )
2621  nShapeFeatures = (nShapeFeatures & ~XMLShapeExportFlags::Y);
2622  }
2623 
2624  Reference< XPropertySetInfo > xPropSetInfo(rPropSet->getPropertySetInfo());
2625 
2626  // svg:width
2627  sal_Int16 nWidthType = SizeType::FIX;
2628  if( xPropSetInfo->hasPropertyByName( gsWidthType ) )
2629  {
2630  rPropSet->getPropertyValue( gsWidthType ) >>= nWidthType;
2631  }
2632  if( xPropSetInfo->hasPropertyByName( gsWidth ) )
2633  {
2634  sal_Int32 nWidth = 0;
2635  // VAR size will be written as zero min-size
2636  if( SizeType::VARIABLE != nWidthType )
2637  {
2638  rPropSet->getPropertyValue( gsWidth ) >>= nWidth;
2639  }
2641  if( SizeType::FIX != nWidthType )
2642  {
2643  assert(pMinWidthValue);
2644  if (pMinWidthValue)
2645  {
2646  *pMinWidthValue = sValue.makeStringAndClear();
2647  }
2648  }
2649  else
2650  {
2652  sValue.makeStringAndClear() );
2653  if(nullptr != pCenter)
2654  {
2655  // add half width to Center
2656  pCenter->setX(pCenter->getX() + (0.5 * nWidth));
2657  }
2658  }
2659  }
2660  bool bSyncWidth = false;
2661  if( xPropSetInfo->hasPropertyByName( gsIsSyncWidthToHeight ) )
2662  {
2663  bSyncWidth = *o3tl::doAccess<bool>(rPropSet->getPropertyValue( gsIsSyncWidthToHeight ));
2664  if( bSyncWidth )
2666  XML_SCALE );
2667  }
2668  if( !bSyncWidth && xPropSetInfo->hasPropertyByName( gsRelativeWidth ) )
2669  {
2670  sal_Int16 nRelWidth = 0;
2671  rPropSet->getPropertyValue( gsRelativeWidth ) >>= nRelWidth;
2672  SAL_WARN_IF( nRelWidth < 0 || nRelWidth > 254, "xmloff",
2673  "Got illegal relative width from API" );
2674  if( nRelWidth > 0 )
2675  {
2676  ::sax::Converter::convertPercent( sValue, nRelWidth );
2678  sValue.makeStringAndClear() );
2679  }
2680  }
2681 
2682  // svg:height, fo:min-height or style:rel-height
2683  sal_Int16 nSizeType = SizeType::FIX;
2684  if( xPropSetInfo->hasPropertyByName( gsSizeType ) )
2685  {
2686  rPropSet->getPropertyValue( gsSizeType ) >>= nSizeType;
2687  }
2688  bool bSyncHeight = false;
2689  if( xPropSetInfo->hasPropertyByName( gsIsSyncHeightToWidth ) )
2690  {
2691  bSyncHeight = *o3tl::doAccess<bool>(rPropSet->getPropertyValue( gsIsSyncHeightToWidth ));
2692  }
2693  sal_Int16 nRelHeight = 0;
2694  if( !bSyncHeight && xPropSetInfo->hasPropertyByName( gsRelativeHeight ) )
2695  {
2696  rPropSet->getPropertyValue( gsRelativeHeight ) >>= nRelHeight;
2697  }
2698  if( xPropSetInfo->hasPropertyByName( gsHeight ) )
2699  {
2700  sal_Int32 nHeight = 0;
2701  if( SizeType::VARIABLE != nSizeType )
2702  {
2703  rPropSet->getPropertyValue( gsHeight ) >>= nHeight;
2704  }
2706  nHeight );
2707  if( SizeType::FIX != nSizeType && 0==nRelHeight && !bSyncHeight &&
2708  pMinHeightValue )
2709  {
2710  *pMinHeightValue = sValue.makeStringAndClear();
2711  }
2712  else
2713  {
2715  sValue.makeStringAndClear() );
2716  if(nullptr != pCenter)
2717  {
2718  // add half height to Center
2719  pCenter->setY(pCenter->getY() + (0.5 * nHeight));
2720  }
2721  }
2722  }
2723  if( bSyncHeight )
2724  {
2726  SizeType::MIN == nSizeType ? XML_SCALE_MIN : XML_SCALE );
2727 
2728  }
2729  else if( nRelHeight > 0 )
2730  {
2731  ::sax::Converter::convertPercent( sValue, nRelHeight );
2732  if( SizeType::MIN == nSizeType )
2733  {
2734  assert(pMinHeightValue);
2735  if (pMinHeightValue)
2736  {
2737  *pMinHeightValue = sValue.makeStringAndClear();
2738  }
2739  }
2740  else
2742  sValue.makeStringAndClear() );
2743  }
2744 
2745  OUString sZOrder( "ZOrder" );
2746  if( xPropSetInfo->hasPropertyByName( sZOrder ) )
2747  {
2748  sal_Int32 nZIndex = 0;
2749  rPropSet->getPropertyValue( sZOrder ) >>= nZIndex;
2750  if( -1 != nZIndex )
2751  {
2753  OUString::number( nZIndex ) );
2754  }
2755  }
2756 
2757  return nShapeFeatures;
2758 }
2759 
2761  const Reference < XTextContent > & rTxtCntnt,
2762  FrameType eType,
2763  bool bAutoStyles,
2764  bool bIsProgress,
2765  bool bExportContent,
2766  const Reference < XPropertySet > *pRangePropSet)
2767 {
2768  Reference < XPropertySet > xPropSet( rTxtCntnt, UNO_QUERY );
2769 
2770  if( bAutoStyles )
2771  {
2772  if( FrameType::Embedded == eType )
2773  _collectTextEmbeddedAutoStyles( xPropSet );
2774  // No text frame style for shapes (#i28745#)
2775  else if ( FrameType::Shape != eType )
2776  Add( XmlStyleFamily::TEXT_FRAME, xPropSet );
2777 
2778  if( pRangePropSet && lcl_txtpara_isBoundAsChar( xPropSet,
2779  xPropSet->getPropertySetInfo() ) )
2780  Add( XmlStyleFamily::TEXT_TEXT, *pRangePropSet );
2781 
2782  switch( eType )
2783  {
2784  case FrameType::Text:
2785  {
2786  // frame bound frames
2787  if ( bExportContent )
2788  {
2789  Reference < XTextFrame > xTxtFrame( rTxtCntnt, UNO_QUERY );
2790  Reference < XText > xTxt(xTxtFrame->getText());
2791  exportFrameFrames( true, bIsProgress, &xTxtFrame );
2792  exportText( xTxt, bAutoStyles, bIsProgress, true );
2793  }
2794  }
2795  break;
2796  case FrameType::Shape:
2797  {
2798  Reference < XShape > xShape( rTxtCntnt, UNO_QUERY );
2799  GetExport().GetShapeExport()->collectShapeAutoStyles( xShape );
2800  }
2801  break;
2802  default:
2803  break;
2804  }
2805  }
2806  else
2807  {
2808  Reference< XPropertySetInfo > xPropSetInfo(xPropSet->getPropertySetInfo());
2809  Reference< XPropertyState > xPropState( xPropSet, UNO_QUERY );
2810  {
2811  bool bAddCharStyles = pRangePropSet &&
2812  lcl_txtpara_isBoundAsChar( xPropSet, xPropSetInfo );
2813 
2814  bool bIsUICharStyle;
2815  bool bHasAutoStyle = false;
2816 
2817  OUString sStyle;
2818 
2819  if( bAddCharStyles )
2820  {
2821  bool bDummy;
2822  sStyle = FindTextStyleAndHyperlink( *pRangePropSet, bDummy, bIsUICharStyle, bHasAutoStyle );
2823  }
2824  else
2825  bIsUICharStyle = false;
2826 
2827  bool bDoSomething = bIsUICharStyle
2828  && aCharStyleNamesPropInfoCache.hasProperty( *pRangePropSet );
2829  XMLTextCharStyleNamesElementExport aCharStylesExport(
2830  GetExport(), bDoSomething, bHasAutoStyle,
2831  bDoSomething ? *pRangePropSet : Reference<XPropertySet>(),
2832  gsCharStyleNames );
2833 
2834  if( !sStyle.isEmpty() )
2836  GetExport().EncodeStyleName( sStyle ) );
2837  {
2838  SvXMLElementExport aElem( GetExport(), !sStyle.isEmpty(),
2839  XML_NAMESPACE_TEXT, XML_SPAN, false, false );
2840  {
2841  SvXMLElementExport aElement( GetExport(),
2842  FrameType::Shape != eType &&
2843  addHyperlinkAttributes( xPropSet,
2844  xPropState,xPropSetInfo ),
2845  XML_NAMESPACE_DRAW, XML_A, false, false );
2846  switch( eType )
2847  {
2848  case FrameType::Text:
2849  _exportTextFrame( xPropSet, xPropSetInfo, bIsProgress );
2850  break;
2851  case FrameType::Graphic:
2852  _exportTextGraphic( xPropSet, xPropSetInfo );
2853  break;
2854  case FrameType::Embedded:
2855  _exportTextEmbedded( xPropSet, xPropSetInfo );
2856  break;
2857  case FrameType::Shape:
2858  {
2859  Reference < XShape > xShape( rTxtCntnt, UNO_QUERY );
2860  XMLShapeExportFlags nFeatures =
2861  addTextFrameAttributes( xPropSet, true );
2863  ->exportShape( xShape, nFeatures );
2864  }
2865  break;
2866  }
2867  }
2868  }
2869  }
2870  }
2871 }
2872 
2874  const Reference < XPropertySet > & rPropSet,
2875  const Reference < XPropertySetInfo > & rPropSetInfo,
2876  bool bIsProgress )
2877 {
2878  Reference < XTextFrame > xTxtFrame( rPropSet, UNO_QUERY );
2879  Reference < XText > xTxt(xTxtFrame->getText());
2880 
2881  OUString sStyle;
2882  if( rPropSetInfo->hasPropertyByName( gsFrameStyleName ) )
2883  {
2884  rPropSet->getPropertyValue( gsFrameStyleName ) >>= sStyle;
2885  }
2886 
2887  OUString aMinHeightValue;
2888  OUString sMinWidthValue;
2889  OUString sAutoStyle = Find( XmlStyleFamily::TEXT_FRAME, rPropSet, sStyle );
2890  if ( sAutoStyle.isEmpty() )
2891  sAutoStyle = sStyle;
2892  if( !sAutoStyle.isEmpty() )
2894  GetExport().EncodeStyleName( sAutoStyle ) );
2895  addTextFrameAttributes(rPropSet, false, nullptr, &aMinHeightValue, &sMinWidthValue);
2896 
2898  XML_FRAME, false, true );
2899 
2900  if( !aMinHeightValue.isEmpty() )
2902  aMinHeightValue );
2903 
2904  if (!sMinWidthValue.isEmpty())
2905  {
2907  sMinWidthValue );
2908  }
2909 
2910  // draw:chain-next-name
2911  if( rPropSetInfo->hasPropertyByName( gsChainNextName ) )
2912  {
2913  OUString sNext;
2914  if( (rPropSet->getPropertyValue( gsChainNextName ) >>= sNext) && !sNext.isEmpty() )
2917  sNext );
2918  }
2919 
2920  {
2922  XML_TEXT_BOX, true, true );
2923 
2924  // frames bound to frame
2925  exportFrameFrames( false, bIsProgress, &xTxtFrame );
2926 
2927  exportText( xTxt, false, bIsProgress, true );
2928  }
2929 
2930  // script:events
2931  Reference<XEventsSupplier> xEventsSupp( xTxtFrame, UNO_QUERY );
2932  GetExport().GetEventExport().Export(xEventsSupp);
2933 
2934  // image map
2935  GetExport().GetImageMapExport().Export( rPropSet );
2936 
2937  // svg:title and svg:desc (#i73249#)
2938  exportTitleAndDescription( rPropSet, rPropSetInfo );
2939 }
2940 
2942  const Reference < XPropertySet > & rPropSet,
2943  const Reference < XPropertySetInfo > & rPropSetInfo )
2944 {
2945  if( !rPropSetInfo->hasPropertyByName( gsContourPolyPolygon ) )
2946  {
2947  return;
2948  }
2949 
2950  PointSequenceSequence aSourcePolyPolygon;
2951  rPropSet->getPropertyValue( gsContourPolyPolygon ) >>= aSourcePolyPolygon;
2952  const basegfx::B2DPolyPolygon aPolyPolygon(
2954  aSourcePolyPolygon));
2955  const sal_uInt32 nPolygonCount(aPolyPolygon.count());
2956 
2957  if(!nPolygonCount)
2958  {
2959  return;
2960  }
2961 
2962  const basegfx::B2DRange aPolyPolygonRange(aPolyPolygon.getB2DRange());
2963  bool bPixel(false);
2964 
2965  if( rPropSetInfo->hasPropertyByName( gsIsPixelContour ) )
2966  {
2967  bPixel = *o3tl::doAccess<bool>(rPropSet->getPropertyValue( gsIsPixelContour ));
2968  }
2969 
2970  // svg: width
2971  OUStringBuffer aStringBuffer( 10 );
2972 
2973  if(bPixel)
2974  {
2975  ::sax::Converter::convertMeasurePx(aStringBuffer, basegfx::fround(aPolyPolygonRange.getWidth()));
2976  }
2977  else
2978  {
2979  GetExport().GetMM100UnitConverter().convertMeasureToXML(aStringBuffer, basegfx::fround(aPolyPolygonRange.getWidth()));
2980  }
2981 
2982  GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStringBuffer.makeStringAndClear());
2983 
2984  // svg: height
2985  if(bPixel)
2986  {
2987  ::sax::Converter::convertMeasurePx(aStringBuffer, basegfx::fround(aPolyPolygonRange.getHeight()));
2988  }
2989  else
2990  {
2991  GetExport().GetMM100UnitConverter().convertMeasureToXML(aStringBuffer, basegfx::fround(aPolyPolygonRange.getHeight()));
2992  }
2993 
2994  GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStringBuffer.makeStringAndClear());
2995 
2996  // svg:viewbox
2997  SdXMLImExViewBox aViewBox(0.0, 0.0, aPolyPolygonRange.getWidth(), aPolyPolygonRange.getHeight());
2998  GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
2999  enum XMLTokenEnum eElem = XML_TOKEN_INVALID;
3000 
3001  if(1 == nPolygonCount )
3002  {
3003  // simple polygon shape, can be written as svg:points sequence
3004  const OUString aPointString(
3006  aPolyPolygon.getB2DPolygon(0)));
3007 
3008  // write point array
3010  eElem = XML_CONTOUR_POLYGON;
3011  }
3012  else
3013  {
3014  // polypolygon, needs to be written as a svg:path sequence
3015  const OUString aPolygonString(
3017  aPolyPolygon,
3018  true, // bUseRelativeCoordinates
3019  false, // bDetectQuadraticBeziers: not used in old, but maybe activated now
3020  true)); // bHandleRelativeNextPointCompatible
3021 
3022  // write point array
3023  GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_D, aPolygonString);
3024  eElem = XML_CONTOUR_PATH;
3025  }
3026 
3027  if( rPropSetInfo->hasPropertyByName( gsIsAutomaticContour ) )
3028  {
3029  bool bTmp = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(
3033  }
3034 
3035  // write object now
3037  true, true );
3038 }
3039 
3041  const Reference < XPropertySet > & rPropSet,
3042  const Reference < XPropertySetInfo > & rPropSetInfo )
3043 {
3044  OUString sStyle;
3045  if( rPropSetInfo->hasPropertyByName( gsFrameStyleName ) )
3046  {
3047  rPropSet->getPropertyValue( gsFrameStyleName ) >>= sStyle;
3048  }
3049 
3050  OUString sAutoStyle = Find( XmlStyleFamily::TEXT_FRAME, rPropSet, sStyle );
3051  if ( sAutoStyle.isEmpty() )
3052  sAutoStyle = sStyle;
3053  if( !sAutoStyle.isEmpty() )
3055  GetExport().EncodeStyleName( sAutoStyle ) );
3056 
3057  // check if we need to use svg:transform
3058  sal_Int16 nRotation(0);
3059  rPropSet->getPropertyValue( gsGraphicRotation ) >>= nRotation;
3060  const bool bUseRotation(0 != nRotation);
3061  basegfx::B2DPoint aCenter(0.0, 0.0);
3062 
3063  // add TextFrame attributes like svg:x/y/width/height, also get back
3064  // object's center point if rotation is used and has to be exported
3065  addTextFrameAttributes(rPropSet, false, bUseRotation ? &aCenter : nullptr);
3066 
3067  // svg:transform
3068  if(bUseRotation)
3069  {
3070  // RotateFlyFrameFix: im/export full 'draw:transform' using existing tooling.
3071  // Currently only rotation is used, but combinations with 'draw:transform'
3072  // may be necessary in the future, so that svg:x/svg:y/svg:width/svg:height
3073  // may be extended/replaced with 'draw:transform' (see draw objects)
3074  SdXMLImExTransform2D aSdXMLImExTransform2D;
3075 
3076  // Convert from 10th degree integer to deg.
3077  // CAUTION: internal rotation is classically mathematically 'wrong' defined by ignoring that
3078  // we have a right-handed coordinate system, so need to correct this by mirroring
3079  // the rotation to get the correct transformation. See also case XML_TOK_TEXT_FRAME_TRANSFORM
3080  // in XMLTextFrameContext_Impl::XMLTextFrameContext_Impl and #i78696#
3081  // CAUTION-II: due to tdf#115782 it is better for current ODF to indeed write it with the wrong
3082  // orientation as in all other cases - ARGH! We will need to correct this in future ODF ASAP!
3083  const double fRotate(basegfx::deg2rad<10>(nRotation));
3084 
3085  // transform to rotation center which is the object's center
3086  aSdXMLImExTransform2D.AddTranslate(-aCenter);
3087 
3088  // add rotation itself
3089  // tdf#115529 but correct value modulo 2PI to have it positive and in the range of [0.0 .. 2PI[
3090  aSdXMLImExTransform2D.AddRotate(basegfx::normalizeToRange(fRotate, 2 * M_PI));
3091 
3092  // back-transform after rotation
3093  aSdXMLImExTransform2D.AddTranslate(aCenter);
3094 
3095  // Note: using GetTwipUnitConverter instead of GetMM100UnitConverter may be needed,
3096  // but is not generally available (as it should be, a 'current' UnitConverter should
3097  // be available at GetExport() - and maybe was once). May have to be addressed as soon
3098  // as translate transformations are used here.
3101  XML_TRANSFORM,
3102  aSdXMLImExTransform2D.GetExportString(GetExport().GetMM100UnitConverter()));
3103  }
3104 
3105  // original content
3106  SvXMLElementExport aElem(GetExport(), XML_NAMESPACE_DRAW, XML_FRAME, false, true);
3107 
3108  {
3109  // xlink:href
3110  uno::Reference<graphic::XGraphic> xGraphic;
3111  rPropSet->getPropertyValue("Graphic") >>= xGraphic;
3112 
3113  OUString sInternalURL;
3114  OUString sOutMimeType;
3115 
3116  if (xGraphic.is())
3117  {
3118  sInternalURL = GetExport().AddEmbeddedXGraphic(xGraphic, sOutMimeType);
3119  }
3120 
3121  // If there still is no url, then graphic is empty
3122  if (!sInternalURL.isEmpty())
3123  {
3128  }
3129 
3130  // draw:filter-name
3131  OUString sGrfFilter;
3132  rPropSet->getPropertyValue( gsGraphicFilter ) >>= sGrfFilter;
3133  if( !sGrfFilter.isEmpty() )
3135  sGrfFilter );
3136 
3137  if (GetExport().getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
3138  {
3139  if (sOutMimeType.isEmpty())
3140  {
3141  GetExport().GetGraphicMimeTypeFromStream(xGraphic, sOutMimeType);
3142  }
3143  if (!sOutMimeType.isEmpty())
3144  { // ODF 1.3 OFFICE-3943
3146  SvtSaveOptions::ODFSVER_013 <= GetExport().getSaneDefaultVersion()
3149  "mime-type", sOutMimeType);
3150  }
3151  }
3152 
3153 
3154  // optional office:binary-data
3155  if (xGraphic.is())
3156  {
3157  SvXMLElementExport aElement(GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, false, true );
3159  }
3160  }
3161 
3162  const bool bAddReplacementImages = officecfg::Office::Common::Save::Graphic::AddReplacementImages::get();
3163  if (bAddReplacementImages)
3164  {
3165  // replacement graphic for backwards compatibility, but
3166  // only for SVG and metafiles currently
3167  uno::Reference<graphic::XGraphic> xReplacementGraphic;
3168  rPropSet->getPropertyValue("ReplacementGraphic") >>= xReplacementGraphic;
3169 
3170  OUString sInternalURL;
3171  OUString sOutMimeType;
3172 
3173  //Resolves: fdo#62461 put preferred image first above, followed by
3174  //fallback here
3175  if (xReplacementGraphic.is())
3176  {
3177  sInternalURL = GetExport().AddEmbeddedXGraphic(xReplacementGraphic, sOutMimeType);
3178  }
3179 
3180  // If there is no url, then graphic is empty
3181  if (!sInternalURL.isEmpty())
3182  {
3187  }
3188 
3189  if (GetExport().getSaneDefaultVersion() > SvtSaveOptions::ODFSVER_012)
3190  {
3191  if (sOutMimeType.isEmpty())
3192  {
3193  GetExport().GetGraphicMimeTypeFromStream(xReplacementGraphic, sOutMimeType);
3194  }
3195  if (!sOutMimeType.isEmpty())
3196  { // ODF 1.3 OFFICE-3943
3198  SvtSaveOptions::ODFSVER_013 <= GetExport().getSaneDefaultVersion()
3201  "mime-type", sOutMimeType);
3202  }
3203  }
3204 
3205 
3206  // optional office:binary-data
3207  if (xReplacementGraphic.is())
3208  {
3209  SvXMLElementExport aElement(GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, true, true);
3210  GetExport().AddEmbeddedXGraphicAsBase64(xReplacementGraphic);
3211  }
3212  }
3213 
3214  // script:events
3215  Reference<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY );
3216  GetExport().GetEventExport().Export(xEventsSupp);
3217 
3218  // image map
3219  GetExport().GetImageMapExport().Export( rPropSet );
3220 
3221  // svg:title and svg:desc (#i73249#)
3222  exportTitleAndDescription( rPropSet, rPropSetInfo );
3223 
3224  // draw:contour
3225  exportContour( rPropSet, rPropSetInfo );
3226 }
3227 
3229 {
3230  SAL_WARN( "xmloff", "no API implementation available" );
3231 }
3232 
3235  const Reference < XPropertySetInfo > & )
3236 {
3237  SAL_WARN( "xmloff", "no API implementation available" );
3238 }
3239 
3241 {
3242  // script:events
3243  Reference<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY );
3244  GetExport().GetEventExport().Export(xEventsSupp);
3245 
3246  // image map
3247  if (rPropSet->getPropertySetInfo()->hasPropertyByName("ImageMap"))
3248  GetExport().GetImageMapExport().Export( rPropSet );
3249 }
3250 
3251 // Implement Title/Description Elements UI (#i73249#)
3253  const Reference < XPropertySet > & rPropSet,
3254  const Reference < XPropertySetInfo > & rPropSetInfo )
3255 {
3256  // svg:title
3257  if( rPropSetInfo->hasPropertyByName( gsTitle ) )
3258  {
3259  OUString sObjTitle;
3260  rPropSet->getPropertyValue( gsTitle ) >>= sObjTitle;
3261  if( !sObjTitle.isEmpty() )
3262  {
3264  XML_TITLE, true, false );
3265  GetExport().Characters( sObjTitle );
3266  }
3267  }
3268 
3269  // svg:description
3270  if( rPropSetInfo->hasPropertyByName( gsDescription ) )
3271  {
3272  OUString sObjDesc;
3273  rPropSet->getPropertyValue( gsDescription ) >>= sObjDesc;
3274  if( !sObjDesc.isEmpty() )
3275  {
3277  XML_DESC, true, false );
3278  GetExport().Characters( sObjDesc );
3279  }
3280  }
3281 }
3282 
3284  const Reference< XPropertySet > & rPropSet,
3285  const Reference< XPropertyState > & rPropState,
3286  const Reference< XPropertySetInfo > & rPropSetInfo )
3287 {
3288  bool bExport = false;
3289  OUString sHRef, sName, sTargetFrame, sUStyleName, sVStyleName;
3290  bool bServerMap = false;
3291 
3292  if( rPropSetInfo->hasPropertyByName( gsHyperLinkURL ) &&
3293  ( !rPropState.is() || PropertyState_DIRECT_VALUE ==
3294  rPropState->getPropertyState( gsHyperLinkURL ) ) )
3295  {
3296  rPropSet->getPropertyValue( gsHyperLinkURL ) >>= sHRef;
3297 
3298  if( !sHRef.isEmpty() )
3299  bExport = true;
3300  }
3301 
3302  if ( sHRef.isEmpty() )
3303  {
3304  // hyperlink without a URL does not make sense
3305  OSL_ENSURE( false, "hyperlink without a URL --> no export to ODF" );
3306  return false;
3307  }
3308 
3309  if ( rPropSetInfo->hasPropertyByName( gsHyperLinkName )
3310  && ( !rPropState.is()
3311  || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( gsHyperLinkName ) ) )
3312  {
3313  rPropSet->getPropertyValue( gsHyperLinkName ) >>= sName;
3314  if( !sName.isEmpty() )
3315  bExport = true;
3316  }
3317 
3318  if ( rPropSetInfo->hasPropertyByName( gsHyperLinkTarget )
3319  && ( !rPropState.is()
3320  || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( gsHyperLinkTarget ) ) )
3321  {
3322  rPropSet->getPropertyValue( gsHyperLinkTarget ) >>= sTargetFrame;
3323  if( !sTargetFrame.isEmpty() )
3324  bExport = true;
3325  }
3326 
3327  if ( rPropSetInfo->hasPropertyByName( gsServerMap )
3328  && ( !rPropState.is()
3329  || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( gsServerMap ) ) )
3330  {
3331  bServerMap = *o3tl::doAccess<bool>(rPropSet->getPropertyValue( gsServerMap ));
3332  if ( bServerMap )
3333  bExport = true;
3334  }
3335 
3336  if ( rPropSetInfo->hasPropertyByName( gsUnvisitedCharStyleName )
3337  && ( !rPropState.is()
3338  || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( gsUnvisitedCharStyleName ) ) )
3339  {
3340  rPropSet->getPropertyValue( gsUnvisitedCharStyleName ) >>= sUStyleName;
3341  if( !sUStyleName.isEmpty() )
3342  bExport = true;
3343  }
3344 
3345  if ( rPropSetInfo->hasPropertyByName( gsVisitedCharStyleName )
3346  && ( !rPropState.is()
3347  || PropertyState_DIRECT_VALUE == rPropState->getPropertyState( gsVisitedCharStyleName ) ) )
3348  {
3349  rPropSet->getPropertyValue( gsVisitedCharStyleName ) >>= sVStyleName;
3350  if( !sVStyleName.isEmpty() )
3351  bExport = true;
3352  }
3353 
3354  if ( bExport )
3355  {
3357  GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference( sHRef ) );
3358 
3359  if( !sName.isEmpty() )
3361 
3362  if( !sTargetFrame.isEmpty() )
3363  {
3365  XML_TARGET_FRAME_NAME, sTargetFrame );
3366  enum XMLTokenEnum eTok = sTargetFrame == "_blank" ? XML_NEW : XML_REPLACE;
3368  }
3369 
3370  if( bServerMap )
3373 
3374  if( !sUStyleName.isEmpty() )
3376  XML_STYLE_NAME, GetExport().EncodeStyleName( sUStyleName ) );
3377 
3378  if( !sVStyleName.isEmpty() )
3380  XML_VISITED_STYLE_NAME, GetExport().EncodeStyleName( sVStyleName ) );
3381  }
3382 
3383  return bExport;
3384 }
3385 
3387  const css::uno::Reference< css::text::XTextRange > & rTextRange,
3388  Reference< XPropertySet > const & xPropSet,
3389  Reference < XPropertySetInfo > & xPropSetInfo,
3390  const bool bIsUICharStyle,
3391  const bool bHasAutoStyle,
3392  const OUString& sStyle,
3393  bool& rPrevCharIsSpace,
3394  FieldmarkType& openFieldMark )
3395 {
3396  XMLTextCharStyleNamesElementExport aCharStylesExport(
3397  GetExport(),
3398  bIsUICharStyle && aCharStyleNamesPropInfoCache.hasProperty( xPropSet, xPropSetInfo ),
3399  bHasAutoStyle,
3400  xPropSet,
3401  gsCharStyleNames );
3402 
3403  if ( !sStyle.isEmpty() )
3404  {
3405  GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, GetExport().EncodeStyleName( sStyle ) );
3406  }
3407  {
3408  SvXMLElementExport aElement( GetExport(), !sStyle.isEmpty(), XML_NAMESPACE_TEXT, XML_SPAN, false, false );
3409  const OUString aText( rTextRange->getString() );
3410  SvXMLElementExport aElem2( GetExport(), TEXT == openFieldMark,
3412  false, false );
3413  exportCharacterData(aText, rPrevCharIsSpace);
3414  openFieldMark = NONE;
3415  }
3416 }
3417 
3419  const Reference< XTextRange > & rTextRange,
3420  bool bAutoStyles,
3421  bool& rPrevCharIsSpace,
3422  FieldmarkType& openFieldMark )
3423 {
3424  Reference< XPropertySet > xPropSet( rTextRange, UNO_QUERY );
3425  if ( bAutoStyles )
3426  {
3427  Add( XmlStyleFamily::TEXT_TEXT, xPropSet );
3428  }
3429  else
3430  {
3431  bool bHyperlink = false;
3432  bool bIsUICharStyle = false;
3433  bool bHasAutoStyle = false;
3434  const OUString sStyle(
3435  FindTextStyleAndHyperlink( xPropSet, bHyperlink, bIsUICharStyle, bHasAutoStyle ) );
3436 
3437  Reference < XPropertySetInfo > xPropSetInfo;
3438  bool bHyperlinkAttrsAdded = false;
3439  if ( bHyperlink )
3440  {
3441  Reference< XPropertyState > xPropState( xPropSet, UNO_QUERY );
3442  xPropSetInfo.set( xPropSet->getPropertySetInfo() );
3443  bHyperlinkAttrsAdded = addHyperlinkAttributes( xPropSet, xPropState, xPropSetInfo );
3444  }
3445 
3446  if ( bHyperlink && bHyperlinkAttrsAdded )
3447  {
3448  SvXMLElementExport aElem( GetExport(), true, XML_NAMESPACE_TEXT, XML_A, false, false );
3449 
3450  // export events (if supported)
3451  OUString sHyperLinkEvents(
3452  "HyperLinkEvents");
3453  if (xPropSetInfo->hasPropertyByName(sHyperLinkEvents))
3454  {
3455  Reference< XNameReplace > xName( xPropSet->getPropertyValue( sHyperLinkEvents ), uno::UNO_QUERY );
3456  GetExport().GetEventExport().Export( xName, false );
3457  }
3458 
3459  exportTextRangeSpan( rTextRange, xPropSet, xPropSetInfo, bIsUICharStyle, bHasAutoStyle, sStyle, rPrevCharIsSpace, openFieldMark );
3460  }
3461  else
3462  {
3463  exportTextRangeSpan( rTextRange, xPropSet, xPropSetInfo, bIsUICharStyle, bHasAutoStyle, sStyle, rPrevCharIsSpace, openFieldMark );
3464  }
3465  }
3466 }
3467 
3469  bool& rPrevCharIsSpace )
3470 {
3471  sal_Int32 nExpStartPos = 0;
3472  sal_Int32 nEndPos = rText.getLength();
3473  sal_Int32 nSpaceChars = 0;
3474  for( sal_Int32 nPos = 0; nPos < nEndPos; nPos++ )
3475  {
3476  sal_Unicode cChar = rText[nPos];
3477  bool bExpCharAsText = true;
3478  bool bExpCharAsElement = false;
3479  bool bCurrCharIsSpace = false;
3480  switch( cChar )
3481  {
3482  case 0x0009: // Tab
3483  case 0x000A: // LF
3484  // These characters are exported as text.
3485  bExpCharAsElement = true;
3486  bExpCharAsText = false;
3487  break;
3488  case 0x000D:
3489  break; // legal character
3490  case 0x0020: // Blank
3491  if( rPrevCharIsSpace )
3492  {
3493  // If the previous character is a space character,
3494  // too, export a special space element.
3495  bExpCharAsText = false;
3496  }
3497  bCurrCharIsSpace = true;
3498  break;
3499  default:
3500  if( cChar < 0x0020 )
3501  {
3502 #ifdef DBG_UTIL
3503  OSL_ENSURE( txtparae_bContainsIllegalCharacters ||
3504  cChar >= 0x0020,
3505  "illegal character in text content" );
3506  txtparae_bContainsIllegalCharacters = true;
3507 #endif
3508  bExpCharAsText = false;
3509  }
3510  break;
3511  }
3512 
3513  // If the current character is not exported as text
3514  // the text that has not been exported by now has to be exported now.
3515  if( nPos > nExpStartPos && !bExpCharAsText )
3516  {
3517  SAL_WARN_IF( 0 != nSpaceChars, "xmloff", "pending spaces" );
3518  OUString sExp( rText.copy( nExpStartPos, nPos - nExpStartPos ) );
3519  GetExport().Characters( sExp );
3520  nExpStartPos = nPos;
3521  }
3522 
3523  // If there are spaces left that have not been exported and the
3524  // current character is not a space , the pending spaces have to be
3525  // exported now.
3526  if( nSpaceChars > 0 && !bCurrCharIsSpace )
3527  {
3528  SAL_WARN_IF( nExpStartPos != nPos, "xmloff", " pending characters" );
3529 
3530  if( nSpaceChars > 1 )
3531  {
3533  OUString::number(nSpaceChars) );
3534  }
3535 
3537  XML_S, false, false );
3538 
3539  nSpaceChars = 0;
3540  }
3541 
3542  // If the current character has to be exported as a special
3543  // element, the element will be exported now.
3544  if( bExpCharAsElement )
3545  {
3546  switch( cChar )
3547  {
3548  case 0x0009: // Tab
3549  {
3551  XML_TAB, false,
3552  false );
3553  }
3554  break;
3555  case 0x000A: // LF
3556  {
3558  XML_LINE_BREAK, false,
3559  false );
3560  }
3561  break;
3562  }
3563  }
3564 
3565  // If the current character is a space, and the previous one
3566  // is a space, too, the number of pending spaces is incremented
3567  // only.
3568  if( bCurrCharIsSpace && rPrevCharIsSpace )
3569  nSpaceChars++;
3570  rPrevCharIsSpace = bCurrCharIsSpace;
3571 
3572  // If the current character is not exported as text, the start
3573  // position for text is the position behind the current position.
3574  if( !bExpCharAsText )
3575  {
3576  SAL_WARN_IF( nExpStartPos != nPos, "xmloff", "wrong export start pos" );
3577  nExpStartPos = nPos+1;
3578  }
3579  }
3580 
3581  if( nExpStartPos < nEndPos )
3582  {
3583  SAL_WARN_IF( 0 != nSpaceChars, "xmloff", " pending spaces " );
3584  OUString sExp( rText.copy( nExpStartPos, nEndPos - nExpStartPos ) );
3585  GetExport().Characters( sExp );
3586  }
3587 
3588  // If there are some spaces left, they have to be exported now.
3589  if( nSpaceChars > 0 )
3590  {
3591  if( nSpaceChars > 1 )
3592  {
3594  OUString::number(nSpaceChars) );
3595  }
3596 
3598  false, false );
3599  }
3600 }
3601 
3603 {
3604  pFieldExport->ExportFieldDeclarations();
3605 
3606  // get XPropertySet from the document and ask for AutoMarkFileURL.
3607  // If it exists, export the auto-mark-file element.
3608  Reference<XPropertySet> xPropertySet( GetExport().GetModel(), UNO_QUERY );
3609  if (!xPropertySet.is())
3610  return;
3611 
3612  OUString sUrl;
3613  OUString sIndexAutoMarkFileURL(
3614  "IndexAutoMarkFileURL");
3615  if (!xPropertySet->getPropertySetInfo()->hasPropertyByName(
3616  sIndexAutoMarkFileURL))
3617  return;
3618 
3619  xPropertySet->getPropertyValue(sIndexAutoMarkFileURL) >>= sUrl;
3620  if (!sUrl.isEmpty())
3621  {
3623  GetExport().GetRelativeReference(sUrl) );
3624  SvXMLElementExport aAutoMarkElement(
3627  true, true );
3628  }
3629 }
3630 
3632  const Reference<XText> & rText )
3633 {
3634  pFieldExport->ExportFieldDeclarations(rText);
3635 }
3636 
3638 {
3639  pFieldExport->SetExportOnlyUsedFieldDeclarations( false/*bOnlyUsed*/ );
3640 }
3641 
3643 {
3644  if (nullptr != pRedlineExport)
3645  pRedlineExport->ExportChangesList( bAutoStyles );
3646 }
3647 
3649  const Reference<XText> & rText,
3650  bool bAutoStyle)
3651 {
3652  if (nullptr != pRedlineExport)
3653  pRedlineExport->ExportChangesList(rText, bAutoStyle);
3654 }
3655 
3657  const Reference<XText> & rText )
3658 {
3659  if (nullptr != pRedlineExport)
3660  pRedlineExport->SetCurrentXText(rText);
3661 }
3662 
3664 {
3665  if (nullptr != pRedlineExport)
3666  pRedlineExport->SetCurrentXText();
3667 }
3668 
3670 
3672 {
3673  // tdf#135942: do not collect styles during their export: this may modify iterated containers
3674  mbCollected = true;
3676 
3678 
3680 
3682 
3684 
3686 
3688 }
3689 
3691  const Reference<XPropertySet> & rPropSet,
3692  bool bAutoStyles )
3693 {
3694  // early out: a collapsed ruby makes no sense
3695  if (*o3tl::doAccess<bool>(rPropSet->getPropertyValue(gsIsCollapsed)))
3696  return;
3697 
3698  // start value ?
3699  bool bStart = *o3tl::doAccess<bool>(rPropSet->getPropertyValue(gsIsStart));
3700 
3701  if (bAutoStyles)
3702  {
3703  // ruby auto styles
3704  if (bStart)
3705  Add( XmlStyleFamily::TEXT_RUBY, rPropSet );
3706  }
3707  else
3708  {
3709  if (bStart)
3710  {
3711  // ruby start
3712 
3713  // we can only start a ruby if none is open
3714  assert(!bOpenRuby && "Can't open a ruby inside of ruby!");
3715  if( bOpenRuby )
3716  return;
3717 
3718  // save ruby text + ruby char style
3719  rPropSet->getPropertyValue(gsRubyText) >>= sOpenRubyText;
3720  rPropSet->getPropertyValue(gsRubyCharStyleName) >>= sOpenRubyCharStyle;
3721 
3722  // ruby style
3724  OUString sStyleName(Find(XmlStyleFamily::TEXT_RUBY, rPropSet, ""));
3725  SAL_WARN_IF(sStyleName.isEmpty(), "xmloff", "Can't find ruby style!");
3727  XML_STYLE_NAME, sStyleName);
3728 
3729  // export <text:ruby> and <text:ruby-base> start elements
3733  false );
3734  bOpenRuby = true;
3735  }
3736  else
3737  {
3738  // ruby end
3739 
3740  // check for an open ruby
3741  assert(bOpenRuby && "Can't close a ruby if none is open!");
3742  if( !bOpenRuby )
3743  return;
3744 
3745  // close <text:ruby-base>
3747  false);
3748 
3749  // write the ruby text (with char style)
3750  {
3751  if (!sOpenRubyCharStyle.isEmpty())
3754  GetExport().EncodeStyleName( sOpenRubyCharStyle) );
3755 
3756  SvXMLElementExport aRubyElement(
3758  false, false);
3759 
3761  }
3762 
3763  // and finally, close the ruby
3765  bOpenRuby = false;
3766  }
3767  }
3768 }
3769 
3771  const Reference<XPropertySet> & i_xPortion,
3772  bool i_bAutoStyles, bool i_isProgress, bool & rPrevCharIsSpace)
3773 {
3774  bool doExport(!i_bAutoStyles); // do not export element if autostyles
3775  // check version >= 1.2
3776  switch (GetExport().getSaneDefaultVersion()) {
3777  case SvtSaveOptions::ODFSVER_011: // fall through
3778  case SvtSaveOptions::ODFSVER_010: doExport = false; break;
3779  default: break;
3780  }
3781 
3782  const Reference< XTextContent > xTextContent(
3783  i_xPortion->getPropertyValue("InContentMetadata"), UNO_QUERY_THROW);
3784  const Reference< XEnumerationAccess > xEA( xTextContent, UNO_QUERY_THROW );
3785  const Reference< XEnumeration > xTextEnum( xEA->createEnumeration() );
3786 
3787  if (doExport)
3788  {
3789  const Reference<rdf::XMetadatable> xMeta(xTextContent, UNO_QUERY_THROW);
3790 
3791  // text:meta with neither xml:id nor RDFa is invalid
3792  xMeta->ensureMetadataReference();
3793 
3794  // xml:id and RDFa for RDF metadata
3795  GetExport().AddAttributeXmlId(xMeta);
3796  GetExport().AddAttributesRDFa(xTextContent);
3797  }
3798 
3799  SvXMLElementExport aElem( GetExport(), doExport,
3800  XML_NAMESPACE_TEXT, XML_META, false, false );
3801 
3802  // recurse to export content
3803  exportTextRangeEnumeration(xTextEnum, i_bAutoStyles, i_isProgress, rPrevCharIsSpace);
3804 }
3805 
3807  const Reference<XIndexAccess> & rShapes,
3808  const rtl::Reference<xmloff::OFormLayerXMLExport>& xFormExport )
3809 {
3810  // check parameters ad pre-conditions
3811  if( ( ! rShapes.is() ) || ( ! xFormExport.is() ) )
3812  {
3813  // if we don't have shapes or a form export, there's nothing to do
3814  return;
3815  }
3816  SAL_WARN_IF( pSectionExport == nullptr, "xmloff", "We need the section export." );
3817 
3818  Reference<XEnumeration> xShapesEnum = pBoundFrameSets->GetShapes()->createEnumeration();
3819  if(!xShapesEnum.is())
3820  return;
3821  while( xShapesEnum->hasMoreElements() )
3822  {
3823  // now we need to check
3824  // 1) if this is a control shape, and
3825  // 2) if it's in a mute section
3826  // if both answers are 'yes', notify the form layer export
3827 
3828  // we join accessing the shape and testing for control
3829  Reference<XControlShape> xControlShape(xShapesEnum->nextElement(), UNO_QUERY);
3830  if( xControlShape.is() )
3831  {
3832  // Reference<XPropertySet> xPropSet( xControlShape, UNO_QUERY );
3833  // Reference<XTextContent> xTextContent;
3834  // xPropSet->getPropertyValue("TextRange") >>= xTextContent;
3835 
3836  Reference<XTextContent> xTextContent( xControlShape, UNO_QUERY );
3837  if( xTextContent.is() )
3838  {
3839  if( pSectionExport->IsMuteSection( xTextContent, false ) )
3840  {
3841  // Ah, we've found a shape that
3842  // 1) is a control shape
3843  // 2) is anchored in a mute section
3844  // so: don't export it!
3845  xFormExport->excludeFromExport(
3846  xControlShape->getControl() );
3847  }
3848  // else: not in mute section -> should be exported -> nothing
3849  // to do
3850  }
3851  // else: no anchor -> ignore
3852  }
3853  // else: no control shape -> nothing to do
3854  }
3855 }
3856 
3858 {
3859  maTextListsHelperStack.emplace_back( new XMLTextListsHelper() );
3861 }
3862 
3864 {
3865  mpTextListsHelper = nullptr;
3866  maTextListsHelperStack.pop_back();
3867  if ( !maTextListsHelperStack.empty() )
3868  {
3870  }
3871 }
3872 
3873 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
rtl::Reference< SvXMLExportPropertyMapper > xFramePropMapper
Definition: txtparae.hxx:86
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:1185
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:1390
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
virtual void _collectTextEmbeddedAutoStyles(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Definition: txtparae.cxx:3228
static const char * aParagraphPropertyNames[]
Definition: txtparae.cxx:348
rtl::Reference< XMLShapeExport > const & GetShapeExport()
Definition: xmlexp.hxx:570
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:2941
#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:2247
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:562
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:396
void CheckAttrList()
Definition: xmlexp.cxx:1015
void exportFrameFrames(bool bAutoStyles, bool bProgress, const css::uno::Reference< css::text::XTextFrame > *pParentTxtFrame)
Definition: txtparae.cxx:1356
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:2339
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:1397
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:141
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:3770
void exportParagraph(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, bool bProgress, bool bExportParagraph, MultiPropertySetHelper &rPropSetHelper, TextPNS eExtensionNS)
Definition: txtparae.cxx:1828
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:1667
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:2273
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:2508
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:1937
This class handles the export of index marks for table of content, alphabetical and user index...
virtual ~XMLTextParagraphExport() override
Definition: txtparae.cxx:1286
void exportEvents(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Definition: txtparae.cxx:3240
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:2524
int nCount
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
Definition: xmlexp.cxx:910
const BoundFrames * GetEmbeddeds() const
Definition: txtparae.cxx:292
void StartElement(sal_uInt16 nPrefix, enum::xmloff::token::XMLTokenEnum eName, bool bIgnWSOutside)
Definition: xmlexp.cxx:2090
void exportTrackedChanges(bool bAutoStyle)
Export the list of change information (enclosed by ) (or the necessary automatic sty...
Definition: txtparae.cxx:3642
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:3233
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 iterator begin() const noexcept
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:1834
B2IRange fround(const B2DRange &rRange)
const char * sName
void exportCharacterData(const OUString &rText, bool &rPrevCharWasSpace)
Definition: txtparae.cxx:3468
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:1856
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:2263
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")
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:1985
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:3602
static SvXMLExportPropertyMapper * CreateParaDefaultExtPropMapper(SvXMLExport &rExport)
Definition: txtparae.cxx:1324
virtual void exportTable(const css::uno::Reference< css::text::XTextContent > &rTextContent, bool bAutoStyles, bool bProgress)
Definition: txtparae.cxx:2382
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:3656
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:2112
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")
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:1332
float u
static SvXMLExportPropertyMapper * CreateCharExtPropMapper(SvXMLExport &rExport)
Definition: txtparae.cxx:1308
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:2001
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:3418
This class handles the export of sections and indices (which are, internally, just sections)...
enum XMLTokenEnum lcl_XmlBookmarkElements[]
Definition: txtparae.cxx:1392
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:3663
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:3283
void exportRuby(const css::uno::Reference< css::beans::XPropertySet > &rPortionPropSet, bool bAutoStyles)
export a ruby
Definition: txtparae.cxx:3690
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:2873
constexpr iterator end() const noexcept
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:3806
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:2434
void ClearAttrList()
Definition: xmlexp.cxx:1009
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:2147
constexpr OUStringLiteral gsParagraphService(u"com.sun.star.text.Paragraph")
virtual void exportTableAutoStyles()
Definition: txtparae.cxx:3669
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:3386
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:3252
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3455
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:3040
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:2125
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
OUString Find(XmlStyleFamily nFamily, const css::uno::Reference< css::beans::XPropertySet > &rPropSet, const OUString &rParent, const o3tl::span< const XMLPropertyState > aAddStates={}) const
find style name for specified family and parent
Definition: txtparae.cxx:734
XMLShapeExportFlags
Definition: shapeexport.hxx:49
sal_Int32 AddFieldMarkStart(Reference< XFormField > const &i_xFieldMark)
Definition: txtparae.cxx:1189
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:139
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:1207
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:1300
bool AddEmbeddedXGraphicAsBase64(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic)
Definition: xmlexp.cxx:1871
constexpr OUStringLiteral sHidden
#define CTF_HYPERLINK_URL
Definition: txtprmap.hxx:140
FieldMarkMap_t m_FieldMarkMap
Definition: txtparae.cxx:1186
std::unique_ptr< XMLIndexMarkExport > pIndexMarkExport
Definition: txtparae.hxx:96
#define SAL_WARN(area, stream)
static SvXMLExportPropertyMapper * CreateParaExtPropMapper(SvXMLExport &rExport)
Definition: txtparae.cxx:1316
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:769
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:2289
SinglePropertySetInfoCache aCharStyleNamesPropInfoCache
Definition: txtparae.hxx:156
sal_Int32 GetFieldMarkIndex(Reference< XFormField > const &i_xFieldMark)
Definition: txtparae.cxx:1196
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:2760
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:849
sal_uInt16 nPos
void exportUsedDeclarations()
export all declarations
Definition: txtparae.cxx:3637
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) )