LCOV - code coverage report
Current view: top level - libreoffice/sfx2/source/dialog - filedlgimpl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2 0.0 %
Date: 2012-12-27 Functions: 0 2 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 _SFX_FILEDLGIMPL_HXX
      20             : #define _SFX_FILEDLGIMPL_HXX
      21             : 
      22             : #include <vcl/timer.hxx>
      23             : #include <vcl/graph.hxx>
      24             : #include <cppuhelper/implbase2.hxx>
      25             : #include <com/sun/star/beans/StringPair.hpp>
      26             : #include <com/sun/star/container/XNameAccess.hpp>
      27             : #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
      28             : #include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
      29             : #include <com/sun/star/ui/dialogs/XDialogClosedListener.hpp>
      30             : #include <sfx2/fcontnr.hxx>
      31             : #include <sfx2/filedlghelper.hxx>
      32             : #include <comphelper/sequenceasvector.hxx>
      33             : 
      34             : class SfxFilterMatcher;
      35             : class GraphicFilter;
      36             : class FileDialogHelper;
      37             : 
      38             : namespace sfx2
      39             : {
      40             :     typedef ::com::sun::star::beans::StringPair FilterPair;
      41             : 
      42             :     class FileDialogHelper_Impl :
      43             :         public ::cppu::WeakImplHelper2<
      44             :             ::com::sun::star::ui::dialogs::XFilePickerListener,
      45             :             ::com::sun::star::ui::dialogs::XDialogClosedListener >
      46             :     {
      47             :         friend class FileDialogHelper;
      48             : 
      49             :         ::com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFilePicker > mxFileDlg;
      50             :         ::com::sun::star::uno::Reference < ::com::sun::star::container::XNameAccess >   mxFilterCFG;
      51             : 
      52             :         std::vector< FilterPair >   maFilters;
      53             : 
      54             :         SfxFilterMatcher*           mpMatcher;
      55             :         GraphicFilter*              mpGraphicFilter;
      56             :         FileDialogHelper*           mpAntiImpl;
      57             :         Window*                     mpPreferredParentWindow;
      58             : 
      59             :         ::comphelper::SequenceAsVector< ::rtl::OUString > mlLastURLs;
      60             : 
      61             :         ::rtl::OUString             maPath;
      62             :         ::rtl::OUString             maFileName;
      63             :         ::rtl::OUString             maCurFilter;
      64             :         ::rtl::OUString             maSelectFilter;
      65             :         ::rtl::OUString             maButtonLabel;
      66             : 
      67             :         Timer                       maPreViewTimer;
      68             :         Graphic                     maGraphic;
      69             : 
      70             :         const short                 m_nDialogType;
      71             : 
      72             :         SfxFilterFlags              m_nMustFlags;
      73             :         SfxFilterFlags              m_nDontFlags;
      74             : 
      75             :         sal_uIntPtr                     mnPostUserEventId;
      76             : 
      77             :         ErrCode                     mnError;
      78             : 
      79             :         FileDialogHelper::Context   meContext;
      80             : 
      81             :         sal_Bool                    mbHasPassword           : 1;
      82             :         sal_Bool                    mbIsPwdEnabled          : 1;
      83             :         sal_Bool                    m_bHaveFilterOptions    : 1;
      84             :         sal_Bool                    mbHasVersions           : 1;
      85             :         sal_Bool                    mbHasAutoExt            : 1;
      86             :         sal_Bool                    mbAddGraphicFilter      : 1;
      87             :         sal_Bool                    mbHasPreview            : 1;
      88             :         sal_Bool                    mbShowPreview           : 1;
      89             :         sal_Bool                    mbIsSaveDlg             : 1;
      90             :         sal_Bool                    mbExport                : 1;
      91             : 
      92             :         sal_Bool                    mbDeleteMatcher         : 1;
      93             :         sal_Bool                    mbInsert                : 1;
      94             :         sal_Bool                    mbSystemPicker          : 1;
      95             :         sal_Bool                    mbPwdCheckBoxState      : 1;
      96             :         sal_Bool                    mbSelection             : 1;
      97             :         sal_Bool                    mbSelectionEnabled      : 1;
      98             :         sal_Bool                    mbHasSelectionBox       : 1;
      99             :         sal_Bool                    mbSelectionFltrEnabled  : 1;
     100             : 
     101             :     private:
     102             :         void                    addFilters( const String& rFactory,
     103             :                                             SfxFilterFlags nMust,
     104             :                                             SfxFilterFlags nDont );
     105             :         void                    addFilter( const ::rtl::OUString& rFilterName,
     106             :                                            const ::rtl::OUString& rExtension );
     107             :         void                    addGraphicFilter();
     108             :         void                    enablePasswordBox( sal_Bool bInit );
     109             :         void                    updateFilterOptionsBox();
     110             :         void                    updateExportButton();
     111             :         void                    updateSelectionBox();
     112             :         void                    updateVersions();
     113             :         void                    updatePreviewState( sal_Bool _bUpdatePreviewWindow = sal_True );
     114             :         void                    dispose();
     115             : 
     116             :         void                    loadConfig();
     117             :         void                    saveConfig();
     118             : 
     119             :         const SfxFilter*        getCurentSfxFilter();
     120             :         sal_Bool                updateExtendedControl( sal_Int16 _nExtendedControlId, sal_Bool _bEnable );
     121             : 
     122             :         ErrCode                 getGraphic( const ::rtl::OUString& rURL, Graphic& rGraphic ) const;
     123             :         void                    setDefaultValues();
     124             : 
     125             :         void                    preExecute();
     126             :         void                    postExecute( sal_Int16 _nResult );
     127             :         sal_Int16               implDoExecute();
     128             :         void                    implStartExecute();
     129             : 
     130             :         void                    correctVirtualDialogType();
     131             : 
     132             :         void                    setControlHelpIds( const sal_Int16* _pControlId, const char** _pHelpId );
     133             : 
     134             :         sal_Bool                CheckFilterOptionsCapability( const SfxFilter* _pFilter );
     135             : 
     136             :         sal_Bool                isInOpenMode() const;
     137             :         String                  getCurrentFilterUIName() const;
     138             : 
     139             :         void                    LoadLastUsedFilter( const ::rtl::OUString& _rContextIdentifier );
     140             :         void                    SaveLastUsedFilter( const ::rtl::OUString& _rContextIdentifier );
     141             :         void                    SaveLastUsedFilter( void );
     142             : 
     143             :         void                    implInitializeFileName( );
     144             : 
     145             :         void                    verifyPath( );
     146             : 
     147             :         void                    implGetAndCacheFiles( const ::com::sun::star::uno::Reference< XInterface >& xPicker  ,
     148             :                                                       std::vector<rtl::OUString>&               rpURLList,
     149             :                                                       const SfxFilter*                    pFilter  );
     150             : 
     151             :         DECL_LINK(TimeOutHdl_Impl, void *);
     152             :         DECL_LINK( HandleEvent, FileDialogHelper* );
     153             :         DECL_LINK( InitControls, void* );
     154             : 
     155             :     public:
     156             :         // XFilePickerListener methods
     157             :         virtual void SAL_CALL               fileSelectionChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
     158             :         virtual void SAL_CALL               directoryChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
     159             :         virtual ::rtl::OUString SAL_CALL    helpRequested( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
     160             :         virtual void SAL_CALL               controlStateChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent ) throw( ::com::sun::star::uno::RuntimeException );
     161             :         virtual void SAL_CALL               dialogSizeChanged() throw( ::com::sun::star::uno::RuntimeException );
     162             : 
     163             :         // XDialogClosedListener methods
     164             :         virtual void SAL_CALL               dialogClosed( const ::com::sun::star::ui::dialogs::DialogClosedEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
     165             : 
     166             :         // XEventListener methods
     167             :         virtual void SAL_CALL       disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException );
     168             : 
     169             :         // handle XFilePickerListener events
     170             :         void                    handleFileSelectionChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent );
     171             :         void                    handleDirectoryChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent );
     172             :         ::rtl::OUString         handleHelpRequested( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent );
     173             :         void                    handleControlStateChanged( const ::com::sun::star::ui::dialogs::FilePickerEvent& aEvent );
     174             :         void                    handleDialogSizeChanged();
     175             : 
     176             :         // Own methods
     177             :                                 FileDialogHelper_Impl(
     178             :                                     FileDialogHelper* _pAntiImpl,
     179             :                                     const short nDialogType,
     180             :                                     sal_Int64 nFlags,
     181             :                                     sal_Int16 nDialog = SFX2_IMPL_DIALOG_CONFIG,
     182             :                                     Window* _pPreferredParentWindow = NULL,
     183             :                                     const String& sStandardDir = rtl::OUString(),
     184             :                                     const ::com::sun::star::uno::Sequence< ::rtl::OUString >&   rBlackList = ::com::sun::star::uno::Sequence< ::rtl::OUString >()
     185             :                                 );
     186             :         virtual                 ~FileDialogHelper_Impl();
     187             : 
     188             :         ErrCode                 execute( std::vector<rtl::OUString>& rpURLList,
     189             :                                          SfxItemSet *&   rpSet,
     190             :                                          String&         rFilter );
     191             :         ErrCode                 execute();
     192             : 
     193             :         void                    setFilter( const ::rtl::OUString& rFilter );
     194             : 
     195             :         /** sets the directory which should be browsed
     196             : 
     197             :             <p>If the given path does not point to a valid (existent and accessible) folder, the request
     198             :             is silently dropped</p>
     199             :         */
     200             :         void                    displayFolder( const ::rtl::OUString& rPath );
     201             :         void                    setFileName( const ::rtl::OUString& _rFile );
     202             : 
     203             :         ::rtl::OUString         getPath() const;
     204             :         ::rtl::OUString         getFilter() const;
     205             :         void                    getRealFilter( String& _rFilter ) const;
     206             : 
     207             :         ErrCode                 getGraphic( Graphic& rGraphic ) const;
     208             :         void                    createMatcher( const String& rFactory );
     209             : 
     210             :         sal_Bool                isShowFilterExtensionEnabled() const;
     211             :         void                    addFilterPair( const ::rtl::OUString& rFilter,
     212             :                                                const ::rtl::OUString& rFilterWithExtension );
     213             :         ::rtl::OUString         getFilterName( const ::rtl::OUString& rFilterWithExtension ) const;
     214             :         ::rtl::OUString         getFilterWithExtension( const ::rtl::OUString& rFilter ) const;
     215             : 
     216             :         void                    SetContext( FileDialogHelper::Context _eNewContext );
     217             : 
     218           0 :         inline sal_Bool         isSystemFilePicker() const { return mbSystemPicker; }
     219           0 :         inline sal_Bool         isPasswordEnabled() const { return mbIsPwdEnabled; }
     220             :     };
     221             : 
     222             : }   // end of namespace sfx2
     223             : 
     224             : #endif // _SFX_FILEDLGIMPL_HXX
     225             : 
     226             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10