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