22#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
23#include <com/sun/star/xml/sax/SAXException.hpp>
26#include <rtl/ustrbuf.hxx>
33#define ELEMENT_IMAGECONTAINER "imagescontainer"
34#define ELEMENT_IMAGES "images"
35#define ELEMENT_ENTRY "entry"
36#define ELEMENT_EXTERNALIMAGES "externalimages"
37#define ELEMENT_EXTERNALENTRY "externalentry"
43#define ATTRIBUTE_HREF "href"
44#define ATTRIBUTE_MASKCOLOR "maskcolor"
45#define ATTRIBUTE_COMMAND "command"
46#define ATTRIBUTE_BITMAPINDEX "bitmap-index"
47#define ATTRIBUTE_MASKURL "maskurl"
48#define ATTRIBUTE_MASKMODE "maskmode"
49#define ATTRIBUTE_HIGHCONTRASTURL "highcontrasturl"
50#define ATTRIBUTE_HIGHCONTRASTMASKURL "highcontrastmaskurl"
58constexpr OUStringLiteral
XMLNS_IMAGE =
u"http://openoffice.org/2001/image";
59constexpr OUStringLiteral
XMLNS_XLINK =
u"http://www.w3.org/1999/xlink";
64constexpr OUStringLiteral
IMAGES_DOCTYPE =
u"<!DOCTYPE image:imagecontainer PUBLIC \"-//OpenOffice.org//DTD OfficeDocument 1.0//EN\" \"image.dtd\">";
71struct ImageXMLEntryProperty
97 m_rImageList( rItems )
102 OUStringBuffer temp( 20 );
133 OUString aErrorMessage =
getErrorLineString() +
"No matching start or end element 'image:imagecontainer' found!";
134 throw SAXException( aErrorMessage, Reference< XInterface >(),
Any() );
139 const OUString& aName,
const Reference< XAttributeList > &xAttribs )
145 switch ( pImageEntry->second )
152 OUString aErrorMessage =
getErrorLineString() +
"Element 'image:imagecontainer' cannot be embedded into 'image:imagecontainer'!";
153 throw SAXException( aErrorMessage, Reference< XInterface >(),
Any() );
164 OUString aErrorMessage =
getErrorLineString() +
"Element 'image:images' must be embedded into element 'image:imagecontainer'!";
165 throw SAXException( aErrorMessage, Reference< XInterface >(),
Any() );
170 OUString aErrorMessage =
getErrorLineString() +
"Element 'image:images' cannot be embedded into 'image:images'!";
171 throw SAXException( aErrorMessage, Reference< XInterface >(),
Any() );
183 OUString aErrorMessage =
getErrorLineString() +
"Element 'image:entry' must be embedded into element 'image:images'!";
184 throw SAXException( aErrorMessage, Reference< XInterface >(),
Any() );
191 for ( sal_Int16
n = 0;
n < xAttribs->getLength();
n++ )
193 pImageEntry =
m_aImageMap.find( xAttribs->getNameByIndex(
n ) );
196 switch ( pImageEntry->second )
213 OUString aErrorMessage =
getErrorLineString() +
"Required attribute 'image:command' must have a value!";
214 throw SAXException( aErrorMessage, Reference< XInterface >(),
Any() );
232 switch ( pImageEntry->second )
259 const OUString& ,
const OUString& )
264 const Reference< XLocator > &xLocator)
274 OUString::number(
m_xLocator->getLineNumber()) +
285 Reference< XDocumentHandler >
const & rWriteDocumentHandler ) :
286 m_rImageItemList( rItems ),
287 m_xWriteDocumentHandler( rWriteDocumentHandler )
305 if ( xExtendedDocHandler.is() )
@ IMG_ELEMENT_IMAGECONTAINER
virtual void SAL_CALL startElement(const OUString &aName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttribs) override
virtual void SAL_CALL startDocument() override
virtual ~OReadImagesDocumentHandler() override
OUString getErrorLineString()
virtual void SAL_CALL ignorableWhitespace(const OUString &aWhitespaces) override
virtual void SAL_CALL characters(const OUString &aChars) override
virtual void SAL_CALL endDocument() override
OReadImagesDocumentHandler(ImageItemDescriptorList &aItems)
bool m_bImageContainerStartFound
virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > &xLocator) override
virtual void SAL_CALL processingInstruction(const OUString &aTarget, const OUString &aData) override
ImageItemDescriptorList & m_rImageList
bool m_bImageContainerEndFound
virtual void SAL_CALL endElement(const OUString &aName) override
css::uno::Reference< css::xml::sax::XLocator > m_xLocator
OUString m_aAttributeValueSimple
css::uno::Reference< css::xml::sax::XAttributeList > m_xEmptyList
css::uno::Reference< css::xml::sax::XDocumentHandler > m_xWriteDocumentHandler
OUString m_aAttributeXlinkType
void WriteImageList(const ImageItemDescriptorList *)
~OWriteImagesDocumentHandler()
void WriteImage(const ImageItemDescriptor *)
const ImageItemDescriptorList & m_rImageItemList
OWriteImagesDocumentHandler(const ImageItemDescriptorList &aItems, css::uno::Reference< css::xml::sax::XDocumentHandler > const &rWriteDocumentHandler)
void WriteImagesDocument()
constexpr OUStringLiteral ELEMENT_NS_IMAGES
#define ATTRIBUTE_HIGHCONTRASTMASKURL
constexpr OUStringLiteral ATTRIBUTE_XLINK_TYPE
constexpr OUStringLiteral XMLNS_IMAGE
constexpr OUStringLiteral XMLNS_FILTER_SEPARATOR
#define ATTRIBUTE_MASKCOLOR
constexpr OUStringLiteral ATTRIBUTE_XLINK_TYPE_VALUE
#define ELEMENT_EXTERNALENTRY
#define ELEMENT_EXTERNALIMAGES
#define ELEMENT_IMAGECONTAINER
OReadImagesDocumentHandler::Image_XML_Namespace nNamespace
#define ATTRIBUTE_MASKURL
#define ATTRIBUTE_HIGHCONTRASTURL
#define ATTRIBUTE_BITMAPINDEX
constexpr OUStringLiteral ELEMENT_NS_ENTRY
#define ATTRIBUTE_COMMAND
constexpr OUStringLiteral ATTRIBUTE_XMLNS_IMAGE
constexpr OUStringLiteral ELEMENT_NS_IMAGESCONTAINER
#define ATTRIBUTE_MASKMODE
constexpr OUStringLiteral XMLNS_IMAGE_PREFIX
constexpr OUStringLiteral IMAGES_DOCTYPE
constexpr OUStringLiteral ATTRIBUTE_XMLNS_XLINK
constexpr OUStringLiteral XMLNS_XLINK
ImageXMLEntryProperty const ImagesEntries[OReadImagesDocumentHandler::IMG_XML_ENTRY_COUNT]
std::vector< ImageItemDescriptor > ImageItemDescriptorList