LCOV - code coverage report
Current view: top level - fpicker/source/office - commonpicker.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 3 33.3 %
Date: 2015-06-13 12:38:46 Functions: 1 3 33.3 %
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_FPICKER_SOURCE_OFFICE_COMMONPICKER_HXX
      21             : #define INCLUDED_FPICKER_SOURCE_OFFICE_COMMONPICKER_HXX
      22             : 
      23             : #include <cppuhelper/compbase5.hxx>
      24             : #include <com/sun/star/ui/dialogs/XControlInformation.hpp>
      25             : #include <com/sun/star/ui/dialogs/XControlAccess.hpp>
      26             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      27             : #include <com/sun/star/lang/DisposedException.hpp>
      28             : #include <com/sun/star/awt/XWindow.hpp>
      29             : #include <com/sun/star/util/XCancellable.hpp>
      30             : #include <com/sun/star/lang/XInitialization.hpp>
      31             : #include <comphelper/broadcasthelper.hxx>
      32             : #include <comphelper/propertycontainer.hxx>
      33             : #include <comphelper/proparrhlp.hxx>
      34             : #include <comphelper/uno3.hxx>
      35             : #include <tools/link.hxx>
      36             : #include <vcl/vclptr.hxx>
      37             : 
      38             : class SvtFileDialog;
      39             : namespace vcl { class Window; }
      40             : struct ImplSVEvent;
      41             : 
      42             : namespace svt
      43             : {
      44             : 
      45             : 
      46             :     typedef ::cppu::WeakComponentImplHelper5    <   ::com::sun::star::ui::dialogs::XControlAccess
      47             :                                                 ,   ::com::sun::star::ui::dialogs::XControlInformation
      48             :                                                 ,   ::com::sun::star::lang::XEventListener
      49             :                                                 ,   ::com::sun::star::util::XCancellable
      50             :                                                 ,   ::com::sun::star::lang::XInitialization
      51             :                                                 >   OCommonPicker_Base;
      52             :     /** implements common functionality for the 2 UNO picker components
      53             :     */
      54             :     class OCommonPicker
      55             :                     :public ::comphelper::OBaseMutex
      56             :                     ,public OCommonPicker_Base
      57             :                     ,public ::comphelper::OPropertyContainer
      58             :                     ,public ::comphelper::OPropertyArrayUsageHelper< OCommonPicker >
      59             :     {
      60             :     private:
      61             :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >    m_xORB;
      62             : 
      63             :         // <properties>
      64             :         OUString                                                     m_sHelpURL;
      65             :         ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >  m_xWindow;
      66             :         // </properties>
      67             : 
      68             :         VclPtr<SvtFileDialog>      m_pDlg;
      69             :         ImplSVEvent *       m_nCancelEvent;
      70             :         bool            m_bExecuting;
      71             : 
      72             :         ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >  m_xDialogParent;
      73             : 
      74             :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >  m_xWindowListenerAdapter;
      75             :         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >  m_xParentListenerAdapter;
      76             : 
      77             :     protected:
      78             :         OUString     m_aTitle;
      79             :         OUString     m_aDisplayDirectory;
      80             : 
      81             :     protected:
      82           0 :         inline  SvtFileDialog*  getDialog() { return m_pDlg; }
      83             : 
      84           0 :         inline const    ::cppu::OBroadcastHelper&   GetBroadcastHelper() const  { return OCommonPicker_Base::rBHelper; }
      85           2 :         inline          ::cppu::OBroadcastHelper&   GetBroadcastHelper()        { return OCommonPicker_Base::rBHelper; }
      86             : 
      87             :     public:
      88             :         OCommonPicker( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory );
      89             : 
      90             :     protected:
      91             :         virtual ~OCommonPicker();
      92             : 
      93             :         // overridables
      94             : 
      95             :         // will be called with locked SolarMutex
      96             :         virtual VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) = 0;
      97             :         virtual sal_Int16       implExecutePicker( ) = 0;
      98             :             // do NOT override XExecutableDialog::execute! We need to do some stuff there ourself ...
      99             : 
     100             :     protected:
     101             : 
     102             :         // disambiguate XInterface
     103             : 
     104             :         DECLARE_XINTERFACE( )
     105             : 
     106             : 
     107             :         // disambiguate XTypeProvider
     108             : 
     109             :         DECLARE_XTYPEPROVIDER( )
     110             : 
     111             : 
     112             :         // ComponentHelper/XComponent
     113             : 
     114             :         virtual void SAL_CALL disposing() SAL_OVERRIDE;
     115             : 
     116             : 
     117             :         // XEventListner
     118             : 
     119             :         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     120             : 
     121             : 
     122             :         // property set related methods
     123             : 
     124             : 
     125             :         // XPropertySet pure methods
     126             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     127             :         // OPropertySetHelper pure methods
     128             :         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
     129             :         // OPropertyArrayUsageHelper pure methods
     130             :         virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
     131             : 
     132             :         // OPropertySetHelper overridden methods
     133             :         virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
     134             :                 sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
     135             : 
     136             : 
     137             :         // XExecutableDialog functions
     138             : 
     139             :         virtual void SAL_CALL           setTitle( const OUString& _rTitle ) throw( ::com::sun::star::uno::RuntimeException, std::exception );
     140             :         virtual sal_Int16 SAL_CALL      execute() throw( ::com::sun::star::uno::RuntimeException, std::exception );
     141             : 
     142             : 
     143             :         // XControlAccess functions
     144             : 
     145             :         virtual void SAL_CALL setControlProperty( const OUString& aControlName, const OUString& aControlProperty, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     146             :         virtual ::com::sun::star::uno::Any SAL_CALL getControlProperty( const OUString& aControlName, const OUString& aControlProperty ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     147             : 
     148             : 
     149             :         // XControlInformation functions
     150             : 
     151             :         virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedControls(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     152             :         virtual sal_Bool SAL_CALL isControlSupported( const OUString& aControlName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     153             :         virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedControlProperties( const OUString& aControlName ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     154             :         virtual sal_Bool SAL_CALL isControlPropertySupported( const OUString& aControlName, const OUString& aControlProperty ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     155             : 
     156             : 
     157             :         // XCancellable functions
     158             : 
     159             :         virtual void SAL_CALL cancel(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     160             : 
     161             : 
     162             :         // XInitialization functions
     163             : 
     164             : 
     165             :         virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw ( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     166             : 
     167             : 
     168             :         // misc
     169             : 
     170             :         void checkAlive() const;
     171             : 
     172             :         void prepareDialog();
     173             : 
     174             :     protected:
     175             :                 bool    createPicker();
     176             : 
     177             :         /** handle a single argument from the XInitialization::initialize method
     178             : 
     179             :             @return <TRUE/> if the argument could be handled
     180             :         */
     181             :         virtual bool    implHandleInitializationArgument(
     182             :                                 const OUString& _rName,
     183             :                                 const ::com::sun::star::uno::Any& _rValue
     184             :                             );
     185             : 
     186             :     private:
     187             :         void        stopWindowListening();
     188             : 
     189             :         DECL_LINK( OnCancelPicker, void* );
     190             :     };
     191             : 
     192             : }   // namespace svt
     193             : 
     194             : 
     195             : #endif // INCLUDED_FPICKER_SOURCE_OFFICE_COMMONPICKER_HXX
     196             : 
     197             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11