LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/svtools - fileview.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 12 0.0 %
Date: 2012-08-25 Functions: 0 9 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 16 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _SVT_FILEVIEW_HXX
      29                 :            : #define _SVT_FILEVIEW_HXX
      30                 :            : 
      31                 :            : #include "svtools/svtdllapi.h"
      32                 :            : #include <com/sun/star/uno/Sequence.h>
      33                 :            : #include <com/sun/star/ucb/XContent.hpp>
      34                 :            : #include <vcl/ctrl.hxx>
      35                 :            : #include <vcl/image.hxx>
      36                 :            : #include <vcl/fixed.hxx>
      37                 :            : #include <vcl/button.hxx>
      38                 :            : #include <vcl/dialog.hxx>
      39                 :            : #include <rtl/ustring.hxx>
      40                 :            : 
      41                 :            : // class SvtFileView -----------------------------------------------------
      42                 :            : 
      43                 :            : #define FILEVIEW_ONLYFOLDER         0x0001
      44                 :            : #define FILEVIEW_MULTISELECTION     0x0002
      45                 :            : 
      46                 :            : #define FILEVIEW_SHOW_ONLYTITLE     0x0010
      47                 :            : #define FILEVIEW_SHOW_NONE          0x0020
      48                 :            : 
      49                 :            : class ViewTabListBox_Impl;
      50                 :            : class SvtFileView_Impl;
      51                 :            : class SvLBoxEntry;
      52                 :            : class HeaderBar;
      53                 :            : class IUrlFilter;
      54                 :            : 
      55                 :            : /// the result of an action in the FileView
      56                 :            : enum FileViewResult
      57                 :            : {
      58                 :            :     eSuccess,
      59                 :            :     eFailure,
      60                 :            :     eTimeout,
      61                 :            :     eStillRunning
      62                 :            : };
      63                 :            : 
      64                 :            : /// describes parameters for doing an action on the FileView asynchronously
      65                 :            : struct FileViewAsyncAction
      66                 :            : {
      67                 :            :     sal_uInt32  nMinTimeout;    /// minimum time to wait for a result, in milliseconds
      68                 :            :     sal_uInt32  nMaxTimeout;    /// maximum time to wait for a result, in milliseconds, until eTimeout is returned
      69                 :            :     Link        aFinishHandler; /// the handler to be called when the action is finished. Called in every case, no matter of the result
      70                 :            : 
      71                 :          0 :     FileViewAsyncAction()
      72                 :          0 :     {
      73                 :          0 :         nMinTimeout = nMaxTimeout = 0;
      74                 :          0 :     }
      75                 :            : };
      76                 :            : 
      77                 :            : class SVT_DLLPUBLIC SvtFileView : public Control
      78                 :            : {
      79                 :            : private:
      80                 :            :     SvtFileView_Impl*       mpImp;
      81                 :            :     sal_Bool                bSortColumn;
      82                 :            : 
      83                 :            :     ::com::sun::star::uno::Sequence< ::rtl::OUString > mpBlackList;
      84                 :            : 
      85                 :            :     DECL_DLLPRIVATE_LINK(               HeaderSelect_Impl, HeaderBar * );
      86                 :            :     DECL_DLLPRIVATE_LINK(               HeaderEndDrag_Impl, HeaderBar * );
      87                 :            : 
      88                 :            : protected:
      89                 :            :     virtual void GetFocus();
      90                 :            : 
      91                 :            : public:
      92                 :            :     SvtFileView( Window* pParent, const ResId& rResId, sal_Bool bOnlyFolder, sal_Bool bMultiSelection );
      93                 :            :     SvtFileView( Window* pParent, const ResId& rResId, sal_uInt8 nFlags );
      94                 :            :     ~SvtFileView();
      95                 :            : 
      96                 :            :     const String&           GetViewURL() const;
      97                 :            :     String                  GetURL( SvLBoxEntry* pEntry ) const;
      98                 :            :     String                  GetCurrentURL() const;
      99                 :            : 
     100                 :            :     sal_Bool                GetParentURL( String& _rParentURL ) const;
     101                 :            :     void                    CreatedFolder( const String& rUrl, const String& rNewFolder );
     102                 :            : 
     103                 :            :     void                    SetHelpId( const rtl::OString& rHelpId );
     104                 :            :     const rtl::OString&     GetHelpId( ) const;
     105                 :            :     void                    SetSizePixel( const Size& rNewSize );
     106                 :            :     using Window::SetPosSizePixel;
     107                 :            :     virtual void            SetPosSizePixel( const Point& rNewPos, const Size& rNewSize );
     108                 :          0 :     void                    SetSortColumn( sal_Bool bValue ) { bSortColumn = bValue; }
     109                 :          0 :     sal_Bool                GetSortColumn() { return bSortColumn; }
     110                 :            : 
     111                 :            :     /** initialize the view with the content of a folder given by URL, and aply an immediate filter
     112                 :            : 
     113                 :            :         @param rFolderURL
     114                 :            :             the URL of the folder whose content is to be read
     115                 :            :         @param rFilter
     116                 :            :             the initial filter to be applied
     117                 :            :         @param pAsyncDescriptor
     118                 :            :             If not <NULL/>, this struct describes the parameters for doing the
     119                 :            :             action asynchronously.
     120                 :            :     */
     121                 :            :     FileViewResult          Initialize(
     122                 :            :                                 const String& rFolderURL,
     123                 :            :                                 const String& rFilter,
     124                 :            :                                 const FileViewAsyncAction* pAsyncDescriptor,
     125                 :            :                                 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList
     126                 :            :                             );
     127                 :            : 
     128                 :            :     FileViewResult          Initialize(
     129                 :            :                                 const String& rFolderURL,
     130                 :            :                                 const String& rFilter,
     131                 :            :                                 const FileViewAsyncAction* pAsyncDescriptor );
     132                 :            :     /** initialze the view with a sequence of contents, which have already been obtained elsewhere
     133                 :            : 
     134                 :            :         This method will never return <member>eStillRunning</member>, since it will fill the
     135                 :            :         view synchronously
     136                 :            :     */
     137                 :            :     sal_Bool                Initialize( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aContents );
     138                 :            : 
     139                 :            :     /** initializes the view with the content of a folder given by an UCB content
     140                 :            :     */
     141                 :            :     sal_Bool                Initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent,
     142                 :            :                                         const String& rFilter );
     143                 :            : 
     144                 :            :     /** reads the current content of the current folder again, and applies the given filter to it
     145                 :            : 
     146                 :            :         Note 1: The folder is really read a second time. This implies that any new elements (which were
     147                 :            :         not present when you called Initialize the last time) are now displayed.
     148                 :            : 
     149                 :            :         Note 2: This method must not be called when you previously initialized the view from a sequence
     150                 :            :         of strings, or a UNO content object.
     151                 :            : 
     152                 :            :         @param rFilter
     153                 :            :             the filter to be applied
     154                 :            :         @param pAsyncDescriptor
     155                 :            :             If not <NULL/>, this struct describes the parameters for doing the
     156                 :            :             action asynchronously.
     157                 :            :     */
     158                 :            :     FileViewResult          ExecuteFilter(
     159                 :            :                                 const String& rFilter,
     160                 :            :                                 const FileViewAsyncAction* pAsyncDescriptor
     161                 :            :                             );
     162                 :            : 
     163                 :            :     /** cancels a running async action (if any)
     164                 :            : 
     165                 :            :         @seealso Initialize
     166                 :            :         @seealso ExecuteFilter
     167                 :            :         @seealso FileViewAsyncAction
     168                 :            :     */
     169                 :            :     void                    CancelRunningAsyncAction();
     170                 :            : 
     171                 :            :     /** initializes the view with the parent folder of the current folder
     172                 :            : 
     173                 :            :         @param rNewURL
     174                 :            :             the URL of the folder which we just navigated to
     175                 :            :         @param pAsyncDescriptor
     176                 :            :             If not <NULL/>, this struct describes the parameters for doing the
     177                 :            :             action asynchronously.
     178                 :            :     */
     179                 :            :     FileViewResult          PreviousLevel(
     180                 :            :                                 const FileViewAsyncAction* pAsyncDescriptor
     181                 :            :                             );
     182                 :            : 
     183                 :            :     void                    SetNoSelection();
     184                 :            : 
     185                 :            :     void                    SetSelectHdl( const Link& rHdl );
     186                 :            :     void                    SetDoubleClickHdl( const Link& rHdl );
     187                 :            :     void                    SetOpenDoneHdl( const Link& rHdl );
     188                 :            : 
     189                 :            :     sal_uLong                   GetSelectionCount() const;
     190                 :            :     SvLBoxEntry*            FirstSelected() const;
     191                 :            :     SvLBoxEntry*            NextSelected( SvLBoxEntry* pEntry ) const;
     192                 :            :     void                    EnableAutoResize();
     193                 :            :     void                    SetFocus();
     194                 :            : 
     195                 :            :     void                    EnableContextMenu( sal_Bool bEnable );
     196                 :            :     void                    EnableDelete( sal_Bool bEnable );
     197                 :            :     void                    EnableNameReplacing( sal_Bool bEnable = sal_True );
     198                 :            :                                 // translate folder names or display doc-title instead of file name
     199                 :            :                                 // EnableContextMenu( sal_True )/EnableDelete(sal_True) disable name replacing!
     200                 :            : 
     201                 :            :                             // save and load column size and sort order
     202                 :            :     String                  GetConfigString() const;
     203                 :            :     void                    SetConfigString( const String& rCfgStr );
     204                 :            : 
     205                 :            :     void                    SetUrlFilter( const IUrlFilter* _pFilter );
     206                 :            : 
     207                 :            :     void                    EndInplaceEditing( bool _bCancel );
     208                 :            : 
     209                 :            : protected:
     210                 :            :     virtual void            StateChanged( StateChangedType nStateChange );
     211                 :            : };
     212                 :            : 
     213                 :            : // struct SvtContentEntry ------------------------------------------------
     214                 :            : 
     215                 :          0 : struct SvtContentEntry
     216                 :            : {
     217                 :            :     sal_Bool    mbIsFolder;
     218                 :            :     rtl::OUString maURL;
     219                 :            : 
     220                 :          0 :     SvtContentEntry( const rtl::OUString& rURL, sal_Bool bIsFolder ) :
     221                 :          0 :         mbIsFolder( bIsFolder ), maURL( rURL ) {}
     222                 :            : };
     223                 :            : 
     224                 :            : namespace svtools {
     225                 :            : 
     226                 :            : // -----------------------------------------------------------------------
     227                 :            : // QueryDeleteDlg_Impl
     228                 :            : // -----------------------------------------------------------------------
     229                 :            : 
     230                 :            : enum QueryDeleteResult_Impl
     231                 :            : {
     232                 :            :     QUERYDELETE_YES = 0,
     233                 :            :     QUERYDELETE_NO,
     234                 :            :     QUERYDELETE_ALL,
     235                 :            :     QUERYDELETE_CANCEL
     236                 :            : };
     237                 :            : 
     238 [ #  # ][ #  # ]:          0 : class SVT_DLLPUBLIC QueryDeleteDlg_Impl : public ModalDialog
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     239                 :            : {
     240                 :            :     FixedText               _aEntryLabel;
     241                 :            :     FixedText               _aEntry;
     242                 :            :     FixedText               _aQueryMsg;
     243                 :            : 
     244                 :            :     PushButton              _aYesButton;
     245                 :            :     PushButton              _aAllButton;
     246                 :            :     PushButton              _aNoButton;
     247                 :            :     CancelButton            _aCancelButton;
     248                 :            : 
     249                 :            :     QueryDeleteResult_Impl  _eResult;
     250                 :            : 
     251                 :            : private:
     252                 :            : 
     253                 :            :     DECL_DLLPRIVATE_STATIC_LINK( QueryDeleteDlg_Impl, ClickLink, PushButton* );
     254                 :            : 
     255                 :            : public:
     256                 :            : 
     257                 :            :                             QueryDeleteDlg_Impl( Window* pParent,
     258                 :            :                                                  const String& rName );
     259                 :            : 
     260                 :          0 :     void                    EnableAllButton() { _aAllButton.Enable( sal_True ); }
     261                 :          0 :     QueryDeleteResult_Impl  GetResult() const { return _eResult; }
     262                 :            : };
     263                 :            : 
     264                 :            : }
     265                 :            : 
     266                 :            : #endif // _SVT_FILEVIEW_HXX
     267                 :            : 
     268                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10