22#include <rtl/ustring.hxx>
23#include <rtl/ustrbuf.hxx>
25#include <com/sun/star/uno/Reference.h>
26#include <com/sun/star/uno/Sequence.h>
27#include <com/sun/star/beans/XPropertySet.hpp>
28#include <com/sun/star/lang/XServiceInfo.hpp>
29#include <com/sun/star/container/XIndexContainer.hpp>
30#include <com/sun/star/document/XEventsSupplier.hpp>
31#include <com/sun/star/awt/Rectangle.hpp>
32#include <com/sun/star/awt/Point.hpp>
33#include <com/sun/star/drawing/PointSequence.hpp>
46using ::com::sun::star::uno::Any;
47using ::com::sun::star::uno::UNO_QUERY;
48using ::com::sun::star::uno::Sequence;
49using ::com::sun::star::uno::Reference;
50using ::com::sun::star::beans::XPropertySet;
51using ::com::sun::star::container::XIndexContainer;
52using ::com::sun::star::document::XEventsSupplier;
53using ::com::sun::star::lang::XServiceInfo;
54using ::com::sun::star::drawing::PointSequence;
61constexpr OUStringLiteral
gsName(u
"Name");
65constexpr OUStringLiteral
gsURL(u
"URL");
66constexpr OUStringLiteral
gsTitle(u
"Title");
74 const Reference<XPropertySet> & rPropertySet)
76 if (rPropertySet->getPropertySetInfo()->hasPropertyByName(
gsImageMap))
79 Reference<XIndexContainer> aContainer;
88 const Reference<XIndexContainer> & rContainer)
93 if (!rContainer->hasElements())
103 sal_Int32
nLength = rContainer->getCount();
106 Any aAny = rContainer->getByIndex(i);
107 Reference<XPropertySet> rElement;
110 DBG_ASSERT(rElement.is(),
"Image map element is empty!");
122 const Reference<XPropertySet> & rPropertySet)
124 Reference<XServiceInfo> xServiceInfo(rPropertySet, UNO_QUERY);
125 if (!xServiceInfo.is())
131 const Sequence<OUString> sServiceNames =
132 xServiceInfo->getSupportedServiceNames();
133 for(
const OUString& rName : sServiceNames )
135 if ( rName ==
"com.sun.star.image.ImageMapRectangleObject" )
140 else if ( rName ==
"com.sun.star.image.ImageMapCircleObject" )
145 else if ( rName ==
"com.sun.star.image.ImageMapPolygonObject" )
154 "Image map element doesn't support appropriate service!");
161 Any aAny = rPropertySet->getPropertyValue(
gsURL);
164 if (!sHref.isEmpty())
171 aAny = rPropertySet->getPropertyValue(
gsTarget);
174 if (!sTargt.isEmpty())
185 aAny = rPropertySet->getPropertyValue(
gsName);
188 if (!sItemName.isEmpty())
194 aAny = rPropertySet->getPropertyValue(
gsIsActive);
195 if (! *o3tl::doAccess<bool>(aAny))
219 "No name?! How did this happen?");
225 rPropertySet->getPropertyValue(
gsTitle) >>= sTitle;
226 if(!sTitle.isEmpty())
233 OUString sDescription;
234 rPropertySet->getPropertyValue(
gsDescription) >>= sDescription;
235 if (!sDescription.isEmpty())
242 Reference<XEventsSupplier> xSupplier(rPropertySet, UNO_QUERY);
249 const Reference<XPropertySet> & rPropertySet)
253 awt::Rectangle aRectangle;
260 aBuffer.makeStringAndClear() );
263 aBuffer.makeStringAndClear() );
267 aBuffer.makeStringAndClear() );
271 aBuffer.makeStringAndClear() );
275 const Reference<XPropertySet> & rPropertySet)
278 Any aAny = rPropertySet->getPropertyValue(
gsCenter);
286 aBuffer.makeStringAndClear() );
289 aBuffer.makeStringAndClear() );
292 aAny = rPropertySet->getPropertyValue(
gsRadius);
293 sal_Int32 nRadius = 0;
297 aBuffer.makeStringAndClear() );
332 const OUString aPointString(
constexpr OUStringLiteral gsIsActive(u"IsActive")
constexpr OUStringLiteral gsURL(u"URL")
constexpr OUStringLiteral gsName(u"Name")
constexpr OUStringLiteral gsPolygon(u"Polygon")
constexpr OUStringLiteral gsBoundary(u"Boundary")
constexpr OUStringLiteral gsDescription(u"Description")
constexpr OUStringLiteral gsRadius(u"Radius")
constexpr OUStringLiteral gsTarget(u"Target")
constexpr OUStringLiteral gsTitle(u"Title")
constexpr OUStringLiteral gsCenter(u"Center")
constexpr OUStringLiteral gsImageMap(u"ImageMap")
const OUString & GetExportString()
OUString GetRelativeReference(const OUString &rValue)
XMLEventExport & GetEventExport()
get Event export, with handlers for script types "None" and "StarBasic" already registered; other han...
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
void Characters(const OUString &rChars)
const SvXMLUnitConverter & GetMM100UnitConverter() const
void convertMeasureToXML(OUStringBuffer &rBuffer, sal_Int32 nMeasure) const
convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit
void Export(css::uno::Reference< css::document::XEventsSupplier > const &xAccess, bool bUseWhitespace=true)
export the events (calls EventExport::Export(Reference<XNameAccess>) )
void ExportCircle(const css::uno::Reference< css::beans::XPropertySet > &rPropertySet)
Export the specifics of a circular image map entry.
void ExportMapEntry(const css::uno::Reference< css::beans::XPropertySet > &rPropertySet)
Export a single, named map entry.
void ExportPolygon(const css::uno::Reference< css::beans::XPropertySet > &rPropertySet)
Export the specifics of a polygonal image map entry; To be called by ExportMapEntry.
void ExportRectangle(const css::uno::Reference< css::beans::XPropertySet > &rPropertySet)
Export the specifics of a rectangular image map entry.
void Export(const css::uno::Reference< css::beans::XPropertySet > &rPropertySet)
Get the ImageMap object from the "ImageMap" property and subsequently export the map (if present).
XMLImageMapExport(SvXMLExport &rExport)
B2DRange const & getB2DRange() const
#define DBG_ASSERT(sCon, aError)
B2DPolygon UnoPointSequenceToB2DPolygon(const css::drawing::PointSequence &rPointSequenceSource)
OUString exportToSvgPoints(const B2DPolygon &rPoly)
B2IRange fround(const B2DRange &rRange)
Handling of tokens in XML:
XMLTokenEnum
The enumeration of all XML tokens.
std::unique_ptr< char[]> aBuffer
constexpr sal_uInt16 XML_NAMESPACE_DRAW
constexpr sal_uInt16 XML_NAMESPACE_XLINK
constexpr sal_uInt16 XML_NAMESPACE_SVG
constexpr sal_uInt16 XML_NAMESPACE_OFFICE