LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/svtools - fileview.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 12 0.0 %
Date: 2013-07-09 Functions: 0 9 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 _SVT_FILEVIEW_HXX
      20             : #define _SVT_FILEVIEW_HXX
      21             : 
      22             : #include "svtools/svtdllapi.h"
      23             : #include <com/sun/star/uno/Sequence.h>
      24             : #include <com/sun/star/ucb/XContent.hpp>
      25             : #include <vcl/ctrl.hxx>
      26             : #include <vcl/image.hxx>
      27             : #include <vcl/fixed.hxx>
      28             : #include <vcl/button.hxx>
      29             : #include <vcl/dialog.hxx>
      30             : #include <rtl/ustring.hxx>
      31             : 
      32             : // class SvtFileView -----------------------------------------------------
      33             : 
      34             : #define FILEVIEW_ONLYFOLDER         0x0001
      35             : #define FILEVIEW_MULTISELECTION     0x0002
      36             : 
      37             : #define FILEVIEW_SHOW_ONLYTITLE     0x0010
      38             : #define FILEVIEW_SHOW_NONE          0x0020
      39             : 
      40             : class ViewTabListBox_Impl;
      41             : class SvtFileView_Impl;
      42             : class SvTreeListEntry;
      43             : class HeaderBar;
      44             : 
      45             : /// the result of an action in the FileView
      46             : enum FileViewResult
      47             : {
      48             :     eSuccess,
      49             :     eFailure,
      50             :     eTimeout,
      51             :     eStillRunning
      52             : };
      53             : 
      54             : /// describes parameters for doing an action on the FileView asynchronously
      55             : struct FileViewAsyncAction
      56             : {
      57             :     sal_uInt32  nMinTimeout;    /// minimum time to wait for a result, in milliseconds
      58             :     sal_uInt32  nMaxTimeout;    /// maximum time to wait for a result, in milliseconds, until eTimeout is returned
      59             :     Link        aFinishHandler; /// the handler to be called when the action is finished. Called in every case, no matter of the result
      60             : 
      61           0 :     FileViewAsyncAction()
      62           0 :     {
      63           0 :         nMinTimeout = nMaxTimeout = 0;
      64           0 :     }
      65             : };
      66             : 
      67             : class SVT_DLLPUBLIC SvtFileView : public Control
      68             : {
      69             : private:
      70             :     SvtFileView_Impl*       mpImp;
      71             :     sal_Bool                bSortColumn;
      72             : 
      73             :     ::com::sun::star::uno::Sequence< OUString > mpBlackList;
      74             : 
      75             :     DECL_DLLPRIVATE_LINK(               HeaderSelect_Impl, HeaderBar * );
      76             :     DECL_DLLPRIVATE_LINK(               HeaderEndDrag_Impl, HeaderBar * );
      77             : 
      78             : protected:
      79             :     virtual void GetFocus();
      80             : 
      81             : public:
      82             :     SvtFileView( Window* pParent, const ResId& rResId, sal_Bool bOnlyFolder, sal_Bool bMultiSelection );
      83             :     SvtFileView( Window* pParent, const ResId& rResId, sal_uInt8 nFlags );
      84             :     ~SvtFileView();
      85             : 
      86             :     const String&           GetViewURL() const;
      87             :     String                  GetURL( SvTreeListEntry* pEntry ) const;
      88             :     String                  GetCurrentURL() const;
      89             : 
      90             :     sal_Bool                GetParentURL( String& _rParentURL ) const;
      91             :     void                    CreatedFolder( const String& rUrl, const String& rNewFolder );
      92             : 
      93             :     void                    SetHelpId( const OString& rHelpId );
      94             :     const OString&     GetHelpId( ) const;
      95             :     void                    SetSizePixel( const Size& rNewSize );
      96             :     virtual void            SetPosSizePixel( const Point& rNewPos, const Size& rNewSize );
      97           0 :     void                    SetSortColumn( sal_Bool bValue ) { bSortColumn = bValue; }
      98           0 :     sal_Bool                GetSortColumn() { return bSortColumn; }
      99             : 
     100             :     /** initialize the view with the content of a folder given by URL, and aply an immediate filter
     101             : 
     102             :         @param rFolderURL
     103             :             the URL of the folder whose content is to be read
     104             :         @param rFilter
     105             :             the initial filter to be applied
     106             :         @param pAsyncDescriptor
     107             :             If not <NULL/>, this struct describes the parameters for doing the
     108             :             action asynchronously.
     109             :     */
     110             :     FileViewResult          Initialize(
     111             :                                 const String& rFolderURL,
     112             :                                 const String& rFilter,
     113             :                                 const FileViewAsyncAction* pAsyncDescriptor,
     114             :                                 const ::com::sun::star::uno::Sequence< OUString >& rBlackList
     115             :                             );
     116             : 
     117             :     FileViewResult          Initialize(
     118             :                                 const String& rFolderURL,
     119             :                                 const String& rFilter,
     120             :                                 const FileViewAsyncAction* pAsyncDescriptor );
     121             :     /** initialze the view with a sequence of contents, which have already been obtained elsewhere
     122             : 
     123             :         This method will never return <member>eStillRunning</member>, since it will fill the
     124             :         view synchronously
     125             :     */
     126             :     sal_Bool                Initialize( const ::com::sun::star::uno::Sequence< OUString >& aContents );
     127             : 
     128             :     /** initializes the view with the content of a folder given by an UCB content
     129             :     */
     130             :     sal_Bool                Initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent,
     131             :                                         const String& rFilter );
     132             : 
     133             :     /** reads the current content of the current folder again, and applies the given filter to it
     134             : 
     135             :         Note 1: The folder is really read a second time. This implies that any new elements (which were
     136             :         not present when you called Initialize the last time) are now displayed.
     137             : 
     138             :         Note 2: This method must not be called when you previously initialized the view from a sequence
     139             :         of strings, or a UNO content object.
     140             : 
     141             :         @param rFilter
     142             :             the filter to be applied
     143             :         @param pAsyncDescriptor
     144             :             If not <NULL/>, this struct describes the parameters for doing the
     145             :             action asynchronously.
     146             :     */
     147             :     FileViewResult          ExecuteFilter(
     148             :                                 const String& rFilter,
     149             :                                 const FileViewAsyncAction* pAsyncDescriptor
     150             :                             );
     151             : 
     152             :     /** cancels a running async action (if any)
     153             : 
     154             :         @seealso Initialize
     155             :         @seealso ExecuteFilter
     156             :         @seealso FileViewAsyncAction
     157             :     */
     158             :     void                    CancelRunningAsyncAction();
     159             : 
     160             :     /** initializes the view with the parent folder of the current folder
     161             : 
     162             :         @param rNewURL
     163             :             the URL of the folder which we just navigated to
     164             :         @param pAsyncDescriptor
     165             :             If not <NULL/>, this struct describes the parameters for doing the
     166             :             action asynchronously.
     167             :     */
     168             :     FileViewResult          PreviousLevel(
     169             :                                 const FileViewAsyncAction* pAsyncDescriptor
     170             :                             );
     171             : 
     172             :     void                    SetNoSelection();
     173             : 
     174             :     void                    SetSelectHdl( const Link& rHdl );
     175             :     void                    SetDoubleClickHdl( const Link& rHdl );
     176             :     void                    SetOpenDoneHdl( const Link& rHdl );
     177             : 
     178             :     sal_uLong                   GetSelectionCount() const;
     179             :     SvTreeListEntry*            FirstSelected() const;
     180             :     SvTreeListEntry*            NextSelected( SvTreeListEntry* pEntry ) const;
     181             :     void                    EnableAutoResize();
     182             :     void                    SetFocus();
     183             : 
     184             :     void                    EnableContextMenu( sal_Bool bEnable );
     185             :     void                    EnableDelete( sal_Bool bEnable );
     186             :     void                    EnableNameReplacing( sal_Bool bEnable = sal_True );
     187             :                                 // translate folder names or display doc-title instead of file name
     188             :                                 // EnableContextMenu( sal_True )/EnableDelete(sal_True) disable name replacing!
     189             : 
     190             :                             // save and load column size and sort order
     191             :     String                  GetConfigString() const;
     192             :     void                    SetConfigString( const String& rCfgStr );
     193             : 
     194             :     void                    EndInplaceEditing( bool _bCancel );
     195             : 
     196             : protected:
     197             :     virtual void            StateChanged( StateChangedType nStateChange );
     198             : };
     199             : 
     200             : // struct SvtContentEntry ------------------------------------------------
     201             : 
     202           0 : struct SvtContentEntry
     203             : {
     204             :     sal_Bool    mbIsFolder;
     205             :     OUString maURL;
     206             : 
     207           0 :     SvtContentEntry( const OUString& rURL, sal_Bool bIsFolder ) :
     208           0 :         mbIsFolder( bIsFolder ), maURL( rURL ) {}
     209             : };
     210             : 
     211             : namespace svtools {
     212             : 
     213             : // -----------------------------------------------------------------------
     214             : // QueryDeleteDlg_Impl
     215             : // -----------------------------------------------------------------------
     216             : 
     217             : enum QueryDeleteResult_Impl
     218             : {
     219             :     QUERYDELETE_YES = 0,
     220             :     QUERYDELETE_NO,
     221             :     QUERYDELETE_ALL,
     222             :     QUERYDELETE_CANCEL
     223             : };
     224             : 
     225           0 : class SVT_DLLPUBLIC QueryDeleteDlg_Impl : public ModalDialog
     226             : {
     227             :     FixedText               _aEntryLabel;
     228             :     FixedText               _aEntry;
     229             :     FixedText               _aQueryMsg;
     230             : 
     231             :     PushButton              _aYesButton;
     232             :     PushButton              _aAllButton;
     233             :     PushButton              _aNoButton;
     234             :     CancelButton            _aCancelButton;
     235             : 
     236             :     QueryDeleteResult_Impl  _eResult;
     237             : 
     238             : private:
     239             : 
     240             :     DECL_DLLPRIVATE_STATIC_LINK( QueryDeleteDlg_Impl, ClickLink, PushButton* );
     241             : 
     242             : public:
     243             : 
     244             :                             QueryDeleteDlg_Impl( Window* pParent,
     245             :                                                  const String& rName );
     246             : 
     247           0 :     void                    EnableAllButton() { _aAllButton.Enable( sal_True ); }
     248           0 :     QueryDeleteResult_Impl  GetResult() const { return _eResult; }
     249             : };
     250             : 
     251             : }
     252             : 
     253             : #endif // _SVT_FILEVIEW_HXX
     254             : 
     255             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10