LCOV - code coverage report
Current view: top level - writerfilter/source/ooxml - OOXMLFactory.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 1 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_OOXML_FACTORY_HXX
      21             : #define INCLUDED_OOXML_FACTORY_HXX
      22             : 
      23             : #include <boost/unordered_map.hpp>
      24             : #include <boost/shared_ptr.hpp>
      25             : 
      26             : #include <resourcemodel/WW8ResourceModel.hxx>
      27             : 
      28             : #include <ooxml/OOXMLFastTokens.hxx>
      29             : 
      30             : #include "OOXMLFastContextHandler.hxx"
      31             : 
      32             : namespace writerfilter {
      33             : namespace ooxml {
      34             : 
      35             : using namespace std;
      36             : 
      37             : enum ResourceType_t {
      38             :     RT_NoResource,
      39             :     RT_Table,
      40             :     RT_Stream,
      41             :     RT_StreamProperties,
      42             :     RT_List,
      43             :     RT_Integer,
      44             :     RT_Properties,
      45             :     RT_Hex,
      46             :     RT_String,
      47             :     RT_Shape,
      48             :     RT_Boolean,
      49             :     RT_HexValue,
      50             :     RT_Value,
      51             :     RT_XNote,
      52             :     RT_TextTableCell,
      53             :     RT_TextTableRow,
      54             :     RT_TextTable,
      55             :     RT_PropertyTable,
      56             :     RT_Math,
      57             :     RT_Any,
      58             :     RT_UniversalMeasure
      59             : };
      60             : 
      61             : struct AttributeInfo
      62             : {
      63             :     ResourceType_t m_nResource;
      64             :     Id m_nRef;
      65             : 
      66             :     AttributeInfo(ResourceType_t nResource, Id nRef);
      67             :     AttributeInfo();
      68             : };
      69             : 
      70             : typedef boost::unordered_map<Token_t, AttributeInfo> AttributeToResourceMap;
      71             : typedef boost::shared_ptr<AttributeToResourceMap> AttributeToResourceMapPointer;
      72             : typedef boost::unordered_map<Id, AttributeToResourceMapPointer> AttributesMap;
      73             : 
      74             : typedef boost::unordered_map<OUString, sal_Int32, OUStringHash> ListValueMap;
      75             : typedef boost::shared_ptr<ListValueMap> ListValueMapPointer;
      76             : typedef boost::unordered_map<Id, ListValueMapPointer> ListValuesMap;
      77             : 
      78             : struct CreateElement
      79             : {
      80             :     ResourceType_t m_nResource;
      81             :     Id m_nId;
      82             : 
      83             :     CreateElement(ResourceType_t nResource, Id nId);
      84             :     CreateElement();
      85             : };
      86             : 
      87             : typedef boost::unordered_map<Token_t, CreateElement> CreateElementMap;
      88             : typedef boost::shared_ptr<CreateElementMap> CreateElementMapPointer;
      89             : typedef boost::unordered_map<Id, CreateElementMapPointer> CreateElementsMap;
      90             : typedef boost::unordered_map<Id, string> IdToStringMap;
      91             : typedef boost::shared_ptr<IdToStringMap> IdToStringMapPointer;
      92             : 
      93             : typedef boost::unordered_map<Id, Token_t> TokenToIdMap;
      94             : typedef boost::shared_ptr<TokenToIdMap> TokenToIdMapPointer;
      95             : typedef boost::unordered_map<Id, TokenToIdMapPointer> TokenToIdsMap;
      96             : 
      97           0 : class OOXMLFactory_ns {
      98             : public:
      99             :     typedef boost::shared_ptr<OOXMLFactory_ns> Pointer_t;
     100             : 
     101             :     virtual void startAction(OOXMLFastContextHandler * pHandler);
     102             :     virtual void charactersAction(OOXMLFastContextHandler * pHandler, const OUString & rString);
     103             :     virtual void endAction(OOXMLFastContextHandler * pHandler);
     104             :     virtual void attributeAction(OOXMLFastContextHandler * pHandler, Token_t nToken, OOXMLValue::Pointer_t pValue);
     105             :     virtual string getDefineName(Id nId) const;
     106             : #ifdef DEBUG_FACTORY
     107             :     virtual string getName() const;
     108             : #endif
     109             : 
     110             :     AttributeToResourceMapPointer getAttributeToResourceMap(Id nId);
     111             :     ListValueMapPointer getListValueMap(Id nId);
     112             :     CreateElementMapPointer getCreateElementMap(Id nId);
     113             :     TokenToIdMapPointer getTokenToIdMap(Id nId);
     114             : 
     115             : protected:
     116             :     virtual ~OOXMLFactory_ns();
     117             : 
     118             :     AttributesMap m_AttributesMap;
     119             :     ListValuesMap m_ListValuesMap;
     120             :     CreateElementsMap m_CreateElementsMap;
     121             :     TokenToIdsMap m_TokenToIdsMap;
     122             : 
     123             :     virtual AttributeToResourceMapPointer createAttributeToResourceMap(Id nId) = 0;
     124             :     virtual ListValueMapPointer createListValueMap(Id nId) = 0;
     125             :     virtual CreateElementMapPointer createCreateElementMap(Id nId) = 0;
     126             :     virtual TokenToIdMapPointer createTokenToIdMap(Id nId) = 0;
     127             : };
     128             : 
     129             : class OOXMLFactory
     130             : {
     131             : public:
     132             :     typedef boost::shared_ptr<OOXMLFactory> Pointer_t;
     133             : 
     134             :     static Pointer_t getInstance();
     135             : 
     136             :     uno::Reference< xml::sax::XFastContextHandler> createFastChildContext
     137             :     (OOXMLFastContextHandler * pHandler, Token_t Element);
     138             : 
     139             :     uno::Reference< xml::sax::XFastContextHandler> createFastChildContextFromStart
     140             :     (OOXMLFastContextHandler * pHandler, Token_t Element);
     141             : 
     142             :     void attributes(OOXMLFastContextHandler * pHandler,
     143             :                     const uno::Reference< xml::sax::XFastAttributeList > & Attribs);
     144             : 
     145             :     void characters(OOXMLFastContextHandler * pHandler,
     146             :                     const OUString & rString);
     147             : 
     148             :     void startAction(OOXMLFastContextHandler * pHandler, Token_t nToken);
     149             :     void endAction(OOXMLFastContextHandler * pHandler, Token_t nToken);
     150             : 
     151             :     virtual ~OOXMLFactory();
     152             : 
     153             : private:
     154             :     static Pointer_t m_Instance;
     155             : 
     156             :     OOXMLFactory();
     157             :     OOXMLFactory_ns::Pointer_t getFactoryForNamespace(Id id);
     158             : 
     159             :     uno::Reference< xml::sax::XFastContextHandler>
     160             :     createFastChildContextFromFactory(OOXMLFastContextHandler * pHandler,
     161             :                                       OOXMLFactory_ns::Pointer_t pFactory,
     162             :                                       Token_t Element);
     163             : };
     164             : 
     165             : }
     166             : }
     167             : 
     168             : #endif // INCLUDED_OOXML_FACTORY_HXX
     169             : 
     170             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10