LCOV - code coverage report
Current view: top level - dbaccess/source/ui/inc - databaseobjectview.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 9 0.0 %
Date: 2012-08-25 Functions: 0 12 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 10 0.0 %

           Branch data     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 DBACCESS_DATABASE_OBJECT_VIEW_HXX
      21                 :            : #define DBACCESS_DATABASE_OBJECT_VIEW_HXX
      22                 :            : 
      23                 :            : #include <rtl/ustring.hxx>
      24                 :            : #include <com/sun/star/sdbc/XConnection.hpp>
      25                 :            : #include <com/sun/star/sdbc/XDataSource.hpp>
      26                 :            : #include <com/sun/star/frame/XDispatch.hpp>
      27                 :            : #include <com/sun/star/lang/XComponent.hpp>
      28                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      29                 :            : #include <com/sun/star/frame/XComponentLoader.hpp>
      30                 :            : #include <com/sun/star/frame/XFrame.hpp>
      31                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      32                 :            : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
      33                 :            : #include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
      34                 :            : #include <com/sun/star/uno/Sequence.hxx>
      35                 :            : #include <comphelper/namedvaluecollection.hxx>
      36                 :            : 
      37                 :            : #include <boost/shared_ptr.hpp>
      38                 :            : 
      39                 :            : 
      40                 :            : // .........................................................................
      41                 :            : namespace dbaui
      42                 :            : {
      43                 :            : // .........................................................................
      44                 :            :     /** encapsulates access to the view of a database object.
      45                 :            : 
      46                 :            :         @todo
      47                 :            :             this is to be merged with the OLinkedDocumentAccess class
      48                 :            :     */
      49                 :            :     class DatabaseObjectView
      50                 :            :     {
      51                 :            :     private:
      52                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
      53                 :            :                         m_xORB;
      54                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
      55                 :            :                         m_xParentFrame;
      56                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XComponentLoader >
      57                 :            :                         m_xFrameLoader;
      58                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >
      59                 :            :                         m_xApplication;
      60                 :            :         ::rtl::OUString m_sComponentURL;
      61                 :            : 
      62                 :            : 
      63                 :            :     private:
      64                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
      65                 :            :                 doDispatch(
      66                 :            :                     const ::comphelper::NamedValueCollection& i_rDispatchArgs
      67                 :            :                 );
      68                 :            : 
      69                 :            :     protected:
      70                 :            :         /** creates the desired view
      71                 :            : 
      72                 :            :             The default implementation will call <member>fillDispatchArgs</member>, followed
      73                 :            :             by <member>doDispatch</member>.
      74                 :            : 
      75                 :            :             @param _rDataSource
      76                 :            :                 the data source, as passed to the <member>createNew</member> or <member>openExisting</member> method.
      77                 :            :             @param _rObjectName
      78                 :            :                 the name of the object for which the view is to be opened,
      79                 :            :                 or an empty string if a view for a new object should be created.
      80                 :            :             @param _rCreationArgs
      81                 :            :                 the arguments for the view's creation
      82                 :            :         */
      83                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > doCreateView(
      84                 :            :             const ::com::sun::star::uno::Any& _rDataSource,
      85                 :            :             const ::rtl::OUString& _rObjectName,
      86                 :            :             const ::comphelper::NamedValueCollection& i_rCreationArgs
      87                 :            :         );
      88                 :            : 
      89                 :            :         virtual void fillDispatchArgs(
      90                 :            :                           ::comphelper::NamedValueCollection& i_rDispatchArgs,
      91                 :            :                     const ::com::sun::star::uno::Any& _rDataSource,
      92                 :            :                     const ::rtl::OUString& _rObjectName
      93                 :            :                 );
      94                 :            : 
      95                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >&
      96                 :          0 :                 getApplicationUI() const { return m_xApplication; }
      97                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
      98                 :            :                 getConnection() const;
      99                 :            : 
     100                 :            :     public:
     101                 :            :         DatabaseObjectView(
     102                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
     103                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication,
     104                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame,
     105                 :            :             const ::rtl::OUString& _rComponentURL
     106                 :            :         );
     107         [ #  # ]:          0 :         virtual ~DatabaseObjectView(){}
     108                 :            : 
     109                 :            :         /** sets the target frame into which the view should be loaded.
     110                 :            : 
     111                 :            :             By default, the view is loaded into a top-level frame not being part of the
     112                 :            :             Desktop.
     113                 :            :         */
     114                 :          0 :         void setTargetFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame )
     115                 :            :         {
     116                 :          0 :             m_xFrameLoader.set( _rxFrame, ::com::sun::star::uno::UNO_QUERY );
     117                 :          0 :         }
     118                 :            : 
     119                 :            :         /** opens a view for a to-be-created object
     120                 :            : 
     121                 :            :             @param _xDataSource
     122                 :            :                 the data source for which a new object is to be created
     123                 :            :             @return
     124                 :            :                 the controller of the newly created document
     125                 :            :         */
     126                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
     127                 :            :             createNew(
     128                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _xDataSource,
     129                 :            :                 const ::comphelper::NamedValueCollection& i_rDispatchArgs = ::comphelper::NamedValueCollection()
     130                 :            :             );
     131                 :            : 
     132                 :            :         /** opens a view for an existent object
     133                 :            : 
     134                 :            :             @param _xDataSource
     135                 :            :                 the data source for which a new object is to be created
     136                 :            :             @param _rObjectName
     137                 :            :                 the name of the object to be edited
     138                 :            :             @param  _rArgs
     139                 :            :                 Additional settings which should be forwarded to the frame
     140                 :            :             @return
     141                 :            :                 the frame into which the view has been loaded
     142                 :            :         */
     143                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
     144                 :            :             openExisting(
     145                 :            :                 const ::com::sun::star::uno::Any& _aDataSource,
     146                 :            :                 const ::rtl::OUString& _rName,
     147                 :            :                 const ::comphelper::NamedValueCollection& i_rDispatchArgs
     148                 :            :             );
     149                 :            :     };
     150                 :            : 
     151                 :            :     //======================================================================
     152                 :            :     //= QueryDesigner
     153                 :            :     //======================================================================
     154         [ #  # ]:          0 :     class QueryDesigner : public DatabaseObjectView
     155                 :            :     {
     156                 :            :     protected:
     157                 :            :         sal_Int32                           m_nCommandType;
     158                 :            : 
     159                 :            :     protected:
     160                 :            :         virtual void fillDispatchArgs(
     161                 :            :                   ::comphelper::NamedValueCollection& i_rDispatchArgs,
     162                 :            :             const ::com::sun::star::uno::Any& _aDataSource,
     163                 :            :             const ::rtl::OUString& _rObjectName
     164                 :            :         );
     165                 :            : 
     166                 :            :     public:
     167                 :            :         QueryDesigner(
     168                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
     169                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication,
     170                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame,
     171                 :            :             bool _bCreateView
     172                 :            :         );
     173                 :            :     };
     174                 :            : 
     175                 :            :     //======================================================================
     176                 :            :     //= TableDesigner
     177                 :            :     //======================================================================
     178         [ #  # ]:          0 :     class TableDesigner : public DatabaseObjectView
     179                 :            :     {
     180                 :            :     protected:
     181                 :            :         virtual void fillDispatchArgs(
     182                 :            :                   ::comphelper::NamedValueCollection& i_rDispatchArgs,
     183                 :            :             const ::com::sun::star::uno::Any& _aDataSource,
     184                 :            :             const ::rtl::OUString& _rObjectName
     185                 :            :         );
     186                 :            : 
     187                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > doCreateView(
     188                 :            :             const ::com::sun::star::uno::Any& _rDataSource,
     189                 :            :             const ::rtl::OUString& _rObjectName,
     190                 :            :             const ::comphelper::NamedValueCollection& i_rCreationArgs
     191                 :            :         );
     192                 :            : 
     193                 :            :     public:
     194                 :            :         TableDesigner(
     195                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
     196                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication,
     197                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame
     198                 :            :         );
     199                 :            : 
     200                 :            :     private:
     201                 :            :         /** retrieves the table designer component as provided by the connection, if any
     202                 :            :             @param  _rTableName
     203                 :            :                 the name of the table for which a designer is to be obtained
     204                 :            :             @return
     205                 :            :                 the designer component, as provided by the connection, or <NULL/>, if the connection
     206                 :            :                 does not provide a specialized designer.
     207                 :            :             @see com::sun::star::sdb::application::XTableUIProvider
     208                 :            :         */
     209                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
     210                 :            :                 impl_getConnectionProvidedDesigner_nothrow( const ::rtl::OUString& _rTableName );
     211                 :            :     };
     212                 :            : 
     213                 :            :     //======================================================================
     214                 :            :     //= ResultSetBrowser
     215                 :            :     //======================================================================
     216         [ #  # ]:          0 :     class ResultSetBrowser : public DatabaseObjectView
     217                 :            :     {
     218                 :            :     private:
     219                 :            :         sal_Bool    m_bTable;
     220                 :            : 
     221                 :            :     protected:
     222                 :            :         virtual void fillDispatchArgs(
     223                 :            :                   ::comphelper::NamedValueCollection& i_rDispatchArgs,
     224                 :            :             const ::com::sun::star::uno::Any& _aDataSource,
     225                 :            :             const ::rtl::OUString& _rQualifiedName
     226                 :            :         );
     227                 :            : 
     228                 :            :     public:
     229                 :            :         ResultSetBrowser(
     230                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
     231                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication,
     232                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame,
     233                 :            :             sal_Bool _bTable
     234                 :            :         );
     235                 :            : 
     236                 :            :     };
     237                 :            :     //======================================================================
     238                 :            :     //= RelationDesigner
     239                 :            :     //======================================================================
     240         [ #  # ]:          0 :     class RelationDesigner : public DatabaseObjectView
     241                 :            :     {
     242                 :            :     public:
     243                 :            :         RelationDesigner(
     244                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
     245                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication,
     246                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame
     247                 :            :         );
     248                 :            :     };
     249                 :            : // .........................................................................
     250                 :            : }   // namespace dbaui
     251                 :            : // .........................................................................
     252                 :            : 
     253                 :            : #endif // DBACCESS_DATABASE_OBJECT_VIEW_HXX
     254                 :            : 
     255                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10