office-gobmx/svtools/source/contnr/contentenumeration.hxx

284 lines
10 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef SVTOOLS_SOURCE_CONTNR_CONTENTENUMERATION_HXX
#define SVTOOLS_SOURCE_CONTNR_CONTENTENUMERATION_HXX
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/document/XStandaloneDocumentInfo.hpp>
#include <salhelper/thread.hxx>
#include <ucbhelper/content.hxx>
#include <rtl/ustring.hxx>
#include <tools/datetime.hxx>
2012-01-03 08:12:33 -06:00
#include <tools/string.hxx>
#include <vcl/image.hxx>
class IUrlFilter;
//........................................................................
namespace svt
{
//........................................................................
//====================================================================
//= SortingData_Impl
//====================================================================
struct SortingData_Impl
{
private:
::rtl::OUString maFilename; // only filename in upper case - for compare purposes
::rtl::OUString maTitle; // -> be carefull when changing maTitle to update maFilename only when new
::rtl::OUString maLowerTitle;
CWS-TOOLING: integrate CWS cmis01 2009-02-03 20:05:24 +0100 tkr r267341 : #i95301# fixed crash due wrong array length + resolve merge conflicts 2009-01-12 08:35:39 +0100 tkr r266134 : #158978# support unescaped whitespaces in webdav 2009-01-12 08:33:10 +0100 tkr r266133 : #i95307# build error after rebasing fixed 2009-01-07 09:47:09 +0100 tkr r265948 : #159046# Add new path to the wntmsci12 search path 2009-01-05 15:34:19 +0100 tkr r265873 : CWS-TOOLING: rebase CWS cmis01 to trunk@265758 (milestone: DEV300:m38) 2008-12-23 09:38:53 +0100 tkr r265774 : #158537# new property 2008-12-23 09:36:25 +0100 tkr r265773 : #158537# new property 2008-10-29 13:08:30 +0100 mav r262791 : #i94273# let the interaction handler be used for authentication 2008-10-24 15:56:26 +0200 tkr r262649 : #i95310# NTLM support 2008-10-22 18:14:02 +0200 mav r262611 : #i94273# fix the http scenario 2008-10-22 12:41:12 +0200 tkr r262596 : #i95310# NTLM support repaired (new neon version) 2008-10-22 12:38:47 +0200 tkr r262595 : #i95310# NTLM support repaired (new neon version) 2008-10-22 12:38:31 +0200 tkr r262594 : #i95310# NTLM support repaired (new neon version) 2008-10-22 12:29:43 +0200 tkr r262593 : #i95307# Add blacklist support 2008-10-22 12:29:24 +0200 tkr r262592 : #i95307# Add blacklist support 2008-10-22 12:29:07 +0200 tkr r262591 : #i95307# Add blacklist support 2008-10-22 12:28:44 +0200 tkr r262590 : #i95307# Add blacklist support 2008-10-22 12:25:01 +0200 tkr r262589 : #i95307# Add blacklist support 2008-10-22 12:24:28 +0200 tkr r262588 : #i95307# Add blacklist support 2008-10-22 12:22:36 +0200 tkr r262587 : #i95307# Add blacklist support 2008-10-21 12:46:34 +0200 mav r262568 : #i94273# allow to specify the suggested on IO SaveAs directory and filename 2008-10-21 12:44:49 +0200 mav r262566 : #i94273# allow to specify the suggested on IO SaveAs directory and filename
2009-03-03 04:51:13 -06:00
public:
::rtl::OUString maType;
::rtl::OUString maTargetURL;
::rtl::OUString maImageURL;
::rtl::OUString maDisplayText;
DateTime maModDate;
Image maImage;
sal_Int64 maSize;
sal_Bool mbIsFolder;
sal_Bool mbIsVolume;
sal_Bool mbIsRemote;
sal_Bool mbIsRemoveable;
sal_Bool mbIsFloppy;
sal_Bool mbIsCompactDisc;
inline SortingData_Impl();
inline const ::rtl::OUString& GetTitle() const;
inline const ::rtl::OUString& GetLowerTitle() const;
inline const ::rtl::OUString& GetFileName() const;
inline void SetNewTitle( const ::rtl::OUString& rNewTitle ); // new maTitle is set -> maFilename is set to same!
inline void ChangeTitle( const ::rtl::OUString& rChangedTitle ); // maTitle is changed, maFilename is unchanged!
private:
inline void SetTitles( const ::rtl::OUString& rNewTitle );
};
inline SortingData_Impl::SortingData_Impl() :
maModDate ( DateTime::EMPTY ),
maSize ( 0 ),
mbIsFolder ( sal_False ),
mbIsVolume ( sal_False ),
mbIsRemote ( sal_False ),
mbIsRemoveable ( sal_False ),
mbIsFloppy ( sal_False ),
mbIsCompactDisc ( sal_False )
{
}
inline const ::rtl::OUString& SortingData_Impl::GetTitle() const
{
return maTitle;
}
inline const ::rtl::OUString& SortingData_Impl::GetLowerTitle() const
{
return maLowerTitle;
}
inline const ::rtl::OUString& SortingData_Impl::GetFileName() const
{
return maFilename;
}
inline void SortingData_Impl::SetNewTitle( const ::rtl::OUString& rNewTitle )
{
SetTitles( rNewTitle );
maFilename = rNewTitle.toAsciiUpperCase();
}
inline void SortingData_Impl::ChangeTitle( const ::rtl::OUString& rChangedTitle )
{
SetTitles( rChangedTitle );
}
inline void SortingData_Impl::SetTitles( const ::rtl::OUString& rNewTitle )
{
maTitle = rNewTitle;
maLowerTitle = rNewTitle.toAsciiLowerCase();
}
//====================================================================
//= IContentTitleTranslation
//====================================================================
class IContentTitleTranslation
{
public:
virtual sal_Bool GetTranslation( const ::rtl::OUString& _rOriginalName, ::rtl::OUString& _rTranslatedName ) const = 0;
protected:
~IContentTitleTranslation() {}
};
//====================================================================
//= EnumerationResult
//====================================================================
enum EnumerationResult
{
SUCCESS, /// the enumeration was successful
ERROR, /// the enumeration was unsuccessful
RUNNING /// the enumeration is still running, and the maximum wait time has passed
};
//====================================================================
//= FolderDescriptor
//====================================================================
struct FolderDescriptor
{
/** a content object describing the folder. Can be <NULL/>, in this case <member>sURL</member>
is relevant.
*/
::ucbhelper::Content aContent;
/** the URL of a folder. Will be ignored if <member>aContent</member> is not <NULL/>.
*/
String sURL;
FolderDescriptor() { }
FolderDescriptor( const ::ucbhelper::Content& _rContent )
:aContent( _rContent )
{
}
FolderDescriptor( const String& _rURL )
:sURL( _rURL )
{
}
};
//====================================================================
//= IEnumerationResultHandler
//====================================================================
class IEnumerationResultHandler
{
public:
virtual void enumerationDone( EnumerationResult _eResult ) = 0;
protected:
~IEnumerationResultHandler() {}
};
//====================================================================
//= FileViewContentEnumerator
//====================================================================
class FileViewContentEnumerator: public salhelper::Thread
{
public:
typedef ::std::vector< SortingData_Impl* > ContentData;
private:
ContentData& m_rContent;
::osl::Mutex& m_rContentMutex;
mutable ::osl::Mutex m_aMutex;
FolderDescriptor m_aFolder;
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >
m_xCommandEnv;
const IUrlFilter* m_pFilter;
const IContentTitleTranslation* m_pTranslator;
IEnumerationResultHandler* m_pResultHandler;
bool m_bCancelled;
mutable ::com::sun::star::uno::Reference< ::com::sun::star::document::XStandaloneDocumentInfo >
m_xDocInfo;
CWS-TOOLING: integrate CWS cmis01 2009-02-03 20:05:24 +0100 tkr r267341 : #i95301# fixed crash due wrong array length + resolve merge conflicts 2009-01-12 08:35:39 +0100 tkr r266134 : #158978# support unescaped whitespaces in webdav 2009-01-12 08:33:10 +0100 tkr r266133 : #i95307# build error after rebasing fixed 2009-01-07 09:47:09 +0100 tkr r265948 : #159046# Add new path to the wntmsci12 search path 2009-01-05 15:34:19 +0100 tkr r265873 : CWS-TOOLING: rebase CWS cmis01 to trunk@265758 (milestone: DEV300:m38) 2008-12-23 09:38:53 +0100 tkr r265774 : #158537# new property 2008-12-23 09:36:25 +0100 tkr r265773 : #158537# new property 2008-10-29 13:08:30 +0100 mav r262791 : #i94273# let the interaction handler be used for authentication 2008-10-24 15:56:26 +0200 tkr r262649 : #i95310# NTLM support 2008-10-22 18:14:02 +0200 mav r262611 : #i94273# fix the http scenario 2008-10-22 12:41:12 +0200 tkr r262596 : #i95310# NTLM support repaired (new neon version) 2008-10-22 12:38:47 +0200 tkr r262595 : #i95310# NTLM support repaired (new neon version) 2008-10-22 12:38:31 +0200 tkr r262594 : #i95310# NTLM support repaired (new neon version) 2008-10-22 12:29:43 +0200 tkr r262593 : #i95307# Add blacklist support 2008-10-22 12:29:24 +0200 tkr r262592 : #i95307# Add blacklist support 2008-10-22 12:29:07 +0200 tkr r262591 : #i95307# Add blacklist support 2008-10-22 12:28:44 +0200 tkr r262590 : #i95307# Add blacklist support 2008-10-22 12:25:01 +0200 tkr r262589 : #i95307# Add blacklist support 2008-10-22 12:24:28 +0200 tkr r262588 : #i95307# Add blacklist support 2008-10-22 12:22:36 +0200 tkr r262587 : #i95307# Add blacklist support 2008-10-21 12:46:34 +0200 mav r262568 : #i94273# allow to specify the suggested on IO SaveAs directory and filename 2008-10-21 12:44:49 +0200 mav r262566 : #i94273# allow to specify the suggested on IO SaveAs directory and filename
2009-03-03 04:51:13 -06:00
::com::sun::star::uno::Sequence< ::rtl::OUString > m_rBlackList;
sal_Bool URLOnBlackList ( const ::rtl::OUString& sRealURL );
public:
/** constructs an enumerator instance
@param _rContentToFill
the structure which is to be filled with the found content
@param _rContentMutex
the mutex which protects the access to <arg>_rContentToFill</arg>
@param _pTranslator
an instance which should be used to translate content titles. May be <NULL/>
*/
FileViewContentEnumerator(
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& _rxCommandEnv,
ContentData& _rContentToFill,
::osl::Mutex& _rContentMutex,
const IContentTitleTranslation* _pTranslator
);
/** enumerates the content of a given folder
@param _rFolder
the folder whose content is to be enumerated
@param _pFilter
a filter to apply to the found contents
@param _pResultHandler
an instance which should handle the results of the enumeration
*/
void enumerateFolderContent(
const FolderDescriptor& _rFolder,
const IUrlFilter* _pFilter,
IEnumerationResultHandler* _pResultHandler
);
/** enumerates the content of a given folder synchronously
*/
EnumerationResult enumerateFolderContentSync(
const FolderDescriptor& _rFolder,
CWS-TOOLING: integrate CWS cmis01 2009-02-03 20:05:24 +0100 tkr r267341 : #i95301# fixed crash due wrong array length + resolve merge conflicts 2009-01-12 08:35:39 +0100 tkr r266134 : #158978# support unescaped whitespaces in webdav 2009-01-12 08:33:10 +0100 tkr r266133 : #i95307# build error after rebasing fixed 2009-01-07 09:47:09 +0100 tkr r265948 : #159046# Add new path to the wntmsci12 search path 2009-01-05 15:34:19 +0100 tkr r265873 : CWS-TOOLING: rebase CWS cmis01 to trunk@265758 (milestone: DEV300:m38) 2008-12-23 09:38:53 +0100 tkr r265774 : #158537# new property 2008-12-23 09:36:25 +0100 tkr r265773 : #158537# new property 2008-10-29 13:08:30 +0100 mav r262791 : #i94273# let the interaction handler be used for authentication 2008-10-24 15:56:26 +0200 tkr r262649 : #i95310# NTLM support 2008-10-22 18:14:02 +0200 mav r262611 : #i94273# fix the http scenario 2008-10-22 12:41:12 +0200 tkr r262596 : #i95310# NTLM support repaired (new neon version) 2008-10-22 12:38:47 +0200 tkr r262595 : #i95310# NTLM support repaired (new neon version) 2008-10-22 12:38:31 +0200 tkr r262594 : #i95310# NTLM support repaired (new neon version) 2008-10-22 12:29:43 +0200 tkr r262593 : #i95307# Add blacklist support 2008-10-22 12:29:24 +0200 tkr r262592 : #i95307# Add blacklist support 2008-10-22 12:29:07 +0200 tkr r262591 : #i95307# Add blacklist support 2008-10-22 12:28:44 +0200 tkr r262590 : #i95307# Add blacklist support 2008-10-22 12:25:01 +0200 tkr r262589 : #i95307# Add blacklist support 2008-10-22 12:24:28 +0200 tkr r262588 : #i95307# Add blacklist support 2008-10-22 12:22:36 +0200 tkr r262587 : #i95307# Add blacklist support 2008-10-21 12:46:34 +0200 mav r262568 : #i94273# allow to specify the suggested on IO SaveAs directory and filename 2008-10-21 12:44:49 +0200 mav r262566 : #i94273# allow to specify the suggested on IO SaveAs directory and filename
2009-03-03 04:51:13 -06:00
const IUrlFilter* _pFilter,
const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rBlackList = ::com::sun::star::uno::Sequence< ::rtl::OUString >()
);
/** cancels the running operation.
Note that "cancel" may mean that the operation is running, but its result
is simply disregarded later on.
*/
void cancel();
protected:
~FileViewContentEnumerator();
private:
EnumerationResult enumerateFolderContent();
// Thread overridables
virtual void execute();
private:
sal_Bool implGetDocTitle( const ::rtl::OUString& _rTargetURL, ::rtl::OUString& _rRet ) const;
};
//........................................................................
} // namespace svt
//........................................................................
#endif // SVTOOLS_SOURCE_CONTNR_CONTENTENUMERATION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */