LCOV - code coverage report
Current view: top level - libreoffice/framework/inc/xml - imagesdocumenthandler.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-12-27 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef FRAMEWORK_XML_IMAGEDOCUMENTHANDLER_HXX_
      21             : #define FRAMEWORK_XML_IMAGEDOCUMENTHANDLER_HXX_
      22             : 
      23             : #include <framework/fwedllapi.h>
      24             : 
      25             : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      26             : 
      27             : #include <xml/imagesconfiguration.hxx>
      28             : #include <threadhelp/threadhelpbase.hxx>
      29             : #include <rtl/ustring.hxx>
      30             : #include <cppuhelper/implbase1.hxx>
      31             : 
      32             : #include <boost/unordered_map.hpp>
      33             : #include <stdtypes.h>
      34             : 
      35             : namespace framework{
      36             : 
      37             : //*****************************************************************************************************************
      38             : // Hash code function for using in all hash maps of follow implementation.
      39             : 
      40             : class OReadImagesDocumentHandler : private ThreadHelpBase,  // Struct for right initalization of lock member! Must be first of baseclasses.
      41             :                                    public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler >
      42             : {
      43             :     public:
      44             :         enum Image_XML_Entry
      45             :         {
      46             :             IMG_ELEMENT_IMAGECONTAINER,
      47             :             IMG_ELEMENT_IMAGES,
      48             :             IMG_ELEMENT_ENTRY,
      49             :             IMG_ELEMENT_EXTERNALIMAGES,
      50             :             IMG_ELEMENT_EXTERNALENTRY,
      51             :             IMG_ATTRIBUTE_HREF,
      52             :             IMG_ATTRIBUTE_MASKCOLOR,
      53             :             IMG_ATTRIBUTE_COMMAND,
      54             :             IMG_ATTRIBUTE_BITMAPINDEX,
      55             :             IMG_ATTRIBUTE_MASKURL,
      56             :             IMG_ATTRIBUTE_MASKMODE,
      57             :             IMG_ATTRIBUTE_HIGHCONTRASTURL,
      58             :             IMG_ATTRIBUTE_HIGHCONTRASTMASKURL,
      59             :             IMG_XML_ENTRY_COUNT
      60             :         };
      61             : 
      62             :         enum Image_XML_Namespace
      63             :         {
      64             :             IMG_NS_IMAGE,
      65             :             IMG_NS_XLINK,
      66             :             TBL_XML_NAMESPACES_COUNT
      67             :         };
      68             : 
      69             :         OReadImagesDocumentHandler( ImageListsDescriptor& aItems );
      70             :         virtual ~OReadImagesDocumentHandler();
      71             : 
      72             :         // XDocumentHandler
      73             :         virtual void SAL_CALL startDocument(void)
      74             :         throw ( ::com::sun::star::xml::sax::SAXException,
      75             :                 ::com::sun::star::uno::RuntimeException );
      76             : 
      77             :         virtual void SAL_CALL endDocument(void)
      78             :         throw(  ::com::sun::star::xml::sax::SAXException,
      79             :                 ::com::sun::star::uno::RuntimeException );
      80             : 
      81             :         virtual void SAL_CALL startElement(
      82             :             const rtl::OUString& aName,
      83             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
      84             :         throw(  ::com::sun::star::xml::sax::SAXException,
      85             :                 ::com::sun::star::uno::RuntimeException );
      86             : 
      87             :         virtual void SAL_CALL endElement(const rtl::OUString& aName)
      88             :         throw(  ::com::sun::star::xml::sax::SAXException,
      89             :                 ::com::sun::star::uno::RuntimeException );
      90             : 
      91             :         virtual void SAL_CALL characters(const rtl::OUString& aChars)
      92             :         throw(  ::com::sun::star::xml::sax::SAXException,
      93             :                 ::com::sun::star::uno::RuntimeException );
      94             : 
      95             :         virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces)
      96             :         throw(  ::com::sun::star::xml::sax::SAXException,
      97             :                 ::com::sun::star::uno::RuntimeException );
      98             : 
      99             :         virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget,
     100             :                                                     const rtl::OUString& aData)
     101             :         throw(  ::com::sun::star::xml::sax::SAXException,
     102             :                 ::com::sun::star::uno::RuntimeException );
     103             : 
     104             :         virtual void SAL_CALL setDocumentLocator(
     105             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator)
     106             :         throw(  ::com::sun::star::xml::sax::SAXException,
     107             :                 ::com::sun::star::uno::RuntimeException );
     108             : 
     109             :     private:
     110             :         ::rtl::OUString getErrorLineString();
     111             : 
     112           0 :         class ImageHashMap : public ::boost::unordered_map< ::rtl::OUString     ,
     113             :                                                      Image_XML_Entry        ,
     114             :                                                      OUStringHashCode       ,
     115             :                                                      ::std::equal_to< ::rtl::OUString > >
     116             :         {
     117             :             public:
     118             :                 inline void free()
     119             :                 {
     120             :                     ImageHashMap().swap( *this );
     121             :                 }
     122             :         };
     123             : 
     124             :         sal_Bool                                                                    m_bImageContainerStartFound;
     125             :         sal_Bool                                                                    m_bImageContainerEndFound;
     126             :         sal_Bool                                                                    m_bImagesStartFound;
     127             :         sal_Bool                                                                    m_bImagesEndFound;
     128             :         sal_Bool                                                                    m_bImageStartFound;
     129             :         sal_Bool                                                                    m_bExternalImagesStartFound;
     130             :         sal_Bool                                                                    m_bExternalImagesEndFound;
     131             :         sal_Bool                                                                    m_bExternalImageStartFound;
     132             :         sal_Int32                                                                   m_nHashMaskModeBitmap;
     133             :         sal_Int32                                                                   m_nHashMaskModeColor;
     134             :         ImageHashMap                                                                m_aImageMap;
     135             :         ImageListsDescriptor&                                                       m_aImageList;
     136             :         ImageListItemDescriptor*                                                    m_pImages;
     137             :         ExternalImageItemListDescriptor*                                            m_pExternalImages;
     138             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >    m_xLocator;
     139             : };
     140             : 
     141             : class OWriteImagesDocumentHandler : private ThreadHelpBase // Struct for right initalization of lock member! Must be first of baseclasses.
     142             : {
     143             :     public:
     144             :         OWriteImagesDocumentHandler(
     145             :             const ImageListsDescriptor& aItems,
     146             :             ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > );
     147             :         virtual ~OWriteImagesDocumentHandler();
     148             : 
     149             :         void WriteImagesDocument() throw
     150             :             ( ::com::sun::star::xml::sax::SAXException,
     151             :               ::com::sun::star::uno::RuntimeException );
     152             : 
     153             :     protected:
     154             :         virtual void WriteImageList( const ImageListItemDescriptor* ) throw
     155             :             ( ::com::sun::star::xml::sax::SAXException,
     156             :               ::com::sun::star::uno::RuntimeException );
     157             : 
     158             :         virtual void WriteExternalImageList( const ExternalImageItemListDescriptor* ) throw
     159             :             ( ::com::sun::star::xml::sax::SAXException,
     160             :               ::com::sun::star::uno::RuntimeException );
     161             : 
     162             :         virtual void WriteImage( const ImageItemDescriptor* ) throw
     163             :             ( ::com::sun::star::xml::sax::SAXException,
     164             :               ::com::sun::star::uno::RuntimeException );
     165             : 
     166             :         virtual void WriteExternalImage( const ExternalImageItemDescriptor* ) throw
     167             :             ( ::com::sun::star::xml::sax::SAXException,
     168             :               ::com::sun::star::uno::RuntimeException );
     169             : 
     170             :         const ImageListsDescriptor&                                                         m_aImageListsItems;
     171             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >    m_xWriteDocumentHandler;
     172             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >      m_xEmptyList;
     173             :         ::rtl::OUString                                                                     m_aXMLXlinkNS;
     174             :         ::rtl::OUString                                                                     m_aXMLImageNS;
     175             :         ::rtl::OUString                                                                     m_aAttributeType;
     176             :         ::rtl::OUString                                                                     m_aAttributeXlinkType;
     177             :         ::rtl::OUString                                                                     m_aAttributeValueSimple;
     178             : };
     179             : 
     180             : } // namespace framework
     181             : 
     182             : #endif
     183             : 
     184             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10