LCOV - code coverage report
Current view: top level - fpicker/source/office - iodlgimp.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 30 0.0 %
Date: 2014-04-14 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 _IODLGIMP_HXX
      20             : #define _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.copy( 2 ); }
      61             : 
      62           0 :     sal_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_pParent;
      83             :     PopupMenu*          m_pMenu;
      84             : 
      85             : protected:
      86           0 :     inline        SvtFileDialog*  GetDialogParent()       { return m_pParent; }
      87             : 
      88             : protected:
      89             : 
      90             :     virtual void    FillURLMenu( PopupMenu* _pMenu ) = 0;
      91             : 
      92             : protected:
      93             :     SvtFileDialogURLSelector( SvtFileDialog* _pParent, const ResId& _rResId, 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( SvtFileDialog* pParent, const ResId& rResId );
     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             : };
     113             : 
     114             : typedef sal_uInt8 SvtFileDlgState;
     115             : 
     116             : #define FILEDLG_STATE_NONE        ((SvtFileDlgState)0x00)
     117             : #define FILEDLG_STATE_REMOTE      ((SvtFileDlgState)0x01)
     118             : 
     119             : class SvtURLBox;
     120             : class SvtExpFileDlg_Impl
     121             : {
     122             : private:
     123             :     DECL_STATIC_LINK( SvtExpFileDlg_Impl, UnClickHdl, Button* );
     124             : 
     125             : private:
     126             :     ListBox*                        _pLbFilter;
     127             : 
     128             :     const SvtFileDialogFilter_Impl* _pCurFilter;
     129             :     OUString                        m_sCurrentFilterDisplayName;    // may differ from _pCurFilter->GetName in case it is a cached entry
     130             : 
     131             :     ::com::sun::star::uno::Sequence< OUString > _aBlackList;
     132             : 
     133             : public:
     134             :     SvtFileDialogFilterList_Impl*   _pFilter;
     135             :     SvtFileDialogFilter_Impl*       _pUserFilter;
     136             : 
     137             :     FixedText*                      _pFtFileName;
     138             :     SvtURLBox*                      _pEdFileName;
     139             : 
     140             :     FixedText*                      _pFtFileVersion;
     141             :     ListBox*                        _pLbFileVersion;
     142             : 
     143             :     FixedText*                      _pFtTemplates;
     144             :     ListBox*                        _pLbTemplates;
     145             : 
     146             :     FixedText*                      _pFtImageTemplates;
     147             :     ListBox*                        _pLbImageTemplates;
     148             : 
     149             :     FixedText*                      _pFtFileType;
     150             :     PushButton*                     _pBtnFileOpen;
     151             :     PushButton*                     _pBtnCancel;
     152             :     HelpButton*                     _pBtnHelp;
     153             :     SvtUpButton_Impl*               _pBtnUp;
     154             :     ImageButton*                    _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             :     sal_Bool                        _bDoubleClick;
     175             :     sal_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             :     sal_Bool                        _bMultiSelection;
     183             : 
     184             :     // remember fixsizes for resize
     185             :     long                            _nFixDeltaHeight;
     186             :     Size                            _a6Size;
     187             :     Size                            _aDlgSize;
     188             :     OUString                        _aIniKey;
     189             : 
     190             :     sal_Bool                        _bFolderHasOpened;
     191             : 
     192             :                             SvtExpFileDlg_Impl( WinBits nBits );
     193             :                             ~SvtExpFileDlg_Impl();
     194             : 
     195             : 
     196           0 :     inline void             SetBlackList( const ::com::sun::star::uno::Sequence< OUString >& rBlackList ) { _aBlackList = rBlackList; }
     197           0 :     inline const ::com::sun::star::uno::Sequence< OUString >& GetBlackList() const { return _aBlackList; }
     198             :     void                    SetStandardDir( const OUString& _rDir );
     199           0 :     inline const OUString&  GetStandardDir() const          { return _aStdDir; }
     200           0 :     inline void             DisableFilterBoxAutoWidth()     { _pLbFilter->EnableDDAutoWidth( false ); }
     201             : 
     202             : 
     203             :     // access to the filter listbox only as Control* - we want to maintain the entries/userdata ourself
     204           0 :             Control*        GetFilterListControl()          { return _pLbFilter; }
     205             :             const Control*  GetFilterListControl() const    { return _pLbFilter; }
     206             :             void            CreateFilterListControl( Window* _pParent, const ResId& _rId );
     207             :     inline  void            SetFilterListSelectHdl( const Link& _rHandler );
     208             : 
     209             :     // inits the listbox for the filters from the filter list (_pFilter)
     210             :             void            ClearFilterList( );
     211             :             void            InitFilterList( );
     212             :     inline  sal_Bool        HasFilterListEntry( const OUString& _rFilterName );
     213             :     inline  void            SelectFilterListEntry( const OUString& _rFilterName );
     214             :     inline  void            SetNoFilterListSelection( );
     215             :             void            InsertFilterListEntry( const SvtFileDialogFilter_Impl* _pFilterDesc );
     216             :                                 // _pFilterDesc must already have been added to _pFilter
     217             :     inline  SvtFileDialogFilter_Impl*   GetSelectedFilterEntry( OUString& /* [out] */ _rDisplayName ) const;
     218             :     inline  sal_Bool        IsFilterListTravelSelect() const;
     219             : 
     220             : 
     221             :     // access to the current filter via methods only - need to care for consistency between _pCurFilter and m_sCurrentFilterDisplayName
     222             :     inline      const SvtFileDialogFilter_Impl*     GetCurFilter( ) const;
     223             :     inline      const OUString&                     GetCurFilterDisplayName() const;
     224             :                 void                                SetCurFilter( SvtFileDialogFilter_Impl* _pFilter, const OUString& _rDisplayName );
     225             :     inline      void                                SetCurFilter( SvtFileDialogFilter_Impl* _pFilter );
     226             : };
     227             : 
     228           0 : inline void SvtExpFileDlg_Impl::SetFilterListSelectHdl( const Link& _rHandler )
     229             : {
     230           0 :     _pLbFilter->SetSelectHdl( _rHandler );
     231           0 : }
     232             : 
     233           0 : inline sal_Bool SvtExpFileDlg_Impl::HasFilterListEntry( const OUString& _rFilterName )
     234             : {
     235           0 :     return ( LISTBOX_ENTRY_NOTFOUND != _pLbFilter->GetEntryPos( _rFilterName ) );
     236             : }
     237             : 
     238           0 : inline void SvtExpFileDlg_Impl::SelectFilterListEntry( const OUString& _rFilterName )
     239             : {
     240           0 :     _pLbFilter->SelectEntry( _rFilterName );
     241           0 : }
     242             : 
     243           0 : inline  void SvtExpFileDlg_Impl::SetNoFilterListSelection( )
     244             : {
     245           0 :     _pLbFilter->SetNoSelection( );
     246           0 : }
     247             : 
     248           0 : inline SvtFileDialogFilter_Impl* SvtExpFileDlg_Impl::GetSelectedFilterEntry( OUString& _rDisplayName ) const
     249             : {
     250           0 :     _rDisplayName = _pLbFilter->GetSelectEntry();
     251           0 :     return static_cast< SvtFileDialogFilter_Impl* >( _pLbFilter->GetEntryData ( _pLbFilter->GetSelectEntryPos() ) );
     252             : }
     253             : 
     254           0 : inline sal_Bool SvtExpFileDlg_Impl::IsFilterListTravelSelect() const
     255             : {
     256           0 :     return _pLbFilter->IsTravelSelect();
     257             : }
     258             : 
     259           0 : inline const SvtFileDialogFilter_Impl* SvtExpFileDlg_Impl::GetCurFilter( ) const
     260             : {
     261           0 :     return _pCurFilter;
     262             : }
     263             : 
     264           0 : inline const OUString& SvtExpFileDlg_Impl::GetCurFilterDisplayName() const
     265             : {
     266           0 :     return m_sCurrentFilterDisplayName;
     267             : }
     268             : 
     269             : inline  void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl* pFilter )
     270             : {
     271             :     SetCurFilter( pFilter, pFilter->GetName() );
     272             : }
     273             : 
     274             : #endif // #ifndef _IODLGIMP_HXX
     275             : 
     276             : 
     277             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10