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

Generated by: LCOV version 1.10