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