LCOV - code coverage report
Current view: top level - fpicker/source/office - OfficeFilePicker.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 8 0.0 %
Date: 2014-04-14 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             : #ifndef INCLUDED_SVT_FILEPICKER_HXX
      20             : #define INCLUDED_SVT_FILEPICKER_HXX
      21             : 
      22             : #include <cppuhelper/implbase5.hxx>
      23             : #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
      24             : #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
      25             : #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
      26             : #include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
      27             : #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
      28             : #include <com/sun/star/lang/XServiceInfo.hpp>
      29             : #include <com/sun/star/lang/XEventListener.hpp>
      30             : #include <com/sun/star/uno/XComponentContext.hpp>
      31             : 
      32             : 
      33             : #include <tools/wintypes.hxx>
      34             : #include "commonpicker.hxx"
      35             : #include "pickercallbacks.hxx"
      36             : 
      37             : #include <list>
      38             : 
      39             : class Dialog;
      40             : 
      41             : struct FilterEntry;
      42             : struct ElementEntry_Impl;
      43             : 
      44             : typedef ::std::list< FilterEntry >                          FilterList;     // can be maintained more effectively
      45             : typedef ::std::list < ElementEntry_Impl >                   ElementList;
      46             : 
      47             : typedef ::com::sun::star::beans::StringPair                 UnoFilterEntry;
      48             : typedef ::com::sun::star::uno::Sequence< UnoFilterEntry >   UnoFilterList;  // can be transported more effectively
      49             : typedef ::com::sun::star::uno::Sequence< OUString >  OUStringList;   // can be transported more effectively
      50             : 
      51             : // class SvtFilePicker ---------------------------------------------------
      52             : 
      53             : typedef ::cppu::ImplHelper5 <   ::com::sun::star::ui::dialogs::XFilePicker3
      54             :                             ,   ::com::sun::star::ui::dialogs::XFilePickerControlAccess
      55             :                             ,   ::com::sun::star::ui::dialogs::XFilePreview
      56             :                             ,   ::com::sun::star::lang::XServiceInfo
      57             :                             ,   ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog
      58             :                             >   SvtFilePicker_Base;
      59             : 
      60             : class SvtFilePicker :public SvtFilePicker_Base
      61             :                     ,public ::svt::OCommonPicker
      62             :                     ,public ::svt::IFilePickerListener
      63             : {
      64             : private:
      65             :     FilterList*         m_pFilterList;
      66             :     ElementList*        m_pElemList;
      67             : 
      68             :     sal_Bool            m_bMultiSelection;
      69             :     sal_Int16           m_nServiceType;
      70             :     OUString     m_aDefaultName;
      71             :     OUString     m_aCurrentFilter;
      72             : 
      73             :     // #97148# --------------
      74             :     OUString     m_aOldDisplayDirectory;
      75             :     OUString     m_aOldHideDirectory;
      76             : 
      77             :     OUString     m_aStandardDir;
      78             :     OUStringList        m_aBlackList;
      79             : 
      80             :     ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >
      81             :                         m_xListener;
      82             :     ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XDialogClosedListener >
      83             :                         m_xDlgClosedListener;
      84             : 
      85             : public:
      86             :                        SvtFilePicker( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
      87             :     virtual           ~SvtFilePicker();
      88             : 
      89             : 
      90             :     // disambiguate XInterface
      91             : 
      92             :     DECLARE_XINTERFACE( )
      93             : 
      94             : 
      95             :     // disambiguate XTypeProvider
      96             : 
      97             :     DECLARE_XTYPEPROVIDER( )
      98             : 
      99             : 
     100             :     // XExecutableDialog functions
     101             : 
     102             :     virtual void SAL_CALL setTitle( const OUString& _rTitle ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     103             :     virtual sal_Int16 SAL_CALL execute(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     104             : 
     105             : 
     106             :     // XAsynchronousExecutableDialog functions
     107             : 
     108             :     virtual void SAL_CALL setDialogTitle( const OUString& _rTitle ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     109             :     virtual void SAL_CALL startExecuteModal( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XDialogClosedListener >& xListener )
     110             :         throw (::com::sun::star::uno::RuntimeException,
     111             :                std::exception) SAL_OVERRIDE;
     112             : 
     113             : 
     114             :     // XFilePicker functions
     115             : 
     116             : 
     117             :     virtual void SAL_CALL           setMultiSelectionMode( sal_Bool bMode ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     118             :     virtual void SAL_CALL           setDefaultName( const OUString& aName ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     119             :     virtual void SAL_CALL           setDisplayDirectory( const OUString& aDirectory ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     120             :     virtual OUString SAL_CALL    getDisplayDirectory() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     121             :     virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getFiles() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     122             : 
     123             : 
     124             :     // XFilePickerControlAccess functions
     125             : 
     126             : 
     127             :     virtual void SAL_CALL           setValue( sal_Int16 ElementID, sal_Int16 ControlAction, const com::sun::star::uno::Any& value ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     128             :     virtual com::sun::star::uno::Any SAL_CALL           getValue( sal_Int16 ElementID, sal_Int16 ControlAction ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     129             :     virtual void SAL_CALL           setLabel( sal_Int16 ElementID, const OUString& aValue ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     130             :     virtual OUString SAL_CALL    getLabel( sal_Int16 ElementID ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     131             :     virtual void SAL_CALL           enableControl( sal_Int16 ElementID, sal_Bool bEnable ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     132             : 
     133             : 
     134             :     // XFilePickerNotifier functions
     135             : 
     136             : 
     137             :     virtual void SAL_CALL           addFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     138             :     virtual void SAL_CALL           removeFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     139             : 
     140             : 
     141             :     // XFilePreview functions
     142             : 
     143             : 
     144             :     virtual com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats() throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     145             :     virtual sal_Int32 SAL_CALL      getTargetColorDepth() throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     146             :     virtual sal_Int32 SAL_CALL      getAvailableWidth() throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     147             :     virtual sal_Int32 SAL_CALL      getAvailableHeight() throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     148             :     virtual void SAL_CALL           setImage( sal_Int16 aImageFormat, const com::sun::star::uno::Any& aImage ) throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     149             :     virtual sal_Bool SAL_CALL       setShowState( sal_Bool bShowState ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     150             :     virtual sal_Bool SAL_CALL       getShowState() throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     151             : 
     152             : 
     153             :     // XFilterManager functions
     154             : 
     155             : 
     156             :     virtual void SAL_CALL           appendFilter( const OUString& aTitle, const OUString& aFilter ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     157             :     virtual void SAL_CALL           setCurrentFilter( const OUString& aTitle ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     158             :     virtual OUString SAL_CALL    getCurrentFilter() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     159             : 
     160             : 
     161             :     // XFilterGroupManager functions
     162             : 
     163             :     virtual void SAL_CALL           appendFilterGroup( const OUString& sGroupTitle, const com::sun::star::uno::Sequence< com::sun::star::beans::StringPair >& aFilters ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     164             : 
     165             : 
     166             : 
     167             :     // these methods are here because they're ambiguous
     168             : 
     169           0 :     virtual void SAL_CALL           cancel() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
     170           0 :      { ::svt::OCommonPicker::cancel(); }
     171           0 :     virtual void SAL_CALL           dispose() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
     172           0 :      { ::svt::OCommonPicker::dispose(); }
     173           0 :     virtual void SAL_CALL           addEventListener(const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>& l) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
     174           0 :      { ::svt::OCommonPicker::addEventListener(l); }
     175           0 :     virtual void SAL_CALL           removeEventListener(const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>& l) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE
     176           0 :      { ::svt::OCommonPicker::removeEventListener(l); }
     177             : 
     178             : 
     179             :     // XInitialization functions
     180             : 
     181             : 
     182             :     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;
     183             : 
     184             : 
     185             :     // XServiceInfo functions
     186             : 
     187             : 
     188             :     /* XServiceInfo */
     189             :     virtual OUString SAL_CALL    getImplementationName() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     190             :     virtual sal_Bool SAL_CALL       supportsService( const OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     191             :     virtual com::sun::star::uno::Sequence< OUString > SAL_CALL
     192             :                                     getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     193             : 
     194             :     /* Helper for XServiceInfo */
     195             :     static com::sun::star::uno::Sequence< OUString >
     196             :                                     impl_getStaticSupportedServiceNames();
     197             :     static OUString          impl_getStaticImplementationName();
     198             : 
     199             :     /* Helper for registry */
     200             :     static ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL impl_createInstance (
     201             :         const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext )
     202             :         throw( com::sun::star::uno::Exception );
     203             : 
     204             : protected:
     205             : 
     206             :     // OCommonPicker overridables
     207             : 
     208             :     virtual SvtFileDialog*  implCreateDialog( Window* _pParent ) SAL_OVERRIDE;
     209             :     virtual sal_Int16       implExecutePicker( ) SAL_OVERRIDE;
     210             :     virtual sal_Bool        implHandleInitializationArgument(
     211             :                                 const OUString& _rName,
     212             :                                 const ::com::sun::star::uno::Any& _rValue
     213             :                             )
     214             :                             SAL_THROW( ( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException ) ) SAL_OVERRIDE;
     215             : 
     216             : private:
     217             :     WinBits             getWinBits( WinBits& rExtraBits );
     218             :     virtual void        notify( sal_Int16 _nEventId, sal_Int16 _nControlId ) SAL_OVERRIDE;
     219             : 
     220             :     sal_Bool            FilterNameExists( const OUString& rTitle );
     221             :     sal_Bool            FilterNameExists( const UnoFilterList& _rGroupedFilters );
     222             : 
     223             :     void                ensureFilterList( const OUString& _rInitialCurrentFilter );
     224             : 
     225             :     void                prepareExecute( );
     226             : 
     227             :     DECL_LINK(          DialogClosedHdl, Dialog* );
     228             : };
     229             : 
     230             : #endif // INCLUDED_SVT_FILEPICKER_HXX
     231             : 
     232             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10