merge the formfield patch from ooo-build
[ooovba.git] / xmloff / source / draw / XMLImageMapContext.cxx
blob1066e377668f7ddeb69c3f5bbf3aaa60b0a376bb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XMLImageMapContext.cxx,v $
10 * $Revision: 1.15 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
33 #include "XMLImageMapContext.hxx"
34 #include <rtl/ustrbuf.hxx>
35 #include <com/sun/star/uno/Reference.h>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP
38 #include <com/sun/star/beans/XPropertySetInfo.hpp>
39 #endif
40 #include <com/sun/star/xml/sax/XAttributeList.hpp>
41 #include <com/sun/star/container/XIndexContainer.hpp>
42 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
43 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
45 #ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP
46 #include <com/sun/star/document/XEventsSupplier.hpp>
47 #endif
48 #include <com/sun/star/awt/Rectangle.hpp>
49 #include <xmloff/xmltoken.hxx>
50 #include <xmloff/xmlimp.hxx>
51 #include <xmloff/xmltkmap.hxx>
52 #include "xmlnmspe.hxx"
53 #include <xmloff/nmspmap.hxx>
54 #include <xmloff/xmluconv.hxx>
55 #include "xexptran.hxx"
56 #include "xmlerror.hxx"
57 #include <xmloff/XMLEventsImportContext.hxx>
58 #include "XMLStringBufferImportContext.hxx"
59 #include <tools/debug.hxx>
62 using namespace ::com::sun::star;
63 using namespace ::xmloff::token;
65 using ::rtl::OUString;
66 using ::rtl::OUStringBuffer;
67 using ::com::sun::star::beans::XPropertySet;
68 using ::com::sun::star::beans::XPropertySetInfo;
69 using ::com::sun::star::container::XIndexContainer;
70 using ::com::sun::star::lang::XMultiServiceFactory;
71 using ::com::sun::star::uno::Reference;
72 using ::com::sun::star::uno::UNO_QUERY;
73 using ::com::sun::star::xml::sax::XAttributeList;
74 using ::com::sun::star::uno::XInterface;
75 using ::com::sun::star::uno::Any;
76 using ::com::sun::star::drawing::PointSequenceSequence;
77 using ::com::sun::star::document::XEventsSupplier;
80 enum XMLImageMapToken
82 XML_TOK_IMAP_URL,
83 XML_TOK_IMAP_X,
84 XML_TOK_IMAP_Y,
85 XML_TOK_IMAP_CENTER_X,
86 XML_TOK_IMAP_CENTER_Y,
87 XML_TOK_IMAP_WIDTH,
88 XML_TOK_IMAP_HEIGTH,
89 XML_TOK_IMAP_POINTS,
90 XML_TOK_IMAP_VIEWBOX,
91 XML_TOK_IMAP_NOHREF,
92 XML_TOK_IMAP_NAME,
93 XML_TOK_IMAP_RADIUS,
94 XML_TOK_IMAP_TARGET
97 static __FAR_DATA SvXMLTokenMapEntry aImageMapObjectTokenMap[] =
99 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_IMAP_URL },
100 { XML_NAMESPACE_OFFICE, XML_NAME, XML_TOK_IMAP_NAME },
101 { XML_NAMESPACE_DRAW, XML_NOHREF, XML_TOK_IMAP_NOHREF },
102 { XML_NAMESPACE_SVG, XML_X, XML_TOK_IMAP_X },
103 { XML_NAMESPACE_SVG, XML_Y, XML_TOK_IMAP_Y },
104 { XML_NAMESPACE_SVG, XML_CX, XML_TOK_IMAP_CENTER_X },
105 { XML_NAMESPACE_SVG, XML_CY, XML_TOK_IMAP_CENTER_Y },
106 { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_IMAP_WIDTH },
107 { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_IMAP_HEIGTH },
108 { XML_NAMESPACE_SVG, XML_R, XML_TOK_IMAP_RADIUS },
109 { XML_NAMESPACE_SVG, XML_VIEWBOX, XML_TOK_IMAP_VIEWBOX },
110 { XML_NAMESPACE_DRAW, XML_POINTS, XML_TOK_IMAP_POINTS },
111 { XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, XML_TOK_IMAP_TARGET },
112 XML_TOKEN_MAP_END
117 class XMLImageMapObjectContext : public SvXMLImportContext
120 protected:
122 const ::rtl::OUString sBoundary;
123 const ::rtl::OUString sCenter;
124 const ::rtl::OUString sTitle;
125 const ::rtl::OUString sDescription;
126 const ::rtl::OUString sImageMap;
127 const ::rtl::OUString sIsActive;
128 const ::rtl::OUString sName;
129 const ::rtl::OUString sPolygon;
130 const ::rtl::OUString sRadius;
131 const ::rtl::OUString sTarget;
132 const ::rtl::OUString sURL;
134 ::rtl::OUString sServiceName;
136 Reference<XIndexContainer> xImageMap; /// the image map
137 Reference<XPropertySet> xMapEntry; /// one map-entry (one area)
139 ::rtl::OUString sUrl;
140 ::rtl::OUString sTargt;
141 ::rtl::OUStringBuffer sDescriptionBuffer;
142 ::rtl::OUStringBuffer sTitleBuffer;
143 ::rtl::OUString sNam;
144 sal_Bool bIsActive;
146 sal_Bool bValid;
148 public:
149 TYPEINFO();
151 XMLImageMapObjectContext(
152 SvXMLImport& rImport,
153 sal_uInt16 nPrefix,
154 const ::rtl::OUString& rLocalName,
155 ::com::sun::star::uno::Reference<
156 ::com::sun::star::container::XIndexContainer> xMap,
157 const sal_Char* pServiceName);
159 void StartElement(
160 const ::com::sun::star::uno::Reference<
161 ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
163 void EndElement();
165 SvXMLImportContext *CreateChildContext(
166 USHORT nPrefix,
167 const ::rtl::OUString& rLocalName,
168 const ::com::sun::star::uno::Reference<
169 ::com::sun::star::xml::sax::XAttributeList> & xAttrList );
171 protected:
173 virtual void ProcessAttribute(
174 enum XMLImageMapToken eToken,
175 const ::rtl::OUString& rValue);
177 virtual void Prepare(
178 ::com::sun::star::uno::Reference<
179 ::com::sun::star::beans::XPropertySet> & rPropertySet);
183 TYPEINIT1( XMLImageMapObjectContext, SvXMLImportContext );
185 XMLImageMapObjectContext::XMLImageMapObjectContext(
186 SvXMLImport& rImport,
187 sal_uInt16 nPrefix,
188 const OUString& rLocalName,
189 Reference<XIndexContainer> xMap,
190 const sal_Char* pServiceName) :
191 SvXMLImportContext(rImport, nPrefix, rLocalName),
192 sBoundary(RTL_CONSTASCII_USTRINGPARAM("Boundary")),
193 sCenter(RTL_CONSTASCII_USTRINGPARAM("Center")),
194 sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")),
195 sDescription(RTL_CONSTASCII_USTRINGPARAM("Description")),
196 sImageMap(RTL_CONSTASCII_USTRINGPARAM("ImageMap")),
197 sIsActive(RTL_CONSTASCII_USTRINGPARAM("IsActive")),
198 sName(RTL_CONSTASCII_USTRINGPARAM("Name")),
199 sPolygon(RTL_CONSTASCII_USTRINGPARAM("Polygon")),
200 sRadius(RTL_CONSTASCII_USTRINGPARAM("Radius")),
201 sTarget(RTL_CONSTASCII_USTRINGPARAM("Target")),
202 sURL(RTL_CONSTASCII_USTRINGPARAM("URL")),
203 xImageMap(xMap),
204 bIsActive(sal_True),
205 bValid(sal_False)
207 DBG_ASSERT(NULL != pServiceName,
208 "Please supply the image map object service name");
210 Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),UNO_QUERY);
211 if( xFactory.is() )
213 Reference<XInterface> xIfc = xFactory->createInstance(
214 OUString::createFromAscii(pServiceName));
215 DBG_ASSERT(xIfc.is(), "can't create image map object!");
216 if( xIfc.is() )
218 Reference<XPropertySet> xPropertySet( xIfc, UNO_QUERY );
220 xMapEntry = xPropertySet;
222 // else: can't create service -> ignore
224 // else: can't even get factory -> ignore
227 void XMLImageMapObjectContext::StartElement(
228 const Reference<XAttributeList >& xAttrList )
230 SvXMLTokenMap aMap(aImageMapObjectTokenMap);
232 sal_Int16 nLength = xAttrList->getLength();
233 for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++)
235 OUString sLocalName;
236 sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
237 GetKeyByAttrName( xAttrList->getNameByIndex(nAttr),
238 &sLocalName );
239 OUString sValue = xAttrList->getValueByIndex(nAttr);
241 ProcessAttribute(
242 (enum XMLImageMapToken)aMap.Get(nPrefix, sLocalName), sValue);
246 void XMLImageMapObjectContext::EndElement()
248 // only create and insert image map object if validity flag is set
249 // (and we actually have an image map)
250 if ( bValid && xImageMap.is() && xMapEntry.is() )
252 // set values
253 Prepare( xMapEntry );
255 // insert into image map
256 Any aAny;
257 aAny <<= xMapEntry;
258 xImageMap->insertByIndex( xImageMap->getCount(), aAny );
260 // else: not valid -> don't create and insert
263 SvXMLImportContext* XMLImageMapObjectContext::CreateChildContext(
264 USHORT nPrefix,
265 const OUString& rLocalName,
266 const Reference<XAttributeList> & xAttrList )
268 if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
269 IsXMLToken(rLocalName, XML_EVENT_LISTENERS) )
271 Reference<XEventsSupplier> xEvents( xMapEntry, UNO_QUERY );
272 return new XMLEventsImportContext(
273 GetImport(), nPrefix, rLocalName, xEvents);
275 else if ( (XML_NAMESPACE_SVG == nPrefix) &&
276 IsXMLToken(rLocalName, XML_TITLE) )
278 return new XMLStringBufferImportContext(
279 GetImport(), nPrefix, rLocalName, sTitleBuffer);
281 else if ( (XML_NAMESPACE_SVG == nPrefix) &&
282 IsXMLToken(rLocalName, XML_DESC) )
284 return new XMLStringBufferImportContext(
285 GetImport(), nPrefix, rLocalName, sDescriptionBuffer);
287 else
288 return SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
289 xAttrList);
293 void XMLImageMapObjectContext::ProcessAttribute(
294 enum XMLImageMapToken eToken,
295 const OUString& rValue)
297 switch (eToken)
299 case XML_TOK_IMAP_URL:
300 sUrl = GetImport().GetAbsoluteReference(rValue);
301 break;
303 case XML_TOK_IMAP_TARGET:
304 sTargt = rValue;
305 break;
307 case XML_TOK_IMAP_NOHREF:
308 bIsActive = ! IsXMLToken(rValue, XML_NOHREF);
309 break;
311 case XML_TOK_IMAP_NAME:
312 sNam = rValue;
313 break;
314 default:
315 // do nothing
316 break;
320 void XMLImageMapObjectContext::Prepare(
321 Reference<XPropertySet> & rPropertySet)
323 rPropertySet->setPropertyValue( sURL, Any( sUrl ) );
324 rPropertySet->setPropertyValue( sTitle, Any( sTitleBuffer.makeStringAndClear() ) );
325 rPropertySet->setPropertyValue( sDescription, Any( sDescriptionBuffer.makeStringAndClear() ) );
326 rPropertySet->setPropertyValue( sTarget, Any( sTargt ) );
327 rPropertySet->setPropertyValue( sIsActive, Any( bIsActive ) );
328 rPropertySet->setPropertyValue( sName, Any( sNam ) );
333 class XMLImageMapRectangleContext : public XMLImageMapObjectContext
335 awt::Rectangle aRectangle;
337 sal_Bool bXOK;
338 sal_Bool bYOK;
339 sal_Bool bWidthOK;
340 sal_Bool bHeightOK;
342 public:
343 TYPEINFO();
345 XMLImageMapRectangleContext(
346 SvXMLImport& rImport,
347 sal_uInt16 nPrefix,
348 const ::rtl::OUString& rLocalName,
349 ::com::sun::star::uno::Reference<
350 ::com::sun::star::container::XIndexContainer> xMap);
352 virtual ~XMLImageMapRectangleContext();
354 protected:
355 virtual void ProcessAttribute(
356 enum XMLImageMapToken eToken,
357 const ::rtl::OUString& rValue);
359 virtual void Prepare(
360 ::com::sun::star::uno::Reference<
361 ::com::sun::star::beans::XPropertySet> & rPropertySet);
366 TYPEINIT1(XMLImageMapRectangleContext, XMLImageMapObjectContext);
368 XMLImageMapRectangleContext::XMLImageMapRectangleContext(
369 SvXMLImport& rImport,
370 sal_uInt16 nPrefix,
371 const OUString& rLocalName,
372 Reference<XIndexContainer> xMap) :
373 XMLImageMapObjectContext(rImport, nPrefix, rLocalName, xMap,
374 "com.sun.star.image.ImageMapRectangleObject"),
375 bXOK(sal_False),
376 bYOK(sal_False),
377 bWidthOK(sal_False),
378 bHeightOK(sal_False)
382 XMLImageMapRectangleContext::~XMLImageMapRectangleContext()
386 void XMLImageMapRectangleContext::ProcessAttribute(
387 enum XMLImageMapToken eToken,
388 const OUString& rValue)
390 sal_Int32 nTmp;
391 switch (eToken)
393 case XML_TOK_IMAP_X:
394 if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
395 rValue))
397 aRectangle.X = nTmp;
398 bXOK = sal_True;
400 break;
401 case XML_TOK_IMAP_Y:
402 if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
403 rValue))
405 aRectangle.Y = nTmp;
406 bYOK = sal_True;
408 break;
409 case XML_TOK_IMAP_WIDTH:
410 if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
411 rValue))
413 aRectangle.Width = nTmp;
414 bWidthOK = sal_True;
416 break;
417 case XML_TOK_IMAP_HEIGTH:
418 if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
419 rValue))
421 aRectangle.Height = nTmp;
422 bHeightOK = sal_True;
424 break;
425 default:
426 XMLImageMapObjectContext::ProcessAttribute(eToken, rValue);
429 bValid = bHeightOK && bXOK && bYOK && bWidthOK;
432 void XMLImageMapRectangleContext::Prepare(
433 Reference<XPropertySet> & rPropertySet)
435 Any aAny;
436 aAny <<= aRectangle;
437 rPropertySet->setPropertyValue( sBoundary, aAny );
439 // common properties handled by super class
440 XMLImageMapObjectContext::Prepare(rPropertySet);
444 class XMLImageMapPolygonContext : public XMLImageMapObjectContext
446 ::rtl::OUString sViewBoxString;
447 ::rtl::OUString sPointsString;
449 sal_Bool bViewBoxOK;
450 sal_Bool bPointsOK;
452 public:
453 TYPEINFO();
455 XMLImageMapPolygonContext(
456 SvXMLImport& rImport,
457 sal_uInt16 nPrefix,
458 const ::rtl::OUString& rLocalName,
459 ::com::sun::star::uno::Reference<
460 ::com::sun::star::container::XIndexContainer> xMap);
462 virtual ~XMLImageMapPolygonContext();
464 protected:
465 virtual void ProcessAttribute(
466 enum XMLImageMapToken eToken,
467 const ::rtl::OUString& rValue);
469 virtual void Prepare(
470 ::com::sun::star::uno::Reference<
471 ::com::sun::star::beans::XPropertySet> & rPropertySet);
476 TYPEINIT1(XMLImageMapPolygonContext, XMLImageMapObjectContext);
478 XMLImageMapPolygonContext::XMLImageMapPolygonContext(
479 SvXMLImport& rImport,
480 sal_uInt16 nPrefix,
481 const OUString& rLocalName,
482 Reference<XIndexContainer> xMap) :
483 XMLImageMapObjectContext(rImport, nPrefix, rLocalName, xMap,
484 "com.sun.star.image.ImageMapPolygonObject"),
485 bViewBoxOK(sal_False),
486 bPointsOK(sal_False)
490 XMLImageMapPolygonContext::~XMLImageMapPolygonContext()
494 void XMLImageMapPolygonContext::ProcessAttribute(
495 enum XMLImageMapToken eToken,
496 const OUString& rValue)
498 switch (eToken)
500 case XML_TOK_IMAP_POINTS:
501 sPointsString = rValue;
502 bPointsOK = sal_True;
503 break;
504 case XML_TOK_IMAP_VIEWBOX:
505 sViewBoxString = rValue;
506 bViewBoxOK = sal_True;
507 break;
508 default:
509 XMLImageMapObjectContext::ProcessAttribute(eToken, rValue);
510 break;
513 bValid = bViewBoxOK && bPointsOK;
516 void XMLImageMapPolygonContext::Prepare(
517 Reference<XPropertySet> & rPropertySet)
519 // process view box
520 SdXMLImExViewBox aViewBox(sViewBoxString,
521 GetImport().GetMM100UnitConverter());
523 // get polygon sequence
524 awt::Point aPoint(aViewBox.GetX(), aViewBox.GetY());
525 awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
526 SdXMLImExPointsElement aPoints( sPointsString, aViewBox, aPoint, aSize,
527 GetImport().GetMM100UnitConverter() );
528 PointSequenceSequence aPointSeqSeq = aPoints.GetPointSequenceSequence();
530 // only use first element of sequence-sequence
531 if (aPointSeqSeq.getLength() > 0)
533 Any aAny;
534 aAny <<= aPointSeqSeq[0];
535 rPropertySet->setPropertyValue(sPolygon, aAny);
538 // parent properties
539 XMLImageMapObjectContext::Prepare(rPropertySet);
544 class XMLImageMapCircleContext : public XMLImageMapObjectContext
546 awt::Point aCenter;
547 sal_Int32 nRadius;
549 sal_Bool bXOK;
550 sal_Bool bYOK;
551 sal_Bool bRadiusOK;
553 public:
554 TYPEINFO();
556 XMLImageMapCircleContext(
557 SvXMLImport& rImport,
558 sal_uInt16 nPrefix,
559 const ::rtl::OUString& rLocalName,
560 ::com::sun::star::uno::Reference<
561 ::com::sun::star::container::XIndexContainer> xMap);
563 virtual ~XMLImageMapCircleContext();
565 protected:
566 virtual void ProcessAttribute(
567 enum XMLImageMapToken eToken,
568 const ::rtl::OUString& rValue);
570 virtual void Prepare(
571 ::com::sun::star::uno::Reference<
572 ::com::sun::star::beans::XPropertySet> & rPropertySet);
575 TYPEINIT1(XMLImageMapCircleContext, XMLImageMapObjectContext);
577 XMLImageMapCircleContext::XMLImageMapCircleContext(
578 SvXMLImport& rImport,
579 sal_uInt16 nPrefix,
580 const OUString& rLocalName,
581 Reference<XIndexContainer> xMap) :
582 XMLImageMapObjectContext(rImport, nPrefix, rLocalName, xMap,
583 "com.sun.star.image.ImageMapCircleObject"),
584 bXOK(sal_False),
585 bYOK(sal_False),
586 bRadiusOK(sal_False)
590 XMLImageMapCircleContext::~XMLImageMapCircleContext()
594 void XMLImageMapCircleContext::ProcessAttribute(
595 enum XMLImageMapToken eToken,
596 const OUString& rValue)
598 sal_Int32 nTmp;
599 switch (eToken)
601 case XML_TOK_IMAP_CENTER_X:
602 if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
603 rValue))
605 aCenter.X = nTmp;
606 bXOK = sal_True;
608 break;
609 case XML_TOK_IMAP_CENTER_Y:
610 if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
611 rValue))
613 aCenter.Y = nTmp;
614 bYOK = sal_True;
616 break;
617 case XML_TOK_IMAP_RADIUS:
618 if (GetImport().GetMM100UnitConverter().convertMeasure(nTmp,
619 rValue))
621 nRadius = nTmp;
622 bRadiusOK = sal_True;
624 break;
625 default:
626 XMLImageMapObjectContext::ProcessAttribute(eToken, rValue);
629 bValid = bRadiusOK && bXOK && bYOK;
632 void XMLImageMapCircleContext::Prepare(
633 Reference<XPropertySet> & rPropertySet)
635 // center (x,y)
636 Any aAny;
637 aAny <<= aCenter;
638 rPropertySet->setPropertyValue( sCenter, aAny );
640 // radius
641 aAny <<= nRadius;
642 rPropertySet->setPropertyValue( sRadius, aAny );
644 // common properties handled by super class
645 XMLImageMapObjectContext::Prepare(rPropertySet);
657 TYPEINIT1(XMLImageMapContext, SvXMLImportContext);
659 XMLImageMapContext::XMLImageMapContext(
660 SvXMLImport& rImport,
661 sal_uInt16 nPrefix,
662 const OUString& rLocalName,
663 Reference<XPropertySet> & rPropertySet) :
664 SvXMLImportContext(rImport, nPrefix, rLocalName),
665 sImageMap(RTL_CONSTASCII_USTRINGPARAM("ImageMap")),
666 xPropertySet(rPropertySet)
671 Reference < XPropertySetInfo > xInfo =
672 xPropertySet->getPropertySetInfo();
673 if( xInfo.is() && xInfo->hasPropertyByName( sImageMap ) )
674 xPropertySet->getPropertyValue(sImageMap) >>= xImageMap;
676 catch( com::sun::star::uno::Exception e )
678 uno::Sequence<OUString> aSeq(0);
679 rImport.SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
683 XMLImageMapContext::~XMLImageMapContext()
687 SvXMLImportContext *XMLImageMapContext::CreateChildContext(
688 USHORT nPrefix,
689 const OUString& rLocalName,
690 const Reference<XAttributeList> & xAttrList )
692 SvXMLImportContext* pContext = NULL;
694 if ( XML_NAMESPACE_DRAW == nPrefix )
696 if ( IsXMLToken(rLocalName, XML_AREA_RECTANGLE) )
698 pContext = new XMLImageMapRectangleContext(
699 GetImport(), nPrefix, rLocalName, xImageMap);
701 else if ( IsXMLToken(rLocalName, XML_AREA_POLYGON) )
703 pContext = new XMLImageMapPolygonContext(
704 GetImport(), nPrefix, rLocalName, xImageMap);
706 else if ( IsXMLToken(rLocalName, XML_AREA_CIRCLE) )
708 pContext = new XMLImageMapCircleContext(
709 GetImport(), nPrefix, rLocalName, xImageMap);
712 else
713 pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName,
714 xAttrList);
716 return pContext;
719 void XMLImageMapContext::EndElement()
721 Reference < XPropertySetInfo > xInfo =
722 xPropertySet->getPropertySetInfo();
723 if( xInfo.is() && xInfo->hasPropertyByName( sImageMap ) )
724 xPropertySet->setPropertyValue(sImageMap, uno::makeAny( xImageMap ) );