LCOV - code coverage report
Current view: top level - extensions/source/propctrlr - sqlcommanddesign.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 5 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 4 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_EXTENSIONS_SOURCE_PROPCTRLR_SQLCOMMANDDESIGN_HXX
      21             : #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SQLCOMMANDDESIGN_HXX
      22             : 
      23             : #include <com/sun/star/lang/XMultiComponentFactory.hpp>
      24             : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      25             : #include <com/sun/star/frame/XController.hpp>
      26             : #include <com/sun/star/beans/XPropertySet.hpp>
      27             : #include <com/sun/star/uno/XComponentContext.hpp>
      28             : #include <com/sun/star/inspection/XObjectInspectorUI.hpp>
      29             : 
      30             : #include <connectivity/dbtools.hxx>
      31             : #include <tools/link.hxx>
      32             : #include <cppuhelper/implbase1.hxx>
      33             : #include <rtl/ref.hxx>
      34             : #include <salhelper/simplereferenceobject.hxx>
      35             : 
      36             : 
      37             : namespace pcr
      38             : {
      39             : 
      40             : 
      41             :     class ISQLCommandAdapter;
      42             : 
      43             :     //= SQLCommandDesigner
      44             : 
      45             :     typedef ::cppu::WeakImplHelper1 <   ::com::sun::star::beans::XPropertyChangeListener
      46             :                                     >   SQLCommandDesigner_Base;
      47             :     /** encapsulates the code for calling and managing a query design frame, used
      48             :         for interactively designing the Command property of a ->RowSet
      49             :     */
      50             :     class SQLCommandDesigner : public SQLCommandDesigner_Base
      51             :     {
      52             :     private:
      53             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >        m_xContext;
      54             :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory >  m_xORB;
      55             :         ::dbtools::SharedConnection                                                         m_xConnection;
      56             :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >            m_xDesigner;
      57             :         ::rtl::Reference< ISQLCommandAdapter >                                              m_xObjectAdapter;
      58             :         Link<>                                                                              m_aCloseLink;
      59             : 
      60             :     public:
      61             :         /** creates the instance, and immediately opens the SQL command design frame
      62             : 
      63             :         @param  _rxContext
      64             :             our component context. Must not be <NULL/>, and must provide a non-<NULL/> XMultiComponentFactory
      65             :         @param  _rxPropertyAdapter
      66             :             an adapter to the object's SQL command related properties
      67             :         @param  _rConnection
      68             :             the current connection of ->_rxRowSet. Must not be <NULL/>.
      69             :         @param _rCloseLink
      70             :             link to call when the component has been closed
      71             :         @throws ::com::sun::star::lang::NullPointerException
      72             :             if any of the arguments (except ->_rCloseLink) is <NULL/>, or if the component context
      73             :             does not provide a valid component factory.
      74             :         */
      75             :         SQLCommandDesigner(
      76             :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
      77             :             const ::rtl::Reference< ISQLCommandAdapter >& _rxPropertyAdapter,
      78             :             const ::dbtools::SharedConnection& _rConnection,
      79             :             const Link<>& _rCloseLink
      80             :         );
      81             : 
      82             :         /** determines whether the SQL Command designer is currently active, i.e.
      83             :             if there currently exists a frame which allows the user entering the SQL command
      84             :         */
      85           0 :         inline bool isActive() const { return m_xDesigner.is(); }
      86             : 
      87             :         /** returns the property adapter used by the instance
      88             :         */
      89           0 :         inline const ::rtl::Reference< ISQLCommandAdapter >& getPropertyAdapter() const { return m_xObjectAdapter; }
      90             : 
      91             :         /** raises the designer window to top
      92             :             @precond
      93             :                 the designer is active (->isActive)
      94             :             @precond
      95             :                 the instance is not disposed
      96             :         */
      97             :         void    raise() const;
      98             : 
      99             :         /** suspends the designer
     100             :             @precond
     101             :                 the designer is active (->isActive)
     102             :             @precond
     103             :                 the instance is not disposed
     104             :         */
     105             :         bool    suspend() const;
     106             : 
     107             :         /** disposes the instance so that it becomes non-functional
     108             :         */
     109             :         void    dispose();
     110             : 
     111             :     protected:
     112             :         // XPropertyChangeListener
     113             :         virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     114             : 
     115             :         // XEventListener
     116             :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     117             : 
     118             :     protected:
     119             :         virtual ~SQLCommandDesigner();
     120             : 
     121             :         /** opens a new frame for interactively designing an SQL command
     122             :             @precond
     123             :                 the designer is not currently active (see ->isActive)
     124             :             @precond
     125             :                 ->m_xConnection is not <NULL/>
     126             :         */
     127             :         void impl_doOpenDesignerFrame_nothrow();
     128             : 
     129             :         /** impl-version of ->raise
     130             :         */
     131             :         void impl_raise_nothrow() const;
     132             : 
     133             :         /** determines whether we are already disposed
     134             :         */
     135           0 :         bool impl_isDisposed() const
     136             :         {
     137           0 :             return !m_xContext.is();
     138             :         }
     139             :         /** checks whether we are already disposed
     140             :             @throws ::com::sun::star::lang::DisposedException
     141             :                 if we in fact are disposed
     142             :         */
     143             :         void impl_checkDisposed_throw() const;
     144             : 
     145             :         /** create an empty top-level frame, which does not belong to the desktop's frame list
     146             :             @precond
     147             :                 ->m_xORB is not <NULL/>
     148             :         */
     149             :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
     150             :             impl_createEmptyParentlessTask_nothrow() const;
     151             : 
     152             :         /** called whenever the component denoted by m_xDesigner has been closed
     153             :             <em>by an external instance</em>
     154             :         */
     155             :         void impl_designerClosed_nothrow();
     156             : 
     157             :         /** closes the component denoted by m_xDesigner
     158             :             @precond
     159             :                 our designer component is actually active (->isActive)
     160             :             @precond
     161             :                 we're not disposed already
     162             :         */
     163             :         void impl_closeDesigner_nothrow();
     164             : 
     165             :         /** suspends our designer component
     166             :             @precond
     167             :                 the designer component is actually active (->isActive)
     168             :             @return
     169             :                 <TRUE/> if the suspension was successful, <FALSE/> if it was vetoed
     170             :         */
     171             :         bool impl_trySuspendDesigner_nothrow() const;
     172             : 
     173             :         /** gets the current value of the command property
     174             :         */
     175             :         OUString
     176             :                 impl_getCommandPropertyValue_nothrow();
     177             : 
     178             :         /** sets anew value for the command property
     179             :         */
     180             :         void    impl_setCommandPropertyValue_nothrow( const OUString& _rCommand ) const;
     181             : 
     182             :     private:
     183             :         SQLCommandDesigner( const SQLCommandDesigner& ) SAL_DELETED_FUNCTION;
     184             :         SQLCommandDesigner& operator=( const SQLCommandDesigner& ) SAL_DELETED_FUNCTION;
     185             :     };
     186             : 
     187             : 
     188             :     //= ISQLCommandAdapter
     189             : 
     190             :     /** an adapter to forward changed SQL command property values to a component
     191             :     */
     192           0 :     class ISQLCommandAdapter : public salhelper::SimpleReferenceObject
     193             :     {
     194             :     public:
     195             :         /// retrieves the current SQL command of the component
     196             :         virtual OUString getSQLCommand() const = 0;
     197             :         /// retrieves the current value of the EscapeProcessing property of the component
     198             :         virtual bool     getEscapeProcessing() const = 0;
     199             : 
     200             :         /// sets a new SQL command
     201             :         virtual void     setSQLCommand( const OUString& _rCommand ) const = 0;
     202             :         /// sets a new EscapeProcessing property value
     203             :         virtual void     setEscapeProcessing( const bool _bEscapeProcessing ) const = 0;
     204             : 
     205             :         virtual ~ISQLCommandAdapter();
     206             :     };
     207             : 
     208             : 
     209             : } // namespace pcr
     210             : 
     211             : 
     212             : #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_SQLCOMMANDDESIGN_HXX
     213             : 
     214             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11