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

Generated by: LCOV version 1.10