1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _XMLOFF_XMLIMAGEMAPEXPORT_HXX_
29 #define _XMLOFF_XMLIMAGEMAPEXPORT_HXX_
30 
31 #include <rtl/ustring.hxx>
32 
33 namespace com { namespace sun { namespace star {
34 	namespace uno { template<class X> class Reference; }
35 	namespace beans { class XPropertySet; }
36 	namespace container { class XIndexContainer; }
37 } } }
38 class SvXMLExport;
39 
40 
41 /**
42  * Export an ImageMap as defined by service com.sun.star.image.ImageMap to XML.
43  */
44 class XMLImageMapExport
45 {
46 	const ::rtl::OUString msBoundary;
47 	const ::rtl::OUString msCenter;
48 	const ::rtl::OUString msDescription;
49 	const ::rtl::OUString msImageMap;
50 	const ::rtl::OUString msIsActive;
51 	const ::rtl::OUString msName;
52 	const ::rtl::OUString msPolygon;
53 	const ::rtl::OUString msRadius;
54 	const ::rtl::OUString msTarget;
55 	const ::rtl::OUString msURL;
56 	const ::rtl::OUString msTitle;
57 
58 	SvXMLExport& mrExport;
59 
60 	sal_Bool mbWhiteSpace;	/// use whitespace between image map elements?
61 
62 public:
63 	XMLImageMapExport(SvXMLExport& rExport);
64 
65 	~XMLImageMapExport();
66 
67 	/**
68 	 * Get the ImageMap object from the "ImageMap" property and subsequently
69 	 * export the map (if present).
70 	 */
71 	void Export(
72 		/// the property set containing the ImageMap property
73 		const ::com::sun::star::uno::Reference<
74 			::com::sun::star::beans::XPropertySet> & rPropertySet);
75 	/**
76 	 * Export an ImageMap (XIndexContainer).
77 	 */
78 	void Export(
79 		/// the container containing the image map elements
80 		const ::com::sun::star::uno::Reference<
81 			::com::sun::star::container::XIndexContainer> & rContainer);
82 
83 protected:
84 
85 	/**
86 	 * Export a single, named map entry.
87 	 * (as given by com.sun.star.image.ImageMapObject)
88 	 * Calls methods for specific image map entries.
89 	 */
90 	void ExportMapEntry(
91 		const ::com::sun::star::uno::Reference<
92 			::com::sun::star::beans::XPropertySet> & rPropertySet);
93 
94 	/**
95 	 * Export the specifics of a rectangular image map entry.
96 	 * To be called by ExportMapEntry.
97 	 */
98 	void ExportRectangle(
99 		const ::com::sun::star::uno::Reference<
100 			::com::sun::star::beans::XPropertySet> & rPropertySet);
101 
102 	/**
103 	 * Export the specifics of a circular image map entry.
104 	 * To be called by ExportMapEntry.
105 	 */
106 	void ExportCircle(
107 		const ::com::sun::star::uno::Reference<
108 			::com::sun::star::beans::XPropertySet> & rPropertySet);
109 
110 	/**
111 	 * Export the specifics of a polygonal image map entry;
112 	 * To be called by ExportMapEntry.
113 	 */
114 	void ExportPolygon(
115 		const ::com::sun::star::uno::Reference<
116 			::com::sun::star::beans::XPropertySet> & rPropertySet);
117 };
118 
119 #endif
120