LCOV - code coverage report
Current view: top level - include/svtools - fileview.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 9 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 5 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_SVTOOLS_FILEVIEW_HXX
      20             : #define INCLUDED_SVTOOLS_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/dialog.hxx>
      29             : #include <vcl/button.hxx>
      30             : #include <vcl/layout.hxx>
      31             : #include <rtl/ustring.hxx>
      32             : 
      33             : // class SvtFileView -----------------------------------------------------
      34             : 
      35             : class ViewTabListBox_Impl;
      36             : class SvtFileView_Impl;
      37             : class SvTreeListEntry;
      38             : class HeaderBar;
      39             : 
      40             : /// the result of an action in the FileView
      41             : enum FileViewResult
      42             : {
      43             :     eSuccess,
      44             :     eFailure,
      45             :     eTimeout,
      46             :     eStillRunning
      47             : };
      48             : 
      49             : /// describes parameters for doing an action on the FileView asynchronously
      50             : struct FileViewAsyncAction
      51             : {
      52             :     sal_uInt32  nMinTimeout;    /// minimum time to wait for a result, in milliseconds
      53             :     sal_uInt32  nMaxTimeout;    /// maximum time to wait for a result, in milliseconds, until eTimeout is returned
      54             :     Link<>      aFinishHandler; /// the handler to be called when the action is finished. Called in every case, no matter of the result
      55             : 
      56           0 :     FileViewAsyncAction()
      57           0 :     {
      58           0 :         nMinTimeout = nMaxTimeout = 0;
      59           0 :     }
      60             : };
      61             : 
      62             : class SVT_DLLPUBLIC SvtFileView : public Control
      63             : {
      64             : private:
      65             :     SvtFileView_Impl*       mpImp;
      66             :     bool                    bSortColumn;
      67             : 
      68             :     ::com::sun::star::uno::Sequence< OUString > mpBlackList;
      69             : 
      70             :     DECL_DLLPRIVATE_LINK(               HeaderSelect_Impl, HeaderBar * );
      71             :     DECL_DLLPRIVATE_LINK(               HeaderEndDrag_Impl, HeaderBar * );
      72             : 
      73             : protected:
      74             :     virtual void GetFocus() SAL_OVERRIDE;
      75             : 
      76             : public:
      77             :     SvtFileView( vcl::Window* pParent, WinBits nBits, bool bOnlyFolder, bool bMultiSelection );
      78             :     virtual ~SvtFileView();
      79             :     virtual void dispose() SAL_OVERRIDE;
      80             : 
      81             :     virtual Size GetOptimalSize() const SAL_OVERRIDE;
      82             : 
      83             :     const OUString&         GetViewURL() const;
      84             :     static OUString         GetURL( SvTreeListEntry* pEntry );
      85             :     OUString                GetCurrentURL() const;
      86             : 
      87             :     bool                    GetParentURL( OUString& _rParentURL ) const;
      88             :     void                    CreatedFolder( const OUString& rUrl, const OUString& rNewFolder );
      89             : 
      90             :     void                    SetHelpId( const OString& rHelpId );
      91             :     const OString&          GetHelpId( ) const;
      92             :     void                    SetSizePixel( const Size& rNewSize ) SAL_OVERRIDE;
      93             :     virtual void            SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) SAL_OVERRIDE;
      94           0 :     void                    SetSortColumn( bool bValue ) { bSortColumn = bValue; }
      95             :     bool                    GetSortColumn() { return bSortColumn; }
      96             : 
      97             :     /** initialize the view with the content of a folder given by URL, and apply an immediate filter
      98             : 
      99             :         @param rFolderURL
     100             :             the URL of the folder whose content is to be read
     101             :         @param rFilter
     102             :             the initial filter to be applied
     103             :         @param pAsyncDescriptor
     104             :             If not <NULL/>, this struct describes the parameters for doing the
     105             :             action asynchronously.
     106             :     */
     107             :     FileViewResult          Initialize(
     108             :                                 const OUString& rFolderURL,
     109             :                                 const OUString& rFilter,
     110             :                                 const FileViewAsyncAction* pAsyncDescriptor,
     111             :                                 const ::com::sun::star::uno::Sequence< OUString >& rBlackList
     112             :                             );
     113             : 
     114             :     /** initializes the view with the content of a folder given by an UCB content
     115             :     */
     116             :     bool                    Initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent,
     117             :                                         const OUString& rFilter );
     118             : 
     119             :     /** reads the current content of the current folder again, and applies the given filter to it
     120             : 
     121             :         Note 1: The folder is really read a second time. This implies that any new elements (which were
     122             :         not present when you called Initialize the last time) are now displayed.
     123             : 
     124             :         Note 2: This method must not be called when you previously initialized the view from a sequence
     125             :         of strings, or a UNO content object.
     126             : 
     127             :         @param rFilter
     128             :             the filter to be applied
     129             :         @param pAsyncDescriptor
     130             :             If not <NULL/>, this struct describes the parameters for doing the
     131             :             action asynchronously.
     132             :     */
     133             :     FileViewResult          ExecuteFilter(
     134             :                                 const OUString& rFilter,
     135             :                                 const FileViewAsyncAction* pAsyncDescriptor
     136             :                             );
     137             : 
     138             :     /** cancels a running async action (if any)
     139             : 
     140             :         @seealso Initialize
     141             :         @seealso ExecuteFilter
     142             :         @seealso FileViewAsyncAction
     143             :     */
     144             :     void                    CancelRunningAsyncAction();
     145             : 
     146             :     /** initializes the view with the parent folder of the current folder
     147             : 
     148             :         @param rNewURL
     149             :             the URL of the folder which we just navigated to
     150             :         @param pAsyncDescriptor
     151             :             If not <NULL/>, this struct describes the parameters for doing the
     152             :             action asynchronously.
     153             :     */
     154             :     FileViewResult          PreviousLevel(
     155             :                                 const FileViewAsyncAction* pAsyncDescriptor
     156             :                             );
     157             : 
     158             :     void                    SetNoSelection();
     159             : 
     160             :     void                    SetSelectHdl( const Link<>& rHdl );
     161             :     void                    SetDoubleClickHdl( const Link<>& rHdl );
     162             :     void                    SetOpenDoneHdl( const Link<>& rHdl );
     163             : 
     164             :     sal_uLong                   GetSelectionCount() const;
     165             :     SvTreeListEntry*            FirstSelected() const;
     166             :     SvTreeListEntry*            NextSelected( SvTreeListEntry* pEntry ) const;
     167             :     void                    EnableAutoResize();
     168             : 
     169             :     void                    EnableDelete( bool bEnable );
     170             : 
     171             :                             // save and load column size and sort order
     172             :     OUString                GetConfigString() const;
     173             :     void                    SetConfigString( const OUString& rCfgStr );
     174             : 
     175             :     void                    EndInplaceEditing( bool _bCancel );
     176             : 
     177             : protected:
     178             :     virtual void            StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
     179             : };
     180             : 
     181             : // struct SvtContentEntry ------------------------------------------------
     182             : 
     183           0 : struct SvtContentEntry
     184             : {
     185             :     bool     mbIsFolder;
     186             :     OUString maURL;
     187             : 
     188           0 :     SvtContentEntry( const OUString& rURL, bool bIsFolder ) :
     189           0 :         mbIsFolder( bIsFolder ), maURL( rURL ) {}
     190             : };
     191             : 
     192             : namespace svtools {
     193             : 
     194             : 
     195             : // QueryDeleteDlg_Impl
     196             : 
     197             : 
     198             : enum QueryDeleteResult_Impl
     199             : {
     200             :     QUERYDELETE_CANCEL = RET_CANCEL,
     201             :     QUERYDELETE_YES = RET_YES,
     202             :     QUERYDELETE_NO = RET_NO,
     203             :     QUERYDELETE_ALL = -1
     204             : };
     205             : 
     206             : class SVT_DLLPUBLIC QueryDeleteDlg_Impl : public MessageDialog
     207             : {
     208             : private:
     209             :     VclPtr<PushButton> m_pAllButton;
     210             : public:
     211             : 
     212             :     QueryDeleteDlg_Impl(vcl::Window* pParent, const OUString& rName);
     213             :     virtual ~QueryDeleteDlg_Impl();
     214             :     virtual void dispose() SAL_OVERRIDE;
     215             : 
     216           0 :     void EnableAllButton() { m_pAllButton->Enable(true); }
     217             : };
     218             : 
     219             : }
     220             : 
     221             : #endif // INCLUDED_SVTOOLS_FILEVIEW_HXX
     222             : 
     223             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11