LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/svtools - fileview.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 12 0.0 %
Date: 2012-12-27 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             : class IUrlFilter;
      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             :     sal_Bool                bSortColumn;
      73             : 
      74             :     ::com::sun::star::uno::Sequence< ::rtl::OUString > mpBlackList;
      75             : 
      76             :     DECL_DLLPRIVATE_LINK(               HeaderSelect_Impl, HeaderBar * );
      77             :     DECL_DLLPRIVATE_LINK(               HeaderEndDrag_Impl, HeaderBar * );
      78             : 
      79             : protected:
      80             :     virtual void GetFocus();
      81             : 
      82             : public:
      83             :     SvtFileView( Window* pParent, const ResId& rResId, sal_Bool bOnlyFolder, sal_Bool bMultiSelection );
      84             :     SvtFileView( Window* pParent, const ResId& rResId, sal_uInt8 nFlags );
      85             :     ~SvtFileView();
      86             : 
      87             :     const String&           GetViewURL() const;
      88             :     String                  GetURL( SvTreeListEntry* pEntry ) const;
      89             :     String                  GetCurrentURL() const;
      90             : 
      91             :     sal_Bool                GetParentURL( String& _rParentURL ) const;
      92             :     void                    CreatedFolder( const String& rUrl, const String& rNewFolder );
      93             : 
      94             :     void                    SetHelpId( const rtl::OString& rHelpId );
      95             :     const rtl::OString&     GetHelpId( ) const;
      96             :     void                    SetSizePixel( const Size& rNewSize );
      97             :     virtual void            SetPosSizePixel( const Point& rNewPos, const Size& rNewSize );
      98           0 :     void                    SetSortColumn( sal_Bool bValue ) { bSortColumn = bValue; }
      99           0 :     sal_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 String& rFolderURL,
     113             :                                 const String& rFilter,
     114             :                                 const FileViewAsyncAction* pAsyncDescriptor,
     115             :                                 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList
     116             :                             );
     117             : 
     118             :     FileViewResult          Initialize(
     119             :                                 const String& rFolderURL,
     120             :                                 const String& 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             :     sal_Bool                Initialize( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aContents );
     128             : 
     129             :     /** initializes the view with the content of a folder given by an UCB content
     130             :     */
     131             :     sal_Bool                Initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent,
     132             :                                         const String& 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 String& 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( sal_Bool bEnable );
     186             :     void                    EnableDelete( sal_Bool bEnable );
     187             :     void                    EnableNameReplacing( sal_Bool bEnable = sal_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             :     String                  GetConfigString() const;
     193             :     void                    SetConfigString( const String& rCfgStr );
     194             : 
     195             :     void                    SetUrlFilter( const IUrlFilter* _pFilter );
     196             : 
     197             :     void                    EndInplaceEditing( bool _bCancel );
     198             : 
     199             : protected:
     200             :     virtual void            StateChanged( StateChangedType nStateChange );
     201             : };
     202             : 
     203             : // struct SvtContentEntry ------------------------------------------------
     204             : 
     205           0 : struct SvtContentEntry
     206             : {
     207             :     sal_Bool    mbIsFolder;
     208             :     rtl::OUString maURL;
     209             : 
     210           0 :     SvtContentEntry( const rtl::OUString& rURL, sal_Bool bIsFolder ) :
     211           0 :         mbIsFolder( bIsFolder ), maURL( rURL ) {}
     212             : };
     213             : 
     214             : namespace svtools {
     215             : 
     216             : // -----------------------------------------------------------------------
     217             : // QueryDeleteDlg_Impl
     218             : // -----------------------------------------------------------------------
     219             : 
     220             : enum QueryDeleteResult_Impl
     221             : {
     222             :     QUERYDELETE_YES = 0,
     223             :     QUERYDELETE_NO,
     224             :     QUERYDELETE_ALL,
     225             :     QUERYDELETE_CANCEL
     226             : };
     227             : 
     228           0 : class SVT_DLLPUBLIC QueryDeleteDlg_Impl : public ModalDialog
     229             : {
     230             :     FixedText               _aEntryLabel;
     231             :     FixedText               _aEntry;
     232             :     FixedText               _aQueryMsg;
     233             : 
     234             :     PushButton              _aYesButton;
     235             :     PushButton              _aAllButton;
     236             :     PushButton              _aNoButton;
     237             :     CancelButton            _aCancelButton;
     238             : 
     239             :     QueryDeleteResult_Impl  _eResult;
     240             : 
     241             : private:
     242             : 
     243             :     DECL_DLLPRIVATE_STATIC_LINK( QueryDeleteDlg_Impl, ClickLink, PushButton* );
     244             : 
     245             : public:
     246             : 
     247             :                             QueryDeleteDlg_Impl( Window* pParent,
     248             :                                                  const String& rName );
     249             : 
     250           0 :     void                    EnableAllButton() { _aAllButton.Enable( sal_True ); }
     251           0 :     QueryDeleteResult_Impl  GetResult() const { return _eResult; }
     252             : };
     253             : 
     254             : }
     255             : 
     256             : #endif // _SVT_FILEVIEW_HXX
     257             : 
     258             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10