LCOV - code coverage report
Current view: top level - libreoffice/dbaccess/source/filter/xml - xmlExport.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 8 0.0 %
Date: 2012-12-27 Functions: 0 9 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 DBA_XMLEXPORT_HXX
      21             : #define DBA_XMLEXPORT_HXX
      22             : 
      23             : #include <com/sun/star/container/XNamed.hpp>
      24             : #include <com/sun/star/document/XFilter.hpp>
      25             : #include <com/sun/star/document/XImporter.hpp>
      26             : #include <com/sun/star/document/XExporter.hpp>
      27             : #include <com/sun/star/lang/XInitialization.hpp>
      28             : #include <com/sun/star/lang/XServiceInfo.hpp>
      29             : #include <com/sun/star/beans/XPropertySet.hpp>
      30             : #include <com/sun/star/lang/XComponent.hpp>
      31             : #include <cppuhelper/implbase1.hxx>
      32             : #include <cppuhelper/implbase5.hxx>
      33             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      34             : #include <com/sun/star/io/XActiveDataSource.hpp>
      35             : #include <osl/diagnose.h>
      36             : #include <unotools/tempfile.hxx>
      37             : #include <unotools/localfilehelper.hxx>
      38             : #include <unotools/ucbstreamhelper.hxx>
      39             : #include <xmloff/xmlexp.hxx>
      40             : #include <xmloff/xmlimp.hxx>
      41             : #include "apitools.hxx"
      42             : #include "dsntypes.hxx"
      43             : #include <comphelper/stl_types.hxx>
      44             : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
      45             : 
      46             : #include <memory>
      47             : 
      48             : namespace dbaxml
      49             : {
      50             : using namespace ::xmloff::token;
      51             : using namespace ::com::sun::star::uno;
      52             : using namespace ::com::sun::star::container;
      53             : using namespace ::com::sun::star::lang;
      54             : using namespace ::com::sun::star::beans;
      55             : using namespace ::com::sun::star::document;
      56             : using namespace ::com::sun::star::sdbcx;
      57             : using namespace ::com::sun::star::text;
      58             : using namespace ::com::sun::star::io;
      59             : using namespace ::com::sun::star::xml::sax;
      60             : // -------------
      61             : // - ODBExport -
      62             : // -------------
      63             : #define PROGRESS_BAR_STEP 20
      64             : 
      65             : class ODBExport : public SvXMLExport
      66             : {
      67             :     typedef ::std::map< ::xmloff::token::XMLTokenEnum, ::rtl::OUString> TSettingsMap;
      68             : 
      69             :     typedef ::std::pair< ::rtl::OUString ,::rtl::OUString> TStringPair;
      70           0 :     struct TDelimiter
      71             :     {
      72             :         ::rtl::OUString sText;
      73             :         ::rtl::OUString sField;
      74             :         ::rtl::OUString sDecimal;
      75             :         ::rtl::OUString sThousand;
      76             :         bool            bUsed;
      77             : 
      78           0 :         TDelimiter() : bUsed( false ) { }
      79             :     };
      80             :     typedef ::std::map< Reference<XPropertySet> ,::rtl::OUString >          TPropertyStyleMap;
      81             :     typedef ::std::map< Reference<XPropertySet> ,Reference<XPropertySet> >  TTableColumnMap;
      82             : 
      83           0 :     struct TypedPropertyValue
      84             :     {
      85             :         ::rtl::OUString               Name;
      86             :         ::com::sun::star::uno::Type   Type;
      87             :         ::com::sun::star::uno::Any    Value;
      88             : 
      89           0 :         TypedPropertyValue( const ::rtl::OUString& _name, const ::com::sun::star::uno::Type& _type, const ::com::sun::star::uno::Any& _value )
      90             :             :Name( _name )
      91             :             ,Type( _type )
      92           0 :             ,Value( _value )
      93             :         {
      94           0 :         }
      95             :     };
      96             : 
      97             :     ::std::auto_ptr< TStringPair >                  m_aAutoIncrement;
      98             :     ::std::auto_ptr< TDelimiter >                   m_aDelimiter;
      99             :     ::std::vector< TypedPropertyValue >             m_aDataSourceSettings;
     100             :     ::std::vector< XMLPropertyState >               m_aCurrentPropertyStates;
     101             :     TPropertyStyleMap                               m_aAutoStyleNames;
     102             :     TPropertyStyleMap                               m_aCellAutoStyleNames;
     103             :     TPropertyStyleMap                               m_aRowAutoStyleNames;
     104             :     TTableColumnMap                                 m_aTableDummyColumns;
     105             :     ::rtl::OUString                                 m_sCharSet;
     106             :     UniReference < SvXMLExportPropertyMapper>       m_xExportHelper;
     107             :     UniReference < SvXMLExportPropertyMapper>       m_xColumnExportHelper;
     108             :     UniReference < SvXMLExportPropertyMapper>       m_xCellExportHelper;
     109             :     UniReference < SvXMLExportPropertyMapper>       m_xRowExportHelper;
     110             : 
     111             :     mutable UniReference < XMLPropertySetMapper >   m_xTableStylesPropertySetMapper;
     112             :     mutable UniReference < XMLPropertySetMapper >   m_xColumnStylesPropertySetMapper;
     113             :     mutable UniReference < XMLPropertySetMapper >   m_xCellStylesPropertySetMapper;
     114             :     mutable UniReference < XMLPropertySetMapper >   m_xRowStylesPropertySetMapper;
     115             : 
     116             :     Reference<XPropertySet>                         m_xDataSource;
     117             :     ::dbaccess::ODsnTypeCollection                  m_aTypeCollection;
     118             :     sal_Bool                                        m_bAllreadyFilled;
     119             : 
     120             :     void                    exportDataSource();
     121             :     void                    exportConnectionData();
     122             :     void                    exportDriverSettings(const TSettingsMap& _aSettings);
     123             :     void                    exportApplicationConnectionSettings(const TSettingsMap& _aSettings);
     124             :     void                    exportLogin();
     125             :     void                    exportSequence(const Sequence< ::rtl::OUString>& _aValue
     126             :                                         ,::xmloff::token::XMLTokenEnum _eTokenFilter
     127             :                                         ,::xmloff::token::XMLTokenEnum _eTokenType);
     128             :     void                    exportDelimiter();
     129             :     void                    exportAutoIncrement();
     130             :     void                    exportCharSet();
     131             :     template< typename T > void exportDataSourceSettingsSequence(
     132             :         ::std::vector< TypedPropertyValue >::iterator const & in);
     133             :     void                    exportDataSourceSettings();
     134             :     void                    exportForms();
     135             :     void                    exportReports();
     136             :     void                    exportQueries(sal_Bool _bExportContext);
     137             :     void                    exportTables(sal_Bool _bExportContext);
     138             :     void                    exportStyleName(XPropertySet* _xProp,SvXMLAttributeList& _rAtt);
     139             :     void                    exportStyleName(const ::xmloff::token::XMLTokenEnum _eToken,const Reference<XPropertySet>& _xProp,SvXMLAttributeList& _rAtt,TPropertyStyleMap& _rMap);
     140             :     void                    exportCollection(const Reference< XNameAccess >& _xCollection
     141             :                                             ,enum ::xmloff::token::XMLTokenEnum _eComponents
     142             :                                             ,enum ::xmloff::token::XMLTokenEnum _eSubComponents
     143             :                                             ,sal_Bool _bExportContext
     144             :                                             ,const ::comphelper::mem_fun1_t<ODBExport,XPropertySet* >& _aMemFunc
     145             :                                             );
     146             :     void                    exportComponent(XPropertySet* _xProp);
     147             :     void                    exportQuery(XPropertySet* _xProp);
     148             :     void                    exportTable(XPropertySet* _xProp);
     149             :     void                    exportFilter(XPropertySet* _xProp
     150             :                                         ,const ::rtl::OUString& _sProp
     151             :                                         ,enum ::xmloff::token::XMLTokenEnum _eStatementType);
     152             :     void                    exportTableName(XPropertySet* _xProp,sal_Bool _bUpdate);
     153             :     void                    exportAutoStyle(XPropertySet* _xProp);
     154             :     void                    exportColumns(const Reference<XColumnsSupplier>& _xColSup);
     155             :     void                    collectComponentStyles();
     156             : 
     157             :     ::rtl::OUString         implConvertAny(const Any& _rValue);
     158             : 
     159             :     UniReference < XMLPropertySetMapper > GetTableStylesPropertySetMapper() const;
     160             : 
     161             : private:
     162             :                             ODBExport();
     163             : protected:
     164             : 
     165             :     virtual void                    _ExportStyles( sal_Bool bUsed );
     166             :     virtual void                    _ExportAutoStyles();
     167             :     virtual void                    _ExportContent();
     168             :     virtual void                    _ExportMasterStyles();
     169             :     virtual void                    _ExportFontDecls();
     170             :     virtual sal_uInt32              exportDoc( enum ::xmloff::token::XMLTokenEnum eClass );
     171             :     virtual SvXMLAutoStylePoolP*    CreateAutoStylePool();
     172             : 
     173             :     virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
     174             :     virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
     175             : 
     176           0 :     virtual                 ~ODBExport(){};
     177             : public:
     178             : 
     179             :     ODBExport(const Reference< XMultiServiceFactory >& _rxMSF, sal_uInt16 nExportFlag = EXPORT_CONTENT | EXPORT_AUTOSTYLES | EXPORT_PRETTY | EXPORT_FONTDECLS | EXPORT_SCRIPTS );
     180             :     // XServiceInfo
     181             :     DECLARE_SERVICE_INFO_STATIC( );
     182             : 
     183             :     UniReference < XMLPropertySetMapper > GetColumnStylesPropertySetMapper() const;
     184             :     UniReference < XMLPropertySetMapper > GetCellStylesPropertySetMapper() const;
     185             : 
     186             :     // XExporter
     187             :     virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
     188             : 
     189           0 :     inline Reference<XPropertySet> getDataSource() const { return m_xDataSource; }
     190             : };
     191             : 
     192             : // -----------------------------------------------------------------------------
     193             : } // dbaxml
     194             : // -----------------------------------------------------------------------------
     195             : #endif // DBA_XMLEXPORT_HXX
     196             : 
     197             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10