summaryrefslogtreecommitdiff
path: root/ucb/source/ucp
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2003-03-27 16:27:21 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2003-03-27 16:27:21 +0000
commitbcfa252336671880cf1d41510d2f54483548c2bd (patch)
treef4a69da2fafa8f54b44391e2fc75156e1a81cb0f /ucb/source/ucp
parent3aa3d8c5931c38f00e90a4752dd9ca2a697a2103 (diff)
MWS_SRX644: migrate branch mws_srx644 -> HEAD
Diffstat (limited to 'ucb/source/ucp')
-rw-r--r--ucb/source/ucp/file/bc.cxx15
-rw-r--r--ucb/source/ucp/file/filerror.hxx9
-rw-r--r--ucb/source/ucp/file/filglob.cxx96
-rw-r--r--ucb/source/ucp/file/filinsreq.cxx77
-rw-r--r--ucb/source/ucp/file/filinsreq.hxx39
-rw-r--r--ucb/source/ucp/file/filtask.cxx19
-rw-r--r--ucb/source/ucp/file/filtask.hxx8
-rw-r--r--ucb/source/ucp/file/shell.cxx355
-rw-r--r--ucb/source/ucp/file/shell.hxx5
-rw-r--r--ucb/source/ucp/ftp/ftpcontent.cxx62
-rw-r--r--ucb/source/ucp/ftp/ftpcontentcaps.cxx13
-rw-r--r--ucb/source/ucp/ftp/ftpcontentprovider.cxx6
-rw-r--r--ucb/source/ucp/ftp/ftpcontentprovider.hxx18
-rw-r--r--ucb/source/ucp/ftp/ftpinpstr.cxx26
-rw-r--r--ucb/source/ucp/ftp/ftpintreq.cxx214
-rw-r--r--ucb/source/ucp/ftp/ftpintreq.hxx235
-rw-r--r--ucb/source/ucp/ftp/ftpurl.cxx16
-rw-r--r--ucb/source/ucp/ftp/ftpurl.hxx8
-rw-r--r--ucb/source/ucp/ftp/makefile.mk30
-rw-r--r--ucb/source/ucp/ftp/ucpftp.xml (renamed from ucb/source/ucp/odma/ucpodma.xml)95
-rw-r--r--ucb/source/ucp/hierarchy/makefile.mk6
-rw-r--r--ucb/source/ucp/odma/exports.map8
-rw-r--r--ucb/source/ucp/odma/makefile.mk155
-rw-r--r--ucb/source/ucp/odma/odma.h1
-rw-r--r--ucb/source/ucp/odma/odma_content.cxx1313
-rw-r--r--ucb/source/ucp/odma/odma_content.hxx234
-rw-r--r--ucb/source/ucp/odma/odma_contentcaps.cxx300
-rw-r--r--ucb/source/ucp/odma/odma_contentprops.hxx127
-rw-r--r--ucb/source/ucp/odma/odma_datasupplier.cxx502
-rw-r--r--ucb/source/ucp/odma/odma_datasupplier.hxx110
-rw-r--r--ucb/source/ucp/odma/odma_inputstream.cxx336
-rw-r--r--ucb/source/ucp/odma/odma_inputstream.hxx187
-rw-r--r--ucb/source/ucp/odma/odma_lib.cxx170
-rw-r--r--ucb/source/ucp/odma/odma_lib.hxx308
-rw-r--r--ucb/source/ucp/odma/odma_main.cxx110
-rw-r--r--ucb/source/ucp/odma/odma_provider.cxx651
-rw-r--r--ucb/source/ucp/odma/odma_provider.hxx217
-rw-r--r--ucb/source/ucp/odma/odma_resultset.cxx135
-rw-r--r--ucb/source/ucp/odma/odma_resultset.hxx103
-rw-r--r--ucb/source/ucp/odma/odma_services.cxx183
-rw-r--r--ucb/source/ucp/package/makefile.mk6
-rw-r--r--ucb/source/ucp/package/pkgcontent.cxx14
-rw-r--r--ucb/source/ucp/package/pkgdatasupplier.cxx45
-rw-r--r--ucb/source/ucp/package/pkgdatasupplier.hxx6
-rw-r--r--ucb/source/ucp/package/pkgprovider.cxx16
-rw-r--r--ucb/source/ucp/package/pkgprovider.hxx6
-rw-r--r--ucb/source/ucp/package/pkguri.cxx50
-rw-r--r--ucb/source/ucp/package/pkguri.hxx8
-rw-r--r--ucb/source/ucp/webdav/ContentProperties.hxx6
-rw-r--r--ucb/source/ucp/webdav/DAVException.hxx76
-rw-r--r--ucb/source/ucp/webdav/DAVRequestEnvironment.hxx10
-rw-r--r--ucb/source/ucp/webdav/DAVResourceAccess.cxx20
-rw-r--r--ucb/source/ucp/webdav/NeonPropFindRequest.cxx16
-rw-r--r--ucb/source/ucp/webdav/NeonSession.cxx74
-rw-r--r--ucb/source/ucp/webdav/makefile.mk6
-rw-r--r--ucb/source/ucp/webdav/ucpdav.xml1
-rw-r--r--ucb/source/ucp/webdav/webdavcontent.cxx619
-rw-r--r--ucb/source/ucp/webdav/webdavcontent.hxx33
58 files changed, 1821 insertions, 5693 deletions
diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx
index 8eda9cdeac..cf97153207 100644
--- a/ucb/source/ucp/file/bc.cxx
+++ b/ucb/source/ucp/file/bc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: bc.cxx,v $
*
- * $Revision: 1.27 $
+ * $Revision: 1.28 $
*
- * last change: $Author: abi $ $Date: 2002-10-31 16:24:33 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1265,9 +1265,16 @@ void SAL_CALL BaseContent::insert( sal_Int32 nMyCommandIdentifier,
if( success )
break;
- XInteractionRequestImpl *aRequestImpl = new XInteractionRequestImpl;
+ XInteractionRequestImpl *aRequestImpl =
+ new XInteractionRequestImpl(
+ rtl::Uri::decode(
+ getTitle(m_aUncPath),
+ rtl_UriDecodeWithCharset,
+ RTL_TEXTENCODING_UTF8),
+ (cppu::OWeakObject*)this,
+ m_pMyShell,nMyCommandIdentifier);
uno::Reference< task::XInteractionRequest > aReq( aRequestImpl );
-
+
m_pMyShell->handleTask( nMyCommandIdentifier,aReq );
if( aRequestImpl->aborted() ||
!aRequestImpl->newName().getLength() )
diff --git a/ucb/source/ucp/file/filerror.hxx b/ucb/source/ucp/file/filerror.hxx
index 984bc17c71..18a93385e8 100644
--- a/ucb/source/ucp/file/filerror.hxx
+++ b/ucb/source/ucp/file/filerror.hxx
@@ -3,7 +3,8 @@
namespace fileaccess {
// Error codes used to deliver the resulting exceptions
-
+#define LOWEST_FREE_ERROR 72
+
#define TASKHANDLER_NO_ERROR 0
#define TASKHANDLER_UNSUPPORTED_COMMAND 1
#define TASKHANDLING_WRONG_SETPROPERTYVALUES_ARGUMENT 2
@@ -39,12 +40,14 @@ namespace fileaccess {
#define TASKHANDLING_BUFFERSIZEEXCEEDED_FOR_WRITE 29
#define TASKHANDLING_IOEXCEPTION_FOR_WRITE 30
#define TASKHANDLING_FILEIOERROR_FOR_WRITE 31
+#define TASKHANDLING_FILEIOERROR_FOR_NO_SPACE 71
#define TASKHANDLING_FILESIZE_FOR_WRITE 32
#define TASKHANDLING_INPUTSTREAM_FOR_WRITE 33
#define TASKHANDLING_NOREPLACE_FOR_WRITE 34
#define TASKHANDLING_ENSUREDIR_FOR_WRITE 35
#define TASKHANDLING_FOLDER_EXISTS_MKDIR 69
+#define TASKHANDLING_INVALID_NAME_MKDIR 70
#define TASKHANDLING_CREATEDIRECTORY_MKDIR 36
#define TASKHANDLING_NOSUCHFILEORDIR_FOR_REMOVE 38
@@ -84,3 +87,7 @@ namespace fileaccess {
}
#endif
+
+
+
+
diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx
index 843931ff73..58dc7c4591 100644
--- a/ucb/source/ucp/file/filglob.cxx
+++ b/ucb/source/ucp/file/filglob.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: filglob.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: abi $ $Date: 2002-10-31 16:24:36 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -117,6 +117,9 @@
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
#include "com/sun/star/breans/PropertyValue.hpp"
#endif
+#ifndef _COM_SUN_STAR_UCB_INTERACTIVEAUGMENTEDIOEXCEPTION_HPP_
+#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#endif
#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
#include "com/sun/star/uno/Any.hxx"
#endif
@@ -129,8 +132,11 @@
#ifndef _RTL_USTRBUF_HXX_
#include "rtl/ustrbuf.hxx"
#endif
+#ifndef _RTL_URI_HXX_
+#include <rtl/uri.hxx>
+#endif
#ifndef _RTL_USTRING_HXX_
-#include "rtl/ustring.hxx"
+#include <rtl/ustring.hxx>
#endif
#ifndef _SAL_TYPES_H_
#include "sal/types.h"
@@ -611,7 +617,19 @@ namespace fileaccess {
RTL_CONSTASCII_USTRINGPARAM(
"an error occured writing or reading from a file")),
xComProc );
- }
+ }
+ else if( errorCode == TASKHANDLING_FILEIOERROR_FOR_NO_SPACE )
+ {
+ ioErrorCode = IOErrorCode_OUT_OF_DISK_SPACE;
+ cancelCommandExecution(
+ ioErrorCode,
+ generateErrorArguments(pShell,aUncPath),
+ xEnv,
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "device full")),
+ xComProc);
+ }
else if( errorCode == TASKHANDLING_FILEIOERROR_FOR_WRITE ||
errorCode == TASKHANDLING_READING_FILE_FOR_PAGING )
{
@@ -729,17 +747,69 @@ namespace fileaccess {
aAny <<= excep;
cancelCommandExecution( aAny,xEnv );
}
+ else if( errorCode == TASKHANDLING_INVALID_NAME_MKDIR )
+ {
+ InteractiveAugmentedIOException excep;
+ excep.Code = IOErrorCode_INVALID_CHARACTER;
+ PropertyValue prop;
+ prop.Name = rtl::OUString::createFromAscii("ResourceName");
+ prop.Handle = -1;
+ rtl::OUString m_aClashingName(
+ rtl::Uri::decode(
+ getTitle(aUncPath),
+ rtl_UriDecodeWithCharset,
+ RTL_TEXTENCODING_UTF8));
+ prop.Value <<= m_aClashingName;
+ Sequence<Any> seq(1);
+ seq[0] <<= prop;
+ excep.Arguments = seq;
+ excep.Classification = InteractionClassification_ERROR;
+ Reference<XInterface> xContext(xComProc,UNO_QUERY);
+ excep.Context = xContext;
+ excep.Message = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "the name contained invalid characters"));
+ if(isHandled)
+ throw excep;
+ else {
+ aAny <<= excep;
+ cancelCommandExecution( aAny,xEnv );
+ }
+// ioErrorCode = IOErrorCode_INVALID_CHARACTER;
+// cancelCommandExecution(
+// ioErrorCode,
+// generateErrorArguments(pShell,aUncPath),
+// xEnv,
+// rtl::OUString(
+// RTL_CONSTASCII_USTRINGPARAM(
+// "the name contained invalid characters")),
+// xComProc );
+ }
else if( errorCode == TASKHANDLING_FOLDER_EXISTS_MKDIR )
{
- ioErrorCode = IOErrorCode_ALREADY_EXISTING;
- cancelCommandExecution(
- ioErrorCode,
- generateErrorArguments(pShell,aUncPath),
- xEnv,
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "the folder exists")),
- xComProc );
+ NameClashException excep;
+ excep.Name = getTitle(aUncPath);
+ excep.Classification = InteractionClassification_ERROR;
+ Reference<XInterface> xContext(xComProc,UNO_QUERY);
+ excep.Context = xContext;
+ excep.Message = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "folder exists and overwritte forbidden"));
+ if(isHandled)
+ throw excep;
+ else {
+ aAny <<= excep;
+ cancelCommandExecution( aAny,xEnv );
+ }
+// ioErrorCode = IOErrorCode_ALREADY_EXISTING;
+// cancelCommandExecution(
+// ioErrorCode,
+// generateErrorArguments(pShell,aUncPath),
+// xEnv,
+// rtl::OUString(
+// RTL_CONSTASCII_USTRINGPARAM(
+// "the folder exists")),
+// xComProc );
}
else if( errorCode == TASKHANDLING_ENSUREDIR_FOR_WRITE ||
errorCode == TASKHANDLING_CREATEDIRECTORY_MKDIR )
diff --git a/ucb/source/ucp/file/filinsreq.cxx b/ucb/source/ucp/file/filinsreq.cxx
index 372d4476a5..c5f8f31793 100644
--- a/ucb/source/ucp/file/filinsreq.cxx
+++ b/ucb/source/ucp/file/filinsreq.cxx
@@ -1,5 +1,17 @@
-#ifndef _FILINSREQ_HXX_
#include "filinsreq.hxx"
+#include "shell.hxx"
+#include "filglob.hxx"
+#ifndef _COM_SUN_STAR_UCB_IOERRORCODE_HPP_
+#include <com/sun/star/ucb/IOErrorCode.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_INTERACTIVEAUGMENTEDIOEXCEPTION_HPP_
+#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_NAMECLASHEXCEPTION_HPP_
+#include <com/sun/star/ucb/NameClashException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
#endif
@@ -10,6 +22,7 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::task;
using namespace com::sun::star::ucb;
+using namespace com::sun::star::beans;
using namespace fileaccess;
@@ -92,11 +105,20 @@ XTYPEPROVIDER_IMPL_2( XInteractionAbortImpl,
-XInteractionRequestImpl::XInteractionRequestImpl()
+XInteractionRequestImpl::XInteractionRequestImpl(
+ const rtl::OUString& aClashingName,
+ const Reference<XInterface>& xOrigin,
+ shell *pShell,sal_Int32 CommandId)
: m_aSeq( 2 ),
p1( new XInteractionSupplyNameImpl ),
- p2( new XInteractionAbortImpl )
-{
+ p2( new XInteractionAbortImpl ),
+ m_aClashingName(aClashingName),
+ m_xOrigin(xOrigin),
+ m_nErrorCode(0),
+ m_nMinorError(0)
+{
+ if( pShell )
+ pShell->retrieveError(CommandId,m_nErrorCode,m_nMinorError);
m_aSeq[0] = Reference<XInteractionContinuation>(p1);
m_aSeq[1] = Reference<XInteractionContinuation>(p2);
}
@@ -124,9 +146,11 @@ Any SAL_CALL
XInteractionRequestImpl::queryInterface( const Type& rType )
throw( RuntimeException )
{
- Any aRet = cppu::queryInterface( rType,
- SAL_STATIC_CAST( lang::XTypeProvider*, this ),
- SAL_STATIC_CAST( XInteractionRequest*,this) );
+ Any aRet =
+ cppu::queryInterface(
+ rType,
+ SAL_STATIC_CAST( lang::XTypeProvider*, this ),
+ SAL_STATIC_CAST( XInteractionRequest*,this) );
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
}
@@ -138,3 +162,42 @@ XInteractionRequestImpl::queryInterface( const Type& rType )
XTYPEPROVIDER_IMPL_2( XInteractionRequestImpl,
XTypeProvider,
XInteractionRequest )
+
+
+Any SAL_CALL
+XInteractionRequestImpl::getRequest()
+ throw(RuntimeException)
+{
+ Any aAny;
+ if(m_nErrorCode == TASKHANDLING_FOLDER_EXISTS_MKDIR)
+ {
+ NameClashException excep;
+ excep.Name = m_aClashingName;
+ excep.Classification = InteractionClassification_ERROR;
+ excep.Context = m_xOrigin;
+ excep.Message = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "folder exists and overwritte forbidden"));
+ aAny <<= excep;
+ }
+ else if(m_nErrorCode == TASKHANDLING_INVALID_NAME_MKDIR)
+ {
+ InteractiveAugmentedIOException excep;
+ excep.Code = IOErrorCode_INVALID_CHARACTER;
+ PropertyValue prop;
+ prop.Name = rtl::OUString::createFromAscii("ResourceName");
+ prop.Handle = -1;
+ prop.Value <<= m_aClashingName;
+ Sequence<Any> seq(1);
+ seq[0] <<= prop;
+ excep.Arguments = seq;
+ excep.Classification = InteractionClassification_ERROR;
+ excep.Context = m_xOrigin;
+ excep.Message = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "the name contained invalid characters"));
+ aAny <<= excep;
+
+ }
+ return aAny;
+}
diff --git a/ucb/source/ucp/file/filinsreq.hxx b/ucb/source/ucp/file/filinsreq.hxx
index 268825afd9..d2a02f1626 100644
--- a/ucb/source/ucp/file/filinsreq.hxx
+++ b/ucb/source/ucp/file/filinsreq.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: filinsreq.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: abi $ $Date: 2001-11-19 11:11:29 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -87,13 +87,13 @@
#ifndef _COM_SUN_STAR_TASK_XINTERACTIONREQUEST_HPP_
#include <com/sun/star/task/XInteractionRequest.hpp>
#endif
-#ifndef _COM_SUN_STAR_UCB_NAMECLASHEXCEPTION_HPP_
-#include <com/sun/star/ucb/NameClashException.hpp>
-#endif
namespace fileaccess {
+
+ class shell;
+
class XInteractionSupplyNameImpl
: public cppu::OWeakObject,
@@ -217,7 +217,12 @@ namespace fileaccess {
{
public:
- XInteractionRequestImpl();
+ XInteractionRequestImpl(
+ const rtl::OUString& aClashingName,
+ const com::sun::star::uno::Reference<
+ com::sun::star::uno::XInterface>& xOrigin,
+ shell* pShell,
+ sal_Int32 CommandId);
virtual com::sun::star::uno::Any SAL_CALL
queryInterface(
@@ -240,14 +245,11 @@ namespace fileaccess {
XTYPEPROVIDER_DECL()
::com::sun::star::uno::Any SAL_CALL getRequest( )
- throw (::com::sun::star::uno::RuntimeException)
- {
- ::com::sun::star::uno::Any aAny;
- aAny <<= com::sun::star::ucb::NameClashException();
- return aAny;
- }
+ throw (::com::sun::star::uno::RuntimeException);
- com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > > SAL_CALL
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > SAL_CALL
getContinuations( )
throw (::com::sun::star::uno::RuntimeException)
{
@@ -271,10 +273,15 @@ namespace fileaccess {
XInteractionSupplyNameImpl* p1;
XInteractionAbortImpl* p2;
-
- com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > > m_aSeq;
-
+ sal_Int32 m_nErrorCode,m_nMinorError;
+
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > m_aSeq;
+ rtl::OUString m_aClashingName;
+ com::sun::star::uno::Reference<
+ com::sun::star::uno::XInterface> m_xOrigin;
};
}
diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx
index 5648ee1fdc..b0da1d6ee5 100644
--- a/ucb/source/ucp/file/filtask.cxx
+++ b/ucb/source/ucp/file/filtask.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: filtask.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: abi $ $Date: 2002-10-31 16:24:41 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -176,6 +176,21 @@ void SAL_CALL TaskManager::clearError( sal_Int32 CommandId )
}
+void SAL_CALL TaskManager::retrieveError( sal_Int32 CommandId,
+ sal_Int32 &ErrorCode,
+ sal_Int32 &minorCode)
+{
+ vos::OGuard aGuard( m_aMutex );
+ TaskMap::iterator it = m_aTaskMap.find( CommandId );
+ if( it != m_aTaskMap.end() )
+ {
+ ErrorCode = it->second.getInstalledError();
+ minorCode = it->second. getMinorErrorCode();
+ }
+}
+
+
+
void SAL_CALL TaskManager::installError( sal_Int32 CommandId,
sal_Int32 ErrorCode,
sal_Int32 MinorCode )
diff --git a/ucb/source/ucp/file/filtask.hxx b/ucb/source/ucp/file/filtask.hxx
index 14fb485925..97526f27e4 100644
--- a/ucb/source/ucp/file/filtask.hxx
+++ b/ucb/source/ucp/file/filtask.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: filtask.hxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: abi $ $Date: 2002-10-31 16:24:42 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -254,6 +254,10 @@ namespace fileaccess
// sal_Int32 ErrorCode,
// rtl::OUString message );
+ void SAL_CALL retrieveError( sal_Int32 CommandId,
+ sal_Int32 &ErrorCode,
+ sal_Int32 &minorCode);
+
/**
* Deinstalls the task and evaluates a possibly set error code.
* "endTask" throws in case an error code is set the corresponding exception.
diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx
index 1b25a563a1..13314740b0 100644
--- a/ucb/source/ucp/file/shell.cxx
+++ b/ucb/source/ucp/file/shell.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: shell.cxx,v $
*
- * $Revision: 1.72 $
+ * $Revision: 1.73 $
*
- * last change: $Author: abi $ $Date: 2002-10-31 16:24:42 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -264,6 +264,8 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF
m_sCommandInfo( 8 ),
m_bFaked( false ),
Title( rtl::OUString::createFromAscii( "Title" ) ),
+ CasePreservingURL(
+ rtl::OUString::createFromAscii( "CasePreservingURL" ) ),
IsDocument( rtl::OUString::createFromAscii( "IsDocument" ) ),
IsFolder( rtl::OUString::createFromAscii( "IsFolder" ) ),
DateModified( rtl::OUString::createFromAscii( "DateModified" ) ),
@@ -288,6 +290,18 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF
beans::PropertyState_DEFAULT_VALUE,
beans::PropertyAttribute::MAYBEVOID
| beans::PropertyAttribute::BOUND ) );
+
+ // CasePreservingURL
+ m_aDefaultProperties.insert(
+ MyProperty( true,
+ CasePreservingURL,
+ -1 ,
+ getCppuType( static_cast< rtl::OUString* >( 0 ) ),
+ uno::Any(),
+ beans::PropertyState_DEFAULT_VALUE,
+ beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY ) );
// IsFolder
@@ -370,17 +384,23 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF
| beans::PropertyAttribute::READONLY ) );
// Remote
- m_aDefaultProperties.insert( MyProperty( true,
- IsHidden,
- -1 ,
- getCppuType( static_cast< sal_Bool* >( 0 ) ),
- uno::Any(),
- beans::PropertyState_DEFAULT_VALUE,
- beans::PropertyAttribute::MAYBEVOID
- | beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::READONLY ) );
+ m_aDefaultProperties.insert(
+ MyProperty(
+ true,
+ IsHidden,
+ -1 ,
+ getCppuType( static_cast< sal_Bool* >( 0 ) ),
+ uno::Any(),
+ beans::PropertyState_DEFAULT_VALUE,
+ beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::BOUND
+#ifdef WNT
+ ));
+#else
+ | beans::PropertyAttribute::READONLY)); // under unix/linux only readable
+#endif
+
-
// ContentType
uno::Any aAny;
@@ -983,20 +1003,50 @@ shell::setv( sal_Int32 CommandId,
else
ret[i] <<= beans::IllegalTypeException();
}
- else if( values[i].Name == IsReadOnly )
+ else if(values[i].Name == IsReadOnly ||
+ values[i].Name == IsHidden)
{
- sal_Bool readonly ;
- if( values[i].Value >>= readonly )
+ sal_Bool value ;
+ if( values[i].Value >>= value )
{
- osl::FileBase::RC err;
- if( readonly )
- err = osl::File::setAttributes( aUnqPath,Attribute_ReadOnly );
- else
- err = osl::File::setAttributes( aUnqPath,
- Attribute_GrpWrite |
- Attribute_GrpRead |
- Attribute_OwnWrite |
- Attribute_OwnRead );
+ osl::DirectoryItem aDirItem;
+ osl::FileBase::RC err =
+ osl::DirectoryItem::get(aUnqPath,aDirItem);
+ sal_uInt64 nAttributes(0);
+ if(err == osl::FileBase::E_None)
+ {
+ osl::FileStatus aFileStatus(FileStatusMask_Attributes);
+ err = aDirItem.getFileStatus(aFileStatus);
+ if(err == osl::FileBase::E_None &&
+ aFileStatus.isValid(FileStatusMask_Attributes))
+ nAttributes = aFileStatus.getAttributes();
+ }
+ // now we have the attributes provided all went well.
+ if(err == osl::FileBase::E_None) {
+ if(values[i].Name == IsReadOnly)
+ {
+ nAttributes &= ~(Attribute_OwnWrite |
+ Attribute_GrpWrite |
+ Attribute_OthWrite |
+ Attribute_ReadOnly);
+ if(value)
+ nAttributes |= Attribute_ReadOnly;
+ else
+ nAttributes |= (
+ Attribute_OwnWrite |
+ Attribute_GrpWrite |
+ Attribute_OthWrite);
+ }
+ else if(values[i].Name == IsHidden)
+ {
+ nAttributes &= ~(Attribute_Hidden);
+ if(value)
+ nAttributes |= Attribute_Hidden;
+ }
+ err = osl::File::setAttributes(
+ aUnqPath,nAttributes);
+ }
+
if( err != osl::FileBase::E_None )
{
--propChanged; // unsuccessful setting
@@ -1005,32 +1055,47 @@ shell::setv( sal_Int32 CommandId,
IOErrorCode ioError;
switch( err )
{
- case osl::FileBase::E_NOMEM: // not enough memory for allocating structures <br>
- ioError = IOErrorCode_OUT_OF_MEMORY;
- break;
- case osl::FileBase::E_INVAL: // the format of the parameters was not valid<p>
- ioError = IOErrorCode_INVALID_PARAMETER;
- break;
- case osl::FileBase::E_NAMETOOLONG: // File name too long<br>
- ioError = IOErrorCode_NAME_TOO_LONG;
- break;
- case osl::FileBase::E_NOENT: // No such file or directory<br>
- case osl::FileBase::E_NOLINK: // Link has been severed<br>
- ioError = IOErrorCode_NOT_EXISTING;
- break;
- case osl::FileBase::E_ROFS: // #i4735# handle ROFS transparently as ACCESS_DENIED
- case osl::FileBase::E_ACCES: // permission denied<br>
- ioError = IOErrorCode_ACCESS_DENIED;
- break;
- case osl::FileBase::E_LOOP: // Too many symbolic links encountered<br>
- case osl::FileBase::E_FAULT: // Bad address<br>
- case osl::FileBase::E_IO: // I/O error<br>
- case osl::FileBase::E_NOSYS: // Function not implemented<br>
- case osl::FileBase::E_MULTIHOP: // Multihop attempted<br>
- case osl::FileBase::E_INTR: // function call was interrupted<p>
- default:
- ioError = IOErrorCode_GENERAL;
- break;
+ case osl::FileBase::E_NOMEM:
+ // not enough memory for allocating structures <br>
+ ioError = IOErrorCode_OUT_OF_MEMORY;
+ break;
+ case osl::FileBase::E_INVAL:
+ // the format of the parameters was not valid<p>
+ ioError = IOErrorCode_INVALID_PARAMETER;
+ break;
+ case osl::FileBase::E_NAMETOOLONG:
+ // File name too long<br>
+ ioError = IOErrorCode_NAME_TOO_LONG;
+ break;
+ case osl::FileBase::E_NOENT:
+ // No such file or directory<br>
+ case osl::FileBase::E_NOLINK:
+ // Link has been severed<br>
+ ioError = IOErrorCode_NOT_EXISTING;
+ break;
+ case osl::FileBase::E_ROFS:
+ // #i4735# handle ROFS transparently
+ // as ACCESS_DENIED
+ case osl::FileBase::E_PERM:
+ case osl::FileBase::E_ACCES:
+ // permission denied<br>
+ ioError = IOErrorCode_ACCESS_DENIED;
+ break;
+ case osl::FileBase::E_LOOP:
+ // Too many symbolic links encountered<br>
+ case osl::FileBase::E_FAULT:
+ // Bad address<br>
+ case osl::FileBase::E_IO:
+ // I/O error<br>
+ case osl::FileBase::E_NOSYS:
+ // Function not implemented<br>
+ case osl::FileBase::E_MULTIHOP:
+ // Multihop attempted<br>
+ case osl::FileBase::E_INTR:
+ // function call was interrupted<p>
+ default:
+ ioError = IOErrorCode_GENERAL;
+ break;
}
ret[i] <<= InteractiveAugmentedIOException(
rtl::OUString(),
@@ -1079,9 +1144,19 @@ shell::getv( sal_Int32 CommandId,
osl::FileStatus aFileStatus( n_Mask );
osl::DirectoryItem aDirItem;
- osl::DirectoryItem::get( aUnqPath,aDirItem );
- aDirItem.getFileStatus( aFileStatus );
-
+ osl::FileBase::RC nError1 = osl::DirectoryItem::get( aUnqPath,aDirItem );
+ if( nError1 != osl::FileBase::E_None )
+ installError(CommandId,
+ TASKHANDLING_OPEN_FILE_FOR_PAGING, // BEAWARE, REUSED
+ nError1);
+
+ osl::FileBase::RC nError2 = aDirItem.getFileStatus( aFileStatus );
+ if( nError1 == osl::FileBase::E_None &&
+ nError2 != osl::FileBase::E_None )
+ installError(CommandId,
+ TASKHANDLING_OPEN_FILE_FOR_PAGING, // BEAWARE, REUSED
+ nError2);
+
{
vos::OGuard aGuard( m_aMutex );
@@ -1671,7 +1746,7 @@ shell::mkdir( sal_Int32 CommandId,
{
case osl::FileBase::E_EXIST: // Directory cannot be overwritten
{
- if( ! OverWrite )
+ if( !OverWrite )
{
installError( CommandId,
TASKHANDLING_FOLDER_EXISTS_MKDIR );
@@ -1680,6 +1755,12 @@ shell::mkdir( sal_Int32 CommandId,
else
return sal_True;
}
+ case osl::FileBase::E_INVAL:
+ {
+ installError(CommandId,
+ TASKHANDLING_INVALID_NAME_MKDIR);
+ return sal_False;
+ }
case osl::FileBase::E_None:
{
rtl::OUString aPrtPath = getParentName( aUnqPath );
@@ -1687,7 +1768,10 @@ shell::mkdir( sal_Int32 CommandId,
return sal_True;
}
default:
- return ensuredir( CommandId,aUnqPath,TASKHANDLING_CREATEDIRECTORY_MKDIR );
+ return ensuredir(
+ CommandId,
+ aUnqPath,
+ TASKHANDLING_CREATEDIRECTORY_MKDIR );
}
}
@@ -1849,6 +1933,12 @@ shell::write( sal_Int32 CommandId,
err );
break;
}
+ else if( nWrittenBytes != sal_uInt64( nReadBytes ) )
+ {
+ installError( CommandId,
+ TASKHANDLING_FILEIOERROR_FOR_NO_SPACE );
+ break;
+ }
nTotalNumberOfBytes += nWrittenBytes;
}
@@ -2094,17 +2184,43 @@ sal_Bool SAL_CALL shell::ensuredir( sal_Int32 CommandId,
//
-void SAL_CALL shell::getMaskFromProperties( sal_Int32& n_Mask, const uno::Sequence< beans::Property >& seq )
+void SAL_CALL
+shell::getMaskFromProperties(
+ sal_Int32& n_Mask,
+ const uno::Sequence< beans::Property >& seq )
{
- // always try to get all properties
- n_Mask = FileStatusMask_FileURL;
- n_Mask |= FileStatusMask_LinkTargetURL;
- n_Mask |= FileStatusMask_Type;
- n_Mask |= FileStatusMask_FileName;
- n_Mask |= FileStatusMask_Type;
- n_Mask |= FileStatusMask_ModifyTime;
- n_Mask |= FileStatusMask_FileSize;
- n_Mask |= FileStatusMask_Attributes;
+ n_Mask = 0;
+ for(sal_Int32 j = 0; j < seq.getLength(); ++j) {
+ if(seq[j].Name == Title)
+ n_Mask |= FileStatusMask_FileName;
+ else if(seq[j].Name == CasePreservingURL)
+ n_Mask |= FileStatusMask_FileURL;
+ else if(seq[j].Name == IsDocument ||
+ seq[j].Name == IsFolder ||
+ seq[j].Name == IsVolume ||
+ seq[j].Name == IsRemoveable ||
+ seq[j].Name == IsRemote ||
+ seq[j].Name == IsCompactDisc ||
+ seq[j].Name == IsFloppy ||
+ seq[j].Name == ContentType)
+ n_Mask |= (FileStatusMask_Type | FileStatusMask_LinkTargetURL);
+ else if(seq[j].Name == Size)
+ n_Mask |= (FileStatusMask_FileSize |
+ FileStatusMask_Type |
+ FileStatusMask_LinkTargetURL);
+ else if(seq[j].Name == IsHidden ||
+ seq[j].Name == IsReadOnly)
+ n_Mask |= FileStatusMask_Attributes;
+ else if(seq[j].Name == DateModified)
+ n_Mask |= FileStatusMask_ModifyTime;
+// n_Mask = FileStatusMask_FileURL;
+// n_Mask |= FileStatusMask_LinkTargetURL;
+// n_Mask |= FileStatusMask_FileName;
+// n_Mask |= FileStatusMask_Type;
+// n_Mask |= FileStatusMask_ModifyTime;
+// n_Mask |= FileStatusMask_FileSize;
+// n_Mask |= FileStatusMask_Attributes;
+ }
}
@@ -2210,8 +2326,20 @@ shell::commit( const shell::ContentMap::iterator& it,
}
it1->setValue( aAny );
}
- else
- it1->setValue( emptyAny );
+// else
+// it1->setValue( emptyAny );
+ }
+
+ it1 = properties.find( MyProperty( CasePreservingURL ) );
+ if( it1 != properties.end() )
+ {
+ if( aFileStatus.isValid( FileStatusMask_FileURL ) )
+ {
+ aAny <<= aFileStatus.getFileURL();
+ it1->setValue( aAny );
+ }
+// else
+// it1->setValue( emptyAny );
}
@@ -2236,7 +2364,9 @@ shell::commit( const shell::ContentMap::iterator& it,
osl::FileStatus::Regular == aFileStatus2.getFileType();
}
else
- { // extremly ugly, but otherwise default construction of aDirItem and aFileStatus2
+ {
+ // extremly ugly, but otherwise default construction
+ // of aDirItem and aFileStatus2
// before the preciding if
isVolume = osl::FileStatus::Volume == aFileStatus.getFileType();
isDirectory =
@@ -2309,29 +2439,29 @@ shell::commit( const shell::ContentMap::iterator& it,
if( it1 != properties.end() ) it1->setValue( aAny );
}
}
- else
- {
- it1 = properties.find( MyProperty( IsVolume ) );
- if( it1 != properties.end() ) it1->setValue( emptyAny );
+// else
+// {
+// it1 = properties.find( MyProperty( IsVolume ) );
+// if( it1 != properties.end() ) it1->setValue( emptyAny );
- it1 = properties.find( MyProperty( IsFolder ) );
- if( it1 != properties.end() ) it1->setValue( emptyAny );
+// it1 = properties.find( MyProperty( IsFolder ) );
+// if( it1 != properties.end() ) it1->setValue( emptyAny );
- it1 = properties.find( MyProperty( IsDocument ) );
- if( it1 != properties.end() ) it1->setValue( emptyAny );
+// it1 = properties.find( MyProperty( IsDocument ) );
+// if( it1 != properties.end() ) it1->setValue( emptyAny );
- it1 = properties.find( MyProperty( IsRemote ) );
- if( it1 != properties.end() ) it1->setValue( emptyAny );
+// it1 = properties.find( MyProperty( IsRemote ) );
+// if( it1 != properties.end() ) it1->setValue( emptyAny );
- it1 = properties.find( MyProperty( IsRemoveable ) );
- if( it1 != properties.end() ) it1->setValue( emptyAny );
+// it1 = properties.find( MyProperty( IsRemoveable ) );
+// if( it1 != properties.end() ) it1->setValue( emptyAny );
- it1 = properties.find( MyProperty( IsCompactDisc ) );
- if( it1 != properties.end() ) it1->setValue( emptyAny );
+// it1 = properties.find( MyProperty( IsCompactDisc ) );
+// if( it1 != properties.end() ) it1->setValue( emptyAny );
- it1 = properties.find( MyProperty( IsFloppy ) );
- if( it1 != properties.end() ) it1->setValue( emptyAny );
- }
+// it1 = properties.find( MyProperty( IsFloppy ) );
+// if( it1 != properties.end() ) it1->setValue( emptyAny );
+// }
if( m_bFaked && it->first.compareToAscii( "file:///" ) == 0 )
@@ -2385,8 +2515,8 @@ shell::commit( const shell::ContentMap::iterator& it,
aAny <<= dirSize;
it1->setValue( aAny );
}
- else
- it1->setValue( emptyAny );
+// else
+// it1->setValue( emptyAny );
}
@@ -2400,8 +2530,8 @@ shell::commit( const shell::ContentMap::iterator& it,
aAny <<= readonly;
it1->setValue( aAny );
}
- else
- it1->setValue( emptyAny );
+// else
+// it1->setValue( emptyAny );
}
@@ -2427,8 +2557,8 @@ shell::commit( const shell::ContentMap::iterator& it,
aAny <<= ishidden;
it1->setValue( aAny );
}
- else
- it1->setValue( emptyAny );
+// else
+// it1->setValue( emptyAny );
}
@@ -2469,16 +2599,15 @@ shell::commit( const shell::ContentMap::iterator& it,
aAny <<= aDateTime;
it1->setValue( aAny );
}
- else
- it1->setValue( emptyAny );
+// else
+// it1->setValue( emptyAny );
}
}
-
-// Special optimized method for getting the properties of a directoryitem, which
-// is returned by osl::DirectoryItem::getNextItem()
+// Special optimized method for getting the properties of a
+// directoryitem, which is returned by osl::DirectoryItem::getNextItem()
uno::Reference< sdbc::XRow > SAL_CALL
@@ -2495,33 +2624,37 @@ shell::getv(
sal_Int32 n_Mask;
getMaskFromProperties( n_Mask,properties );
- // Always retrieve the target URL if item is a link
- osl::FileStatus aFileStatus( n_Mask | FileStatusMask_LinkTargetURL );
+ // Always retrieve the type and the target URL because item might be a link
+ osl::FileStatus aFileStatus( n_Mask |
+ FileStatusMask_FileURL |
+ FileStatusMask_Type |
+ FileStatusMask_LinkTargetURL );
aDirItem.getFileStatus( aFileStatus );
-
aUnqPath = aFileStatus.getFileURL();
-
+
// If the directory item type is a link retrieve the type of the target
if ( aFileStatus.getFileType() == osl::FileStatus::Link )
{
- osl::FileBase::RC result = osl::FileBase::E_INVAL; // Assume failure
-
- osl::DirectoryItem aTargetItem;
-
+ // Assume failure
+ osl::FileBase::RC result = osl::FileBase::E_INVAL;
+ osl::DirectoryItem aTargetItem;
osl::DirectoryItem::get( aFileStatus.getLinkTargetURL(), aTargetItem );
-
-
if ( aTargetItem.is() )
{
osl::FileStatus aTargetStatus( FileStatusMask_Type );
-
- if ( osl::FileBase::E_None == ( result = aTargetItem.getFileStatus( aTargetStatus ) ) )
- aIsRegular = aTargetStatus.getFileType() == osl::FileStatus::Regular;
+
+ if ( osl::FileBase::E_None ==
+ ( result = aTargetItem.getFileStatus( aTargetStatus ) ) )
+ aIsRegular =
+ aTargetStatus.getFileType() == osl::FileStatus::Regular;
}
- // FIXME: aIsRegular undefined in error case. Don't know how to transport error
- OSL_ENSURE( osl::FileBase::E_None == result, "shell::getv: Link target can't be retrieved. Missing error handling !!!" );
+ // FIXME: aIsRegular undefined in error case.
+ // Don't know how to transport error
+ OSL_ENSURE( osl::FileBase::E_None == result,
+ "shell::getv: Link target can't be retrieved."
+ " Missing error handling !!!" );
}
else
aIsRegular = aFileStatus.getFileType() == osl::FileStatus::Regular;
diff --git a/ucb/source/ucp/file/shell.hxx b/ucb/source/ucp/file/shell.hxx
index 41edfb8948..6ab1885744 100644
--- a/ucb/source/ucp/file/shell.hxx
+++ b/ucb/source/ucp/file/shell.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: shell.hxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: abi $ $Date: 2001-12-05 12:10:16 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -665,6 +665,7 @@ namespace fileaccess {
// Default properties
const rtl::OUString Title;
+ const rtl::OUString CasePreservingURL;
const rtl::OUString IsDocument;
const rtl::OUString IsFolder;
const rtl::OUString DateModified;
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index ddec12d42e..76e38148f4 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftpcontent.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: kso $ $Date: 2002-11-12 11:30:43 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,8 +65,8 @@
*************************************************************************/
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HDL_
-#include <com/sun/star/beans/PropertyAttribute.hdl>
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
#include "ftpdynresultset.hxx"
@@ -80,6 +80,7 @@
#include "ftpcontentidentifier.hxx"
#include "ftpcfunc.hxx"
#include "ftpstrcont.hxx"
+#include "ftpintreq.hxx"
#include <memory>
#include <vector>
@@ -98,7 +99,6 @@
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/ucb/XCommandInfo.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XActiveDataStreamer.hpp>
@@ -110,7 +110,9 @@
#include <com/sun/star/ucb/InteractiveIOException.hpp>
#include <com/sun/star/ucb/MissingPropertiesException.hpp>
#include <com/sun/star/ucb/MissingInputStreamException.hpp>
+#include <com/sun/star/ucb/UnsupportedNameClashException.hpp>
#include <com/sun/star/ucb/NameClashException.hpp>
+//#include <com/sun/star/ucb/NameClash.hpp>
#include <com/sun/star/ucb/OpenMode.hpp>
#include <com/sun/star/ucb/IOErrorCode.hpp>
@@ -624,8 +626,7 @@ FTPContent::queryCreatableContentsInfo( )
seq[0].Type = FTP_FILE;
seq[0].Attributes = ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
- | ContentInfoAttribute::KIND_DOCUMENT;
-
+ | ContentInfoAttribute::KIND_DOCUMENT;
Sequence< Property > props( 1 );
props[0] = Property(
rtl::OUString::createFromAscii( "Title" ),
@@ -742,25 +743,52 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand,
ucbhelper::cancelCommandExecution(aAny,Env);
}
+ bool bReplace(aInsertCommand.ReplaceExisting);
+
+ retry:
try {
if(m_aInfo.Type == FTP_FILE) {
InsertData data(aInsertCommand.Data);
- m_aFTPURL.insert(bool(aInsertCommand.ReplaceExisting),
- &data);
+ m_aFTPURL.insert(bReplace,&data);
} else if(m_aInfo.Type == FTP_FOLDER)
- m_aFTPURL.mkdir(bool(aInsertCommand.ReplaceExisting));
+ m_aFTPURL.mkdir(bReplace);
} catch(const curl_exception& e) {
- if(e.code() == FILE_EXIST_DURING_INSERT) {
- Any aAny;
+ if(e.code() == FILE_EXIST_DURING_INSERT ||
+ e.code() == FOLDER_EXIST_DURING_INSERT) {
+ // Deprecated, not used anymore:
NameClashException excep;
excep.Name = m_aFTPURL.child();
- ucbhelper::cancelCommandExecution(aAny,Env);
- } else if(e.code() == FOLDER_EXIST_DURING_INSERT) {
Any aAny;
- NameClashException excep;
- excep.Name = m_aFTPURL.child();
+ aAny <<= excep;
ucbhelper::cancelCommandExecution(aAny,Env);
- } else
+ } else if(e.code() == FOLDER_MIGHT_EXIST_DURING_INSERT ||
+ e.code() == FILE_MIGHT_EXIST_DURING_INSERT) {
+ // Interact
+ Reference<XInteractionHandler> xInt;
+ if(Env.is())
+ xInt = Env->getInteractionHandler();
+
+ UnsupportedNameClashException excep;
+ excep.NameClash = 0; //NameClash::ERROR;
+
+ if(!xInt.is()) {
+ Any aAny;
+ aAny <<= excep;
+ ucbhelper::cancelCommandExecution(aAny,Env);
+ }
+
+ XInteractionRequestImpl* p =
+ new XInteractionRequestImpl(m_aFTPURL.child());
+ Reference<XInteractionRequest> req(p);
+ xInt->handle(req);
+ if(p->approved()) {
+ bReplace = true;
+ goto retry;
+ }
+ else
+ throw excep;
+ }
+ else
throw;
}
diff --git a/ucb/source/ucp/ftp/ftpcontentcaps.cxx b/ucb/source/ucp/ftp/ftpcontentcaps.cxx
index 96377eb4e9..fb7129b5db 100644
--- a/ucb/source/ucp/ftp/ftpcontentcaps.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentcaps.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftpcontentcaps.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: abi $ $Date: 2002-10-24 16:43:05 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,7 +83,7 @@ Sequence< Property > FTPContent::getProperties(
const Reference< XCommandEnvironment > & xEnv
)
{
- Sequence< Property > props(6);
+ Sequence< Property > props(7);
props[0] =
Property(
@@ -126,6 +126,13 @@ Sequence< Property > FTPContent::getProperties(
-1,
getCppuType( static_cast< DateTime* >( 0 ) ),
PropertyAttribute::BOUND | PropertyAttribute::READONLY );
+
+ props[6] =
+ Property(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ),
+ -1,
+ getCppuBooleanType(),
+ PropertyAttribute::BOUND | PropertyAttribute::READONLY );
return props;
}
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
index 27e89d75ea..ec503e76ff 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftpcontentprovider.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: abi $ $Date: 2002-10-29 12:43:13 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,8 +65,6 @@
*************************************************************************/
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XContainer.hpp>
#include <ucbhelper/contentbroker.hxx>
#include <osl/socket.hxx>
#include "ftpcontentprovider.hxx"
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.hxx b/ucb/source/ucp/ftp/ftpcontentprovider.hxx
index bc0cfff9b5..ababa43f36 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.hxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftpcontentprovider.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: abi $ $Date: 2002-10-29 12:43:14 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,20 +67,14 @@
#include <ucbhelper/macros.hxx>
#include <ucbhelper/proxydecider.hxx>
#include <ucbhelper/providerhelper.hxx>
-#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/ucb/XContentProviderManager.hpp>
-#include <com/sun/star/container/XContainerListener.hpp>
-#include <com/sun/star/container/XContainer.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
#include "ftphandleprovider.hxx"
#include "ftpurl.hxx"
// UNO service name for the provider. This name will be used by the UCB to
// create instances of the provider.
-#define MYUCP_CONTENT_PROVIDER_SERVICE_NAME "com.sun.star.ucb.FTPContentProvider"
+#define MYUCP_CONTENT_PROVIDER_SERVICE_NAME "com.sun.star.ucb.FTPContentProvider"
#define MYUCP_CONTENT_PROVIDER_SERVICE_NAME_LENGTH 35
#define MYUCP_URL_SCHEME "ftp"
#define MYUCP_URL_SCHEME_LENGTH 3
@@ -101,12 +95,14 @@ namespace ftp {
class FTPContentProvider:
public ::ucb::ContentProviderImplHelper,
- // public ::com::sun::star::lang::XComponent,
public FTPHandleProvider
{
public:
- FTPContentProvider(const com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xMSF );
+ FTPContentProvider(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory>& xMSF );
+
~FTPContentProvider();
// XInterface
diff --git a/ucb/source/ucp/ftp/ftpinpstr.cxx b/ucb/source/ucp/ftp/ftpinpstr.cxx
index 8d8ed1d016..dc3f68b465 100644
--- a/ucb/source/ucp/ftp/ftpinpstr.cxx
+++ b/ucb/source/ucp/ftp/ftpinpstr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftpinpstr.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: abi $ $Date: 2002-10-15 09:21:17 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -87,8 +87,9 @@ FTPInputStream::FTPInputStream(FILE* tmpfl)
: m_tmpfl(tmpfl ? tmpfl : tmpfile())
{
fseek(m_tmpfl,0,SEEK_END);
- fpos_t pos;
- fgetpos(m_tmpfl,&pos);
+// fpos_t pos;
+// fgetpos(m_tmpfl,&pos);
+ long pos = ftell(m_tmpfl);
rewind(m_tmpfl);
m_nLength = sal_Int64(pos);
}
@@ -140,11 +141,16 @@ sal_Int32 SAL_CALL FTPInputStream::readBytes(Sequence< sal_Int8 >& aData,
if(0 <= nBytesToRead && aData.getLength() < nBytesToRead)
aData.realloc(nBytesToRead);
- fpos_t bpos,epos;
+// fpos_t bpos,epos;
- fgetpos(m_tmpfl,&bpos);
+// fgetpos(m_tmpfl,&bpos);
+// fread(aData.getArray(),nBytesToRead,1,m_tmpfl);
+// fgetpos(m_tmpfl,&epos);
+ long bpos,epos;
+
+ bpos = ftell(m_tmpfl);
fread(aData.getArray(),nBytesToRead,1,m_tmpfl);
- fgetpos(m_tmpfl,&epos);
+ epos = ftell(m_tmpfl);
return sal_Int32(epos-bpos);
}
@@ -222,8 +228,10 @@ FTPInputStream::getPosition(
if(!m_tmpfl)
throw IOException();
- fpos_t pos;
- fgetpos(m_tmpfl,&pos);
+// fpos_t pos;
+// fgetpos(m_tmpfl,&pos);
+ long pos;
+ pos = ftell(m_tmpfl);
return sal_Int64(pos);
}
diff --git a/ucb/source/ucp/ftp/ftpintreq.cxx b/ucb/source/ucp/ftp/ftpintreq.cxx
new file mode 100644
index 0000000000..4e0c464ea1
--- /dev/null
+++ b/ucb/source/ucp/ftp/ftpintreq.cxx
@@ -0,0 +1,214 @@
+#include <com/sun/star/ucb/UnsupportedNameClashException.hpp>
+#include <com/sun/star/ucb/NameClash.hpp>
+#include "ftpintreq.hxx"
+
+using namespace cppu;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::task;
+using namespace ftp;
+
+
+XInteractionApproveImpl::XInteractionApproveImpl()
+ : m_bSelected(false)
+{
+}
+
+
+void SAL_CALL
+XInteractionApproveImpl::acquire( void )
+ throw()
+{
+ OWeakObject::acquire();
+}
+
+
+void SAL_CALL
+XInteractionApproveImpl::release( void )
+ throw()
+{
+ OWeakObject::release();
+}
+
+
+
+Any SAL_CALL
+XInteractionApproveImpl::queryInterface( const Type& rType )
+ throw( RuntimeException )
+{
+ Any aRet = cppu::queryInterface(
+ rType,
+ SAL_STATIC_CAST( lang::XTypeProvider*, this ),
+ SAL_STATIC_CAST( XInteractionApprove*,this) );
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// XTypeProvider
+//////////////////////////////////////////////////////////////////////////////
+
+XTYPEPROVIDER_IMPL_2( XInteractionApproveImpl,
+ XTypeProvider,
+ XInteractionApprove )
+
+
+void SAL_CALL XInteractionApproveImpl::select()
+ throw (RuntimeException)
+{
+ m_bSelected = true;
+}
+
+
+bool XInteractionApproveImpl::isSelected() const
+{
+ return m_bSelected;
+}
+
+
+
+// XInteractionDisapproveImpl
+
+XInteractionDisapproveImpl::XInteractionDisapproveImpl()
+ : m_bSelected(false)
+{
+}
+
+
+void SAL_CALL
+XInteractionDisapproveImpl::acquire( void )
+ throw()
+{
+ OWeakObject::acquire();
+}
+
+
+void SAL_CALL
+XInteractionDisapproveImpl::release( void )
+ throw()
+{
+ OWeakObject::release();
+}
+
+
+
+Any SAL_CALL
+XInteractionDisapproveImpl::queryInterface( const Type& rType )
+ throw( RuntimeException )
+{
+ Any aRet = cppu::queryInterface(
+ rType,
+ SAL_STATIC_CAST( lang::XTypeProvider*, this ),
+ SAL_STATIC_CAST( XInteractionDisapprove*,this) );
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// XTypeProvider
+//////////////////////////////////////////////////////////////////////////////
+
+XTYPEPROVIDER_IMPL_2( XInteractionDisapproveImpl,
+ XTypeProvider,
+ XInteractionDisapprove )
+
+
+void SAL_CALL XInteractionDisapproveImpl::select()
+ throw (RuntimeException)
+
+{
+ m_bSelected = true;
+}
+
+
+bool XInteractionDisapproveImpl::isSelected() const
+{
+ return m_bSelected;
+}
+
+
+
+// XInteractionRequestImpl
+
+XInteractionRequestImpl::XInteractionRequestImpl(const rtl::OUString& aName)
+ : m_aSeq( 2 ),
+ p1( new XInteractionApproveImpl ),
+ p2( new XInteractionDisapproveImpl ),
+ m_aName(aName)
+{
+ m_aSeq[0] = Reference<XInteractionContinuation>(p1);
+ m_aSeq[1] = Reference<XInteractionContinuation>(p2);
+}
+
+
+void SAL_CALL
+XInteractionRequestImpl::acquire( void )
+ throw()
+{
+ OWeakObject::acquire();
+}
+
+
+
+void SAL_CALL
+XInteractionRequestImpl::release( void )
+ throw()
+{
+ OWeakObject::release();
+}
+
+
+
+Any SAL_CALL
+XInteractionRequestImpl::queryInterface( const Type& rType )
+ throw( RuntimeException )
+{
+ Any aRet = cppu::queryInterface(
+ rType,
+ SAL_STATIC_CAST( lang::XTypeProvider*, this ),
+ SAL_STATIC_CAST( XInteractionRequest*,this) );
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// XTypeProvider
+/////////////////////////////////////////////////////////////////////////////
+
+XTYPEPROVIDER_IMPL_2( XInteractionRequestImpl,
+ XTypeProvider,
+ XInteractionRequest )
+
+
+Any SAL_CALL XInteractionRequestImpl::getRequest( )
+ throw (RuntimeException)
+{
+ Any aAny;
+ UnsupportedNameClashException excep;
+ excep.NameClash = NameClash::ERROR;
+ aAny <<= excep;
+ return aAny;
+}
+
+
+Sequence<Reference<XInteractionContinuation > > SAL_CALL
+XInteractionRequestImpl::getContinuations( )
+ throw (RuntimeException)
+{
+ return m_aSeq;
+}
+
+
+bool XInteractionRequestImpl::aborted() const
+{
+ return p2->isSelected();
+}
+
+
+bool XInteractionRequestImpl::approved() const
+{
+ return p1->isSelected();
+}
+
diff --git a/ucb/source/ucp/ftp/ftpintreq.hxx b/ucb/source/ucp/ftp/ftpintreq.hxx
new file mode 100644
index 0000000000..d0bf807247
--- /dev/null
+++ b/ucb/source/ucp/ftp/ftpintreq.hxx
@@ -0,0 +1,235 @@
+/*************************************************************************
+ *
+ * $RCSfile: ftpintreq.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:48 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FTP_FTPINTREQ_HXX
+#define _FTP_FTPINTREQ_HXX
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _UCBHELPER_MACROS_HXX
+#include <ucbhelper/macros.hxx>
+#endif
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
+#include <com/sun/star/uno/XInterface.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_TASK_XINTERACTIONDISAPPROVE_HPP_
+#include <com/sun/star/task/XInteractionDisapprove.hpp>
+#endif
+#ifndef _COM_SUN_STAR_TASK_XINTERACTIONAPPROVE_HPP_
+#include <com/sun/star/task/XInteractionApprove.hpp>
+#endif
+#ifndef _COM_SUN_STAR_TASK_XINTERACTIONREQUEST_HPP_
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#endif
+
+
+namespace ftp {
+
+
+ class XInteractionApproveImpl
+ : public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::task::XInteractionApprove
+ {
+ public:
+
+ XInteractionApproveImpl();
+
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface(
+ const com::sun::star::uno::Type& rType )
+ throw( com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ acquire(
+ void )
+ throw();
+
+ virtual void SAL_CALL
+ release(
+ void )
+ throw();
+
+
+ // XTypeProvider
+
+ XTYPEPROVIDER_DECL()
+
+ virtual void SAL_CALL select()
+ throw (com::sun::star::uno::RuntimeException);
+
+ bool isSelected() const;
+
+ private:
+
+ bool m_bSelected;
+ };
+
+
+
+
+ class XInteractionDisapproveImpl
+ : public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::task::XInteractionDisapprove
+ {
+ public:
+
+ XInteractionDisapproveImpl();
+
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface(
+ const com::sun::star::uno::Type& rType )
+ throw( com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ acquire(
+ void )
+ throw();
+
+ virtual void SAL_CALL
+ release(
+ void )
+ throw();
+
+
+ // XTypeProvider
+
+ XTYPEPROVIDER_DECL()
+
+ virtual void SAL_CALL select()
+ throw (com::sun::star::uno::RuntimeException);
+
+ bool isSelected() const;
+
+ private:
+
+ bool m_bSelected;
+ };
+
+
+
+ class XInteractionRequestImpl
+ : public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::task::XInteractionRequest
+ {
+ public:
+
+ XInteractionRequestImpl(const rtl::OUString& aName);
+
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface(
+ const com::sun::star::uno::Type& rType )
+ throw( com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ acquire(
+ void )
+ throw();
+
+ virtual void SAL_CALL
+ release(
+ void )
+ throw();
+
+
+ // XTypeProvider
+
+ XTYPEPROVIDER_DECL()
+
+ com::sun::star::uno::Any SAL_CALL
+ getRequest( )
+ throw (com::sun::star::uno::RuntimeException);
+
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > SAL_CALL
+ getContinuations( )
+ throw (com::sun::star::uno::RuntimeException);
+
+ bool aborted() const;
+
+ bool approved() const;
+
+ private:
+
+ XInteractionApproveImpl* p1;
+ XInteractionDisapproveImpl* p2;
+
+ rtl::OUString m_aName;
+
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > m_aSeq;
+ };
+
+}
+
+
+#endif
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index 0205f43105..bf09c65e7d 100644
--- a/ucb/source/ucp/ftp/ftpurl.cxx
+++ b/ucb/source/ucp/ftp/ftpurl.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftpurl.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: abi $ $Date: 2002-10-29 12:43:14 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -702,9 +702,10 @@ void FTPURL::insert(bool replaceExisting,void* stream) const
throw(curl_exception)
{
if(!replaceExisting) {
- FTPDirentry aDirentry(direntry());
- if(aDirentry.m_nMode == INETCOREFTP_FILEMODE_UNKNOWN)
- throw curl_exception(FILE_EXIST_DURING_INSERT);
+// FTPDirentry aDirentry(direntry());
+// if(aDirentry.m_nMode == INETCOREFTP_FILEMODE_UNKNOWN)
+ // throw curl_exception(FILE_EXIST_DURING_INSERT);
+ throw curl_exception(FILE_MIGHT_EXIST_DURING_INSERT);
} // else
// overwrite is default in libcurl
@@ -749,8 +750,9 @@ void FTPURL::mkdir(bool ReplaceExisting) const
FTPDirentry aDirentry(direntry());
if(!ReplaceExisting) {
- if(aDirentry.m_nMode != INETCOREFTP_FILEMODE_UNKNOWN)
- throw curl_exception(FOLDER_EXIST_DURING_INSERT);
+// if(aDirentry.m_nMode != INETCOREFTP_FILEMODE_UNKNOWN)
+// throw curl_exception(FOLDER_EXIST_DURING_INSERT);
+ throw curl_exception(FOLDER_MIGHT_EXIST_DURING_INSERT);
} else if(aDirentry.m_nMode != INETCOREFTP_FILEMODE_UNKNOWN)
slist = curl_slist_append(slist,del.getStr());
diff --git a/ucb/source/ucp/ftp/ftpurl.hxx b/ucb/source/ucp/ftp/ftpurl.hxx
index fcf019d84d..9921266f7c 100644
--- a/ucb/source/ucp/ftp/ftpurl.hxx
+++ b/ucb/source/ucp/ftp/ftpurl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftpurl.hxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: abi $ $Date: 2002-10-25 14:06:15 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:26:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -89,7 +89,9 @@ namespace ftp {
enum FTPErrors { FILE_EXIST_DURING_INSERT = CURL_LAST +1,
- FOLDER_EXIST_DURING_INSERT };
+ FOLDER_EXIST_DURING_INSERT,
+ FOLDER_MIGHT_EXIST_DURING_INSERT,
+ FILE_MIGHT_EXIST_DURING_INSERT };
class malformed_exception { };
diff --git a/ucb/source/ucp/ftp/makefile.mk b/ucb/source/ucp/ftp/makefile.mk
index a225f289bd..d6d6b3c8cc 100644
--- a/ucb/source/ucp/ftp/makefile.mk
+++ b/ucb/source/ucp/ftp/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.9 $
+# $Revision: 1.10 $
#
-# last change: $Author: abi $ $Date: 2002-10-17 16:28:24 $
+# last change: $Author: hr $ $Date: 2003-03-27 17:26:49 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -70,10 +70,13 @@ NO_BSYMBOLIC=TRUE
# Version
UCPFTP_MAJOR=1
+
# --- Settings ---------------------------------------------------------
.INCLUDE: settings.mk
+#CFLAGS +=-fno-inline
+
# --- General -----------------------------------------------------
# first target ( shared library )
@@ -92,6 +95,7 @@ SLOFILES1=\
$(SLO)$/ftpdirp.obj \
$(SLO)$/ftpcfunc.obj \
$(SLO)$/ftpurl.obj \
+ $(SLO)$/ftpintreq.obj \
$(SLO)$/debughelper.obj
LIB1TARGET=$(SLB)$/_$(TARGET).lib
@@ -110,7 +114,6 @@ SHL1STDLIBS=\
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB) \
- $(VOSLIB) \
$(UCBHELPERLIB) \
$(CURLLIB)
@@ -129,5 +132,26 @@ DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE= $(TARGET).dxp
DEF1DES=UCB Ftp Content Provider
+.IF "$(COMPHELPERLIB)"==""
+.IF "$(GUI)" == "UNX"
+COMPHELPERLIB=-licomphelp2
+.ENDIF # unx
+.IF "$(GUI)"=="WNT"
+COMPHELPERLIB=icomphelp2.lib
+.ENDIF # wnt
+.ENDIF
.INCLUDE: target.mk
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ucb/source/ucp/odma/ucpodma.xml b/ucb/source/ucp/ftp/ucpftp.xml
index d627ec3607..0b5478dc04 100644
--- a/ucb/source/ucp/odma/ucpodma.xml
+++ b/ucb/source/ucp/ftp/ucpftp.xml
@@ -3,20 +3,19 @@
<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
<module-name>
- ucpodma
+ ucpftp
</module-name>
<component-description>
<author>
- Ocke Janssen
+ Andreas Bille
</author>
<name>
- com.sun.star.comp.ucb.OdmaContentProvider
+ com.sun.star.comp.ucb.FTPContentProvider
</name>
<description>
This component implements a Content Provider for the Universal
- Content Broker. It provides access to contents stored on an document management
- system (DMS).
+ Content Broker. It provides access to ftp servers.
</description>
<loader-name>
com.sun.star.loader.SharedLibrary
@@ -26,77 +25,67 @@
</language>
<status value="final"/>
<supported-service>
- com.sun.star.ucb.ODMAContentProvider
+ com.sun.star.ucb.FTPContentProvider
</supported-service>
-
- <service-dependency>
- com.sun.star.configuration.ConfigurationAccess
- </service-dependency>
- <service-dependency>
- com.sun.star.configuration.ConfigurationProvider
- </service-dependency>
</component-description>
- <project-build-dependency> external </project-build-dependency>
<project-build-dependency> sal </project-build-dependency>
<project-build-dependency> cppu </project-build-dependency>
<project-build-dependency> cppuhelper </project-build-dependency>
<project-build-dependency> vos </project-build-dependency>
<project-build-dependency> ucbhelper </project-build-dependency>
+ <project-build-dependency> curl </project-build-dependency>
- <runtime-module-dependency> sal3 </runtime-module-dependency>
- <runtime-module-dependency> cppu3 </runtime-module-dependency>
+ <runtime-module-dependency> sal3 </runtime-module-dependency>
+ <runtime-module-dependency> cppu3 </runtime-module-dependency>
<runtime-module-dependency> cppuhelper3$(COM) </runtime-module-dependency>
<runtime-module-dependency> vos2$(COM) </runtime-module-dependency>
<runtime-module-dependency> ucbhelper1$(COM) </runtime-module-dependency>
-
- <type> com.sun.star.beans.PropertyAttribute </type>
+ <runtime-module-dependency> curl </runtime-module-dependency>
+
+ <type> com.sun.star.beans.UnknownPropertyException </type>
+ <type> com.sun.star.beans.Property </type>
<type> com.sun.star.beans.PropertyValue </type>
- <type> com.sun.star.beans.XPropertiesChangeNotifier </type>
- <type> com.sun.star.beans.XPropertyAccess </type>
- <type> com.sun.star.beans.XPropertyContainer </type>
- <type> com.sun.star.beans.XPropertySetInfoChangeNotifier </type>
- <type> com.sun.star.container.XChild </type>
- <type> com.sun.star.container.XNameAccess </type>
+ <type> com.sun.star.beans.PropertyAttribute </type>
+ <type> com.sun.star.beans.XPropertySet </type>
+ <type> com.sun.star.io.XSeekable </type>
<type> com.sun.star.io.XActiveDataSink </type>
<type> com.sun.star.io.XInputStream </type>
<type> com.sun.star.io.XOutputStream </type>
- <type> com.sun.star.io.XSeekable </type>
- <type> com.sun.star.lang.IllegalAccessException </type>
- <type> com.sun.star.lang.XComponent </type>
+ <type> com.sun.star.io.XActiveDataStreamer </type>
<type> com.sun.star.lang.XMultiServiceFactory </type>
- <type> com.sun.star.lang.XServiceInfo </type>
- <type> com.sun.star.lang.XSingleServiceFactory </type>
+ <type> com.sun.star.lang.IllegalAccessException </type>
<type> com.sun.star.lang.XTypeProvider </type>
- <type> com.sun.star.registry.XRegistryKey </type>
- <type> com.sun.star.sdbc.XCloseable </type>
- <type> com.sun.star.sdbc.XColumnLocate </type>
- <type> com.sun.star.sdbc.XResultSetMetaDataSupplier </type>
- <type> com.sun.star.sdbc.XRow </type>
- <type> com.sun.star.ucb.ContentCreationException </type>
+ <type> com.sun.star.lang.XComponent </type>
<type> com.sun.star.ucb.ContentInfoAttribute </type>
- <type> com.sun.star.ucb.InsertCommandArgument </type>
- <type> com.sun.star.ucb.MissingInputStreamException </type>
+ <type> com.sun.star.ucb.UnsupportedDataSinkException </type>
+ <type> com.sun.star.ucb.OpenCommandArgument2 </type>
+ <type> com.sun.star.ucb.UnsupportedOpenModeException </type>
+ <type> com.sun.star.ucb.InteractiveNetworkConnectException </type>
+ <type> com.sun.star.ucb.InteractiveNetworkResolveNameException </type>
+ <type> com.sun.star.ucb.InteractiveIOException </type>
<type> com.sun.star.ucb.MissingPropertiesException </type>
- <type> com.sun.star.ucb.NameClash </type>
+ <type> com.sun.star.ucb.MissingInputStreamException </type>
<type> com.sun.star.ucb.NameClashException </type>
- <type> com.sun.star.ucb.OpenCommandArgument2 </type>
+ <type> com.sun.star.ucb.NumberedSortingInfo </type>
<type> com.sun.star.ucb.OpenMode </type>
- <type> com.sun.star.ucb.PostCommandArgument2 </type>
- <type> com.sun.star.ucb.RememberAuthentication </type>
- <type> com.sun.star.ucb.ResultSetException </type>
- <type> com.sun.star.ucb.TransferInfo </type>
- <type> com.sun.star.ucb.XCommandEnvironment </type>
- <type> com.sun.star.ucb.UnsupportedCommandException </type>
- <type> com.sun.star.ucb.UnsupportedDataSinkException </type>
- <type> com.sun.star.ucb.UnsupportedNameClashException </type>
- <type> com.sun.star.ucb.UnsupportedOpenModeException </type>
+ <type> com.sun.star.ucb.IOErrorCode </type>
+ <type> com.sun.star.ucb.InsertCommandArgument </type>
+ <type> com.sun.star.ucb.ListActionType </type>
+ <type> com.sun.star.ucb.XContentCreator </type>
+ <type> com.sun.star.ucb.XContentProvider </type>
+ <type> com.sun.star.ucb.XContentProviderManager </type>
<type> com.sun.star.ucb.XCommandInfo </type>
- <type> com.sun.star.ucb.XCommandInfoChangeNotifier </type>
- <type> com.sun.star.ucb.XCommandProcessor </type>
+ <type> com.sun.star.ucb.CommandInfo </type>
<type> com.sun.star.ucb.XContentAccess </type>
- <type> com.sun.star.ucb.XContentProvider </type>
- <type> com.sun.star.ucb.XDynamicResultSet </type>
- <type> com.sun.star.ucb.XPersistentPropertySet </type>
+ <type> com.sun.star.ucb.Command </type>
+ <type> com.sun.star.ucb.XCommandEnvironment </type>
+ <type> com.sun.star.ucb.XCommandProcessor </type>
+ <type> com.sun.star.ucb.XContentIdentifier </type>
+ <type> com.sun.star.ucb.XSourceInitialization </type>
<type> com.sun.star.util.DateTime </type>
+ <type> com.sun.star.sdbc.XResultSet </type>
+ <type> com.sun.star.sdbc.XRow </type>
+ <type> com.sun.star.sdbc.XCloseable </type>
+ <type> com.sun.star.sdbc.XResultSetMetaDataSupplier </type>
</module-description>
diff --git a/ucb/source/ucp/hierarchy/makefile.mk b/ucb/source/ucp/hierarchy/makefile.mk
index c02b2ca816..718cbfe20f 100644
--- a/ucb/source/ucp/hierarchy/makefile.mk
+++ b/ucb/source/ucp/hierarchy/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.7 $
+# $Revision: 1.8 $
#
-# last change: $Author: svesik $ $Date: 2002-03-11 15:34:11 $
+# last change: $Author: hr $ $Date: 2003-03-27 17:26:58 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -96,7 +96,7 @@ LIB1OBJFILES=$(SLOFILES)
SHL1TARGET=$(TARGET)$(UCPHIER_MAJOR)
SHL1IMPLIB=i$(TARGET)
-.IF "$(OS)"=="MACOSX"||"$(OS)"=="FREEBSD"
+.IF "$(OS)"=="MACOSX"
.ELSE
SHL1VERSIONMAP= $(TARGET).map
.ENDIF
diff --git a/ucb/source/ucp/odma/exports.map b/ucb/source/ucp/odma/exports.map
deleted file mode 100644
index 14a2531f23..0000000000
--- a/ucb/source/ucp/odma/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-VERS_1_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/ucb/source/ucp/odma/makefile.mk b/ucb/source/ucp/odma/makefile.mk
deleted file mode 100644
index 3aaa5aece6..0000000000
--- a/ucb/source/ucp/odma/makefile.mk
+++ /dev/null
@@ -1,155 +0,0 @@
-#*************************************************************************
-#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.1 $
-#
-# last change: $Author: oj $ $Date: 2002-01-14 15:00:27 $
-#
-# The Contents of this file are made available subject to the terms of
-# either of the following licenses
-#
-# - GNU Lesser General Public License Version 2.1
-# - Sun Industry Standards Source License Version 1.1
-#
-# Sun Microsystems Inc., October, 2000
-#
-# GNU Lesser General Public License Version 2.1
-# =============================================
-# Copyright 2000 by Sun Microsystems, Inc.
-# 901 San Antonio Road, Palo Alto, CA 94303, USA
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License version 2.1, as published by the Free Software Foundation.
-#
-# This library 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 for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-#
-# Sun Industry Standards Source License Version 1.1
-# =================================================
-# The contents of this file are subject to the Sun Industry Standards
-# Source License Version 1.1 (the "License"); You may not use this file
-# except in compliance with the License. You may obtain a copy of the
-# License at http://www.openoffice.org/license.html.
-#
-# Software provided under this License is provided on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
-# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
-# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
-# See the License for the specific provisions governing your rights and
-# obligations concerning the Software.
-#
-# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
-#
-# Copyright: 2000 by Sun Microsystems, Inc.
-#
-# All Rights Reserved.
-#
-# Contributor(s): _______________________________________
-#
-#
-#
-#*************************************************************************
-
-# @@@ UCP Version - Increase, if your UCP libraray becomes incompatible.
-UCP_VERSION=1
-
-# @@@ Name for your UCP. Will become part of the library name (See below).
-UCP_NAME=odma
-
-# @@@ Relative path to project root.
-PRJ=..$/..$/..
-
-# @@@ Name of the project your UCP code recides it.
-PRJNAME=ucb
-
-TARGET=ucp$(UCP_NAME)
-TARGET2=s$(UCP_NAME)
-
-ENABLE_EXCEPTIONS=TRUE
-USE_DEFFILE=TRUE
-NO_BSYMBOLIC=TRUE
-
-TARGET2TYPE=CUI
-LIB2TARGET=NO
-
-# --- Settings ---------------------------------------------------------
-
-.INCLUDE: svpre.mk
-.INCLUDE: settings.mk
-.INCLUDE: sv.mk
-
-# --- General -----------------------------------------------------
-
-# @@@ Adjust template file names. Add own files here.
-SLOFILES=\
- $(SLO)$/odma_lib.obj \
- $(SLO)$/odma_services.obj \
- $(SLO)$/odma_provider.obj \
- $(SLO)$/odma_content.obj \
- $(SLO)$/odma_resultset.obj \
- $(SLO)$/odma_datasupplier.obj \
- $(SLO)$/odma_inputstream.obj \
- $(SLO)$/odma_contentcaps.obj
-
-
-LIB1TARGET=$(SLB)$/_$(TARGET).lib
-LIB1OBJFILES=$(SLOFILES)
-
-# --- Shared-Library ---------------------------------------------------
-
-SHL1TARGET=$(TARGET)$(UCP_VERSION)
-SHL1IMPLIB=i$(TARGET)
-SHL1VERSIONMAP=exports.map
-
-# @@@ Add additional libs here.
-SHL1STDLIBS=\
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB) \
- $(VOSLIB) \
- $(UCBHELPERLIB)
-
-SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-SHL1LIBS=$(LIB1TARGET)
-
-# --- Def-File ---------------------------------------------------------
-
-DEF1NAME=$(SHL1TARGET)
-DEF1EXPORTFILE=exports.dxp
-
-# @@@ A description string for you UCP.
-DEF1DES=UCB ODMA Content Provider
-
-# --- SODMA executable -------------------------------------------------
-OBJ2FILES= $(OBJ)$/odma_main.obj
-
-APP2TARGET= $(TARGET2)
-APP2OBJS= $(OBJ2FILES)
-APP2STDLIBS=$(SALLIB) \
- $(VOSLIB) \
- $(CPPULIB) \
- $(CPPUHELPERLIB)
-
-APP2STDLIBS+=$(STDLIBCPP)
-
-.IF "$(GUI)"=="WNT"
-APP2STDLIBS+=$(LIBCIMT)
-.ENDIF
-
-# @@@ A description string for you UCP.
-DEF2DES=UCB ODMA URL converter
-
-# --- Targets ----------------------------------------------------------
-
-.INCLUDE: target.mk
-
diff --git a/ucb/source/ucp/odma/odma.h b/ucb/source/ucp/odma/odma.h
deleted file mode 100644
index 545b2bbbdf..0000000000
--- a/ucb/source/ucp/odma/odma.h
+++ /dev/null
@@ -1 +0,0 @@
-#error "odma.h: This file is not included in OpenOffice.org (yet). Please download the latest version at http://www.infonuovo.com/odma/downloads"
diff --git a/ucb/source/ucp/odma/odma_content.cxx b/ucb/source/ucp/odma/odma_content.cxx
deleted file mode 100644
index b40c878cf3..0000000000
--- a/ucb/source/ucp/odma/odma_content.cxx
+++ /dev/null
@@ -1,1313 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_content.cxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 14:57:56 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the "License"); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-
-/**************************************************************************
- TODO
- **************************************************************************
-
- *************************************************************************/
-
-#ifndef _OSL_DIAGNOSE_H_
-#include <osl/diagnose.h>
-#endif
-#ifndef ODMA_CONTENTPROPS_HXX
-#include "odma_contentprops.hxx"
-#endif
-#ifndef _COM_SUN_STAR_UCB_XDYNAMICRESULTSET_HPP_
-#include <com/sun/star/ucb/XDynamicResultSet.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_
-#include <com/sun/star/beans/XPropertyAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_ILLEGALACCESSEXCEPTION_HPP_
-#include <com/sun/star/lang/IllegalAccessException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_UNSUPPORTEDDATASINKEXCEPTION_HPP_
-#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
-#include <com/sun/star/sdbc/XRow.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
-#include <com/sun/star/io/XOutputStream.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_
-#include <com/sun/star/io/XActiveDataSink.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
-#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_OPENMODE_HPP_
-#include <com/sun/star/ucb/OpenMode.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_XCOMMANDINFO_HPP_
-#include <com/sun/star/ucb/XCommandInfo.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_XPERSISTENTPROPERTYSET_HPP_
-#include <com/sun/star/ucb/XPersistentPropertySet.hpp>
-#endif
-#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
-#include <ucbhelper/contentidentifier.hxx>
-#endif
-#ifndef _UCBHELPER_PROPERTYVALUESET_HXX
-#include <ucbhelper/propertyvalueset.hxx>
-#endif
-#ifndef _UCBHELPER_CANCELCOMMANDEXECUTION_HXX_
-#include <ucbhelper/cancelcommandexecution.hxx>
-#endif
-#ifndef _COM_SUN_STAR_UCB_UNSUPPORTEDOPENMODEEXCEPTION_HPP_
-#include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_MISSINGINPUTSTREAMEXCEPTION_HPP_
-#include <com/sun/star/ucb/MissingInputStreamException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_INSERTCOMMANDARGUMENT_HPP_
-#include <com/sun/star/ucb/InsertCommandArgument.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_MISSINGPROPERTIESEXCEPTION_HPP_
-#include <com/sun/star/ucb/MissingPropertiesException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATASTREAMER_HPP_
-#include <com/sun/star/io/XActiveDataStreamer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_TRANSFERINFO_HPP_
-#include <com/sun/star/ucb/TransferInfo.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_NAMECLASH_HPP_
-#include <com/sun/star/ucb/NameClash.hpp>
-#endif
-#ifndef ODMA_CONTENT_HXX
-#include "odma_content.hxx"
-#endif
-#ifndef ODMA_PROVIDER_HXX
-#include "odma_provider.hxx"
-#endif
-#ifndef ODMA_RESULTSET_HXX
-#include "odma_resultset.hxx"
-#endif
-#ifndef ODMA_INPUTSTREAM_HXX
-#include "odma_inputstream.hxx"
-#endif
-#ifndef _UCBHELPER_CONTENT_HXX
-#include <ucbhelper/content.hxx>
-#endif
-#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_
-#include <com/sun/star/uno/Exception.hpp>
-#endif
-#ifndef _RTL_REF_HXX_
-#include <rtl/ref.hxx>
-#endif
-#ifndef _OSL_FILE_HXX_
-#include <osl/file.hxx>
-#endif
-
-using namespace com::sun;
-using namespace com::sun::star;
-using namespace odma;
-
-//=========================================================================
-//=========================================================================
-//
-// Content Implementation.
-//
-//=========================================================================
-//=========================================================================
-
-Content::Content( const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
- ContentProvider* pProvider,
- const uno::Reference< star::ucb::XContentIdentifier >& Identifier,
- const ::vos::ORef<ContentProperties>& _rProps)
- : ContentImplHelper( rxSMgr, pProvider, Identifier )
- ,m_aProps(_rProps)
- ,m_pProvider(pProvider)
- ,m_pContent(NULL)
-{
- OSL_ENSURE(m_aProps.isValid(),"No valid ContentPropeties!");
-}
-
-//=========================================================================
-// virtual
-Content::~Content()
-{
- delete m_pContent;
-}
-
-//=========================================================================
-//
-// XInterface methods.
-//
-//=========================================================================
-
-// virtual
-void SAL_CALL Content::acquire() throw()
-{
- ContentImplHelper::acquire();
-}
-
-//=========================================================================
-// virtual
-void SAL_CALL Content::release() throw()
-{
- ContentImplHelper::release();
-}
-
-//=========================================================================
-// virtual
-uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType )
- throw ( uno::RuntimeException )
-{
- uno::Any aRet;
-
- // @@@ Add support for additional interfaces.
-#if 0
- aRet = cppu::queryInterface( rType,
- static_cast< yyy::Xxxxxxxxx * >( this ) );
-#endif
-
- return aRet.hasValue() ? aRet : ContentImplHelper::queryInterface( rType );
-}
-
-//=========================================================================
-//
-// XTypeProvider methods.
-//
-//=========================================================================
-
-XTYPEPROVIDER_COMMON_IMPL( Content );
-
-//=========================================================================
-// virtual
-uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
- throw( uno::RuntimeException )
-{
- // @@@ Add own interfaces.
-
- static cppu::OTypeCollection* pCollection = 0;
-
- if ( !pCollection )
- {
- osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
- if ( !pCollection )
- {
- static cppu::OTypeCollection aCollection(
- CPPU_TYPE_REF( lang::XTypeProvider ),
- CPPU_TYPE_REF( lang::XServiceInfo ),
- CPPU_TYPE_REF( lang::XComponent ),
- CPPU_TYPE_REF( star::ucb::XContent ),
- CPPU_TYPE_REF( star::ucb::XCommandProcessor ),
- CPPU_TYPE_REF( beans::XPropertiesChangeNotifier ),
- CPPU_TYPE_REF( star::ucb::XCommandInfoChangeNotifier ),
- CPPU_TYPE_REF( beans::XPropertyContainer ),
- CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
- CPPU_TYPE_REF( container::XChild ) );
- pCollection = &aCollection;
- }
- }
-
- return (*pCollection).getTypes();
-}
-
-//=========================================================================
-//
-// XServiceInfo methods.
-//
-//=========================================================================
-
-// virtual
-rtl::OUString SAL_CALL Content::getImplementationName()
- throw( uno::RuntimeException )
-{
- // @@@ Adjust implementation name. Keep the prefix "com.sun.star.comp."!
- return rtl::OUString::createFromAscii( "com.sun.star.comp.odma.Content" );
-}
-
-//=========================================================================
-// virtual
-uno::Sequence< rtl::OUString > SAL_CALL Content::getSupportedServiceNames()
- throw( uno::RuntimeException )
-{
- // @@@ Adjust macro name.
- uno::Sequence< rtl::OUString > aSNS( 1 );
- aSNS.getArray()[ 0 ]
- = rtl::OUString::createFromAscii( ODMA_CONTENT_SERVICE_NAME );
- return aSNS;
-}
-
-//=========================================================================
-//
-// XContent methods.
-//
-//=========================================================================
-
-// virtual
-rtl::OUString SAL_CALL Content::getContentType()
- throw( uno::RuntimeException )
-{
- // @@@ Adjust macro name ( def in odma_provider.hxx ).
- return rtl::OUString::createFromAscii( ODMA_CONTENT_TYPE );
-}
-
-//=========================================================================
-//
-// XCommandProcessor methods.
-//
-//=========================================================================
-
-// virtual
-uno::Any SAL_CALL Content::execute(
- const star::ucb::Command& aCommand,
- sal_Int32 CommandId,
- const uno::Reference< star::ucb::XCommandEnvironment >& Environment )
- throw( uno::Exception,
- star::ucb::CommandAbortedException,
- uno::RuntimeException )
-{
- uno::Any aRet;
-
- if ( aCommand.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "getPropertyValues" ) ) )
- {
- //////////////////////////////////////////////////////////////////
- // getPropertyValues
- //////////////////////////////////////////////////////////////////
-
- uno::Sequence< beans::Property > Properties;
- if ( !( aCommand.Argument >>= Properties ) )
- {
- OSL_ENSURE( sal_False, "Wrong argument type!" );
- ucbhelper::cancelCommandExecution(
- uno::makeAny( lang::IllegalArgumentException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ),
- -1 ) ),
- Environment );
- // Unreachable
- }
-
- aRet <<= getPropertyValues( Properties, Environment );
- }
- else if ( aCommand.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "setPropertyValues" ) ) )
- {
- //////////////////////////////////////////////////////////////////
- // setPropertyValues
- //////////////////////////////////////////////////////////////////
-
- uno::Sequence< beans::PropertyValue > aProperties;
- if ( !( aCommand.Argument >>= aProperties ) )
- {
- OSL_ENSURE( sal_False, "Wrong argument type!" );
- ucbhelper::cancelCommandExecution(
- uno::makeAny( lang::IllegalArgumentException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ),
- -1 ) ),
- Environment );
- // Unreachable
- }
-
- if ( !aProperties.getLength() )
- {
- OSL_ENSURE( sal_False, "No properties!" );
- ucbhelper::cancelCommandExecution(
- uno::makeAny( lang::IllegalArgumentException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ),
- -1 ) ),
- Environment );
- // Unreachable
- }
-
- aRet <<= setPropertyValues( aProperties, Environment );
- }
- else if ( aCommand.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "getPropertySetInfo" ) ) )
- {
- //////////////////////////////////////////////////////////////////
- // getPropertySetInfo
- //////////////////////////////////////////////////////////////////
-
- // Note: Implemented by base class.
- aRet <<= getPropertySetInfo( Environment );
- }
- else if ( aCommand.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "getCommandInfo" ) ) )
- {
- //////////////////////////////////////////////////////////////////
- // getCommandInfo
- //////////////////////////////////////////////////////////////////
-
- // Note: Implemented by base class.
- aRet <<= getCommandInfo( Environment );
- }
- else if ( aCommand.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "open" ) ) )
- {
- star::ucb::OpenCommandArgument2 aOpenCommand;
- if ( !( aCommand.Argument >>= aOpenCommand ) )
- {
- OSL_ENSURE( sal_False, "Wrong argument type!" );
- ucbhelper::cancelCommandExecution(
- uno::makeAny( lang::IllegalArgumentException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ),
- -1 ) ),
- Environment );
- // Unreachable
- }
-
- sal_Bool bOpenFolder =
- ( ( aOpenCommand.Mode == star::ucb::OpenMode::ALL ) ||
- ( aOpenCommand.Mode == star::ucb::OpenMode::FOLDERS ) ||
- ( aOpenCommand.Mode == star::ucb::OpenMode::DOCUMENTS ) );
-
- if ( bOpenFolder)
- {
- // open as folder - return result set
-
- uno::Reference< star::ucb::XDynamicResultSet > xSet
- = new DynamicResultSet( m_xSMgr,
- this,
- aOpenCommand,
- Environment );
- aRet <<= xSet;
- }
-
- if ( aOpenCommand.Sink.is() )
- {
- // Open document - supply document data stream.
-
- // Check open mode
- if ( ( aOpenCommand.Mode
- == star::ucb::OpenMode::DOCUMENT_SHARE_DENY_NONE ) ||
- ( aOpenCommand.Mode
- == star::ucb::OpenMode::DOCUMENT_SHARE_DENY_WRITE ) )
- {
- // Unsupported.
- ucbhelper::cancelCommandExecution(
- uno::makeAny( star::ucb::UnsupportedOpenModeException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ),
- sal_Int16( aOpenCommand.Mode ) ) ),
- Environment );
- // Unreachable
- }
-
-
- rtl::OUString aURL = m_xIdentifier->getContentIdentifier();
- rtl::OUString sFileURL = openDoc();
- delete m_pContent;
- m_pContent = new ::ucb::Content(sFileURL,NULL);
- if(!m_pContent->isDocument())
- {
- rtl::OUString sErrorMsg(RTL_CONSTASCII_USTRINGPARAM("File: "));
- sErrorMsg += sFileURL;
- sErrorMsg += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" could not be found."));
- ucbhelper::cancelCommandExecution(
- uno::makeAny( io::IOException(
- sErrorMsg,
- static_cast< cppu::OWeakObject * >( this )) ),
- Environment );
- }
-
- uno::Reference< io::XOutputStream > xOut
- = uno::Reference< io::XOutputStream >(
- aOpenCommand.Sink, uno::UNO_QUERY );
- if ( xOut.is() )
- {
- // @@@ PUSH: write data into xOut
- m_pContent->openStream(xOut);
- }
- else
- {
- uno::Reference< io::XActiveDataSink > xDataSink
- = uno::Reference< io::XActiveDataSink >(
- aOpenCommand.Sink, uno::UNO_QUERY );
- if ( xDataSink.is() )
- {
- // @@@ PULL: wait for client read
- uno::Reference< io::XInputStream > xIn;
- try
- {
- xIn = m_pContent->openStream();
- }
- catch(uno::Exception&)
- {
- OSL_ENSURE(0,"Exception occured while creating the file content!");
- }
- xDataSink->setInputStream( xIn );
- }
- else
- {
- uno::Reference< io::XActiveDataStreamer > activeDataStreamer( aOpenCommand.Sink,uno::UNO_QUERY );
- if(activeDataStreamer.is())
- {
- activeDataStreamer->setStream(new OOdmaStream(m_pContent,getContentProvider(),m_aProps));
- m_pContent = NULL; // don't delete here because the stream is now the owner
- }
- else
- {
- // Note: aOpenCommand.Sink may contain an XStream
- // implementation. Support for this type of
- // sink is optional...
- ucbhelper::cancelCommandExecution(
- uno::makeAny( com::sun::star::ucb::UnsupportedDataSinkException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ),
- aOpenCommand.Sink ) ),
- Environment );
- // Unreachable
- }
- }
- }
- }
- }
- else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "close" ) ) )
- {
- getContentProvider()->closeDocument(m_aProps->m_sDocumentId);
- }
- else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "delete" ) ) )
- {
- //////////////////////////////////////////////////////////////////
- // delete
- //////////////////////////////////////////////////////////////////
-
- // Remove own and all children's Additional Core Properties.
- removeAdditionalPropertySet( sal_True );
- // Remove own and all childrens(!) persistent data.
- if(!getContentProvider()->deleteDocument(m_aProps))
- ucbhelper::cancelCommandExecution(
- uno::makeAny( lang::IllegalArgumentException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ),
- -1 ) ),
- Environment );
- }
- else if ( aCommand.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "insert" ) ) )
- {
- //////////////////////////////////////////////////////////////////
- // insert
- //////////////////////////////////////////////////////////////////
-
- star::ucb::InsertCommandArgument arg;
- if ( !( aCommand.Argument >>= arg ) )
- {
- OSL_ENSURE( sal_False, "Wrong argument type!" );
- ucbhelper::cancelCommandExecution(
- uno::makeAny( lang::IllegalArgumentException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ),
- -1 ) ),
- Environment );
- // Unreachable
- }
-
- insert( arg.Data, arg.ReplaceExisting, Environment );
- }
- else if( ! aCommand.Name.compareToAscii( "transfer" ) )
- {
- com::sun::star::ucb::TransferInfo aTransferInfo;
- if( ! ( aCommand.Argument >>= aTransferInfo ) )
- {
- OSL_ENSURE( sal_False, "Wrong argument type!" );
- ucbhelper::cancelCommandExecution(
- uno::makeAny( lang::IllegalArgumentException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ),
- -1 ) ),
- Environment );
- // Unreachable
- }
- ::vos::ORef<ContentProperties> aProp = m_aProps;
- if(aProp->m_bIsFolder)
- {
- aProp = getContentProvider()->getContentPropertyWithTitle(aTransferInfo.NewTitle);
- if(!aProp.isValid())
- aProp = getContentProvider()->getContentPropertyWithSavedAsName(aTransferInfo.NewTitle);
- sal_Bool bError = !aProp.isValid();
- if(bError)
- {
- sal_Char* pExtension = NULL;
- ::rtl::OString sExt;
- sal_Int32 nPos = aTransferInfo.NewTitle.lastIndexOf('.');
- if(nPos != -1)
- {
- sExt = ::rtl::OUStringToOString(aTransferInfo.NewTitle.copy(nPos+1),RTL_TEXTENCODING_ASCII_US);
- if(sExt.equalsIgnoreAsciiCase("txt"))
- pExtension = ODM_FORMAT_TEXT;
- else if(sExt.equalsIgnoreAsciiCase("rtf"))
- pExtension = ODM_FORMAT_RTF;
- else if(sExt.equalsIgnoreAsciiCase("ps"))
- pExtension = ODM_FORMAT_PS;
- else
- pExtension = const_cast<sal_Char*>(sExt.getStr());
- }
- else
- pExtension = ODM_FORMAT_TEXT;
-
- sal_Char* lpszNewDocId = new sal_Char[ODM_DOCID_MAX];
- void *pData = NULL;
- DWORD dwFlags = ODM_SILENT;
- ODMSTATUS odm = NODMSaveAsEx(ContentProvider::getHandle(),
- NULL, // means it is saved the first time
- lpszNewDocId,
- pExtension,
- NULL, // no callback function here
- pData,
- &dwFlags);
-
- // check if we have to call the DMS dialog
- if(odm == ODM_E_USERINT)
- {
- dwFlags = 0;
- odm = NODMSaveAsEx(ContentProvider::getHandle(),
- NULL, // means it is saved the first time
- lpszNewDocId,
- pExtension,
- NULL, // no callback function here
- pData,
- &dwFlags);
- }
- bError = odm != ODM_SUCCESS;
- if(!bError)
- {
- aProp = new ContentProperties();
- aProp->m_sDocumentId = ::rtl::OString(lpszNewDocId);
- aProp->m_sContentType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODMA_CONTENT_TYPE));
- aProp->m_sSavedAsName = aTransferInfo.NewTitle;
- getContentProvider()->append(aProp);
-
- // now set the title
- WORD nDocInfo = ODM_NAME;
- ::rtl::OUString sFileName = aTransferInfo.NewTitle;
- sal_Int32 nIndex = aTransferInfo.NewTitle.lastIndexOf( sal_Unicode('.') );
- if(nIndex != -1)
- sFileName = aTransferInfo.NewTitle.copy(0,nIndex);
-
- ::rtl::OString sDocInfoValue = ::rtl::OUStringToOString(sFileName,RTL_TEXTENCODING_ASCII_US);
- odm = NODMSetDocInfo( ContentProvider::getHandle(),
- lpszNewDocId,
- nDocInfo,
- const_cast<sal_Char*>(sDocInfoValue.getStr())
- );
-
- }
- else if ( odm == ODM_E_CANCEL)
- ODMSTATUS odm = NODMActivate(ContentProvider::getHandle(),
- ODM_DELETE,
- lpszNewDocId);
-
- delete lpszNewDocId;
- }
- if(bError)
- ucbhelper::cancelCommandExecution(
- uno::makeAny( lang::IllegalArgumentException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ),
- -1 ) ),
- Environment );
- }
- rtl::OUString sFileURL = ContentProvider::openDoc(aProp);
-
- sal_Int32 nLastIndex = sFileURL.lastIndexOf( sal_Unicode('/') );
- ::ucb::Content aContent(sFileURL.copy(0,nLastIndex),NULL);
- // aTransferInfo.NameClash = com::sun::star::ucb::NameClash::OVERWRITE;
- aTransferInfo.NewTitle = sFileURL.copy( 1 + nLastIndex );
- aContent.executeCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("transfer")),uno::makeAny(aTransferInfo));
- getContentProvider()->saveDocument(aProp->m_sDocumentId);
- }
- else
- {
- //////////////////////////////////////////////////////////////////
- // Unsupported command
- //////////////////////////////////////////////////////////////////
-
- OSL_ENSURE( sal_False, "Content::execute - unsupported command!" );
-
- ucbhelper::cancelCommandExecution(
- uno::makeAny( star::ucb::UnsupportedCommandException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ) ) ),
- Environment );
- // Unreachable
- }
-
- return aRet;
-}
-
-//=========================================================================
-// virtual
-void SAL_CALL Content::abort( sal_Int32 CommandId )
- throw( uno::RuntimeException )
-{
- // @@@ Implement logic to abort running commands, if this makes
- // sense for your content.
-}
-
-//=========================================================================
-//
-// Non-interface methods.
-//
-//=========================================================================
-
-// virtual
-::rtl::OUString Content::getParentURL()
-{
- ::rtl::OUString sURL = m_xIdentifier->getContentIdentifier();
-
- // @@@ Extract URL of parent from aURL and return it...
- static ::rtl::OUString sScheme1(RTL_CONSTASCII_USTRINGPARAM(ODMA_URL_SCHEME ODMA_URL_SHORT "/"));
- static ::rtl::OUString sScheme2(RTL_CONSTASCII_USTRINGPARAM(ODMA_URL_SCHEME ODMA_URL_SHORT));
- if(sURL == sScheme1 || sURL == sScheme2)
- sURL = ::rtl::OUString();
- else
- sURL = sScheme1;
-
- return sURL;
-}
-
-//=========================================================================
-// static
-uno::Reference< sdbc::XRow > Content::getPropertyValues(
- const uno::Reference< lang::XMultiServiceFactory >& rSMgr,
- const uno::Sequence< beans::Property >& rProperties,
- const ::vos::ORef<ContentProperties>& rData,
- const vos::ORef< ::ucb::ContentProviderImplHelper >& rProvider,
- const rtl::OUString& rContentId )
-{
- // Note: Empty sequence means "get values of all supported properties".
-
- rtl::Reference< ::ucb::PropertyValueSet > xRow
- = new ::ucb::PropertyValueSet( rSMgr );
-
- sal_Int32 nCount = rProperties.getLength();
- if ( nCount )
- {
- uno::Reference< beans::XPropertySet > xAdditionalPropSet;
- sal_Bool bTriedToGetAdditonalPropSet = sal_False;
-
- const beans::Property* pProps = rProperties.getConstArray();
- for ( sal_Int32 n = 0; n < nCount; ++n )
- {
- const beans::Property& rProp = pProps[ n ];
-
- // Process Core properties.
-
- if ( rProp.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "ContentType" ) ) )
- {
- xRow->appendString ( rProp, rData->m_sContentType );
- }
- else if ( rProp.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
- {
- xRow->appendString ( rProp, rData->m_sTitle );
- }
- else if ( rProp.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) )
- {
- xRow->appendBoolean( rProp, rData->m_bIsDocument );
- }
- else if ( rProp.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) )
- {
- xRow->appendBoolean( rProp, rData->m_bIsFolder );
- }
- else if ( rProp.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "DateCreated" ) ) )
- {
- xRow->appendTimestamp( rProp, rData->m_aDateCreated );
- }
- else if ( rProp.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "DateModified" ) ) )
- {
- xRow->appendTimestamp( rProp, rData->m_aDateModified );
- }
- else if ( rProp.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "IsReadOnly" ) ) )
- {
- xRow->appendBoolean( rProp, rData->m_bIsReadOnly );
- }
- else if ( rProp.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "Author" ) ) )
- {
- xRow->appendString ( rProp, rData->m_sAuthor );
- }
- else if ( rProp.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "Subject" ) ) )
- {
- xRow->appendString ( rProp, rData->m_sSubject );
- }
- else if ( rProp.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "Keywords" ) ) )
- {
- xRow->appendString ( rProp, rData->m_sKeywords );
- }
- else
- {
- // @@@ Note: If your data source supports adding/removing
- // properties, you should implement the interface
- // XPropertyContainer by yourself and supply your own
- // logic here. The base class uses the service
- // "com.sun.star.ucb.Store" to maintain Additional Core
- // properties. But using server functionality is preferred!
-
- // Not a Core Property! Maybe it's an Additional Core Property?!
-
- if ( !bTriedToGetAdditonalPropSet && !xAdditionalPropSet.is() )
- {
- xAdditionalPropSet
- = uno::Reference< beans::XPropertySet >(
- rProvider->getAdditionalPropertySet( rContentId,
- sal_False ),
- uno::UNO_QUERY );
- bTriedToGetAdditonalPropSet = sal_True;
- }
-
- if ( xAdditionalPropSet.is() )
- {
- if ( !xRow->appendPropertySetValue(
- xAdditionalPropSet,
- rProp ) )
- {
- // Append empty entry.
- xRow->appendVoid( rProp );
- }
- }
- else
- {
- // Append empty entry.
- xRow->appendVoid( rProp );
- }
- }
- }
- }
- else
- {
- // Append all Core Properties.
- xRow->appendString (
- beans::Property( rtl::OUString::createFromAscii( "ContentType" ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::READONLY ),
- rData->m_sContentType );
- xRow->appendString (
- beans::Property( rtl::OUString::createFromAscii( "Title" ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND ),
- rData->m_sTitle );
- xRow->appendBoolean(
- beans::Property( rtl::OUString::createFromAscii( "IsDocument" ),
- -1,
- getCppuBooleanType(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::READONLY ),
- rData->m_bIsDocument );
- xRow->appendBoolean(
- beans::Property( rtl::OUString::createFromAscii( "IsFolder" ),
- -1,
- getCppuBooleanType(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::READONLY ),
- rData->m_bIsFolder );
-
- // @@@ Append other properties supported directly.
- xRow->appendTimestamp(
- beans::Property( rtl::OUString::createFromAscii( "DateCreated" ),
- -1,
- getCppuType(static_cast< const com::sun::star::util::DateTime * >( 0 ) ),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::READONLY ),
- rData->m_aDateCreated );
- xRow->appendTimestamp(
- beans::Property( rtl::OUString::createFromAscii( "DateModified" ),
- -1,
- getCppuType(static_cast< const com::sun::star::util::DateTime * >( 0 ) ),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::READONLY ),
- rData->m_aDateModified );
- xRow->appendBoolean(
- beans::Property( rtl::OUString::createFromAscii( "IsReadOnly" ),
- -1,
- getCppuBooleanType(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::READONLY ),
- rData->m_bIsReadOnly );
- xRow->appendString (
- beans::Property( rtl::OUString::createFromAscii( "Author" ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND ),
- rData->m_sAuthor );
- xRow->appendString (
- beans::Property( rtl::OUString::createFromAscii( "Subject" ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND ),
- rData->m_sSubject );
- xRow->appendString (
- beans::Property( rtl::OUString::createFromAscii( "Keywords" ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND ),
- rData->m_sKeywords );
-
- // @@@ Note: If your data source supports adding/removing
- // properties, you should implement the interface
- // XPropertyContainer by yourself and supply your own
- // logic here. The base class uses the service
- // "com.sun.star.ucb.Store" to maintain Additional Core
- // properties. But using server functionality is preferred!
-
- // Append all Additional Core Properties.
-
- uno::Reference< beans::XPropertySet > xSet(
- rProvider->getAdditionalPropertySet( rContentId, sal_False ),
- uno::UNO_QUERY );
- xRow->appendPropertySet( xSet );
- }
-
- return uno::Reference< sdbc::XRow >( xRow.get() );
-}
-
-//=========================================================================
-uno::Reference< sdbc::XRow > Content::getPropertyValues(
- const uno::Sequence< beans::Property >& rProperties,
- const uno::Reference< star::ucb::XCommandEnvironment >& xEnv )
-{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- return getPropertyValues( m_xSMgr,
- rProperties,
- m_aProps,
- vos::ORef<
- ::ucb::ContentProviderImplHelper >(
- m_xProvider.getBodyPtr() ),
- m_xIdentifier->getContentIdentifier() );
-}
-
-//=========================================================================
-uno::Sequence< uno::Any > Content::setPropertyValues(
- const uno::Sequence< beans::PropertyValue >& rValues,
- const uno::Reference< star::ucb::XCommandEnvironment >& xEnv )
-{
- osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
-
- uno::Sequence< uno::Any > aRet( rValues.getLength() );
- uno::Sequence< beans::PropertyChangeEvent > aChanges( rValues.getLength() );
- sal_Int32 nChanged = 0;
-
- beans::PropertyChangeEvent aEvent;
- aEvent.Source = static_cast< cppu::OWeakObject * >( this );
- aEvent.Further = sal_False;
-// aEvent.PropertyName =
- aEvent.PropertyHandle = -1;
-// aEvent.OldValue =
-// aEvent.NewValue =
-
- const beans::PropertyValue* pValues = rValues.getConstArray();
- sal_Int32 nCount = rValues.getLength();
-
- uno::Reference< star::ucb::XPersistentPropertySet > xAdditionalPropSet;
- sal_Bool bTriedToGetAdditonalPropSet = sal_False;
-
- for ( sal_Int32 n = 0; n < nCount; ++n )
- {
- const beans::PropertyValue& rValue = pValues[ n ];
-
- if ( rValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
- {
- changePropertyValue(rValue,n,m_aProps->m_sTitle,nChanged,aRet,aChanges);
- }
- else if ( rValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "Author") ) )
- {
- changePropertyValue(rValue,n,m_aProps->m_sAuthor,nChanged,aRet,aChanges);
- }
- else if ( rValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "Keywords") ) )
- {
- changePropertyValue(rValue,n,m_aProps->m_sKeywords,nChanged,aRet,aChanges);
- }
- else if ( rValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "Subject") ) )
- {
- changePropertyValue(rValue,n,m_aProps->m_sSubject,nChanged,aRet,aChanges);
- }
- else if ( rValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "ContentType" ) ) ||
- rValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) ||
- rValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) ||
- rValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "DateCreated" ) ) ||
- rValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "DateModified" ) ) ||
- rValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "IsReadOnly" ) ) )
- {
- // Read-only property!
- aRet[ n ] <<= lang::IllegalAccessException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "Property is read-only!") ),
- static_cast< cppu::OWeakObject * >( this ) );
- }
- else
- {
- // @@@ Note: If your data source supports adding/removing
- // properties, you should implement the interface
- // XPropertyContainer by yourself and supply your own
- // logic here. The base class uses the service
- // "com.sun.star.ucb.Store" to maintain Additional Core
- // properties. But using server functionality is preferred!
-
- // Not a Core Property! Maybe it's an Additional Core Property?!
-
- if ( !bTriedToGetAdditonalPropSet && !xAdditionalPropSet.is() )
- {
- xAdditionalPropSet = getAdditionalPropertySet( sal_False );
- bTriedToGetAdditonalPropSet = sal_True;
- }
-
- if ( xAdditionalPropSet.is() )
- {
- try
- {
- uno::Any aOldValue
- = xAdditionalPropSet->getPropertyValue( rValue.Name );
- if ( aOldValue != rValue.Value )
- {
- xAdditionalPropSet->setPropertyValue(
- rValue.Name, rValue.Value );
-
- aEvent.PropertyName = rValue.Name;
- aEvent.OldValue = aOldValue;
- aEvent.NewValue = rValue.Value;
-
- aChanges.getArray()[ nChanged ] = aEvent;
- nChanged++;
- }
- else
- {
- // Old value equals new value. No error!
- }
- }
- catch ( beans::UnknownPropertyException const & e )
- {
- aRet[ n ] <<= e;
- }
- catch ( lang::WrappedTargetException const & e )
- {
- aRet[ n ] <<= e;
- }
- catch ( beans::PropertyVetoException const & e )
- {
- aRet[ n ] <<= e;
- }
- catch ( lang::IllegalArgumentException const & e )
- {
- aRet[ n ] <<= e;
- }
- }
- else
- {
- aRet[ n ] <<= uno::Exception(
- rtl::OUString::createFromAscii(
- "No property set for storing the value!" ),
- static_cast< cppu::OWeakObject * >( this ) );
- }
- }
- }
-
- if ( nChanged > 0 )
- {
- // @@@ Save changes.
-// storeData();
-
- aGuard.clear();
- aChanges.realloc( nChanged );
- notifyPropertiesChange( aChanges );
- }
-
- return aRet;
-}
-
-#if 0
-//=========================================================================
-void Content::queryChildren( ContentRefList& rChildren )
-{
- // @@@ Adapt method to your URL scheme...
-
- // Obtain a list with a snapshot of all currently instanciated contents
- // from provider and extract the contents which are direct children
- // of this content.
-
- ::ucb::ContentRefList aAllContents;
- m_xProvider->queryExistingContents( aAllContents );
-
- OUString aURL = m_xIdentifier->getContentIdentifier();
- sal_Int32 nPos = aURL.lastIndexOf( '/' );
-
- if ( nPos != ( aURL.getLength() - 1 ) )
- {
- // No trailing slash found. Append.
- aURL += OUString::createFromAscii( "/" );
- }
-
- sal_Int32 nLen = aURL.getLength();
-
- ::ucb::ContentRefList::const_iterator it = aAllContents.begin();
- ::ucb::ContentRefList::const_iterator end = aAllContents.end();
-
- while ( it != end )
- {
- ::ucb::ContentImplHelperRef xChild = (*it);
- OUString aChildURL = xChild->getIdentifier()->getContentIdentifier();
-
- // Is aURL a prefix of aChildURL?
- if ( ( aChildURL.getLength() > nLen ) &&
- ( aChildURL.compareTo( aURL, nLen ) == 0 ) )
- {
- sal_Int32 nPos = nLen;
- nPos = aChildURL.indexOf( '/', nPos );
-
- if ( ( nPos == -1 ) ||
- ( nPos == ( aChildURL.getLength() - 1 ) ) )
- {
- // No further slashes / only a final slash. It's a child!
- rChildren.push_back(
- ContentRef(
- static_cast< Content * >( xChild.getBodyPtr() ) ) );
- }
- }
- ++it;
- }
-}
-#endif
-//=========================================================================
-void Content::insert(
- const uno::Reference< io::XInputStream > & xInputStream,
- sal_Bool bReplaceExisting,
- const uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& Environment )
- throw( uno::Exception )
-{
- osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
-
- // Check, if all required properties were set.
- if ( !m_aProps->m_sTitle.getLength())
- {
- OSL_ENSURE( sal_False, "Content::insert - property value missing!" );
-
- uno::Sequence< rtl::OUString > aProps( 1 );
- aProps[ 0 ] = rtl::OUString::createFromAscii( "zzzz" );
- ucbhelper::cancelCommandExecution(
- uno::makeAny( star::ucb::MissingPropertiesException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ),
- aProps ) ),
- Environment );
- // Unreachable
- }
-
- if ( !xInputStream.is() )
- {
- OSL_ENSURE( sal_False, "Content::insert - No data stream!" );
-
- ucbhelper::cancelCommandExecution(
- uno::makeAny( star::ucb::MissingInputStreamException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ) ) ),
- Environment );
- // Unreachable
- }
-
- // Assemble new content identifier...
-
- // uno::Reference< star::ucb::XContentIdentifier > xId = ...;
-
- // Fail, if a resource with given id already exists.
- if ( !bReplaceExisting ) // && hasData( m_xIdentifier ) )
- {
- ucbhelper::cancelCommandExecution(
- uno::makeAny( star::ucb::UnsupportedCommandException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ) ) ),
- Environment );
-// ucbhelper::cancelCommandExecution(
-// star::ucb::IOErrorCode_ALREADY_EXISTING,
-// Environment,
-// uno::makeAny(static_cast< cppu::OWeakObject * >( this ))
-// );
- // Unreachable
- }
-
- // m_xIdentifier = xId;
-
-// @@@
-// storeData();
-
- aGuard.clear();
- inserted();
-}
-#if 0
-//=========================================================================
-void Content::destroy( sal_Bool bDeletePhysical )
- throw( uno::Exception )
-{
- // @@@ take care about bDeletePhysical -> trashcan support
-
- uno::Reference< star::ucb::XContent > xThis = this;
-
- deleted();
-
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
-
- // Process instanciated children...
-
- ContentRefList aChildren;
- queryChildren( aChildren );
-
- ContentRefList::const_iterator it = aChildren.begin();
- ContentRefList::const_iterator end = aChildren.end();
-
- while ( it != end )
- {
- (*it)->destroy( bDeletePhysical );
- ++it;
- }
-}
-#endif
-
-// -----------------------------------------------------------------------------
-::rtl::OUString Content::openDoc()
-{
- OSL_ENSURE(m_aProps.isValid(),"No valid content properties!");
- return ContentProvider::openDoc(m_aProps);
-}
-// -----------------------------------------------------------------------------
-void Content::changePropertyValue(const beans::PropertyValue& _rValue,
- sal_Int32 _rnCurrentPos,
- ::rtl::OUString& _rsMemberValue,
- sal_Int32& _rnChanged,
- uno::Sequence< uno::Any >& _rRet,
- uno::Sequence< beans::PropertyChangeEvent >& _rChanges) throw (beans::IllegalTypeException)
-{
- rtl::OUString sNewValue;
- sal_Bool bError = sal_False;
- if ( _rValue.Value >>= sNewValue )
- {
- if ( sNewValue != _rsMemberValue )
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- // first we have to check if we could change the property inside the DMS
- ::rtl::OString sDocInfoValue = ::rtl::OUStringToOString(sNewValue,RTL_TEXTENCODING_ASCII_US);
- WORD nDocInfo;
- if(&_rsMemberValue == &m_aProps->m_sTitle)
- nDocInfo = ODM_TITLETEXT;
- else if(&_rsMemberValue == &m_aProps->m_sAuthor)
- nDocInfo = ODM_AUTHOR;
- else if(&_rsMemberValue == &m_aProps->m_sSubject)
- nDocInfo = ODM_SUBJECT;
- else if(&_rsMemberValue == &m_aProps->m_sKeywords)
- nDocInfo = ODM_KEYWORDS;
- else
- bError = sal_True;
-
- if(!bError)
- {
- ODMSTATUS odm = NODMSetDocInfo( ContentProvider::getHandle(),
- const_cast<sal_Char*>(m_aProps->m_sDocumentId.getStr()),
- nDocInfo,
- const_cast<sal_Char*>(sDocInfoValue.getStr())
- );
- if(odm == ODM_SUCCESS)
- {
- beans::PropertyChangeEvent aEvent;
- aEvent.Source = static_cast< cppu::OWeakObject * >( this );
- aEvent.Further = sal_False;
- aEvent.PropertyHandle = -1;
- aEvent.PropertyName = _rValue.Name;
- aEvent.OldValue = uno::makeAny( _rsMemberValue );
- aEvent.NewValue = uno::makeAny( sNewValue );
-
- _rChanges.getArray()[ _rnChanged ] = aEvent;
-
- _rsMemberValue = sNewValue;
- ++_rnChanged;
- }
- }
- }
- else
- {
- // Old value equals new value. No error!
- }
- }
- else
- bError = sal_True;
-
- if(bError)
- {
- _rRet[ _rnCurrentPos ] <<= beans::IllegalTypeException(
- rtl::OUString::createFromAscii(
- "Property value has wrong type!" ),
- static_cast< cppu::OWeakObject * >( this ) );
- }
-}
-// -----------------------------------------------------------------------------
-
diff --git a/ucb/source/ucp/odma/odma_content.hxx b/ucb/source/ucp/odma/odma_content.hxx
deleted file mode 100644
index 9f6c479ab8..0000000000
--- a/ucb/source/ucp/odma/odma_content.hxx
+++ /dev/null
@@ -1,234 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_content.hxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 14:58:09 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the "License"); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-
-// @@@ Adjust multi-include-protection-ifdef.
-#ifndef ODMA_CONTENT_HXX
-#define ODMA_CONTENT_HXX
-
-#include <list>
-
-#ifndef _UCBHELPER_CONTENTHELPER_HXX
-#include <ucbhelper/contenthelper.hxx>
-#endif
-
-namespace com { namespace sun { namespace star {
- namespace beans {
- struct Property;
- struct PropertyValue;
- }
- namespace sdbc {
- class XRow;
- }
- namespace io {
- class XInputStream;
- }
-}}}
-namespace ucb
-{
- class Content;
-}
-
-
-// @@@ Adjust namespace name.
-namespace odma
-{
-
-//=========================================================================
-
-// @@@ Adjust service name.
-
-// UNO service name for the content.
-#define ODMA_CONTENT_SERVICE_NAME \
- "com.sun.star.ucb.OdmaContent"
-
-//=========================================================================
-class ContentProvider;
-class ContentProperties;
-class Content : public ::ucb::ContentImplHelper
-{
- ::vos::ORef<ContentProperties> m_aProps;
- ContentProvider* m_pProvider;
- ::ucb::Content* m_pContent;
-
-private:
- virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
- getProperties( const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv );
- virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
- getCommands( const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv );
- virtual ::rtl::OUString getParentURL();
-
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
- getPropertyValues( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::beans::Property >& rProperties,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
- setPropertyValues( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::beans::PropertyValue >& rValues,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
-
- /** openDoc returns the file URL for the DOC ID
- @return the url of the temporary file
- */
- ::rtl::OUString openDoc();
-
- /** changePropertyValue sets the property referenced by _sMemberValue to the new value
- @param _rValue the new value to set
- @param _rnCurrentPos the current position inside the Any sequence _rRet
- @param _sMemberValue the place where to set the property
- @param _rnChanged will be incremented when property changed
- @param _rRet collect the exceptions
- @param _rChanges contains the changes done
- */
- void changePropertyValue(const ::com::sun::star::beans::PropertyValue& _rValue,
- sal_Int32 _rnCurrentPos,
- ::rtl::OUString& _rsMemberValue,
- sal_Int32& _rnChanged,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rRet,
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& _rChanges) throw (::com::sun::star::beans::IllegalTypeException);
-
-// typedef rtl::Reference< Content > ContentRef;
-// typedef std::list< ContentRef > ContentRefList;
-// void queryChildren( ContentRefList& rChildren );
-
- // Command "insert"
- void insert( const ::com::sun::star::uno::Reference<
- ::com::sun::star::io::XInputStream > & xInputStream,
- sal_Bool bReplaceExisting,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& Environment )
- throw( ::com::sun::star::uno::Exception );
-
-// // Command "delete"
-// void destroy( sal_Bool bDeletePhysical )
-// throw( ::com::sun::star::uno::Exception );
-
-public:
- Content( const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
- ContentProvider* pProvider,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XContentIdentifier >& Identifier,
- const ::vos::ORef<ContentProperties>& _rProps);
- virtual ~Content();
-
- // XInterface
- XINTERFACE_DECL()
-
- // XTypeProvider
- XTYPEPROVIDER_DECL()
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL
- getImplementationName()
- throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- getSupportedServiceNames()
- throw( ::com::sun::star::uno::RuntimeException );
-
- // XContent
- virtual rtl::OUString SAL_CALL
- getContentType()
- throw( com::sun::star::uno::RuntimeException );
-
- // XCommandProcessor
- virtual com::sun::star::uno::Any SAL_CALL
- execute( const com::sun::star::ucb::Command& aCommand,
- sal_Int32 CommandId,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& Environment )
- throw( com::sun::star::uno::Exception,
- com::sun::star::ucb::CommandAbortedException,
- com::sun::star::uno::RuntimeException );
- virtual void SAL_CALL
- abort( sal_Int32 CommandId )
- throw( com::sun::star::uno::RuntimeException );
-
- //////////////////////////////////////////////////////////////////////
- // Additional interfaces
- //////////////////////////////////////////////////////////////////////
-
- // @@@ Add additional interfaces ( like com::sun:.star::ucb::XContentCreator ).
-
- //////////////////////////////////////////////////////////////////////
- // Non-interface methods.
- //////////////////////////////////////////////////////////////////////
-
- // Called from resultset data supplier.
- static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
- getPropertyValues( const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
- const ::com::sun::star::uno::Sequence<
- ::com::sun::star::beans::Property >& rProperties,
- const ::vos::ORef<ContentProperties>& rData,
- const ::vos::ORef<
- ::ucb::ContentProviderImplHelper >& rProvider,
- const ::rtl::OUString& rContentId );
-
- ContentProvider* getContentProvider() const { return m_pProvider; }
-};
-
-}
-
-#endif
diff --git a/ucb/source/ucp/odma/odma_contentcaps.cxx b/ucb/source/ucp/odma/odma_contentcaps.cxx
deleted file mode 100644
index af8a51862b..0000000000
--- a/ucb/source/ucp/odma/odma_contentcaps.cxx
+++ /dev/null
@@ -1,300 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_contentcaps.cxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 14:58:18 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the "License"); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-
-/**************************************************************************
- TODO
- **************************************************************************
-
- *************************************************************************/
-
-#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_
-#include <com/sun/star/beans/Property.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
-#include <com/sun/star/beans/PropertyValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_COMMANDINFO_HPP_
-#include <com/sun/star/ucb/CommandInfo.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_INSERTCOMMANDARGUMENT_HPP_
-#include <com/sun/star/ucb/InsertCommandArgument.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
-#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
-#include <com/sun/star/uno/Sequence.hxx>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_
-#include <com/sun/star/util/DateTime.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_TRANSFERINFO_HPP_
-#include <com/sun/star/ucb/TransferInfo.hpp>
-#endif
-#ifndef ODMA_CONTENT_HXX
-#include "odma_content.hxx"
-#endif
-
-using namespace com::sun;
-using namespace com::sun::star;
-using namespace odma;
-
-//=========================================================================
-//
-// Content implementation.
-//
-//=========================================================================
-
-//=========================================================================
-//
-// IMPORTENT: If any property data ( name / type / ... ) are changed, then
-// Content::getPropertyValues(...) must be adapted too!
-//
-//=========================================================================
-
-// virtual
-uno::Sequence< beans::Property > Content::getProperties(
- const uno::Reference< star::ucb::XCommandEnvironment > & xEnv )
-{
- // @@@ Add additional properties...
-
- // @@@ Note: If your data source supports adding/removing properties,
- // you should implement the interface XPropertyContainer
- // by yourself and supply your own logic here. The base class
- // uses the service "com.sun.star.ucb.Store" to maintain
- // Additional Core properties. But using server functionality
- // is preferred! In fact you should return a table conatining
- // even that dynamicly added properties.
-
-// osl::Guard< osl::Mutex > aGuard( m_aMutex );
-
- //=================================================================
- //
- // Supported properties
- //
- //=================================================================
-
- #define PROPERTY_COUNT 10
-
- static beans::Property aPropertyInfoTable[] =
- {
- ///////////////////////////////////////////////////////////////
- // Required properties
- ///////////////////////////////////////////////////////////////
- beans::Property(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY
- ),
- beans::Property(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
- -1,
- getCppuBooleanType(),
- beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY
- ),
- beans::Property(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
- -1,
- getCppuBooleanType(),
- beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY
- ),
- beans::Property(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND
- ),
- ///////////////////////////////////////////////////////////////
- // Optional standard properties
- ///////////////////////////////////////////////////////////////
- beans::Property(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateCreated" ) ),
- -1,
- getCppuType(static_cast< const com::sun::star::util::DateTime * >( 0 ) ),
- beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY
- ),
- beans::Property(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateModified" ) ),
- -1,
- getCppuType(static_cast< const com::sun::star::util::DateTime * >( 0 ) ),
- beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY
- ),
- beans::Property(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ),
- -1,
- getCppuBooleanType(),
- beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY
- ),
- ///////////////////////////////////////////////////////////////
- // New properties
- ///////////////////////////////////////////////////////////////
- beans::Property(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Author" ) ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND
- ),
- beans::Property(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subject" ) ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND
- ),
- beans::Property(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Keywords" ) ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND
- )
- };
- return uno::Sequence<
- beans::Property >( aPropertyInfoTable, PROPERTY_COUNT );
-}
-
-//=========================================================================
-// virtual
-uno::Sequence< star::ucb::CommandInfo > Content::getCommands(
- const uno::Reference< star::ucb::XCommandEnvironment > & xEnv )
-{
- // @@@ Add additional commands...
-
-// osl::Guard< osl::Mutex > aGuard( m_aMutex );
-
- //=================================================================
- //
- // Supported commands
- //
- //=================================================================
-
- #define COMMAND_COUNT 8
-
- static star::ucb::CommandInfo aCommandInfoTable[] =
- {
- ///////////////////////////////////////////////////////////////
- // Required commands
- ///////////////////////////////////////////////////////////////
- star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
- -1,
- getCppuVoidType()
- ),
- star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
- -1,
- getCppuVoidType()
- ),
- star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
- -1,
- getCppuType(
- static_cast< uno::Sequence< beans::Property > * >( 0 ) )
- ),
- star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
- -1,
- getCppuType(
- static_cast< uno::Sequence< beans::PropertyValue > * >( 0 ) )
- ),
- ///////////////////////////////////////////////////////////////
- // Optional standard commands
- ///////////////////////////////////////////////////////////////
-/*
- star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
- -1,
- getCppuBooleanType()
- ),
-*/
- star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
- -1,
- getCppuType(
- static_cast< star::ucb::InsertCommandArgument * >( 0 ) )
- ),
- star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
- -1,
- getCppuType( static_cast< star::ucb::OpenCommandArgument2 * >( 0 ) )
- ),
- star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "close" ) ),
- -1,
- getCppuVoidType( )
- ),
- star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
- -1,
- getCppuType( static_cast< star::ucb::TransferInfo * >( 0 ) )
- )
-
- ///////////////////////////////////////////////////////////////
- // New commands
- ///////////////////////////////////////////////////////////////
- };
-
- return uno::Sequence<
- star::ucb::CommandInfo >( aCommandInfoTable, COMMAND_COUNT );
-}
-
diff --git a/ucb/source/ucp/odma/odma_contentprops.hxx b/ucb/source/ucp/odma/odma_contentprops.hxx
deleted file mode 100644
index 22ee1ec9db..0000000000
--- a/ucb/source/ucp/odma/odma_contentprops.hxx
+++ /dev/null
@@ -1,127 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_contentprops.hxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 14:58:32 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the License); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an AS IS basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-#ifndef ODMA_CONTENTPROPS_HXX
-#define ODMA_CONTENTPROPS_HXX
-
-#ifndef _VOS_REFERNCE_HXX_
-#include <vos/refernce.hxx>
-#endif
-#ifndef _VOS_REF_HXX_
-#include <vos/ref.hxx>
-#endif
-#ifndef _RTL_USTRING_HXX_
-#include <rtl/ustring.hxx>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_
-#include <com/sun/star/util/DateTime.hpp>
-#endif
-#include <functional>
-
-namespace odma
-{
- class ContentProperties : public ::vos::OReference
- {
- public:
- com::sun::star::util::DateTime m_aDateCreated; // when was the document created
- com::sun::star::util::DateTime m_aDateModified; // when was the document last modified
- ::rtl::OUString m_sTitle; // Title
- ::rtl::OUString m_sContentType; // ContentType
- ::rtl::OString m_sDocumentId; // the document id given from the DMS
- ::rtl::OUString m_sDocumentName;// document name
- ::rtl::OUString m_sFileURL; // the temporary file location
- ::rtl::OUString m_sAuthor; // the Author of the document
- ::rtl::OUString m_sSubject; // the subject of the document
- ::rtl::OUString m_sKeywords; // the keywords of the document
- ::rtl::OUString m_sSavedAsName; // the name which was used to save it
- sal_Bool m_bIsDocument; // IsDocument
- sal_Bool m_bIsFolder; // IsFolder
- sal_Bool m_bIsOpen; // is true when OpenDoc was called
- sal_Bool m_bIsReadOnly; // true when the document is read-only
-
- // @@@ Add other properties supported by your content.
-
- ContentProperties()
- :m_bIsDocument( sal_True )
- ,m_bIsFolder( sal_False )
- ,m_bIsOpen( sal_False )
- ,m_bIsReadOnly( sal_False )
- {}
-
- inline ::rtl::OUString getTitle() const { return m_sTitle; }
- inline ::rtl::OUString getSavedAsName() const { return m_sSavedAsName; }
- };
- typedef ::std::binary_function< ::vos::ORef<ContentProperties>, ::rtl::OUString,bool> TContentPropertiesFunctorBase;
- /// binary_function Functor object for class ContentProperties return type is bool
- class ContentPropertiesMemberFunctor : public TContentPropertiesFunctorBase
- {
- ::std::const_mem_fun_t< ::rtl::OUString,ContentProperties> m_aFunction;
- public:
- ContentPropertiesMemberFunctor(const ::std::const_mem_fun_t< ::rtl::OUString,ContentProperties>& _rFunc)
- : m_aFunction(_rFunc){}
-
- inline bool operator()(const ::vos::ORef<ContentProperties>& lhs,const ::rtl::OUString& rhs) const
- {
- return !!(m_aFunction(lhs.getBodyPtr()) == rhs);
- }
- };
-}
-#endif // ODMA_CONTENTPROPS_HXX
-
diff --git a/ucb/source/ucp/odma/odma_datasupplier.cxx b/ucb/source/ucp/odma/odma_datasupplier.cxx
deleted file mode 100644
index 47e0a0287b..0000000000
--- a/ucb/source/ucp/odma/odma_datasupplier.cxx
+++ /dev/null
@@ -1,502 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_datasupplier.cxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 14:58:43 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the "License"); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-
-/**************************************************************************
- TODO
- **************************************************************************
-
- *************************************************************************/
-
-#include <vector>
-
-#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
-#include <ucbhelper/contentidentifier.hxx>
-#endif
-#ifndef _UCBHELPER_PROVIDERHELPER_HXX
-#include <ucbhelper/providerhelper.hxx>
-#endif
-
-#ifndef ODMA_DATASUPPLIER_HXX
-#include "odma_datasupplier.hxx"
-#endif
-#ifndef ODMA_CONTENT_HXX
-#include "odma_content.hxx"
-#endif
-#ifndef ODMA_CONTENTPROPS_HXX
-#include "odma_contentprops.hxx"
-#endif
-#ifndef ODMA_PROVIDER_HXX
-#include "odma_provider.hxx"
-#endif
-#ifndef ODMA_LIB_HXX
-#include "odma_lib.hxx"
-#endif
-
-using namespace com::sun::star::beans;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::ucb;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::sdbc;
-using namespace ucb;
-
-using namespace odma;
-
-namespace odma
-{
-
-//=========================================================================
-//
-// struct ResultListEntry.
-//
-//=========================================================================
-
-struct ResultListEntry
-{
- ::rtl::OUString aId;
- Reference< XContentIdentifier > xId;
- Reference< XContent > xContent;
- Reference< XRow > xRow;
- ::vos::ORef<ContentProperties> rData;
-
- ResultListEntry( const ::vos::ORef<ContentProperties>& rEntry ) : rData( rEntry ) {}
-};
-
-//=========================================================================
-//
-// ResultList.
-//
-//=========================================================================
-
-typedef std::vector< ResultListEntry* > ResultList;
-
-//=========================================================================
-//
-// struct DataSupplier_Impl.
-//
-//=========================================================================
-
-struct DataSupplier_Impl
-{
- osl::Mutex m_aMutex;
- ResultList m_aResults;
- vos::ORef< Content > m_xContent;
- Reference< XMultiServiceFactory > m_xSMgr;
-// @@@ The data source and an iterator for it
-// Entry m_aFolder;
-// Entry::iterator m_aIterator;
- sal_Int32 m_nOpenMode;
- sal_Bool m_bCountFinal;
-
- DataSupplier_Impl( const Reference< XMultiServiceFactory >& rxSMgr,
- const vos::ORef< Content >& rContent,
- sal_Int32 nOpenMode )
- : m_xContent( rContent ), m_xSMgr( rxSMgr ),
-// m_aFolder( rxSMgr, rContent->getIdentifier()->getContentIdentifier() ),
- m_nOpenMode( nOpenMode ), m_bCountFinal( sal_False ) {}
- ~DataSupplier_Impl();
-};
-
-//=========================================================================
-DataSupplier_Impl::~DataSupplier_Impl()
-{
- ResultList::const_iterator it = m_aResults.begin();
- ResultList::const_iterator end = m_aResults.end();
-
- while ( it != end )
- {
- delete (*it);
- it++;
- }
-}
-
-}
-
-//=========================================================================
-//=========================================================================
-//
-// DataSupplier Implementation.
-//
-//=========================================================================
-//=========================================================================
-
-DataSupplier::DataSupplier( const Reference<XMultiServiceFactory >& rxSMgr,
- const vos::ORef< ::odma::Content >& rContent,
- sal_Int32 nOpenMode )
-: m_pImpl( new DataSupplier_Impl( rxSMgr, rContent, nOpenMode ) )
-{
-}
-
-//=========================================================================
-// virtual
-DataSupplier::~DataSupplier()
-{
- delete m_pImpl;
-}
-
-//=========================================================================
-// virtual
-::rtl::OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
-{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
-
- if ( nIndex < m_pImpl->m_aResults.size() )
- {
- ::rtl::OUString aId = m_pImpl->m_aResults[ nIndex ]->aId;
- if ( aId.getLength() )
- {
- // Already cached.
- return aId;
- }
- }
-
- if ( getResult( nIndex ) )
- {
- ::rtl::OUString aId
- = m_pImpl->m_xContent->getIdentifier()->getContentIdentifier();
-
- aId += m_pImpl->m_aResults[ nIndex ]->rData->m_sTitle;
-
- m_pImpl->m_aResults[ nIndex ]->aId = aId;
- return aId;
- }
- return ::rtl::OUString();
-}
-
-//=========================================================================
-// virtual
-Reference< XContentIdentifier > DataSupplier::queryContentIdentifier(
- sal_uInt32 nIndex )
-{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
-
- if ( nIndex < m_pImpl->m_aResults.size() )
- {
- Reference< XContentIdentifier > xId
- = m_pImpl->m_aResults[ nIndex ]->xId;
- if ( xId.is() )
- {
- // Already cached.
- return xId;
- }
- }
-
- ::rtl::OUString aId = queryContentIdentifierString( nIndex );
- if ( aId.getLength() )
- {
- Reference< XContentIdentifier > xId = new ucb::ContentIdentifier( aId );
- m_pImpl->m_aResults[ nIndex ]->xId = xId;
- return xId;
- }
- return Reference< XContentIdentifier >();
-}
-
-//=========================================================================
-// virtual
-Reference< XContent > DataSupplier::queryContent( sal_uInt32 nIndex )
-{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
-
- if ( nIndex < m_pImpl->m_aResults.size() )
- {
- Reference< XContent > xContent
- = m_pImpl->m_aResults[ nIndex ]->xContent;
- if ( xContent.is() )
- {
- // Already cached.
- return xContent;
- }
- }
-
- Reference< XContentIdentifier > xId = queryContentIdentifier( nIndex );
- if ( xId.is() )
- {
- try
- {
- Reference< XContent > xContent
- = m_pImpl->m_xContent->getProvider()->queryContent( xId );
- m_pImpl->m_aResults[ nIndex ]->xContent = xContent;
- return xContent;
-
- }
- catch ( IllegalIdentifierException& )
- {
- }
- }
- return Reference< XContent >();
-}
-
-//=========================================================================
-// virtual
-sal_Bool DataSupplier::getResult( sal_uInt32 nIndex )
-{
- osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
-
- if ( m_pImpl->m_aResults.size() > nIndex )
- {
- // Result already present.
- return sal_True;
- }
-
- // Result not (yet) present.
-
- if ( m_pImpl->m_bCountFinal )
- return sal_False;
-
- // Try to obtain result...
-
- sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
- sal_Bool bFound = sal_False;
- sal_uInt32 nPos = nOldCount;
-
- // @@@ Obtain data and put it into result list...
-/*
- while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) )
- {
- m_pImpl->m_aResults.push_back(
- new ResultListEntry( *m_pImpl->m_aIterator ) );
-
- if ( nPos == nIndex )
- {
- // Result obtained.
- bFound = sal_True;
- break;
- }
-
- nPos++;
- }
-*/
- // now query for all documents in the DMS
- OSL_ENSURE(ContentProvider::getHandle(),"No Handle!");
- sal_Char* pQueryId = new sal_Char[ODM_QUERYID_MAX];
- sal_Char* lpszDMSList = new sal_Char[ODM_DMSID_MAX];
-
- ODMSTATUS odm = NODMGetDMS(ODMA_ODMA_REGNAME, lpszDMSList);
- lpszDMSList[strlen(lpszDMSList)+1] = '\0';
-
- ::rtl::OString sQuery("SELECT ODM_DOCID, ODM_NAME");
-
- DWORD dwFlags = ODM_SPECIFIC;
- odm = NODMQueryExecute(ContentProvider::getHandle(), sQuery,dwFlags, lpszDMSList, pQueryId );
- if(odm != ODM_SUCCESS)
- return sal_False;
-
- sal_uInt16 nCount = 10;
- sal_uInt16 nMaxCount = 10;
- sal_Char* lpszDocId = new sal_Char[ODM_DOCID_MAX * nMaxCount];
- sal_Char* lpszDocName = new sal_Char[ODM_NAME_MAX * nMaxCount];
-
-
- ::rtl::OUString sContentType(RTL_CONSTASCII_USTRINGPARAM(ODMA_CONTENT_TYPE));
- sal_uInt32 nCurrentCount = 0;
- do
- {
- if(nCount >= nMaxCount)
- {
- nCount = nMaxCount;
- odm = NODMQueryGetResults(ContentProvider::getHandle(), pQueryId,lpszDocId, lpszDocName, ODM_NAME_MAX, (WORD*)&nCount);
- nCurrentCount += nCount;
- }
- if(odm == ODM_SUCCESS && nIndex < nCurrentCount)
- {
- bFound = sal_True;
- for(sal_uInt16 i = 0; i < nCount; ++i)
- {
- ::vos::ORef<ContentProperties> rProps = new ContentProperties();
- rProps->m_sDocumentId = ::rtl::OString(&lpszDocId[ODM_DOCID_MAX*i]);
- rProps->m_sContentType = sContentType;
- m_pImpl->m_xContent->getContentProvider()->append(rProps);
- m_pImpl->m_aResults.push_back( new ResultListEntry(rProps));
- }
- }
- }
- while(nCount > nMaxCount);
-
-
- // now close the query
- odm = NODMQueryClose(ContentProvider::getHandle(), pQueryId);
-
- delete lpszDMSList;
- delete pQueryId;
- delete lpszDocId;
- delete lpszDocName;
-
- if ( !bFound )
- m_pImpl->m_bCountFinal = sal_True;
-
- vos::ORef< ResultSet > xResultSet = getResultSet();
- if ( xResultSet.isValid() )
- {
- // Callbacks follow!
- aGuard.clear();
-
- if ( nOldCount < m_pImpl->m_aResults.size() )
- xResultSet->rowCountChanged(
- nOldCount, m_pImpl->m_aResults.size() );
-
- if ( m_pImpl->m_bCountFinal )
- xResultSet->rowCountFinal();
- }
-
- return bFound;
-}
-
-//=========================================================================
-// virtual
-sal_uInt32 DataSupplier::totalCount()
-{
- osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
-
- if ( m_pImpl->m_bCountFinal )
- return m_pImpl->m_aResults.size();
-
- sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
-
- // @@@ Obtain data and put it into result list...
-/*
- while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) )
- m_pImpl->m_aResults.push_back(
- new ResultListEntry( *m_pImpl->m_aIterator ) );
-*/
- m_pImpl->m_bCountFinal = sal_True;
-
- vos::ORef< ResultSet > xResultSet = getResultSet();
- if ( xResultSet.isValid() )
- {
- // Callbacks follow!
- aGuard.clear();
-
- if ( nOldCount < m_pImpl->m_aResults.size() )
- xResultSet->rowCountChanged(
- nOldCount, m_pImpl->m_aResults.size() );
-
- xResultSet->rowCountFinal();
- }
-
- return m_pImpl->m_aResults.size();
-}
-
-//=========================================================================
-// virtual
-sal_uInt32 DataSupplier::currentCount()
-{
- return m_pImpl->m_aResults.size();
-}
-
-//=========================================================================
-// virtual
-sal_Bool DataSupplier::isCountFinal()
-{
- return m_pImpl->m_bCountFinal;
-}
-
-//=========================================================================
-// virtual
-Reference< XRow > DataSupplier::queryPropertyValues( sal_uInt32 nIndex )
-{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
-
- if ( nIndex < m_pImpl->m_aResults.size() )
- {
- Reference< XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xRow;
- if ( xRow.is() )
- {
- // Already cached.
- return xRow;
- }
- }
-
- if ( getResult( nIndex ) )
- {
- Reference< XRow > xRow = Content::getPropertyValues(
- m_pImpl->m_xSMgr,
- getResultSet()->getProperties(),
- m_pImpl->m_aResults[ nIndex ]->rData,
- m_pImpl->m_xContent->getProvider(),
- queryContentIdentifierString( nIndex ) );
- m_pImpl->m_aResults[ nIndex ]->xRow = xRow;
- return xRow;
- }
-
- return Reference< XRow >();
-}
-
-//=========================================================================
-// virtual
-void DataSupplier::releasePropertyValues( sal_uInt32 nIndex )
-{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
-
- if ( nIndex < m_pImpl->m_aResults.size() )
- m_pImpl->m_aResults[ nIndex ]->xRow = Reference< XRow >();
-}
-
-//=========================================================================
-// virtual
-void DataSupplier::close()
-{
-}
-
-//=========================================================================
-// virtual
-void DataSupplier::validate()
- throw( ResultSetException )
-{
-}
diff --git a/ucb/source/ucp/odma/odma_datasupplier.hxx b/ucb/source/ucp/odma/odma_datasupplier.hxx
deleted file mode 100644
index 8a8f9feb02..0000000000
--- a/ucb/source/ucp/odma/odma_datasupplier.hxx
+++ /dev/null
@@ -1,110 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_datasupplier.hxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 14:58:55 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the "License"); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-
-#ifndef ODMA_DATASUPPLIER_HXX
-#define ODMA_DATASUPPLIER_HXX
-
-#ifndef _UCBHELPER_RESULTSET_HXX
-#include <ucbhelper/resultset.hxx>
-#endif
-
-namespace odma {
-
-struct DataSupplier_Impl;
-class Content;
-
-class DataSupplier : public ucb::ResultSetDataSupplier
-{
- DataSupplier_Impl* m_pImpl;
-
-public:
- DataSupplier( const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
- const vos::ORef< Content >& rContent,
- sal_Int32 nOpenMode );
- virtual ~DataSupplier();
-
- virtual rtl::OUString queryContentIdentifierString( sal_uInt32 nIndex );
- virtual com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentIdentifier >
- queryContentIdentifier( sal_uInt32 nIndex );
- virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
- queryContent( sal_uInt32 nIndex );
-
- virtual sal_Bool getResult( sal_uInt32 nIndex );
-
- virtual sal_uInt32 totalCount();
- virtual sal_uInt32 currentCount();
- virtual sal_Bool isCountFinal();
-
- virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
- queryPropertyValues( sal_uInt32 nIndex );
- virtual void releasePropertyValues( sal_uInt32 nIndex );
-
- virtual void close();
-
- virtual void validate()
- throw( com::sun::star::ucb::ResultSetException );
-};
-
-}
-
-#endif
diff --git a/ucb/source/ucp/odma/odma_inputstream.cxx b/ucb/source/ucp/odma/odma_inputstream.cxx
deleted file mode 100644
index bf9a59a298..0000000000
--- a/ucb/source/ucp/odma/odma_inputstream.cxx
+++ /dev/null
@@ -1,336 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_inputstream.cxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 14:59:03 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the License); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an AS IS basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-
-#ifndef ODMA_INPUTSTREAM_HXX
-#include "odma_inputstream.hxx"
-#endif
-#ifndef _COM_SUN_STAR_IO_IOEXCEPTION_HPP_
-#include "com/sun/star/io/IOException.hpp"
-#endif
-#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
-#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_OPENMODE_HPP_
-#include <com/sun/star/ucb/OpenMode.hpp>
-#endif
-#ifndef _UCBHELPER_CONTENT_HXX
-#include <ucbhelper/content.hxx>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATASTREAMER_HPP_
-#include <com/sun/star/io/XActiveDataStreamer.hpp>
-#endif
-#ifndef _CPPUHELPER_IMPLBASE1_HXX_
-#include <cppuhelper/implbase1.hxx>
-#endif
-#ifndef ODMA_CONTENTPROPS_HXX
-#include "odma_contentprops.hxx"
-#endif
-#ifndef ODMA_PROVIDER_HXX
-#include "odma_provider.hxx"
-#endif
-
-using namespace odma;
-using namespace com::sun::star;
-
-class OActiveDataStreamer : public ::cppu::WeakImplHelper1< ::com::sun::star::io::XActiveDataStreamer>
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream;
-public:
- OActiveDataStreamer(){}
- virtual void SAL_CALL setStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& _rStream ) throw (::com::sun::star::uno::RuntimeException)
- {
- m_xStream = _rStream;
- }
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL getStream( ) throw (::com::sun::star::uno::RuntimeException)
- {
- return m_xStream;
- }
-};
-// -----------------------------------------------------------------------------
-OOdmaStream::OOdmaStream(::ucb::Content* _pContent,
- ContentProvider* _pProvider,
- const ::vos::ORef<ContentProperties>& _rProp)
- :m_pContent(_pContent)
- ,m_bInputStreamCalled(sal_False)
- ,m_bOutputStreamCalled(sal_False)
- ,m_bModified(sal_False)
- ,m_pProvider(_pProvider)
- ,m_aProp(_rProp)
-{
-}
-// -----------------------------------------------------------------------------
-OOdmaStream::~OOdmaStream()
-{
- try
- {
- closeStream();
- delete m_pContent;
- }
- catch (io::IOException const &)
- {
- OSL_ENSURE(false, "unexpected situation");
- }
- catch (uno::RuntimeException const &)
- {
- OSL_ENSURE(false, "unexpected situation");
- }
-}
-// -----------------------------------------------------------------------------
-uno::Reference< io::XInputStream > SAL_CALL OOdmaStream::getInputStream( ) throw( uno::RuntimeException)
-{
- {
- osl::MutexGuard aGuard( m_aMutex );
- m_bInputStreamCalled = sal_True;
- }
- return uno::Reference< io::XInputStream >( this );
-}
-// -----------------------------------------------------------------------------
-uno::Reference< io::XOutputStream > SAL_CALL OOdmaStream::getOutputStream( ) throw( uno::RuntimeException )
-{
- {
- osl::MutexGuard aGuard( m_aMutex );
- m_bOutputStreamCalled = sal_True;
- }
- return uno::Reference< io::XOutputStream >( this );
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OOdmaStream::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
- throw( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException)
-{
- ensureInputStream();
-
- return m_xInput->readBytes(aData,nBytesToRead);
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OOdmaStream::readSomeBytes( uno::Sequence< sal_Int8 >& aData,sal_Int32 nMaxBytesToRead )
- throw( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException)
-{
- return readBytes( aData,nMaxBytesToRead );
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OOdmaStream::skipBytes( sal_Int32 nBytesToSkip )
- throw( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException )
-{
- ensureInputStream();
- m_xInput->skipBytes(nBytesToSkip );
-}
-// -----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OOdmaStream::available()
- throw( io::NotConnectedException,
- io::IOException,
- uno::RuntimeException)
-{
- ensureInputStream();
- return m_xInput->available();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OOdmaStream::writeBytes( const uno::Sequence< sal_Int8 >& aData )
- throw( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException)
-{
- ensureOutputStream();
- m_xOutput->writeBytes(aData);
- m_bModified = sal_True;
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OOdmaStream::closeStream() throw( io::NotConnectedException,io::IOException,uno::RuntimeException )
-{
- if( m_xInput.is() )
- {
- m_xInput->closeInput();
- m_xInput = NULL;
- m_xInputSeek = NULL;
- }
- if(m_xOutput.is())
- {
- m_xOutput->closeOutput();
- m_xOutput = NULL;
- m_xTruncate = NULL;
- if(m_bModified)
- m_pProvider->saveDocument(m_aProp->m_sDocumentId);
- }
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OOdmaStream::closeInput()
- throw( io::NotConnectedException,
- io::IOException,
- uno::RuntimeException )
-{
- osl::MutexGuard aGuard( m_aMutex );
- m_bInputStreamCalled = sal_False;
-
- if( ! m_bOutputStreamCalled )
- closeStream();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OOdmaStream::closeOutput()
- throw( io::NotConnectedException,
- io::IOException,
- uno::RuntimeException )
-{
- osl::MutexGuard aGuard( m_aMutex );
- m_bOutputStreamCalled = sal_False;
-
- if( ! m_bInputStreamCalled )
- closeStream();
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OOdmaStream::flush()
- throw( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException )
-{
- ensureOutputStream();
- m_xOutput->flush();
-}
-// -----------------------------------------------------------------------------
-void OOdmaStream::ensureInputStream() throw( io::IOException )
-{
- try
- {
- if(!m_xInput.is())
- {
- m_xInput = m_pContent->openStream();
- m_xInputSeek = uno::Reference< io::XSeekable>(m_xInput,uno::UNO_QUERY);
- }
- }
- catch(const uno::Exception&)
- {
- }
- if(!m_xInput.is())
- throw io::IOException();
-}
-// -----------------------------------------------------------------------------
-void OOdmaStream::ensureOutputStream() throw( io::IOException )
-{
- try
- {
- if(!m_xOutput.is())
- {
- ::com::sun::star::ucb::OpenCommandArgument2 aCommand;
- aCommand.Mode = ::com::sun::star::ucb::OpenMode::DOCUMENT;
- uno::Reference< io::XActiveDataStreamer > xActiveStreamer = new OActiveDataStreamer();
- aCommand.Sink = xActiveStreamer;
- m_pContent->executeCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("open")),uno::makeAny(aCommand));
- if(xActiveStreamer.is())
- {
- uno::Reference< io::XStream> xStream = xActiveStreamer->getStream();
- if(xStream.is())
- m_xOutput = xStream->getOutputStream();
- }
- }
- }
- catch(const uno::Exception&)
- {
- }
- if(!m_xOutput.is())
- throw io::IOException();
- m_xTruncate = uno::Reference< io::XTruncate>(m_xOutput,uno::UNO_QUERY);
-}
-// -----------------------------------------------------------------------------
-// XTruncate
-void SAL_CALL OOdmaStream::truncate( void )
- throw( com::sun::star::io::IOException,
- com::sun::star::uno::RuntimeException )
-{
- if(m_xTruncate.is())
- m_xTruncate->truncate();
-}
-// -----------------------------------------------------------------------------
-// XSeekable
-void SAL_CALL OOdmaStream::seek(sal_Int64 location )
- throw( com::sun::star::lang::IllegalArgumentException,
- com::sun::star::io::IOException,
- com::sun::star::uno::RuntimeException )
-{
- ensureInputStream();
- if(m_xInputSeek.is())
- m_xInputSeek->seek(location);
-}
-// -----------------------------------------------------------------------------
-sal_Int64 SAL_CALL OOdmaStream::getPosition()
- throw( com::sun::star::io::IOException,
- com::sun::star::uno::RuntimeException )
-{
- ensureInputStream();
- return m_xInputSeek.is() ? m_xInputSeek->getPosition() : sal_Int64(0);
-}
-// -----------------------------------------------------------------------------
-sal_Int64 SAL_CALL OOdmaStream::getLength()
- throw( com::sun::star::io::IOException,
- com::sun::star::uno::RuntimeException )
-{
- ensureInputStream();
- return m_xInputSeek.is() ? m_xInputSeek->getLength() : sal_Int64(0);
-}
-// ----------------------------------------------------------------------------- \ No newline at end of file
diff --git a/ucb/source/ucp/odma/odma_inputstream.hxx b/ucb/source/ucp/odma/odma_inputstream.hxx
deleted file mode 100644
index c90a79c07e..0000000000
--- a/ucb/source/ucp/odma/odma_inputstream.hxx
+++ /dev/null
@@ -1,187 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_inputstream.hxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 14:59:14 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the License); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an AS IS basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-
-#ifndef ODMA_INPUTSTREAM_HXX
-#define ODMA_INPUTSTREAM_HXX
-
-#ifndef _OSL_MUTEX_HXX_
-#include <osl/mutex.hxx>
-#endif
-#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
-#include <com/sun/star/io/XInputStream.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XSTREAM_HPP_
-#include <com/sun/star/io/XStream.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
-#include <com/sun/star/io/XOutputStream.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XTRUNCATE_HPP_
-#include <com/sun/star/io/XTruncate.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XSEEKABLE_HPP_
-#include <com/sun/star/io/XSeekable.hpp>
-#endif
-#ifndef _CPPUHELPER_IMPLBASE5_HXX_
-#include <cppuhelper/implbase5.hxx>
-#endif
-#ifndef _VOS_REF_HXX_
-#include <vos/ref.hxx>
-#endif
-
-namespace ucb
-{
- class Content;
-}
-namespace odma
-{
- typedef ::cppu::WeakImplHelper5< ::com::sun::star::io::XInputStream,
- ::com::sun::star::io::XStream,
- ::com::sun::star::io::XTruncate,
- ::com::sun::star::io::XSeekable,
- ::com::sun::star::io::XOutputStream> OOdmaStreamBase;
-
- class ContentProvider;
- class ContentProperties;
- class OOdmaStream : public OOdmaStreamBase
- {
- ::osl::Mutex m_aMutex;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream> m_xOutput;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XTruncate> m_xTruncate;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> m_xInput;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable> m_xInputSeek;
-
- ::vos::ORef<ContentProperties> m_aProp;
- ::ucb::Content* m_pContent;
- ContentProvider* m_pProvider;
- sal_Bool m_bInputStreamCalled;
- sal_Bool m_bOutputStreamCalled;
- sal_Bool m_bModified;
-
- void ensureInputStream() throw( ::com::sun::star::io::IOException );
- void ensureOutputStream() throw( ::com::sun::star::io::IOException );
- void SAL_CALL closeStream() throw( ::com::sun::star::io::NotConnectedException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::RuntimeException );
- public:
- OOdmaStream(::ucb::Content* _pContent,
- ContentProvider* _pProvider,
- const ::vos::ORef<ContentProperties>& _rProp);
- virtual ~OOdmaStream();
- // com::sun::star::io::XInputStream
- virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence<sal_Int8>& aData, sal_Int32 nBytesToRead )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
- ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence<sal_Int8>& aData, sal_Int32 nMaxBytesToRead )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
- ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
- ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- virtual sal_Int32 SAL_CALL available( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL closeInput( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- // com::sun::star::io::XStream
- virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw( com::sun::star::uno::RuntimeException );
- virtual com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw( com::sun::star::uno::RuntimeException );
-
- // com::sun::star::io::XOutputStream
- void SAL_CALL writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& aData )
- throw( com::sun::star::io::NotConnectedException,
- com::sun::star::io::BufferSizeExceededException,
- com::sun::star::io::IOException,
- com::sun::star::uno::RuntimeException);
-
- void SAL_CALL flush()
- throw( com::sun::star::io::NotConnectedException,
- com::sun::star::io::BufferSizeExceededException,
- com::sun::star::io::IOException,
- com::sun::star::uno::RuntimeException);
- void SAL_CALL closeOutput()
- throw( com::sun::star::io::NotConnectedException,
- com::sun::star::io::IOException,
- com::sun::star::uno::RuntimeException );
- // XTruncate
- virtual void SAL_CALL truncate( void )
- throw( com::sun::star::io::IOException,
- com::sun::star::uno::RuntimeException );
- // XSeekable
- void SAL_CALL seek(sal_Int64 location )
- throw( com::sun::star::lang::IllegalArgumentException,
- com::sun::star::io::IOException,
- com::sun::star::uno::RuntimeException );
-
- sal_Int64 SAL_CALL getPosition()
- throw( com::sun::star::io::IOException,
- com::sun::star::uno::RuntimeException );
-
- sal_Int64 SAL_CALL getLength()
- throw( com::sun::star::io::IOException,
- com::sun::star::uno::RuntimeException );
- };
-}
-#endif // ODMA_INPUTSTREAM_HXX
diff --git a/ucb/source/ucp/odma/odma_lib.cxx b/ucb/source/ucp/odma/odma_lib.cxx
deleted file mode 100644
index c0328e483d..0000000000
--- a/ucb/source/ucp/odma/odma_lib.cxx
+++ /dev/null
@@ -1,170 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_lib.cxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 14:59:26 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the License); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an AS IS basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-//#ifndef _OSL_PROCESS_H_
-//#include <osl/process.h>
-//#endif
-#ifndef _OSL_MODULE_H_
-#include <osl/module.h>
-#endif
-#ifndef _RTL_USTRING_HXX_
-#include <rtl/ustring.hxx>
-#endif
-#ifndef ODMA_LIB_HXX
-#include "odma_lib.hxx"
-#endif
-
-
-namespace odma
-{
-
- TODMRegisterApp pODMRegisterApp;
- TODMUnRegisterApp pODMUnRegisterApp;
- TODMSelectDoc pODMSelectDoc;
- TODMOpenDoc pODMOpenDoc;
- TODMSaveDoc pODMSaveDoc;
- TODMCloseDoc pODMCloseDoc;
- TODMNewDoc pODMNewDoc;
- TODMSaveAs pODMSaveAs;
- TODMActivate pODMActivate;
- TODMGetDocInfo pODMGetDocInfo;
- TODMSetDocInfo pODMSetDocInfo;
- TODMGetDMSInfo pODMGetDMSInfo;
- TODMGetDMSCount pODMGetDMSCount;
- TODMGetDMSList pODMGetDMSList;
- TODMGetDMS pODMGetDMS;
- TODMSetDMS pODMSetDMS;
- TODMQueryExecute pODMQueryExecute;
- TODMQueryGetResults pODMQueryGetResults;
- TODMQueryClose pODMQueryClose;
- TODMCloseDocEx pODMCloseDocEx;
- TODMSaveAsEx pODMSaveAsEx;
- TODMSaveDocEx pODMSaveDocEx;
- TODMSelectDocEx pODMSelectDocEx;
- TODMQueryCapability pODMQueryCapability;
- TODMSetDocEvent pODMSetDocEvent;
- TODMGetAlternateContent pODMGetAlternateContent;
- TODMSetAlternateContent pODMSetAlternateContent;
- TODMGetDocRelation pODMGetDocRelation;
- TODMSetDocRelation pODMSetDocRelation;
-
- sal_Bool LoadFunctions(oslModule _pODMA);
-
- sal_Bool LoadLibrary()
- {
- static sal_Bool bLoaded = sal_False;
- static oslModule pODMA = NULL;
-
- if (bLoaded)
- return sal_True;
- ::rtl::OUString sPath;
- #ifdef WIN
- sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA.DLL"));
-
- #endif
- #ifdef WNT
- sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA32.DLL"));
- #endif
- #ifdef UNX
- sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libodma.so"));
- #endif
-
- pODMA = osl_loadModule( sPath.pData,SAL_LOADMODULE_NOW );
- if( !pODMA)
- return sal_False;
-
- return bLoaded = LoadFunctions(pODMA);
- }
- // -------------------------------------------------------------------------
-
- sal_Bool LoadFunctions(oslModule pODMA)
- {
- if ( ( pODMRegisterApp = (TODMRegisterApp)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMRegisterApp")).pData)) == NULL ) return sal_False;
- if ( ( pODMUnRegisterApp = (TODMUnRegisterApp)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMUnRegisterApp")).pData)) == NULL ) return sal_False;
- if ( ( pODMSelectDoc = (TODMSelectDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSelectDoc")).pData)) == NULL ) return sal_False;
- if ( ( pODMOpenDoc = (TODMOpenDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMOpenDoc")).pData)) == NULL ) return sal_False;
- if ( ( pODMSaveDoc = (TODMSaveDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveDoc")).pData)) == NULL ) return sal_False;
- if ( ( pODMCloseDoc = (TODMCloseDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMCloseDoc")).pData)) == NULL ) return sal_False;
- if ( ( pODMNewDoc = (TODMNewDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMNewDoc")).pData)) == NULL ) return sal_False;
- if ( ( pODMSaveAs = (TODMSaveAs)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveAs")).pData)) == NULL ) return sal_False;
- if ( ( pODMActivate = (TODMActivate)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMActivate")).pData)) == NULL ) return sal_False;
- if ( ( pODMGetDocInfo = (TODMGetDocInfo)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDocInfo")).pData)) == NULL ) return sal_False;
- if ( ( pODMSetDocInfo = (TODMSetDocInfo)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDocInfo")).pData)) == NULL ) return sal_False;
- if ( ( pODMGetDMSInfo = (TODMGetDMSInfo)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMSInfo")).pData)) == NULL ) return sal_False;
- if ( ( pODMGetDMSCount = (TODMGetDMSCount)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMSCount")).pData)) == NULL ) return sal_False;
- if ( ( pODMGetDMSList = (TODMGetDMSList)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMSList")).pData)) == NULL ) return sal_False;
- if ( ( pODMGetDMS = (TODMGetDMS)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMS")).pData)) == NULL ) return sal_False;
- if ( ( pODMSetDMS = (TODMSetDMS)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDMS")).pData)) == NULL ) return sal_False;
- if ( ( pODMQueryExecute = (TODMQueryExecute)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryExecute")).pData)) == NULL ) return sal_False;
- if ( ( pODMQueryGetResults = (TODMQueryGetResults)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryGetResults")).pData)) == NULL ) return sal_False;
- if ( ( pODMQueryClose = (TODMQueryClose)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryClose")).pData)) == NULL ) return sal_False;
- if ( ( pODMCloseDocEx = (TODMCloseDocEx)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMCloseDocEx")).pData)) == NULL ) return sal_False;
- if ( ( pODMSaveAsEx = (TODMSaveAsEx)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveAsEx")).pData)) == NULL ) return sal_False;
- if ( ( pODMSaveDocEx = (TODMSaveDocEx)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveDocEx")).pData)) == NULL ) return sal_False;
- if ( ( pODMSelectDocEx = (TODMSelectDocEx)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSelectDocEx")).pData)) == NULL ) return sal_False;
- if ( ( pODMQueryCapability = (TODMQueryCapability)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryCapability")).pData)) == NULL ) return sal_False;
- if ( ( pODMSetDocEvent = (TODMSetDocEvent)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDocEvent")).pData)) == NULL ) return sal_False;
- if ( ( pODMGetAlternateContent = (TODMGetAlternateContent)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetAlternateContent")).pData)) == NULL ) return sal_False;
- if ( ( pODMSetAlternateContent = (TODMSetAlternateContent)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetAlternateContent")).pData)) == NULL ) return sal_False;
- if ( ( pODMGetDocRelation = (TODMGetDocRelation)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDocRelation")).pData)) == NULL ) return sal_False;
- if ( ( pODMSetDocRelation = (TODMSetDocRelation)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDocRelation")).pData)) == NULL ) return sal_False;
- return sal_True;
- }
-}
diff --git a/ucb/source/ucp/odma/odma_lib.hxx b/ucb/source/ucp/odma/odma_lib.hxx
deleted file mode 100644
index 94c227bddd..0000000000
--- a/ucb/source/ucp/odma/odma_lib.hxx
+++ /dev/null
@@ -1,308 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_lib.hxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 14:59:35 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the License); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an AS IS basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-#ifndef ODMA_LIB_HXX
-#define ODMA_LIB_HXX
-
-typedef void *LPVOID;
-typedef char *LPSTR,
- *PSTR;
-typedef const char *LPCSTR;
-typedef unsigned long DWORD;
-typedef unsigned short WORD;
-typedef unsigned short *LPWORD;
-typedef DWORD *LPDWORD;
-
-#define WINAPI __stdcall
-#define FAR
-
-#ifndef ODMA_H
-#include "odma.h"
-#endif
-
-namespace odma
-{
- typedef ODMSTATUS (WINAPI *TODMRegisterApp) ( ODMHANDLE FAR *pOdmHandle,
- WORD version,
- LPSTR lpszAppId,
- DWORD dwEnvData,
- LPVOID pReserved);
-
- typedef void (WINAPI *TODMUnRegisterApp)(ODMHANDLE odmHandle);
-
-
- typedef ODMSTATUS (WINAPI *TODMSelectDoc)( ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- LPDWORD pdwFlags);
-
-
- typedef ODMSTATUS (WINAPI *TODMOpenDoc)( ODMHANDLE odmHandle,
- DWORD flags,
- LPSTR lpszDocId,
- LPSTR lpszDocLocation);
-
- typedef ODMSTATUS (WINAPI *TODMSaveDoc)( ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- LPSTR lpszNewDocId);
-
- typedef ODMSTATUS (WINAPI *TODMCloseDoc)( ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- DWORD activeTime,
- DWORD pagesPrinted,
- LPVOID sessionData,
- WORD dataLen);
-
- typedef ODMSTATUS (WINAPI *TODMNewDoc)( ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- DWORD dwFlags,
- LPSTR lpszFormat,
- LPSTR lpszDocLocation);
-
- typedef ODMSTATUS (WINAPI *TODMSaveAs)( ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- LPSTR lpszNewDocId,
- LPSTR lpszFormat,
- ODMSAVEASCALLBACK pcbCallBack,
- LPVOID pInstanceData);
-
- typedef ODMSTATUS (WINAPI *TODMActivate)( ODMHANDLE odmHandle,
- WORD action,
- LPSTR lpszDocId);
-
- typedef ODMSTATUS (WINAPI *TODMGetDocInfo)( ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- WORD item,
- LPSTR lpszData,
- WORD dataLen);
-
- typedef ODMSTATUS (WINAPI *TODMSetDocInfo)( ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- WORD item,
- LPSTR lpszData);
-
- typedef ODMSTATUS (WINAPI *TODMGetDMSInfo)( ODMHANDLE odmHandle,
- LPSTR lpszDmsId,
- LPWORD pwVerNo,
- LPDWORD pdwExtensions);
-
- /* Query Enhancements */
- typedef WORD (WINAPI *TODMGetDMSCount)();
-
- typedef WORD (WINAPI *TODMGetDMSList)( LPSTR buffer,
- WORD buffer_size );
-
- typedef ODMSTATUS (WINAPI *TODMGetDMS)( LPCSTR lpszAppId,
- LPSTR lpszDMSId );
-
- typedef ODMSTATUS (WINAPI *TODMSetDMS)( LPCSTR lpszAppId,
- LPCSTR lpszDMSId );
-
- typedef ODMSTATUS (WINAPI *TODMQueryExecute)( ODMHANDLE odmHandle,
- LPCSTR lpszQuery,
- DWORD flags,
- LPCSTR lpszDMSList,
- LPSTR queryId );
-
- typedef ODMSTATUS (WINAPI *TODMQueryGetResults)(ODMHANDLE odmHandle,
- LPCSTR queryId,
- LPSTR lpszDocId,
- LPSTR lpszDocName,
- WORD docNameLen,
- WORD *docCount );
-
- typedef ODMSTATUS (WINAPI *TODMQueryClose)( ODMHANDLE odmHandle,
- LPCSTR queryId );
-
- /* ODMA 2.0 Enhancements */
- typedef ODMSTATUS (WINAPI *TODMCloseDocEx)( ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- LPDWORD pdwFlags,
- DWORD activeTime,
- DWORD pagesPrinted,
- LPVOID sessionData,
- WORD dataLen);
-
- typedef ODMSTATUS (WINAPI *TODMSaveAsEx)( ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- LPSTR lpszNewDocId,
- LPSTR lpszFormat,
- ODMSAVEASCALLBACK pcbCallBack,
- LPVOID pInstanceData,
- LPDWORD pdwFlags);
-
- typedef ODMSTATUS (WINAPI *TODMSaveDocEx)( ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- LPSTR lpszNewDocId,
- LPDWORD pdwFlags);
-
- typedef ODMSTATUS (WINAPI *TODMSelectDocEx)( ODMHANDLE odmHandle,
- LPSTR lpszDocIds,
- LPWORD pwDocIdsLen,
- LPWORD pwDocCount,
- LPDWORD pdwFlags,
- LPSTR lpszFormatFilter);
-
- typedef ODMSTATUS (WINAPI *TODMQueryCapability)(ODMHANDLE odmHandle,
- LPCSTR lpszDmsId,
- DWORD function,
- DWORD item,
- DWORD flags);
-
- typedef ODMSTATUS (WINAPI *TODMSetDocEvent)( ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- DWORD flags,
- DWORD event,
- LPVOID lpData,
- DWORD dwDataLen,
- LPSTR lpszComment);
-
- typedef ODMSTATUS (WINAPI *TODMGetAlternateContent)(ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- LPDWORD pdwFlags,
- LPSTR lpszFormat,
- LPSTR lpszDocLocation);
-
- typedef ODMSTATUS (WINAPI *TODMSetAlternateContent)(ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- LPDWORD pdwFlags,
- LPSTR lpszFormat,
- LPSTR lpszDocLocation);
-
- typedef ODMSTATUS (WINAPI *TODMGetDocRelation)( ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- LPDWORD pdwFlags,
- LPSTR lpszLinkedId,
- LPSTR lpszFormat,
- LPSTR lpszPreviousId);
-
- typedef ODMSTATUS (WINAPI *TODMSetDocRelation)( ODMHANDLE odmHandle,
- LPSTR lpszDocId,
- LPDWORD pdwFlags,
- LPSTR lpszLinkedId,
- LPSTR lpszFormat,
- LPSTR lpszPreviousId);
-
- // now we define some macros
-
- #define NODMRegisterApp(a,b,c,d,e) (*(pODMRegisterApp))(a,b,c,d,e)
- #define NODMUnRegisterApp(a) (*(pODMUnRegisterApp))(a)
- #define NODMSelectDoc(a,b,c) (*(pODMSelectDoc))(a,b,c)
- #define NODMOpenDoc(a,b,c,d) (*(pODMOpenDoc))(a,b,c,d)
- #define NODMSaveDoc(a,b,c) (*(pODMSaveDoc))(a,b,c)
- #define NODMCloseDoc(a,b,c,d,e,f) (*(pODMCloseDoc))(a,b,c,d,e,f)
- #define NODMNewDoc(a,b,c,d,e) (*(pODMNewDoc))(a,b,c,d,e)
- #define NODMSaveAs(a,b,c,d,e,f) (*(pODMSaveAs))(a,b,c,d,e,f)
- #define NODMActivate(a,b,c) (*(pODMActivate))(a,b,c)
- #define NODMGetDocInfo(a,b,c,d,e) (*(pODMGetDocInfo))(a,b,c,d,e)
- #define NODMSetDocInfo(a,b,c,d) (*(pODMSetDocInfo))(a,b,c,d)
- #define NODMGetDMSInfo(a,b,c,d) (*(pODMGetDMSInfo))(a,b,c,d)
- #define NODMGetDMSCount() (*(pODMGetDMSCount))()
- #define NODMGetDMSList(a,b) (*(pODMGetDMSList))(a,b)
- #define NODMGetDMS(a,b) (*(pODMGetDMS))(a,b)
- #define NODMSetDMS(a,b) (*(pODMSetDMS))(a,b)
- #define NODMQueryExecute(a,b,c,d,e) (*(pODMQueryExecute))(a,b,c,d,e)
- #define NODMQueryGetResults(a,b,c,d,e,f) (*(pODMQueryGetResults))(a,b,c,d,e,f)
- #define NODMQueryClose(a,b) (*(pODMQueryClose))(a,b)
- #define NODMCloseDocEx(a,b,c,d,e,f,g) (*(pODMCloseDocEx))(a,b,c,d,e,f,g)
- #define NODMSaveAsEx(a,b,c,d,e,f,g) (*(pODMSaveAsEx))(a,b,c,d,e,f,g)
- #define NODMSaveDocEx(a,b,c,d) (*(pODMSaveDocEx))(a,b,c,d)
- #define NODMSelectDocEx(a,b,c,d,e,f) (*(pODMSelectDocEx))(a,b,c,d,e,f)
- #define NODMQueryCapability(a,b,c,d,e) (*(pODMQueryCapability))(a,b,c,d,e)
- #define NODMSetDocEvent(a,b,c,d,e,f,g) (*(pODMSetDocEvent))(a,b,c,d,e,f,g)
- #define NODMGetAlternateContent(a,b,c,d,e) (*(pODMGetAlternateContent))(a,b,c,d,e)
- #define NODMSetAlternateContent(a,b,c,d,e) (*(pODMSetAlternateContent))(a,b,c,d,e)
- #define NODMGetDocRelation(a,b,c,d,e,f) (*(pODMGetDocRelation))(a,b,c,d,e,f)
- #define NODMSetDocRelation(a,b,c,d,e,f) (*(pODMSetDocRelation))(a,b,c,d,e,f)
-
- sal_Bool LoadLibrary();
-
- extern TODMRegisterApp pODMRegisterApp;
- extern TODMUnRegisterApp pODMUnRegisterApp;
- extern TODMSelectDoc pODMSelectDoc;
- extern TODMOpenDoc pODMOpenDoc;
- extern TODMSaveDoc pODMSaveDoc;
- extern TODMCloseDoc pODMCloseDoc;
- extern TODMNewDoc pODMNewDoc;
- extern TODMSaveAs pODMSaveAs;
- extern TODMActivate pODMActivate;
- extern TODMGetDocInfo pODMGetDocInfo;
- extern TODMSetDocInfo pODMSetDocInfo;
- extern TODMGetDMSInfo pODMGetDMSInfo;
- extern TODMGetDMSCount pODMGetDMSCount;
- extern TODMGetDMSList pODMGetDMSList;
- extern TODMGetDMS pODMGetDMS;
- extern TODMSetDMS pODMSetDMS;
- extern TODMQueryExecute pODMQueryExecute;
- extern TODMQueryGetResults pODMQueryGetResults;
- extern TODMQueryClose pODMQueryClose;
- extern TODMCloseDocEx pODMCloseDocEx;
- extern TODMSaveAsEx pODMSaveAsEx;
- extern TODMSaveDocEx pODMSaveDocEx;
- extern TODMSelectDocEx pODMSelectDocEx;
- extern TODMQueryCapability pODMQueryCapability;
- extern TODMSetDocEvent pODMSetDocEvent;
- extern TODMGetAlternateContent pODMGetAlternateContent;
- extern TODMSetAlternateContent pODMSetAlternateContent;
- extern TODMGetDocRelation pODMGetDocRelation;
- extern TODMSetDocRelation pODMSetDocRelation;
-
-}
-
-#endif // ODMA_LIB_HXX
diff --git a/ucb/source/ucp/odma/odma_main.cxx b/ucb/source/ucp/odma/odma_main.cxx
deleted file mode 100644
index 6f0b46ca4e..0000000000
--- a/ucb/source/ucp/odma/odma_main.cxx
+++ /dev/null
@@ -1,110 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_main.cxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 14:59:44 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the "License"); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-#ifndef _VOS_PROCESS_HXX_
-#include <vos/process.hxx>
-#endif
-#ifndef _OSL_PROCESS_H_
-#include <osl/process.h>
-#endif
-#ifndef ODMA_PROVIDER_HXX
-#include "odma_provider.hxx"
-#endif
-
-#ifdef WNT
-#define SOFFICE "soffice.exe"
-#else
-#define SOFFICE "soffice"
-#endif
-
-using namespace vos;
-
-/** our main program to convert ODMAIDs to URLs
-*/
-
-#if (defined UNX) || (defined OS2)
-void main( int argc, char * argv[] )
-#else
-void _cdecl main( int argc, char * argv[] )
-#endif
-{
- static ::rtl::OUString sProcess(RTL_CONSTASCII_USTRINGPARAM(SOFFICE));
- if(argc > 1) // only chang when argument is docid
- {
- ::rtl::OUString* pArguments = new ::rtl::OUString[argc-1];
- for(int i = 1; i < argc;++i)
- {
- pArguments[i] = ::rtl::OUString::createFromAscii(argv[1]);
- if( pArguments[i].matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(ODMA_URL_ODMAID)))
- {
- ::rtl::OUString sArgument = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODMA_URL_SCHEME ODMA_URL_SHORT "/"));
- sArgument += pArguments[i];
- pArguments[i] = sArgument;
- }
- }
- {
- OArgumentList aList(pArguments,argc-1);
- OProcess aProcess( sProcess );
- aProcess.execute(OProcess::TOption_Detached,aList);
- }
- delete [] pArguments;
- }
-}
-
diff --git a/ucb/source/ucp/odma/odma_provider.cxx b/ucb/source/ucp/odma/odma_provider.cxx
deleted file mode 100644
index c8b332d663..0000000000
--- a/ucb/source/ucp/odma/odma_provider.cxx
+++ /dev/null
@@ -1,651 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_provider.cxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 14:59:52 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the "License"); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-
-/**************************************************************************
- TODO
- **************************************************************************
-
- *************************************************************************/
-
-#ifndef _VOS_DIAGNOSE_HXX_
-#include <vos/diagnose.hxx>
-#endif
-#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
-#include <ucbhelper/contentidentifier.hxx>
-#endif
-#ifndef ODMA_PROVIDER_HXX
-#include "odma_provider.hxx"
-#endif
-#ifndef ODMA_CONTENT_HXX
-#include "odma_content.hxx"
-#endif
-#ifndef ODMA_CONTENTPROPS_HXX
-#include "odma_contentprops.hxx"
-#endif
-#ifndef _COM_SUN_STAR_UTIL_DATE_HPP_
-#include <com/sun/star/util/Date.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_TIME_HPP_
-#include <com/sun/star/util/Time.hpp>
-#endif
-#ifndef _RTL_URI_HXX_
-#include <rtl/uri.hxx>
-#endif
-#include <algorithm>
-#ifndef _OSL_FILE_HXX_
-#include <osl/file.hxx>
-#endif
-
-using namespace com::sun;
-using namespace com::sun::star;
-using namespace odma;
-
-//=========================================================================
-//=========================================================================
-//
-// ContentProvider Implementation.
-//
-//=========================================================================
-//=========================================================================
-ODMHANDLE ContentProvider::m_aOdmHandle = NULL;
-
-ContentProvider::ContentProvider(
- const uno::Reference< lang::XMultiServiceFactory >& rSMgr )
-: ::ucb::ContentProviderImplHelper( rSMgr )
-{
-
-}
-
-//=========================================================================
-// virtual
-ContentProvider::~ContentProvider()
-{
- ContentsMap::iterator aIter = m_aContents.begin();
- for (;aIter != m_aContents.begin() ;++aIter )
- {
- if(aIter->second->m_bIsOpen)
- closeDocument(aIter->first);
- }
- if(m_aOdmHandle)
- {
- NODMUnRegisterApp(m_aOdmHandle);
- m_aOdmHandle = NULL;
- }
-}
-// -----------------------------------------------------------------------------
-ODMHANDLE ContentProvider::getHandle()
-{
- if(!m_aOdmHandle)
- {
- ODMSTATUS odm = NODMRegisterApp(&m_aOdmHandle,ODM_API_VERSION,ODMA_ODMA_REGNAME,NULL,NULL);
- switch(odm)
- {
- case ODM_SUCCESS:
- break;
- case ODM_E_NODMS:
- break;
- case ODM_E_CANTINIT:
- break;
- case ODM_E_VERSION:
- break;
- default:
- break;
- }
- }
- return m_aOdmHandle;
-}
-// -----------------------------------------------------------------------------
-
-//=========================================================================
-//
-// XInterface methods.
-//
-//=========================================================================
-
-// @@@ Add own interfaces.
-XINTERFACE_IMPL_3( ContentProvider,
- lang::XTypeProvider,
- lang::XServiceInfo,
- star::ucb::XContentProvider );
-
-//=========================================================================
-//
-// XTypeProvider methods.
-//
-//=========================================================================
-
-// @@@ Add own interfaces.
-XTYPEPROVIDER_IMPL_3( ContentProvider,
- lang::XTypeProvider,
- lang::XServiceInfo,
- star::ucb::XContentProvider );
-
-//=========================================================================
-//
-// XServiceInfo methods.
-//
-//=========================================================================
-
-// @@@ Adjust implementation name. Keep the prefix "com.sun.star.comp."!
-// @@@ Adjust service name.
-XSERVICEINFO_IMPL_1( ContentProvider,
- rtl::OUString::createFromAscii(
- "com.sun.star.comp.odma.ContentProvider" ),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODMA_CONTENT_PROVIDER_SERVICE_NAME) ) );
-
-//=========================================================================
-//
-// Service factory implementation.
-//
-//=========================================================================
-
-ONE_INSTANCE_SERVICE_FACTORY_IMPL( ContentProvider );
-
-//=========================================================================
-//
-// XContentProvider methods.
-//
-//=========================================================================
-
-// virtual
-uno::Reference< star::ucb::XContent > SAL_CALL ContentProvider::queryContent(
- const uno::Reference< star::ucb::XContentIdentifier >& Identifier )
- throw( star::ucb::IllegalIdentifierException, uno::RuntimeException )
-{
- // Check URL scheme...
- if(!getHandle())
- throw star::ucb::IllegalIdentifierException();
-
- rtl::OUString aScheme( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(ODMA_URL_SCHEME) ) );
- sal_Int32 nIndex = 0;
- rtl::OUString sOdma = aScheme.getToken(3,'.',nIndex);
- rtl::OUString sCanonicURL = Identifier->getContentIdentifier();
- // check if url starts with odma
- if ( !(Identifier->getContentProviderScheme().equalsIgnoreAsciiCase( aScheme ) ||
- Identifier->getContentProviderScheme().equalsIgnoreAsciiCase( sOdma )) )
- throw star::ucb::IllegalIdentifierException();
-
- if(!( sCanonicURL.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(ODMA_URL_SCHEME_SHORT ODMA_URL_SHORT)) ||
- sCanonicURL.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(ODMA_URL_SCHEME ODMA_URL_SHORT))))
- throw star::ucb::IllegalIdentifierException();
-
- // @@@ Further id checks may go here...
-#if 0
- if ( id-check-failes )
- throw star::ucb::IllegalIdentifierException();
-#endif
-
- // @@@ Id normalization may go here...
-#if 0
- // Normalize URL and create new Id.
- rtl::OUString aCanonicURL = ( Identifier->getContentIdentifier() );
- uno::Reference< star::ucb::XContentIdentifier > xCanonicId
- = new ::ucb::ContentIdentifier( m_xSMgr, aCanonicURL );
-#else
- uno::Reference< star::ucb::XContentIdentifier > xCanonicId = Identifier;
-#endif
-
- vos::OGuard aGuard( m_aMutex );
-
- // Check, if a content with given id already exists...
- uno::Reference< star::ucb::XContent > xContent
- = queryExistingContent( xCanonicId ).getBodyPtr();
- if ( xContent.is() )
- return xContent;
-
- // @@@ Decision, which content implementation to instanciate may be
- // made here ( in case you have different content classes ).
-
- // Create a new content. Note that the content will insert itself
- // into providers content list by calling addContent(...) from it's ctor.
-
- sCanonicURL = convertURL(sCanonicURL);
-
- ::vos::ORef<ContentProperties> aProp;
- // first check if we got an ODMA ID from outside
- if( sCanonicURL.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(ODMA_URL_ODMAID)))
- {// we get an orignal ODMA id so we have to look for the name
- ::rtl::OString sDocId = ::rtl::OUStringToOString(sCanonicURL,RTL_TEXTENCODING_MS_1252);
- sal_Char* lpszDocName = new sal_Char[ODM_NAME_MAX];
-
- ODMSTATUS odm = NODMGetDocInfo( getHandle(),
- const_cast<sal_Char*>(sDocId.getStr()),
- ODM_NAME,
- lpszDocName,
- ODM_NAME_MAX
- );
- if(odm == ODM_SUCCESS)
- {
- aProp = new ContentProperties();
- aProp->m_sDocumentName = ::rtl::OStringToOUString(rtl::OString(lpszDocName),RTL_TEXTENCODING_ASCII_US);
- aProp->m_sDocumentId = sDocId;
- aProp->m_sContentType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ODMA_CONTENT_TYPE));
- append(aProp);
- }
- delete lpszDocName;
- }
- else // we got an already fetched name here so look for it
- {
- // we have a valid document name
- aProp = getContentPropertyWithTitle(sCanonicURL);
- if(!aProp.isValid())
- aProp = getContentPropertyWithSavedAsName(sCanonicURL);
- if(!aProp.isValid())
- {
- if(sCanonicURL.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("/")))
- { // found only the scheme
- aProp = new ContentProperties();
- aProp->m_sDocumentId = "/";
- aProp->m_sTitle = sCanonicURL;
- aProp->m_bIsFolder = sal_True;
- aProp->m_bIsDocument = !aProp->m_bIsFolder;
- m_aContents.insert(ContentsMap::value_type(aProp->m_sDocumentId,aProp));
- }
- else
- aProp = queryContentProperty(sCanonicURL);
- }
- }
- if(!aProp.isValid())
- throw star::ucb::IllegalIdentifierException();
-
- xContent = new Content( m_xSMgr, this, xCanonicId ,aProp);
-
- if ( !xContent->getIdentifier().is() )
- throw star::ucb::IllegalIdentifierException();
-
- return xContent;
-}
-// -----------------------------------------------------------------------------
-void ContentProvider::closeDocument(const ::rtl::OString& _sDocumentId)
-{
- ContentsMap::iterator aIter = m_aContents.find(_sDocumentId);
- if(aIter != m_aContents.end())
- {
- DWORD dwFlags = ODM_SILENT;
- ODMSTATUS odm = NODMCloseDocEx( ContentProvider::getHandle(),
- const_cast<sal_Char*>(_sDocumentId.getStr()),
- &dwFlags,
- 0xFFFFFFFF,
- 0xFFFFFFFF,
- NULL,
- 0);
- OSL_ENSURE(odm == ODM_SUCCESS,"Error while closing a document!");
- if(odm == ODM_SUCCESS)
- aIter->second->m_bIsOpen = sal_False;
- }
-}
-// -----------------------------------------------------------------------------
-void ContentProvider::saveDocument(const ::rtl::OString& _sDocumentId)
-{
- ContentsMap::iterator aIter = m_aContents.find(_sDocumentId);
- if(aIter != m_aContents.end())
- {
- sal_Char* lpszDocId = new sal_Char[ODM_DOCID_MAX];
- DWORD dwFlags = ODM_SILENT;
- ODMSTATUS odm = NODMSaveDocEx(getHandle(),
- const_cast<sal_Char*>(_sDocumentId.getStr()),
- lpszDocId,
- &dwFlags);
- OSL_ENSURE(odm == ODM_SUCCESS,"Could not save document!");
- if(odm != ODM_SUCCESS)
- {
- delete lpszDocId;
- throw uno::Exception();
- }
- aIter->second->m_sDocumentId = rtl::OString(lpszDocId);
- delete lpszDocId;
- }
-}
-// -----------------------------------------------------------------------------
-util::Date toDate(const ::rtl::OString& _sSQLString)
-{
- sal_uInt16 nYear = 0,
- nMonth = 0,
- nDay = 0;
- nYear = (sal_uInt16)_sSQLString.copy(0,4).toInt32();
- nMonth = (sal_uInt16)_sSQLString.copy(4,2).toInt32();
- nDay = (sal_uInt16)_sSQLString.copy(6,2).toInt32();
-
- return util::Date(nDay,nMonth,nYear);
-}
-//-----------------------------------------------------------------------------
-util::Time toTime(const ::rtl::OString& _sSQLString)
-{
- sal_uInt16 nHour = 0,
- nMinute = 0,
- nSecond = 0;
- nHour = (sal_uInt16)_sSQLString.copy(8,2).toInt32();
- nMinute = (sal_uInt16)_sSQLString.copy(10,2).toInt32();
- nSecond = (sal_uInt16)_sSQLString.copy(12,2).toInt32();
-
- return util::Time(0,nHour,nMinute,nSecond);
-}
-//-----------------------------------------------------------------------------
-util::DateTime toDateTime(const ::rtl::OString& _sSQLString)
-{
- util::Date aDate = toDate(_sSQLString);
- util::Time aTime = toTime(_sSQLString);
-
- return util::DateTime(0,aTime.Seconds,aTime.Minutes,aTime.Hours,aDate.Day,aDate.Month,aDate.Year);
-}
-// -----------------------------------------------------------------------------
-void ContentProvider::fillDocumentProperties(const ::vos::ORef<ContentProperties>& _rProp)
-{
- // read some properties from the DMS
- sal_Char* lpszDocInfo = new sal_Char[ODM_DOCID_MAX];
- sal_Char* pDocId = const_cast<sal_Char*>(_rProp->m_sDocumentId.getStr());
-
- // read the create date of the document
- ODMSTATUS odm = NODMGetDocInfo( getHandle(),
- pDocId,
- ODM_CREATEDDATE,
- lpszDocInfo,
- ODM_DOCID_MAX);
- if(odm == ODM_SUCCESS)
- _rProp->m_aDateCreated = toDateTime(::rtl::OString(lpszDocInfo));
-
- // read the modified date of the document
- odm = NODMGetDocInfo( getHandle(),
- pDocId,
- ODM_MODIFYDATE,
- lpszDocInfo,
- ODM_DOCID_MAX);
- if(odm == ODM_SUCCESS)
- _rProp->m_aDateModified = toDateTime(::rtl::OString(lpszDocInfo));
-
- // read the title of the document
- odm = NODMGetDocInfo( getHandle(),
- pDocId,
- ODM_TITLETEXT,
- lpszDocInfo,
- ODM_DOCID_MAX);
- if(odm == ODM_SUCCESS)
- _rProp->m_sTitle = ::rtl::OStringToOUString(rtl::OString(lpszDocInfo),RTL_TEXTENCODING_ASCII_US);
-
- // read the name of the document
- odm = NODMGetDocInfo( getHandle(),
- pDocId,
- ODM_NAME,
- lpszDocInfo,
- ODM_DOCID_MAX);
- if(odm == ODM_SUCCESS)
- _rProp->m_sDocumentName = ::rtl::OStringToOUString(rtl::OString(lpszDocInfo),RTL_TEXTENCODING_ASCII_US);
-
- // read the author of the document
- odm = NODMGetDocInfo( getHandle(),
- pDocId,
- ODM_AUTHOR,
- lpszDocInfo,
- ODM_DOCID_MAX);
- if(odm == ODM_SUCCESS)
- _rProp->m_sAuthor = ::rtl::OStringToOUString(rtl::OString(lpszDocInfo),RTL_TEXTENCODING_ASCII_US);
-
- // read the subject of the document
- odm = NODMGetDocInfo( getHandle(),
- pDocId,
- ODM_SUBJECT,
- lpszDocInfo,
- ODM_DOCID_MAX);
- if(odm == ODM_SUCCESS)
- _rProp->m_sSubject = ::rtl::OStringToOUString(rtl::OString(lpszDocInfo),RTL_TEXTENCODING_ASCII_US);
-
- // read the keywords of the document
- odm = NODMGetDocInfo( getHandle(),
- pDocId,
- ODM_KEYWORDS,
- lpszDocInfo,
- ODM_DOCID_MAX);
- if(odm == ODM_SUCCESS)
- _rProp->m_sKeywords = ::rtl::OStringToOUString(rtl::OString(lpszDocInfo),RTL_TEXTENCODING_ASCII_US);
-
-/*
- odm = NODMGetDocInfo( getHandle(),
- const_cast<sal_Char*>(_rProp->m_sDocumentId.getStr()),
- ODM_URL,
- lpszDocInfo,
- ODM_DOCID_MAX);
-*/
- delete lpszDocInfo;
-}
-// -----------------------------------------------------------------------------
-void ContentProvider::append(const ::vos::ORef<ContentProperties>& _rProp)
-{
- // now fill some more properties
- fillDocumentProperties(_rProp);
- // and append them
- m_aContents.insert(ContentsMap::value_type(_rProp->m_sDocumentId,_rProp));
-}
-// -----------------------------------------------------------------------------
-::vos::ORef<ContentProperties> ContentProvider::queryContentProperty(const ::rtl::OUString& _sDocumentName)
-{
- ::vos::ORef<ContentProperties> aReturn;
- sal_Char* lpszDMSList = new sal_Char[ODM_DMSID_MAX];
-
- ODMSTATUS odm = NODMGetDMS(ODMA_ODMA_REGNAME, lpszDMSList);
- if(odm == ODM_SUCCESS)
- {
- sal_Char* pQueryId = new sal_Char[ODM_QUERYID_MAX];
- lpszDMSList[strlen(lpszDMSList)+1] = '\0';
-
- ::rtl::OString sTitleText(::rtl::OUStringToOString(_sDocumentName,RTL_TEXTENCODING_ASCII_US));
- ::rtl::OString sQuery("SELECT ODM_DOCID, ODM_NAME WHERE ODM_TITLETEXT = '");
- sQuery += sTitleText;
- sQuery += "'";
-
- DWORD dwFlags = ODM_SPECIFIC;
- odm = NODMQueryExecute(getHandle(), sQuery,dwFlags, lpszDMSList, pQueryId );
- if(odm == ODM_SUCCESS)
- {
- sal_uInt16 nCount = 10;
- sal_uInt16 nMaxCount = 10;
- sal_Char* lpszDocId = new sal_Char[ODM_DOCID_MAX * nMaxCount];
- sal_Char* lpszDocName = new sal_Char[ODM_NAME_MAX * nMaxCount];
- sal_Char* lpszDocInfo = new sal_Char[ODM_DOCID_MAX];
-
- ::rtl::OUString sContentType(RTL_CONSTASCII_USTRINGPARAM(ODMA_CONTENT_TYPE));
- do
- {
- if(nCount >= nMaxCount)
- {
- // get the result
- nCount = nMaxCount;
- odm = NODMQueryGetResults(getHandle(), pQueryId,lpszDocId, lpszDocName, ODM_NAME_MAX, (WORD*)&nCount);
- }
- if(odm == ODM_SUCCESS)
- for(sal_uInt16 i = 0; i < nCount; ++i)
- {
- odm = NODMGetDocInfo( getHandle(),
- &lpszDocId[ODM_DOCID_MAX*i],
- ODM_TITLETEXT,
- lpszDocInfo,
- ODM_DOCID_MAX);
- if( odm == ODM_SUCCESS && sTitleText == ::rtl::OString(lpszDocInfo))
- {
- aReturn = new ContentProperties();
- aReturn->m_sDocumentName = ::rtl::OStringToOUString(rtl::OString(&lpszDocName[ODM_NAME_MAX*i]),RTL_TEXTENCODING_ASCII_US);
- aReturn->m_sDocumentId = ::rtl::OString(&lpszDocId[ODM_DOCID_MAX*i]);
- aReturn->m_sContentType = sContentType;
- append(aReturn);
- nCount = 0; // break condition from outer loop
- break;
- }
- }
- }
- while(nCount > nMaxCount);
-
- delete lpszDocInfo;
- delete lpszDocId;
- delete lpszDocName;
- }
-
- // now close the query
- odm = NODMQueryClose(ContentProvider::getHandle(), pQueryId);
- delete pQueryId;
- }
- delete lpszDMSList;
-
-
- return aReturn;
-}
-// -----------------------------------------------------------------------------
-::vos::ORef<ContentProperties> ContentProvider::getContentProperty(const ::rtl::OUString& _sName,
- const ContentPropertiesMemberFunctor& _aFunctor) const
-{
- ::vos::ORef<ContentProperties> aReturn;
- ContentsMap::const_iterator aFind = ::std::find_if( m_aContents.begin(),
- m_aContents.end(),
- ::std::compose1(
- ::std::bind2nd(_aFunctor,_sName),
- ::std::select2nd<ContentsMap::value_type>()
- )
- );
- if(aFind != m_aContents.end())
- aReturn = aFind->second;
- return aReturn;
-}
-// -----------------------------------------------------------------------------
-::vos::ORef<ContentProperties> ContentProvider::getContentPropertyWithSavedAsName(const ::rtl::OUString& _sSaveAsName) const
-{
- ContentPropertiesMemberFunctor aFunc(::std::mem_fun(&ContentProperties::getSavedAsName));
- return getContentProperty(_sSaveAsName,aFunc);
-}
-// -----------------------------------------------------------------------------
-::vos::ORef<ContentProperties> ContentProvider::getContentPropertyWithTitle(const ::rtl::OUString& _sTitle) const
-{
- ContentPropertiesMemberFunctor aFunc(::std::mem_fun(&ContentProperties::getTitle));
- return getContentProperty(_sTitle,aFunc);
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString ContentProvider::openDoc(const ::vos::ORef<ContentProperties>& _rProp) throw (::com::sun::star::uno::Exception)
-{
- OSL_ENSURE(_rProp.isValid(),"No valid content properties!");
- if(!_rProp->m_bIsOpen)
- {
- sal_Char *pFileName = new sal_Char[ODM_FILENAME_MAX];
-
- DWORD dwFlag = ODM_MODIFYMODE | ODM_SILENT;
- ODMSTATUS odm = NODMOpenDoc(getHandle(), dwFlag, const_cast<sal_Char*>(_rProp->m_sDocumentId.getStr()), pFileName);
- switch(odm)
- {
- case ODM_E_INUSE:
- dwFlag = ODM_VIEWMODE;
- if( NODMOpenDoc(getHandle(), dwFlag, const_cast<sal_Char*>(_rProp->m_sDocumentId.getStr()), pFileName) != ODM_SUCCESS)
- break;
- // else run through
- case ODM_SUCCESS:
- ::osl::FileBase::getFileURLFromSystemPath(::rtl::OStringToOUString(rtl::OString(pFileName),RTL_TEXTENCODING_ASCII_US)
- ,_rProp->m_sFileURL);
- _rProp->m_bIsOpen = sal_True;
- break;
- default:
- delete pFileName;
- throw uno::Exception(); // TODO give a more precise error message here
- }
-
- delete pFileName;
- }
- return _rProp->m_sFileURL;
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString ContentProvider::convertURL(const ::rtl::OUString& _sCanonicURL)
-{
- sal_Int32 nPos = 0;
- // check if url starts with odma
- if(_sCanonicURL.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(ODMA_URL_SCHEME_SHORT ODMA_URL_SHORT)))
- { // URL starts with odma:// so we have to remove this
- nPos = ODMA_URL_SHORT_LGTH;
- }
- else if(_sCanonicURL.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(ODMA_URL_SCHEME ODMA_URL_SHORT)))
- { // URL starts with vnd.sun.star.odma:/// so we have to remove this
- nPos = ODMA_URL_LGTH;
- }
-
- ::rtl::OUString sCanonicURL = _sCanonicURL;
- // now check what formats we allow
- if(nPos == _sCanonicURL.getLength()) // only ask for root entry
- sCanonicURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
-
- if(nPos < sCanonicURL.getLength())
- {
- sCanonicURL = sCanonicURL.copy(nPos);
- sCanonicURL = rtl::Uri::decode(sCanonicURL,rtl_UriDecodeWithCharset,RTL_TEXTENCODING_UTF8);
- }
- if(sCanonicURL.getLength() > 1 && sCanonicURL.getStr()[0] == sal_Unicode('/'))
- {
- sCanonicURL = sCanonicURL.copy(1);
- if(sCanonicURL.getLength() == 1 && sCanonicURL.getStr()[0] == sal_Unicode('.'))
- sCanonicURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- }
- return sCanonicURL;
-}
-// -----------------------------------------------------------------------------
-sal_Bool ContentProvider::deleteDocument(const ::vos::ORef<ContentProperties>& _rProp)
-{
- closeDocument(_rProp->m_sDocumentId);
- ODMSTATUS odm = NODMActivate(ContentProvider::getHandle(),
- ODM_DELETE,
- const_cast< sal_Char*>(_rProp->m_sDocumentId.getStr()));
- if(odm == ODM_SUCCESS)
- m_aContents.erase(_rProp->m_sDocumentId);
-
- return odm == ODM_SUCCESS;
-}
-// -----------------------------------------------------------------------------
diff --git a/ucb/source/ucp/odma/odma_provider.hxx b/ucb/source/ucp/odma/odma_provider.hxx
deleted file mode 100644
index 136365b9e2..0000000000
--- a/ucb/source/ucp/odma/odma_provider.hxx
+++ /dev/null
@@ -1,217 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_provider.hxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 15:00:00 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the "License"); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-
-// @@@ Adjust multi-include-protection-ifdef.
-#ifndef ODMA_PROVIDER_HXX
-#define ODMA_PROVIDER_HXX
-
-#ifndef _UCBHELPER_PROVIDERHELPER_HXX
-#include <ucbhelper/providerhelper.hxx>
-#endif
-#ifndef ODMA_LIB_HXX
-#include "odma_lib.hxx"
-#endif
-#ifndef _VOS_REF_HXX_
-#include <vos/ref.hxx>
-#endif
-#include <map>
-#ifndef ODMA_CONTENTPROPS_HXX
-#include "odma_contentprops.hxx"
-#endif
-// @@@ Adjust namespace name.
-namespace odma {
-
-//=========================================================================
-
-// @@@ Adjust defines.
-
-// UNO service name for the provider. This name will be used by the UCB to
-// create instances of the provider.
-#define ODMA_CONTENT_PROVIDER_SERVICE_NAME \
- "com.sun.star.ucb.OdmaContentProvider"
-// #define ODMA_CONTENT_PROVIDER_SERVICE_NAME_LENGTH 34
-
-// URL scheme. This is the scheme the provider will be able to create
-// contents for. The UCB will select the provider ( i.e. in order to create
-// contents ) according to this scheme.
-#define ODMA_URL_ODMAID "::ODMA"
-#define ODMA_URL_SCHEME "vnd.sun.star.odma"
-#define ODMA_URL_SCHEME_SHORT "odma"
-#define ODMA_URL_SHORT ":"
-#define ODMA_URL_SHORT_LGTH 5
-#define ODMA_URL_LGTH 18
-#define ODMA_URL_ODMAID_LGTH 6
-
-// UCB Content Type.
-#define ODMA_CONTENT_TYPE "application/" ODMA_URL_SCHEME "-content"
-#define ODMA_ODMA_REGNAME "sodma"
-#define ODM_NAME_MAX 64 // Max length of a name document including
- // the terminating NULL character.
-
-//=========================================================================
-class ContentProperties;
-class ContentProvider : public ::ucb::ContentProviderImplHelper
-{
- typedef ::std::map< ::rtl::OString, ::vos::ORef<ContentProperties> > ContentsMap;
- ContentsMap m_aContents; // contains all ContentProperties
- static ODMHANDLE m_aOdmHandle; // the one and only ODMA handle to our DMS
-
- /** fillDocumentProperties fills the given _rProp with ODMA properties
- @param _rProp the ContentProperties
- */
- void fillDocumentProperties(const ::vos::ORef<ContentProperties>& _rProp);
-
- /**
- */
- ::vos::ORef<ContentProperties> getContentProperty(const ::rtl::OUString& _sName,
- const ContentPropertiesMemberFunctor& _aFunctor) const;
-public:
- ContentProvider( const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >& rSMgr );
- virtual ~ContentProvider();
-
- // XInterface
- XINTERFACE_DECL()
-
- // XTypeProvider
- XTYPEPROVIDER_DECL()
-
- // XServiceInfo
- XSERVICEINFO_DECL()
-
- // XContentProvider
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XContent > SAL_CALL
- queryContent( const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XContentIdentifier >& Identifier )
- throw( ::com::sun::star::ucb::IllegalIdentifierException,
- ::com::sun::star::uno::RuntimeException );
-
- //////////////////////////////////////////////////////////////////////
- // Additional interfaces
- //////////////////////////////////////////////////////////////////////
-
- //////////////////////////////////////////////////////////////////////
- // Non-interface methods.
- //////////////////////////////////////////////////////////////////////
- static ODMHANDLE getHandle();
-
- /** append add an entry to the internal map
- @param _rProp the content properties
- */
- void append(const ::vos::ORef<ContentProperties>& _rProp);
-
- /** closeDocument closes the document
- @param _sDocumentId the id of the document
- */
- void closeDocument(const ::rtl::OString& _sDocumentId);
-
- /** saveDocument saves the document in DMS
- @param _sDocumentId the id of the document
- */
- void saveDocument(const ::rtl::OString& _sDocumentId);
-
- /** queryContentProperty query in the DMS for a content which document name is equal to _sDocumentName
- @param _sDocumentName the document to query for
-
- @return the content properties for this content or an empty refernce
- */
- ::vos::ORef<ContentProperties> queryContentProperty(const ::rtl::OUString& _sDocumentName);
-
- /** getContentProperty returns the ContentProperties for the first content with that title
- @param _sTitle the title of the document
-
- @return the content properties
- */
- ::vos::ORef<ContentProperties> getContentPropertyWithTitle(const ::rtl::OUString& _sTitle) const;
-
- /** getContentProperty returns the ContentProperties for the first content with that SavedAsName
- @param _sSaveAsName the SavedAsName of the document
-
- @return the content properties
- */
- ::vos::ORef<ContentProperties> getContentPropertyWithSavedAsName(const ::rtl::OUString& _sSaveAsName) const;
-
- /** openDoc returns the URL for the temporary file for the specific Content and opens it
- @param _rProp used for check if already open, the member m_sFileURL will be set if is wan't opened yet
-
- @return the URL of the temporary file
- */
- static ::rtl::OUString openDoc(const ::vos::ORef<ContentProperties>& _rProp) throw (::com::sun::star::uno::Exception);
-
- /** convertURL converts a normal URL into an ODMA understandable name
- @param _sCanonicURL the URL from ContentIndentifier
-
- @return the ODMA name
- */
- static ::rtl::OUString convertURL(const ::rtl::OUString& _sCanonicURL);
-
- /** deleteDocument deletes the document inside the DMS and remove the content properties from inside list
- @param _rProp the ContentProperties
-
- @return true when successful
- */
- sal_Bool deleteDocument(const ::vos::ORef<ContentProperties>& _rProp);
-};
-
-}
-
-#endif
diff --git a/ucb/source/ucp/odma/odma_resultset.cxx b/ucb/source/ucp/odma/odma_resultset.cxx
deleted file mode 100644
index 71406cfce3..0000000000
--- a/ucb/source/ucp/odma/odma_resultset.cxx
+++ /dev/null
@@ -1,135 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_resultset.cxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 15:00:07 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the "License"); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-
-/**************************************************************************
- TODO
- **************************************************************************
-
- - This implementation is not a dynamic result set!!! It only implements
- the necessary interfaces, but never recognizes/notifies changes!!!
-
- *************************************************************************/
-
-// @@@ Adjust multi-include-protection-ifdef and header file name.
-#ifndef ODMA_DATASUPPLIER_HXX
-#include "odma_datasupplier.hxx"
-#endif
-// @@@ Adjust multi-include-protection-ifdef and header file name.
-#ifndef ODMA_RESULTSET_HXX
-#include "odma_resultset.hxx"
-#endif
-
-using namespace com::sun::star::lang;
-using namespace com::sun::star::ucb;
-using namespace com::sun::star::uno;
-
-// @@@ Adjust namespace name.
-using namespace odma;
-
-//=========================================================================
-//=========================================================================
-//
-// DynamicResultSet Implementation.
-//
-//=========================================================================
-//=========================================================================
-
-DynamicResultSet::DynamicResultSet(
- const Reference< XMultiServiceFactory >& rxSMgr,
- const vos::ORef< Content >& rxContent,
- const OpenCommandArgument2& rCommand,
- const Reference< XCommandEnvironment >& rxEnv )
-: ResultSetImplHelper( rxSMgr, rCommand ),
- m_xContent( rxContent ),
- m_xEnv( rxEnv )
-{
-}
-
-//=========================================================================
-//
-// Non-interface methods.
-//
-//=========================================================================
-
-void DynamicResultSet::initStatic()
-{
- m_xResultSet1
- = new ::ucb::ResultSet( m_xSMgr,
- m_aCommand.Properties,
- new DataSupplier( m_xSMgr,
- m_xContent,
- m_aCommand.Mode ),
- m_xEnv );
-}
-
-//=========================================================================
-void DynamicResultSet::initDynamic()
-{
- m_xResultSet1
- = new ::ucb::ResultSet( m_xSMgr,
- m_aCommand.Properties,
- new DataSupplier( m_xSMgr,
- m_xContent,
- m_aCommand.Mode ),
- m_xEnv );
- m_xResultSet2 = m_xResultSet1;
-}
-
diff --git a/ucb/source/ucp/odma/odma_resultset.hxx b/ucb/source/ucp/odma/odma_resultset.hxx
deleted file mode 100644
index 5b4eb44f67..0000000000
--- a/ucb/source/ucp/odma/odma_resultset.hxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_resultset.hxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 15:00:13 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the "License"); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-
-// @@@ Adjust multi-include-protection-ifdef.
-#ifndef ODMA_RESULTSET_HXX
-#define ODMA_RESULTSET_HXX
-
-#ifndef _UCBHELPER_RESULTSETHELPER_HXX
-#include <ucbhelper/resultsethelper.hxx>
-#endif
-#ifndef _VOS_REF_HXX_
-#include <vos/ref.hxx>
-#endif
-
-// @@@ Adjust multi-include-protection-ifdef and header file name.
-#ifndef ODMA_CONTENT_HXX
-#include "odma_content.hxx"
-#endif
-
-// @@@ Adjust namespace name.
-namespace odma {
-
-class DynamicResultSet : public ::ucb::ResultSetImplHelper
-{
- vos::ORef< Content > m_xContent;
- com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > m_xEnv;
-
-private:
- virtual void initStatic();
- virtual void initDynamic();
-
-public:
- DynamicResultSet(
- const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
- const vos::ORef< Content >& rxContent,
- const com::sun::star::ucb::OpenCommandArgument2& rCommand,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& rxEnv );
-};
-
-}
-
-#endif
diff --git a/ucb/source/ucp/odma/odma_services.cxx b/ucb/source/ucp/odma/odma_services.cxx
deleted file mode 100644
index fe6a27aa32..0000000000
--- a/ucb/source/ucp/odma/odma_services.cxx
+++ /dev/null
@@ -1,183 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: odma_services.cxx,v $
- *
- * $Revision: 1.1 $
- *
- * last change: $Author: oj $ $Date: 2002-01-14 15:00:20 $
- *
- * The Contents of this file are made available subject to the terms of
- * either of the following licenses
- *
- * - GNU Lesser General Public License Version 2.1
- * - Sun Industry Standards Source License Version 1.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library 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 for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- *
- * Sun Industry Standards Source License Version 1.1
- * =================================================
- * The contents of this file are subject to the Sun Industry Standards
- * Source License Version 1.1 (the "License"); You may not use this file
- * except in compliance with the License. You may obtain a copy of the
- * License at http://www.openoffice.org/license.html.
- *
- * Software provided under this License is provided on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- * See the License for the specific provisions governing your rights and
- * obligations concerning the Software.
- *
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- * Copyright: 2000 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): _______________________________________
- *
- *
- ************************************************************************/
-
-#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#endif
-#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#endif
-
-#ifndef ODMA_CONTENTPROPS_HXX
-#include "odma_contentprops.hxx"
-#endif
-#ifndef ODMA_PROVIDER_HXX
-#include "odma_provider.hxx"
-#endif
-#ifndef ODMA_LIB_HXX
-#include "odma_lib.hxx"
-#endif
-
-using namespace rtl;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::registry;
-
-//=========================================================================
-static sal_Bool writeInfo( void * pRegistryKey,
- const OUString & rImplementationName,
- Sequence< OUString > const & rServiceNames )
-{
- OUString aKeyName( OUString::createFromAscii( "/" ) );
- aKeyName += rImplementationName;
- aKeyName += OUString::createFromAscii( "/UNO/SERVICES" );
-
- Reference< XRegistryKey > xKey;
- try
- {
- xKey = static_cast< XRegistryKey * >(
- pRegistryKey )->createKey( aKeyName );
- }
- catch ( InvalidRegistryException const & )
- {
- }
-
- if ( !xKey.is() )
- return sal_False;
-
- sal_Bool bSuccess = sal_True;
-
- for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n )
- {
- try
- {
- xKey->createKey( rServiceNames[ n ] );
- }
- catch ( InvalidRegistryException const & )
- {
- bSuccess = sal_False;
- break;
- }
- }
- return bSuccess;
-}
-
-//=========================================================================
-extern "C" void SAL_CALL component_getImplementationEnvironment(
- const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
-{
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
-//=========================================================================
-extern "C" sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return pRegistryKey &&
-
- //////////////////////////////////////////////////////////////////////
- // Write info into registry.
- //////////////////////////////////////////////////////////////////////
-
- // @@@ Adjust namespace names.
- writeInfo( pRegistryKey,
- ::odma::ContentProvider::getImplementationName_Static(),
- ::odma::ContentProvider::getSupportedServiceNames_Static() );
-}
-
-//=========================================================================
-extern "C" void * SAL_CALL component_getFactory(
- const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
-{
- void * pRet = 0;
-
- Reference< XMultiServiceFactory > xSMgr(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
- Reference< XSingleServiceFactory > xFactory;
-
- //////////////////////////////////////////////////////////////////////
- // Create factory, if implementation name matches.
- //////////////////////////////////////////////////////////////////////
-
- // @@@ Adjust namespace names.
- if ( ::odma::ContentProvider::getImplementationName_Static().
- compareToAscii( pImplName ) == 0 )
- {
- if(::odma::LoadLibrary())
- xFactory = ::odma::ContentProvider::createServiceFactory( xSMgr );
- else
- OSL_ASSERT(!"Could not load library!");
- }
-
- //////////////////////////////////////////////////////////////////////
-
- if ( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
-
- return pRet;
-}
-
diff --git a/ucb/source/ucp/package/makefile.mk b/ucb/source/ucp/package/makefile.mk
index 94d97be693..6f6d95974f 100644
--- a/ucb/source/ucp/package/makefile.mk
+++ b/ucb/source/ucp/package/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.4 $
+# $Revision: 1.5 $
#
-# last change: $Author: svesik $ $Date: 2002-03-11 15:36:52 $
+# last change: $Author: hr $ $Date: 2003-03-27 17:27:14 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -100,7 +100,7 @@ LIB1OBJFILES=$(SLOFILES)
SHL1TARGET=$(TARGET)$(UCP_VERSION)
SHL1IMPLIB=i$(TARGET)
-.IF "$(OS)"=="MACOSX"||"$(OS)"=="FREEBSD"
+.IF "$(OS)"=="MACOSX"
.ELSE
SHL1VERSIONMAP=exports.map
.ENDIF
diff --git a/ucb/source/ucp/package/pkgcontent.cxx b/ucb/source/ucp/package/pkgcontent.cxx
index d8e7defe27..e31db29a38 100644
--- a/ucb/source/ucp/package/pkgcontent.cxx
+++ b/ucb/source/ucp/package/pkgcontent.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pkgcontent.cxx,v $
*
- * $Revision: 1.45 $
+ * $Revision: 1.46 $
*
- * last change: $Author: kso $ $Date: 2002-06-19 15:08:01 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -308,7 +308,7 @@ Content* Content::create(
if ( hasData( pProvider, aURI, xPackage ) )
return 0;
#else
- xPackage = pProvider->createPackage( aURI.getPackage() );
+ xPackage = pProvider->createPackage( aURI.getPackage(), aURI.getParam() );
#endif
uno::Reference< star::ucb::XContentIdentifier > xId
@@ -2308,12 +2308,12 @@ uno::Reference< container::XHierarchicalNameAccess > Content::getPackage(
if ( rURI.getPackage() == m_aUri.getPackage() )
{
if ( !m_xPackage.is() )
- m_xPackage = m_pProvider->createPackage( m_aUri.getPackage() );
+ m_xPackage = m_pProvider->createPackage( m_aUri.getPackage(), m_aUri.getParam() );
return m_xPackage;
}
- return m_pProvider->createPackage( rURI.getPackage() );
+ return m_pProvider->createPackage( rURI.getPackage(), rURI.getParam() );
}
//=========================================================================
@@ -2329,7 +2329,7 @@ sal_Bool Content::hasData(
const PackageUri& rURI,
uno::Reference< container::XHierarchicalNameAccess > & rxPackage )
{
- rxPackage = pProvider->createPackage( rURI.getPackage() );
+ rxPackage = pProvider->createPackage( rURI.getPackage(), rURI.getParam() );
if ( !rxPackage.is() )
return sal_False;
@@ -2362,7 +2362,7 @@ sal_Bool Content::loadData(
ContentProperties& rProps,
uno::Reference< container::XHierarchicalNameAccess > & rxPackage )
{
- rxPackage = pProvider->createPackage( rURI.getPackage() );
+ rxPackage = pProvider->createPackage( rURI.getPackage(), rURI.getParam() );
if ( !rxPackage.is() )
return sal_False;
diff --git a/ucb/source/ucp/package/pkgdatasupplier.cxx b/ucb/source/ucp/package/pkgdatasupplier.cxx
index 3345ebddb8..bdb73b448c 100644
--- a/ucb/source/ucp/package/pkgdatasupplier.cxx
+++ b/ucb/source/ucp/package/pkgdatasupplier.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pkgdatasupplier.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: kso $ $Date: 2002-09-18 14:58:07 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -328,10 +328,7 @@ sal_Bool DataSupplier::getResult( sal_uInt32 nIndex )
}
// Assemble URL for child.
- rtl::OUString aURL
- = m_pImpl->m_xContent->getIdentifier()->getContentIdentifier();
- aURL += rtl::OUString::createFromAscii( "/" );
- aURL += aName;
+ rtl::OUString aURL = assembleChildURL( aName );
m_pImpl->m_aResults.push_back( new ResultListEntry( aURL ) );
@@ -411,10 +408,7 @@ sal_uInt32 DataSupplier::totalCount()
}
// Assemble URL for child.
- rtl::OUString aURL
- = m_pImpl->m_xContent->getIdentifier()->getContentIdentifier();
- aURL += rtl::OUString::createFromAscii( "/" );
- aURL += aName;
+ rtl::OUString aURL = assembleChildURL( aName );
m_pImpl->m_aResults.push_back( new ResultListEntry( aURL ) );
}
@@ -519,3 +513,34 @@ void DataSupplier::validate()
throw star::ucb::ResultSetException();
}
+//=========================================================================
+::rtl::OUString DataSupplier::assembleChildURL( const ::rtl::OUString& aName )
+{
+ rtl::OUString aURL;
+ rtl::OUString aContURL = m_pImpl->m_xContent->getIdentifier()->getContentIdentifier();
+ sal_Int32 nParam = aContURL.indexOf( '?' );
+ if ( nParam >= 0 )
+ {
+ aURL = aContURL.copy( 0, nParam );
+
+ sal_Int32 nPackageUrlEnd = aURL.lastIndexOf( '/' );
+ if ( nPackageUrlEnd != aURL.getLength() - 1 )
+ aURL += rtl::OUString::createFromAscii( "/" );
+
+ aURL += aName;
+ aURL += aContURL.copy( nParam );
+ }
+ else
+ {
+ aURL = aContURL;
+
+ sal_Int32 nPackageUrlEnd = aURL.lastIndexOf( '/' );
+ if ( nPackageUrlEnd != aURL.getLength() - 1 )
+ aURL += rtl::OUString::createFromAscii( "/" );
+
+ aURL += aName;
+ }
+ return aURL;
+}
+
+
diff --git a/ucb/source/ucp/package/pkgdatasupplier.hxx b/ucb/source/ucp/package/pkgdatasupplier.hxx
index baa43a7229..7f91df8563 100644
--- a/ucb/source/ucp/package/pkgdatasupplier.hxx
+++ b/ucb/source/ucp/package/pkgdatasupplier.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pkgdatasupplier.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: kso $ $Date: 2001-06-25 09:11:47 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -107,6 +107,8 @@ public:
virtual void validate()
throw( com::sun::star::ucb::ResultSetException );
+
+ ::rtl::OUString assembleChildURL( const ::rtl::OUString& aName );
};
}
diff --git a/ucb/source/ucp/package/pkgprovider.cxx b/ucb/source/ucp/package/pkgprovider.cxx
index 46fa2e318c..088912e06c 100644
--- a/ucb/source/ucp/package/pkgprovider.cxx
+++ b/ucb/source/ucp/package/pkgprovider.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pkgprovider.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: kso $ $Date: 2001-07-26 12:42:28 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -294,7 +294,7 @@ uno::Reference< star::ucb::XContent > SAL_CALL ContentProvider::queryContent(
//=========================================================================
uno::Reference< container::XHierarchicalNameAccess >
-ContentProvider::createPackage( const rtl::OUString & rName )
+ContentProvider::createPackage( const rtl::OUString & rName, const rtl::OUString & rParam )
{
vos::OGuard aGuard( m_aMutex );
@@ -305,9 +305,11 @@ ContentProvider::createPackage( const rtl::OUString & rName )
return uno::Reference< container::XHierarchicalNameAccess >();
}
+ rtl::OUString rURL = rName + rParam;
+
if ( m_pPackages )
{
- Packages::const_iterator it = m_pPackages->find( rName );
+ Packages::const_iterator it = m_pPackages->find( rURL );
if ( it != m_pPackages->end() )
{
// Already instanciated. Return package.
@@ -321,7 +323,7 @@ ContentProvider::createPackage( const rtl::OUString & rName )
try
{
uno::Sequence< uno::Any > aArguments( 1 );
- aArguments[ 0 ] <<= rName;
+ aArguments[ 0 ] <<= rURL;
uno::Reference< uno::XInterface > xIfc
= m_xSMgr->createInstanceWithArguments(
@@ -340,9 +342,9 @@ ContentProvider::createPackage( const rtl::OUString & rName )
"Got no hierarchical name access!" );
rtl::Reference< Package> xPackage
- = new Package( rName, xNameAccess, this );
+ = new Package( rURL, xNameAccess, this );
- (*m_pPackages)[ rName ] = xPackage.get();
+ (*m_pPackages)[ rURL ] = xPackage.get();
return xPackage.get();
}
diff --git a/ucb/source/ucp/package/pkgprovider.hxx b/ucb/source/ucp/package/pkgprovider.hxx
index 210e7ecfbf..4fda2bc313 100644
--- a/ucb/source/ucp/package/pkgprovider.hxx
+++ b/ucb/source/ucp/package/pkgprovider.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pkgprovider.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: kso $ $Date: 2000-12-06 08:44:12 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -130,7 +130,7 @@ public:
::com::sun::star::uno::Reference<
::com::sun::star::container::XHierarchicalNameAccess >
- createPackage( const rtl::OUString & rName );
+ createPackage( const rtl::OUString & rName, const rtl::OUString & rParam );
sal_Bool
removePackage( const rtl::OUString & rName );
};
diff --git a/ucb/source/ucp/package/pkguri.cxx b/ucb/source/ucp/package/pkguri.cxx
index ff419128ec..a9e5f1e326 100644
--- a/ucb/source/ucp/package/pkguri.cxx
+++ b/ucb/source/ucp/package/pkguri.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pkguri.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: kso $ $Date: 2002-10-08 13:59:10 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -113,7 +113,7 @@ void PackageUri::init() const
if ( m_aUri.getLength() && !m_aPath.getLength() )
{
// Note: Maybe it's a re-init, setUri only resets m_aPath!
- m_aPackage = m_aParentUri = m_aName = OUString();
+ m_aPackage = m_aParentUri = m_aName = m_aParam = OUString();
// URI must match at least: <sheme>://<non_empty_url_to_file>
if ( ( m_aUri.getLength() < PACKAGE_URL_SCHEME_LENGTH + 4 ) )
@@ -138,16 +138,26 @@ void PackageUri::init() const
return;
}
+ rtl::OUString aPureUri;
+ sal_Int32 nParam = m_aUri.indexOf( '?' );
+ if( nParam >= 0 )
+ {
+ m_aParam = m_aUri.copy( nParam );
+ aPureUri = m_aUri.copy( 0, nParam );
+ }
+ else
+ aPureUri = m_aUri;
+
// Scheme is case insensitive.
rtl::OUString aScheme
- = m_aUri.copy( 0, PACKAGE_URL_SCHEME_LENGTH ).toAsciiLowerCase();
+ = aPureUri.copy( 0, PACKAGE_URL_SCHEME_LENGTH ).toAsciiLowerCase();
if ( aScheme.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM( PACKAGE_URL_SCHEME ) ) )
{
- m_aUri = m_aUri.replaceAt( 0, aScheme.getLength(), aScheme );
+ aPureUri = aPureUri.replaceAt( 0, aScheme.getLength(), aScheme );
sal_Int32 nStart = PACKAGE_URL_SCHEME_LENGTH + 3;
- sal_Int32 nEnd = m_aUri.lastIndexOf( '/' );
+ sal_Int32 nEnd = aPureUri.lastIndexOf( '/' );
if ( nEnd == PACKAGE_URL_SCHEME_LENGTH + 3 )
{
// Only <scheme>:/// - Empty authority
@@ -156,9 +166,9 @@ void PackageUri::init() const
m_aPath = rtl::OUString::createFromAscii( "/" );
return;
}
- else if ( nEnd == ( m_aUri.getLength() - 1 ) )
+ else if ( nEnd == ( aPureUri.getLength() - 1 ) )
{
- if ( m_aUri.getStr()[ m_aUri.getLength() - 2 ]
+ if ( aPureUri.getStr()[ aPureUri.getLength() - 2 ]
== sal_Unicode( '/' ) )
{
// Only <scheme>://// or <scheme>://<something>//
@@ -169,25 +179,26 @@ void PackageUri::init() const
}
// Remove trailing slash.
- m_aUri = m_aUri.copy( 0, nEnd );
+ aPureUri = aPureUri.copy( 0, nEnd );
}
- nEnd = m_aUri.indexOf( '/', nStart );
+
+ nEnd = aPureUri.indexOf( '/', nStart );
if ( nEnd == -1 )
{
// root folder.
- OUString aNormPackage = m_aUri.copy( nStart );
+ OUString aNormPackage = aPureUri.copy( nStart );
normalize( aNormPackage );
- m_aUri = m_aUri.replaceAt(
- nStart, m_aUri.getLength() - nStart, aNormPackage );
+ aPureUri = aPureUri.replaceAt(
+ nStart, aPureUri.getLength() - nStart, aNormPackage );
m_aPackage = decodeSegment( aNormPackage );
m_aPath = rtl::OUString::createFromAscii( "/" );
}
else
{
- m_aPath = m_aUri.copy( nEnd + 1 );
+ m_aPath = aPureUri.copy( nEnd + 1 );
// Empty path segments?
if ( m_aPath.indexOf(
@@ -198,18 +209,19 @@ void PackageUri::init() const
return;
}
- OUString aNormPackage = m_aUri.copy( nStart, nEnd - nStart );
+ OUString aNormPackage = aPureUri.copy( nStart, nEnd - nStart );
normalize( aNormPackage );
- m_aUri = m_aUri.replaceAt(
+ aPureUri = aPureUri.replaceAt(
nStart, nEnd - nStart, aNormPackage );
m_aPackage = decodeSegment( aNormPackage );
- sal_Int32 nLastSlash = m_aUri.lastIndexOf( '/' );
+
+ sal_Int32 nLastSlash = aPureUri.lastIndexOf( '/' );
if ( nLastSlash != -1 )
{
- m_aParentUri = m_aUri.copy( 0, nLastSlash );
- m_aName = m_aUri.copy( nLastSlash + 1 );
+ m_aParentUri = aPureUri.copy( 0, nLastSlash );
+ m_aName = aPureUri.copy( nLastSlash + 1 );
}
}
diff --git a/ucb/source/ucp/package/pkguri.hxx b/ucb/source/ucp/package/pkguri.hxx
index ffa5f627cc..582510dd04 100644
--- a/ucb/source/ucp/package/pkguri.hxx
+++ b/ucb/source/ucp/package/pkguri.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: pkguri.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: kso $ $Date: 2001-07-06 08:11:17 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,6 +82,7 @@ class PackageUri
mutable ::rtl::OUString m_aPackage;
mutable ::rtl::OUString m_aPath;
mutable ::rtl::OUString m_aName;
+ mutable ::rtl::OUString m_aParam;
mutable bool m_bValid;
private:
@@ -114,6 +115,9 @@ public:
const ::rtl::OUString & getName() const
{ init(); return m_aName; }
+ const ::rtl::OUString & getParam() const
+ { init(); return m_aParam; }
+
inline sal_Bool isRootFolder() const;
};
diff --git a/ucb/source/ucp/webdav/ContentProperties.hxx b/ucb/source/ucp/webdav/ContentProperties.hxx
index 828ec8ed0a..e83aa556bd 100644
--- a/ucb/source/ucp/webdav/ContentProperties.hxx
+++ b/ucb/source/ucp/webdav/ContentProperties.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ContentProperties.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: kso $ $Date: 2002-09-24 14:15:49 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -180,7 +180,7 @@ public:
// adds all properties described by rProps that are actually contained in
// rContentProps to this instance. In case of duplicates the value
- // already contained in this will left anchanged.
+ // already contained in this will left unchanged.
void addProperties( const std::vector< rtl::OUString > & rProps,
const ContentProperties & rContentProps );
diff --git a/ucb/source/ucp/webdav/DAVException.hxx b/ucb/source/ucp/webdav/DAVException.hxx
index 2073d924a2..f34e186aa1 100644
--- a/ucb/source/ucp/webdav/DAVException.hxx
+++ b/ucb/source/ucp/webdav/DAVException.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DAVException.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: kso $ $Date: 2002-08-21 07:34:51 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,6 +69,74 @@
namespace webdav_ucp
{
+/////////////////////////////////////////////////////////////////////////////
+// HTTP/WebDAV status codes
+/////////////////////////////////////////////////////////////////////////////
+
+const sal_uInt16 SC_NONE = 0;
+
+// 1xx (Informational - no errors)
+const sal_uInt16 SC_CONTINUE = 100;
+const sal_uInt16 SC_SWITCHING_PROTOCOLS = 101;
+// DAV extensions
+const sal_uInt16 SC_PROCESSING = 102;
+
+//2xx (Successful - no errors)
+const sal_uInt16 SC_OK = 200;
+const sal_uInt16 SC_CREATED = 201;
+const sal_uInt16 SC_ACCEPTED = 202;
+const sal_uInt16 SC_NON_AUTHORITATIVE_INFORMATION = 203;
+const sal_uInt16 SC_NO_CONTENT = 204;
+const sal_uInt16 SC_RESET_CONTENT = 205;
+const sal_uInt16 SC_PARTIAL_CONTENT = 206;
+// DAV extensions
+const sal_uInt16 SC_MULTISTATUS = 207;
+
+//3xx (Redirection)
+const sal_uInt16 SC_MULTIPLE_CHOICES = 300;
+const sal_uInt16 SC_MOVED_PERMANENTLY = 301;
+const sal_uInt16 SC_MOVED_TEMPORARILY = 302;
+const sal_uInt16 SC_SEE_OTHER = 303;
+const sal_uInt16 SC_NOT_MODIFIED = 304;
+const sal_uInt16 SC_USE_PROXY = 305;
+const sal_uInt16 SC_TEMPORARY_REDIRECT = 307;
+
+//4xx (Client error)
+const sal_uInt16 SC_BAD_REQUEST = 400;
+const sal_uInt16 SC_UNAUTHORIZED = 401;
+const sal_uInt16 SC_PAYMENT_REQUIRED = 402;
+const sal_uInt16 SC_FORBIDDEN = 403;
+const sal_uInt16 SC_NOT_FOUND = 404;
+const sal_uInt16 SC_METHOD_NOT_ALLOWED = 405;
+const sal_uInt16 SC_NOT_ACCEPTABLE = 406;
+const sal_uInt16 SC_PROXY_AUTHENTICATION_REQUIRED = 407;
+const sal_uInt16 SC_REQUEST_TIMEOUT = 408;
+const sal_uInt16 SC_CONFLICT = 409;
+const sal_uInt16 SC_GONE = 410;
+const sal_uInt16 SC_LENGTH_REQUIRED = 411;
+const sal_uInt16 SC_PRECONDITION_FAILED = 412;
+const sal_uInt16 SC_REQUEST_ENTITY_TOO_LARGE = 413;
+const sal_uInt16 SC_REQUEST_URI_TOO_LONG = 414;
+const sal_uInt16 SC_UNSUPPORTED_MEDIA_TYPE = 415;
+const sal_uInt16 SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
+const sal_uInt16 SC_EXPECTATION_FAILED = 417;
+// DAV extensions
+const sal_uInt16 SC_UNPROCESSABLE_ENTITY = 422;
+const sal_uInt16 SC_LOCKED = 423;
+const sal_uInt16 SC_FAILED_DEPENDENCY = 424;
+
+//5xx (Server error)
+const sal_uInt16 SC_INTERNAL_SERVER_ERROR = 500;
+const sal_uInt16 SC_NOT_IMPLEMENTED = 501;
+const sal_uInt16 SC_BAD_GATEWAY = 502;
+const sal_uInt16 SC_SERVICE_UNAVAILABLE = 503;
+const sal_uInt16 SC_GATEWAY_TIMEOUT = 504;
+const sal_uInt16 SC_HTTP_VERSION_NOT_SUPPORTED = 505;
+// DAV extensions
+const sal_uInt16 SC_INSUFFICIENT_STORAGE = 507;
+
+/////////////////////////////////////////////////////////////////////////////
+
class DAVException
{
public:
@@ -92,11 +160,11 @@ class DAVException
public:
DAVException( ExceptionCode inExceptionCode ) :
- mExceptionCode( inExceptionCode ), mStatusCode( 0 ) {};
+ mExceptionCode( inExceptionCode ), mStatusCode( SC_NONE ) {};
DAVException( ExceptionCode inExceptionCode,
const rtl::OUString & rData ) :
mExceptionCode( inExceptionCode ), mData( rData ),
- mStatusCode( 0 ) {};
+ mStatusCode( SC_NONE ) {};
DAVException( ExceptionCode inExceptionCode,
const rtl::OUString & rData,
sal_uInt16 nStatusCode ) :
diff --git a/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx b/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx
index 8fec1b14b5..89c06cbfe4 100644
--- a/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx
+++ b/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DAVRequestEnvironment.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: kso $ $Date: 2002-09-24 14:15:49 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,12 +74,14 @@ namespace webdav_ucp
struct DAVRequestEnvironment
{
+ rtl::OUString m_aRequestURI;
rtl::Reference< DAVAuthListener > m_xAuthListener;
// rtl::Reference< DAVStatusListener > m_xStatusListener;
// rtl::Reference< DAVProgressListener > m_xStatusListener;
- DAVRequestEnvironment( const rtl::Reference< DAVAuthListener > & xListener )
- : m_xAuthListener( xListener ) {}
+ DAVRequestEnvironment( const rtl::OUString & rRequestURI,
+ const rtl::Reference< DAVAuthListener > & xListener )
+ : m_aRequestURI( rRequestURI ), m_xAuthListener( xListener ) {}
DAVRequestEnvironment() {}
};
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
index fee0382b65..9b246bfb01 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DAVResourceAccess.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: kso $ $Date: 2002-10-24 11:59:10 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -216,6 +216,7 @@ void DAVResourceAccess::OPTIONS( DAVCapabilities & rCapabilities,
m_xSession->OPTIONS( getRequestURI(),
rCapabilities,
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
@@ -249,6 +250,7 @@ void DAVResourceAccess::PROPFIND( const Depth nDepth,
rPropertyNames,
rResources,
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
@@ -280,6 +282,7 @@ void DAVResourceAccess::PROPFIND( const Depth nDepth,
nDepth,
rResInfo,
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) ) ;
}
catch ( DAVException & e )
@@ -309,6 +312,7 @@ void DAVResourceAccess::PROPPATCH( const std::vector< ProppatchValue >& rValues,
m_xSession->PROPPATCH( getRequestURI(),
rValues,
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
@@ -340,6 +344,7 @@ void DAVResourceAccess::HEAD( const std::vector< rtl::OUString > & rHeaderNames,
rHeaderNames,
rResource,
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
@@ -368,6 +373,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
{
xStream = m_xSession->GET( getRequestURI(),
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
@@ -399,6 +405,7 @@ void DAVResourceAccess::GET( uno::Reference< io::XOutputStream > & rStream,
m_xSession->GET( getRequestURI(),
rStream,
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
@@ -431,6 +438,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
rHeaderNames,
rResource,
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
@@ -466,6 +474,7 @@ void DAVResourceAccess::GET(
rHeaderNames,
rResource,
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
@@ -495,6 +504,7 @@ void DAVResourceAccess::PUT( const uno::Reference< io::XInputStream > & rStream,
m_xSession->PUT( getRequestURI(),
rStream,
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
@@ -529,6 +539,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST(
rReferer,
rInputStream,
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
@@ -567,6 +578,7 @@ void DAVResourceAccess::POST(
rInputStream,
rOutputStream,
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
@@ -594,6 +606,7 @@ void DAVResourceAccess::MKCOL( const uno::Reference<
{
m_xSession->MKCOL( getRequestURI(),
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
@@ -625,6 +638,7 @@ void DAVResourceAccess::COPY( const ::rtl::OUString & rSourcePath,
m_xSession->COPY( rSourcePath,
rDestinationURI,
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ),
bOverwrite );
}
@@ -657,6 +671,7 @@ void DAVResourceAccess::MOVE( const ::rtl::OUString & rSourcePath,
m_xSession->MOVE( rSourcePath,
rDestinationURI,
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ),
bOverwrite );
}
@@ -685,6 +700,7 @@ void DAVResourceAccess::DESTROY( const uno::Reference<
{
m_xSession->DESTROY( getRequestURI(),
DAVRequestEnvironment(
+ getRequestURI(),
new AuthListener( xEnv ) ) );
}
catch ( DAVException & e )
diff --git a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx
index 0011e1c3ff..f5cdbba649 100644
--- a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx
+++ b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: NeonPropFindRequest.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: kso $ $Date: 2002-08-22 14:44:27 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -147,6 +147,7 @@ extern "C" int NPFR_propfind_iter( void* userdata,
pname->name, "resourcetype" ) == 0 )
{
OString aValue( value );
+ aValue = aValue.trim(); // #107358# remove leading/trailing spaces
if ( aValue.getLength() )
{
aValue = aValue.toAsciiLowerCase();
@@ -156,15 +157,12 @@ extern "C" int NPFR_propfind_iter( void* userdata,
thePropertyValue.Value
<<= OUString::createFromAscii( "collection" );
}
- else
- {
- thePropertyValue.Value
- <<= OUString::createFromAscii( value );
- }
}
- else
+
+ if ( !thePropertyValue.Value.hasValue() )
{
- thePropertyValue.Value <<= OUString();
+ // Take over the value exactly as supplied by the server.
+ thePropertyValue.Value <<= OUString::createFromAscii( value );
}
}
else if ( rtl_str_compareIgnoreAsciiCase(
diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx
index 09430e832b..fcdeacef2e 100644
--- a/ucb/source/ucp/webdav/NeonSession.cxx
+++ b/ucb/source/ucp/webdav/NeonSession.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: NeonSession.cxx,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: kso $ $Date: 2002-10-28 16:20:08 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -271,6 +271,17 @@ extern "C" int NeonSession_NeonAuth( void * inUserData,
char * inoutUserName,
char * inoutPassWord )
{
+/* The callback used to request the username and password in the given
+ * realm. The username and password must be copied into the buffers
+ * which are both of size NE_ABUFSIZ. The 'attempt' parameter is zero
+ * on the first call to the callback, and increases by one each time
+ * an attempt to authenticate fails.
+ *
+ * The callback must return zero to indicate that authentication
+ * should be attempted with the username/password, or non-zero to
+ * cancel the request. (if non-zero, username and password are
+ * ignored.) */
+
#if 0
// Give'em only a limited mumber of retries..
if ( attempt > 9 )
@@ -288,24 +299,65 @@ extern "C" int NeonSession_NeonAuth( void * inUserData,
// abort
return -1;
}
+ rtl::OUString theUserName;
+ rtl::OUString thePassWord;
+
+ if ( attempt == 0 )
+ {
+ // neon does not handle username supplied with request URI (for instance
+ // when doing FTP over proxy - last checked: 0.23.5 )
- // username buffer is prefilled with user name from last attempt.
- rtl::OUString theUserName(
- rtl::OUString::createFromAscii( inoutUserName ) );
- rtl::OUString thePassWord; /*(
- // @@@ Neon does not initialize password buffer
- // (last checked: 0.22.0).
- rtl::OUString::createFromAscii( inoutPassWord ) ); */
+ NeonUri uri( theSession->getRequestEnvironment().m_aRequestURI );
+ rtl::OUString aUserInfo( uri.GetUserInfo() );
+ if ( aUserInfo.getLength() )
+ {
+ sal_Int32 nPos = aUserInfo.indexOf( '@' );
+ if ( nPos == -1 )
+ {
+ theUserName = aUserInfo;
+ }
+ else
+ {
+ theUserName = aUserInfo.copy( 0, nPos );
+ thePassWord = aUserInfo.copy( nPos + 1 );
+ }
+ }
+ }
+ else
+ {
+ // username buffer is prefilled with user name from last attempt.
+ theUserName = rtl::OUString::createFromAscii( inoutUserName );
+ // @@@ Neon does not initialize password buffer (last checked: 0.22.0).
+ //thePassWord = rtl::OUString::createFromAscii( inoutPassWord );
+ }
int theRetVal = pListener->authenticate(
rtl::OUString::createFromAscii( inRealm ),
theSession->getHostName(),
theUserName,
thePassWord );
- strcpy( inoutUserName,
+ rtl::OString aUser(
+ rtl::OUStringToOString( theUserName, RTL_TEXTENCODING_UTF8 ) );
+ if ( aUser.getLength() > ( NE_ABUFSIZ - 1 ) )
+ {
+ OSL_ENSURE(
+ sal_False, "NeonSession_NeonAuth - username to long!" );
+ return -1;
+ }
+
+ rtl::OString aPass(
+ rtl::OUStringToOString( thePassWord, RTL_TEXTENCODING_UTF8 ) );
+ if ( aPass.getLength() > ( NE_ABUFSIZ - 1 ) )
+ {
+ OSL_ENSURE(
+ sal_False, "NeonSession_NeonAuth - password to long!" );
+ return -1;
+ }
+
+ strcpy( inoutUserName, // #100211# - checked
rtl::OUStringToOString( theUserName, RTL_TEXTENCODING_UTF8 ) );
- strcpy( inoutPassWord,
+ strcpy( inoutPassWord, // #100211# - checked
rtl::OUStringToOString( thePassWord, RTL_TEXTENCODING_UTF8 ) );
return theRetVal;
diff --git a/ucb/source/ucp/webdav/makefile.mk b/ucb/source/ucp/webdav/makefile.mk
index f3af5b8e72..43bfc7dfad 100644
--- a/ucb/source/ucp/webdav/makefile.mk
+++ b/ucb/source/ucp/webdav/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.17 $
+# $Revision: 1.18 $
#
-# last change: $Author: kso $ $Date: 2002-10-28 16:20:12 $
+# last change: $Author: hr $ $Date: 2003-03-27 17:27:20 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -118,7 +118,7 @@ LIB1OBJFILES=$(SLOFILES)
SHL1TARGET=$(TARGET)$(UCP_VERSION)
SHL1IMPLIB=i$(TARGET)
-.IF "$(OS)"=="MACOSX" || "$(OS)"=="FREEBSD"
+.IF "$(OS)"=="MACOSX"
.ELSE
SHL1VERSIONMAP=exports.map
.ENDIF
diff --git a/ucb/source/ucp/webdav/ucpdav.xml b/ucb/source/ucp/webdav/ucpdav.xml
index 45e25f9347..1b083a7c15 100644
--- a/ucb/source/ucp/webdav/ucpdav.xml
+++ b/ucb/source/ucp/webdav/ucpdav.xml
@@ -69,6 +69,7 @@
<type> com.sun.star.task.XInteractionAbort </type>
<type> com.sun.star.task.XInteractionReply </type>
<type> com.sun.star.ucb.AuthenticationRequest </type>
+ <type> com.sun.star.ucb.CommandFailedException </type>
<type> com.sun.star.ucb.ContentCreationException </type>
<type> com.sun.star.ucb.ContentInfoAttribute </type>
<type> com.sun.star.ucb.InsertCommandArgument </type>
diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index 90ee24aaa0..7082754a21 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: webdavcontent.cxx,v $
*
- * $Revision: 1.37 $
+ * $Revision: 1.38 $
*
- * last change: $Author: kso $ $Date: 2002-10-21 10:28:39 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -92,6 +92,9 @@
#ifndef _COM_SUN_STAR_LANG_ILLEGALACCESSEXCEPTION_HPP_
#include <com/sun/star/lang/IllegalAccessException.hpp>
#endif
+#ifndef _COM_SUN_STAR_UCB_COMMANDFAILEDEXCEPTION_HPP_
+#include <com/sun/star/ucb/CommandFailedException.hpp>
+#endif
#ifndef _COM_SUN_STAR_UCB_CONTENTINFOATTRIBUTE_HPP_
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#endif
@@ -168,8 +171,8 @@
#ifndef _UCBHELPER_PROPERTYVALUESET_HXX
#include <ucbhelper/propertyvalueset.hxx>
#endif
-#ifndef _UCBHELPER_INTERACTIONREQUEST_HXX
-#include <ucbhelper/interactionrequest.hxx>
+#ifndef _UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX
+#include <ucbhelper/simpleinteractionrequest.hxx>
#endif
#ifndef _UCBHELPER_CANCELCOMMANDEXECUTION_HXX_
#include <ucbhelper/cancelcommandexecution.hxx>
@@ -215,6 +218,7 @@ Content::Content(
rtl::Reference< DAVSessionFactory > const & rSessionFactory )
throw ( star::ucb::ContentCreationException )
: ContentImplHelper( rxSMgr, pProvider, Identifier ),
+ m_eResourceType( UNKNOWN ),
m_pProvider( pProvider ),
m_bTransient( sal_False ),
m_bCollection( sal_False )
@@ -243,6 +247,7 @@ Content::Content(
sal_Bool isCollection )
throw ( star::ucb::ContentCreationException )
: ContentImplHelper( rxSMgr, pProvider, Identifier, sal_False ),
+ m_eResourceType( UNKNOWN ),
m_pProvider( pProvider ),
m_bTransient( sal_True ),
m_bCollection( isCollection )
@@ -297,10 +302,25 @@ uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType )
uno::Any aRet = cppu::queryInterface( rType,
static_cast< star::ucb::XContentCreator * >( this ) );
if ( aRet.hasValue() )
- return isFolder( uno::Reference< star::ucb::XCommandEnvironment >() )
- ? aRet
- : uno::Any();
-
+ {
+ try
+ {
+ return isFolder(
+ uno::Reference< star::ucb::XCommandEnvironment >() )
+ ? aRet
+ : uno::Any();
+ }
+ catch ( uno::RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( uno::Exception const & )
+ {
+ OSL_ENSURE( sal_False,
+ "Content::queryInterface - caught exception." );
+ return uno::Any();
+ }
+ }
return aRet.hasValue() ? aRet : ContentImplHelper::queryInterface( rType );
}
@@ -324,8 +344,24 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
if ( !pCollection )
{
- if ( isFolder(
- uno::Reference< star::ucb::XCommandEnvironment >() ) )
+ sal_Bool bFolder = sal_False;
+ try
+ {
+ bFolder
+ = isFolder(
+ uno::Reference< star::ucb::XCommandEnvironment >() );
+ }
+ catch ( uno::RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( uno::Exception const & )
+ {
+ OSL_ENSURE( sal_False,
+ "Content::getTypes - caught exception." );
+ }
+
+ if ( bFolder )
{
static cppu::OTypeCollection aCollection(
CPPU_TYPE_REF( lang::XTypeProvider ),
@@ -396,7 +432,23 @@ uno::Sequence< rtl::OUString > SAL_CALL Content::getSupportedServiceNames()
rtl::OUString SAL_CALL Content::getContentType()
throw( uno::RuntimeException )
{
- if ( isFolder( uno::Reference< star::ucb::XCommandEnvironment >() ) )
+ sal_Bool bFolder = sal_False;
+ try
+ {
+ bFolder
+ = isFolder(
+ uno::Reference< star::ucb::XCommandEnvironment >() );
+ }
+ catch ( uno::RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( uno::Exception const & )
+ {
+ OSL_ENSURE( sal_False, "Content::getContentType - caught exception" );
+ }
+
+ if ( bFolder )
return rtl::OUString::createFromAscii( WEBDAV_COLLECTION_TYPE );
return rtl::OUString::createFromAscii( WEBDAV_CONTENT_TYPE );
@@ -889,7 +941,7 @@ void SAL_CALL Content::addProperty( const rtl::OUString& Name,
}
catch ( DAVException const & e )
{
- if ( e.getStatus() == 403 /* FORBIDDEN */ )
+ if ( e.getStatus() == SC_FORBIDDEN )
{
// Support for setting arbitrary dead properties is optional!
@@ -898,28 +950,44 @@ void SAL_CALL Content::addProperty( const rtl::OUString& Name,
}
else
{
- try
+ if ( shouldAccessNetworkAfterException( e ) )
{
- DAVCapabilities caps;
- m_xResAccess->OPTIONS( caps, xEnv );
-
- if ( caps.class1 )
+ try
{
- // DAV resource!
- throw lang::IllegalArgumentException();
+ const ResourceType & rType = getResourceType( xEnv );
+ switch ( rType )
+ {
+ case UNKNOWN:
+ case DAV:
+ throw lang::IllegalArgumentException();
+
+ case FTP:
+ case NON_DAV:
+ // Store property locally.
+ ContentImplHelper::addProperty( Name,
+ Attributes,
+ DefaultValue );
+ break;
+
+ default:
+ OSL_ENSURE( sal_False,
+ "Content::addProperty - "
+ "Unsupported resource type!" );
+ break;
+ }
}
- else
+ catch ( uno::Exception const & )
{
- // HTTP resource!
-
- // Store property locally.
- ContentImplHelper::addProperty(
- Name, Attributes, DefaultValue );
+ OSL_ENSURE( sal_False,
+ "Content::addProperty - "
+ "Unable to determine resource type!" );
}
}
- catch ( DAVException const & )
+ else
{
- throw lang::IllegalArgumentException();
+ OSL_ENSURE( sal_False,
+ "Content::addProperty - "
+ "Unable to determine resource type!" );
}
}
}
@@ -983,7 +1051,7 @@ void SAL_CALL Content::removeProperty( const rtl::OUString& Name )
}
catch ( DAVException const & e )
{
- if ( e.getStatus() == 403 /* FORBIDDEN */ )
+ if ( e.getStatus() == SC_FORBIDDEN )
{
// Support for setting arbitrary dead properties is optional!
@@ -992,27 +1060,43 @@ void SAL_CALL Content::removeProperty( const rtl::OUString& Name )
}
else
{
- try
+ if ( shouldAccessNetworkAfterException( e ) )
{
- DAVCapabilities caps;
- m_xResAccess->OPTIONS( caps, xEnv );
-
- if ( caps.class1 )
+ try
{
- // DAV resource!
- throw beans::UnknownPropertyException();
+ const ResourceType & rType = getResourceType( xEnv );
+ switch ( rType )
+ {
+ case UNKNOWN:
+ case DAV:
+ throw beans::UnknownPropertyException();
+
+ case FTP:
+ case NON_DAV:
+ // Try to remove property from local store.
+ ContentImplHelper::removeProperty( Name );
+ break;
+
+ default:
+ OSL_ENSURE( sal_False,
+ "Content::removeProperty - "
+ "Unsupported resource type!" );
+ break;
+ }
}
- else
+ catch ( uno::Exception const & )
{
- // HTTP resource!
-
- // Try to remove property from local store.
- ContentImplHelper::removeProperty( Name );
+ OSL_ENSURE( sal_False,
+ "Content::removeProperty - "
+ "Unable to determine resource type!" );
}
}
- catch ( DAVException const & )
+ else
{
- throw beans::UnknownPropertyException();
+ OSL_ENSURE( sal_False,
+ "Content::removeProperty - "
+ "Unable to determine resource type!" );
+// throw beans::UnknownPropertyException();
}
}
}
@@ -1263,6 +1347,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
uno::Reference< sdbc::XRow > Content::getPropertyValues(
const uno::Sequence< beans::Property >& rProperties,
const uno::Reference< star::ucb::XCommandEnvironment >& xEnv )
+ throw ( uno::Exception )
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -1275,8 +1360,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
std::vector< rtl::OUString > aMissingProps;
if ( m_xCachedProps->containsAllNames( rProperties, aMissingProps ) )
{
- // All requested properties are already in cache! No server
- // access needed.
+ // All properties are already in cache! No server access needed.
bHasAll = true;
xProps.reset( new ContentProperties( *m_xCachedProps.get() ) );
}
@@ -1305,95 +1389,145 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
if ( !xProps.get() )
{
+ /////////////////////////////////////////////////////////////////////
// Obtain values from server...
+ /////////////////////////////////////////////////////////////////////
- bool bNetAccessSucceeded = false;
- std::vector< DAVResource > resources;
-
- std::vector< rtl::OUString > aPropNames;
- ContentProperties::UCBNamesToDAVNames( rProperties, aPropNames );
-
- if ( aPropNames.size() > 0 )
+ // First, identify whether resource is DAV or not
+ const ResourceType & rType = getResourceType( xEnv );
+ if ( rType == UNKNOWN )
{
- try
- {
- m_xResAccess->PROPFIND( ZERO, aPropNames, resources, xEnv );
- bNetAccessSucceeded = true;
- }
- catch ( DAVException const & e )
- {
- if ( ( e.getStatus() == 404 /* not found */ ) ||
- ( e.getError() == DAVException::DAV_HTTP_LOOKUP ) ||
- ( e.getError() == DAVException::DAV_HTTP_AUTH ) ||
- ( e.getError() == DAVException::DAV_HTTP_AUTHPROXY ) )
- {
- // Resource not accessable, only Title property available.
- xProps.reset( new ContentProperties(
- NeonUri::unescape( m_aEscapedTitle ) ) );
- }
- }
- }
- else
- {
- bNetAccessSucceeded = true;
+ xProps.reset(
+ new ContentProperties(
+ NeonUri::unescape( m_aEscapedTitle ) ) );
}
if ( !xProps.get() )
{
- if ( !bNetAccessSucceeded )
- {
- // PROPFIND failed. Try a HEAD request; possibly the requested
- // properties can by obtained this way.
+ bool bNetworkAccessAllowed = true;
- std::vector< rtl::OUString > aHeaderNames;
- ContentProperties::UCBNamesToHTTPNames(
- rProperties, aHeaderNames, false /* bIncludeUnmatched */ );
+ if ( rType == DAV )
+ {
+ // Only DAV resources support PROPFIND
- // Note: Setting bIncludeUnmatched to true would provide support
- // for obtaining arbitrary header values, but will result in
- // additional network traffic (HEAD requests). For the moment it
- // is okay only to support the header values which can be mapped
- // to UCB properties (like "Content-Length" header <-> "Size"
- // property)
+ std::vector< rtl::OUString > aPropNames;
+ ContentProperties::UCBNamesToDAVNames(
+ rProperties, aPropNames );
- if ( aHeaderNames.size() > 0 )
+ if ( aPropNames.size() > 0 )
{
+ std::vector< DAVResource > resources;
+
try
{
- resources.clear();
-
- DAVResource resource;
- m_xResAccess->HEAD( aHeaderNames, resource, xEnv );
-
- resources.push_back( resource );
- bNetAccessSucceeded = true;
+ m_xResAccess->PROPFIND(
+ ZERO, aPropNames, resources, xEnv );
}
- catch ( DAVException const & )
+ catch ( DAVException const & e )
{
- bNetAccessSucceeded = false;
+ bNetworkAccessAllowed
+ = shouldAccessNetworkAfterException( e );
+
+ if ( !bNetworkAccessAllowed )
+ {
+ cancelCommandExecution( e, xEnv );
+ // unreachable
+ }
}
+
+ if ( resources.size() == 1 )
+ xProps.reset( new ContentProperties( resources[ 0 ] ) );
}
}
- bNetAccessSucceeded &= ( resources.size() == 1 );
-
- if ( bNetAccessSucceeded )
+ if ( bNetworkAccessAllowed )
{
- xProps.reset( new ContentProperties( resources[ 0 ] ) );
+ // All properties obtained already?
+ std::vector< rtl::OUString > aMissingProps;
+ if ( !( xProps.get()
+ && xProps->containsAllNames(
+ rProperties, aMissingProps ) ) )
+ {
+ // Possibly the missing props can be obtained using a HEAD
+ // request.
+
+ std::vector< rtl::OUString > aHeaderNames;
+ ContentProperties::UCBNamesToHTTPNames(
+ rProperties,
+ aHeaderNames,
+ false /* bIncludeUnmatched */ );
+
+ // Note: Setting bIncludeUnmatched to true would provide
+ // support for obtaining arbitrary header values, but will
+ // result in additional network traffic (HEAD requests).
+ // For the moment it is okay only to support the header
+ // values which can be mapped to UCB properties (like
+ // "Content-Length" header <-> "Size" property)
+
+ if ( aHeaderNames.size() > 0 )
+ {
+ try
+ {
+ DAVResource resource;
+ m_xResAccess->HEAD( aHeaderNames, resource, xEnv );
+
+ if ( xProps.get() )
+ {
+ xProps->addProperties(
+ aMissingProps,
+ ContentProperties( resource ) );
+ }
+ else
+ {
+ xProps.reset(
+ new ContentProperties( resource ) );
+ }
+
+ if ( rType == NON_DAV )
+ xProps->addProperties( aMissingProps,
+ ContentProperties(
+ NeonUri::unescape(
+ m_aEscapedTitle ),
+ false ) );
+ }
+ catch ( DAVException const & e )
+ {
+ bNetworkAccessAllowed
+ = shouldAccessNetworkAfterException( e );
+
+ if ( !bNetworkAccessAllowed )
+ {
+ cancelCommandExecution( e, xEnv );
+ // unreachable
+ }
+ }
+ }
+ }
}
- else
+
+ if ( !xProps.get() )
{
- xProps.reset( new ContentProperties(
- NeonUri::unescape( m_aEscapedTitle ) ) );
+ // For DAV resources we only know the Title, for non-DAV
+ // resources we additionally know that it is a document.
+ if ( rType == DAV )
+ {
+ xProps.reset(
+ new ContentProperties(
+ NeonUri::unescape( m_aEscapedTitle ) ) );
+ }
+ else
+ {
+ xProps.reset(
+ new ContentProperties(
+ NeonUri::unescape( m_aEscapedTitle ), false ) );
+ }
}
}
}
- OSL_ENSURE( xProps.get(), "Content::getPropertyValues - no properties!" );
-
- // All values obtained? If not, is there something valueable in the local
- // cache?
+// OSL_ENSURE( xProps.get(), "Content::getPropertyValues - no properties!" );
+ // All values obtained? If not, is there something valueable in the cache?
if ( !bHasAll && m_xCachedProps.get() )
{
std::vector< rtl::OUString > aMissingProps;
@@ -1443,6 +1577,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
uno::Sequence< uno::Any > Content::setPropertyValues(
const uno::Sequence< beans::PropertyValue >& rValues,
const uno::Reference< star::ucb::XCommandEnvironment >& xEnv )
+ throw ( uno::Exception )
{
osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
@@ -1458,9 +1593,6 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
// aEvent.OldValue =
// aEvent.NewValue =
- sal_Bool bCheckedForDAV = sal_False;
- sal_Bool bDAV = sal_False;
-
std::vector< ProppatchValue > aProppatchValues;
std::vector< sal_Int32 > aProppatchPropsPositions;
@@ -1626,23 +1758,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
}
else
{
- if ( !bCheckedForDAV )
- {
- bCheckedForDAV = sal_True;
-
- try
- {
- DAVCapabilities caps;
- m_xResAccess->OPTIONS( caps, xEnv );
- bDAV = caps.class1;
- }
- catch ( DAVException const & )
- {
- bDAV = sal_False;
- }
- }
-
- if ( bDAV )
+ if ( getResourceType( xEnv ) == DAV )
{
// Property value will be set on server.
ProppatchValue aValue( PROPSET, rName, rValue.Value );
@@ -1740,6 +1856,10 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
// OSL_ENSURE( sal_False,
// "Content::setPropertyValues - PROPPATCH failed!" );
+#if 1
+ cancelCommandExecution( e, xEnv );
+ // unreachable
+#else
// Note: PROPPATCH either sets ALL property values OR NOTHING.
std::vector< sal_Int32 >::const_iterator it
@@ -1749,10 +1869,11 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
while ( it != end )
{
- // Set error .
+ // Set error.
aRet[ (*it) ] <<= MapDAVException( e, sal_True );
++it;
}
+#endif
}
}
@@ -1920,42 +2041,85 @@ void Content::insert(
// Unreachable
}
-#if 0
- // This an API change that will be done in the future!!!
-
- /* [RFC 2616] - HTTP
+ if ( !bReplaceExisting )
+ {
+ /* [RFC 2616] - HTTP
- The PUT method requests that the enclosed entity be stored under the
- supplied Request-URI. If the Request-URI refers to an already
- existing resource, the enclosed entity SHOULD be considered as a
- modified version of the one residing on the origin server.
- */
+ The PUT method requests that the enclosed entity be stored under the
+ supplied Request-URI. If the Request-URI refers to an already
+ existing resource, the enclosed entity SHOULD be considered as a
+ modified version of the one residing on the origin server.
+ */
- /* [RFC 2518] - WebDAV
+ /* [RFC 2518] - WebDAV
- MKCOL creates a new collection resource at the location specified by
- the Request-URI. If the resource identified by the Request-URI is
- non-null then the MKCOL MUST fail.
- */
+ MKCOL creates a new collection resource at the location specified by
+ the Request-URI. If the resource identified by the Request-URI is
+ non-null then the MKCOL MUST fail.
+ */
- if ( !bReplaceExisting )
- {
- // Complain on PUT, continue on MKCOL.
+ // ==> Complain on PUT, continue on MKCOL.
if ( !m_bTransient || ( m_bTransient && !m_bCollection ) )
{
- ucbhelper::cancelCommandExecution(
- uno::makeAny(
- star::ucb::UnsupportedNameClashException(
- rtl::OUString::createFromAscii(
- "Unable to write without overwrite!" ),
- static_cast< cppu::OWeakObject * >( this ),
- star::ucb::NameClash::ERROR ) ),
- Environment );
+ uno::Any aEx( uno::makeAny(
+ star::ucb::UnsupportedNameClashException(
+ rtl::OUString::createFromAscii(
+ "Unable to write without overwrite!" ),
+ static_cast< cppu::OWeakObject * >( this ),
+ star::ucb::NameClash::ERROR ) ) );
- // Unreachable
+ uno::Reference< task::XInteractionHandler > xIH
+ = Environment->getInteractionHandler();
+ if ( xIH.is() )
+ {
+ rtl::Reference< ucbhelper::SimpleInteractionRequest > xRequest
+ = new ucbhelper::SimpleInteractionRequest(
+ aEx,
+ ucbhelper::CONTINUATION_APPROVE
+ | ucbhelper::CONTINUATION_DISAPPROVE );
+ xIH->handle( xRequest.get() );
+
+ const sal_Int32 nResp = xRequest->getResponse();
+
+ switch ( nResp )
+ {
+ case ucbhelper::CONTINUATION_UNKNOWN:
+ // Not handled; throw.
+ throw aEx;
+// break;
+
+ case ucbhelper::CONTINUATION_APPROVE:
+ // Continue -> Overwrite.
+ bReplaceExisting = sal_True;
+ break;
+
+ case ucbhelper::CONTINUATION_DISAPPROVE:
+ // Abort.
+ throw star::ucb::CommandFailedException(
+ rtl::OUString(),
+ uno::Reference< uno::XInterface >(),
+ aEx );
+// break;
+
+ default:
+ OSL_ENSURE( sal_False,
+ "Content::insert - "
+ "Unknown interaction selection!" );
+ throw star::ucb::CommandFailedException(
+ rtl::OUString::createFromAscii(
+ "Unknown interaction selection!" ),
+ uno::Reference< uno::XInterface >(),
+ aEx );
+// break;
+ }
+ }
+ else
+ {
+ // No IH; throw.
+ throw aEx;
+ }
}
}
-#endif
if ( m_bTransient )
{
@@ -1979,7 +2143,7 @@ void Content::insert(
{
if ( m_bCollection )
{
- if ( e.getStatus() == 405 )
+ if ( e.getStatus() == SC_METHOD_NOT_ALLOWED )
{
// [RFC 2518] - WebDAV
// 405 (Method Not Allowed) - MKCOL can only be
@@ -2225,7 +2389,7 @@ void Content::transfer(
// XML element or the Overwrite header is "F" and the state of
// the destination resource is non-null.
- if ( e.getStatus() == 412 )
+ if ( e.getStatus() == SC_PRECONDITION_FAILED )
{
switch ( rArgs.NameClash )
{
@@ -2367,36 +2531,29 @@ sal_Bool Content::exchangeIdentity(
//=========================================================================
sal_Bool Content::isFolder(
const uno::Reference< star::ucb::XCommandEnvironment >& xEnv )
+ throw( uno::Exception )
{
if ( m_bTransient )
{
return m_bCollection;
}
- else
- {
- std::vector< rtl::OUString > aPropNames;
- aPropNames.push_back( DAVProperties::RESOURCETYPE );
- std::vector< DAVResource > resources;
+ uno::Sequence< beans::Property > aProperties( 1 );
+ aProperties[ 0 ].Name = rtl::OUString::createFromAscii( "IsFolder" );
+ aProperties[ 0 ].Handle = -1;
+ uno::Reference< sdbc::XRow > xRow( getPropertyValues( aProperties, xEnv ) );
+ if ( xRow.is() )
+ {
try
{
- m_xResAccess->PROPFIND( ZERO, aPropNames, resources, xEnv );
+ return xRow->getBoolean( 1 );
}
- catch ( DAVException const & )
+ catch ( sdbc::SQLException const & )
{
- }
-
- if ( resources.size() != 1 )
- return sal_False;
-
- ContentProperties aContentProperties( resources[ 0 ] );
- const uno::Any & rValue
- = aContentProperties.getValue(
- rtl::OUString::createFromAscii( "IsFolder" ) );
- sal_Bool bFolder = sal_False;
- rValue >>= bFolder;
- return bFolder;
+ }
}
+
+ return sal_False;
}
//=========================================================================
@@ -2407,7 +2564,7 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite )
switch ( e.getStatus() )
{
- case 404: // Not Found
+ case SC_NOT_FOUND:
{
uno::Sequence< uno::Any > aArgs( 1 );
aArgs[ 0 ] <<= m_xIdentifier->getContentIdentifier();
@@ -2506,6 +2663,20 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite )
}
//=========================================================================
+// static
+bool Content::shouldAccessNetworkAfterException( const DAVException & e )
+{
+ if ( ( e.getStatus() == SC_NOT_FOUND ) ||
+ ( e.getError() == DAVException::DAV_HTTP_LOOKUP ) ||
+ ( e.getError() == DAVException::DAV_HTTP_CONNECT ) ||
+ ( e.getError() == DAVException::DAV_HTTP_AUTH ) ||
+ ( e.getError() == DAVException::DAV_HTTP_AUTHPROXY ) )
+ return false;
+
+ return true;
+}
+
+//=========================================================================
void Content::cancelCommandExecution(
const DAVException & e,
const uno::Reference< star::ucb::XCommandEnvironment > & xEnv,
@@ -2545,3 +2716,99 @@ const rtl::OUString Content::getBaseURI()
return rtl::OUString( m_xResAccess->getURL() );
}
+//=========================================================================
+const Content::ResourceType & Content::getResourceType(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
+ throw ( uno::Exception )
+{
+ if ( m_eResourceType == UNKNOWN )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ if ( m_eResourceType == UNKNOWN )
+ {
+ const rtl::OUString & rURL = m_xResAccess->getURL();
+ const rtl::OUString aScheme(
+ rURL.copy( 0, rURL.indexOf( ':' ) ).toAsciiLowerCase() );
+
+ if ( aScheme.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( FTP_URL_SCHEME ) ) )
+ {
+ m_eResourceType = FTP;
+ }
+ else
+ {
+ try
+ {
+ DAVCapabilities caps;
+ m_xResAccess->OPTIONS( caps, xEnv );
+
+ if ( caps.class1 )
+ {
+ // DAV resource
+ m_eResourceType = DAV;
+ }
+ else
+ {
+ // HTTP (non-DAV) resource
+ m_eResourceType = NON_DAV;
+ }
+ }
+ catch ( DAVException const & e )
+ {
+ if ( shouldAccessNetworkAfterException( e ) )
+ {
+ // OPTIONS is an optional HTTP method. Server can reply
+ // with an error message. Last chance: try a PROPFIND
+ // obtain resourcetype property. If it succeeds, we know
+ // the resource is DAV enabled. If not, try a HEAD
+ // (mandatory method). If this succeeds, it's an
+ // existing HTTP resource.
+
+ try
+ {
+ std::vector< rtl::OUString > aPropNames;
+ aPropNames.push_back( DAVProperties::RESOURCETYPE );
+ std::vector< DAVResource > resources;
+ m_xResAccess->PROPFIND(
+ ZERO, aPropNames, resources, xEnv );
+
+ m_eResourceType = DAV;
+ }
+ catch ( DAVException const & e )
+ {
+ if ( shouldAccessNetworkAfterException( e ) )
+ {
+ try
+ {
+ std::vector< rtl::OUString > aHeaderNames;
+ DAVResource resource;
+ m_xResAccess->HEAD(
+ aHeaderNames, resource, xEnv );
+
+ m_eResourceType = NON_DAV;
+ }
+ catch ( DAVException const & e )
+ {
+ cancelCommandExecution( e, xEnv );
+ // Unreachable
+ }
+ }
+ else
+ {
+ cancelCommandExecution( e, xEnv );
+ // Unreachable
+ }
+ }
+ }
+ else
+ {
+ cancelCommandExecution( e, xEnv );
+ // Unreachable
+ }
+ }
+ }
+ }
+ }
+ return m_eResourceType;
+}
diff --git a/ucb/source/ucp/webdav/webdavcontent.hxx b/ucb/source/ucp/webdav/webdavcontent.hxx
index 1472c49fca..d79a6235e5 100644
--- a/ucb/source/ucp/webdav/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav/webdavcontent.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: webdavcontent.hxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: kso $ $Date: 2002-09-24 14:15:50 $
+ * last change: $Author: hr $ $Date: 2003-03-27 17:27:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -120,9 +120,18 @@ class ContentProperties;
class Content : public ::ucb::ContentImplHelper,
public com::sun::star::ucb::XContentCreator
{
+ enum ResourceType
+ {
+ UNKNOWN,
+ FTP,
+ NON_DAV,
+ DAV
+ };
+
std::auto_ptr< DAVResourceAccess > m_xResAccess;
std::auto_ptr< ContentProperties > m_xCachedProps; // locally cached props
rtl::OUString m_aEscapedTitle;
+ ResourceType m_eResourceType;
ContentProvider* m_pProvider; // No need for a ref, base class holds object
sal_Bool m_bTransient;
sal_Bool m_bCollection;
@@ -137,7 +146,8 @@ private:
virtual ::rtl::OUString getParentURL();
sal_Bool isFolder( const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
+ ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
+ throw ( ::com::sun::star::uno::Exception );
void getProperties( const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& xEnv,
@@ -147,14 +157,16 @@ private:
getPropertyValues( const ::com::sun::star::uno::Sequence<
::com::sun::star::beans::Property >& rProperties,
const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
+ ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
+ throw ( ::com::sun::star::uno::Exception );
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
- setPropertyValues(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ setPropertyValues(
const ::com::sun::star::uno::Sequence<
::com::sun::star::beans::PropertyValue >& rValues,
const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
+ ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
+ throw ( ::com::sun::star::uno::Exception );
typedef rtl::Reference< Content > ContentRef;
typedef std::list< ContentRef > ContentRefList;
@@ -166,6 +178,11 @@ private:
const rtl::OUString getBaseURI();
+ const ResourceType & getResourceType(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
+ throw ( ::com::sun::star::uno::Exception );
+
// Command "insert"
void insert( const ::com::sun::star::uno::Reference<
::com::sun::star::io::XInputStream > & xInputStream,
@@ -193,6 +210,8 @@ private:
sal_Bool bWrite = sal_False )
throw( ::com::sun::star::uno::Exception );
+ static bool shouldAccessNetworkAfterException( const DAVException & e );
+
public:
Content( const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,