LibreOffice Module xmloff (master)  1
XMLTextFrameContext.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 <osl/diagnose.h>
21 #include <sal/log.hxx>
22 #include <tools/diagnose_ex.h>
23 #include <comphelper/base64.hxx>
24 #include <com/sun/star/frame/XModel.hpp>
25 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
26 #include <com/sun/star/text/TextContentAnchorType.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/text/XTextFrame.hpp>
29 #include <com/sun/star/container/XNamed.hpp>
30 #include <com/sun/star/container/XNameContainer.hpp>
31 #include <com/sun/star/graphic/XGraphic.hpp>
32 #include <com/sun/star/text/SizeType.hpp>
33 #include <com/sun/star/drawing/XShape.hpp>
34 #include <com/sun/star/document/XEventsSupplier.hpp>
35 #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
36 #include <com/sun/star/io/XOutputStream.hpp>
37 #include <com/sun/star/text/HoriOrientation.hpp>
38 #include <com/sun/star/text/VertOrientation.hpp>
39 #include <sax/tools/converter.hxx>
40 #include <xmloff/xmlimp.hxx>
41 #include <xmloff/xmltoken.hxx>
42 #include <xmloff/xmlnamespace.hxx>
43 #include <xmloff/namespacemap.hxx>
44 #include <xmloff/xmluconv.hxx>
45 #include "XMLAnchorTypePropHdl.hxx"
49 #include <xmloff/prstylei.hxx>
50 #include <xmloff/i18nmap.hxx>
51 #include <xexptran.hxx>
52 #include <xmloff/shapeimport.hxx>
54 #include <XMLImageMapContext.hxx>
55 #include "XMLTextFrameContext.hxx"
56 #include <xmloff/attrlist.hxx>
63 #include <map>
64 #include <string_view>
65 
66 using namespace ::com::sun::star;
67 using namespace ::com::sun::star::uno;
68 using namespace ::com::sun::star::text;
69 using namespace ::com::sun::star::xml::sax;
70 using namespace ::com::sun::star::beans;
71 using namespace ::com::sun::star::lang;
72 using namespace ::com::sun::star::container;
73 using namespace ::com::sun::star::drawing;
74 using namespace ::com::sun::star::document;
75 using namespace ::xmloff::token;
76 using ::com::sun::star::document::XEventsSupplier;
77 
78 #define XML_TEXT_FRAME_TEXTBOX 1
79 #define XML_TEXT_FRAME_GRAPHIC 2
80 #define XML_TEXT_FRAME_OBJECT 3
81 #define XML_TEXT_FRAME_OBJECT_OLE 4
82 #define XML_TEXT_FRAME_APPLET 5
83 #define XML_TEXT_FRAME_PLUGIN 6
84 #define XML_TEXT_FRAME_FLOATING_FRAME 7
85 
86 typedef ::std::map < const OUString, OUString > ParamMap;
87 
89 {
90  OUString sHRef;
91  OUString sName;
92  OUString sTargetFrameName;
93  bool bMap;
94 
95 public:
96 
97  inline XMLTextFrameContextHyperlink_Impl( const OUString& rHRef,
98  const OUString& rName,
99  const OUString& rTargetFrameName,
100  bool bMap );
101 
102  const OUString& GetHRef() const { return sHRef; }
103  const OUString& GetName() const { return sName; }
104  const OUString& GetTargetFrameName() const { return sTargetFrameName; }
105  bool GetMap() const { return bMap; }
106 };
107 
109  const OUString& rHRef, const OUString& rName,
110  const OUString& rTargetFrameName, bool bM ) :
111  sHRef( rHRef ),
112  sName( rName ),
113  sTargetFrameName( rTargetFrameName ),
114  bMap( bM )
115 {
116 }
117 
118 namespace {
119 
120 // Implement Title/Description Elements UI (#i73249#)
121 class XMLTextFrameTitleOrDescContext_Impl : public SvXMLImportContext
122 {
123  OUString& mrTitleOrDesc;
124 
125 public:
126 
127 
128  XMLTextFrameTitleOrDescContext_Impl( SvXMLImport& rImport,
129  OUString& rTitleOrDesc );
130 
131  virtual void SAL_CALL characters( const OUString& rText ) override;
132 };
133 
134 }
135 
136 XMLTextFrameTitleOrDescContext_Impl::XMLTextFrameTitleOrDescContext_Impl(
137  SvXMLImport& rImport,
138  OUString& rTitleOrDesc )
139  : SvXMLImportContext( rImport )
140  , mrTitleOrDesc( rTitleOrDesc )
141 {
142 }
143 
144 void XMLTextFrameTitleOrDescContext_Impl::characters( const OUString& rText )
145 {
146  mrTitleOrDesc += rText;
147 }
148 
149 namespace {
150 
151 class XMLTextFrameParam_Impl : public SvXMLImportContext
152 {
153 public:
154  XMLTextFrameParam_Impl( SvXMLImport& rImport,
155  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
156  ParamMap &rParamMap);
157 };
158 
159 }
160 
161 XMLTextFrameParam_Impl::XMLTextFrameParam_Impl(
162  SvXMLImport& rImport,
163  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
164  ParamMap &rParamMap):
165  SvXMLImportContext( rImport )
166 {
167  OUString sName, sValue;
168  bool bFoundValue = false; // to allow empty values
169  for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
170  {
171  switch (aIter.getToken())
172  {
173  case XML_ELEMENT(DRAW, XML_VALUE):
174  {
175  sValue = aIter.toString();
176  bFoundValue = true;
177  break;
178  }
179  case XML_ELEMENT(DRAW, XML_NAME):
180  sName = aIter.toString();
181  break;
182  default:
183  XMLOFF_WARN_UNKNOWN("xmloff", aIter);
184  }
185  }
186  if (!sName.isEmpty() && bFoundValue )
187  rParamMap[sName] = sValue;
188 }
189 
190 namespace {
191 
192 class XMLTextFrameContourContext_Impl : public SvXMLImportContext
193 {
195 
196 public:
197 
198 
199  XMLTextFrameContourContext_Impl( SvXMLImport& rImport, sal_Int32 nElement,
200  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
201  const Reference < XPropertySet >& rPropSet,
202  bool bPath );
203 };
204 
205 }
206 
207 XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl(
208  SvXMLImport& rImport,
209  sal_Int32 /*nElement*/,
210  const Reference< XFastAttributeList > & xAttrList,
211  const Reference < XPropertySet >& rPropSet,
212  bool bPath ) :
213  SvXMLImportContext( rImport ),
214  xPropSet( rPropSet )
215 {
216  OUString sD, sPoints, sViewBox;
217  bool bPixelWidth = false, bPixelHeight = false;
218  bool bAuto = false;
219  sal_Int32 nWidth = 0;
220  sal_Int32 nHeight = 0;
221 
222  for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
223  {
224  switch( aIter.getToken() )
225  {
226  case XML_ELEMENT(SVG, XML_VIEWBOX):
227  case XML_ELEMENT(SVG_COMPAT, XML_VIEWBOX):
228  sViewBox = aIter.toString();
229  break;
230  case XML_ELEMENT(SVG, XML_D):
231  case XML_ELEMENT(SVG_COMPAT, XML_D):
232  if( bPath )
233  sD = aIter.toString();
234  break;
235  case XML_ELEMENT(DRAW,XML_POINTS):
236  if( !bPath )
237  sPoints = aIter.toString();
238  break;
239  case XML_ELEMENT(SVG, XML_WIDTH):
240  case XML_ELEMENT(SVG_COMPAT, XML_WIDTH):
241  if (::sax::Converter::convertMeasurePx(nWidth, aIter.toView()))
242  bPixelWidth = true;
243  else
244  GetImport().GetMM100UnitConverter().convertMeasureToCore(
245  nWidth, aIter.toView());
246  break;
247  case XML_ELEMENT(SVG, XML_HEIGHT):
248  case XML_ELEMENT(SVG_COMPAT, XML_HEIGHT):
249  if (::sax::Converter::convertMeasurePx(nHeight, aIter.toView()))
250  bPixelHeight = true;
251  else
252  GetImport().GetMM100UnitConverter().convertMeasureToCore(
253  nHeight, aIter.toView());
254  break;
255  case XML_ELEMENT(DRAW, XML_RECREATE_ON_EDIT):
256  bAuto = IsXMLToken(aIter, XML_TRUE);
257  break;
258  }
259  }
260 
261  OUString sContourPolyPolygon("ContourPolyPolygon");
262  Reference < XPropertySetInfo > xPropSetInfo = rPropSet->getPropertySetInfo();
263 
264  if(!xPropSetInfo->hasPropertyByName(sContourPolyPolygon) ||
265  nWidth <= 0 || nHeight <= 0 || bPixelWidth != bPixelHeight ||
266  !(bPath ? sD : sPoints).getLength())
267  return;
268 
269  const SdXMLImExViewBox aViewBox( sViewBox, GetImport().GetMM100UnitConverter());
270  basegfx::B2DPolyPolygon aPolyPolygon;
271 
272  if( bPath )
273  {
274  basegfx::utils::importFromSvgD(aPolyPolygon, sD, GetImport().needFixPositionAfterZ(), nullptr);
275  }
276  else
277  {
278  basegfx::B2DPolygon aPolygon;
279 
280  if(basegfx::utils::importFromSvgPoints(aPolygon, sPoints))
281  {
282  aPolyPolygon = basegfx::B2DPolyPolygon(aPolygon);
283  }
284  }
285 
286  if(aPolyPolygon.count())
287  {
288  const basegfx::B2DRange aSourceRange(
289  aViewBox.GetX(), aViewBox.GetY(),
290  aViewBox.GetX() + aViewBox.GetWidth(), aViewBox.GetY() + aViewBox.GetHeight());
291  const basegfx::B2DRange aTargetRange(
292  0.0, 0.0,
293  nWidth, nHeight);
294 
295  if(!aSourceRange.equal(aTargetRange))
296  {
297  aPolyPolygon.transform(
299  aSourceRange,
300  aTargetRange));
301  }
302 
303  css::drawing::PointSequenceSequence aPointSequenceSequence;
304  basegfx::utils::B2DPolyPolygonToUnoPointSequenceSequence(aPolyPolygon, aPointSequenceSequence);
305  xPropSet->setPropertyValue( sContourPolyPolygon, Any(aPointSequenceSequence) );
306  }
307 
308  static const OUStringLiteral sIsPixelContour(u"IsPixelContour");
309 
310  if( xPropSetInfo->hasPropertyByName( sIsPixelContour ) )
311  {
312  xPropSet->setPropertyValue( sIsPixelContour, Any(bPixelWidth) );
313  }
314 
315  static const OUStringLiteral sIsAutomaticContour(u"IsAutomaticContour");
316 
317  if( xPropSetInfo->hasPropertyByName( sIsAutomaticContour ) )
318  {
319  xPropSet->setPropertyValue( sIsAutomaticContour, Any(bAuto) );
320  }
321 }
322 
323 namespace {
324 
325 class XMLTextFrameContext_Impl : public SvXMLImportContext
326 {
327  css::uno::Reference < css::text::XTextCursor > xOldTextCursor;
328  css::uno::Reference < css::beans::XPropertySet > xPropSet;
329  css::uno::Reference < css::io::XOutputStream > xBase64Stream;
330 
332  bool mbListContextPushed;
333 
334  OUString m_sOrigName;
335  OUString sName;
336  OUString sStyleName;
337  OUString sNextName;
338  OUString sHRef;
339  OUString sCode;
340  OUString sMimeType;
341  OUString sFrameName;
342  OUString sAppletName;
343  OUString sFilterService;
344  OUString sBase64CharsLeft;
345  OUString sTblName;
346  OUStringBuffer maUrlBuffer;
347 
348  ParamMap aParamMap;
349 
350  sal_Int32 nX;
351  sal_Int32 nY;
352  sal_Int32 nWidth;
353  sal_Int32 nHeight;
354  sal_Int32 nZIndex;
355  sal_Int16 nPage;
356  sal_Int16 nRotation;
357  sal_Int16 nRelWidth;
358  sal_Int16 nRelHeight;
359 
360  sal_uInt16 nType;
361  css::text::TextContentAnchorType eAnchorType;
362 
363  bool bMayScript : 1;
364  bool bMinWidth : 1;
365  bool bMinHeight : 1;
366  bool bSyncWidth : 1;
367  bool bSyncHeight : 1;
368  bool bCreateFailed : 1;
369  bool bOwnBase64Stream : 1;
370  bool mbMultipleContent : 1; // This context is created based on a multiple content (image)
371 
372  void Create();
373 
374 public:
375 
376 
377  bool CreateIfNotThere();
378  const OUString& GetHRef() const { return sHRef; }
379 
380  XMLTextFrameContext_Impl( SvXMLImport& rImport,
381  sal_Int32 nElement,
382  const css::uno::Reference<css::xml::sax::XFastAttributeList > & rAttrList,
383  css::text::TextContentAnchorType eAnchorType,
384  sal_uInt16 nType,
385  const css::uno::Reference<css::xml::sax::XFastAttributeList > & rFrameAttrList,
386  bool bMultipleContent = false );
387 
388  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
389 
390  virtual void SAL_CALL characters( const OUString& rChars ) override;
391 
392  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
393  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
394 
395  void SetHyperlink( const OUString& rHRef,
396  const OUString& rName,
397  const OUString& rTargetFrameName,
398  bool bMap );
399 
400  // Implement Title/Description Elements UI (#i73249#)
401  void SetTitle( const OUString& rTitle );
402 
403  void SetDesc( const OUString& rDesc );
404 
405  void SetName();
406 
407  const OUString& GetOrigName() const { return m_sOrigName; }
408 
409  css::text::TextContentAnchorType GetAnchorType() const { return eAnchorType; }
410 
411  const css::uno::Reference < css::beans::XPropertySet >& GetPropSet() const { return xPropSet; }
412 };
413 
414 }
415 
416 void XMLTextFrameContext_Impl::Create()
417 {
418  rtl::Reference < XMLTextImportHelper > xTextImportHelper =
419  GetImport().GetTextImport();
420 
421  switch ( nType)
422  {
425  if( xBase64Stream.is() )
426  {
427  OUString sURL( GetImport().ResolveEmbeddedObjectURLFromBase64() );
428  if( !sURL.isEmpty() )
429  xPropSet = GetImport().GetTextImport()
430  ->createAndInsertOLEObject( GetImport(), sURL,
431  sStyleName,
432  sTblName,
433  nWidth, nHeight );
434  }
435  else if( !sHRef.isEmpty() )
436  {
437  OUString sURL( GetImport().ResolveEmbeddedObjectURL( sHRef,
438  std::u16string_view() ) );
439 
440  if( GetImport().IsPackageURL( sHRef ) )
441  {
442  xPropSet = GetImport().GetTextImport()
443  ->createAndInsertOLEObject( GetImport(), sURL,
444  sStyleName,
445  sTblName,
446  nWidth, nHeight );
447  }
448  else
449  {
450  // it should be an own OOo link that has no storage persistence
451  xPropSet = GetImport().GetTextImport()
452  ->createAndInsertOOoLink( GetImport(),
453  sURL,
454  sStyleName,
455  sTblName,
456  nWidth, nHeight );
457  }
458  }
459  else
460  {
461  OUString sURL = "vnd.sun.star.ServiceName:" + sFilterService;
462  xPropSet = GetImport().GetTextImport()
463  ->createAndInsertOLEObject( GetImport(), sURL,
464  sStyleName,
465  sTblName,
466  nWidth, nHeight );
467 
468  }
469  break;
471  {
472  xPropSet = GetImport().GetTextImport()
473  ->createAndInsertApplet( sAppletName, sCode,
474  bMayScript, sHRef,
475  nWidth, nHeight);
476  break;
477  }
479  {
480  if(!sHRef.isEmpty())
481  GetImport().GetAbsoluteReference(sHRef);
482  xPropSet = GetImport().GetTextImport()
483  ->createAndInsertPlugin( sMimeType, sHRef,
484  nWidth, nHeight);
485 
486  break;
487  }
489  {
490  xPropSet = GetImport().GetTextImport()
491  ->createAndInsertFloatingFrame( sFrameName, sHRef,
492  sStyleName,
493  nWidth, nHeight);
494  break;
495  }
496  default:
497  {
498  Reference<XMultiServiceFactory> xFactory( GetImport().GetModel(),
499  UNO_QUERY );
500  if( xFactory.is() )
501  {
502  OUString sServiceName;
503  switch( nType )
504  {
505  case XML_TEXT_FRAME_TEXTBOX: sServiceName = "com.sun.star.text.TextFrame"; break;
506  case XML_TEXT_FRAME_GRAPHIC: sServiceName = "com.sun.star.text.GraphicObject"; break;
507  }
508  Reference<XInterface> xIfc = xFactory->createInstance( sServiceName );
509  SAL_WARN_IF( !xIfc.is(), "xmloff.text", "couldn't create frame" );
510  if( xIfc.is() )
511  xPropSet.set( xIfc, UNO_QUERY );
512  }
513  }
514  }
515 
516  if( !xPropSet.is() )
517  {
518  bCreateFailed = true;
519  return;
520  }
521 
522  Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
523 
524  // Skip duplicated frames
525  if(!mbMultipleContent && // It's allowed to have multiple image for the same frame
526  !sName.isEmpty() &&
527  xTextImportHelper->IsDuplicateFrame(sName, nX, nY, nWidth, nHeight))
528  {
529  bCreateFailed = true;
530  return;
531  }
532 
533  // set name
534  Reference < XNamed > xNamed( xPropSet, UNO_QUERY );
535  if( xNamed.is() )
536  {
537  OUString sOrigName( xNamed->getName() );
538  if( sOrigName.isEmpty() ||
539  (!sName.isEmpty() && sOrigName != sName) )
540  {
541  OUString sOldName( sName );
542 
543  sal_Int32 i = 0;
544  while( xTextImportHelper->HasFrameByName( sName ) )
545  {
546  sName = sOldName + OUString::number( ++i );
547  }
548  xNamed->setName( sName );
549  if( sName != sOldName )
550  {
551  xTextImportHelper->GetRenameMap().Add( XML_TEXT_RENAME_TYPE_FRAME,
552  sOldName, sName );
553 
554  }
555  }
556  }
557 
558  // frame style
559  XMLPropStyleContext *pStyle = nullptr;
560  if( !sStyleName.isEmpty() )
561  {
562  pStyle = xTextImportHelper->FindAutoFrameStyle( sStyleName );
563  if( pStyle )
564  sStyleName = pStyle->GetParentName();
565  }
566 
567  Any aAny;
568  if( !sStyleName.isEmpty() )
569  {
570  OUString sDisplayStyleName( GetImport().GetStyleDisplayName(
571  XmlStyleFamily::SD_GRAPHICS_ID, sStyleName ) );
572  const Reference < XNameContainer > & rStyles =
573  xTextImportHelper->GetFrameStyles();
574  if( rStyles.is() &&
575  rStyles->hasByName( sDisplayStyleName ) )
576  {
577  xPropSet->setPropertyValue( "FrameStyleName", Any(sDisplayStyleName) );
578  }
579  }
580 
581  // anchor type (must be set before any other properties, because
582  // otherwise some orientations cannot be set or will be changed
583  // afterwards)
584  xPropSet->setPropertyValue( "AnchorType", Any(eAnchorType) );
585 
586  // hard properties
587  if( pStyle )
588  pStyle->FillPropertySet( xPropSet );
589 
590  // x and y
591  sal_Int16 nHoriOrient = HoriOrientation::NONE;
592  aAny = xPropSet->getPropertyValue( "HoriOrient" );
593  aAny >>= nHoriOrient;
594  if( HoriOrientation::NONE == nHoriOrient )
595  {
596  xPropSet->setPropertyValue( "HoriOrientPosition", Any(nX) );
597  }
598 
599  sal_Int16 nVertOrient = VertOrientation::NONE;
600  aAny = xPropSet->getPropertyValue( "VertOrient" );
601  aAny >>= nVertOrient;
602  if( VertOrientation::NONE == nVertOrient )
603  {
604  xPropSet->setPropertyValue( "VertOrientPosition", Any(nY) );
605  }
606 
607  // width
608  if( nWidth > 0 )
609  {
610  xPropSet->setPropertyValue( "Width", Any(nWidth) );
611  }
612  if( nRelWidth > 0 || nWidth > 0 )
613  {
614  xPropSet->setPropertyValue( "RelativeWidth", Any(nRelWidth) );
615  }
616  if( bSyncWidth || nWidth > 0 )
617  {
618  xPropSet->setPropertyValue( "IsSyncWidthToHeight", Any(bSyncWidth) );
619  }
620  if( xPropSetInfo->hasPropertyByName( "WidthType" ) &&
621  (bMinWidth || nWidth > 0 || nRelWidth > 0 ) )
622  {
623  sal_Int16 nSizeType =
624  (bMinWidth && XML_TEXT_FRAME_TEXTBOX == nType) ? SizeType::MIN
625  : SizeType::FIX;
626  xPropSet->setPropertyValue( "WidthType", Any(nSizeType) );
627  }
628 
629  if( nHeight > 0 )
630  {
631  xPropSet->setPropertyValue( "Height", Any(nHeight) );
632  }
633  if( nRelHeight > 0 || nHeight > 0 )
634  {
635  xPropSet->setPropertyValue( "RelativeHeight", Any(nRelHeight) );
636  }
637  if( bSyncHeight || nHeight > 0 )
638  {
639  xPropSet->setPropertyValue( "IsSyncHeightToWidth", Any(bSyncHeight) );
640  }
641  if( xPropSetInfo->hasPropertyByName( "SizeType" ) &&
642  (bMinHeight || nHeight > 0 || nRelHeight > 0 ) )
643  {
644  sal_Int16 nSizeType =
645  (bMinHeight && XML_TEXT_FRAME_TEXTBOX == nType) ? SizeType::MIN
646  : SizeType::FIX;
647  xPropSet->setPropertyValue( "SizeType", Any(nSizeType) );
648  }
649 
650  if( XML_TEXT_FRAME_GRAPHIC == nType )
651  {
652  // URL
653  OSL_ENSURE( !sHRef.isEmpty() || xBase64Stream.is(),
654  "neither URL nor base64 image data given" );
655  uno::Reference<graphic::XGraphic> xGraphic;
656  if (!sHRef.isEmpty())
657  {
658  xGraphic = GetImport().loadGraphicByURL(sHRef);
659  }
660  else if (xBase64Stream.is())
661  {
662  xGraphic = GetImport().loadGraphicFromBase64(xBase64Stream);
663  xBase64Stream = nullptr;
664  }
665 
666  if (xGraphic.is())
667  xPropSet->setPropertyValue("Graphic", Any(xGraphic));
668 
669  // filter name
670  xPropSet->setPropertyValue( "GraphicFilter", Any(OUString()) );
671 
672  // rotation
673  xPropSet->setPropertyValue( "GraphicRotation", Any(nRotation) );
674  }
675 
676  // page number (must be set after the frame is inserted, because it
677  // will be overwritten then inserting the frame.
678  if( TextContentAnchorType_AT_PAGE == eAnchorType && nPage > 0 )
679  {
680  xPropSet->setPropertyValue( "AnchorPageNo", Any(nPage) );
681  }
682 
683  if( XML_TEXT_FRAME_OBJECT != nType &&
684  XML_TEXT_FRAME_OBJECT_OLE != nType &&
685  XML_TEXT_FRAME_APPLET != nType &&
686  XML_TEXT_FRAME_PLUGIN!= nType &&
688  {
689  Reference < XTextContent > xTxtCntnt( xPropSet, UNO_QUERY );
690  try
691  {
692  xTextImportHelper->InsertTextContent(xTxtCntnt);
693  }
694  catch (lang::IllegalArgumentException const&)
695  {
696  TOOLS_WARN_EXCEPTION("xmloff.text", "Cannot import part of the text - probably an image in the text frame?");
697  return;
698  }
699  }
700 
701  // Make adding the shape to Z-Ordering dependent from if we are
702  // inside an inside_deleted_section (redlining). That is necessary
703  // since the shape will be removed again later. It would lead to
704  // errors if it would stay inside the Z-Ordering. Thus, the
705  // easiest way to solve that conflict is to not add it here.
706  if(!GetImport().HasTextImport()
707  || !GetImport().GetTextImport()->IsInsideDeleteContext())
708  {
709  Reference < XShape > xShape( xPropSet, UNO_QUERY );
710 
711  GetImport().GetShapeImport()->shapeWithZIndexAdded( xShape, nZIndex );
712  }
713 
714  if( XML_TEXT_FRAME_TEXTBOX != nType )
715  return;
716 
717  xTextImportHelper->ConnectFrameChains( sName, sNextName, xPropSet );
718  Reference < XTextFrame > xTxtFrame( xPropSet, UNO_QUERY );
719  Reference < XText > xTxt = xTxtFrame->getText();
720  xOldTextCursor = xTextImportHelper->GetCursor();
721  xTextImportHelper->SetCursor( xTxt->createTextCursor() );
722 
723  // remember old list item and block (#89892#) and reset them
724  // for the text frame
725  xTextImportHelper->PushListContext();
726  mbListContextPushed = true;
727 }
728 
730 {
731  const XMLTextFrameContext_Impl* pXMLTextFrameContext_Impl = dynamic_cast< const XMLTextFrameContext_Impl* >(&rContext);
732 
733  if(!pXMLTextFrameContext_Impl)
734  return;
735 
736  try
737  {
738  // just dispose to delete
739  uno::Reference< lang::XComponent > xComp(pXMLTextFrameContext_Impl->GetPropSet(), UNO_QUERY);
740 
741  // Inform shape importer about the removal so it can adjust
742  // z-indexes.
743  uno::Reference<drawing::XShape> xShape(xComp, uno::UNO_QUERY);
744  GetImport().GetShapeImport()->shapeRemoved(xShape);
745 
746  if(xComp.is())
747  {
748  xComp->dispose();
749  }
750  }
751  catch( uno::Exception& )
752  {
753  OSL_FAIL( "Error in cleanup of multiple graphic object import (!)" );
754  }
755 }
756 
758 {
759  const XMLTextFrameContext_Impl* pXMLTextFrameContext_Impl = dynamic_cast< const XMLTextFrameContext_Impl* >(&rContext);
760 
761  if(pXMLTextFrameContext_Impl)
762  {
763  return "vnd.sun.star.Package:" + pXMLTextFrameContext_Impl->GetHRef();
764  }
765 
766  return OUString();
767 }
768 
769 css::uno::Reference<css::graphic::XGraphic> XMLTextFrameContext::getGraphicFromImportContext(const SvXMLImportContext& rContext) const
770 {
771  uno::Reference<graphic::XGraphic> xGraphic;
772 
773  const XMLTextFrameContext_Impl* pXMLTextFrameContext_Impl = dynamic_cast<const XMLTextFrameContext_Impl*>(&rContext);
774 
775  if (pXMLTextFrameContext_Impl)
776  {
777  try
778  {
779  const uno::Reference<beans::XPropertySet>& xPropertySet = pXMLTextFrameContext_Impl->GetPropSet();
780 
781  if (xPropertySet.is())
782  {
783  xPropertySet->getPropertyValue("Graphic") >>= xGraphic;
784  }
785  }
786  catch (uno::Exception&)
787  {}
788  }
789  return xGraphic;
790 }
791 
792 bool XMLTextFrameContext_Impl::CreateIfNotThere()
793 {
794  if( !xPropSet.is() &&
797  xBase64Stream.is() && !bCreateFailed )
798  {
799  if( bOwnBase64Stream )
800  xBase64Stream->closeOutput();
801  Create();
802  }
803 
804  return xPropSet.is();
805 }
806 
807 XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
808  SvXMLImport& rImport,
809  sal_Int32 /*nElement*/,
810  const Reference< XFastAttributeList > & rAttrList,
811  TextContentAnchorType eATyp,
812  sal_uInt16 nNewType,
813  const Reference< XFastAttributeList > & rFrameAttrList,
814  bool bMultipleContent )
815 : SvXMLImportContext( rImport )
816 , mbListContextPushed( false )
817 , nType( nNewType )
818 , eAnchorType( eATyp )
819 {
820  nX = 0;
821  nY = 0;
822  nWidth = 0;
823  nHeight = 0;
824  nZIndex = -1;
825  nPage = 0;
826  nRotation = 0;
827  nRelWidth = 0;
828  nRelHeight = 0;
829  bMayScript = false;
830 
831  bMinHeight = false;
832  bMinWidth = false;
833  bSyncWidth = false;
834  bSyncHeight = false;
835  bCreateFailed = false;
836  bOwnBase64Stream = false;
837  mbMultipleContent = bMultipleContent;
838 
839  auto processAttr = [&](sal_Int32 nElement, const sax_fastparser::FastAttributeList::FastAttributeIter& aIter) -> void
840  {
841  switch( nElement )
842  {
843  case XML_ELEMENT(DRAW, XML_STYLE_NAME):
844  sStyleName = aIter.toString();
845  break;
846  case XML_ELEMENT(DRAW, XML_NAME):
847  m_sOrigName = aIter.toString();
848  sName = m_sOrigName;
849  break;
850  case XML_ELEMENT(DRAW, XML_FRAME_NAME):
851  sFrameName = aIter.toString();
852  break;
853  case XML_ELEMENT(DRAW, XML_APPLET_NAME):
854  sAppletName = aIter.toString();
855  break;
856  case XML_ELEMENT(TEXT, XML_ANCHOR_TYPE):
857  if( TextContentAnchorType_AT_PARAGRAPH == eAnchorType ||
858  TextContentAnchorType_AT_CHARACTER == eAnchorType ||
859  TextContentAnchorType_AS_CHARACTER == eAnchorType )
860  {
861 
862  TextContentAnchorType eNew;
863  if( XMLAnchorTypePropHdl::convert( aIter.toView(), eNew ) &&
864  ( TextContentAnchorType_AT_PARAGRAPH == eNew ||
865  TextContentAnchorType_AT_CHARACTER == eNew ||
866  TextContentAnchorType_AS_CHARACTER == eNew ||
867  TextContentAnchorType_AT_PAGE == eNew) )
868  eAnchorType = eNew;
869  }
870  break;
872  {
873  sal_Int32 nTmp;
874  if (::sax::Converter::convertNumber(nTmp, aIter.toView(), 1, SHRT_MAX))
875  nPage = static_cast<sal_Int16>(nTmp);
876  }
877  break;
878  case XML_ELEMENT(SVG, XML_X):
879  case XML_ELEMENT(SVG_COMPAT, XML_X):
880  GetImport().GetMM100UnitConverter().convertMeasureToCore(
881  nX, aIter.toView());
882  break;
883  case XML_ELEMENT(SVG, XML_Y):
884  case XML_ELEMENT(SVG_COMPAT, XML_Y):
885  GetImport().GetMM100UnitConverter().convertMeasureToCore(
886  nY, aIter.toView() );
887  break;
888  case XML_ELEMENT(SVG, XML_WIDTH):
889  case XML_ELEMENT(SVG_COMPAT, XML_WIDTH):
890  // relative widths are obsolete since SRC617. Remove them some day!
891  if( aIter.toView().find( '%' ) != std::string_view::npos )
892  {
893  sal_Int32 nTmp;
894  if (::sax::Converter::convertPercent(nTmp, aIter.toView()))
895  nRelWidth = static_cast<sal_Int16>(nTmp);
896  }
897  else
898  {
900  nWidth, aIter.toView(), 0 );
901  }
902  break;
903  case XML_ELEMENT(STYLE, XML_REL_WIDTH):
904  if( IsXMLToken(aIter, XML_SCALE) )
905  {
906  bSyncWidth = true;
907  }
908  else
909  {
910  sal_Int32 nTmp;
911  if (::sax::Converter::convertPercent( nTmp, aIter.toView() ))
912  nRelWidth = static_cast<sal_Int16>(nTmp);
913  }
914  break;
915  case XML_ELEMENT(FO, XML_MIN_WIDTH):
916  case XML_ELEMENT(FO_COMPAT, XML_MIN_WIDTH):
917  if( aIter.toView().find( '%' ) != std::string_view::npos )
918  {
919  sal_Int32 nTmp;
920  if (::sax::Converter::convertPercent(nTmp, aIter.toView()))
921  nRelWidth = static_cast<sal_Int16>(nTmp);
922  }
923  else
924  {
926  nWidth, aIter.toView(), 0 );
927  }
928  bMinWidth = true;
929  break;
930  case XML_ELEMENT(SVG, XML_HEIGHT):
931  case XML_ELEMENT(SVG_COMPAT, XML_HEIGHT):
932  // relative heights are obsolete since SRC617. Remove them some day!
933  if( aIter.toView().find( '%' ) != std::string_view::npos )
934  {
935  sal_Int32 nTmp;
936  if (::sax::Converter::convertPercent(nTmp, aIter.toView()))
937  nRelHeight = static_cast<sal_Int16>(nTmp);
938  }
939  else
940  {
942  nHeight, aIter.toView(), 0 );
943  }
944  break;
945  case XML_ELEMENT(STYLE, XML_REL_HEIGHT):
946  if( IsXMLToken( aIter, XML_SCALE ) )
947  {
948  bSyncHeight = true;
949  }
950  else if( IsXMLToken( aIter, XML_SCALE_MIN ) )
951  {
952  bSyncHeight = true;
953  bMinHeight = true;
954  }
955  else
956  {
957  sal_Int32 nTmp;
958  if (::sax::Converter::convertPercent( nTmp, aIter.toView() ))
959  nRelHeight = static_cast<sal_Int16>(nTmp);
960  }
961  break;
962  case XML_ELEMENT(FO, XML_MIN_HEIGHT):
963  case XML_ELEMENT(FO_COMPAT, XML_MIN_HEIGHT):
964  if( aIter.toView().find( '%' ) != std::string_view::npos )
965  {
966  sal_Int32 nTmp;
967  if (::sax::Converter::convertPercent(nTmp, aIter.toView()))
968  nRelHeight = static_cast<sal_Int16>(nTmp);
969  }
970  else
971  {
973  nHeight, aIter.toView(), 0 );
974  }
975  bMinHeight = true;
976  break;
977  case XML_ELEMENT(DRAW, XML_ZINDEX):
978  ::sax::Converter::convertNumber( nZIndex, aIter.toView(), -1 );
979  break;
980  case XML_ELEMENT(DRAW, XML_CHAIN_NEXT_NAME):
981  sNextName = aIter.toString();
982  break;
983  case XML_ELEMENT(XLINK, XML_HREF):
984  sHRef = aIter.toString();
985  break;
986  case XML_ELEMENT(DRAW, XML_TRANSFORM):
987  {
988  // RotateFlyFrameFix: im/export full 'draw:transform' using existing tooling
989  // Currently only rotation is used, but combinations with 'draw:transform'
990  // may be necessary in the future, so that svg:x/svg:y/svg:width/svg:height
991  // may be extended/replaced with 'draw:transform' (see draw objects)
992  SdXMLImExTransform2D aSdXMLImExTransform2D;
993  basegfx::B2DHomMatrix aFullTransform;
994 
995  // Use SdXMLImExTransform2D to convert to transformation
996  // Note: using GetTwipUnitConverter instead of GetMM100UnitConverter may be needed,
997  // but is not generally available (as it should be, a 'current' UnitConverter should
998  // be available at GetExport() - and maybe was once). May have to be addressed as soon
999  // as translate transformations are used here.
1000  aSdXMLImExTransform2D.SetString(aIter.toString(), GetImport().GetMM100UnitConverter());
1001  aSdXMLImExTransform2D.GetFullTransform(aFullTransform);
1002 
1003  if(!aFullTransform.isIdentity())
1004  {
1005  const basegfx::utils::B2DHomMatrixBufferedDecompose aDecomposedTransform(aFullTransform);
1006 
1007  // currently we *only* use rotation (and translation indirectly), so warn if *any*
1008  // of the other transform parts is used
1009  SAL_WARN_IF(!basegfx::fTools::equal(1.0, aDecomposedTransform.getScale().getX()), "xmloff.text", "draw:transform uses scaleX" );
1010  SAL_WARN_IF(!basegfx::fTools::equal(1.0, aDecomposedTransform.getScale().getY()), "xmloff.text", "draw:transform uses scaleY" );
1011  SAL_WARN_IF(!basegfx::fTools::equalZero(aDecomposedTransform.getShearX()), "xmloff.text", "draw:transform uses shearX" );
1012 
1013  // Translation comes from the translate to RotCenter, rot and BackTranslate.
1014  // This means that it represents the translation between unrotated TopLeft
1015  // and rotated TopLeft. This may be checked here now, but currently we only
1016  // use rotation around center and assume that this *was* a rotation around
1017  // center. The check would compare the object's center with the RotCenter
1018  // that can be extracted from the transformation in aFullTransform.
1019  // The definition contains implicitly the RotationCenter absolute
1020  // to the scaled and translated object, so this may be used if needed (see
1021  // _exportTextGraphic how the -trans/rot/trans is composed)
1022 
1023  if(!basegfx::fTools::equalZero(aDecomposedTransform.getRotate()))
1024  {
1025  // rotation is used, set it. Convert from deg to 10th degree integer
1026  // CAUTION: due to #i78696# (rotation mirrored using API) the rotate
1027  // value is already mirrored, so do not do it again here (to be in sync
1028  // with XMLTextParagraphExport::_exportTextGraphic normally it would need
1029  // to me mirrored using * -1.0, see conversion there)
1030  // CAUTION-II: due to tdf#115782 it is better for current ODF to indeed use it
1031  // with the wrong orientation as in all other cases - ARGH! We will need to
1032  // correct this in future ODF ASAP! For now, mirror the rotation here AGAIN
1033  const double fRotate(aDecomposedTransform.getRotate() * (-1800.0/M_PI));
1034  nRotation = static_cast< sal_Int16 >(basegfx::fround(fRotate) % 3600);
1035 
1036  // tdf#115529 may be negative, with the above modulo maximal -3599, so
1037  // no loop needed here. nRotation is used in setPropertyValue("GraphicRotation")
1038  // and *has* to be in the range [0 .. 3600[
1039  if(nRotation < 0)
1040  {
1041  nRotation += 3600;
1042  }
1043  }
1044  }
1045  }
1046  break;
1047  case XML_ELEMENT(DRAW, XML_CODE):
1048  sCode = aIter.toString();
1049  break;
1050  case XML_ELEMENT(DRAW, XML_OBJECT):
1051  break;
1052  case XML_ELEMENT(DRAW, XML_ARCHIVE):
1053  break;
1054  case XML_ELEMENT(DRAW, XML_MAY_SCRIPT):
1055  bMayScript = IsXMLToken( aIter, XML_TRUE );
1056  break;
1057  case XML_ELEMENT(DRAW, XML_MIME_TYPE):
1058  case XML_ELEMENT(LO_EXT, XML_MIME_TYPE):
1059  sMimeType = aIter.toString();
1060  break;
1063  sTblName = aIter.toString();
1064  break;
1065  default:
1066  XMLOFF_WARN_UNKNOWN("xmloff", aIter);
1067  }
1068  };
1069 
1070  for( auto& aIter : sax_fastparser::castToFastAttributeList(rAttrList) )
1071  processAttr(aIter.getToken(), aIter);
1072  for( auto& aIter : sax_fastparser::castToFastAttributeList(rFrameAttrList) )
1073  processAttr(aIter.getToken(), aIter);
1074 
1075  if( ( (XML_TEXT_FRAME_GRAPHIC == nType ||
1076  XML_TEXT_FRAME_OBJECT == nType ||
1077  XML_TEXT_FRAME_OBJECT_OLE == nType) &&
1078  sHRef.isEmpty() ) ||
1079  ( XML_TEXT_FRAME_APPLET == nType && sCode.isEmpty() ) ||
1080  ( XML_TEXT_FRAME_PLUGIN == nType &&
1081  sHRef.isEmpty() && sMimeType.isEmpty() ) )
1082  return; // no URL: no image or OLE object
1083 
1084  Create();
1085 }
1086 
1087 void XMLTextFrameContext_Impl::endFastElement(sal_Int32 )
1088 {
1089  if( ( XML_TEXT_FRAME_OBJECT_OLE == nType ||
1090  XML_TEXT_FRAME_GRAPHIC == nType) &&
1091  !xPropSet.is() && !bCreateFailed )
1092  {
1093  OUString sTrimmedChars = maUrlBuffer.makeStringAndClear().trim();
1094  if( !sTrimmedChars.isEmpty() )
1095  {
1096  if( !xBase64Stream.is() )
1097  {
1098  if( XML_TEXT_FRAME_GRAPHIC == nType )
1099  {
1100  xBase64Stream =
1101  GetImport().GetStreamForGraphicObjectURLFromBase64();
1102  }
1103  else
1104  {
1105  xBase64Stream =
1106  GetImport().GetStreamForEmbeddedObjectURLFromBase64();
1107  }
1108  if( xBase64Stream.is() )
1109  bOwnBase64Stream = true;
1110  }
1111  if( bOwnBase64Stream && xBase64Stream.is() )
1112  {
1113  OUString sChars;
1114  if( !sBase64CharsLeft.isEmpty() )
1115  {
1116  sChars = sBase64CharsLeft + sTrimmedChars;
1117  sBase64CharsLeft.clear();
1118  }
1119  else
1120  {
1121  sChars = sTrimmedChars;
1122  }
1123  Sequence< sal_Int8 > aBuffer( (sChars.getLength() / 4) * 3 );
1124  sal_Int32 nCharsDecoded =
1125  ::comphelper::Base64::decodeSomeChars( aBuffer, sChars );
1126  xBase64Stream->writeBytes( aBuffer );
1127  if( nCharsDecoded != sChars.getLength() )
1128  sBase64CharsLeft = sChars.copy( nCharsDecoded );
1129  }
1130  }
1131  }
1132 
1133  CreateIfNotThere();
1134 
1135  if( xOldTextCursor.is() )
1136  {
1137  GetImport().GetTextImport()->DeleteParagraph();
1138  GetImport().GetTextImport()->SetCursor( xOldTextCursor );
1139  }
1140 
1141  // reinstall old list item (if necessary) #89892#
1142  if (mbListContextPushed) {
1143  GetImport().GetTextImport()->PopListContext();
1144  }
1145 
1146  if (( nType == XML_TEXT_FRAME_APPLET || nType == XML_TEXT_FRAME_PLUGIN ) && xPropSet.is())
1147  GetImport().GetTextImport()->endAppletOrPlugin( xPropSet, aParamMap);
1148 }
1149 
1150 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextFrameContext_Impl::createFastChildContext(
1151  sal_Int32 nElement,
1152  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
1153 {
1154  if( nElement == XML_ELEMENT(DRAW, XML_PARAM) )
1155  {
1156  if ( nType == XML_TEXT_FRAME_APPLET || nType == XML_TEXT_FRAME_PLUGIN )
1157  return new XMLTextFrameParam_Impl( GetImport(),
1158  xAttrList, aParamMap );
1159  }
1160  else if( nElement == XML_ELEMENT(OFFICE, XML_BINARY_DATA) )
1161  {
1162  if( !xPropSet.is() && !xBase64Stream.is() && !bCreateFailed )
1163  {
1164  switch( nType )
1165  {
1167  xBase64Stream =
1168  GetImport().GetStreamForGraphicObjectURLFromBase64();
1169  break;
1171  xBase64Stream =
1172  GetImport().GetStreamForEmbeddedObjectURLFromBase64();
1173  break;
1174  }
1175  if( xBase64Stream.is() )
1176  return new XMLBase64ImportContext( GetImport(), xBase64Stream );
1177  }
1178  }
1179  // Correction of condition which also avoids warnings. (#i100480#)
1180  if( XML_TEXT_FRAME_OBJECT == nType &&
1181  ( nElement == XML_ELEMENT(OFFICE, XML_DOCUMENT) ||
1182  nElement == XML_ELEMENT(MATH, XML_MATH) ) )
1183  {
1184  if( !xPropSet.is() && !bCreateFailed )
1185  {
1186  XMLEmbeddedObjectImportContext *pEContext =
1187  new XMLEmbeddedObjectImportContext( GetImport(), nElement, xAttrList );
1188  sFilterService = pEContext->GetFilterServiceName();
1189  if( !sFilterService.isEmpty() )
1190  {
1191  Create();
1192  if( xPropSet.is() )
1193  {
1194  Reference < XEmbeddedObjectSupplier > xEOS( xPropSet,
1195  UNO_QUERY );
1196  OSL_ENSURE( xEOS.is(),
1197  "no embedded object supplier for own object" );
1198  Reference<css::lang::XComponent> aXComponent(xEOS->getEmbeddedObject());
1199  pEContext->SetComponent( aXComponent );
1200  }
1201  }
1202  return pEContext;
1203  }
1204  }
1205 
1206  if( xOldTextCursor.is() ) // text-box
1207  {
1208  auto p = GetImport().GetTextImport()->CreateTextChildContext(
1209  GetImport(), nElement, xAttrList,
1211  if (p)
1212  return p;
1213  }
1214 
1215  XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
1216 
1217  return nullptr;
1218 }
1219 
1220 void XMLTextFrameContext_Impl::characters( const OUString& rChars )
1221 {
1222  maUrlBuffer.append(rChars);
1223 }
1224 
1225 void XMLTextFrameContext_Impl::SetHyperlink( const OUString& rHRef,
1226  const OUString& rName,
1227  const OUString& rTargetFrameName,
1228  bool bMap )
1229 {
1230  static constexpr OUStringLiteral s_HyperLinkURL = u"HyperLinkURL";
1231  static constexpr OUStringLiteral s_HyperLinkName = u"HyperLinkName";
1232  static constexpr OUStringLiteral s_HyperLinkTarget = u"HyperLinkTarget";
1233  static constexpr OUStringLiteral s_ServerMap = u"ServerMap";
1234  if( !xPropSet.is() )
1235  return;
1236 
1237  Reference < XPropertySetInfo > xPropSetInfo =
1238  xPropSet->getPropertySetInfo();
1239  if( !xPropSetInfo.is() ||
1240  !xPropSetInfo->hasPropertyByName(s_HyperLinkURL))
1241  return;
1242 
1243  xPropSet->setPropertyValue( s_HyperLinkURL, Any(rHRef) );
1244 
1245  if (xPropSetInfo->hasPropertyByName(s_HyperLinkName))
1246  {
1247  xPropSet->setPropertyValue(s_HyperLinkName, Any(rName));
1248  }
1249 
1250  if (xPropSetInfo->hasPropertyByName(s_HyperLinkTarget))
1251  {
1252  xPropSet->setPropertyValue( s_HyperLinkTarget, Any(rTargetFrameName) );
1253  }
1254 
1255  if (xPropSetInfo->hasPropertyByName(s_ServerMap))
1256  {
1257  xPropSet->setPropertyValue(s_ServerMap, Any(bMap));
1258  }
1259 }
1260 
1261 void XMLTextFrameContext_Impl::SetName()
1262 {
1263  Reference<XNamed> xNamed(xPropSet, UNO_QUERY);
1264  if (m_sOrigName.isEmpty() || !xNamed.is())
1265  return;
1266 
1267  OUString const name(xNamed->getName());
1268  if (name != m_sOrigName)
1269  {
1270  try
1271  {
1272  xNamed->setName(m_sOrigName);
1273  }
1274  catch (uno::Exception const&)
1275  { // fdo#71698 document contains 2 frames with same draw:name
1276  TOOLS_INFO_EXCEPTION("xmloff.text", "SetName(): exception setting \""
1277  << m_sOrigName << "\"");
1278  }
1279  }
1280 }
1281 
1282 // Implement Title/Description Elements UI (#i73249#)
1283 void XMLTextFrameContext_Impl::SetTitle( const OUString& rTitle )
1284 {
1285  if ( xPropSet.is() )
1286  {
1287  Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1288  if( xPropSetInfo->hasPropertyByName( "Title" ) )
1289  {
1290  xPropSet->setPropertyValue( "Title", makeAny( rTitle ) );
1291  }
1292  }
1293 }
1294 
1295 void XMLTextFrameContext_Impl::SetDesc( const OUString& rDesc )
1296 {
1297  if ( xPropSet.is() )
1298  {
1299  Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1300  if( xPropSetInfo->hasPropertyByName( "Description" ) )
1301  {
1302  xPropSet->setPropertyValue( "Description", makeAny( rDesc ) );
1303  }
1304  }
1305 }
1306 
1307 
1308 bool XMLTextFrameContext::CreateIfNotThere( css::uno::Reference < css::beans::XPropertySet >& rPropSet )
1309 {
1310  SvXMLImportContext *pContext = m_xImplContext.get();
1311  XMLTextFrameContext_Impl *pImpl = dynamic_cast< XMLTextFrameContext_Impl*>( pContext );
1312  if( pImpl && pImpl->CreateIfNotThere() )
1313  rPropSet = pImpl->GetPropSet();
1314 
1315  return rPropSet.is();
1316 }
1317 
1319  SvXMLImport& rImport,
1320  const Reference< XFastAttributeList > & xAttrList,
1321  TextContentAnchorType eATyp )
1322 : SvXMLImportContext( rImport )
1323 , m_xAttrList( new sax_fastparser::FastAttributeList( xAttrList ) )
1324  // Implement Title/Description Elements UI (#i73249#)
1325 , m_eDefaultAnchorType( eATyp )
1326  // Shapes in Writer cannot be named via context menu (#i51726#)
1327 , m_HasAutomaticStyleWithoutParentStyle( false )
1328 , m_bSupportsReplacement( false )
1329 {
1330  for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
1331  {
1332  // New distinguish attribute between Writer objects and Draw objects is:
1333  // Draw objects have an automatic style without a parent style (#i51726#)
1334  switch (aIter.getToken())
1335  {
1336  case XML_ELEMENT(DRAW, XML_STYLE_NAME):
1337  {
1338  OUString aStyleName = aIter.toString();
1339  if( !aStyleName.isEmpty() )
1340  {
1343  XMLPropStyleContext* pStyle = xTxtImport->FindAutoFrameStyle( aStyleName );
1344  if ( pStyle && pStyle->GetParentName().isEmpty() )
1345  {
1347  }
1348  }
1349  break;
1350  }
1351  case XML_ELEMENT(TEXT, XML_ANCHOR_TYPE):
1352  {
1353  TextContentAnchorType eNew;
1354  if( XMLAnchorTypePropHdl::convert( aIter.toView(), eNew ) &&
1355  ( TextContentAnchorType_AT_PARAGRAPH == eNew ||
1356  TextContentAnchorType_AT_CHARACTER == eNew ||
1357  TextContentAnchorType_AS_CHARACTER == eNew ||
1358  TextContentAnchorType_AT_PAGE == eNew) )
1359  m_eDefaultAnchorType = eNew;
1360  break;
1361  }
1362  }
1363  }
1364 }
1365 
1367 {
1369  SvXMLImportContextRef const pMultiContext(solveMultipleImages());
1370 
1371  SvXMLImportContext const*const pContext =
1372  (pMultiContext.is()) ? pMultiContext.get() : m_xImplContext.get();
1373  XMLTextFrameContext_Impl *pImpl = const_cast<XMLTextFrameContext_Impl*>(dynamic_cast< const XMLTextFrameContext_Impl*>( pContext ));
1374  assert(!pMultiContext.is() || pImpl);
1375 
1376  // When we are dealing with a textbox, pImpl will be null;
1377  // we need to set the hyperlink to the shape instead
1378  Reference<XShape> xShape = GetShape();
1379  if (xShape.is() && m_pHyperlink)
1380  {
1381  Reference<XPropertySet> xProps(xShape, UNO_QUERY);
1382  if (xProps.is())
1383  xProps->setPropertyValue("Hyperlink", Any(m_pHyperlink->GetHRef()));
1384  }
1385 
1386  if( !pImpl )
1387  return;
1388 
1389  pImpl->CreateIfNotThere();
1390 
1391  // fdo#68839: in case the surviving image was not the first one,
1392  // it will have a counter added to its name - set the original name
1393  if (pMultiContext.is()) // do this only when necessary; esp. not for text
1394  { // frames that may have entries in GetRenameMap()!
1395  pImpl->SetName();
1396  }
1397 
1398  if( !m_sTitle.isEmpty() )
1399  {
1400  pImpl->SetTitle( m_sTitle );
1401  }
1402  if( !m_sDesc.isEmpty() )
1403  {
1404  pImpl->SetDesc( m_sDesc );
1405  }
1406 
1407  if( m_pHyperlink )
1408  {
1409  pImpl->SetHyperlink( m_pHyperlink->GetHRef(), m_pHyperlink->GetName(),
1410  m_pHyperlink->GetTargetFrameName(), m_pHyperlink->GetMap() );
1411  m_pHyperlink.reset();
1412  }
1413 
1414  GetImport().GetTextImport()->StoreLastImportedFrameName(pImpl->GetOrigName());
1415 }
1416 
1417 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextFrameContext::createFastChildContext(
1418  sal_Int32 nElement,
1419  const uno::Reference< xml::sax::XFastAttributeList>& xAttrList )
1420 {
1421  SvXMLImportContextRef xContext;
1422 
1423  if( !m_xImplContext.is() )
1424  {
1425  // no child exists
1426  if( IsTokenInNamespace(nElement, XML_NAMESPACE_DRAW) )
1427  {
1428  sal_uInt16 nFrameType = USHRT_MAX;
1429  switch (nElement & TOKEN_MASK)
1430  {
1431  case XML_TEXT_BOX:
1432  nFrameType = XML_TEXT_FRAME_TEXTBOX;
1433  break;
1434  case XML_IMAGE:
1435  nFrameType = XML_TEXT_FRAME_GRAPHIC;
1436  break;
1437  case XML_OBJECT:
1438  nFrameType = XML_TEXT_FRAME_OBJECT;
1439  break;
1440  case XML_OBJECT_OLE:
1441  nFrameType = XML_TEXT_FRAME_OBJECT_OLE;
1442  break;
1443  case XML_APPLET:
1444  nFrameType = XML_TEXT_FRAME_APPLET;
1445  break;
1446  case XML_PLUGIN:
1447  nFrameType = XML_TEXT_FRAME_PLUGIN;
1448  break;
1449  case XML_FLOATING_FRAME:
1450  nFrameType = XML_TEXT_FRAME_FLOATING_FRAME;
1451  break;
1452  }
1453 
1454  if( USHRT_MAX != nFrameType )
1455  {
1456  // Shapes in Writer cannot be named via context menu (#i51726#)
1457  if ( ( XML_TEXT_FRAME_TEXTBOX == nFrameType ||
1458  XML_TEXT_FRAME_GRAPHIC == nFrameType ) &&
1460  {
1461  Reference < XShapes > xShapes;
1463  GetImport(), nElement, xAttrList, xShapes, m_xAttrList );
1464  }
1465  else if( XML_TEXT_FRAME_PLUGIN == nFrameType )
1466  {
1467  bool bMedia = false;
1468 
1469  // check, if we have a media object
1470  for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
1471  {
1472  if( aIter.getToken() == XML_ELEMENT(DRAW, XML_MIME_TYPE) )
1473  {
1474  if( aIter.toString() == "application/vnd.sun.star.media" )
1475  bMedia = true;
1476 
1477  // leave this loop
1478  break;
1479  }
1480  }
1481 
1482  if( bMedia )
1483  {
1484  Reference < XShapes > xShapes;
1486  GetImport(), nElement, xAttrList, xShapes, m_xAttrList );
1487  }
1488  }
1489  else if( XML_TEXT_FRAME_OBJECT == nFrameType ||
1490  XML_TEXT_FRAME_OBJECT_OLE == nFrameType )
1491  {
1492  m_bSupportsReplacement = true;
1493  }
1494  else if(XML_TEXT_FRAME_GRAPHIC == nFrameType)
1495  {
1496  setSupportsMultipleContents( (nElement & TOKEN_MASK) == XML_IMAGE );
1497  }
1498 
1499  if (!xContext)
1500  {
1501  xContext = new XMLTextFrameContext_Impl( GetImport(), nElement,
1502  xAttrList,
1504  nFrameType,
1505  m_xAttrList );
1506  }
1507 
1508  m_xImplContext = xContext;
1509 
1511  {
1513  }
1514  }
1515  }
1516  }
1517  else if(getSupportsMultipleContents() && nElement == XML_ELEMENT(DRAW, XML_IMAGE))
1518  {
1519  // read another image
1520  xContext = new XMLTextFrameContext_Impl(
1521  GetImport(), nElement, xAttrList,
1523 
1524  m_xImplContext = xContext;
1526  }
1527  else if( m_bSupportsReplacement && !m_xReplImplContext.is() &&
1528  nElement == XML_ELEMENT(DRAW, XML_IMAGE) )
1529  {
1530  // read replacement image
1531  Reference < XPropertySet > xPropSet;
1532  if( CreateIfNotThere( xPropSet ) )
1533  {
1534  xContext = new XMLReplacementImageContext( GetImport(),
1535  nElement, xAttrList, xPropSet );
1536  m_xReplImplContext = xContext;
1537  }
1538  }
1539  else if( nullptr != dynamic_cast< const XMLTextFrameContext_Impl*>( m_xImplContext.get() ))
1540  {
1541  // the child is a writer frame
1542  if( IsTokenInNamespace(nElement, XML_NAMESPACE_SVG) ||
1544  {
1545  // Implement Title/Description Elements UI (#i73249#)
1546  const bool bOld = SvXMLImport::OOo_2x >= GetImport().getGeneratorVersion();
1547  if ( bOld )
1548  {
1549  if ( (nElement & TOKEN_MASK) == XML_DESC )
1550  {
1551  xContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(),
1552  m_sTitle );
1553  }
1554  }
1555  else
1556  {
1557  if( (nElement & TOKEN_MASK) == XML_TITLE )
1558  {
1560  { // tdf#103567 ensure props are set on surviving shape
1562  }
1563  xContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(),
1564  m_sTitle );
1565  }
1566  else if ( (nElement & TOKEN_MASK) == XML_DESC )
1567  {
1569  { // tdf#103567 ensure props are set on surviving shape
1571  }
1572  xContext = new XMLTextFrameTitleOrDescContext_Impl( GetImport(),
1573  m_sDesc );
1574  }
1575  }
1576  }
1577  else if( IsTokenInNamespace(nElement, XML_NAMESPACE_DRAW) )
1578  {
1579  Reference < XPropertySet > xPropSet;
1580  if( (nElement & TOKEN_MASK) == XML_CONTOUR_POLYGON )
1581  {
1583  { // tdf#103567 ensure props are set on surviving shape
1585  }
1586  if( CreateIfNotThere( xPropSet ) )
1587  xContext = new XMLTextFrameContourContext_Impl( GetImport(), nElement,
1588  xAttrList, xPropSet, false );
1589  }
1590  else if( (nElement & TOKEN_MASK) == XML_CONTOUR_PATH )
1591  {
1593  { // tdf#103567 ensure props are set on surviving shape
1595  }
1596  if( CreateIfNotThere( xPropSet ) )
1597  xContext = new XMLTextFrameContourContext_Impl( GetImport(), nElement,
1598  xAttrList, xPropSet, true );
1599  }
1600  else if( (nElement & TOKEN_MASK) == XML_IMAGE_MAP )
1601  {
1603  { // tdf#103567 ensure props are set on surviving shape
1605  }
1606  if( CreateIfNotThere( xPropSet ) )
1607  xContext = new XMLImageMapContext( GetImport(), xPropSet );
1608  }
1609  }
1610  else if( nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) )
1611  {
1613  { // tdf#103567 ensure props are set on surviving shape
1615  }
1616  // do we still have the frame object?
1617  Reference < XPropertySet > xPropSet;
1618  if( CreateIfNotThere( xPropSet ) )
1619  {
1620  // is it an event supplier?
1621  Reference<XEventsSupplier> xEventsSupplier(xPropSet, UNO_QUERY);
1622  if (xEventsSupplier.is())
1623  {
1624  // OK, we have the events, so create the context
1625  xContext = new XMLEventsImportContext(GetImport(), xEventsSupplier);
1626  }
1627  }
1628  }
1629  }
1630  // #i68101#
1631  else if( nElement == XML_ELEMENT(SVG, XML_TITLE) || nElement == XML_ELEMENT(SVG, XML_DESC ) ||
1632  nElement == XML_ELEMENT(SVG_COMPAT, XML_TITLE) || nElement == XML_ELEMENT(SVG_COMPAT, XML_DESC ) )
1633  {
1635  { // tdf#103567 ensure props are set on surviving shape
1636  // note: no more draw:image can be added once we get here
1638  }
1639  xContext = static_cast<SvXMLImportContext*>(m_xImplContext->createFastChildContext( nElement, xAttrList ).get());
1640  }
1641  else if (nElement == XML_ELEMENT(LO_EXT, XML_SIGNATURELINE))
1642  {
1644  { // tdf#103567 ensure props are set on surviving shape
1645  // note: no more draw:image can be added once we get here
1647  }
1648  xContext = static_cast<SvXMLImportContext*>(m_xImplContext->createFastChildContext(nElement, xAttrList).get());
1649  }
1650  else if (nElement == XML_ELEMENT(LO_EXT, XML_QRCODE))
1651  {
1653  { // tdf#103567 ensure props are set on surviving shape
1654  // note: no more draw:image can be added once we get here
1656  }
1657  xContext = static_cast<SvXMLImportContext*>(m_xImplContext->createFastChildContext(nElement, xAttrList).get());
1658  }
1659  else if (nElement == XML_ELEMENT(DRAW, XML_A))
1660  {
1661  xContext = static_cast<SvXMLImportContext*>(m_xImplContext->createFastChildContext(nElement, xAttrList).get());
1662  }
1663  else
1664  {
1665  // the child is a drawing shape
1667  m_xImplContext.get(), nElement, xAttrList );
1668  }
1669 
1670  return xContext;
1671 }
1672 
1673 void XMLTextFrameContext::SetHyperlink( const OUString& rHRef,
1674  const OUString& rName,
1675  const OUString& rTargetFrameName,
1676  bool bMap )
1677 {
1678  OSL_ENSURE( !m_pHyperlink, "recursive SetHyperlink call" );
1679  m_pHyperlink = std::make_unique<XMLTextFrameContextHyperlink_Impl>(
1680  rHRef, rName, rTargetFrameName, bMap );
1681 }
1682 
1683 TextContentAnchorType XMLTextFrameContext::GetAnchorType() const
1684 {
1685  SvXMLImportContext *pContext = m_xImplContext.get();
1686  XMLTextFrameContext_Impl *pImpl = dynamic_cast< XMLTextFrameContext_Impl*>( pContext );
1687  if( pImpl )
1688  return pImpl->GetAnchorType();
1689  else
1690  return m_eDefaultAnchorType;
1691 }
1692 
1693 Reference < XTextContent > XMLTextFrameContext::GetTextContent() const
1694 {
1695  Reference < XTextContent > xTxtCntnt;
1696  SvXMLImportContext *pContext = m_xImplContext.get();
1697  XMLTextFrameContext_Impl *pImpl = dynamic_cast< XMLTextFrameContext_Impl* >( pContext );
1698  if( pImpl )
1699  xTxtCntnt.set( pImpl->GetPropSet(), UNO_QUERY );
1700 
1701  return xTxtCntnt;
1702 }
1703 
1704 Reference < XShape > XMLTextFrameContext::GetShape() const
1705 {
1706  Reference < XShape > xShape;
1707  SvXMLImportContext* pContext = m_xImplContext.get();
1708  SvXMLShapeContext* pImpl = dynamic_cast<SvXMLShapeContext*>( pContext );
1709  if ( pImpl )
1710  {
1711  xShape = pImpl->getShape();
1712  }
1713 
1714  return xShape;
1715 }
1716 
1717 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool importFromSvgPoints(B2DPolygon &o_rPoly, const OUString &rSvgPointsAttribute)
#define XML_TEXT_RENAME_TYPE_FRAME
Definition: txtimp.hxx:91
bool CreateIfNotThere(css::uno::Reference< css::beans::XPropertySet > &rPropSet)
bool convertMeasureToCore(sal_Int32 &rValue, std::u16string_view rString, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32) const
convert string to measure with meCoreMeasureUnit, using optional min and max values ...
Definition: xmluconv.cxx:186
constexpr OUStringLiteral sFrameName
SvXMLImportContextRef m_xReplImplContext
std::unique_ptr< XMLTextFrameContextHyperlink_Impl > m_pHyperlink
bool equalZero(const T &rfVal)
void B2DPolyPolygonToUnoPointSequenceSequence(const B2DPolyPolygon &rPolyPolygon, css::drawing::PointSequenceSequence &rPointSequenceSequenceRetval)
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
bool getSupportsMultipleContents() const
read/write access to boolean switch
::std::map< const OUString, OUString > ParamMap
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:59
#define XML_TEXT_FRAME_FLOATING_FRAME
bool importFromSvgD(B2DPolyPolygon &o_rPolyPoly, const OUString &rSvgDAttribute, bool bHandleRelativeNextPointCompatible, PointIndexSet *pHelpPointIndexSet)
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3508
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
rtl::Reference< XMLTextImportHelper > const & GetTextImport()
Definition: xmlimp.hxx:600
void SetHyperlink(const OUString &rHRef, const OUString &rName, const OUString &rTargetFrameName, bool bMap)
OSQLColumns::const_iterator find(const OSQLColumns::const_iterator &first, const OSQLColumns::const_iterator &last, std::u16string_view _rVal, const ::comphelper::UStringMixEqual &_rCase)
OUString getGraphicPackageURLFromImportContext(const SvXMLImportContext &rContext) const override
void setSupportsMultipleContents(bool bNew)
sal_uInt16 getGeneratorVersion() const
this checks the build ID and returns
Definition: xmlimp.cxx:1834
static const sal_uInt16 OOo_2x
Definition: xmlimp.hxx:535
DRAW
constexpr OUStringLiteral sServiceName
#define XMLOFF_WARN_UNKNOWN(area, rIter)
Definition: xmlictxt.hxx:113
const css::uno::Reference< css::drawing::XShape > & getShape() const
static void convertNumber(OUStringBuffer &b, sal_Int32 n)
css::text::TextContentAnchorType GetAnchorType() const
constexpr sal_uInt16 XML_NAMESPACE_DRAW
B2IRange fround(const B2DRange &rRange)
const char * sName
void addContent(const SvXMLImportContext &rSvXMLImportContext)
add a content to the remembered image import contexts
B2DHomMatrix createSourceRangeTargetRangeTransform(const B2DRange &rSourceRange, const B2DRange &rTargetRange)
#define XML_TEXT_FRAME_OBJECT
constexpr sal_uInt16 XML_NAMESPACE_SVG
#define TOOLS_WARN_EXCEPTION(area, stream)
int i
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Definition: prstylei.cxx:222
bool equal(T const &rfValA, T const &rfValB)
void SetString(const OUString &rNew, const SvXMLUnitConverter &rConv)
Definition: xexptran.cxx:349
css::uno::Reference< css::text::XTextContent > GetTextContent() const
float u
void transform(const basegfx::B2DHomMatrix &rMatrix)
bool isIdentity() const
#define XML_TEXT_FRAME_GRAPHIC
static SvXMLShapeContext * CreateFrameChildContext(SvXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xFrameAttrList)
css::uno::Reference< css::graphic::XGraphic > getGraphicFromImportContext(const SvXMLImportContext &rContext) const override
static bool convertPercent(sal_Int32 &rValue, std::u16string_view rString)
constexpr sal_uInt16 XML_NAMESPACE_SVG_COMPAT
static bool convert(std::string_view rStrImpValue, css::text::TextContentAnchorType &rType)
Definition: txtprhdl.cxx:634
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
#define XML_TEXT_FRAME_OBJECT_OLE
SvXMLImportContextRef solveMultipleImages()
solve multiple imported images.
#define TOOLS_INFO_EXCEPTION(area, stream)
#define XML_TEXT_FRAME_PLUGIN
std::unique_ptr< char[]> aBuffer
sal_uInt32 count() const
const OUString & GetParentName() const
Definition: xmlstyle.hxx:80
void removeGraphicFromImportContext(const SvXMLImportContext &rContext) override
helper to get the created xShape instance, needs to be overridden
constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix)
Definition: xmlimp.hxx:104
#define SAL_WARN_IF(condition, area, stream)
void SetComponent(css::uno::Reference< css::lang::XComponent > const &rComp)
#define XML_TEXT_FRAME_APPLET
virtual void SAL_CALL endFastElement(sal_Int32 Element) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: xmlictxt.cxx:40
Handling of tokens in XML:
virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlictxt.cxx:59
if(aStr!=aBuf) UpdateName_Impl(m_xFollowLb.get()
XMLTextFrameContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::text::TextContentAnchorType eDfltAnchorType)
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:97
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlimp.hxx:400
void * p
QPRO_FUNC_TYPE nType
const char * name
double getLength(const B2DPolygon &rCandidate)
rtl::Reference< sax_fastparser::FastAttributeList > m_xAttrList
void GetFullTransform(::basegfx::B2DHomMatrix &rFullTrans)
Definition: xexptran.cxx:482
css::text::TextContentAnchorType m_eDefaultAnchorType
Reference< XSingleServiceFactory > xFactory
constexpr sal_Int32 TOKEN_MASK
Definition: xmlimp.hxx:94
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
Definition: xmlictxt.hxx:119
#define XML_TEXT_FRAME_TEXTBOX
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
css::uno::Reference< css::drawing::XShape > GetShape() const
static sal_Int32 decodeSomeChars(css::uno::Sequence< sal_Int8 > &aPass, const OUString &sBuffer)
virtual void SAL_CALL characters(const OUString &aChars) override
This method is called for all characters that are contained in the current element.
Definition: xmlictxt.cxx:70
SvXMLImportContextRef m_xImplContext
rtl::Reference< XMLShapeImportHelper > const & GetShapeImport()
Definition: xmlimp.hxx:608
OUString toString(OptionInfo const *info)
static bool convertNumber(sal_Int32 &rValue, std::u16string_view aString, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32)
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)