LCOV - code coverage report
Current view: top level - fpicker/source/office - iodlgimp.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 30 0.0 %
Date: 2014-11-03 Functions: 0 18 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_IODLGIMP_HXX
      20             : #define INCLUDED_FPICKER_SOURCE_OFFICE_IODLGIMP_HXX
      21             : 
      22             : #include <PlacesListBox.hxx>
      23             : 
      24             : #include <vcl/fixed.hxx>
      25             : #include <vcl/lstbox.hxx>
      26             : #include <vcl/menubtn.hxx>
      27             : #include <vcl/timer.hxx>
      28             : #include <vcl/group.hxx>
      29             : 
      30             : #include <vector>
      31             : #include <boost/ptr_container/ptr_deque.hpp>
      32             : 
      33             : class CheckBox;
      34             : class SvtFileDialog;
      35             : 
      36             : #define FILEDIALOG_DEF_EXTSEP       ';'
      37             : #define FILEDIALOG_DEF_WILDCARD     '*'
      38             : 
      39             : 
      40             : // SvtFileDialogFilter_Impl
      41             : 
      42             : 
      43             : /*  [Description]
      44             : 
      45             :     Instances of this class represent a filter.
      46             : */
      47             : 
      48             : class SvtFileDialogFilter_Impl
      49             : {
      50             : private:
      51             :     OUString m_aName;    // name of the entry
      52             :     OUString m_aType;    // filter wildcard - if empty, the entry marks a group
      53             : 
      54             : public:
      55             :     SvtFileDialogFilter_Impl( const OUString& rName, const OUString& rType );
      56             :     ~SvtFileDialogFilter_Impl();
      57             : 
      58           0 :     const OUString&     GetName() const     { return m_aName; }
      59           0 :     const OUString&     GetType() const     { return m_aType; }
      60           0 :     const OUString      GetExtension() const    { return m_aType.getLength() > 2 ? m_aType.copy( 2 ) : OUString(); }
      61             : 
      62           0 :     bool            isGroupSeparator() const    { return m_aType.isEmpty(); }
      63             : };
      64             : 
      65             : typedef boost::ptr_deque<SvtFileDialogFilter_Impl> SvtFileDialogFilterList_Impl;
      66             : 
      67             : enum SvtFileDlgMode
      68             : {
      69             :     FILEDLG_MODE_OPEN = 0,
      70             :     FILEDLG_MODE_SAVE = 1
      71             : };
      72             : 
      73             : enum SvtFileDlgType
      74             : {
      75             :     FILEDLG_TYPE_FILEDLG = 0,
      76             :     FILEDLG_TYPE_PATHDLG
      77             : };
      78             : 
      79             : class SvtFileDialogURLSelector : public MenuButton
      80             : {
      81             : private:
      82             :     SvtFileDialog*      m_pDlg;
      83             :     PopupMenu*          m_pMenu;
      84             : 
      85             : protected:
      86           0 :     inline        SvtFileDialog*  GetDialogParent()       { return m_pDlg; }
      87             : 
      88             : protected:
      89             : 
      90             :     virtual void    FillURLMenu( PopupMenu* _pMenu ) = 0;
      91             : 
      92             : protected:
      93             :     SvtFileDialogURLSelector( vcl::Window* _pParent, SvtFileDialog* _pDlg, WinBits nBits, sal_uInt16 _nButtonId );
      94             :     virtual ~SvtFileDialogURLSelector();
      95             : 
      96             :     virtual void        Activate() SAL_OVERRIDE;
      97             : };
      98             : 
      99             : class SvtUpButton_Impl : public SvtFileDialogURLSelector
     100             : {
     101             : private:
     102             :     std::vector<OUString> _aURLs;
     103             : 
     104             : public:
     105             :     SvtUpButton_Impl( vcl::Window* pParent, SvtFileDialog* pDlg, WinBits nBits );
     106             :     virtual ~SvtUpButton_Impl();
     107             : 
     108             : protected:
     109             :     virtual void        FillURLMenu( PopupMenu* _pMenu ) SAL_OVERRIDE;
     110             :     virtual void        Select() SAL_OVERRIDE;
     111             :     virtual void        Click() SAL_OVERRIDE;
     112             :     virtual Size        GetOptimalSize() const SAL_OVERRIDE;
     113             : };
     114             : 
     115             : typedef sal_uInt8 SvtFileDlgState;
     116             : 
     117             : #define FILEDLG_STATE_NONE        ((SvtFileDlgState)0x00)
     118             : #define FILEDLG_STATE_REMOTE      ((SvtFileDlgState)0x01)
     119             : 
     120             : class SvtURLBox;
     121             : class SvtExpFileDlg_Impl
     122             : {
     123             : private:
     124             :     DECL_STATIC_LINK( SvtExpFileDlg_Impl, UnClickHdl, Button* );
     125             : 
     126             : private:
     127             :     const SvtFileDialogFilter_Impl* _pCurFilter;
     128             :     OUString                        m_sCurrentFilterDisplayName;    // may differ from _pCurFilter->GetName in case it is a cached entry
     129             : 
     130             :     ::com::sun::star::uno::Sequence< OUString > _aBlackList;
     131             : 
     132             : public:
     133             :     SvtFileDialogFilterList_Impl*   _pFilter;
     134             :     SvtFileDialogFilter_Impl*       _pUserFilter;
     135             : 
     136             :     FixedText*                      _pFtFileName;
     137             :     SvtURLBox*                      _pEdFileName;
     138             : 
     139             :     FixedText*                      _pFtFileVersion;
     140             :     ListBox*                        _pLbFileVersion;
     141             : 
     142             :     FixedText*                      _pFtTemplates;
     143             :     ListBox*                        _pLbTemplates;
     144             : 
     145             :     FixedText*                      _pFtImageTemplates;
     146             :     ListBox*                        _pLbImageTemplates;
     147             : 
     148             :     FixedText*                      _pFtFileType;
     149             :     ListBox*                        _pLbFilter;
     150             :     PushButton*                     _pBtnFileOpen;
     151             :     PushButton*                     _pBtnCancel;
     152             :     HelpButton*                     _pBtnHelp;
     153             :     SvtUpButton_Impl*               _pBtnUp;
     154             :     PushButton*                     _pBtnNewFolder;
     155             :     CheckBox*                       _pCbPassword;
     156             :     SvtURLBox*                      _pEdCurrentPath;
     157             :     CheckBox*                       _pCbAutoExtension;
     158             :     CheckBox*                       _pCbOptions;
     159             : 
     160             :     PlacesListBox*                  _pPlaces;
     161             :     PushButton*                     _pBtnConnectToServer;
     162             : 
     163             :     SvtFileDlgMode                  _eMode;
     164             :     SvtFileDlgType                  _eDlgType;
     165             :     SvtFileDlgState                 _nState;
     166             :     WinBits                         _nStyle;
     167             : 
     168             :     OUString                        _aStdDir;
     169             : 
     170             :     // delay filter when traveling the filterbox
     171             :     Timer                           _aFilterTimer;
     172             : 
     173             :     // shows OpenHdl_Imp() if the open was triggered by a double click
     174             :     bool                        _bDoubleClick;
     175             :     bool                        m_bNeedDelayedFilterExecute;
     176             : 
     177             :     // list of the 5 most recently used filters
     178             :     // Defaultfilter for <All> oder <All ...>
     179             :     const SvtFileDialogFilter_Impl* _pDefaultFilter;
     180             : 
     181             :     // MultiSelection?
     182             :     bool                        _bMultiSelection;
     183             : 
     184             :     // remember sizes
     185             :     OUString                        _aIniKey;
     186             : 
     187             :     bool                        _bFolderHasOpened;
     188             : 
     189             :                             SvtExpFileDlg_Impl( WinBits nBits );
     190             :                             ~SvtExpFileDlg_Impl();
     191             : 
     192             : 
     193           0 :     inline void             SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) { _aBlackList = rBlackList; }
     194           0 :     inline const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const { return _aBlackList; }
     195             :     void                    SetStandardDir( const OUString& _rDir );
     196           0 :     inline const OUString&  GetStandardDir() const          { return _aStdDir; }
     197           0 :     inline void             DisableFilterBoxAutoWidth()     { _pLbFilter->EnableDDAutoWidth( false ); }
     198             : 
     199             : 
     200             :     // access to the filter listbox only as Control* - we want to maintain the entries/userdata ourself
     201           0 :             Control*        GetFilterListControl()          { return _pLbFilter; }
     202             :             const Control*  GetFilterListControl() const    { return _pLbFilter; }
     203             :     inline  void            SetFilterListSelectHdl( const Link& _rHandler );
     204             : 
     205             :     // inits the listbox for the filters from the filter list (_pFilter)
     206             :             void            ClearFilterList( );
     207             :             void            InitFilterList( );
     208             :     inline  bool        HasFilterListEntry( const OUString& _rFilterName );
     209             :     inline  void            SelectFilterListEntry( const OUString& _rFilterName );
     210             :     inline  void            SetNoFilterListSelection( );
     211             :             void            InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc );
     212             :                                 // _pFilterDesc must already have been added to _pFilter
     213             :     inline  SvtFileDialogFilter_Impl*   GetSelectedFilterEntry( OUString& /* [out] */ _rDisplayName ) const;
     214             :     inline  bool        IsFilterListTravelSelect() const;
     215             : 
     216             : 
     217             :     // access to the current filter via methods only - need to care for consistency between _pCurFilter and m_sCurrentFilterDisplayName
     218             :     inline      const SvtFileDialogFilter_Impl*     GetCurFilter( ) const;
     219             :     inline      const OUString&                     GetCurFilterDisplayName() const;
     220             :                 void                                SetCurFilter( SvtFileDialogFilter_Impl* _pFilter, const OUString& _rDisplayName );
     221             :     inline      void                                SetCurFilter( SvtFileDialogFilter_Impl* _pFilter );
     222             : };
     223             : 
     224           0 : inline void SvtExpFileDlg_Impl::SetFilterListSelectHdl( const Link& _rHandler )
     225             : {
     226           0 :     _pLbFilter->SetSelectHdl( _rHandler );
     227           0 : }
     228             : 
     229           0 : inline bool SvtExpFileDlg_Impl::HasFilterListEntry( const OUString& _rFilterName )
     230             : {
     231           0 :     return ( LISTBOX_ENTRY_NOTFOUND != _pLbFilter->GetEntryPos( _rFilterName ) );
     232             : }
     233             : 
     234           0 : inline void SvtExpFileDlg_Impl::SelectFilterListEntry( const OUString& _rFilterName )
     235             : {
     236           0 :     _pLbFilter->SelectEntry( _rFilterName );
     237           0 : }
     238             : 
     239           0 : inline  void SvtExpFileDlg_Impl::SetNoFilterListSelection( )
     240             : {
     241           0 :     _pLbFilter->SetNoSelection( );
     242           0 : }
     243             : 
     244           0 : inline SvtFileDialogFilter_Impl* SvtExpFileDlg_Impl::GetSelectedFilterEntry( OUString& _rDisplayName ) const
     245             : {
     246           0 :     _rDisplayName = _pLbFilter->GetSelectEntry();
     247           0 :     return static_cast< SvtFileDialogFilter_Impl* >( _pLbFilter->GetEntryData ( _pLbFilter->GetSelectEntryPos() ) );
     248             : }
     249             : 
     250           0 : inline bool SvtExpFileDlg_Impl::IsFilterListTravelSelect() const
     251             : {
     252           0 :     return _pLbFilter->IsTravelSelect();
     253             : }
     254             : 
     255           0 : inline const SvtFileDialogFilter_Impl* SvtExpFileDlg_Impl::GetCurFilter( ) const
     256             : {
     257           0 :     return _pCurFilter;
     258             : }
     259             : 
     260           0 : inline const OUString& SvtExpFileDlg_Impl::GetCurFilterDisplayName() const
     261             : {
     262           0 :     return m_sCurrentFilterDisplayName;
     263             : }
     264             : 
     265             : inline  void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl* pFilter )
     266             : {
     267             :     SetCurFilter( pFilter, pFilter->GetName() );
     268             : }
     269             : 
     270             : #endif // INCLUDED_FPICKER_SOURCE_OFFICE_IODLGIMP_HXX
     271             : 
     272             : 
     273             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10