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