LCOV - code coverage report
Current view: top level - dbaccess/source/ui/inc - TokenWriter.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 16 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 14 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             : #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TOKENWRITER_HXX
      20             : #define INCLUDED_DBACCESS_SOURCE_UI_INC_TOKENWRITER_HXX
      21             : 
      22             : #include "DExport.hxx"
      23             : #include "moduledbu.hxx"
      24             : #include "commontypes.hxx"
      25             : 
      26             : #include <com/sun/star/awt/FontDescriptor.hpp>
      27             : #include <com/sun/star/sdbc/XResultSet.hpp>
      28             : #include <com/sun/star/sdbc/XResultSetUpdate.hpp>
      29             : #include <com/sun/star/sdbc/XRow.hpp>
      30             : #include <com/sun/star/lang/XEventListener.hpp>
      31             : #include <com/sun/star/frame/XModel.hpp>
      32             : #include <com/sun/star/beans/PropertyValue.hpp>
      33             : #include <com/sun/star/sdb/CommandType.hpp>
      34             : #include <com/sun/star/sdbcx/XRowLocate.hpp>
      35             : #include <com/sun/star/uno/XComponentContext.hpp>
      36             : 
      37             : #include <cppuhelper/implbase1.hxx>
      38             : #include <tools/stream.hxx>
      39             : #include <svx/dataaccessdescriptor.hxx>
      40             : 
      41             : namespace com { namespace sun { namespace star {
      42             :     namespace sdbc{
      43             :         class XRowUpdate;
      44             :     }
      45             : }}}
      46             : 
      47             : namespace dbaui
      48             : {
      49             :     // ODatabaseImportExport base class for import/export
      50             :     class ODatabaseExport;
      51             :     typedef ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener> ODatabaseImportExport_BASE;
      52             :     class ODatabaseImportExport : public ODatabaseImportExport_BASE
      53             :     {
      54             :     private:
      55             :         void impl_initializeRowMember_throw();
      56             : 
      57             :     protected:
      58             :         ::com::sun::star::lang::Locale                                                  m_aLocale;
      59             :         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>                    m_aSelection;
      60             :         bool                                                                        m_bBookmarkSelection;
      61             :         SvStream*                                                                       m_pStream;
      62             :         ::com::sun::star::awt::FontDescriptor                                           m_aFont;
      63             :         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >       m_xObject;      // table/query
      64             :         SharedConnection                                                                m_xConnection;
      65             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >          m_xResultSet;
      66             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >                m_xRow;
      67             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XRowLocate >         m_xRowLocate;
      68             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >  m_xResultSetMetaData;
      69             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >   m_xRowSetColumns;
      70             :         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >    m_xFormatter;   // a number formatter working with the connection's NumberFormatsSupplier
      71             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >    m_xContext;
      72             : 
      73             :         OUString m_sName;
      74             : 
      75             :         //for transfor the tablename
      76             :         OUString m_sDefaultTableName;
      77             : 
      78             :         OUString m_sDataSourceName;
      79             :         sal_Int32       m_nCommandType;
      80             :         bool            m_bNeedToReInitialize;
      81             : 
      82             :         ODatabaseExport*    m_pReader;
      83             :         sal_Int32*          m_pRowMarker; // if set, then copy only these rows
      84             :         rtl_TextEncoding    m_eDestEnc;
      85             :         bool            m_bInInitialize;
      86             :         bool            m_bCheckOnly;
      87             : 
      88             :         // export data
      89             :         ODatabaseImportExport(  const svx::ODataAccessDescriptor& _aDataDescriptor,
      90             :                                 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rM,
      91             :                                 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF,
      92             :                                 const OUString& rExchange = OUString());
      93             : 
      94             :         // import data
      95             :         ODatabaseImportExport(  const SharedConnection& _rxConnection,
      96             :                                 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF,
      97             :                                 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rM);
      98             : 
      99             :         virtual ~ODatabaseImportExport();
     100             : 
     101             :         virtual void initialize();
     102             :     public:
     103           0 :         void setStream(SvStream* _pStream){  m_pStream = _pStream; }
     104             : 
     105             :         //for set the tablename
     106           0 :         void setSTableName(const OUString &_sTableName){ m_sDefaultTableName = _sTableName; }
     107             : 
     108             :         virtual bool Write(); // Export
     109             :         virtual bool Read(); // Import
     110             : 
     111             :         void initialize(const svx::ODataAccessDescriptor& _aDataDescriptor);
     112             :         void dispose();
     113             : 
     114           0 :         void enableCheckOnly() { m_bCheckOnly = true; }
     115           0 :         bool isCheckEnabled() const { return m_bCheckOnly; }
     116             : 
     117             :     private:
     118             :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             :         void impl_initFromDescriptor( const svx::ODataAccessDescriptor& _aDataDescriptor, bool _bPlusDefaultInit );
     120             :     };
     121             : 
     122             :     // RTF Import and Export
     123             : 
     124           0 :     class ORTFImportExport : public ODatabaseImportExport
     125             :     {
     126             :         void appendRow(OString* pHorzChar,sal_Int32 _nColumnCount,sal_Int32& k,sal_Int32& kk);
     127             :     public:
     128             :         // export data
     129           0 :         ORTFImportExport(   const svx::ODataAccessDescriptor& _aDataDescriptor,
     130             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rM,
     131             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF,
     132             :                             const OUString& rExchange = OUString())
     133           0 :                             : ODatabaseImportExport(_aDataDescriptor,_rM,_rxNumberF,rExchange) {};
     134             : 
     135             :         // import data
     136           0 :         ORTFImportExport(   const SharedConnection& _rxConnection,
     137             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF,
     138             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rM)
     139           0 :                         : ODatabaseImportExport(_rxConnection,_rxNumberF,_rM)
     140           0 :         {}
     141             : 
     142             :         virtual bool Write() SAL_OVERRIDE;
     143             :         virtual bool Read() SAL_OVERRIDE;
     144             :     };
     145             :     // HTML Import and Export
     146             :     #define SBA_HTML_FONTSIZES 7
     147             :     const sal_Int16 nIndentMax = 23;
     148           0 :     class OHTMLImportExport : public ODatabaseImportExport
     149             :     {
     150             :         // default HtmlFontSz[1-7]
     151             :         static const sal_Int16  nDefaultFontSize[SBA_HTML_FONTSIZES];
     152             :         // HtmlFontSz[1-7] in s*3.ini [user]
     153             :         static sal_Int16        nFontSize[SBA_HTML_FONTSIZES];
     154             :         static const sal_Int16  nCellSpacing;
     155             :         static const char sIndentSource[];
     156             :         char                    sIndent[nIndentMax+1];
     157             :         sal_Int16               m_nIndent;
     158             :     #if OSL_DEBUG_LEVEL > 0
     159             :         bool                    m_bCheckFont;
     160             :     #endif
     161             : 
     162             :         void WriteHeader();
     163             :         void WriteBody();
     164             :         void WriteTables();
     165             :         void WriteCell( sal_Int32 nFormat,sal_Int32 nWidthPixel,sal_Int32 nHeightPixel,const char* pChar,const OUString& rValue,const char* pHtmlTag);
     166             :         void IncIndent( sal_Int16 nVal );
     167           0 :         const char*         GetIndentStr() { return sIndent; }
     168             :         void FontOn();
     169             :         inline void FontOff();
     170             : 
     171             :     public:
     172             :         // export data
     173             :         OHTMLImportExport(  const svx::ODataAccessDescriptor& _aDataDescriptor,
     174             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rM,
     175             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF,
     176             :                             const OUString& rExchange = OUString());
     177             :         // import data
     178           0 :         OHTMLImportExport(  const SharedConnection& _rxConnection,
     179             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF,
     180             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rM)
     181             :             : ODatabaseImportExport(_rxConnection,_rxNumberF,_rM)
     182           0 :             , m_nIndent(0)
     183           0 :         {}
     184             : 
     185             :         virtual bool Write() SAL_OVERRIDE;
     186             :         virtual bool Read() SAL_OVERRIDE;
     187             : 
     188             :     };
     189             :     // normal RowSet Import and Export
     190             : 
     191           0 :     class ORowSetImportExport : public ODatabaseImportExport
     192             :     {
     193             :         OModuleClient       m_aModuleClient;
     194             :         ::std::vector<sal_Int32>    m_aColumnMapping;
     195             :         ::std::vector<sal_Int32>    m_aColumnTypes;
     196             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetUpdate >    m_xTargetResultSetUpdate;
     197             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowUpdate >          m_xTargetRowUpdate;
     198             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >  m_xTargetResultSetMetaData;
     199             :         VclPtr<vcl::Window>         m_pParent;
     200             :         bool                        m_bAlreadyAsked;
     201             : 
     202             :         bool insertNewRow();
     203             :     protected:
     204             :         virtual void initialize() SAL_OVERRIDE;
     205             : 
     206             :     public:
     207             :         // export data
     208             :         ORowSetImportExport(vcl::Window* _pParent,
     209             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetUpdate >& _xResultSetUpdate,
     210             :                             const svx::ODataAccessDescriptor& _aDataDescriptor,
     211             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rM,
     212             :                             const OUString& rExchange = OUString());
     213             : 
     214             :         // import data
     215             :         ORowSetImportExport(const SharedConnection& _rxConnection,
     216             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rM)
     217             :                         : ODatabaseImportExport(_rxConnection,NULL,_rM)
     218             :         {}
     219             : 
     220             :         virtual bool Write() SAL_OVERRIDE;
     221             :         virtual bool Read() SAL_OVERRIDE;
     222             : 
     223             :     private:
     224             :         using ODatabaseImportExport::initialize;
     225             :     };
     226             : 
     227             : }
     228             : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TOKENWRITER_HXX
     229             : 
     230             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11