LibreOffice Module svtools (master) 1
unoimap.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 <com/sun/star/container/XIndexContainer.hpp>
21#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
22#include <com/sun/star/lang/XServiceInfo.hpp>
23#include <com/sun/star/document/XEventsSupplier.hpp>
24#include <com/sun/star/beans/XPropertySet.hpp>
25#include <com/sun/star/awt/Rectangle.hpp>
26#include <com/sun/star/awt/Point.hpp>
27#include <com/sun/star/drawing/PointSequence.hpp>
34#include <algorithm>
35#include <osl/diagnose.h>
36#include <rtl/ref.hxx>
37#include <svtools/unoevent.hxx>
38#include <svtools/unoimap.hxx>
39#include <vcl/imap.hxx>
40#include <vcl/imapcirc.hxx>
41#include <vcl/imaprect.hxx>
42#include <vcl/imappoly.hxx>
43
44using namespace comphelper;
45using namespace cppu;
46using namespace com::sun::star;
47using namespace css::uno;
48using namespace css::lang;
49using namespace css::container;
50using namespace css::beans;
51using namespace css::document;
52using namespace css::drawing;
53
54const sal_Int32 HANDLE_URL = 1;
55const sal_Int32 HANDLE_DESCRIPTION = 2;
56const sal_Int32 HANDLE_TARGET = 3;
57const sal_Int32 HANDLE_NAME = 4;
58const sal_Int32 HANDLE_ISACTIVE = 5;
59const sal_Int32 HANDLE_POLYGON = 6;
60const sal_Int32 HANDLE_CENTER = 7;
61const sal_Int32 HANDLE_RADIUS = 8;
62const sal_Int32 HANDLE_BOUNDARY = 9;
63const sal_Int32 HANDLE_TITLE = 10;
64
65namespace {
66
67class SvUnoImageMapObject : public OWeakAggObject,
68 public XEventsSupplier,
69 public XServiceInfo,
70 public PropertySetHelper,
71 public XTypeProvider
72{
73public:
74 SvUnoImageMapObject( IMapObjectType nType, const SvEventDescription* pSupportedMacroItems );
75 SvUnoImageMapObject( const IMapObject& rMapObject, const SvEventDescription* pSupportedMacroItems );
76
77 std::unique_ptr<IMapObject> createIMapObject() const;
78
80
81 // overridden helpers from PropertySetHelper
82 virtual void _setPropertyValues( const PropertyMapEntry** ppEntries, const Any* pValues ) override;
83 virtual void _getPropertyValues( const PropertyMapEntry** ppEntries, Any* pValue ) override;
84
85 // XInterface
86 virtual Any SAL_CALL queryAggregation( const Type & rType ) override;
87 virtual Any SAL_CALL queryInterface( const Type & rType ) override;
88 virtual void SAL_CALL acquire() noexcept override;
89 virtual void SAL_CALL release() noexcept override;
90
91 // XTypeProvider
92 virtual Sequence< Type > SAL_CALL getTypes( ) override;
93 virtual Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
94
95 // XEventsSupplier
96 virtual Reference< css::container::XNameReplace > SAL_CALL getEvents( ) override;
97
98 // XServiceInfo
99 virtual OUString SAL_CALL getImplementationName( ) override;
100 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
101 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
102
103private:
104 static rtl::Reference<PropertySetInfo> createPropertySetInfo( IMapObjectType nType );
105
106
108
109 OUString maURL;
110 OUString maAltText;
111 OUString maDesc;
112 OUString maTarget;
113 OUString maName;
114 bool mbIsActive;
115 awt::Rectangle maBoundary;
116 awt::Point maCenter;
117 sal_Int32 mnRadius;
118 PointSequence maPolygon;
119};
120
121}
122
123rtl::Reference<PropertySetInfo> SvUnoImageMapObject::createPropertySetInfo( IMapObjectType nType )
124{
125 switch( nType )
126 {
127 case IMapObjectType::Polygon:
128 {
129 static PropertyMapEntry const aPolygonObj_Impl[] =
130 {
131 { OUString("URL"), HANDLE_URL, cppu::UnoType<OUString>::get(), 0, 0 },
132 { OUString("Title"), HANDLE_TITLE, cppu::UnoType<OUString>::get(), 0, 0 },
133 { OUString("Description"), HANDLE_DESCRIPTION, cppu::UnoType<OUString>::get(), 0, 0 },
134 { OUString("Target"), HANDLE_TARGET, cppu::UnoType<OUString>::get(), 0, 0 },
135 { OUString("Name"), HANDLE_NAME, cppu::UnoType<OUString>::get(), 0, 0 },
136 { OUString("IsActive"), HANDLE_ISACTIVE, cppu::UnoType<bool>::get(), 0, 0 },
137 { OUString("Polygon"), HANDLE_POLYGON, cppu::UnoType<PointSequence>::get(), 0, 0 },
138 };
139
140 return rtl::Reference<PropertySetInfo>(new PropertySetInfo( aPolygonObj_Impl ));
141 }
142 case IMapObjectType::Circle:
143 {
144 static PropertyMapEntry const aCircleObj_Impl[] =
145 {
146 { OUString("URL"), HANDLE_URL, cppu::UnoType<OUString>::get(), 0, 0 },
147 { OUString("Title"), HANDLE_TITLE, cppu::UnoType<OUString>::get(), 0, 0 },
148 { OUString("Description"), HANDLE_DESCRIPTION, cppu::UnoType<OUString>::get(), 0, 0 },
149 { OUString("Target"), HANDLE_TARGET, cppu::UnoType<OUString>::get(), 0, 0 },
150 { OUString("Name"), HANDLE_NAME, cppu::UnoType<OUString>::get(), 0, 0 },
151 { OUString("IsActive"), HANDLE_ISACTIVE, cppu::UnoType<bool>::get(), 0, 0 },
152 { OUString("Center"), HANDLE_CENTER, cppu::UnoType<awt::Point>::get(), 0, 0 },
153 { OUString("Radius"), HANDLE_RADIUS, cppu::UnoType<sal_Int32>::get(), 0, 0 },
154 };
155
156 return rtl::Reference<PropertySetInfo>(new PropertySetInfo( aCircleObj_Impl ));
157 }
158 case IMapObjectType::Rectangle:
159 default:
160 {
161 static PropertyMapEntry const aRectangleObj_Impl[] =
162 {
163 { OUString("URL"), HANDLE_URL, cppu::UnoType<OUString>::get(), 0, 0 },
164 { OUString("Title"), HANDLE_TITLE, cppu::UnoType<OUString>::get(), 0, 0 },
165 { OUString("Description"), HANDLE_DESCRIPTION, cppu::UnoType<OUString>::get(), 0, 0 },
166 { OUString("Target"), HANDLE_TARGET, cppu::UnoType<OUString>::get(), 0, 0 },
167 { OUString("Name"), HANDLE_NAME, cppu::UnoType<OUString>::get(), 0, 0 },
168 { OUString("IsActive"), HANDLE_ISACTIVE, cppu::UnoType<bool>::get(), 0, 0 },
169 { OUString("Boundary"), HANDLE_BOUNDARY, cppu::UnoType<awt::Rectangle>::get(), 0, 0 },
170 };
171
172 return rtl::Reference<PropertySetInfo>(new PropertySetInfo( aRectangleObj_Impl ));
173 }
174 }
175}
176
177SvUnoImageMapObject::SvUnoImageMapObject( IMapObjectType nType, const SvEventDescription* pSupportedMacroItems )
178: PropertySetHelper( createPropertySetInfo( nType ) ),
179 mnType( nType )
180, mbIsActive( true )
181, mnRadius( 0 )
182{
183 mxEvents = new SvMacroTableEventDescriptor( pSupportedMacroItems );
184}
185
186SvUnoImageMapObject::SvUnoImageMapObject( const IMapObject& rMapObject, const SvEventDescription* pSupportedMacroItems )
187: PropertySetHelper( createPropertySetInfo( rMapObject.GetType() ) ),
188 mnType( rMapObject.GetType() )
189, mbIsActive( true )
190, mnRadius( 0 )
191{
192 maURL = rMapObject.GetURL();
193 maAltText = rMapObject.GetAltText();
194 maDesc = rMapObject.GetDesc();
195 maTarget = rMapObject.GetTarget();
196 maName = rMapObject.GetName();
197 mbIsActive = rMapObject.IsActive();
198
199 switch( mnType )
200 {
201 case IMapObjectType::Rectangle:
202 {
203 const tools::Rectangle aRect( static_cast<const IMapRectangleObject*>(&rMapObject)->GetRectangle(false) );
204 maBoundary.X = aRect.Left();
205 maBoundary.Y = aRect.Top();
206 maBoundary.Width = aRect.GetWidth();
207 maBoundary.Height = aRect.GetHeight();
208 }
209 break;
210 case IMapObjectType::Circle:
211 {
212 mnRadius = static_cast<const IMapCircleObject*>(&rMapObject)->GetRadius(false);
213 const Point aPoint( static_cast<const IMapCircleObject*>(&rMapObject)->GetCenter(false) );
214
215 maCenter.X = aPoint.X();
216 maCenter.Y = aPoint.Y();
217 }
218 break;
219 case IMapObjectType::Polygon:
220 default:
221 {
222 const tools::Polygon aPoly( static_cast<const IMapPolygonObject*>(&rMapObject)->GetPolygon(false) );
223
224 const sal_uInt16 nCount = aPoly.GetSize();
225 maPolygon.realloc( nCount );
226 awt::Point* pPoints = maPolygon.getArray();
227
228 for( sal_uInt16 nPoint = 0; nPoint < nCount; nPoint++ )
229 {
230 const Point& rPoint = aPoly.GetPoint( nPoint );
231 pPoints->X = rPoint.X();
232 pPoints->Y = rPoint.Y();
233
234 pPoints++;
235 }
236 }
237 }
238
239 mxEvents = new SvMacroTableEventDescriptor( rMapObject.GetMacroTable(), pSupportedMacroItems );
240}
241
242std::unique_ptr<IMapObject> SvUnoImageMapObject::createIMapObject() const
243{
244 const OUString aURL( maURL );
245 const OUString aAltText( maAltText );
246 const OUString aDesc( maDesc );
247 const OUString aTarget( maTarget );
248 const OUString aName( maName );
249
250 std::unique_ptr<IMapObject> pNewIMapObject;
251
252 switch( mnType )
253 {
254 case IMapObjectType::Rectangle:
255 {
256 const tools::Rectangle aRect( maBoundary.X, maBoundary.Y, maBoundary.X + maBoundary.Width - 1, maBoundary.Y + maBoundary.Height - 1 );
257 pNewIMapObject.reset(new IMapRectangleObject( aRect, aURL, aAltText, aDesc, aTarget, aName, mbIsActive, false ));
258 }
259 break;
260
261 case IMapObjectType::Circle:
262 {
263 const Point aCenter( maCenter.X, maCenter.Y );
264 pNewIMapObject.reset(new IMapCircleObject( aCenter, mnRadius, aURL, aAltText, aDesc, aTarget, aName, mbIsActive, false ));
265 }
266 break;
267
268 case IMapObjectType::Polygon:
269 default:
270 {
271 const sal_uInt16 nCount = static_cast<sal_uInt16>(maPolygon.getLength());
272
273 tools::Polygon aPoly( nCount );
274 for( sal_uInt16 nPoint = 0; nPoint < nCount; nPoint++ )
275 {
276 Point aPoint( maPolygon[nPoint].X, maPolygon[nPoint].Y );
277 aPoly.SetPoint( aPoint, nPoint );
278 }
279
280 aPoly.Optimize( PolyOptimizeFlags::CLOSE );
281 pNewIMapObject.reset(new IMapPolygonObject( aPoly, aURL, aAltText, aDesc, aTarget, aName, mbIsActive, false ));
282 }
283 break;
284 }
285
286 SvxMacroTableDtor aMacroTable;
287 mxEvents->copyMacrosIntoTable(aMacroTable);
288 pNewIMapObject->SetMacroTable( aMacroTable );
289
290 return pNewIMapObject;
291}
292
293// XInterface
294
295Any SAL_CALL SvUnoImageMapObject::queryInterface( const Type & rType )
296{
297 return OWeakAggObject::queryInterface( rType );
298}
299
300Any SAL_CALL SvUnoImageMapObject::queryAggregation( const Type & rType )
301{
302 Any aAny;
303
305 aAny <<= Reference< XServiceInfo >(this);
306 else if( rType == cppu::UnoType<XTypeProvider>::get())
307 aAny <<= Reference< XTypeProvider >(this);
308 else if( rType == cppu::UnoType<XPropertySet>::get())
309 aAny <<= Reference< XPropertySet >(this);
310 else if( rType == cppu::UnoType<XEventsSupplier>::get())
311 aAny <<= Reference< XEventsSupplier >(this);
312 else if( rType == cppu::UnoType<XMultiPropertySet>::get())
313 aAny <<= Reference< XMultiPropertySet >(this);
314 else
315 aAny = OWeakAggObject::queryAggregation( rType );
316
317 return aAny;
318}
319
320void SAL_CALL SvUnoImageMapObject::acquire() noexcept
321{
322 OWeakAggObject::acquire();
323}
324
325void SAL_CALL SvUnoImageMapObject::release() noexcept
326{
327 OWeakAggObject::release();
328}
329
330uno::Sequence< uno::Type > SAL_CALL SvUnoImageMapObject::getTypes()
331{
332 static const uno::Sequence< uno::Type > aTypes {
339 return aTypes;
340}
341
342uno::Sequence< sal_Int8 > SAL_CALL SvUnoImageMapObject::getImplementationId()
343{
344 return css::uno::Sequence<sal_Int8>();
345}
346
347// XServiceInfo
348sal_Bool SAL_CALL SvUnoImageMapObject::supportsService( const OUString& ServiceName )
349{
350 return cppu::supportsService(this, ServiceName);
351}
352
353Sequence< OUString > SAL_CALL SvUnoImageMapObject::getSupportedServiceNames()
354{
355 Sequence< OUString > aSNS( 2 );
356 aSNS.getArray()[0] = "com.sun.star.image.ImageMapObject";
357 switch( mnType )
358 {
359 case IMapObjectType::Polygon:
360 default:
361 aSNS.getArray()[1] = "com.sun.star.image.ImageMapPolygonObject";
362 break;
363 case IMapObjectType::Rectangle:
364 aSNS.getArray()[1] = "com.sun.star.image.ImageMapRectangleObject";
365 break;
366 case IMapObjectType::Circle:
367 aSNS.getArray()[1] = "com.sun.star.image.ImageMapCircleObject";
368 break;
369 }
370 return aSNS;
371}
372
373OUString SAL_CALL SvUnoImageMapObject::getImplementationName()
374{
375 switch( mnType )
376 {
377 case IMapObjectType::Polygon:
378 default:
379 return "org.openoffice.comp.svt.ImageMapPolygonObject";
380 case IMapObjectType::Circle:
381 return "org.openoffice.comp.svt.ImageMapCircleObject";
382 case IMapObjectType::Rectangle:
383 return "org.openoffice.comp.svt.ImageMapRectangleObject";
384 }
385}
386
387// overridden helpers from PropertySetHelper
388void SvUnoImageMapObject::_setPropertyValues( const PropertyMapEntry** ppEntries, const Any* pValues )
389{
390 bool bOk = false;
391
392 while( *ppEntries )
393 {
394 switch( (*ppEntries)->mnHandle )
395 {
396 case HANDLE_URL:
397 bOk = *pValues >>= maURL;
398 break;
399 case HANDLE_TITLE:
400 bOk = *pValues >>= maAltText;
401 break;
403 bOk = *pValues >>= maDesc;
404 break;
405 case HANDLE_TARGET:
406 bOk = *pValues >>= maTarget;
407 break;
408 case HANDLE_NAME:
409 bOk = *pValues >>= maName;
410 break;
411 case HANDLE_ISACTIVE:
412 bOk = *pValues >>= mbIsActive;
413 break;
414 case HANDLE_BOUNDARY:
415 bOk = *pValues >>= maBoundary;
416 break;
417 case HANDLE_CENTER:
418 bOk = *pValues >>= maCenter;
419 break;
420 case HANDLE_RADIUS:
421 bOk = *pValues >>= mnRadius;
422 break;
423 case HANDLE_POLYGON:
424 bOk = *pValues >>= maPolygon;
425 break;
426 default:
427 OSL_FAIL( "SvUnoImageMapObject::_setPropertyValues: unexpected property handle" );
428 break;
429 }
430
431 if( !bOk )
432 throw IllegalArgumentException();
433
434 ppEntries++;
435 pValues++;
436 }
437}
438
439void SvUnoImageMapObject::_getPropertyValues( const PropertyMapEntry** ppEntries, Any* pValues )
440{
441 while( *ppEntries )
442 {
443 switch( (*ppEntries)->mnHandle )
444 {
445 case HANDLE_URL:
446 *pValues <<= maURL;
447 break;
448 case HANDLE_TITLE:
449 *pValues <<= maAltText;
450 break;
452 *pValues <<= maDesc;
453 break;
454 case HANDLE_TARGET:
455 *pValues <<= maTarget;
456 break;
457 case HANDLE_NAME:
458 *pValues <<= maName;
459 break;
460 case HANDLE_ISACTIVE:
461 *pValues <<= mbIsActive;
462 break;
463 case HANDLE_BOUNDARY:
464 *pValues <<= maBoundary;
465 break;
466 case HANDLE_CENTER:
467 *pValues <<= maCenter;
468 break;
469 case HANDLE_RADIUS:
470 *pValues <<= mnRadius;
471 break;
472 case HANDLE_POLYGON:
473 *pValues <<= maPolygon;
474 break;
475 default:
476 OSL_FAIL( "SvUnoImageMapObject::_getPropertyValues: unexpected property handle" );
477 break;
478 }
479
480 ppEntries++;
481 pValues++;
482 }
483}
484
485
486Reference< XNameReplace > SAL_CALL SvUnoImageMapObject::getEvents()
487{
488 return mxEvents;
489}
490
491namespace {
492
493class SvUnoImageMap : public WeakImplHelper< XIndexContainer, XServiceInfo >
494{
495public:
496 explicit SvUnoImageMap();
497 SvUnoImageMap( const ImageMap& rMap, const SvEventDescription* pSupportedMacroItems );
498
499 void fillImageMap( ImageMap& rMap ) const;
501 static SvUnoImageMapObject* getObject( const Any& aElement );
502
503 // XIndexContainer
504 virtual void SAL_CALL insertByIndex( sal_Int32 Index, const Any& Element ) override;
505 virtual void SAL_CALL removeByIndex( sal_Int32 Index ) override;
506
507 // XIndexReplace
508 virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const Any& Element ) override;
509
510 // XIndexAccess
511 virtual sal_Int32 SAL_CALL getCount( ) override;
512 virtual Any SAL_CALL getByIndex( sal_Int32 Index ) override;
513
514 // XElementAccess
515 virtual Type SAL_CALL getElementType( ) override;
516 virtual sal_Bool SAL_CALL hasElements( ) override;
517
518 // XServiceInfo
519 virtual OUString SAL_CALL getImplementationName( ) override;
520 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
521 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
522
523private:
524 OUString maName;
525
526 std::vector< rtl::Reference<SvUnoImageMapObject> > maObjectList;
527};
528
529}
530
531SvUnoImageMap::SvUnoImageMap()
532{
533}
534
535SvUnoImageMap::SvUnoImageMap( const ImageMap& rMap, const SvEventDescription* pSupportedMacroItems )
536{
537 maName = rMap.GetName();
538
539 const std::size_t nCount = rMap.GetIMapObjectCount();
540 for( std::size_t nPos = 0; nPos < nCount; nPos++ )
541 {
542 IMapObject* pMapObject = rMap.GetIMapObject( nPos );
543 rtl::Reference<SvUnoImageMapObject> xUnoObj = new SvUnoImageMapObject( *pMapObject, pSupportedMacroItems );
544 maObjectList.push_back( xUnoObj );
545 }
546}
547
548SvUnoImageMapObject* SvUnoImageMap::getObject( const Any& aElement )
549{
550 Reference< XInterface > xObject;
551 aElement >>= xObject;
552
553 SvUnoImageMapObject* pObject = dynamic_cast<SvUnoImageMapObject*>( xObject.get() );
554 if( nullptr == pObject )
555 throw IllegalArgumentException();
556
557 return pObject;
558}
559
560// XIndexContainer
561void SAL_CALL SvUnoImageMap::insertByIndex( sal_Int32 nIndex, const Any& Element )
562{
563 SvUnoImageMapObject* pObject = getObject( Element );
564 const sal_Int32 nCount = maObjectList.size();
565 if( nullptr == pObject || nIndex > nCount )
566 throw IndexOutOfBoundsException();
567
568 if( nIndex == nCount )
569 maObjectList.emplace_back(pObject );
570 else
571 {
572 auto aIter = maObjectList.begin();
573 std::advance(aIter, nIndex);
574 maObjectList.insert( aIter, pObject );
575 }
576}
577
578void SAL_CALL SvUnoImageMap::removeByIndex( sal_Int32 nIndex )
579{
580 const sal_Int32 nCount = maObjectList.size();
581 if( nIndex >= nCount )
582 throw IndexOutOfBoundsException();
583
584 if( nCount - 1 == nIndex )
585 {
586 maObjectList.pop_back();
587 }
588 else
589 {
590 auto aIter = maObjectList.begin();
591 std::advance(aIter, nIndex);
592 maObjectList.erase( aIter );
593 }
594}
595
596// XIndexReplace
597void SAL_CALL SvUnoImageMap::replaceByIndex( sal_Int32 nIndex, const Any& Element )
598{
599 SvUnoImageMapObject* pObject = getObject( Element );
600 const sal_Int32 nCount = maObjectList.size();
601 if( nullptr == pObject || nIndex >= nCount )
602 throw IndexOutOfBoundsException();
603
604 auto aIter = maObjectList.begin();
605 std::advance(aIter, nIndex);
606 *aIter = pObject;
607}
608
609// XIndexAccess
610sal_Int32 SAL_CALL SvUnoImageMap::getCount( )
611{
612 return maObjectList.size();
613}
614
615Any SAL_CALL SvUnoImageMap::getByIndex( sal_Int32 nIndex )
616{
617 const sal_Int32 nCount = maObjectList.size();
618 if( nIndex >= nCount )
619 throw IndexOutOfBoundsException();
620
621 auto aIter = maObjectList.begin();
622 std::advance(aIter, nIndex);
623
624 Reference< XPropertySet > xObj( *aIter );
625 return Any( xObj );
626}
627
628// XElementAccess
629Type SAL_CALL SvUnoImageMap::getElementType( )
630{
632}
633
634sal_Bool SAL_CALL SvUnoImageMap::hasElements( )
635{
636 return (!maObjectList.empty());
637}
638
639// XServiceInfo
640OUString SAL_CALL SvUnoImageMap::getImplementationName( )
641{
642 return "org.openoffice.comp.svt.SvUnoImageMap";
643}
644
645sal_Bool SAL_CALL SvUnoImageMap::supportsService( const OUString& ServiceName )
646{
647 return cppu::supportsService(this, ServiceName);
648}
649
650Sequence< OUString > SAL_CALL SvUnoImageMap::getSupportedServiceNames( )
651{
652 return { "com.sun.star.image.ImageMap" };
653}
654
655void SvUnoImageMap::fillImageMap( ImageMap& rMap ) const
656{
657 rMap.ClearImageMap();
658
659 rMap.SetName( maName );
660
661 for (auto const& elem : maObjectList)
662 {
663 std::unique_ptr<IMapObject> pNewMapObject = elem->createIMapObject();
664 rMap.InsertIMapObject( std::move(pNewMapObject) );
665 }
666}
667
668
669// factory helper methods
670
671
672Reference< XInterface > SvUnoImageMapRectangleObject_createInstance( const SvEventDescription* pSupportedMacroItems )
673{
674 return getXWeak(new SvUnoImageMapObject( IMapObjectType::Rectangle, pSupportedMacroItems ));
675}
676
677Reference< XInterface > SvUnoImageMapCircleObject_createInstance( const SvEventDescription* pSupportedMacroItems )
678{
679 return getXWeak(new SvUnoImageMapObject( IMapObjectType::Circle, pSupportedMacroItems ));
680}
681
682Reference< XInterface > SvUnoImageMapPolygonObject_createInstance( const SvEventDescription* pSupportedMacroItems )
683{
684 return getXWeak(new SvUnoImageMapObject( IMapObjectType::Polygon, pSupportedMacroItems ));
685}
686
687Reference< XInterface > SvUnoImageMap_createInstance()
688{
689 return getXWeak(new SvUnoImageMap);
690}
691
692Reference< XInterface > SvUnoImageMap_createInstance( const ImageMap& rMap, const SvEventDescription* pSupportedMacroItems )
693{
694 return getXWeak(new SvUnoImageMap( rMap, pSupportedMacroItems ));
695}
696
697bool SvUnoImageMap_fillImageMap( const Reference< XInterface >& xImageMap, ImageMap& rMap )
698{
699 SvUnoImageMap* pUnoImageMap = dynamic_cast<SvUnoImageMap*>( xImageMap.get() );
700 if( nullptr == pUnoImageMap )
701 return false;
702
703 pUnoImageMap->fillImageMap( rMap );
704 return true;
705}
706
707/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const PropertyValue * pValues
struct _ADOIndex Index
Any maTarget
B2DPolygon maPolygon
OUString maName
const OUString & GetAltText() const
const OUString & GetName() const
bool IsActive() const
const OUString & GetURL() const
const SvxMacroTableDtor & GetMacroTable() const
const OUString & GetTarget() const
const OUString & GetDesc() const
void SetName(const OUString &rName)
const OUString & GetName() const
void InsertIMapObject(const IMapObject &rIMapObject)
IMapObject * GetIMapObject(size_t nPos) const
size_t GetIMapObjectCount() const
void ClearImageMap()
constexpr tools::Long Y() const
constexpr tools::Long X() const
virtual void _getPropertyValues(const comphelper::PropertyMapEntry **ppEntries, css::uno::Any *pValue)=0
virtual void _setPropertyValues(const comphelper::PropertyMapEntry **ppEntries, const css::uno::Any *pValues)=0
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &rType) SAL_OVERRIDE
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) SAL_OVERRIDE
virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
css::uno::Type const & get()
int nCount
URL aURL
EmbeddedObjectRef * pObject
Definition: embedhlp.cxx:74
IMapObjectType
bool mbIsActive
OUString aName
sal_uInt16 nPos
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
Type
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
const URL maURL
QPRO_FUNC_TYPE nType
sal_Int32 mnType
SvEventDescription: Description of a single event.
Definition: unoevent.hxx:42
unsigned char sal_Bool
Reference< XInterface > SvUnoImageMap_createInstance()
Definition: unoimap.cxx:687
Reference< XInterface > SvUnoImageMapRectangleObject_createInstance(const SvEventDescription *pSupportedMacroItems)
Definition: unoimap.cxx:672
const sal_Int32 HANDLE_NAME
Definition: unoimap.cxx:57
const sal_Int32 HANDLE_BOUNDARY
Definition: unoimap.cxx:62
Reference< XInterface > SvUnoImageMapPolygonObject_createInstance(const SvEventDescription *pSupportedMacroItems)
Definition: unoimap.cxx:682
const sal_Int32 HANDLE_DESCRIPTION
Definition: unoimap.cxx:55
const sal_Int32 HANDLE_TARGET
Definition: unoimap.cxx:56
const sal_Int32 HANDLE_ISACTIVE
Definition: unoimap.cxx:58
const sal_Int32 HANDLE_POLYGON
Definition: unoimap.cxx:59
const sal_Int32 HANDLE_CENTER
Definition: unoimap.cxx:60
const sal_Int32 HANDLE_URL
Definition: unoimap.cxx:54
const sal_Int32 HANDLE_RADIUS
Definition: unoimap.cxx:61
const sal_Int32 HANDLE_TITLE
Definition: unoimap.cxx:63
bool SvUnoImageMap_fillImageMap(const Reference< XInterface > &xImageMap, ImageMap &rMap)
Definition: unoimap.cxx:697
Reference< XInterface > SvUnoImageMapCircleObject_createInstance(const SvEventDescription *pSupportedMacroItems)
Definition: unoimap.cxx:677
const SvXMLTokenMapEntry aTypes[]