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

Generated by: LCOV version 1.10