LCOV - code coverage report
Current view: top level - fpicker/source/office - OfficeFilePicker.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 8 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             : #ifndef INCLUDED_FPICKER_SOURCE_OFFICE_OFFICEFILEPICKER_HXX
      20             : #define INCLUDED_FPICKER_SOURCE_OFFICE_OFFICEFILEPICKER_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             :     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 VclPtr<SvtFileDialog> implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE;
     209             :     virtual sal_Int16       implExecutePicker( ) SAL_OVERRIDE;
     210             :     virtual bool            implHandleInitializationArgument(
     211             :                                 const OUString& _rName,
     212             :                                 const ::com::sun::star::uno::Any& _rValue
     213             :                             ) SAL_OVERRIDE;
     214             : 
     215             : private:
     216             :     WinBits             getWinBits( WinBits& rExtraBits );
     217             :     virtual void        notify( sal_Int16 _nEventId, sal_Int16 _nControlId ) SAL_OVERRIDE;
     218             : 
     219             :     bool                FilterNameExists( const OUString& rTitle );
     220             :     bool                FilterNameExists( const UnoFilterList& _rGroupedFilters );
     221             : 
     222             :     void                ensureFilterList( const OUString& _rInitialCurrentFilter );
     223             : 
     224             :     void                prepareExecute( );
     225             : 
     226             :     DECL_LINK(          DialogClosedHdl, Dialog* );
     227             : };
     228             : 
     229             : #endif // INCLUDED_FPICKER_SOURCE_OFFICE_OFFICEFILEPICKER_HXX
     230             : 
     231             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11