LCOV - code coverage report
Current view: top level - svtools/source/contnr - fileview.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1111 0.0 %
Date: 2012-08-25 Functions: 0 132 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1778 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                 :            : 
      29                 :            : #include "sal/config.h"
      30                 :            : 
      31                 :            : #include <svtools/fileview.hxx>
      32                 :            : #include <svtools/svtresid.hxx>
      33                 :            : #include <svtools/imagemgr.hxx>
      34                 :            : #include <svtools/headbar.hxx>
      35                 :            : #include <svtools/svtabbx.hxx>
      36                 :            : #include <svtools/svtools.hrc>
      37                 :            : #include "fileview.hrc"
      38                 :            : #include "fileview.hxx"
      39                 :            : #include "contentenumeration.hxx"
      40                 :            : #include <svtools/AccessibleBrowseBoxObjType.hxx>
      41                 :            : #include <com/sun/star/util/DateTime.hpp>
      42                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      43                 :            : #include <com/sun/star/task/XInteractionHandler.hpp>
      44                 :            : #include <com/sun/star/ucb/XProgressHandler.hpp>
      45                 :            : #include <com/sun/star/sdbc/XResultSet.hpp>
      46                 :            : #include <com/sun/star/ucb/XAnyCompareFactory.hpp>
      47                 :            : #include <com/sun/star/ucb/XContentAccess.hpp>
      48                 :            : #include <com/sun/star/ucb/XDynamicResultSet.hpp>
      49                 :            : #include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
      50                 :            : #include <com/sun/star/sdbc/XRow.hpp>
      51                 :            : #include <com/sun/star/container/XChild.hpp>
      52                 :            : #include <com/sun/star/ucb/CommandAbortedException.hpp>
      53                 :            : #include <com/sun/star/ucb/ContentCreationException.hpp>
      54                 :            : #include <vcl/waitobj.hxx>
      55                 :            : #include <com/sun/star/io/XPersist.hpp>
      56                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      57                 :            : #include <com/sun/star/ucb/XCommandInfo.hpp>
      58                 :            : #include <com/sun/star/beans/XPropertySetInfo.hpp>
      59                 :            : #include <com/sun/star/beans/PropertyAttribute.hpp>
      60                 :            : 
      61                 :            : #include <algorithm>
      62                 :            : #include <memory>
      63                 :            : #include <vector>
      64                 :            : #include <tools/urlobj.hxx>
      65                 :            : #include <comphelper/processfactory.hxx>
      66                 :            : #include <comphelper/string.hxx>
      67                 :            : #include <unotools/localfilehelper.hxx>
      68                 :            : #include <ucbhelper/content.hxx>
      69                 :            : #include <ucbhelper/commandenvironment.hxx>
      70                 :            : #include <vcl/msgbox.hxx>
      71                 :            : #include <rtl/math.hxx>
      72                 :            : #include <tools/config.hxx>
      73                 :            : #include <osl/mutex.hxx>
      74                 :            : #include <osl/conditn.hxx>
      75                 :            : #include <salhelper/timer.hxx>
      76                 :            : #include <vcl/svapp.hxx>
      77                 :            : #include <unotools/ucbhelper.hxx>
      78                 :            : #include <unotools/intlwrapper.hxx>
      79                 :            : #include <unotools/syslocale.hxx>
      80                 :            : #include <svl/urlfilter.hxx>
      81                 :            : #include <boost/ptr_container/ptr_set.hpp>
      82                 :            : 
      83                 :            : using namespace ::com::sun::star::lang;
      84                 :            : using namespace ::com::sun::star::sdbc;
      85                 :            : using namespace ::com::sun::star::task;
      86                 :            : using namespace ::com::sun::star::ucb;
      87                 :            : using namespace ::com::sun::star::uno;
      88                 :            : using namespace ::com::sun::star::io;
      89                 :            : using namespace ::com::sun::star::beans;
      90                 :            : using namespace ::comphelper;
      91                 :            : using ::svt::SortingData_Impl;
      92                 :            : using ::svt::FolderDescriptor;
      93                 :            : using ::rtl::OUString;
      94                 :            : 
      95                 :            : #define ALL_FILES_FILTER    "*.*"
      96                 :            : 
      97                 :            : #define COLUMN_TITLE        1
      98                 :            : #define COLUMN_TYPE         2
      99                 :            : #define COLUMN_SIZE         3
     100                 :            : #define COLUMN_DATE         4
     101                 :            : 
     102                 :            : #define SEPARATOR_STR  "----------------------------------"
     103                 :            : 
     104                 :            : #define ROW_HEIGHT                17    // the height of a row has to be a little higher than the bitmap
     105                 :            : #define QUICK_SEARCH_TIMEOUT    1500    // time in mSec before the quicksearch string will be reseted
     106                 :            : 
     107                 :            : namespace
     108                 :            : {
     109                 :            :     //====================================================================
     110                 :            :     //= ITimeoutHandler
     111                 :            :     //====================================================================
     112                 :            :     class CallbackTimer;
     113                 :          0 :     class ITimeoutHandler
     114                 :            :     {
     115                 :            :     public:
     116                 :            :         virtual void onTimeout( CallbackTimer* _pInstigator ) = 0;
     117                 :            : 
     118                 :            :     protected:
     119                 :          0 :         ~ITimeoutHandler() {}
     120                 :            :     };
     121                 :            : 
     122                 :            :     //====================================================================
     123                 :            :     //= CallbackTimer
     124                 :            :     //====================================================================
     125         [ #  # ]:          0 :     class CallbackTimer : public ::salhelper::Timer
     126                 :            :     {
     127                 :            :     protected:
     128                 :            :         ITimeoutHandler* m_pTimeoutHandler;
     129                 :            : 
     130                 :            :     public:
     131                 :          0 :         CallbackTimer( ITimeoutHandler* _pHandler ) : m_pTimeoutHandler( _pHandler ) { }
     132                 :            : 
     133                 :            :     protected:
     134                 :            :         virtual void SAL_CALL onShot();
     135                 :            :     };
     136                 :            : 
     137                 :            :     //--------------------------------------------------------------------
     138                 :          0 :     void SAL_CALL CallbackTimer::onShot()
     139                 :            :     {
     140                 :            :         OSL_ENSURE( m_pTimeoutHandler, "CallbackTimer::onShot: nobody interested in?" );
     141                 :          0 :         ITimeoutHandler* pHandler( m_pTimeoutHandler );
     142         [ #  # ]:          0 :         if ( pHandler )
     143                 :          0 :             pHandler->onTimeout( this );
     144                 :          0 :     }
     145                 :            : 
     146                 :            : }
     147                 :            : 
     148                 :            : // -----------------------------------------------------------------------
     149                 :            : 
     150                 :          0 : void FilterMatch::createWildCardFilterList(const String& _rFilterList,::std::vector< WildCard >& _rFilters)
     151                 :            : {
     152         [ #  # ]:          0 :     if( _rFilterList.Len() )
     153                 :            :     {
     154                 :            :         // filter is given
     155                 :          0 :         xub_StrLen nIndex = 0;
     156                 :          0 :         OUString sToken;
     157         [ #  # ]:          0 :         do
     158                 :            :         {
     159 [ #  # ][ #  # ]:          0 :             sToken = _rFilterList.GetToken( 0, ';', nIndex );
                 [ #  # ]
     160         [ #  # ]:          0 :             if ( !sToken.isEmpty() )
     161                 :            :             {
     162 [ #  # ][ #  # ]:          0 :                 _rFilters.push_back( WildCard( sToken.toAsciiUpperCase() ) );
                 [ #  # ]
     163                 :            :             }
     164                 :            :         }
     165                 :          0 :         while ( nIndex != STRING_NOTFOUND );
     166                 :            :     }
     167                 :            :     else
     168                 :            :     {
     169                 :            :         // no filter is given -> match all
     170 [ #  # ][ #  # ]:          0 :         _rFilters.push_back( WildCard(rtl::OUString("*")) );
                 [ #  # ]
     171                 :            :     }
     172                 :          0 : }
     173                 :            : // class ViewTabListBox_Impl ---------------------------------------------
     174                 :            : 
     175                 :            : class ViewTabListBox_Impl : public SvHeaderTabListBox
     176                 :            : {
     177                 :            : private:
     178                 :            :     Reference< XCommandEnvironment >    mxCmdEnv;
     179                 :            : 
     180                 :            :     ::osl::Mutex            maMutex;
     181                 :            :     HeaderBar*              mpHeaderBar;
     182                 :            :     SvtFileView_Impl*       mpParent;
     183                 :            :     Timer                   maResetQuickSearch;
     184                 :            :     OUString                maQuickSearchText;
     185                 :            :     String                  msAccessibleDescText;
     186                 :            :     String                  msFolder;
     187                 :            :     String                  msFile;
     188                 :            :     sal_uInt32              mnSearchIndex;
     189                 :            :     sal_Bool                mbResizeDisabled        : 1;
     190                 :            :     sal_Bool                mbAutoResize            : 1;
     191                 :            :     sal_Bool                mbEnableDelete          : 1;
     192                 :            :     sal_Bool                mbEnableRename          : 1;
     193                 :            :     bool                    mbShowHeader;
     194                 :            : 
     195                 :            :     void            DeleteEntries();
     196                 :            :     void            DoQuickSearch( const xub_Unicode& rChar );
     197                 :            :     sal_Bool        Kill( const OUString& rURL );
     198                 :            : 
     199                 :            : protected:
     200                 :            :     virtual sal_Bool            DoubleClickHdl();
     201                 :            :     virtual ::rtl::OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos ) const;
     202                 :            : 
     203                 :            : public:
     204                 :            :     ViewTabListBox_Impl( Window* pParentWin, SvtFileView_Impl* pParent, sal_Int16 nFlags );
     205                 :            :    ~ViewTabListBox_Impl();
     206                 :            : 
     207                 :            :     virtual void    Resize();
     208                 :            :     virtual void    KeyInput( const KeyEvent& rKEvt );
     209                 :            :     virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const rtl::OUString& rNewText );
     210                 :            : 
     211                 :            :     void            ClearAll();
     212                 :          0 :     HeaderBar*      GetHeaderBar() const { return mpHeaderBar; }
     213                 :            : 
     214                 :          0 :     void            EnableAutoResize() { mbAutoResize = sal_True; }
     215                 :          0 :     void            EnableDelete( sal_Bool bEnable ) { mbEnableDelete = bEnable; }
     216                 :          0 :     void            EnableRename( sal_Bool bEnable ) { mbEnableRename = bEnable; }
     217 [ #  # ][ #  # ]:          0 :     sal_Bool        IsDeleteOrContextMenuEnabled() { return mbEnableDelete || IsContextMenuHandlingEnabled(); }
     218                 :            : 
     219                 :          0 :     Reference< XCommandEnvironment >    GetCommandEnvironment() const { return mxCmdEnv; }
     220                 :            : 
     221                 :            :     DECL_LINK(ResetQuickSearch_Impl, void *);
     222                 :            : 
     223                 :            :     virtual PopupMenu*  CreateContextMenu( void );
     224                 :            :     virtual void        ExcecuteContextMenuAction( sal_uInt16 nSelectedPopentry );
     225                 :            : };
     226                 :            : 
     227                 :            : // class HashedEntry --------------------------------------------------
     228                 :            : 
     229                 :            : class HashedEntry
     230                 :            : {   // just a special String which can be compared on equality much faster
     231                 :            : protected:
     232                 :            :     OUString                maName;
     233                 :            :     sal_Int32               mnHashCode;
     234                 :            : public:
     235                 :            :     inline                  HashedEntry( const OUString& rName );
     236                 :            :     inline                  HashedEntry( const INetURLObject& rURL );
     237                 :            :     inline                  HashedEntry( const HashedEntry& rCopy );
     238                 :            :     virtual                 ~HashedEntry();
     239                 :            : 
     240                 :            :     inline bool operator    ==( const HashedEntry& rRef ) const;
     241                 :            :     inline bool operator    !=( const HashedEntry& rRef ) const;
     242                 :            :     inline bool operator    <( const HashedEntry& rRef ) const;
     243                 :            : 
     244                 :            :     inline const OUString&  GetName() const;
     245                 :            : };
     246                 :            : 
     247                 :          0 : inline HashedEntry::HashedEntry( const OUString& rName ): maName( rName ), mnHashCode( rName.hashCode() )
     248                 :            : {
     249                 :          0 : }
     250                 :            : 
     251                 :          0 : inline HashedEntry::HashedEntry( const INetURLObject& rURL ):
     252                 :            :     maName( rURL.GetMainURL( INetURLObject::NO_DECODE ) ),
     253                 :          0 :     mnHashCode( maName.hashCode() )
     254                 :            : {
     255                 :          0 : }
     256                 :            : 
     257                 :            : inline HashedEntry::HashedEntry( const HashedEntry& r ): maName( r.maName ), mnHashCode( r.mnHashCode )
     258                 :            : {
     259                 :            : }
     260                 :            : 
     261                 :          0 : HashedEntry::~HashedEntry()
     262                 :            : {
     263         [ #  # ]:          0 : }
     264                 :            : 
     265                 :          0 : inline bool HashedEntry::operator ==( const HashedEntry& rRef ) const
     266                 :            : {
     267 [ #  # ][ #  # ]:          0 :     return mnHashCode == rRef.mnHashCode && maName.reverseCompareTo( rRef.maName ) == 0;
     268                 :            : }
     269                 :            : 
     270                 :          0 : inline bool HashedEntry::operator !=( const HashedEntry& rRef ) const
     271                 :            : {
     272 [ #  # ][ #  # ]:          0 :     return mnHashCode != rRef.mnHashCode || maName.reverseCompareTo( rRef.maName ) != 0;
     273                 :            : }
     274                 :            : 
     275                 :          0 : inline bool HashedEntry::operator <( const HashedEntry& rRef ) const
     276                 :            : {
     277         [ #  # ]:          0 :     if( mnHashCode == rRef.mnHashCode )
     278                 :          0 :         return maName.reverseCompareTo( rRef.maName ) < 0;
     279                 :            :     else
     280                 :          0 :        return mnHashCode < rRef.mnHashCode;
     281                 :            : }
     282                 :            : 
     283                 :            : inline const OUString& HashedEntry::GetName() const
     284                 :            : {
     285                 :            :     return maName;
     286                 :            : }
     287                 :            : 
     288                 :            : // class HashedEntryList ----------------------------------------------
     289                 :            : // provides a list of _unique_ Entries
     290                 :          0 : class HashedEntryList : public boost::ptr_set<HashedEntry> {};
     291                 :            : 
     292                 :            : // class NameTranslationEntry -----------------------------------------
     293                 :            : 
     294         [ #  # ]:          0 : class NameTranslationEntry : public HashedEntry
     295                 :            : {// a fast compareble String and another String, which is used to get a substitution for a given String
     296                 :            : protected:
     297                 :            :     OUString                maTranslatedName;
     298                 :            : public:
     299                 :            :     inline                  NameTranslationEntry( const rtl::OUString& rOriginalName, const rtl::OUString& rTranslatedName );
     300                 :            :     inline                  NameTranslationEntry( const rtl::OString& rOriginalName, const rtl::OString& rTranslatedName );
     301                 :            : 
     302                 :            :     inline const OUString&  GetTranslation() const;
     303                 :            : };
     304                 :            : 
     305                 :            : inline NameTranslationEntry::NameTranslationEntry( const OUString& rOrg, const OUString& rTrans ):
     306                 :            :     HashedEntry( rOrg ),
     307                 :            :     maTranslatedName( rTrans )
     308                 :            : {
     309                 :            : }
     310                 :            : 
     311                 :          0 : inline NameTranslationEntry::NameTranslationEntry( const rtl::OString& rOrg, const rtl::OString& rTrans )
     312                 :            :     : HashedEntry(rtl::OStringToOUString(rOrg, RTL_TEXTENCODING_ASCII_US))
     313         [ #  # ]:          0 :     , maTranslatedName(rtl::OStringToOUString(rTrans, RTL_TEXTENCODING_UTF8))
     314                 :            : {
     315                 :          0 : }
     316                 :            : 
     317                 :          0 : inline const OUString& NameTranslationEntry::GetTranslation() const
     318                 :            : {
     319                 :          0 :     return maTranslatedName;
     320                 :            : }
     321                 :            : 
     322                 :            : // class NameTranslationList -----------------------------------------
     323                 :            : 
     324 [ #  # ][ #  # ]:          0 : class NameTranslationList : protected HashedEntryList
     325                 :            : {   // contains a list of substitutes of strings for a given folder (as URL)
     326                 :            :     // explanation of the circumstances see in remarks for Init();
     327                 :            : protected:
     328                 :            :     INetURLObject               maTransFile;    // URL of file with translation entries
     329                 :            :     HashedEntry                 maHashedURL;    // for future purposes when dealing with a set of cached
     330                 :            :                                                 //  NameTranslationLists
     331                 :            : private:
     332                 :            :     const String            maTransFileName;
     333                 :            :     void                    Init();             // reads the translation file and fills the (internal) list
     334                 :            : 
     335                 :            : public:
     336                 :            :                             NameTranslationList( const INetURLObject& rBaseURL );
     337                 :            :                                             // rBaseURL: path to folder for which the translation of the entries
     338                 :            :                                             //  should be done
     339                 :            : 
     340                 :            :     using HashedEntryList::operator==;
     341                 :            :     using HashedEntryList::operator!=;
     342                 :            :     inline bool operator       ==( const HashedEntry& rRef ) const;
     343                 :            :     inline bool operator       !=( const HashedEntry& rRef ) const;
     344                 :            : 
     345                 :            :     const OUString*             Translate( const OUString& rName ) const;
     346                 :            :                                             // returns NULL, if rName can't be found
     347                 :            : 
     348                 :            :     inline void                 Update();   // clears list and init
     349                 :            : 
     350                 :            :     inline const String&        GetTransTableFileName() const;
     351                 :            :                                             // returns the name for the file, which contains the translation strings
     352                 :            : };
     353                 :            : 
     354                 :          0 : inline const String& NameTranslationList::GetTransTableFileName() const
     355                 :            : {
     356                 :          0 :     return maTransFileName;
     357                 :            : }
     358                 :            : 
     359                 :          0 : void NameTranslationList::Init()
     360                 :            : {
     361                 :            : // Tries to read the file ".nametranslation.table" in the base folder. Complete path/name is in maTransFile.
     362                 :            : // Further on, the found entries in the section "TRANSLATIONNAMES" are used to replace names in the
     363                 :            : // base folder by translated ones. The translation must be given in UTF8
     364                 :            : // See examples of such a files in the samples-folder of an Office installation
     365                 :            : 
     366                 :            :     try
     367                 :            :     {
     368 [ #  # ][ #  # ]:          0 :         ::ucbhelper::Content aTestContent( maTransFile.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() );
     369                 :            : 
     370 [ #  # ][ #  # ]:          0 :         if( aTestContent.isDocument() )
     371                 :            :         {
     372                 :            :             // ... also tests the existence of maTransFile by throwing an Exception
     373 [ #  # ][ #  # ]:          0 :             String          aFsysName( maTransFile.getFSysPath( INetURLObject::FSYS_DETECT ) );
     374 [ #  # ][ #  # ]:          0 :             Config          aConfig( aFsysName );
     375                 :            : 
     376         [ #  # ]:          0 :             aConfig.SetGroup( rtl::OString(RTL_CONSTASCII_STRINGPARAM("TRANSLATIONNAMES")) );
     377                 :            : 
     378         [ #  # ]:          0 :             sal_uInt16          nKeyCnt = aConfig.GetKeyCount();
     379                 :            : 
     380         [ #  # ]:          0 :             for( sal_uInt16 nCnt = 0 ; nCnt < nKeyCnt ; ++nCnt )
     381 [ #  # ][ #  # ]:          0 :                 insert( new NameTranslationEntry( aConfig.GetKeyName( nCnt ), aConfig.ReadKey( nCnt ) ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     382 [ #  # ][ #  # ]:          0 :         }
     383                 :            :     }
     384                 :          0 :     catch( Exception const & ) {}
     385                 :          0 : }
     386                 :            : 
     387                 :          0 : NameTranslationList::NameTranslationList( const INetURLObject& rBaseURL ):
     388                 :            :     maTransFile( rBaseURL ),
     389                 :            :     maHashedURL( rBaseURL ),
     390 [ #  # ][ #  # ]:          0 :     maTransFileName( rtl::OUString(".nametranslation.table") )
                 [ #  # ]
     391                 :            : {
     392 [ #  # ][ #  # ]:          0 :     maTransFile.insertName( maTransFileName );
     393         [ #  # ]:          0 :     Init();
     394                 :          0 : }
     395                 :            : 
     396                 :            : inline bool NameTranslationList::operator ==( const HashedEntry& rRef ) const
     397                 :            : {
     398                 :            :     return maHashedURL == rRef;
     399                 :            : }
     400                 :            : 
     401                 :          0 : inline bool NameTranslationList::operator !=( const HashedEntry& rRef ) const
     402                 :            : {
     403                 :          0 :     return maHashedURL != rRef;
     404                 :            : }
     405                 :            : 
     406                 :          0 : const OUString* NameTranslationList::Translate( const OUString& rName ) const
     407                 :            : {
     408                 :          0 :     HashedEntry  aRef( rName );
     409                 :          0 :     const NameTranslationEntry* pSearch = NULL;
     410 [ #  # ][ #  # ]:          0 :     for( const_iterator it = begin(); it != end(); ++it )
         [ #  # ][ #  # ]
                 [ #  # ]
     411 [ #  # ][ #  # ]:          0 :         if( (*it) == aRef )
     412                 :            :         {
     413         [ #  # ]:          0 :             pSearch = static_cast<const NameTranslationEntry*>(&*it);
     414                 :            :         }
     415                 :            : 
     416         [ #  # ]:          0 :     return pSearch ? &pSearch->GetTranslation() : NULL;
     417                 :            : }
     418                 :            : 
     419                 :            : inline void NameTranslationList::Update()
     420                 :            : {
     421                 :            :     clear();
     422                 :            :     Init();
     423                 :            : }
     424                 :            : 
     425                 :            : // class NameTranslator_Impl ------------------------------------------
     426                 :            : 
     427                 :            : // enables the user to get string substitutions (translations for the content) for a given folder
     428                 :            : // see more explanations above in the description for NameTranslationList
     429                 :            : class NameTranslator_Impl : public ::svt::IContentTitleTranslation
     430                 :            : {
     431                 :            : private:
     432                 :            :     NameTranslationList*    mpActFolder;
     433                 :            : public:
     434                 :            :                             NameTranslator_Impl( const INetURLObject& rActualFolder );
     435                 :            :                             virtual ~NameTranslator_Impl();
     436                 :            : 
     437                 :            :      // IContentTitleTranslation
     438                 :            :     virtual sal_Bool        GetTranslation( const OUString& rOriginalName, OUString& rTranslatedName ) const;
     439                 :            : 
     440                 :            :     void                    SetActualFolder( const INetURLObject& rActualFolder );
     441                 :            :     const String*           GetTransTableFileName() const;
     442                 :            :                                             // returns the name for the file, which contains the translation strings
     443                 :            : };
     444                 :            : 
     445                 :            : //====================================================================
     446                 :            : //= SvtFileView_Impl
     447                 :            : //====================================================================
     448                 :            : 
     449                 :            : class SvtFileView_Impl  :public ::svt::IEnumerationResultHandler
     450                 :            :                         ,public ITimeoutHandler
     451                 :            : {
     452                 :            : protected:
     453                 :            :     SvtFileView*                mpAntiImpl;
     454                 :            :     Link                        m_aSelectHandler;
     455                 :            : 
     456                 :            :     ::rtl::Reference< ::svt::FileViewContentEnumerator >
     457                 :            :                                         m_pContentEnumerator;
     458                 :            :     Link                                m_aCurrentAsyncActionHandler;
     459                 :            :     ::osl::Condition                    m_aAsyncActionFinished;
     460                 :            :     ::rtl::Reference< ::salhelper::Timer > m_pCancelAsyncTimer;
     461                 :            :     ::svt::EnumerationResult            m_eAsyncActionResult;
     462                 :            :     bool                                m_bRunningAsyncAction;
     463                 :            :     bool                                m_bAsyncActionCancelled;
     464                 :            : 
     465                 :            : 
     466                 :            : public:
     467                 :            : 
     468                 :            :     ::std::vector< SortingData_Impl* >  maContent;
     469                 :            :     ::osl::Mutex                        maMutex;
     470                 :            : 
     471                 :            :     ViewTabListBox_Impl*    mpView;
     472                 :            :     NameTranslator_Impl*    mpNameTrans;
     473                 :            :     const IUrlFilter*       mpUrlFilter;
     474                 :            :     sal_uInt16              mnSortColumn;
     475                 :            :     sal_Bool                mbAscending     : 1;
     476                 :            :     sal_Bool                mbOnlyFolder    : 1;
     477                 :            :     sal_Bool                mbReplaceNames  : 1;    // translate folder names or display doc-title instead of file name
     478                 :            :     sal_Int16               mnSuspendSelectCallback : 1;
     479                 :            :     sal_Bool                mbIsFirstResort : 1;
     480                 :            : 
     481                 :            :     IntlWrapper             aIntlWrapper;
     482                 :            : 
     483                 :            :     String                  maViewURL;
     484                 :            :     String                  maAllFilter;
     485                 :            :     String                  maCurrentFilter;
     486                 :            :     Image                   maFolderImage;
     487                 :            :     Link                    maOpenDoneLink;
     488                 :            :     Reference< XCommandEnvironment >    mxCmdEnv;
     489                 :            : 
     490                 :            :     SvtFileView_Impl( SvtFileView* pAntiImpl, Reference < XCommandEnvironment > xEnv,
     491                 :            :                                               sal_Int16 nFlags,
     492                 :            :                                               sal_Bool bOnlyFolder );
     493                 :            :     virtual                ~SvtFileView_Impl();
     494                 :            : 
     495                 :            :     void                    Clear();
     496                 :            : 
     497                 :            :     FileViewResult          GetFolderContent_Impl(
     498                 :            :         const String& rFolder,
     499                 :            :         const FileViewAsyncAction* pAsyncDescriptor,
     500                 :            :         const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList = ::com::sun::star::uno::Sequence< ::rtl::OUString >() );
     501                 :            : 
     502                 :            :     FileViewResult          GetFolderContent_Impl(
     503                 :            :         const FolderDescriptor& _rFolder,
     504                 :            :         const FileViewAsyncAction* pAsyncDescriptor,
     505                 :            :         const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList = ::com::sun::star::uno::Sequence< ::rtl::OUString >());
     506                 :            :     void                    FilterFolderContent_Impl( const OUString &rFilter );
     507                 :            :     void                    CancelRunningAsyncAction();
     508                 :            : 
     509                 :            :     void                    OpenFolder_Impl();
     510                 :            :     // #83004# -------
     511                 :            :     void                        ReplaceTabWithString( OUString& aValue );
     512                 :            :     void                    CreateDisplayText_Impl();
     513                 :            :     void                    CreateVector_Impl( const Sequence < OUString > &rList );
     514                 :            :     void                    SortFolderContent_Impl();
     515                 :            : 
     516                 :            :     void                    EntryRemoved( const OUString& rURL );
     517                 :            :     void                    EntryRenamed( OUString& rURL,
     518                 :            :                                           const OUString& rName );
     519                 :            :     String                  FolderInserted( const OUString& rURL,
     520                 :            :                                             const OUString& rTitle );
     521                 :            : 
     522                 :            :     sal_uLong                   GetEntryPos( const OUString& rURL );
     523                 :            : 
     524                 :            :     inline void             EnableContextMenu( sal_Bool bEnable );
     525                 :            :     inline void             EnableDelete( sal_Bool bEnable );
     526                 :            : 
     527                 :            :     void                    Resort_Impl( sal_Int16 nColumn, sal_Bool bAscending );
     528                 :            :     sal_Bool                SearchNextEntry( sal_uInt32 &nIndex,
     529                 :            :                                              const OUString& rTitle,
     530                 :            :                                              sal_Bool bWrapAround );
     531                 :            : 
     532                 :            :     inline sal_Bool         EnableNameReplacing( sal_Bool bEnable = sal_True ); // returns false, if action wasn't possible
     533                 :            :     void                    SetActualFolder( const INetURLObject& rActualFolder );
     534                 :            : 
     535                 :            :     sal_Bool                GetDocTitle( const OUString& rTargetURL, OUString& rDocTitle ) const;
     536                 :            : 
     537                 :            :     void                    SetSelectHandler( const Link& _rHdl );
     538                 :            : 
     539                 :            :     void                    InitSelection();
     540                 :            :     void                    ResetCursor();
     541                 :            : 
     542                 :            :     inline void             EndEditing( bool _bCancel );
     543                 :            : 
     544                 :            : protected:
     545                 :            :     DECL_LINK( SelectionMultiplexer, void* );
     546                 :            : 
     547                 :            : protected:
     548                 :            :     // IEnumerationResultHandler overridables
     549                 :            :     virtual void        enumerationDone( ::svt::EnumerationResult _eResult );
     550                 :            :             void        implEnumerationSuccess();
     551                 :            : 
     552                 :            :     // ITimeoutHandler
     553                 :            :     virtual void onTimeout( CallbackTimer* _pInstigator );
     554                 :            : };
     555                 :            : 
     556                 :          0 : inline void SvtFileView_Impl::EnableContextMenu( sal_Bool bEnable )
     557                 :            : {
     558                 :          0 :     mpView->EnableContextMenuHandling( bEnable );
     559         [ #  # ]:          0 :     if( bEnable )
     560                 :          0 :         mbReplaceNames = sal_False;
     561                 :          0 : }
     562                 :            : 
     563                 :          0 : inline void SvtFileView_Impl::EnableDelete( sal_Bool bEnable )
     564                 :            : {
     565                 :          0 :     mpView->EnableDelete( bEnable );
     566         [ #  # ]:          0 :     if( bEnable )
     567                 :          0 :         mbReplaceNames = sal_False;
     568                 :          0 : }
     569                 :            : 
     570                 :          0 : inline sal_Bool SvtFileView_Impl::EnableNameReplacing( sal_Bool bEnable )
     571                 :            : {
     572                 :          0 :     mpView->EnableRename( bEnable );
     573                 :            : 
     574                 :            :     sal_Bool bRet;
     575         [ #  # ]:          0 :     if( mpView->IsDeleteOrContextMenuEnabled() )
     576                 :            :     {
     577                 :            :         DBG_ASSERT( !mbReplaceNames, "SvtFileView_Impl::EnableNameReplacing(): state should be not possible!" );
     578                 :          0 :         bRet = !bEnable; // only for enabling this is an unsuccessful result
     579                 :            :     }
     580                 :            :     else
     581                 :            :     {
     582                 :          0 :         mbReplaceNames = bEnable;
     583                 :          0 :         bRet = sal_True;
     584                 :            :     }
     585                 :            : 
     586                 :          0 :     return bRet;
     587                 :            : }
     588                 :            : 
     589                 :          0 : inline void SvtFileView_Impl::EndEditing( bool _bCancel )
     590                 :            : {
     591         [ #  # ]:          0 :     if ( mpView->IsEditingActive() )
     592                 :          0 :         mpView->EndEditing( _bCancel != false );
     593                 :          0 : }
     594                 :            : 
     595                 :            : // functions -------------------------------------------------------------
     596                 :            : 
     597                 :          0 : OUString CreateExactSizeText( sal_Int64 nSize )
     598                 :            : {
     599                 :          0 :     double fSize( ( double ) nSize );
     600                 :            :     int nDec;
     601                 :            : 
     602                 :          0 :     long nMega = 1024 * 1024;
     603                 :          0 :     long nGiga = nMega * 1024;
     604                 :            : 
     605                 :          0 :     rtl::OUString aUnitStr(' ');
     606                 :            : 
     607         [ #  # ]:          0 :     if ( nSize < 10000 )
     608                 :            :     {
     609 [ #  # ][ #  # ]:          0 :         aUnitStr += SVT_RESSTR(STR_SVT_BYTES );
     610                 :          0 :         nDec = 0;
     611                 :            :     }
     612         [ #  # ]:          0 :     else if ( nSize < nMega )
     613                 :            :     {
     614                 :          0 :         fSize /= 1024;
     615 [ #  # ][ #  # ]:          0 :         aUnitStr += SVT_RESSTR(STR_SVT_KB);
     616                 :          0 :         nDec = 1;
     617                 :            :     }
     618         [ #  # ]:          0 :     else if ( nSize < nGiga )
     619                 :            :     {
     620                 :          0 :         fSize /= nMega;
     621 [ #  # ][ #  # ]:          0 :         aUnitStr += SVT_RESSTR(STR_SVT_MB);
     622                 :          0 :         nDec = 2;
     623                 :            :     }
     624                 :            :     else
     625                 :            :     {
     626                 :          0 :         fSize /= nGiga;
     627 [ #  # ][ #  # ]:          0 :         aUnitStr += SVT_RESSTR(STR_SVT_GB);
     628                 :          0 :         nDec = 3;
     629                 :            :     }
     630                 :            : 
     631                 :            :     OUString aSizeStr( ::rtl::math::doubleToUString( fSize,
     632                 :            :                 rtl_math_StringFormat_F, nDec,
     633 [ #  # ][ #  # ]:          0 :                 SvtSysLocale().GetLocaleData().getNumDecimalSep()[0]) );
         [ #  # ][ #  # ]
     634                 :          0 :     aSizeStr += aUnitStr;
     635                 :            : 
     636                 :          0 :     return aSizeStr;
     637                 :            : }
     638                 :            : 
     639                 :            : // -----------------------------------------------------------------------
     640                 :            : // class ViewTabListBox_Impl ---------------------------------------------
     641                 :            : // -----------------------------------------------------------------------
     642                 :            : 
     643                 :          0 : ViewTabListBox_Impl::ViewTabListBox_Impl( Window* pParentWin,
     644                 :            :                                           SvtFileView_Impl* pParent,
     645                 :            :                                           sal_Int16 nFlags ) :
     646                 :            : 
     647                 :            :     SvHeaderTabListBox( pParentWin, WB_TABSTOP ),
     648                 :            : 
     649                 :            :     mpHeaderBar         ( NULL ),
     650                 :            :     mpParent            ( pParent ),
     651                 :            :     msAccessibleDescText( SVT_RESSTR(STR_SVT_ACC_DESC_FILEVIEW) ),
     652                 :            :     msFolder            ( SVT_RESSTR(STR_SVT_ACC_DESC_FOLDER) ),
     653                 :            :     msFile              ( SVT_RESSTR(STR_SVT_ACC_DESC_FILE) ),
     654                 :            :     mnSearchIndex       ( 0 ),
     655                 :            :     mbResizeDisabled    ( sal_False ),
     656                 :            :     mbAutoResize        ( sal_False ),
     657                 :            :     mbEnableDelete      ( sal_True ),
     658                 :            :     mbEnableRename      ( sal_True ),
     659 [ #  # ][ #  # ]:          0 :     mbShowHeader        ( (nFlags & FILEVIEW_SHOW_NONE) == 0 )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     660                 :            : {
     661         [ #  # ]:          0 :     Size aBoxSize = pParentWin->GetSizePixel();
     662 [ #  # ][ #  # ]:          0 :     mpHeaderBar = new HeaderBar( pParentWin, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
     663 [ #  # ][ #  # ]:          0 :     mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), mpHeaderBar->CalcWindowSizePixel() );
     664                 :            : 
     665                 :          0 :     HeaderBarItemBits nBits = ( HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE );
     666         [ #  # ]:          0 :     if (nFlags & FILEVIEW_SHOW_ONLYTITLE)
     667                 :            :     {
     668                 :          0 :         long pTabs[] = { 2, 20, 600 };
     669         [ #  # ]:          0 :         SetTabs(&pTabs[0], MAP_PIXEL);
     670                 :            : 
     671 [ #  # ][ #  # ]:          0 :         mpHeaderBar->InsertItem(COLUMN_TITLE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_TITLE), 600, nBits | HIB_UPARROW);
         [ #  # ][ #  # ]
                 [ #  # ]
     672                 :            :     }
     673                 :            :     else
     674                 :            :     {
     675                 :          0 :         long pTabs[] = { 5, 20, 180, 320, 400, 600 };
     676         [ #  # ]:          0 :         SetTabs(&pTabs[0], MAP_PIXEL);
     677         [ #  # ]:          0 :         SetTabJustify(2, AdjustRight); // column "Size"
     678                 :            : 
     679 [ #  # ][ #  # ]:          0 :         mpHeaderBar->InsertItem(COLUMN_TITLE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_TITLE), 180, nBits | HIB_UPARROW);
         [ #  # ][ #  # ]
                 [ #  # ]
     680 [ #  # ][ #  # ]:          0 :         mpHeaderBar->InsertItem(COLUMN_TYPE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_TYPE), 140, nBits);
         [ #  # ][ #  # ]
                 [ #  # ]
     681 [ #  # ][ #  # ]:          0 :         mpHeaderBar->InsertItem(COLUMN_SIZE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_SIZE), 80, nBits);
         [ #  # ][ #  # ]
                 [ #  # ]
     682 [ #  # ][ #  # ]:          0 :         mpHeaderBar->InsertItem(COLUMN_DATE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_DATE), 500, nBits);
         [ #  # ][ #  # ]
                 [ #  # ]
     683                 :            :     }
     684                 :            : 
     685         [ #  # ]:          0 :     Size aHeadSize = mpHeaderBar->GetSizePixel();
     686                 :          0 :     SetPosSizePixel( Point( 0, aHeadSize.Height() ),
     687         [ #  # ]:          0 :                      Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
     688         [ #  # ]:          0 :     InitHeaderBar( mpHeaderBar );
     689         [ #  # ]:          0 :     SetHighlightRange();
     690         [ #  # ]:          0 :     SetEntryHeight( ROW_HEIGHT );
     691         [ #  # ]:          0 :     if (nFlags & FILEVIEW_MULTISELECTION)
     692         [ #  # ]:          0 :         SetSelectionMode( MULTIPLE_SELECTION );
     693                 :            : 
     694         [ #  # ]:          0 :     Show();
     695         [ #  # ]:          0 :     if( mbShowHeader )
     696         [ #  # ]:          0 :         mpHeaderBar->Show();
     697                 :            : 
     698         [ #  # ]:          0 :     maResetQuickSearch.SetTimeout( QUICK_SEARCH_TIMEOUT );
     699         [ #  # ]:          0 :     maResetQuickSearch.SetTimeoutHdl( LINK( this, ViewTabListBox_Impl, ResetQuickSearch_Impl ) );
     700                 :            : 
     701         [ #  # ]:          0 :     Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
     702                 :            :     Reference< XInteractionHandler > xInteractionHandler = Reference< XInteractionHandler > (
     703 [ #  # ][ #  # ]:          0 :                xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uui.InteractionHandler") ) ), UNO_QUERY );
         [ #  # ][ #  # ]
     704                 :            : 
     705 [ #  # ][ #  # ]:          0 :     mxCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
                 [ #  # ]
     706                 :            : 
     707         [ #  # ]:          0 :     EnableContextMenuHandling();
     708                 :          0 : }
     709                 :            : 
     710                 :            : // -----------------------------------------------------------------------
     711                 :            : 
     712 [ #  # ][ #  # ]:          0 : ViewTabListBox_Impl::~ViewTabListBox_Impl()
         [ #  # ][ #  # ]
                 [ #  # ]
     713                 :            : {
     714         [ #  # ]:          0 :     maResetQuickSearch.Stop();
     715                 :            : 
     716 [ #  # ][ #  # ]:          0 :     delete mpHeaderBar;
     717         [ #  # ]:          0 : }
     718                 :            : 
     719                 :            : // -----------------------------------------------------------------------
     720                 :            : 
     721                 :          0 : IMPL_LINK_NOARG(ViewTabListBox_Impl, ResetQuickSearch_Impl)
     722                 :            : {
     723         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
     724                 :            : 
     725                 :          0 :     maQuickSearchText = OUString();
     726                 :          0 :     mnSearchIndex = 0;
     727                 :            : 
     728         [ #  # ]:          0 :     return 0;
     729                 :            : }
     730                 :            : 
     731                 :            : // -----------------------------------------------------------------------
     732                 :            : 
     733                 :          0 : void ViewTabListBox_Impl::Resize()
     734                 :            : {
     735         [ #  # ]:          0 :     SvTabListBox::Resize();
     736         [ #  # ]:          0 :     Size aBoxSize = Control::GetParent()->GetOutputSizePixel();
     737                 :            : 
     738 [ #  # ][ #  # ]:          0 :     if ( mbResizeDisabled || !aBoxSize.Width() )
                 [ #  # ]
     739                 :          0 :         return;
     740                 :            : 
     741                 :          0 :     Size aBarSize;
     742         [ #  # ]:          0 :     if ( mbShowHeader )
     743                 :            :     {
     744         [ #  # ]:          0 :         aBarSize = mpHeaderBar->GetSizePixel();
     745 [ #  # ][ #  # ]:          0 :         aBarSize.Width() = mbAutoResize ? aBoxSize.Width() : GetSizePixel().Width();
         [ #  # ][ #  # ]
     746         [ #  # ]:          0 :         mpHeaderBar->SetSizePixel( aBarSize );
     747                 :            :     }
     748                 :            : 
     749         [ #  # ]:          0 :     if ( mbAutoResize )
     750                 :            :     {
     751                 :          0 :         mbResizeDisabled = sal_True;
     752                 :          0 :         SetPosSizePixel( Point( 0, aBarSize.Height() ),
     753         [ #  # ]:          0 :                         Size( aBoxSize.Width(), aBoxSize.Height() - aBarSize.Height() ) );
     754                 :          0 :         mbResizeDisabled = sal_False;
     755                 :            :     }
     756                 :            : }
     757                 :            : 
     758                 :            : // -----------------------------------------------------------------------
     759                 :            : 
     760                 :          0 : void ViewTabListBox_Impl::KeyInput( const KeyEvent& rKEvt )
     761                 :            : {
     762                 :          0 :     bool bHandled = false;
     763                 :            : 
     764                 :          0 :     const KeyCode& rKeyCode = rKEvt.GetKeyCode();
     765         [ #  # ]:          0 :     if ( 0 == rKeyCode.GetModifier() )
     766                 :            :     {
     767         [ #  # ]:          0 :         if ( rKeyCode.GetCode() == KEY_RETURN )
     768                 :            :         {
     769                 :          0 :             ResetQuickSearch_Impl( NULL );
     770                 :          0 :             GetDoubleClickHdl().Call( this );
     771                 :          0 :             bHandled = true;
     772                 :            :         }
     773 [ #  # ][ #  # ]:          0 :         else if ( ( rKeyCode.GetCode() == KEY_DELETE ) &&
                 [ #  # ]
     774                 :            :                   mbEnableDelete )
     775                 :            :         {
     776                 :          0 :             ResetQuickSearch_Impl( NULL );
     777                 :          0 :             DeleteEntries();
     778                 :          0 :             bHandled = true;
     779                 :            :         }
     780   [ #  #  #  # ]:          0 :         else if ( ( rKEvt.GetKeyCode().GetGroup() == KEYGROUP_NUM ) ||
                 [ #  # ]
     781                 :          0 :                   ( rKEvt.GetKeyCode().GetGroup() == KEYGROUP_ALPHA ) )
     782                 :            :         {
     783         [ #  # ]:          0 :             DoQuickSearch( rKEvt.GetCharCode() );
     784                 :          0 :             bHandled = true;
     785                 :            :         }
     786                 :            :     }
     787                 :            : 
     788         [ #  # ]:          0 :     if ( !bHandled )
     789                 :            :     {
     790                 :          0 :         ResetQuickSearch_Impl( NULL );
     791                 :          0 :         SvHeaderTabListBox::KeyInput( rKEvt );
     792                 :            :     }
     793                 :          0 : }
     794                 :            : 
     795                 :            : // -----------------------------------------------------------------------
     796                 :            : 
     797                 :          0 : PopupMenu* ViewTabListBox_Impl::CreateContextMenu( void )
     798                 :            : {
     799                 :          0 :     bool bEnableDelete = mbEnableDelete;
     800                 :          0 :     bool bEnableRename = mbEnableRename;
     801                 :            : 
     802 [ #  # ][ #  # ]:          0 :     if ( bEnableDelete || bEnableRename )
     803                 :            :     {
     804                 :          0 :         sal_Int32 nSelectedEntries = GetSelectionCount();
     805                 :          0 :         bEnableDelete &= nSelectedEntries > 0;
     806                 :          0 :         bEnableRename &= nSelectedEntries == 1;
     807                 :            :     }
     808                 :            : 
     809 [ #  # ][ #  # ]:          0 :     if ( bEnableDelete || bEnableRename )
     810                 :            :     {
     811                 :          0 :         SvLBoxEntry* pEntry = FirstSelected();
     812         [ #  # ]:          0 :         while ( pEntry )
     813                 :            :         {
     814         [ #  # ]:          0 :             ::ucbhelper::Content aCnt;
     815                 :            :             try
     816                 :            :             {
     817                 :            :                 OUString aURL( static_cast< SvtContentEntry * >(
     818                 :          0 :                     pEntry->GetUserData() )->maURL );
     819 [ #  # ][ #  # ]:          0 :                 aCnt = ::ucbhelper::Content( aURL, mxCmdEnv );
         [ #  # ][ #  # ]
     820                 :            :             }
     821         [ #  # ]:          0 :             catch( Exception const & )
     822                 :            :             {
     823                 :          0 :                 bEnableDelete = bEnableRename = false;
     824                 :            :             }
     825                 :            : 
     826         [ #  # ]:          0 :             if ( bEnableDelete )
     827                 :            :             {
     828                 :            :                 try
     829                 :            :                 {
     830         [ #  # ]:          0 :                     Reference< XCommandInfo > aCommands = aCnt.getCommands();
     831         [ #  # ]:          0 :                     if ( aCommands.is() )
     832                 :            :                         bEnableDelete
     833         [ #  # ]:          0 :                             = aCommands->hasCommandByName(
     834 [ #  # ][ #  # ]:          0 :                                 OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" )) );
     835                 :            :                     else
     836         [ #  # ]:          0 :                         bEnableDelete = false;
     837                 :            :                 }
     838         [ #  # ]:          0 :                 catch( Exception const & )
     839                 :            :                 {
     840                 :          0 :                     bEnableDelete = false;
     841                 :            :                 }
     842                 :            :             }
     843                 :            : 
     844         [ #  # ]:          0 :             if ( bEnableRename )
     845                 :            :             {
     846                 :            :                 try
     847                 :            :                 {
     848         [ #  # ]:          0 :                     Reference< XPropertySetInfo > aProps = aCnt.getProperties();
     849         [ #  # ]:          0 :                     if ( aProps.is() )
     850                 :            :                     {
     851                 :            :                         Property aProp
     852         [ #  # ]:          0 :                             = aProps->getPropertyByName(
     853 [ #  # ][ #  # ]:          0 :                                 OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" )) );
     854                 :            :                         bEnableRename
     855                 :          0 :                             = !( aProp.Attributes & PropertyAttribute::READONLY );
     856                 :            :                     }
     857                 :            :                     else
     858         [ #  # ]:          0 :                         bEnableRename = false;
     859                 :            :                 }
     860         [ #  # ]:          0 :                 catch( Exception const & )
     861                 :            :                 {
     862                 :          0 :                     bEnableRename = false;
     863                 :            :                 }
     864                 :            :             }
     865                 :            : 
     866                 :            :             pEntry = ( bEnableDelete || bEnableRename )
     867                 :          0 :                 ? NextSelected( pEntry )
     868 [ #  # ][ #  # ]:          0 :                 : 0;
                 [ #  # ]
     869         [ #  # ]:          0 :         }
     870                 :            :     }
     871                 :            : 
     872 [ #  # ][ #  # ]:          0 :     if ( bEnableDelete || bEnableRename )
     873                 :            :     {
     874                 :            :         PopupMenu * pRet
     875 [ #  # ][ #  # ]:          0 :             = new PopupMenu( SvtResId( RID_FILEVIEW_CONTEXTMENU ) );
     876                 :          0 :         pRet->EnableItem( MID_FILEVIEW_DELETE, bEnableDelete );
     877                 :          0 :         pRet->EnableItem( MID_FILEVIEW_RENAME, bEnableRename );
     878                 :          0 :         pRet->RemoveDisabledEntries( sal_True, sal_True );
     879                 :          0 :         return pRet;
     880                 :            :     }
     881                 :            : 
     882                 :          0 :     return NULL;
     883                 :            : }
     884                 :            : 
     885                 :            : // -----------------------------------------------------------------------
     886                 :            : 
     887                 :          0 : void ViewTabListBox_Impl::ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
     888                 :            : {
     889      [ #  #  # ]:          0 :     switch ( nSelectedPopupEntry )
     890                 :            :     {
     891                 :            :         case MID_FILEVIEW_DELETE :
     892                 :          0 :             DeleteEntries();
     893                 :          0 :             break;
     894                 :            : 
     895                 :            :         case MID_FILEVIEW_RENAME :
     896                 :          0 :             EditEntry( FirstSelected() );
     897                 :          0 :             break;
     898                 :            :     }
     899                 :          0 : }
     900                 :            : 
     901                 :            : // -----------------------------------------------------------------------
     902                 :            : 
     903                 :          0 : void ViewTabListBox_Impl::ClearAll()
     904                 :            : {
     905         [ #  # ]:          0 :     for ( sal_uInt16 i = 0; i < GetEntryCount(); ++i )
     906         [ #  # ]:          0 :         delete (SvtContentEntry*)GetEntry(i)->GetUserData();
     907                 :          0 :     Clear();
     908                 :          0 : }
     909                 :            : 
     910                 :            : // -----------------------------------------------------------------------
     911                 :          0 : void ViewTabListBox_Impl::DeleteEntries()
     912                 :            : {
     913                 :          0 :     svtools::QueryDeleteResult_Impl eResult = svtools::QUERYDELETE_YES;
     914         [ #  # ]:          0 :     SvLBoxEntry* pEntry = FirstSelected();
     915         [ #  # ]:          0 :     String aURL;
     916                 :            : 
     917                 :          0 :     rtl::OString sDialogPosition;
     918 [ #  # ][ #  # ]:          0 :     while ( pEntry && ( eResult != svtools::QUERYDELETE_CANCEL ) )
                 [ #  # ]
     919                 :            :     {
     920                 :          0 :         SvLBoxEntry *pCurEntry = pEntry;
     921         [ #  # ]:          0 :         pEntry = NextSelected( pEntry );
     922                 :            : 
     923         [ #  # ]:          0 :         if ( pCurEntry->GetUserData() )
     924         [ #  # ]:          0 :             aURL = ( (SvtContentEntry*)pCurEntry->GetUserData() )->maURL;
     925                 :            : 
     926         [ #  # ]:          0 :         if ( !aURL.Len() )
     927                 :          0 :             continue;
     928                 :            : 
     929                 :          0 :         bool canDelete = true;
     930                 :            :         try
     931                 :            :         {
     932 [ #  # ][ #  # ]:          0 :             ::ucbhelper::Content aCnt( aURL, mxCmdEnv );
     933         [ #  # ]:          0 :             Reference< XCommandInfo > aCommands = aCnt.getCommands();
     934         [ #  # ]:          0 :             if ( aCommands.is() )
     935                 :            :                 canDelete
     936         [ #  # ]:          0 :                     = aCommands->hasCommandByName(
     937 [ #  # ][ #  # ]:          0 :                         OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" )) );
     938                 :            :             else
     939 [ #  # ][ #  # ]:          0 :                 canDelete = false;
     940                 :            :         }
     941         [ #  # ]:          0 :         catch( Exception const & )
     942                 :            :         {
     943                 :          0 :             canDelete = false;
     944                 :            :         }
     945                 :            : 
     946         [ #  # ]:          0 :         if (!canDelete)
     947                 :          0 :             continue; // process next entry
     948                 :            : 
     949         [ #  # ]:          0 :         if ( eResult != svtools::QUERYDELETE_ALL )
     950                 :            :         {
     951 [ #  # ][ #  # ]:          0 :             INetURLObject aObj( aURL );
     952 [ #  # ][ #  # ]:          0 :             svtools::QueryDeleteDlg_Impl aDlg( NULL, aObj.GetName( INetURLObject::DECODE_WITH_CHARSET ) );
         [ #  # ][ #  # ]
     953         [ #  # ]:          0 :             if ( sDialogPosition.getLength() )
     954         [ #  # ]:          0 :                 aDlg.SetWindowState( sDialogPosition );
     955                 :            : 
     956         [ #  # ]:          0 :             if ( GetSelectionCount() > 1 )
     957         [ #  # ]:          0 :                 aDlg.EnableAllButton();
     958                 :            : 
     959 [ #  # ][ #  # ]:          0 :             if ( aDlg.Execute() == RET_OK )
     960                 :          0 :                 eResult = aDlg.GetResult();
     961                 :            :             else
     962                 :          0 :                 eResult = svtools::QUERYDELETE_CANCEL;
     963                 :            : 
     964 [ #  # ][ #  # ]:          0 :             sDialogPosition = aDlg.GetWindowState( );
                 [ #  # ]
     965                 :            :         }
     966                 :            : 
     967 [ #  # ][ #  # ]:          0 :         if ( ( eResult == svtools::QUERYDELETE_ALL ) ||
     968                 :            :              ( eResult == svtools::QUERYDELETE_YES ) )
     969                 :            :         {
     970 [ #  # ][ #  # ]:          0 :             if ( Kill( aURL ) )
                 [ #  # ]
     971                 :            :             {
     972         [ #  # ]:          0 :                 delete (SvtContentEntry*)pCurEntry->GetUserData();
     973         [ #  # ]:          0 :                 GetModel()->Remove( pCurEntry );
     974 [ #  # ][ #  # ]:          0 :                 mpParent->EntryRemoved( aURL );
     975                 :            :             }
     976                 :            :         }
     977         [ #  # ]:          0 :     }
     978                 :          0 : }
     979                 :            : 
     980                 :            : // -----------------------------------------------------------------------
     981                 :          0 : sal_Bool ViewTabListBox_Impl::EditedEntry( SvLBoxEntry* pEntry,
     982                 :            :                                  const rtl::OUString& rNewText )
     983                 :            : {
     984                 :          0 :     sal_Bool bRet = sal_False;
     985                 :            : 
     986                 :          0 :     OUString aURL;
     987                 :          0 :     SvtContentEntry* pData = (SvtContentEntry*)pEntry->GetUserData();
     988                 :            : 
     989         [ #  # ]:          0 :     if ( pData )
     990                 :          0 :         aURL = OUString( pData->maURL );
     991                 :            : 
     992         [ #  # ]:          0 :     if ( aURL.isEmpty() )
     993                 :          0 :         return bRet;
     994                 :            : 
     995                 :            :     try
     996                 :            :     {
     997         [ #  # ]:          0 :         OUString aPropName( RTL_CONSTASCII_USTRINGPARAM( "Title" ));
     998                 :          0 :         bool canRename = true;
     999         [ #  # ]:          0 :         ::ucbhelper::Content aContent( aURL, mxCmdEnv );
    1000                 :            : 
    1001                 :            :         try
    1002                 :            :         {
    1003         [ #  # ]:          0 :             Reference< XPropertySetInfo > aProps = aContent.getProperties();
    1004         [ #  # ]:          0 :             if ( aProps.is() )
    1005                 :            :             {
    1006 [ #  # ][ #  # ]:          0 :                 Property aProp = aProps->getPropertyByName( aPropName );
    1007                 :          0 :                 canRename = !( aProp.Attributes & PropertyAttribute::READONLY );
    1008                 :            :             }
    1009                 :            :             else
    1010                 :            :             {
    1011                 :          0 :                 canRename = false;
    1012         [ #  # ]:          0 :             }
    1013                 :            :         }
    1014         [ #  # ]:          0 :         catch ( Exception const & )
    1015                 :            :         {
    1016                 :          0 :             canRename = false;
    1017                 :            :         }
    1018                 :            : 
    1019         [ #  # ]:          0 :         if ( canRename )
    1020                 :            :         {
    1021                 :          0 :             Any aValue;
    1022         [ #  # ]:          0 :             aValue <<= rNewText;
    1023         [ #  # ]:          0 :             aContent.setPropertyValue( aPropName, aValue );
    1024         [ #  # ]:          0 :             mpParent->EntryRenamed( aURL, rNewText );
    1025                 :            : 
    1026                 :          0 :             pData->maURL = aURL;
    1027                 :          0 :             pEntry->SetUserData( pData );
    1028                 :            : 
    1029                 :          0 :             bRet = sal_True;
    1030 [ #  # ][ #  # ]:          0 :         }
    1031                 :            :     }
    1032         [ #  # ]:          0 :     catch( Exception const & )
    1033                 :            :     {
    1034                 :            :     }
    1035                 :            : 
    1036                 :          0 :     return bRet;
    1037                 :            : }
    1038                 :            : 
    1039                 :            : // -----------------------------------------------------------------------
    1040                 :          0 : void ViewTabListBox_Impl::DoQuickSearch( const xub_Unicode& rChar )
    1041                 :            : {
    1042         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    1043                 :            : 
    1044         [ #  # ]:          0 :     maResetQuickSearch.Stop();
    1045                 :            : 
    1046                 :          0 :     OUString    aLastText = maQuickSearchText;
    1047                 :          0 :     sal_uInt32  aLastPos = mnSearchIndex;
    1048                 :          0 :     sal_Bool    bFound = sal_False;
    1049                 :            : 
    1050                 :          0 :     maQuickSearchText += OUString(rChar).toAsciiLowerCase();
    1051                 :            : 
    1052         [ #  # ]:          0 :     bFound = mpParent->SearchNextEntry( mnSearchIndex, maQuickSearchText, sal_False );
    1053                 :            : 
    1054         [ #  # ]:          0 :     if ( !bFound && ( aLastText.getLength() == 1 ) &&
           [ #  #  #  # ]
                 [ #  # ]
    1055         [ #  # ]:          0 :          ( aLastText == OUString(rChar) ) )
    1056                 :            :     {
    1057                 :          0 :         mnSearchIndex = aLastPos + 1;
    1058                 :          0 :         maQuickSearchText = aLastText;
    1059         [ #  # ]:          0 :         bFound = mpParent->SearchNextEntry( mnSearchIndex, maQuickSearchText, sal_True );
    1060                 :            :     }
    1061                 :            : 
    1062         [ #  # ]:          0 :     if ( bFound )
    1063                 :            :     {
    1064         [ #  # ]:          0 :         SvLBoxEntry* pEntry = GetEntry( mnSearchIndex );
    1065         [ #  # ]:          0 :         if ( pEntry )
    1066                 :            :         {
    1067         [ #  # ]:          0 :             SelectAll( sal_False );
    1068         [ #  # ]:          0 :             Select( pEntry );
    1069         [ #  # ]:          0 :             SetCurEntry( pEntry );
    1070         [ #  # ]:          0 :             MakeVisible( pEntry );
    1071                 :            :         }
    1072                 :            :         else
    1073                 :          0 :             bFound = sal_False;
    1074                 :            :     }
    1075                 :            : 
    1076 [ #  # ][ #  # ]:          0 :     maResetQuickSearch.Start();
    1077                 :          0 : }
    1078                 :            : 
    1079                 :            : // -----------------------------------------------------------------------
    1080                 :          0 : sal_Bool ViewTabListBox_Impl::DoubleClickHdl()
    1081                 :            : {
    1082                 :          0 :     SvHeaderTabListBox::DoubleClickHdl();
    1083                 :          0 :     return sal_False;
    1084                 :            :         // this means "do no additional handling". Especially this means that the SvImpLBox does not
    1085                 :            :         // recognize that the entry at the double click position change after the handler call (which is
    1086                 :            :         // the case if in the handler, our content was replaced)
    1087                 :            :         // If it _would_ recognize this change, it would take this as a reason to select the entry, again
    1088                 :            :         // - which is not what in the case of content replace
    1089                 :            :         // (I really doubt that this behaviour of the SvImpLBox does make any sense at all, but
    1090                 :            :         // who knows ...)
    1091                 :            : }
    1092                 :            : 
    1093                 :          0 : ::rtl::OUString ViewTabListBox_Impl::GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos ) const
    1094                 :            : {
    1095                 :          0 :     ::rtl::OUString sRet = SvHeaderTabListBox::GetAccessibleObjectDescription( _eType, _nPos );
    1096         [ #  # ]:          0 :     if ( ::svt::BBTYPE_TABLECELL == _eType )
    1097                 :            :     {
    1098                 :          0 :         sal_Int32 nRow = -1;
    1099         [ #  # ]:          0 :         const sal_uInt16 nColumnCount = GetColumnCount();
    1100         [ #  # ]:          0 :         if (nColumnCount > 0)
    1101                 :          0 :             nRow = _nPos / nColumnCount;
    1102         [ #  # ]:          0 :         SvLBoxEntry* pEntry = GetEntry( nRow );
    1103         [ #  # ]:          0 :         if ( pEntry )
    1104                 :            :         {
    1105                 :          0 :             SvtContentEntry* pData = (SvtContentEntry*)pEntry->GetUserData();
    1106         [ #  # ]:          0 :             if ( pData )
    1107                 :            :             {
    1108         [ #  # ]:          0 :                 const String sVar1( RTL_CONSTASCII_USTRINGPARAM( "%1" ) );
    1109         [ #  # ]:          0 :                 const String sVar2( RTL_CONSTASCII_USTRINGPARAM( "%2" ) );
    1110         [ #  # ]:          0 :                 String aText( msAccessibleDescText );
    1111 [ #  # ][ #  # ]:          0 :                 aText.SearchAndReplace( sVar1, pData->mbIsFolder ? msFolder : msFile );
    1112 [ #  # ][ #  # ]:          0 :                 aText.SearchAndReplace( sVar2, pData->maURL );
                 [ #  # ]
    1113 [ #  # ][ #  # ]:          0 :                 sRet += ::rtl::OUString( aText );
         [ #  # ][ #  # ]
    1114                 :            :             }
    1115                 :            :         }
    1116                 :            :     }
    1117                 :            : 
    1118                 :          0 :     return sRet;
    1119                 :            : }
    1120                 :            : 
    1121                 :            : // -----------------------------------------------------------------------
    1122                 :          0 : sal_Bool ViewTabListBox_Impl::Kill( const OUString& rContent )
    1123                 :            : {
    1124                 :          0 :     sal_Bool bRet = sal_True;
    1125                 :            : 
    1126                 :            :     try
    1127                 :            :     {
    1128         [ #  # ]:          0 :         ::ucbhelper::Content aCnt( rContent, mxCmdEnv );
    1129 [ #  # ][ #  # ]:          0 :         aCnt.executeCommand( OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" )), makeAny( sal_Bool( sal_True ) ) );
         [ #  # ][ #  # ]
              [ #  #  # ]
    1130                 :            :     }
    1131                 :          0 :     catch( ::com::sun::star::ucb::CommandAbortedException const & )
    1132                 :            :     {
    1133                 :            :         DBG_WARNING( "CommandAbortedException" );
    1134                 :          0 :         bRet = sal_False;
    1135                 :            :     }
    1136                 :          0 :     catch( Exception const & )
    1137                 :            :     {
    1138                 :            :         DBG_WARNING( "Any other exception" );
    1139                 :          0 :         bRet = sal_False;
    1140                 :            :     }
    1141                 :            : 
    1142                 :          0 :     return bRet;
    1143                 :            : }
    1144                 :            : 
    1145                 :            : 
    1146                 :            : 
    1147                 :            : 
    1148                 :            : // -----------------------------------------------------------------------
    1149                 :            : // class SvtFileView -----------------------------------------------------
    1150                 :            : // -----------------------------------------------------------------------
    1151                 :            : 
    1152                 :          0 : SvtFileView::SvtFileView( Window* pParent, const ResId& rResId,
    1153                 :            :                           sal_Bool bOnlyFolder, sal_Bool bMultiSelection ) :
    1154                 :            : 
    1155         [ #  # ]:          0 :     Control( pParent, rResId )
    1156                 :            : {
    1157                 :          0 :     sal_Int8 nFlags = 0;
    1158         [ #  # ]:          0 :     if ( bOnlyFolder )
    1159                 :          0 :         nFlags |= FILEVIEW_ONLYFOLDER;
    1160         [ #  # ]:          0 :     if ( bMultiSelection )
    1161                 :          0 :         nFlags |= FILEVIEW_MULTISELECTION;
    1162                 :            : 
    1163                 :            :     Reference< XInteractionHandler > xInteractionHandler = Reference< XInteractionHandler > (
    1164 [ #  # ][ #  # ]:          0 :         ::comphelper::getProcessServiceFactory()->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uui.InteractionHandler") ) ), UNO_QUERY );
         [ #  # ][ #  # ]
                 [ #  # ]
    1165 [ #  # ][ #  # ]:          0 :     Reference < XCommandEnvironment > xCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
                 [ #  # ]
    1166                 :            : 
    1167 [ #  # ][ #  # ]:          0 :     mpImp = new SvtFileView_Impl( this, xCmdEnv, nFlags, bOnlyFolder );
    1168         [ #  # ]:          0 :     mpImp->mpView->ForbidEmptyText();
    1169                 :          0 :     SetSortColumn( true );
    1170                 :            : 
    1171                 :          0 :     HeaderBar* pHeaderBar = mpImp->mpView->GetHeaderBar();
    1172         [ #  # ]:          0 :     pHeaderBar->SetSelectHdl( LINK( this, SvtFileView, HeaderSelect_Impl ) );
    1173         [ #  # ]:          0 :     pHeaderBar->SetEndDragHdl( LINK( this, SvtFileView, HeaderEndDrag_Impl ) );
    1174                 :          0 : }
    1175                 :            : 
    1176                 :          0 : SvtFileView::SvtFileView( Window* pParent, const ResId& rResId, sal_uInt8 nFlags ) :
    1177                 :            : 
    1178         [ #  # ]:          0 :     Control( pParent, rResId )
    1179                 :            : {
    1180                 :            :     Reference< XInteractionHandler > xInteractionHandler = Reference< XInteractionHandler > (
    1181 [ #  # ][ #  # ]:          0 :         ::comphelper::getProcessServiceFactory()->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uui.InteractionHandler") ) ), UNO_QUERY );
         [ #  # ][ #  # ]
                 [ #  # ]
    1182 [ #  # ][ #  # ]:          0 :     Reference < XCommandEnvironment > xCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() );
                 [ #  # ]
    1183                 :            : 
    1184 [ #  # ][ #  # ]:          0 :     mpImp = new SvtFileView_Impl( this, xCmdEnv, nFlags, nFlags & FILEVIEW_ONLYFOLDER );
    1185                 :            : 
    1186                 :          0 :     SetSortColumn( (nFlags & FILEVIEW_SHOW_NONE) == 0 );
    1187                 :            : 
    1188                 :          0 :     HeaderBar *pHeaderBar = mpImp->mpView->GetHeaderBar();
    1189         [ #  # ]:          0 :     pHeaderBar->SetSelectHdl( LINK( this, SvtFileView, HeaderSelect_Impl ) );
    1190         [ #  # ]:          0 :     pHeaderBar->SetEndDragHdl( LINK( this, SvtFileView, HeaderEndDrag_Impl ) );
    1191                 :          0 : }
    1192                 :            : 
    1193                 :            : // -----------------------------------------------------------------------
    1194                 :            : 
    1195         [ #  # ]:          0 : SvtFileView::~SvtFileView()
    1196                 :            : {
    1197                 :            :     // use temp pointer to prevent access of deleted member (GetFocus())
    1198                 :          0 :     SvtFileView_Impl* pTemp = mpImp;
    1199                 :          0 :     mpImp = NULL;
    1200 [ #  # ][ #  # ]:          0 :     delete pTemp;
    1201         [ #  # ]:          0 : }
    1202                 :            : 
    1203                 :            : // -----------------------------------------------------------------------
    1204                 :            : 
    1205                 :          0 : String SvtFileView::GetURL( SvLBoxEntry* pEntry ) const
    1206                 :            : {
    1207                 :          0 :     String aURL;
    1208 [ #  # ][ #  # ]:          0 :     if ( pEntry && pEntry->GetUserData() )
                 [ #  # ]
    1209         [ #  # ]:          0 :         aURL = ( (SvtContentEntry*)pEntry->GetUserData() )->maURL;
    1210                 :          0 :     return aURL;
    1211                 :            : }
    1212                 :            : 
    1213                 :            : // -----------------------------------------------------------------------
    1214                 :            : 
    1215                 :          0 : String SvtFileView::GetCurrentURL() const
    1216                 :            : {
    1217                 :          0 :     String aURL;
    1218         [ #  # ]:          0 :     SvLBoxEntry* pEntry = mpImp->mpView->FirstSelected();
    1219 [ #  # ][ #  # ]:          0 :     if ( pEntry && pEntry->GetUserData() )
                 [ #  # ]
    1220         [ #  # ]:          0 :         aURL = ( (SvtContentEntry*)pEntry->GetUserData() )->maURL;
    1221                 :          0 :     return aURL;
    1222                 :            : }
    1223                 :            : // -----------------------------------------------------------------------------
    1224                 :            : 
    1225                 :          0 : void SvtFileView::CreatedFolder( const String& rUrl, const String& rNewFolder )
    1226                 :            : {
    1227 [ #  # ][ #  # ]:          0 :     String sEntry = mpImp->FolderInserted( rUrl, rNewFolder );
                 [ #  # ]
    1228         [ #  # ]:          0 :     SvLBoxEntry* pEntry = mpImp->mpView->InsertEntry( sEntry, mpImp->maFolderImage, mpImp->maFolderImage );
    1229 [ #  # ][ #  # ]:          0 :     SvtContentEntry* pUserData = new SvtContentEntry( rUrl, sal_True );
    1230                 :          0 :     pEntry->SetUserData( pUserData );
    1231 [ #  # ][ #  # ]:          0 :     mpImp->mpView->MakeVisible( pEntry );
    1232                 :          0 : }
    1233                 :            : 
    1234                 :            : // -----------------------------------------------------------------------
    1235                 :            : 
    1236                 :          0 : FileViewResult SvtFileView::PreviousLevel( const FileViewAsyncAction* pAsyncDescriptor )
    1237                 :            : {
    1238                 :          0 :     FileViewResult eResult = eFailure;
    1239                 :            : 
    1240         [ #  # ]:          0 :     String sParentURL;
    1241 [ #  # ][ #  # ]:          0 :     if ( GetParentURL( sParentURL ) )
    1242         [ #  # ]:          0 :         eResult = Initialize( sParentURL, mpImp->maCurrentFilter, pAsyncDescriptor, mpBlackList );
    1243                 :            : 
    1244         [ #  # ]:          0 :     return eResult;
    1245                 :            : }
    1246                 :            : 
    1247                 :            : // -----------------------------------------------------------------------
    1248                 :            : 
    1249                 :          0 : sal_Bool SvtFileView::GetParentURL( String& rParentURL ) const
    1250                 :            : {
    1251                 :          0 :     sal_Bool bRet = sal_False;
    1252                 :            :     try
    1253                 :            :     {
    1254 [ #  # ][ #  # ]:          0 :         ::ucbhelper::Content aCnt( mpImp->maViewURL, mpImp->mxCmdEnv );
    1255         [ #  # ]:          0 :         Reference< XContent > xContent( aCnt.get() );
    1256         [ #  # ]:          0 :         Reference< com::sun::star::container::XChild > xChild( xContent, UNO_QUERY );
    1257         [ #  # ]:          0 :         if ( xChild.is() )
    1258                 :            :         {
    1259 [ #  # ][ #  # ]:          0 :             Reference< XContent > xParent( xChild->getParent(), UNO_QUERY );
                 [ #  # ]
    1260         [ #  # ]:          0 :             if ( xParent.is() )
    1261                 :            :             {
    1262 [ #  # ][ #  # ]:          0 :                 rParentURL = String( xParent->getIdentifier()->getContentIdentifier() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1263 [ #  # ][ #  # ]:          0 :                 bRet = ( rParentURL.Len() > 0 && rParentURL != mpImp->maViewURL );
                 [ #  # ]
    1264                 :          0 :             }
    1265 [ #  # ][ #  # ]:          0 :         }
    1266                 :            :     }
    1267                 :          0 :     catch( Exception const & )
    1268                 :            :     {
    1269                 :            :         // perhaps an unknown url protocol (e.g. "private:newdoc")
    1270                 :            :     }
    1271                 :            : 
    1272                 :          0 :     return bRet;
    1273                 :            : }
    1274                 :            : 
    1275                 :            : // -----------------------------------------------------------------------
    1276                 :            : 
    1277                 :          0 : const rtl::OString& SvtFileView::GetHelpId( ) const
    1278                 :            : {
    1279                 :          0 :     return mpImp->mpView->GetHelpId( );
    1280                 :            : }
    1281                 :            : 
    1282                 :            : // -----------------------------------------------------------------------
    1283                 :            : 
    1284                 :          0 : void SvtFileView::SetHelpId( const rtl::OString& rHelpId )
    1285                 :            : {
    1286                 :          0 :     mpImp->mpView->SetHelpId( rHelpId );
    1287                 :          0 : }
    1288                 :            : 
    1289                 :            : // -----------------------------------------------------------------------
    1290                 :            : 
    1291                 :          0 : void SvtFileView::SetSizePixel( const Size& rNewSize )
    1292                 :            : {
    1293                 :          0 :     Control::SetSizePixel( rNewSize );
    1294                 :          0 :     mpImp->mpView->SetSizePixel( rNewSize );
    1295                 :          0 : }
    1296                 :            : 
    1297                 :            : // -----------------------------------------------------------------------
    1298                 :            : 
    1299                 :          0 : void SvtFileView::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
    1300                 :            : {
    1301                 :          0 :     SetPosPixel( rNewPos );
    1302                 :          0 :     SetSizePixel( rNewSize );
    1303                 :          0 : }
    1304                 :            : 
    1305                 :            : // -----------------------------------------------------------------------------
    1306                 :          0 : sal_Bool SvtFileView::Initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent, const String& rFilter  )
    1307                 :            : {
    1308         [ #  # ]:          0 :     WaitObject aWaitCursor( this );
    1309                 :            : 
    1310         [ #  # ]:          0 :     mpImp->Clear();
    1311         [ #  # ]:          0 :     ::ucbhelper::Content aContent(_xContent, mpImp->mxCmdEnv );
    1312 [ #  # ][ #  # ]:          0 :     FileViewResult eResult = mpImp->GetFolderContent_Impl( FolderDescriptor( aContent ), NULL );
         [ #  # ][ #  # ]
                 [ #  # ]
    1313                 :            :     OSL_ENSURE( eResult != eStillRunning, "SvtFileView::Initialize: this was expected to be synchronous!" );
    1314         [ #  # ]:          0 :     if ( eResult != eSuccess )
    1315                 :          0 :         return sal_False;
    1316                 :            : 
    1317 [ #  # ][ #  # ]:          0 :     mpImp->FilterFolderContent_Impl( rFilter );
    1318                 :            : 
    1319         [ #  # ]:          0 :     mpImp->SortFolderContent_Impl(); // possibly not necessary!!!!!!!!!!
    1320         [ #  # ]:          0 :     mpImp->CreateDisplayText_Impl();
    1321         [ #  # ]:          0 :     mpImp->OpenFolder_Impl();
    1322                 :            : 
    1323         [ #  # ]:          0 :     mpImp->maOpenDoneLink.Call( this );
    1324 [ #  # ][ #  # ]:          0 :     return sal_True;
    1325                 :            : }
    1326                 :            : 
    1327                 :            : // -----------------------------------------------------------------------
    1328                 :          0 : FileViewResult SvtFileView::Initialize(
    1329                 :            :     const String& rURL,
    1330                 :            :     const String& rFilter,
    1331                 :            :     const FileViewAsyncAction* pAsyncDescriptor,
    1332                 :            :     const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList  )
    1333                 :            : {
    1334         [ #  # ]:          0 :     WaitObject aWaitCursor( this );
    1335         [ #  # ]:          0 :     mpBlackList = rBlackList;
    1336                 :            : 
    1337         [ #  # ]:          0 :     String sPushURL( mpImp->maViewURL );
    1338                 :            : 
    1339         [ #  # ]:          0 :     mpImp->maViewURL = rURL;
    1340         [ #  # ]:          0 :     FileViewResult eResult = ExecuteFilter( rFilter, pAsyncDescriptor );
    1341      [ #  #  # ]:          0 :     switch ( eResult )
    1342                 :            :     {
    1343                 :            :     case eFailure:
    1344                 :            :     case eTimeout:
    1345         [ #  # ]:          0 :         mpImp->maViewURL = sPushURL;
    1346                 :          0 :         return eResult;
    1347                 :            : 
    1348                 :            :     case eStillRunning:
    1349                 :            :         OSL_ENSURE( pAsyncDescriptor, "SvtFileView::Initialize: we told it to read synchronously!" );
    1350                 :            :     case eSuccess:
    1351                 :          0 :         return eResult;
    1352                 :            :     }
    1353                 :            : 
    1354                 :            :     OSL_FAIL( "SvtFileView::Initialize: unreachable!" );
    1355 [ #  # ][ #  # ]:          0 :     return eFailure;
    1356                 :            : }
    1357                 :            : 
    1358                 :            : // -----------------------------------------------------------------------
    1359                 :          0 : FileViewResult SvtFileView::Initialize(
    1360                 :            :     const String& rURL,
    1361                 :            :     const String& rFilter,
    1362                 :            :     const FileViewAsyncAction* pAsyncDescriptor )
    1363                 :            : {
    1364         [ #  # ]:          0 :     return Initialize( rURL, rFilter, pAsyncDescriptor, ::com::sun::star::uno::Sequence< ::rtl::OUString >());
    1365                 :            : }
    1366                 :            : 
    1367                 :            : // -----------------------------------------------------------------------
    1368                 :            : 
    1369                 :            : // -----------------------------------------------------------------------
    1370                 :          0 : sal_Bool SvtFileView::Initialize( const Sequence< OUString >& aContents )
    1371                 :            : {
    1372         [ #  # ]:          0 :     WaitObject aWaitCursor( this );
    1373                 :            : 
    1374 [ #  # ][ #  # ]:          0 :     mpImp->maViewURL = String();
                 [ #  # ]
    1375         [ #  # ]:          0 :     mpImp->maCurrentFilter = mpImp->maAllFilter;
    1376                 :            : 
    1377         [ #  # ]:          0 :     mpImp->Clear();
    1378         [ #  # ]:          0 :     mpImp->CreateVector_Impl( aContents );
    1379         [ #  # ]:          0 :     if( GetSortColumn() )
    1380         [ #  # ]:          0 :         mpImp->SortFolderContent_Impl();
    1381                 :            : 
    1382         [ #  # ]:          0 :     mpImp->OpenFolder_Impl();
    1383                 :            : 
    1384         [ #  # ]:          0 :     mpImp->maOpenDoneLink.Call( this );
    1385                 :            : 
    1386         [ #  # ]:          0 :     return sal_True;
    1387                 :            : }
    1388                 :            : 
    1389                 :            : // -----------------------------------------------------------------------
    1390                 :            : 
    1391                 :          0 : FileViewResult SvtFileView::ExecuteFilter( const String& rFilter, const FileViewAsyncAction* pAsyncDescriptor )
    1392                 :            : {
    1393                 :          0 :     mpImp->maCurrentFilter = rFilter;
    1394                 :          0 :     mpImp->maCurrentFilter.ToLowerAscii();
    1395                 :            : 
    1396                 :          0 :     mpImp->Clear();
    1397                 :          0 :     FileViewResult eResult = mpImp->GetFolderContent_Impl( mpImp->maViewURL, pAsyncDescriptor, mpBlackList );
    1398                 :            :     OSL_ENSURE( ( eResult != eStillRunning ) || pAsyncDescriptor, "SvtFileView::ExecuteFilter: we told it to read synchronously!" );
    1399                 :          0 :     return eResult;
    1400                 :            : }
    1401                 :            : 
    1402                 :            : // -----------------------------------------------------------------------
    1403                 :            : 
    1404                 :          0 : void SvtFileView::CancelRunningAsyncAction()
    1405                 :            : {
    1406                 :          0 :     mpImp->CancelRunningAsyncAction();
    1407                 :          0 : }
    1408                 :            : 
    1409                 :            : // -----------------------------------------------------------------------
    1410                 :            : 
    1411                 :          0 : void SvtFileView::SetNoSelection()
    1412                 :            : {
    1413                 :          0 :     mpImp->mpView->SelectAll( sal_False );
    1414                 :          0 : }
    1415                 :            : 
    1416                 :            : // -----------------------------------------------------------------------
    1417                 :            : 
    1418                 :          0 : void SvtFileView::GetFocus()
    1419                 :            : {
    1420                 :          0 :     Control::GetFocus();
    1421 [ #  # ][ #  # ]:          0 :     if ( mpImp && mpImp->mpView )
    1422                 :          0 :         mpImp->mpView->GrabFocus();
    1423                 :          0 : }
    1424                 :            : 
    1425                 :            : // -----------------------------------------------------------------------
    1426                 :            : 
    1427                 :          0 : void SvtFileView::SetSelectHdl( const Link& rHdl )
    1428                 :            : {
    1429                 :          0 :     mpImp->SetSelectHandler( rHdl );
    1430                 :          0 : }
    1431                 :            : 
    1432                 :            : // -----------------------------------------------------------------------
    1433                 :            : 
    1434                 :          0 : void SvtFileView::SetDoubleClickHdl( const Link& rHdl )
    1435                 :            : {
    1436                 :          0 :     mpImp->mpView->SetDoubleClickHdl( rHdl );
    1437                 :          0 : }
    1438                 :            : 
    1439                 :            : // -----------------------------------------------------------------------
    1440                 :            : 
    1441                 :          0 : sal_uLong SvtFileView::GetSelectionCount() const
    1442                 :            : {
    1443                 :          0 :     return mpImp->mpView->GetSelectionCount();
    1444                 :            : }
    1445                 :            : 
    1446                 :            : // -----------------------------------------------------------------------
    1447                 :            : 
    1448                 :          0 : SvLBoxEntry* SvtFileView::FirstSelected() const
    1449                 :            : {
    1450                 :          0 :     return mpImp->mpView->FirstSelected();
    1451                 :            : }
    1452                 :            : 
    1453                 :            : // -----------------------------------------------------------------------
    1454                 :            : 
    1455                 :          0 : SvLBoxEntry* SvtFileView::NextSelected( SvLBoxEntry* pEntry ) const
    1456                 :            : {
    1457                 :          0 :     return mpImp->mpView->NextSelected( pEntry );
    1458                 :            : }
    1459                 :            : 
    1460                 :            : // -----------------------------------------------------------------------
    1461                 :            : 
    1462                 :          0 : void SvtFileView::EnableAutoResize()
    1463                 :            : {
    1464                 :          0 :     mpImp->mpView->EnableAutoResize();
    1465                 :          0 : }
    1466                 :            : 
    1467                 :            : // -----------------------------------------------------------------------
    1468                 :            : 
    1469                 :          0 : void SvtFileView::SetFocus()
    1470                 :            : {
    1471                 :          0 :     mpImp->mpView->GrabFocus();
    1472                 :          0 : }
    1473                 :            : 
    1474                 :            : // -----------------------------------------------------------------------
    1475                 :          0 : const String& SvtFileView::GetViewURL() const
    1476                 :            : {
    1477                 :          0 :     return mpImp->maViewURL;
    1478                 :            : }
    1479                 :            : 
    1480                 :            : // -----------------------------------------------------------------------
    1481                 :          0 : void SvtFileView::SetOpenDoneHdl( const Link& rHdl )
    1482                 :            : {
    1483                 :          0 :     mpImp->maOpenDoneLink = rHdl;
    1484                 :          0 : }
    1485                 :            : 
    1486                 :            : // -----------------------------------------------------------------------
    1487                 :          0 : void SvtFileView::EnableContextMenu( sal_Bool bEnable )
    1488                 :            : {
    1489                 :          0 :     mpImp->EnableContextMenu( bEnable );
    1490                 :          0 : }
    1491                 :            : 
    1492                 :            : // -----------------------------------------------------------------------
    1493                 :          0 : void SvtFileView::EnableDelete( sal_Bool bEnable )
    1494                 :            : {
    1495                 :          0 :     mpImp->EnableDelete( bEnable );
    1496                 :          0 : }
    1497                 :            : 
    1498                 :          0 : void SvtFileView::EnableNameReplacing( sal_Bool bEnable )
    1499                 :            : {
    1500                 :          0 :     mpImp->EnableNameReplacing( bEnable );
    1501                 :          0 : }
    1502                 :            : 
    1503                 :            : // -----------------------------------------------------------------------
    1504                 :          0 : void SvtFileView::EndInplaceEditing( bool _bCancel )
    1505                 :            : {
    1506                 :          0 :     return mpImp->EndEditing( _bCancel );
    1507                 :            : }
    1508                 :            : 
    1509                 :            : // -----------------------------------------------------------------------
    1510                 :          0 : IMPL_LINK( SvtFileView, HeaderSelect_Impl, HeaderBar*, pBar )
    1511                 :            : {
    1512                 :            :     DBG_ASSERT( pBar, "no headerbar" );
    1513                 :          0 :     sal_uInt16 nItemID = pBar->GetCurItemId();
    1514                 :            : 
    1515                 :            :     HeaderBarItemBits nBits;
    1516                 :            : 
    1517                 :            :     // clear the arrow of the recently used column
    1518         [ #  # ]:          0 :     if ( nItemID != mpImp->mnSortColumn )
    1519                 :            :     {
    1520         [ #  # ]:          0 :         if ( !nItemID )
    1521                 :            :         {
    1522                 :            :             // first call -> remove arrow from title column,
    1523                 :            :             // because another column is the sort column
    1524                 :          0 :             nItemID = mpImp->mnSortColumn;
    1525                 :          0 :             mpImp->mnSortColumn = COLUMN_TITLE;
    1526                 :            :         }
    1527                 :          0 :         nBits = pBar->GetItemBits( mpImp->mnSortColumn );
    1528                 :          0 :         nBits &= ~( HIB_UPARROW | HIB_DOWNARROW );
    1529                 :          0 :         pBar->SetItemBits( mpImp->mnSortColumn, nBits );
    1530                 :            :     }
    1531                 :            : 
    1532                 :          0 :     nBits = pBar->GetItemBits( nItemID );
    1533                 :            : 
    1534                 :          0 :     sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
    1535                 :            : 
    1536         [ #  # ]:          0 :     if ( bUp )
    1537                 :            :     {
    1538                 :          0 :         nBits &= ~HIB_UPARROW;
    1539                 :          0 :         nBits |= HIB_DOWNARROW;
    1540                 :            :     }
    1541                 :            :     else
    1542                 :            :     {
    1543                 :          0 :         nBits &= ~HIB_DOWNARROW;
    1544                 :          0 :         nBits |= HIB_UPARROW;
    1545                 :            :     }
    1546                 :            : 
    1547                 :          0 :     pBar->SetItemBits( nItemID, nBits );
    1548                 :          0 :     mpImp->Resort_Impl( nItemID, !bUp );
    1549                 :          0 :     return 1;
    1550                 :            : }
    1551                 :            : 
    1552                 :            : // -----------------------------------------------------------------------
    1553                 :          0 : IMPL_LINK( SvtFileView, HeaderEndDrag_Impl, HeaderBar*, pBar )
    1554                 :            : {
    1555         [ #  # ]:          0 :     if ( !pBar->IsItemMode() )
    1556                 :            :     {
    1557                 :          0 :         Size aSize;
    1558         [ #  # ]:          0 :         sal_uInt16 nTabs = pBar->GetItemCount();
    1559                 :          0 :         long nTmpSize = 0;
    1560                 :            : 
    1561         [ #  # ]:          0 :         for ( sal_uInt16 i = 1; i <= nTabs; ++i )
    1562                 :            :         {
    1563         [ #  # ]:          0 :             long nWidth = pBar->GetItemSize(i);
    1564                 :          0 :             aSize.Width() =  nWidth + nTmpSize;
    1565                 :          0 :             nTmpSize += nWidth;
    1566         [ #  # ]:          0 :             mpImp->mpView->SetTab( i, aSize.Width(), MAP_PIXEL );
    1567                 :            :         }
    1568                 :            :     }
    1569                 :            : 
    1570                 :          0 :     return 0;
    1571                 :            : }
    1572                 :            : 
    1573                 :            : // -----------------------------------------------------------------------
    1574                 :          0 : String SvtFileView::GetConfigString() const
    1575                 :            : {
    1576                 :          0 :     String sRet;
    1577                 :          0 :     HeaderBar* pBar = mpImp->mpView->GetHeaderBar();
    1578                 :            :     DBG_ASSERT( pBar, "invalid headerbar" );
    1579                 :            : 
    1580                 :            :     // sort order
    1581 [ #  # ][ #  # ]:          0 :     sRet += String::CreateFromInt32( mpImp->mnSortColumn );
                 [ #  # ]
    1582         [ #  # ]:          0 :     sRet += ';';
    1583         [ #  # ]:          0 :     HeaderBarItemBits nBits = pBar->GetItemBits( mpImp->mnSortColumn );
    1584                 :          0 :     sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
    1585 [ #  # ][ #  # ]:          0 :     sRet += bUp ? '1' : '0';
    1586         [ #  # ]:          0 :     sRet += ';';
    1587                 :            : 
    1588         [ #  # ]:          0 :     sal_uInt16 nCount = pBar->GetItemCount();
    1589         [ #  # ]:          0 :     for ( sal_uInt16 i = 0; i < nCount; ++i )
    1590                 :            :     {
    1591         [ #  # ]:          0 :         sal_uInt16 nId = pBar->GetItemId(i);
    1592 [ #  # ][ #  # ]:          0 :         sRet += String::CreateFromInt32( nId );
                 [ #  # ]
    1593         [ #  # ]:          0 :         sRet += ';';
    1594 [ #  # ][ #  # ]:          0 :         sRet += String::CreateFromInt32( pBar->GetItemSize( nId ) );
         [ #  # ][ #  # ]
    1595         [ #  # ]:          0 :         sRet += ';';
    1596                 :            :     }
    1597                 :            : 
    1598 [ #  # ][ #  # ]:          0 :     sRet = comphelper::string::stripEnd(sRet, ';');
                 [ #  # ]
    1599                 :          0 :     return sRet;
    1600                 :            : }
    1601                 :            : 
    1602                 :            : // -----------------------------------------------------------------------
    1603                 :          0 : void SvtFileView::SetConfigString( const String& rCfgStr )
    1604                 :            : {
    1605                 :          0 :     HeaderBar* pBar = mpImp->mpView->GetHeaderBar();
    1606                 :            :     DBG_ASSERT( pBar, "invalid headerbar" );
    1607                 :            : 
    1608                 :          0 :     sal_uInt16 nIdx = 0;
    1609 [ #  # ][ #  # ]:          0 :     mpImp->mnSortColumn = (sal_uInt16)rCfgStr.GetToken( 0, ';', nIdx ).ToInt32();
                 [ #  # ]
    1610 [ #  # ][ #  # ]:          0 :     sal_Bool bUp = (sal_Bool)(sal_uInt16)rCfgStr.GetToken( 0, ';', nIdx ).ToInt32();
                 [ #  # ]
    1611         [ #  # ]:          0 :     HeaderBarItemBits nBits = pBar->GetItemBits( mpImp->mnSortColumn );
    1612                 :            : 
    1613         [ #  # ]:          0 :     if ( bUp )
    1614                 :            :     {
    1615                 :          0 :         nBits &= ~HIB_UPARROW;
    1616                 :          0 :         nBits |= HIB_DOWNARROW;
    1617                 :            :     }
    1618                 :            :     else
    1619                 :            :     {
    1620                 :          0 :         nBits &= ~HIB_DOWNARROW;
    1621                 :          0 :         nBits |= HIB_UPARROW;
    1622                 :            :     }
    1623         [ #  # ]:          0 :     pBar->SetItemBits( mpImp->mnSortColumn, nBits );
    1624                 :            : 
    1625         [ #  # ]:          0 :     while ( nIdx != STRING_NOTFOUND )
    1626                 :            :     {
    1627 [ #  # ][ #  # ]:          0 :         sal_uInt16 nItemId = (sal_uInt16)rCfgStr.GetToken( 0, ';', nIdx ).ToInt32();
                 [ #  # ]
    1628 [ #  # ][ #  # ]:          0 :         pBar->SetItemSize( nItemId, rCfgStr.GetToken( 0, ';', nIdx ).ToInt32() );
         [ #  # ][ #  # ]
    1629                 :            :     }
    1630                 :            : 
    1631         [ #  # ]:          0 :     HeaderSelect_Impl( pBar );
    1632         [ #  # ]:          0 :     HeaderEndDrag_Impl( pBar );
    1633                 :          0 : }
    1634                 :            : 
    1635                 :            : // -----------------------------------------------------------------------
    1636                 :          0 : void SvtFileView::SetUrlFilter( const IUrlFilter* _pFilter )
    1637                 :            : {
    1638                 :          0 :     mpImp->mpUrlFilter = _pFilter;
    1639                 :          0 : }
    1640                 :            : 
    1641                 :            : // -----------------------------------------------------------------------
    1642                 :          0 : void SvtFileView::StateChanged( StateChangedType nStateChange )
    1643                 :            : {
    1644         [ #  # ]:          0 :     if ( nStateChange == STATE_CHANGE_ENABLE )
    1645                 :          0 :         Invalidate();
    1646                 :          0 :     Control::StateChanged( nStateChange );
    1647                 :          0 : }
    1648                 :            : 
    1649                 :            : // -----------------------------------------------------------------------
    1650                 :            : // class NameTranslator_Impl
    1651                 :            : // -----------------------------------------------------------------------
    1652                 :            : 
    1653                 :          0 : NameTranslator_Impl::NameTranslator_Impl( const INetURLObject& rActualFolder )
    1654                 :            : {
    1655 [ #  # ][ #  # ]:          0 :     mpActFolder = new NameTranslationList( rActualFolder );
    1656                 :          0 : }
    1657                 :            : 
    1658                 :          0 : NameTranslator_Impl::~NameTranslator_Impl()
    1659                 :            : {
    1660         [ #  # ]:          0 :     if( mpActFolder )
    1661 [ #  # ][ #  # ]:          0 :         delete mpActFolder;
    1662         [ #  # ]:          0 : }
    1663                 :            : 
    1664                 :          0 : void NameTranslator_Impl::SetActualFolder( const INetURLObject& rActualFolder )
    1665                 :            : {
    1666         [ #  # ]:          0 :     HashedEntry aActFolder( rActualFolder );
    1667                 :            : 
    1668         [ #  # ]:          0 :     if( mpActFolder )
    1669                 :            :     {
    1670         [ #  # ]:          0 :         if( *mpActFolder != aActFolder )
    1671                 :            :         {
    1672 [ #  # ][ #  # ]:          0 :             delete mpActFolder;
    1673 [ #  # ][ #  # ]:          0 :             mpActFolder = new NameTranslationList( rActualFolder );
    1674                 :            :         }
    1675                 :            :     }
    1676                 :            :     else
    1677 [ #  # ][ #  # ]:          0 :         mpActFolder = new NameTranslationList( rActualFolder );
    1678                 :          0 : }
    1679                 :            : 
    1680                 :          0 : sal_Bool NameTranslator_Impl::GetTranslation( const OUString& rOrg, OUString& rTrans ) const
    1681                 :            : {
    1682                 :          0 :     sal_Bool bRet = sal_False;
    1683                 :            : 
    1684         [ #  # ]:          0 :     if( mpActFolder )
    1685                 :            :     {
    1686                 :          0 :         const OUString* pTrans = mpActFolder->Translate( rOrg );
    1687         [ #  # ]:          0 :         if( pTrans )
    1688                 :            :         {
    1689                 :          0 :             rTrans = *pTrans;
    1690                 :          0 :             bRet = sal_True;
    1691                 :            :         }
    1692                 :            :     }
    1693                 :            : 
    1694                 :          0 :     return bRet;
    1695                 :            : }
    1696                 :            : 
    1697                 :          0 : const String* NameTranslator_Impl::GetTransTableFileName() const
    1698                 :            : {
    1699         [ #  # ]:          0 :     return mpActFolder? &mpActFolder->GetTransTableFileName() : NULL;
    1700                 :            : }
    1701                 :            : 
    1702                 :            : // -----------------------------------------------------------------------
    1703                 :            : // class SvtFileView_Impl
    1704                 :            : // -----------------------------------------------------------------------
    1705                 :            : 
    1706                 :          0 : SvtFileView_Impl::SvtFileView_Impl( SvtFileView* pAntiImpl, Reference < XCommandEnvironment > xEnv, sal_Int16 nFlags, sal_Bool bOnlyFolder )
    1707                 :            : 
    1708                 :            :     :mpAntiImpl                 ( pAntiImpl )
    1709                 :            :     ,m_eAsyncActionResult       ( ::svt::ERROR )
    1710                 :            :     ,m_bRunningAsyncAction      ( false )
    1711                 :            :     ,m_bAsyncActionCancelled    ( false )
    1712                 :            :     ,mpNameTrans                ( NULL )
    1713                 :            :     ,mpUrlFilter                ( NULL )
    1714                 :            :     ,mnSortColumn               ( COLUMN_TITLE )
    1715                 :            :     ,mbAscending                ( sal_True )
    1716                 :            :     ,mbOnlyFolder               ( bOnlyFolder )
    1717                 :            :     ,mbReplaceNames             ( sal_False )
    1718                 :            :     ,mnSuspendSelectCallback    ( 0 )
    1719                 :            :     ,mbIsFirstResort            ( sal_True )
    1720 [ #  # ][ #  # ]:          0 :     ,aIntlWrapper               ( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() )
    1721                 :            :     ,maFolderImage              ( SvtResId( IMG_SVT_FOLDER ) )
    1722 [ #  # ][ #  # ]:          0 :     ,mxCmdEnv ( xEnv )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1723                 :            : 
    1724                 :            : {
    1725         [ #  # ]:          0 :     maAllFilter = rtl::OUString("*.*");
    1726 [ #  # ][ #  # ]:          0 :     mpView = new ViewTabListBox_Impl( mpAntiImpl, this, nFlags );
    1727         [ #  # ]:          0 :     mpView->EnableCellFocus();
    1728                 :          0 : }
    1729                 :            : 
    1730                 :            : // -----------------------------------------------------------------------
    1731 [ #  # ][ #  # ]:          0 : SvtFileView_Impl::~SvtFileView_Impl()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1732                 :            : {
    1733         [ #  # ]:          0 :     Clear();
    1734                 :            : 
    1735                 :            :     // use temp pointer to prevent access of deleted member (GetFocus())
    1736                 :          0 :     ViewTabListBox_Impl* pTemp = mpView;
    1737                 :          0 :     mpView = NULL;
    1738 [ #  # ][ #  # ]:          0 :     delete pTemp;
    1739         [ #  # ]:          0 : }
    1740                 :            : 
    1741                 :            : // -----------------------------------------------------------------------
    1742                 :          0 : void SvtFileView_Impl::Clear()
    1743                 :            : {
    1744         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    1745                 :            : 
    1746                 :          0 :     std::vector< SortingData_Impl* >::iterator aIt;
    1747                 :            : 
    1748 [ #  # ][ #  # ]:          0 :     for ( aIt = maContent.begin(); aIt != maContent.end(); ++aIt )
    1749 [ #  # ][ #  # ]:          0 :         delete (*aIt);
    1750                 :            : 
    1751                 :          0 :     maContent.clear();
    1752                 :            : 
    1753         [ #  # ]:          0 :     if( mpNameTrans )
    1754 [ #  # ][ #  # ]:          0 :         DELETEZ( mpNameTrans );
                 [ #  # ]
    1755                 :          0 : }
    1756                 :            : 
    1757                 :            : // -----------------------------------------------------------------------
    1758                 :          0 : FileViewResult SvtFileView_Impl::GetFolderContent_Impl(
    1759                 :            :     const String& rFolder,
    1760                 :            :     const FileViewAsyncAction* pAsyncDescriptor,
    1761                 :            :     const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList )
    1762                 :            : {
    1763         [ #  # ]:          0 :     ::osl::ClearableMutexGuard aGuard( maMutex );
    1764 [ #  # ][ #  # ]:          0 :     INetURLObject aFolderObj( rFolder );
    1765                 :            :     DBG_ASSERT( aFolderObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" );
    1766                 :            : 
    1767                 :            :     // prepare name translation
    1768         [ #  # ]:          0 :     SetActualFolder( aFolderObj );
    1769                 :            : 
    1770 [ #  # ][ #  # ]:          0 :     FolderDescriptor aFolder( aFolderObj.GetMainURL( INetURLObject::NO_DECODE ) );
         [ #  # ][ #  # ]
    1771                 :            : 
    1772         [ #  # ]:          0 :     aGuard.clear();
    1773 [ #  # ][ #  # ]:          0 :     return GetFolderContent_Impl( aFolder, pAsyncDescriptor, rBlackList );
         [ #  # ][ #  # ]
    1774                 :            : }
    1775                 :            : 
    1776                 :            : // -----------------------------------------------------------------------
    1777                 :          0 : FileViewResult SvtFileView_Impl::GetFolderContent_Impl(
    1778                 :            :     const FolderDescriptor& _rFolder,
    1779                 :            :     const FileViewAsyncAction* pAsyncDescriptor,
    1780                 :            :     const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList )
    1781                 :            : {
    1782                 :            :     DBG_TESTSOLARMUTEX();
    1783         [ #  # ]:          0 :     ::osl::ClearableMutexGuard aGuard( maMutex );
    1784                 :            : 
    1785                 :            :     OSL_ENSURE( !m_pContentEnumerator.is(), "SvtFileView_Impl::GetFolderContent_Impl: still running another enumeration!" );
    1786                 :            :     m_pContentEnumerator = new ::svt::FileViewContentEnumerator(
    1787 [ #  # ][ #  # ]:          0 :         mpView->GetCommandEnvironment(), maContent, maMutex, mbReplaceNames ? mpNameTrans : NULL );
         [ #  # ][ #  # ]
                 [ #  # ]
    1788                 :            :         // TODO: should we cache and re-use this thread?
    1789                 :            : 
    1790         [ #  # ]:          0 :     if ( !pAsyncDescriptor )
    1791                 :            :     {
    1792         [ #  # ]:          0 :         ::svt::EnumerationResult eResult = m_pContentEnumerator->enumerateFolderContentSync( _rFolder, mpUrlFilter, rBlackList );
    1793         [ #  # ]:          0 :         if ( ::svt::SUCCESS == eResult )
    1794                 :            :         {
    1795         [ #  # ]:          0 :             implEnumerationSuccess();
    1796         [ #  # ]:          0 :             m_pContentEnumerator.clear();
    1797                 :          0 :             return eSuccess;
    1798                 :            :         }
    1799         [ #  # ]:          0 :         m_pContentEnumerator.clear();
    1800                 :          0 :         return eFailure;
    1801                 :            :     }
    1802                 :            : 
    1803                 :          0 :     m_bRunningAsyncAction = true;
    1804                 :          0 :     m_bAsyncActionCancelled = false;
    1805                 :          0 :     m_eAsyncActionResult = ::svt::ERROR;
    1806         [ #  # ]:          0 :     m_aAsyncActionFinished.reset();
    1807                 :            : 
    1808                 :            :     // don't (yet) set m_aCurrentAsyncActionHandler to pTimeout->aFinishHandler.
    1809                 :            :     // By definition, this handler *only* get's called when the result cannot be obtained
    1810                 :            :     // during the minimum wait time, so it is only set below, when needed.
    1811         [ #  # ]:          0 :     m_aCurrentAsyncActionHandler = Link();
    1812                 :            : 
    1813                 :            :     // minimum time to wait
    1814         [ #  # ]:          0 :     ::std::auto_ptr< TimeValue > pTimeout( new TimeValue );
    1815                 :          0 :     sal_Int32 nMinTimeout = pAsyncDescriptor->nMinTimeout;
    1816                 :            :     OSL_ENSURE( nMinTimeout > 0, "SvtFileView_Impl::GetFolderContent_Impl: invalid minimum timeout!" );
    1817         [ #  # ]:          0 :     if ( nMinTimeout <= 0 )
    1818                 :          0 :         nMinTimeout = sal_Int32( 1000L );
    1819                 :          0 :     pTimeout->Seconds = nMinTimeout / 1000L;
    1820                 :          0 :     pTimeout->Nanosec = ( nMinTimeout % 1000L ) * 1000000L;
    1821                 :            : 
    1822         [ #  # ]:          0 :     m_pContentEnumerator->enumerateFolderContent( _rFolder, mpUrlFilter, this );
    1823                 :            : 
    1824                 :            :     // wait until the enumeration is finished
    1825                 :            :     // for this, release our own mutex (which is used by the enumerator thread)
    1826         [ #  # ]:          0 :     aGuard.clear();
    1827                 :            : 
    1828                 :          0 :     ::osl::Condition::Result eResult = ::osl::Condition::result_ok;
    1829                 :            :     {
    1830                 :            :         // also release the SolarMutex. Not all code which is needed during the enumeration
    1831                 :            :         // is Solar-Thread-Safe, in particular there is some code which needs to access
    1832                 :            :         // string resources (and our resource system relies on the SolarMutex :()
    1833         [ #  # ]:          0 :         SolarMutexReleaser aSolarRelease;
    1834                 :            : 
    1835                 :            :         // now wait. Note that if we didn't get an pAsyncDescriptor, then this is an infinite wait.
    1836 [ #  # ][ #  # ]:          0 :         eResult = m_aAsyncActionFinished.wait( pTimeout.get() );
    1837                 :            :     }
    1838                 :            : 
    1839         [ #  # ]:          0 :     ::osl::MutexGuard aGuard2( maMutex );
    1840         [ #  # ]:          0 :     if ( ::osl::Condition::result_timeout == eResult )
    1841                 :            :     {
    1842                 :            :         // maximum time to wait
    1843                 :            :         OSL_ENSURE( !m_pCancelAsyncTimer.get(), "SvtFileView_Impl::GetFolderContent_Impl: there's still a previous timer!" );
    1844 [ #  # ][ #  # ]:          0 :         m_pCancelAsyncTimer = new CallbackTimer( this );
                 [ #  # ]
    1845                 :          0 :         sal_Int32 nMaxTimeout = pAsyncDescriptor->nMaxTimeout;
    1846                 :            :         OSL_ENSURE( nMaxTimeout > nMinTimeout,
    1847                 :            :             "SvtFileView_Impl::GetFolderContent_Impl: invalid maximum timeout!" );
    1848         [ #  # ]:          0 :         if ( nMaxTimeout <= nMinTimeout )
    1849                 :          0 :             nMaxTimeout = nMinTimeout + 5000;
    1850 [ #  # ][ #  # ]:          0 :         m_pCancelAsyncTimer->setRemainingTime( salhelper::TTimeValue( nMaxTimeout - nMinTimeout ) );
    1851                 :            :             // we already waited for nMinTimeout milliseconds, so take this into account
    1852         [ #  # ]:          0 :         m_pCancelAsyncTimer->start();
    1853                 :            : 
    1854                 :          0 :         m_aCurrentAsyncActionHandler = pAsyncDescriptor->aFinishHandler;
    1855                 :            :         DBG_ASSERT( m_aCurrentAsyncActionHandler.IsSet(), "SvtFileView_Impl::GetFolderContent_Impl: nobody interested when it's finished?" );
    1856         [ #  # ]:          0 :         mpView->ClearAll();
    1857                 :          0 :         return eStillRunning;
    1858                 :            :     }
    1859                 :            : 
    1860                 :          0 :     m_bRunningAsyncAction = false;
    1861   [ #  #  #  # ]:          0 :     switch ( m_eAsyncActionResult )
    1862                 :            :     {
    1863                 :            :     case ::svt::SUCCESS:
    1864                 :          0 :         return eSuccess;
    1865                 :            : 
    1866                 :            :     case ::svt::ERROR:
    1867                 :          0 :         return eFailure;
    1868                 :            : 
    1869                 :            :     case ::svt::RUNNING:
    1870                 :          0 :         return eStillRunning;
    1871                 :            :     }
    1872                 :            : 
    1873                 :            :     SAL_WARN( "svtools.contnr", "SvtFileView_Impl::GetFolderContent_Impl: unreachable!" );
    1874 [ #  # ][ #  # ]:          0 :     return eFailure;
    1875                 :            : }
    1876                 :            : 
    1877                 :            : // -----------------------------------------------------------------------
    1878                 :          0 : void SvtFileView_Impl::FilterFolderContent_Impl( const OUString &rFilter )
    1879                 :            : {
    1880 [ #  # ][ #  # ]:          0 :     sal_Bool bHideTransFile = mbReplaceNames && mpNameTrans;
    1881                 :            : 
    1882         [ #  # ]:          0 :     String sHideEntry;
    1883         [ #  # ]:          0 :     if( bHideTransFile )
    1884                 :            :     {
    1885                 :          0 :         const String* pTransTableFileName = mpNameTrans->GetTransTableFileName();
    1886         [ #  # ]:          0 :         if( pTransTableFileName )
    1887                 :            :         {
    1888         [ #  # ]:          0 :             sHideEntry = *pTransTableFileName;
    1889         [ #  # ]:          0 :             sHideEntry.ToUpperAscii();
    1890                 :            :         }
    1891                 :            :         else
    1892                 :          0 :             bHideTransFile = sal_False;
    1893                 :            :     }
    1894                 :            : 
    1895   [ #  #  #  #  :          0 :     if ( !bHideTransFile &&
           #  # ][ #  # ]
    1896                 :          0 :         ( rFilter.isEmpty() || ( rFilter.compareToAscii( ALL_FILES_FILTER ) == COMPARE_EQUAL ) ) )
    1897                 :            :         // when replacing names, there is always something to filter (no view of ".nametranslation.table")
    1898                 :            :         return;
    1899                 :            : 
    1900         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    1901                 :            : 
    1902         [ #  # ]:          0 :     if ( maContent.empty() )
    1903                 :            :         return;
    1904                 :            : 
    1905                 :            :     // count (estimate) the number of filter tokens
    1906                 :          0 :     sal_Int32 nTokens=0;
    1907                 :          0 :     const sal_Unicode* pStart = rFilter.getStr();
    1908                 :          0 :     const sal_Unicode* pEnd = pStart + rFilter.getLength();
    1909         [ #  # ]:          0 :     while ( pStart != pEnd )
    1910         [ #  # ]:          0 :         if ( *pStart++ == ';' )
    1911                 :          0 :             ++nTokens;
    1912                 :            : 
    1913                 :            :     // collect the filter tokens
    1914         [ #  # ]:          0 :     ::std::vector< WildCard > aFilters;
    1915 [ #  # ][ #  # ]:          0 :     FilterMatch::createWildCardFilterList(rFilter,aFilters);
                 [ #  # ]
    1916                 :            : 
    1917                 :            : 
    1918                 :            :     // do the filtering
    1919                 :          0 :     ::std::vector< SortingData_Impl* >::iterator aContentLoop = maContent.begin();
    1920         [ #  # ]:          0 :     String sCompareString;
    1921 [ #  # ][ #  # ]:          0 :     do
    1922                 :            :     {
    1923         [ #  # ]:          0 :         if ( (*aContentLoop)->mbIsFolder )
    1924                 :          0 :             ++aContentLoop;
    1925                 :            :         else
    1926                 :            :         {
    1927                 :            :             // normalize the content title (we always match case-insensitive)
    1928                 :            :             // 91872 - 11.09.2001 - frank.schoenheit@sun.com
    1929         [ #  # ]:          0 :             sCompareString = (*aContentLoop)->GetFileName(); // filter works on file name, not on title!
    1930                 :            :             sal_Bool bDelete;
    1931                 :            : 
    1932 [ #  # ][ #  # ]:          0 :             if( bHideTransFile && sCompareString == sHideEntry )
         [ #  # ][ #  # ]
    1933                 :          0 :                 bDelete = sal_True;
    1934                 :            :             else
    1935                 :            :             {
    1936                 :            :                 // search for the first filter which matches
    1937                 :            :                 ::std::vector< WildCard >::const_iterator pMatchingFilter =
    1938                 :            :                     ::std::find_if(
    1939                 :            :                         aFilters.begin(),
    1940                 :            :                         aFilters.end(),
    1941                 :            :                         FilterMatch( sCompareString )
    1942 [ #  # ][ #  # ]:          0 :                     );
    1943                 :            : 
    1944         [ #  # ]:          0 :                 bDelete = aFilters.end() == pMatchingFilter;
    1945                 :            :             }
    1946                 :            : 
    1947         [ #  # ]:          0 :             if( bDelete )
    1948                 :            :             {
    1949                 :            :                 // none of the filters did match
    1950 [ #  # ][ #  # ]:          0 :                 delete (*aContentLoop);
    1951                 :            : 
    1952 [ #  # ][ #  # ]:          0 :                 if ( maContent.begin() == aContentLoop )
    1953                 :            :                 {
    1954         [ #  # ]:          0 :                     maContent.erase( aContentLoop );
    1955                 :          0 :                     aContentLoop = maContent.begin();
    1956                 :            :                 }
    1957                 :            :                 else
    1958                 :            :                 {
    1959                 :          0 :                     std::vector< SortingData_Impl* >::iterator aDelete = aContentLoop;
    1960                 :          0 :                     --aContentLoop; // move the iterator to a position which is not invalidated by the erase
    1961         [ #  # ]:          0 :                     maContent.erase( aDelete );
    1962                 :          0 :                     ++aContentLoop; // this is now the next one ....
    1963                 :            :                 }
    1964                 :            :             }
    1965                 :            :             else
    1966                 :          0 :                 ++aContentLoop;
    1967                 :            :         }
    1968                 :            :     }
    1969 [ #  # ][ #  # ]:          0 :     while ( aContentLoop != maContent.end() );
         [ #  # ][ #  # ]
                 [ #  # ]
    1970                 :            : }
    1971                 :            : 
    1972                 :            : // -----------------------------------------------------------------------
    1973                 :          0 : IMPL_LINK( SvtFileView_Impl, SelectionMultiplexer, void*, _pSource )
    1974                 :            : {
    1975         [ #  # ]:          0 :     return mnSuspendSelectCallback ? 0L : m_aSelectHandler.Call( _pSource );
    1976                 :            : }
    1977                 :            : 
    1978                 :            : // -----------------------------------------------------------------------
    1979                 :          0 : void SvtFileView_Impl::SetSelectHandler( const Link& _rHdl )
    1980                 :            : {
    1981                 :          0 :     m_aSelectHandler = _rHdl;
    1982                 :            : 
    1983         [ #  # ]:          0 :     Link aMasterHandler;
    1984 [ #  # ][ #  # ]:          0 :     if ( m_aSelectHandler.IsSet() )
    1985         [ #  # ]:          0 :         aMasterHandler = LINK( this, SvtFileView_Impl, SelectionMultiplexer );
    1986                 :            : 
    1987                 :          0 :     mpView->SetSelectHdl( aMasterHandler );
    1988                 :          0 : }
    1989                 :            : 
    1990                 :            : // -----------------------------------------------------------------------
    1991                 :          0 : void SvtFileView_Impl::InitSelection()
    1992                 :            : {
    1993                 :          0 :     mpView->SelectAll( sal_False );
    1994                 :          0 :     SvLBoxEntry* pFirst = mpView->First();
    1995         [ #  # ]:          0 :     if ( pFirst )
    1996                 :          0 :         mpView->SetCursor( pFirst, sal_True );
    1997                 :          0 : }
    1998                 :            : 
    1999                 :            : // -----------------------------------------------------------------------
    2000                 :          0 : void SvtFileView_Impl::OpenFolder_Impl()
    2001                 :            : {
    2002         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    2003                 :            : 
    2004         [ #  # ]:          0 :     mpView->SetUpdateMode( sal_False );
    2005         [ #  # ]:          0 :     mpView->ClearAll();
    2006                 :            : 
    2007                 :          0 :     std::vector< SortingData_Impl* >::iterator aIt;
    2008                 :            : 
    2009 [ #  # ][ #  # ]:          0 :     for ( aIt = maContent.begin(); aIt != maContent.end(); ++aIt )
    2010                 :            :     {
    2011 [ #  # ][ #  # ]:          0 :         if ( mbOnlyFolder && ! (*aIt)->mbIsFolder )
                 [ #  # ]
    2012                 :          0 :             continue;
    2013                 :            : 
    2014                 :            :         // insert entry and set user data
    2015                 :          0 :         SvLBoxEntry* pEntry = mpView->InsertEntry( (*aIt)->maDisplayText,
    2016                 :          0 :                                                    (*aIt)->maImage,
    2017 [ #  # ][ #  # ]:          0 :                                                    (*aIt)->maImage );
                 [ #  # ]
    2018                 :            : 
    2019                 :          0 :         SvtContentEntry* pUserData = new SvtContentEntry( (*aIt)->maTargetURL,
    2020         [ #  # ]:          0 :                                                           (*aIt)->mbIsFolder );
    2021                 :          0 :         pEntry->SetUserData( pUserData );
    2022                 :            :     }
    2023                 :            : 
    2024         [ #  # ]:          0 :     InitSelection();
    2025                 :            : 
    2026                 :          0 :     ++mnSuspendSelectCallback;
    2027         [ #  # ]:          0 :     mpView->SetUpdateMode( sal_True );
    2028                 :          0 :     --mnSuspendSelectCallback;
    2029                 :            : 
    2030 [ #  # ][ #  # ]:          0 :     ResetCursor();
    2031                 :          0 : }
    2032                 :            : 
    2033                 :            : // -----------------------------------------------------------------------
    2034                 :          0 : void SvtFileView_Impl::ResetCursor()
    2035                 :            : {
    2036                 :            :     // deselect
    2037                 :          0 :     SvLBoxEntry* pEntry = mpView->FirstSelected();
    2038         [ #  # ]:          0 :     if ( pEntry )
    2039                 :          0 :         mpView->Select( pEntry, sal_False );
    2040                 :            :     // set cursor to the first entry
    2041                 :          0 :     mpView->SetCursor( mpView->First(), sal_True );
    2042                 :          0 :     mpView->Update();
    2043                 :          0 : }
    2044                 :            : 
    2045                 :            : // -----------------------------------------------------------------------
    2046                 :          0 : void SvtFileView_Impl::CancelRunningAsyncAction()
    2047                 :            : {
    2048                 :            :     DBG_TESTSOLARMUTEX();
    2049         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    2050         [ #  # ]:          0 :     if ( !m_pContentEnumerator.is() )
    2051                 :          0 :         return;
    2052                 :            : 
    2053                 :          0 :     m_bAsyncActionCancelled = true;
    2054         [ #  # ]:          0 :     m_pContentEnumerator->cancel();
    2055                 :          0 :     m_bRunningAsyncAction = false;
    2056                 :            : 
    2057         [ #  # ]:          0 :     m_pContentEnumerator.clear();
    2058 [ #  # ][ #  # ]:          0 :     if ( m_pCancelAsyncTimer.is() && m_pCancelAsyncTimer->isTicking() )
         [ #  # ][ #  # ]
    2059         [ #  # ]:          0 :         m_pCancelAsyncTimer->stop();
    2060 [ #  # ][ #  # ]:          0 :     m_pCancelAsyncTimer = NULL;
                 [ #  # ]
    2061                 :            : }
    2062                 :            : 
    2063                 :            : //-----------------------------------------------------------------------
    2064                 :          0 : void SvtFileView_Impl::onTimeout( CallbackTimer* )
    2065                 :            : {
    2066         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
    2067         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    2068         [ #  # ]:          0 :     if ( !m_bRunningAsyncAction )
    2069                 :            :         // there might have been a race condition while we waited for the mutex
    2070                 :          0 :         return;
    2071                 :            : 
    2072         [ #  # ]:          0 :     CancelRunningAsyncAction();
    2073                 :            : 
    2074 [ #  # ][ #  # ]:          0 :     if ( m_aCurrentAsyncActionHandler.IsSet() )
    2075                 :            :     {
    2076         [ #  # ]:          0 :         Application::PostUserEvent( m_aCurrentAsyncActionHandler, reinterpret_cast< void* >( eTimeout ) );
    2077         [ #  # ]:          0 :         m_aCurrentAsyncActionHandler = Link();
    2078 [ #  # ][ #  # ]:          0 :     }
         [ #  # ][ #  # ]
    2079                 :            : }
    2080                 :            : 
    2081                 :            : //-----------------------------------------------------------------------
    2082                 :          0 : void SvtFileView_Impl::enumerationDone( ::svt::EnumerationResult _eResult )
    2083                 :            : {
    2084         [ #  # ]:          0 :     SolarMutexGuard aSolarGuard;
    2085         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    2086                 :            : 
    2087         [ #  # ]:          0 :     m_pContentEnumerator.clear();
    2088 [ #  # ][ #  # ]:          0 :     if ( m_pCancelAsyncTimer.is() && m_pCancelAsyncTimer->isTicking() )
         [ #  # ][ #  # ]
    2089         [ #  # ]:          0 :         m_pCancelAsyncTimer->stop();
    2090         [ #  # ]:          0 :     m_pCancelAsyncTimer = NULL;
    2091                 :            : 
    2092         [ #  # ]:          0 :     if ( m_bAsyncActionCancelled )
    2093                 :            :         // this is to prevent race conditions
    2094                 :          0 :         return;
    2095                 :            : 
    2096                 :          0 :     m_eAsyncActionResult = _eResult;
    2097                 :          0 :     m_bRunningAsyncAction = false;
    2098                 :            : 
    2099         [ #  # ]:          0 :     m_aAsyncActionFinished.set();
    2100                 :            : 
    2101         [ #  # ]:          0 :     if ( svt::SUCCESS == _eResult )
    2102         [ #  # ]:          0 :         implEnumerationSuccess();
    2103                 :            : 
    2104 [ #  # ][ #  # ]:          0 :     if ( m_aCurrentAsyncActionHandler.IsSet() )
    2105                 :            :     {
    2106         [ #  # ]:          0 :         Application::PostUserEvent( m_aCurrentAsyncActionHandler, reinterpret_cast< void* >( m_eAsyncActionResult ) );
    2107         [ #  # ]:          0 :         m_aCurrentAsyncActionHandler = Link();
    2108 [ #  # ][ #  # ]:          0 :     }
         [ #  # ][ #  # ]
    2109                 :            : }
    2110                 :            : 
    2111                 :            : //-----------------------------------------------------------------------
    2112                 :          0 : void SvtFileView_Impl::implEnumerationSuccess()
    2113                 :            : {
    2114         [ #  # ]:          0 :     FilterFolderContent_Impl( maCurrentFilter );
    2115                 :          0 :     SortFolderContent_Impl();
    2116                 :          0 :     CreateDisplayText_Impl();
    2117                 :          0 :     OpenFolder_Impl();
    2118                 :          0 :     maOpenDoneLink.Call( mpAntiImpl );
    2119                 :          0 : }
    2120                 :            : 
    2121                 :            : // -----------------------------------------------------------------------
    2122                 :          0 : void SvtFileView_Impl::ReplaceTabWithString( OUString& aValue )
    2123                 :            : {
    2124         [ #  # ]:          0 :     OUString aTab(       RTL_CONSTASCII_USTRINGPARAM( "\t" ));
    2125         [ #  # ]:          0 :     OUString aTabString( RTL_CONSTASCII_USTRINGPARAM( "%09" ));
    2126                 :            :     sal_Int32 iPos;
    2127                 :            : 
    2128         [ #  # ]:          0 :     while ( ( iPos = aValue.indexOf( aTab ) ) >= 0 )
    2129                 :          0 :        aValue = aValue.replaceAt( iPos, 1, aTabString );
    2130                 :          0 : }
    2131                 :            : 
    2132                 :            : // -----------------------------------------------------------------------
    2133                 :          0 : void SvtFileView_Impl::CreateDisplayText_Impl()
    2134                 :            : {
    2135         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    2136                 :            : 
    2137                 :          0 :     OUString aValue;
    2138         [ #  # ]:          0 :     OUString aTab(     RTL_CONSTASCII_USTRINGPARAM( "\t" ));
    2139         [ #  # ]:          0 :     OUString aDateSep( RTL_CONSTASCII_USTRINGPARAM( ", " ));
    2140                 :            : 
    2141                 :          0 :     std::vector< SortingData_Impl* >::iterator aIt;
    2142                 :            : 
    2143 [ #  # ][ #  # ]:          0 :     for ( aIt = maContent.begin(); aIt != maContent.end(); ++aIt )
    2144                 :            :     {
    2145                 :            :         // title, type, size, date
    2146                 :          0 :         aValue = (*aIt)->GetTitle();
    2147                 :            :         // #83004# --------------------
    2148         [ #  # ]:          0 :         ReplaceTabWithString( aValue );
    2149                 :          0 :         aValue += aTab;
    2150                 :          0 :         aValue += (*aIt)->maType;
    2151                 :          0 :         aValue += aTab;
    2152                 :            :         // folders don't have a size
    2153         [ #  # ]:          0 :         if ( ! (*aIt)->mbIsFolder )
    2154         [ #  # ]:          0 :             aValue += CreateExactSizeText( (*aIt)->maSize );
    2155                 :          0 :         aValue += aTab;
    2156                 :            :         // set the date, but volumes have no date
    2157 [ #  # ][ #  # ]:          0 :         if ( ! (*aIt)->mbIsFolder || ! (*aIt)->mbIsVolume )
                 [ #  # ]
    2158                 :            :         {
    2159         [ #  # ]:          0 :             SvtSysLocale aSysLocale;
    2160         [ #  # ]:          0 :             const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
    2161         [ #  # ]:          0 :             aValue += rLocaleData.getDate( (*aIt)->maModDate );
    2162                 :          0 :             aValue += aDateSep;
    2163 [ #  # ][ #  # ]:          0 :             aValue += rLocaleData.getTime( (*aIt)->maModDate );
    2164                 :            :         }
    2165                 :          0 :         (*aIt)->maDisplayText = aValue;
    2166                 :            : 
    2167                 :            :         // detect image
    2168         [ #  # ]:          0 :         if ( (*aIt)->mbIsFolder )
    2169                 :            :         {
    2170                 :          0 :             ::svtools::VolumeInfo aVolInfo( (*aIt)->mbIsVolume, (*aIt)->mbIsRemote,
    2171                 :          0 :                                             (*aIt)->mbIsRemoveable, (*aIt)->mbIsFloppy,
    2172                 :          0 :                                             (*aIt)->mbIsCompactDisc );
    2173 [ #  # ][ #  # ]:          0 :             (*aIt)->maImage = SvFileInformationManager::GetFolderImage( aVolInfo, sal_False );
                 [ #  # ]
    2174                 :            :         }
    2175                 :            :         else
    2176 [ #  # ][ #  # ]:          0 :             (*aIt)->maImage = SvFileInformationManager::GetFileImage( INetURLObject( (*aIt)->maTargetURL ), sal_False );
         [ #  # ][ #  # ]
                 [ #  # ]
    2177         [ #  # ]:          0 :     }
    2178                 :          0 : }
    2179                 :            : 
    2180                 :            : // -----------------------------------------------------------------------
    2181                 :            : // this function converts the sequence of strings into a vector of SortingData
    2182                 :            : // the string should have the form :
    2183                 :            : // title \t type \t size \t date \t target url \t is folder \t image url
    2184                 :            : 
    2185                 :          0 : void SvtFileView_Impl::CreateVector_Impl( const Sequence < OUString > &rList )
    2186                 :            : {
    2187         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    2188                 :            : 
    2189         [ #  # ]:          0 :     OUString aTab( RTL_CONSTASCII_USTRINGPARAM( "\t" ));
    2190                 :            : 
    2191                 :          0 :     sal_uInt32 nCount = (sal_uInt32) rList.getLength();
    2192                 :            : 
    2193         [ #  # ]:          0 :     for( sal_uInt32 i = 0; i < nCount; i++ )
    2194                 :            :     {
    2195 [ #  # ][ #  # ]:          0 :         SortingData_Impl*   pEntry = new SortingData_Impl;
    2196                 :          0 :         OUString            aValue = rList[i];
    2197                 :          0 :         OUString            aDisplayText;
    2198                 :          0 :         sal_Int32           nIndex = 0;
    2199                 :            : 
    2200                 :            :         // get the title
    2201         [ #  # ]:          0 :         pEntry->SetNewTitle( aValue.getToken( 0, '\t', nIndex ) );
    2202                 :          0 :         aDisplayText = pEntry->GetTitle();
    2203         [ #  # ]:          0 :         ReplaceTabWithString( aDisplayText );
    2204                 :          0 :         aDisplayText += aTab;
    2205                 :            : 
    2206                 :            :         // get the type
    2207         [ #  # ]:          0 :         if ( nIndex >= 0 )
    2208                 :            :         {
    2209                 :          0 :             pEntry->maType = aValue.getToken( 0, '\t', nIndex );
    2210                 :          0 :             aDisplayText += pEntry->maType;
    2211                 :            :         }
    2212                 :          0 :         aDisplayText += aTab;
    2213                 :            : 
    2214                 :            :         // get the size
    2215         [ #  # ]:          0 :         if ( nIndex >= 0 )
    2216                 :            :         {
    2217                 :          0 :             OUString aSize = aValue.getToken( 0, '\t', nIndex );
    2218                 :          0 :             aDisplayText += aSize;
    2219                 :            : 
    2220         [ #  # ]:          0 :             if ( !aSize.isEmpty() )
    2221                 :          0 :                 pEntry->maSize = aSize.toInt64();
    2222                 :            :         }
    2223                 :          0 :         aDisplayText += aTab;
    2224                 :            : 
    2225                 :            :         // get the date
    2226         [ #  # ]:          0 :         if ( nIndex >= 0 )
    2227                 :            :         {
    2228                 :          0 :             OUString aDate = aValue.getToken( 0, '\t', nIndex );
    2229                 :          0 :             aDisplayText += aDate;
    2230                 :            : 
    2231                 :          0 :             if ( !aDate.isEmpty() )
    2232                 :            :             {
    2233                 :            :                 SAL_WARN( "svtools.contnr", "Don't know, how to convert date" );
    2234                 :            :                 ;// convert date string to date
    2235                 :          0 :             }
    2236                 :            :         }
    2237                 :            :         // get the target url
    2238         [ #  # ]:          0 :         if ( nIndex >= 0 )
    2239                 :            :         {
    2240                 :          0 :             pEntry->maTargetURL = aValue.getToken( 0, '\t', nIndex );
    2241                 :            :         }
    2242                 :            :         // get the size
    2243         [ #  # ]:          0 :         if ( nIndex >= 0 )
    2244                 :            :         {
    2245                 :          0 :             OUString aBool = aValue.getToken( 0, '\t', nIndex );
    2246         [ #  # ]:          0 :             if ( !aBool.isEmpty() )
    2247                 :          0 :                 pEntry->mbIsFolder = aBool.toBoolean();
    2248                 :            :         }
    2249                 :            :         // get the image url
    2250         [ #  # ]:          0 :         if ( nIndex >= 0 )
    2251                 :            :         {
    2252                 :          0 :             pEntry->maImageURL = aValue.getToken( 0, '\t', nIndex );
    2253                 :            :         }
    2254                 :            : 
    2255                 :            :         // set the display text
    2256                 :          0 :         pEntry->maDisplayText = aDisplayText;
    2257                 :            : 
    2258                 :            :         // detect the image
    2259         [ #  # ]:          0 :         if( aValue != SEPARATOR_STR )
    2260                 :            :         {
    2261 [ #  # ][ #  # ]:          0 :             INetURLObject aObj( !pEntry->maImageURL.isEmpty() ? pEntry->maImageURL : pEntry->maTargetURL );
    2262 [ #  # ][ #  # ]:          0 :             pEntry->maImage = SvFileInformationManager::GetImage( aObj, sal_False );
         [ #  # ][ #  # ]
    2263                 :            :         }
    2264         [ #  # ]:          0 :         maContent.push_back( pEntry );
    2265         [ #  # ]:          0 :     }
    2266                 :          0 : }
    2267                 :            : 
    2268                 :            : // -----------------------------------------------------------------------
    2269                 :          0 : void SvtFileView_Impl::Resort_Impl( sal_Int16 nColumn, sal_Bool bAscending )
    2270                 :            : {
    2271         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    2272                 :            : 
    2273 [ #  # ][ #  # ]:          0 :     if ( ( nColumn == mnSortColumn ) &&
    2274                 :            :          ( bAscending == mbAscending ) )
    2275                 :          0 :          return;
    2276                 :            : 
    2277                 :            :     // reset the quick search index
    2278         [ #  # ]:          0 :     mpView->ResetQuickSearch_Impl( NULL );
    2279                 :            : 
    2280         [ #  # ]:          0 :     String aEntryURL;
    2281         [ #  # ]:          0 :     SvLBoxEntry* pEntry = mpView->GetCurEntry();
    2282 [ #  # ][ #  # ]:          0 :     if ( pEntry && pEntry->GetUserData() )
                 [ #  # ]
    2283         [ #  # ]:          0 :         aEntryURL = ( (SvtContentEntry*)pEntry->GetUserData() )->maURL;
    2284                 :            : 
    2285                 :          0 :     mnSortColumn = nColumn;
    2286                 :          0 :     mbAscending = bAscending;
    2287                 :            : 
    2288         [ #  # ]:          0 :     SortFolderContent_Impl();
    2289         [ #  # ]:          0 :     OpenFolder_Impl();
    2290                 :            : 
    2291         [ #  # ]:          0 :     if ( !mbIsFirstResort )
    2292                 :            :     {
    2293 [ #  # ][ #  # ]:          0 :         sal_uLong nPos = GetEntryPos( aEntryURL );
    2294         [ #  # ]:          0 :         if ( nPos < mpView->GetEntryCount() )
    2295                 :            :         {
    2296         [ #  # ]:          0 :             pEntry = mpView->GetEntry( nPos );
    2297                 :            : 
    2298                 :          0 :             ++mnSuspendSelectCallback;  // #i15668#
    2299         [ #  # ]:          0 :             mpView->SetCurEntry( pEntry );
    2300                 :          0 :             --mnSuspendSelectCallback;
    2301                 :            :         }
    2302                 :            :     }
    2303                 :            :     else
    2304 [ #  # ][ #  # ]:          0 :         mbIsFirstResort = sal_False;
                 [ #  # ]
    2305                 :            : }
    2306                 :            : 
    2307                 :            : // -----------------------------------------------------------------------
    2308                 :            : static sal_Bool                 gbAscending = sal_True;
    2309                 :            : static sal_Int16                gnColumn = COLUMN_TITLE;
    2310                 :            : static const CollatorWrapper*   pCollatorWrapper = NULL;
    2311                 :            : 
    2312                 :            : /* this functions returns true, if aOne is less then aTwo
    2313                 :            : */
    2314                 :          0 : sal_Bool CompareSortingData_Impl( SortingData_Impl* const aOne, SortingData_Impl* const aTwo )
    2315                 :            : {
    2316                 :            :     DBG_ASSERT( pCollatorWrapper, "*CompareSortingData_Impl(): Can't work this way!" );
    2317                 :            : 
    2318                 :            :     sal_Int32   nComp;
    2319                 :          0 :     sal_Bool    bRet = sal_False;
    2320                 :          0 :     sal_Bool    bEqual = sal_False;
    2321                 :            : 
    2322         [ #  # ]:          0 :     if ( aOne->mbIsFolder != aTwo->mbIsFolder )
    2323                 :            :     {
    2324         [ #  # ]:          0 :         if ( aOne->mbIsFolder )
    2325                 :          0 :             bRet = sal_True;
    2326                 :            :         else
    2327                 :          0 :             bRet = sal_False;
    2328                 :            : 
    2329                 :            :         // !!! pb: #100376# folder always on top
    2330         [ #  # ]:          0 :         if ( !gbAscending )
    2331                 :          0 :             bRet = !bRet;
    2332                 :            :     }
    2333                 :            :     else
    2334                 :            :     {
    2335   [ #  #  #  #  :          0 :         switch ( gnColumn )
                      # ]
    2336                 :            :         {
    2337                 :            :             case COLUMN_TITLE:
    2338                 :            :                 // compare case insensitive first
    2339                 :          0 :                 nComp = pCollatorWrapper->compareString( aOne->GetLowerTitle(), aTwo->GetLowerTitle() );
    2340                 :            : 
    2341         [ #  # ]:          0 :                 if ( nComp == 0 )
    2342                 :          0 :                     nComp = pCollatorWrapper->compareString( aOne->GetTitle(), aTwo->GetTitle() );
    2343                 :            : 
    2344         [ #  # ]:          0 :                 if ( nComp < 0 )
    2345                 :          0 :                     bRet = sal_True;
    2346         [ #  # ]:          0 :                 else if ( nComp > 0 )
    2347                 :          0 :                     bRet = sal_False;
    2348                 :            :                 else
    2349                 :          0 :                     bEqual = sal_True;
    2350                 :          0 :                 break;
    2351                 :            :             case COLUMN_TYPE:
    2352                 :          0 :                 nComp = pCollatorWrapper->compareString( aOne->maType, aTwo->maType );
    2353         [ #  # ]:          0 :                 if ( nComp < 0 )
    2354                 :          0 :                     bRet = sal_True;
    2355         [ #  # ]:          0 :                 else if ( nComp > 0 )
    2356                 :          0 :                     bRet = sal_False;
    2357                 :            :                 else
    2358                 :          0 :                     bEqual = sal_True;
    2359                 :          0 :                 break;
    2360                 :            :             case COLUMN_SIZE:
    2361         [ #  # ]:          0 :                 if ( aOne->maSize < aTwo->maSize )
    2362                 :          0 :                     bRet = sal_True;
    2363         [ #  # ]:          0 :                 else if ( aOne->maSize > aTwo->maSize )
    2364                 :          0 :                     bRet = sal_False;
    2365                 :            :                 else
    2366                 :          0 :                     bEqual = sal_True;
    2367                 :          0 :                 break;
    2368                 :            :             case COLUMN_DATE:
    2369         [ #  # ]:          0 :                 if ( aOne->maModDate < aTwo->maModDate )
    2370                 :          0 :                     bRet = sal_True;
    2371         [ #  # ]:          0 :                 else if ( aOne->maModDate > aTwo->maModDate )
    2372                 :          0 :                     bRet = sal_False;
    2373                 :            :                 else
    2374                 :          0 :                     bEqual = sal_True;
    2375                 :          0 :                 break;
    2376                 :            :             default:
    2377                 :            :                 DBG_WARNING( "CompareSortingData_Impl: Compare unknown type!" );
    2378                 :          0 :                 bRet = sal_False;
    2379                 :            :         }
    2380                 :            :     }
    2381                 :            : 
    2382                 :            :     // when the two elements are equal, we must not return sal_True (which would
    2383                 :            :     // happen if we just return ! ( a < b ) when not sorting ascending )
    2384         [ #  # ]:          0 :     if ( bEqual )
    2385                 :          0 :         return sal_False;
    2386                 :            : 
    2387         [ #  # ]:          0 :     return gbAscending ? bRet : !bRet;
    2388                 :            : }
    2389                 :            : 
    2390                 :            : // -----------------------------------------------------------------------
    2391                 :          0 : void SvtFileView_Impl::SortFolderContent_Impl()
    2392                 :            : {
    2393         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    2394                 :            : 
    2395                 :          0 :     sal_uInt32 nSize = maContent.size();
    2396                 :            : 
    2397         [ #  # ]:          0 :     if ( nSize > 1 )
    2398                 :            :     {
    2399                 :          0 :         gbAscending = mbAscending;
    2400                 :          0 :         gnColumn = mnSortColumn;
    2401         [ #  # ]:          0 :         pCollatorWrapper = aIntlWrapper.getCaseCollator();
    2402                 :            : 
    2403         [ #  # ]:          0 :         std::stable_sort( maContent.begin(), maContent.end(), CompareSortingData_Impl );
    2404                 :            : 
    2405                 :          0 :         pCollatorWrapper = NULL;
    2406         [ #  # ]:          0 :     }
    2407                 :          0 : }
    2408                 :            : 
    2409                 :            : // -----------------------------------------------------------------------
    2410                 :          0 : void SvtFileView_Impl::EntryRemoved( const OUString& rURL )
    2411                 :            : {
    2412         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    2413                 :            : 
    2414                 :          0 :     std::vector< SortingData_Impl* >::iterator aIt;
    2415                 :            : 
    2416 [ #  # ][ #  # ]:          0 :     for ( aIt = maContent.begin(); aIt != maContent.end(); ++aIt )
    2417                 :            :     {
    2418         [ #  # ]:          0 :         if ( (*aIt)->maTargetURL == rURL )
    2419                 :            :         {
    2420         [ #  # ]:          0 :             maContent.erase( aIt );
    2421                 :          0 :             break;
    2422                 :            :         }
    2423         [ #  # ]:          0 :     }
    2424                 :          0 : }
    2425                 :            : 
    2426                 :            : // -----------------------------------------------------------------------
    2427                 :          0 : void SvtFileView_Impl::EntryRenamed( OUString& rURL,
    2428                 :            :                                      const OUString& rTitle )
    2429                 :            : {
    2430         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    2431                 :            : 
    2432                 :          0 :     std::vector< SortingData_Impl* >::iterator aIt;
    2433                 :            : 
    2434 [ #  # ][ #  # ]:          0 :     for ( aIt = maContent.begin(); aIt != maContent.end(); ++aIt )
    2435                 :            :     {
    2436         [ #  # ]:          0 :         if ( (*aIt)->maTargetURL == rURL )
    2437                 :            :         {
    2438         [ #  # ]:          0 :             (*aIt)->SetNewTitle( rTitle );
    2439                 :          0 :             OUString aDisplayText = (*aIt)->maDisplayText;
    2440                 :          0 :             sal_Int32 nIndex = aDisplayText.indexOf( '\t' );
    2441                 :            : 
    2442         [ #  # ]:          0 :             if ( nIndex > 0 )
    2443                 :          0 :                 (*aIt)->maDisplayText = aDisplayText.replaceAt( 0, nIndex, rTitle );
    2444                 :            : 
    2445         [ #  # ]:          0 :             INetURLObject aURLObj( rURL );
    2446         [ #  # ]:          0 :             aURLObj.SetName( rTitle, INetURLObject::ENCODE_ALL );
    2447                 :            : 
    2448         [ #  # ]:          0 :             rURL = aURLObj.GetMainURL( INetURLObject::NO_DECODE );
    2449                 :            : 
    2450                 :          0 :             (*aIt)->maTargetURL = rURL;
    2451         [ #  # ]:          0 :             break;
    2452                 :            :         }
    2453         [ #  # ]:          0 :     }
    2454                 :          0 : }
    2455                 :            : 
    2456                 :            : // -----------------------------------------------------------------------
    2457                 :          0 : String SvtFileView_Impl::FolderInserted( const OUString& rURL, const OUString& rTitle )
    2458                 :            : {
    2459         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    2460                 :            : 
    2461 [ #  # ][ #  # ]:          0 :     SortingData_Impl* pData = new SortingData_Impl;
    2462                 :            : 
    2463         [ #  # ]:          0 :     pData->SetNewTitle( rTitle );
    2464                 :          0 :     pData->maSize     = 0;
    2465                 :          0 :     pData->mbIsFolder = sal_True;
    2466                 :          0 :     pData->maTargetURL   = rURL;
    2467                 :            : 
    2468         [ #  # ]:          0 :     INetURLObject aURLObj( rURL );
    2469                 :            : 
    2470                 :          0 :     ::svtools::VolumeInfo aVolInfo;
    2471 [ #  # ][ #  # ]:          0 :     pData->maType = SvFileInformationManager::GetFolderDescription( aVolInfo );
                 [ #  # ]
    2472 [ #  # ][ #  # ]:          0 :     pData->maImage = SvFileInformationManager::GetFolderImage( aVolInfo, sal_False );
                 [ #  # ]
    2473                 :            : 
    2474                 :          0 :     OUString aValue;
    2475         [ #  # ]:          0 :     OUString aTab(     RTL_CONSTASCII_USTRINGPARAM( "\t" ));
    2476         [ #  # ]:          0 :     OUString aDateSep( RTL_CONSTASCII_USTRINGPARAM( ", " ));
    2477                 :            : 
    2478                 :            :     // title, type, size, date
    2479                 :          0 :     aValue = pData->GetTitle();
    2480         [ #  # ]:          0 :     ReplaceTabWithString( aValue );
    2481                 :          0 :     aValue += aTab;
    2482                 :          0 :     aValue += pData->maType;
    2483                 :          0 :     aValue += aTab;
    2484                 :            :     // folders don't have a size
    2485                 :          0 :     aValue += aTab;
    2486                 :            :     // set the date
    2487         [ #  # ]:          0 :     SvtSysLocale aSysLocale;
    2488         [ #  # ]:          0 :     const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
    2489         [ #  # ]:          0 :     aValue += rLocaleData.getDate( pData->maModDate );
    2490                 :          0 :     aValue += aDateSep;
    2491         [ #  # ]:          0 :     aValue += rLocaleData.getTime( pData->maModDate );
    2492                 :            : 
    2493                 :          0 :     pData->maDisplayText = aValue;
    2494         [ #  # ]:          0 :     maContent.push_back( pData );
    2495                 :            : 
    2496 [ #  # ][ #  # ]:          0 :     return String( aValue );
         [ #  # ][ #  # ]
    2497                 :            : }
    2498                 :            : 
    2499                 :            : // -----------------------------------------------------------------------
    2500                 :          0 : sal_uLong SvtFileView_Impl::GetEntryPos( const OUString& rURL )
    2501                 :            : {
    2502         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    2503                 :            : 
    2504                 :          0 :     std::vector< SortingData_Impl* >::iterator aIt;
    2505                 :          0 :     sal_uLong   nPos = 0;
    2506                 :            : 
    2507 [ #  # ][ #  # ]:          0 :     for ( aIt = maContent.begin(); aIt != maContent.end(); ++aIt )
    2508                 :            :     {
    2509         [ #  # ]:          0 :         if ( (*aIt)->maTargetURL == rURL )
    2510                 :          0 :             return nPos;
    2511                 :          0 :         nPos += 1;
    2512                 :            :     }
    2513                 :            : 
    2514         [ #  # ]:          0 :     return nPos;
    2515                 :            : }
    2516                 :            : 
    2517                 :            : // -----------------------------------------------------------------------
    2518                 :          0 : sal_Bool SvtFileView_Impl::SearchNextEntry( sal_uInt32& nIndex, const OUString& rTitle, sal_Bool bWrapAround )
    2519                 :            : {
    2520         [ #  # ]:          0 :     ::osl::MutexGuard aGuard( maMutex );
    2521                 :            : 
    2522                 :          0 :     sal_uInt32 nEnd = maContent.size();
    2523                 :          0 :     sal_uInt32 nStart = nIndex;
    2524         [ #  # ]:          0 :     while ( nIndex < nEnd )
    2525                 :            :     {
    2526                 :          0 :         SortingData_Impl* pData = maContent[ nIndex ];
    2527         [ #  # ]:          0 :         if ( rTitle.compareTo( pData->GetLowerTitle(), rTitle.getLength() ) == 0 )
    2528                 :          0 :             return sal_True;
    2529                 :          0 :         nIndex += 1;
    2530                 :            :     }
    2531                 :            : 
    2532         [ #  # ]:          0 :     if ( bWrapAround )
    2533                 :            :     {
    2534                 :          0 :         nIndex = 0;
    2535 [ #  # ][ #  # ]:          0 :         while ( nIndex < nEnd && nIndex <= nStart )
                 [ #  # ]
    2536                 :            :         {
    2537                 :          0 :             SortingData_Impl* pData = maContent[ nIndex ];
    2538         [ #  # ]:          0 :             if ( rTitle.compareTo( pData->GetLowerTitle(), rTitle.getLength() ) == 0 )
    2539                 :          0 :                 return sal_True;
    2540                 :          0 :             nIndex += 1;
    2541                 :            :         }
    2542                 :            :     }
    2543                 :            : 
    2544         [ #  # ]:          0 :     return sal_False;
    2545                 :            : }
    2546                 :            : 
    2547                 :            : // -----------------------------------------------------------------------
    2548                 :          0 : void SvtFileView_Impl::SetActualFolder( const INetURLObject& rActualFolder )
    2549                 :            : {
    2550         [ #  # ]:          0 :     if( mbReplaceNames )
    2551                 :            :     {
    2552         [ #  # ]:          0 :         if( mpNameTrans )
    2553                 :          0 :             mpNameTrans->SetActualFolder( rActualFolder );
    2554                 :            :         else
    2555         [ #  # ]:          0 :             mpNameTrans = new NameTranslator_Impl( rActualFolder );
    2556                 :            :     }
    2557                 :          0 : }
    2558                 :            : 
    2559                 :            : namespace svtools {
    2560                 :            : 
    2561                 :            : // -----------------------------------------------------------------------
    2562                 :            : // QueryDeleteDlg_Impl
    2563                 :            : // -----------------------------------------------------------------------
    2564                 :            : 
    2565                 :          0 : QueryDeleteDlg_Impl::QueryDeleteDlg_Impl
    2566                 :            : (
    2567                 :            :     Window* pParent,
    2568                 :            :     const String& rName      // entry name
    2569                 :            : ) :
    2570                 :            : 
    2571                 :            :     ModalDialog( pParent, SvtResId( DLG_SVT_QUERYDELETE ) ),
    2572                 :            : 
    2573                 :            :     _aEntryLabel  ( this, SvtResId( TXT_ENTRY ) ),
    2574                 :            :     _aEntry       ( this, SvtResId( TXT_ENTRYNAME ) ),
    2575                 :            :     _aQueryMsg    ( this, SvtResId( TXT_QUERYMSG ) ),
    2576                 :            :     _aYesButton   ( this, SvtResId( BTN_YES ) ),
    2577                 :            :     _aAllButton   ( this, SvtResId( BTN_ALL ) ),
    2578                 :            :     _aNoButton    ( this, SvtResId( BTN_NO ) ),
    2579 [ #  # ][ #  # ]:          0 :     _aCancelButton( this, SvtResId( BTN_CANCEL ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    2580                 :            : 
    2581                 :            : {
    2582         [ #  # ]:          0 :     FreeResource();
    2583                 :            : 
    2584                 :            :     // Handler
    2585         [ #  # ]:          0 :     Link aLink( STATIC_LINK( this, QueryDeleteDlg_Impl, ClickLink ) );
    2586                 :          0 :     _aYesButton.SetClickHdl( aLink );
    2587                 :          0 :     _aAllButton.SetClickHdl( aLink );
    2588                 :          0 :     _aNoButton.SetClickHdl( aLink );
    2589                 :            : 
    2590                 :            :     // display specified texts
    2591                 :            : 
    2592         [ #  # ]:          0 :     WinBits nTmpStyle = _aEntry.GetStyle();
    2593                 :          0 :     nTmpStyle |= WB_PATHELLIPSIS;
    2594         [ #  # ]:          0 :     _aEntry.SetStyle( nTmpStyle );
    2595         [ #  # ]:          0 :     _aEntry.SetText( rName );
    2596                 :          0 : }
    2597                 :            : 
    2598                 :            : // -----------------------------------------------------------------------
    2599                 :            : 
    2600                 :          0 : IMPL_STATIC_LINK( QueryDeleteDlg_Impl, ClickLink, PushButton*, pBtn )
    2601                 :            : {
    2602         [ #  # ]:          0 :     if ( pBtn == &pThis->_aYesButton )
    2603                 :          0 :         pThis->_eResult = QUERYDELETE_YES;
    2604         [ #  # ]:          0 :     else if ( pBtn == &pThis->_aNoButton )
    2605                 :          0 :         pThis->_eResult = QUERYDELETE_NO;
    2606         [ #  # ]:          0 :     else if ( pBtn == &pThis->_aAllButton )
    2607                 :          0 :         pThis->_eResult = QUERYDELETE_ALL;
    2608         [ #  # ]:          0 :     else if ( pBtn == &pThis->_aCancelButton )
    2609                 :          0 :         pThis->_eResult = QUERYDELETE_CANCEL;
    2610                 :            : 
    2611                 :          0 :     pThis->EndDialog( RET_OK );
    2612                 :            : 
    2613                 :          0 :     return 0;
    2614                 :            : }
    2615                 :            : 
    2616                 :            : }
    2617                 :            : 
    2618                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10