LCOV - code coverage report
Current view: top level - xmloff/source/forms - layerimport.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 2 100.0 %
Date: 2015-06-13 12:38:46 Functions: 2 2 100.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_XMLOFF_SOURCE_FORMS_LAYERIMPORT_HXX
      21             : #define INCLUDED_XMLOFF_SOURCE_FORMS_LAYERIMPORT_HXX
      22             : 
      23             : #include <sal/config.h>
      24             : 
      25             : #include <map>
      26             : 
      27             : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      28             : #include <com/sun/star/form/XFormsSupplier2.hpp>
      29             : #include <rtl/ref.hxx>
      30             : #include "formattributes.hxx"
      31             : #include "callbacks.hxx"
      32             : #include "eventimport.hxx"
      33             : #include <tools/ref.hxx>
      34             : 
      35             : class SvXMLImport;
      36             : class SvXMLImportContext;
      37             : class SvXMLStyleContext;
      38             : class SvXMLStylesContext;
      39             : 
      40             :     // unfortunately, we can't put this into our namespace, as the macro expands to (amongst others) a forward
      41             :     // declaration of the class name, which then would be in the namespace, too
      42             : 
      43             : namespace xmloff
      44             : {
      45             : 
      46             :     class OAttribute2Property;
      47             : 
      48             :     //= OFormLayerXMLImport_Impl
      49             :     class OFormLayerXMLImport_Impl
      50             :                 : public ODefaultEventAttacherManager
      51             :     {
      52             :         friend class OFormLayerXMLImport;
      53             : 
      54             :     protected:
      55             :         SvXMLImport&                        m_rImporter;
      56             :         OAttribute2Property                 m_aAttributeMetaData;
      57             : 
      58             :         /// the supplier for the forms of the currently imported page
      59             :         ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier2 >
      60             :                                             m_xCurrentPageFormsSupp;
      61             :         SvXMLStylesContext*                 m_pAutoStyles;
      62             : 
      63             :     protected:
      64             :         typedef std::map< OUString, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > > MapString2PropertySet;
      65             :         typedef std::map<css::uno::Reference<css::drawing::XDrawPage>, MapString2PropertySet, ODrawPageCompare> MapDrawPage2Map;
      66             : 
      67             :         MapDrawPage2Map         m_aControlIds;          // ids of the controls on all known page
      68             :         MapDrawPage2Map::iterator m_aCurrentPageIds;      // ifs of the controls on the current page
      69             : 
      70             :         typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, OUString >
      71             :                                 ModelStringPair;
      72             :         ::std::vector< ModelStringPair >
      73             :                                 m_aControlReferences;   // control reference descriptions for current page
      74             :         ::std::vector< ModelStringPair >
      75             :                                 m_aCellValueBindings;   // information about controls bound to spreadsheet cells
      76             :         ::std::vector< ModelStringPair >
      77             :                                 m_aCellRangeListSources;// information about controls bound to spreadsheet cell range list sources
      78             : 
      79             :         ::std::vector< ModelStringPair >
      80             :                                 m_aXFormsValueBindings; // collect xforms:bind attributes to be resolved
      81             : 
      82             :         ::std::vector< ModelStringPair >
      83             :                                 m_aXFormsListBindings; // collect forms:xforms-list-source attributes to be resolved
      84             : 
      85             :         ::std::vector< ModelStringPair >
      86             :                                 m_aXFormsSubmissions;   // collect xforms:submission attributes to be resolved
      87             : 
      88             :     public:
      89             :         // IControlIdMap
      90             :         void    registerControlId(
      91             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl,
      92             :             const OUString& _rId);
      93             :         void    registerControlReferences(
      94             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl,
      95             :             const OUString& _rReferringControls);
      96             : 
      97             :         // OFormLayerXMLImport_Impl
      98         171 :         inline OAttribute2Property&         getAttributeMap()   { return m_aAttributeMetaData; }
      99        1516 :         inline SvXMLImport&                 getGlobalContext()  { return m_rImporter; }
     100             :         const SvXMLStyleContext*            getStyleElement(const OUString& _rStyleName) const;
     101             :         void                                enterEventContext();
     102             :         void                                leaveEventContext();
     103             :         void                                applyControlNumberStyle(
     104             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
     105             :             const OUString& _rControlNumerStyleName
     106             :         );
     107             :         void                        registerCellValueBinding(
     108             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
     109             :             const OUString& _rCellAddress
     110             :         );
     111             : 
     112             :         void                        registerCellRangeListSource(
     113             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
     114             :             const OUString& _rCellRangeAddress
     115             :         );
     116             : 
     117             :         void                        registerXFormsValueBinding(
     118             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
     119             :             const OUString& _rBindingID
     120             :         );
     121             : 
     122             :         void                        registerXFormsListBinding(
     123             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
     124             :             const OUString& _rBindingID
     125             :         );
     126             : 
     127             :         void                        registerXFormsSubmission(
     128             :             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel,
     129             :             const OUString& _rSubmissionID
     130             :         );
     131             : 
     132             :     protected:
     133             :         explicit OFormLayerXMLImport_Impl(SvXMLImport& _rImporter);
     134             :         virtual ~OFormLayerXMLImport_Impl();
     135             : 
     136             :         /** start importing the forms of the given page
     137             :         */
     138             :         void startPage(
     139             :             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage);
     140             : 
     141             :         /** end importing the forms of the current page
     142             :         */
     143             :         void endPage();
     144             : 
     145             :         /** creates an import context for the office:forms element
     146             :         */
     147             :         static SvXMLImportContext* createOfficeFormsContext(
     148             :             SvXMLImport& _rImport,
     149             :             sal_uInt16 _nPrefix,
     150             :             const OUString& _rLocalName);
     151             : 
     152             :         /** create an <type>SvXMLImportContext</type> instance which is able to import the &lt;form:form&gt;
     153             :             element.
     154             :         */
     155             :         SvXMLImportContext* createContext(
     156             :             const sal_uInt16 _nPrefix,
     157             :             const OUString& _rLocalName,
     158             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttribs);
     159             : 
     160             :         /** get the control with the given id
     161             :         */
     162             :         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
     163             :                 lookupControlId(const OUString& _rControlId);
     164             : 
     165             :         /** announces the auto-style context to the form importer
     166             :         */
     167             :         void setAutoStyleContext(SvXMLStylesContext* _pNewContext);
     168             : 
     169             :         /** to be called when the document has been completely imported
     170             : 
     171             :             <p>For some documents (currently: only some spreadsheet documents) it's necessary
     172             :             do to a post processing, since not all information from the file can be processed
     173             :             if the document is not completed, yet.</p>
     174             :         */
     175             :         void documentDone( );
     176             :     };
     177             : 
     178             : }   // namespace xmloff
     179             : 
     180             : #endif // INCLUDED_XMLOFF_SOURCE_FORMS_LAYERIMPORT_HXX
     181             : 
     182             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11