summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connectivity/source/commontools/FValue.cxx8
-rw-r--r--connectivity/source/commontools/dbtools.cxx55
-rw-r--r--connectivity/source/drivers/jdbc/tools.cxx2
-rw-r--r--connectivity/source/parse/PColumn.cxx3
-rw-r--r--connectivity/source/parse/sqlnode.cxx2
-rw-r--r--desktop/source/deployment/misc/dp_ucb.cxx87
-rw-r--r--desktop/source/registration/com/sun/star/servicetag/SystemEnvironment.java29
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx3
-rw-r--r--fileaccess/source/FileAccess.cxx102
-rw-r--r--fpicker/source/office/fpsmartcontent.cxx35
-rw-r--r--sfx2/source/doc/doctempl.cxx25
-rw-r--r--sfx2/source/doc/objstor.cxx62
-rw-r--r--svx/inc/svx/numitem.hxx1
-rw-r--r--svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx1
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeEngine.cxx4
-rw-r--r--svx/source/items/numitem.cxx10
-rw-r--r--svx/source/outliner/outlvw.cxx34
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx23
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx16
-rw-r--r--svx/source/svdraw/svdfmtf.cxx4
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx8
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx1
-rwxr-xr-xucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java13
-rw-r--r--ucb/source/core/cmdenv.cxx194
-rw-r--r--ucb/source/core/cmdenv.hxx105
-rw-r--r--ucb/source/core/makefile.mk7
-rw-r--r--ucb/source/core/ucbcmds.cxx257
-rw-r--r--ucb/source/core/ucbserv.cxx26
-rw-r--r--ucb/source/ucp/file/bc.cxx68
-rw-r--r--ucb/source/ucp/file/filerror.hxx32
-rw-r--r--ucb/source/ucp/file/filglob.cxx67
-rw-r--r--ucb/source/ucp/file/filtask.cxx87
-rw-r--r--ucb/source/ucp/file/filtask.hxx109
-rw-r--r--ucb/source/ucp/file/shell.cxx149
-rw-r--r--ucb/source/ucp/file/shell.hxx18
-rw-r--r--ucb/source/ucp/ftp/ftpcontent.cxx369
-rw-r--r--ucb/source/ucp/ftp/ftpcontent.hxx80
-rw-r--r--ucb/source/ucp/ftp/ftpcontentcaps.cxx74
-rw-r--r--ucb/source/ucp/ftp/ftpdirp.cxx30
-rw-r--r--ucb/source/ucp/ftp/ftpdirp.hxx41
-rw-r--r--ucb/source/ucp/ftp/ftpinpstr.cxx55
-rw-r--r--ucb/source/ucp/ftp/ftpintreq.cxx40
-rw-r--r--ucb/source/ucp/ftp/ftpintreq.hxx70
-rw-r--r--ucb/source/ucp/ftp/ftpresultsetI.cxx16
-rw-r--r--ucb/source/ucp/ftp/ftpurl.cxx29
-rw-r--r--ucb/source/ucp/ftp/ftpurl.hxx68
-rw-r--r--ucb/source/ucp/gio/gio_content.cxx196
-rw-r--r--ucb/source/ucp/gio/gio_content.hxx24
-rw-r--r--ucb/source/ucp/gio/gio_datasupplier.cxx12
-rw-r--r--ucb/source/ucp/gvfs/gvfs_content.cxx (renamed from ucb/source/ucp/gvfs/content.cxx)233
-rw-r--r--ucb/source/ucp/gvfs/gvfs_content.hxx (renamed from ucb/source/ucp/gvfs/content.hxx)91
-rw-r--r--ucb/source/ucp/gvfs/gvfs_directory.cxx (renamed from ucb/source/ucp/gvfs/directory.cxx)18
-rw-r--r--ucb/source/ucp/gvfs/gvfs_directory.hxx (renamed from ucb/source/ucp/gvfs/directory.hxx)10
-rw-r--r--ucb/source/ucp/gvfs/gvfs_provider.cxx (renamed from ucb/source/ucp/gvfs/provider.cxx)12
-rw-r--r--ucb/source/ucp/gvfs/gvfs_provider.hxx (renamed from ucb/source/ucp/gvfs/provider.hxx)0
-rw-r--r--ucb/source/ucp/gvfs/gvfs_stream.cxx (renamed from ucb/source/ucp/gvfs/stream.cxx)22
-rw-r--r--ucb/source/ucp/gvfs/gvfs_stream.hxx (renamed from ucb/source/ucp/gvfs/stream.hxx)0
-rw-r--r--ucb/source/ucp/gvfs/makefile.mk10
-rw-r--r--ucb/source/ucp/hierarchy/hierarchycontent.cxx197
-rw-r--r--ucb/source/ucp/hierarchy/hierarchycontent.hxx21
-rw-r--r--ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx139
-rw-r--r--ucb/source/ucp/package/pkgcontent.cxx226
-rw-r--r--ucb/source/ucp/package/pkgcontent.hxx46
-rw-r--r--ucb/source/ucp/package/pkgcontentcaps.cxx67
-rw-r--r--ucb/source/ucp/tdoc/tdoc_content.cxx233
-rw-r--r--ucb/source/ucp/tdoc/tdoc_content.hxx18
-rw-r--r--ucb/source/ucp/tdoc/tdoc_contentcaps.cxx85
-rw-r--r--ucb/source/ucp/webdav/DAVException.hxx40
-rw-r--r--ucb/source/ucp/webdav/DAVProperties.cxx28
-rw-r--r--ucb/source/ucp/webdav/DAVResourceAccess.cxx367
-rw-r--r--ucb/source/ucp/webdav/DAVResourceAccess.hxx164
-rw-r--r--ucb/source/ucp/webdav/DAVSession.hxx129
-rw-r--r--ucb/source/ucp/webdav/LinkSequence.cxx19
-rw-r--r--ucb/source/ucp/webdav/LockEntrySequence.cxx40
-rw-r--r--ucb/source/ucp/webdav/LockSequence.cxx9
-rw-r--r--ucb/source/ucp/webdav/NeonLockStore.cxx248
-rw-r--r--ucb/source/ucp/webdav/NeonLockStore.hxx105
-rw-r--r--ucb/source/ucp/webdav/NeonPropFindRequest.cxx89
-rw-r--r--ucb/source/ucp/webdav/NeonSession.cxx1084
-rw-r--r--ucb/source/ucp/webdav/NeonSession.hxx464
-rw-r--r--ucb/source/ucp/webdav/NeonTypes.hxx3
-rw-r--r--ucb/source/ucp/webdav/NeonUri.cxx57
-rw-r--r--ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx17
-rw-r--r--ucb/source/ucp/webdav/makefile.mk60
-rw-r--r--ucb/source/ucp/webdav/webdavcontent.cxx1031
-rw-r--r--ucb/source/ucp/webdav/webdavcontent.hxx189
-rw-r--r--ucb/source/ucp/webdav/webdavcontentcaps.cxx333
-rw-r--r--uui/source/getcontinuations.hxx121
-rw-r--r--uui/source/iahndl-authentication.cxx588
-rw-r--r--uui/source/iahndl-cookies.cxx212
-rw-r--r--uui/source/iahndl-errorhandler.cxx321
-rw-r--r--uui/source/iahndl-filter.cxx474
-rw-r--r--uui/source/iahndl-ioexceptions.cxx346
-rw-r--r--uui/source/iahndl-locking.cxx319
-rw-r--r--uui/source/iahndl-ssl.cxx360
-rw-r--r--uui/source/iahndl.cxx4208
-rw-r--r--uui/source/iahndl.hxx472
-rw-r--r--uui/source/ids.hrc4
-rw-r--r--uui/source/ids.src38
-rw-r--r--uui/source/makefile.mk30
-rw-r--r--uui/source/passwordcontainer.cxx473
-rw-r--r--uui/source/passwordcontainer.hxx200
-rw-r--r--uui/source/services.cxx98
-rw-r--r--xmloff/inc/xmlnmspe.hxx3
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx4
-rw-r--r--xmloff/source/core/xmlexp.cxx6
-rw-r--r--xmloff/source/core/xmlimp.cxx4
-rw-r--r--xmloff/source/core/xmltoken.cxx4
-rw-r--r--xmloff/source/draw/ximpshap.cxx13
109 files changed, 9775 insertions, 7178 deletions
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index 7783a31f9b..0ffe2e57e5 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -1923,7 +1923,7 @@ namespace detail
virtual Reference< XInputStream > getCharacterStream() const = 0;
virtual Reference< XBlob > getBlob() const = 0;
virtual Reference< XClob > getClob() const = 0;
- virtual Any getObject() const = 0;
+ virtual Any getObject() const = 0;
virtual sal_Bool wasNull() const = 0;
virtual ~IValueSource() { }
@@ -1953,9 +1953,9 @@ namespace detail
virtual Sequence< sal_Int8 > getBytes() const { return m_xRow->getBytes( m_nPos ); };
virtual Reference< XInputStream > getBinaryStream() const { return m_xRow->getBinaryStream( m_nPos ); };
virtual Reference< XInputStream > getCharacterStream() const { return m_xRow->getCharacterStream( m_nPos ); };
- virtual Reference< XBlob > getBlob() const { return m_xRow->getBlob( m_nPos ); };
- virtual Reference< XClob > getClob() const { return m_xRow->getClob( m_nPos ); };
- virtual Any getObject() const { return m_xRow->getObject( m_nPos, NULL ); };
+ virtual Reference< XBlob > getBlob() const { return m_xRow->getBlob( m_nPos ); };
+ virtual Reference< XClob > getClob() const { return m_xRow->getClob( m_nPos ); };
+ virtual Any getObject() const { return m_xRow->getObject( m_nPos ,NULL); };
virtual sal_Bool wasNull() const { return m_xRow->wasNull( ); };
private:
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index 5dc4330bc0..d4b485ca75 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -1388,16 +1388,18 @@ namespace
::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
Reference< XPropertySetInfo > xInfo = _xTable->getPropertySetInfo();
if ( xInfo.is()
- && xInfo->hasPropertyByName(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME))
- && xInfo->hasPropertyByName(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME))
&& xInfo->hasPropertyByName(rPropMap.getNameByIndex(PROPERTY_ID_NAME)) )
{
::rtl::OUString aCatalog;
::rtl::OUString aSchema;
::rtl::OUString aTable;
- _xTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME)) >>= _out_rCatalog;
- _xTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= _out_rSchema;
+ if ( xInfo->hasPropertyByName(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME))
+ && xInfo->hasPropertyByName(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME)) )
+ {
+ _xTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME)) >>= _out_rCatalog;
+ _xTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= _out_rSchema;
+ }
_xTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)) >>= _out_rName;
}
else
@@ -1779,15 +1781,31 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer,
Reference<XIndexAccess> xParamsAsIndicies = xParameters.is() ? xParameters->getParameters() : Reference<XIndexAccess>();
Reference<XNameAccess> xParamsAsNames(xParamsAsIndicies, UNO_QUERY);
sal_Int32 nParamCount = xParamsAsIndicies.is() ? xParamsAsIndicies->getCount() : 0;
- if ( (nParamCount && _aParametersSet.empty()) || ::std::count(_aParametersSet.begin(),_aParametersSet.end(),true) != nParamCount )
+ ::std::bit_vector aNewParameterSet( _aParametersSet );
+ if ( nParamCount || ::std::count(aNewParameterSet.begin(),aNewParameterSet.end(),true) != nParamCount )
{
+ static const ::rtl::OUString PROPERTY_NAME(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME));
+ aNewParameterSet.resize(nParamCount ,false);
+ typedef ::std::map< ::rtl::OUString, ::std::vector<sal_Int32> > TParameterPositions;
+ TParameterPositions aParameterNames;
+ for(sal_Int32 i = 0; i < nParamCount; ++i)
+ {
+ Reference<XPropertySet> xParam(xParamsAsIndicies->getByIndex(i),UNO_QUERY);
+ ::rtl::OUString sName;
+ xParam->getPropertyValue(PROPERTY_NAME) >>= sName;
+
+ TParameterPositions::iterator aFind = aParameterNames.find(sName);
+ if ( aFind != aParameterNames.end() )
+ aNewParameterSet[i] = true;
+ aParameterNames[sName].push_back(i+1);
+ }
// build an interaction request
// two continuations (Ok and Cancel)
OInteractionAbort* pAbort = new OInteractionAbort;
OParameterContinuation* pParams = new OParameterContinuation;
// the request
ParametersRequest aRequest;
- Reference<XIndexAccess> xWrappedParameters = new OParameterWrapper(_aParametersSet,xParamsAsIndicies);
+ Reference<XIndexAccess> xWrappedParameters = new OParameterWrapper(aNewParameterSet,xParamsAsIndicies);
aRequest.Parameters = xWrappedParameters;
aRequest.Connection = _xConnection;
OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aRequest));
@@ -1815,11 +1833,10 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer,
Reference< XPropertySet > xParamColumn(xWrappedParameters->getByIndex(i),UNO_QUERY);
if (xParamColumn.is())
{
-#ifdef DBG_UTIL
::rtl::OUString sName;
- xParamColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sName;
+ xParamColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
OSL_ENSURE(sName.equals(pFinalValues->Name), "::dbaui::askForParameters: inconsistent parameter names!");
-#endif
+
// determine the field type and ...
sal_Int32 nParamType = 0;
xParamColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nParamType;
@@ -1827,21 +1844,17 @@ void askForParameters(const Reference< XSingleSelectQueryComposer >& _xComposer,
sal_Int32 nScale = 0;
if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE), xParamColumn))
xParamColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nScale;
- // and set the value
- ::std::bit_vector::const_iterator aIter = _aParametersSet.begin();
- ::std::bit_vector::const_iterator aEnd = _aParametersSet.end();
- sal_Int32 j = 0;
- sal_Int32 nParamPos = -1;
- for(; aIter != aEnd && j <= i; ++aIter)
- {
- ++nParamPos;
- if ( !*aIter )
+ // (the index of the parameters is one-based)
+ TParameterPositions::iterator aFind = aParameterNames.find(pFinalValues->Name);
+ ::std::vector<sal_Int32>::iterator aIterPos = aFind->second.begin();
+ ::std::vector<sal_Int32>::iterator aEndPos = aFind->second.end();
+ for(;aIterPos != aEndPos;++aIterPos)
+ {
+ if ( _aParametersSet.empty() || !_aParametersSet[(*aIterPos)-1] )
{
- ++j;
+ _xParameters->setObjectWithInfo(*aIterPos, pFinalValues->Value, nParamType, nScale);
}
}
- _xParameters->setObjectWithInfo(nParamPos + 1, pFinalValues->Value, nParamType, nScale);
- // (the index of the parameters is one-based)
}
}
}
diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx
index f9de90d92f..e4a79817f3 100644
--- a/connectivity/source/drivers/jdbc/tools.cxx
+++ b/connectivity/source/drivers/jdbc/tools.cxx
@@ -153,6 +153,8 @@ java_util_Properties* connectivity::createStringPropertyArray(const Sequence< Pr
&& pBegin->Name.compareToAscii( "SupportsTableCreation" )
&& pBegin->Name.compareToAscii( "UseJava" )
&& pBegin->Name.compareToAscii( "Authentication" )
+ && pBegin->Name.compareToAscii( "PreferDosLikeLineEnds" )
+ && pBegin->Name.compareToAscii( "PrimaryKeySupport" )
)
{
::rtl::OUString aStr;
diff --git a/connectivity/source/parse/PColumn.cxx b/connectivity/source/parse/PColumn.cxx
index 34b3f3a582..8eca29dfb5 100644
--- a/connectivity/source/parse/PColumn.cxx
+++ b/connectivity/source/parse/PColumn.cxx
@@ -116,7 +116,7 @@ OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSe
const Reference< XDatabaseMetaData >& _rxDBMetaData, sal_Int32 _nColumnPos )
{
OParseColumn* pColumn = new OParseColumn(
- _rxResMetaData->getColumnName( _nColumnPos ),
+ _rxResMetaData->getColumnLabel( _nColumnPos ),
_rxResMetaData->getColumnTypeName( _nColumnPos ),
::rtl::OUString(),
_rxResMetaData->isNullable( _nColumnPos ),
@@ -135,6 +135,7 @@ OParseColumn* OParseColumn::createColumnForResultSet( const Reference< XResultSe
eComplete
) );
pColumn->setIsSearchable( _rxResMetaData->isSearchable( _nColumnPos ) );
+ pColumn->setRealName(_rxResMetaData->getColumnName( _nColumnPos ));
return pColumn;
}
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index e0a08ca1c7..568b8bd78c 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -911,7 +911,7 @@ OSQLParseNode* OSQLParser::convertNode(sal_Int32 nType,OSQLParseNode*& pLiteral)
}
break;
default:
- OSL_ENSURE(0,"Not handled!");
+ ;
}
}
return pReturn;
diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx
index 5d17a87daa..013ba0e2ce 100644
--- a/desktop/source/deployment/misc/dp_ucb.cxx
+++ b/desktop/source/deployment/misc/dp_ucb.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -40,7 +40,6 @@
#include "xmlscript/xml_helper.hxx"
#include "com/sun/star/io/XInputStream.hpp"
#include "com/sun/star/ucb/CommandFailedException.hpp"
-#include "com/sun/star/ucb/XContentCreator.hpp"
#include "com/sun/star/ucb/ContentInfo.hpp"
#include "com/sun/star/ucb/ContentInfoAttribute.hpp"
@@ -66,13 +65,13 @@ bool create_ucb_content(
{
try {
// Existense check...
- // content ctor/isFolder() will throw exception in case the resource
+ // content ctor/isFolder() will throw exception in case the resource
// does not exist.
// dilemma: no chance to use the given iahandler here, because it would
// raise no such file dialogs, else no interaction for
// passwords, ...? xxx todo
- ::ucbhelper::Content ucbContent(
+ ::ucbhelper::Content ucbContent(
url, Reference<XCommandEnvironment>() );
ucbContent.isFolder();
@@ -109,7 +108,7 @@ bool create_folder(
return true;
}
}
-
+
OUString url( url_ );
// xxx todo: find parent
sal_Int32 slash = url.lastIndexOf( '/' );
@@ -130,50 +129,46 @@ bool create_folder(
if (! create_folder(
&parentContent, url.copy( 0, slash ), xCmdEnv, throw_exc ))
return false;
- Reference<XContentCreator> xCreator( parentContent.get(), UNO_QUERY );
- if (xCreator.is())
+ const Any title( ::rtl::Uri::decode( url.copy( slash + 1 ),
+ rtl_UriDecodeWithCharset,
+ RTL_TEXTENCODING_UTF8 ) );
+ const Sequence<ContentInfo> infos(
+ parentContent.queryCreatableContentsInfo() );
+ for ( sal_Int32 pos = 0; pos < infos.getLength(); ++pos )
{
- const Any title( ::rtl::Uri::decode( url.copy( slash + 1 ),
- rtl_UriDecodeWithCharset,
- RTL_TEXTENCODING_UTF8 ) );
- const Sequence<ContentInfo> infos(
- xCreator->queryCreatableContentsInfo() );
- for ( sal_Int32 pos = 0; pos < infos.getLength(); ++pos )
+ // look KIND_FOLDER:
+ ContentInfo const & info = infos[ pos ];
+ if ((info.Attributes & ContentInfoAttribute::KIND_FOLDER) != 0)
{
- // look KIND_FOLDER:
- ContentInfo const & info = infos[ pos ];
- if ((info.Attributes & ContentInfoAttribute::KIND_FOLDER) != 0)
- {
- // make sure the only required bootstrap property is "Title":
- Sequence<beans::Property> const & rProps = info.Properties;
- if (rProps.getLength() != 1 ||
- !rProps[ 0 ].Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("Title") ))
- continue;
-
- try {
- if (parentContent.insertNewContent(
- info.Type,
- Sequence<OUString>( &StrTitle::get(), 1 ),
- Sequence<Any>( &title, 1 ),
- ucb_content )) {
- if (ret_ucb_content != 0)
- *ret_ucb_content = ucb_content;
- return true;
- }
+ // make sure the only required bootstrap property is "Title":
+ Sequence<beans::Property> const & rProps = info.Properties;
+ if (rProps.getLength() != 1 ||
+ !rProps[ 0 ].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("Title") ))
+ continue;
+
+ try {
+ if (parentContent.insertNewContent(
+ info.Type,
+ Sequence<OUString>( &StrTitle::get(), 1 ),
+ Sequence<Any>( &title, 1 ),
+ ucb_content )) {
+ if (ret_ucb_content != 0)
+ *ret_ucb_content = ucb_content;
+ return true;
}
- catch (RuntimeException &) {
+ }
+ catch (RuntimeException &) {
+ throw;
+ }
+ catch (CommandFailedException &) {
+ // Interaction Handler already handled the error
+ // that has occured...
+ }
+ catch (Exception &) {
+ if (throw_exc)
throw;
- }
- catch (CommandFailedException &) {
- // Interaction Handler already handled the error
- // that has occured...
- }
- catch (Exception &) {
- if (throw_exc)
- throw;
- return false;
- }
+ return false;
}
}
}
@@ -217,7 +212,7 @@ bool erase_path( OUString const & url,
if (! ucb_content.openStream( xStream ))
throw RuntimeException(
OUSTR(
- "::ucbhelper::Content::openStream( XOutputStream ) failed!"),
+ "::ucbhelper::Content::openStream( XOutputStream ) failed!"),
0 );
return bytes;
}
diff --git a/desktop/source/registration/com/sun/star/servicetag/SystemEnvironment.java b/desktop/source/registration/com/sun/star/servicetag/SystemEnvironment.java
index badf5bbbfd..d218650ee5 100644
--- a/desktop/source/registration/com/sun/star/servicetag/SystemEnvironment.java
+++ b/desktop/source/registration/com/sun/star/servicetag/SystemEnvironment.java
@@ -95,12 +95,12 @@ public class SystemEnvironment {
this.systemManufacturer = "";
this.cpuManufacturer = "";
this.serialNumber = "";
- this.physmem = "";
- this.sockets = "";
- this.cores = "";
- this.virtcpus = "";
+ this.physmem = "0";
+ this.sockets = "0";
+ this.cores = "0";
+ this.virtcpus = "0";
this.cpuname = "";
- this.clockrate = "";
+ this.clockrate = "0";
}
@@ -173,6 +173,8 @@ public class SystemEnvironment {
* @param physmem The physmem to set.
*/
public void setPhysMem(String physmem) {
+ if (physmem.length() == 0)
+ physmem = "0";
this.physmem = physmem;
}
@@ -181,6 +183,8 @@ public class SystemEnvironment {
* @param sockets The sockets to set.
*/
public void setSockets(String sockets) {
+ if (sockets.length() == 0)
+ sockets = "0";
this.sockets = sockets;
}
@@ -189,6 +193,8 @@ public class SystemEnvironment {
* @param cores The cores to set.
*/
public void setCores(String cores) {
+ if (cores.length() == 0)
+ cores ="0";
this.cores = cores;
}
@@ -197,6 +203,8 @@ public class SystemEnvironment {
* @param virtcpus The virtcpus to set.
*/
public void setVirtCpus(String virtcpus) {
+ if (virtcpus.length() == 0)
+ virtcpus = "0";
this.virtcpus = virtcpus;
}
@@ -213,9 +221,14 @@ public class SystemEnvironment {
* @param clockrate The clockrate to set.
*/
public void setClockRate(String clockrate) {
- Float f = Float.parseFloat(clockrate);
- Integer nClockrate = f.intValue();
- this.clockrate = nClockrate.toString();
+ if (clockrate.length() == 0)
+ this.clockrate = "0";
+ else
+ {
+ Float f = Float.parseFloat(clockrate);
+ Integer nClockrate = f.intValue();
+ this.clockrate = nClockrate.toString();
+ }
}
/**
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index ec09bef696..64eb630165 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -70,6 +70,9 @@
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <drawinglayer/primitive2d/epsprimitive2d.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
+
//////////////////////////////////////////////////////////////////////////////
using namespace com::sun::star;
diff --git a/fileaccess/source/FileAccess.cxx b/fileaccess/source/FileAccess.cxx
index fbbcc31e04..3f387afe4b 100644
--- a/fileaccess/source/FileAccess.cxx
+++ b/fileaccess/source/FileAccess.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -61,7 +61,6 @@
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
-#include <com/sun/star/ucb/XContentCreator.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
@@ -89,7 +88,7 @@ namespace io_FileAccess
typedef cppu::WeakImplHelper1< XSimpleFileAccess3 > FileAccessHelper;
class OCommandEnvironment;
-class OFileAccess : public FileAccessHelper
+class OFileAccess : public FileAccessHelper
{
Reference< XMultiServiceFactory > mxSMgr;
Reference< XCommandEnvironment > mxEnvironment;
@@ -134,7 +133,7 @@ public:
typedef cppu::WeakImplHelper1< XActiveDataSink > ActiveDataSinkHelper;
-class OActiveDataSink : public ActiveDataSinkHelper
+class OActiveDataSink : public ActiveDataSinkHelper
{
Reference< XInputStream > mxStream;
@@ -360,7 +359,7 @@ void OFileAccess::transferImpl( const rtl::OUString& rSource,
"destination folder URL!" ) ),
static_cast< cppu::OWeakObject * >( this ) );
}
-
+
transferImpl( rSource, aDestURL, bMoveData );
return;
}
@@ -480,11 +479,7 @@ void OFileAccess::createFolder( const rtl::OUString& NewFolderURL )
ucbhelper::Content aCnt( aURL.GetMainURL( INetURLObject::NO_DECODE ), mxEnvironment );
- Reference< XContentCreator > xCreator = Reference< XContentCreator >( aCnt.get(), UNO_QUERY );
- if ( !xCreator.is() )
- return;
-
- Sequence< ContentInfo > aInfo = xCreator->queryCreatableContentsInfo();
+ Sequence< ContentInfo > aInfo = aCnt.queryCreatableContentsInfo();
sal_Int32 nCount = aInfo.getLength();
if ( nCount == 0 )
return;
@@ -685,8 +680,8 @@ Reference< XStream > OFileAccess::openFileReadWrite( const rtl::OUString& FileUR
Reference< XInterface > xSinkIface = Reference< XInterface >::query( xSink );
OpenCommandArgument2 aArg;
- aArg.Mode = OpenMode::DOCUMENT;
- aArg.Priority = 0; // unused
+ aArg.Mode = OpenMode::DOCUMENT;
+ aArg.Priority = 0; // unused
aArg.Sink = xSink;
aArg.Properties = Sequence< Property >( 0 ); // unused
@@ -758,56 +753,51 @@ bool OFileAccess::createNewFile( const rtl::OUString & rParentURL,
{
ucbhelper::Content aParentCnt( rParentURL, mxEnvironment );
- Reference< XContentCreator > xCreator
- = Reference< XContentCreator >( aParentCnt.get(), UNO_QUERY );
- if ( xCreator.is() )
- {
- Sequence< ContentInfo > aInfo = xCreator->queryCreatableContentsInfo();
- sal_Int32 nCount = aInfo.getLength();
- if ( nCount == 0 )
- return false;
+ Sequence< ContentInfo > aInfo = aParentCnt.queryCreatableContentsInfo();
+ sal_Int32 nCount = aInfo.getLength();
+ if ( nCount == 0 )
+ return false;
- for ( sal_Int32 i = 0; i < nCount; ++i )
+ for ( sal_Int32 i = 0; i < nCount; ++i )
+ {
+ const ContentInfo & rCurr = aInfo[i];
+ if ( ( rCurr.Attributes
+ & ContentInfoAttribute::KIND_DOCUMENT ) &&
+ ( rCurr.Attributes
+ & ContentInfoAttribute::INSERT_WITH_INPUTSTREAM ) )
{
- const ContentInfo & rCurr = aInfo[i];
- if ( ( rCurr.Attributes
- & ContentInfoAttribute::KIND_DOCUMENT ) &&
- ( rCurr.Attributes
- & ContentInfoAttribute::INSERT_WITH_INPUTSTREAM ) )
- {
- // Make sure the only required bootstrap property is
- // "Title",
- const Sequence< Property > & rProps = rCurr.Properties;
- if ( rProps.getLength() != 1 )
- continue;
+ // Make sure the only required bootstrap property is
+ // "Title",
+ const Sequence< Property > & rProps = rCurr.Properties;
+ if ( rProps.getLength() != 1 )
+ continue;
- if ( !rProps[ 0 ].Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
- continue;
+ if ( !rProps[ 0 ].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
+ continue;
- Sequence<rtl::OUString> aNames(1);
- rtl::OUString* pNames = aNames.getArray();
- pNames[0] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
- Sequence< Any > aValues(1);
- Any* pValues = aValues.getArray();
- pValues[0] = makeAny( rtl::OUString( rTitle ) );
+ Sequence<rtl::OUString> aNames(1);
+ rtl::OUString* pNames = aNames.getArray();
+ pNames[0] = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
+ Sequence< Any > aValues(1);
+ Any* pValues = aValues.getArray();
+ pValues[0] = makeAny( rtl::OUString( rTitle ) );
- try
- {
- ucbhelper::Content aNew;
- if ( aParentCnt.insertNewContent(
- rCurr.Type, aNames, aValues, data, aNew ) )
- return true; // success.
- else
- continue;
- }
- catch ( CommandFailedException const & )
- {
- // Interaction Handler already handled the
- // error that has occured...
+ try
+ {
+ ucbhelper::Content aNew;
+ if ( aParentCnt.insertNewContent(
+ rCurr.Type, aNames, aValues, data, aNew ) )
+ return true; // success.
+ else
continue;
- }
+ }
+ catch ( CommandFailedException const & )
+ {
+ // Interaction Handler already handled the
+ // error that has occured...
+ continue;
}
}
}
diff --git a/fpicker/source/office/fpsmartcontent.cxx b/fpicker/source/office/fpsmartcontent.cxx
index 32a699895f..3ee5166fed 100644
--- a/fpicker/source/office/fpsmartcontent.cxx
+++ b/fpicker/source/office/fpsmartcontent.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -33,14 +33,13 @@
#include "fpsmartcontent.hxx"
/** === begin UNO includes === **/
-#include <com/sun/star/ucb/XContentCreator.hpp>
#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/ucb/ContentInfo.hpp>
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
+#include <com/sun/star/ucb/XContent.hpp>
/** === end UNO includes === **/
-#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
#include <comphelper/processfactory.hxx>
-#endif
#include <ucbhelper/commandenvironment.hxx>
#include <tools/solar.h>
#include <tools/debug.hxx>
@@ -127,7 +126,7 @@ namespace svt
if (!m_xCmdEnv.is())
return IHT_NONE;
-
+
return IHT_DEFAULT;
}
@@ -282,25 +281,21 @@ namespace svt
sal_Bool bRet = sal_False;
try
{
- Reference< XContentCreator > xCreator = Reference< XContentCreator >( m_pContent->get(), UNO_QUERY );
- if ( xCreator.is() )
+ Sequence< ContentInfo > aInfo = m_pContent->queryCreatableContentsInfo();
+ const ContentInfo* pInfo = aInfo.getConstArray();
+ sal_Int32 nCount = aInfo.getLength();
+ for ( sal_Int32 i = 0; i < nCount; ++i, ++pInfo )
{
- Sequence< ContentInfo > aInfo = xCreator->queryCreatableContentsInfo();
- const ContentInfo* pInfo = aInfo.getConstArray();
- sal_Int32 nCount = aInfo.getLength();
- for ( sal_Int32 i = 0; i < nCount; ++i, ++pInfo )
+ // Simply look for the first KIND_FOLDER...
+ if ( pInfo->Attributes & ContentInfoAttribute::KIND_FOLDER )
{
- // Simply look for the first KIND_FOLDER...
- if ( pInfo->Attributes & ContentInfoAttribute::KIND_FOLDER )
- {
- bRet = sal_True;
- break;
- }
+ bRet = sal_True;
+ break;
}
-
- // now we're definately valid
- m_eState = VALID;
}
+
+ // now we're definately valid
+ m_eState = VALID;
}
catch( Exception& )
{
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index e7dc765911..bb7d15d0b5 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -69,7 +69,6 @@
#include <com/sun/star/ucb/TransferInfo.hpp>
#include <com/sun/star/ucb/XCommandProcessor.hpp>
#include <com/sun/star/ucb/XContent.hpp>
-#include <com/sun/star/ucb/XContentCreator.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
#include <com/sun/star/ucb/XAnyCompare.hpp>
@@ -130,7 +129,7 @@ using namespace ::ucbhelper;
//#define PARAMETER_OLD_TYPEDETECTION "DeepDetection"
#define SERVICENAME_DOCINFO "com.sun.star.document.DocumentProperties"
#define SERVICENAME_DOCTEMPLATES "com.sun.star.frame.DocumentTemplates"
-#define SERVICENAME_DESKTOP "com.sun.star.frame.Desktop"
+#define SERVICENAME_DESKTOP "com.sun.star.frame.Desktop"
//========================================================================
@@ -238,7 +237,7 @@ class SfxDocTemplate_Impl : public SvRefBase
// the following member is intended to prevent clearing of the global data when it is in use
// TODO/LATER: it still does not make the implementation complete thread-safe
- sal_Int32 mnLockCounter;
+ sal_Int32 mnLockCounter;
private:
void Clear();
@@ -247,12 +246,12 @@ public:
SfxDocTemplate_Impl();
~SfxDocTemplate_Impl();
- void IncrementLock();
- void DecrementLock();
+ void IncrementLock();
+ void DecrementLock();
sal_Bool Construct( );
void CreateFromHierarchy( Content &rTemplRoot );
- void ReInitFromComponent();
+ void ReInitFromComponent();
void AddRegion( const OUString& rTitle,
Content& rContent );
@@ -794,12 +793,12 @@ String SfxDocumentTemplates::GetDefaultTemplatePath
INetURLObject aTemplateObj( pImp->GetRootURL() );
aTemplateObj.insertName( aGroupName, false,
- INetURLObject::LAST_SEGMENT, true,
- INetURLObject::ENCODE_ALL );
+ INetURLObject::LAST_SEGMENT, true,
+ INetURLObject::ENCODE_ALL );
aTemplateObj.insertName( aTitle, false,
- INetURLObject::LAST_SEGMENT, true,
- INetURLObject::ENCODE_ALL );
+ INetURLObject::LAST_SEGMENT, true,
+ INetURLObject::ENCODE_ALL );
::rtl::OUString aResult;
@@ -2358,7 +2357,7 @@ void SfxDocTemplate_Impl::AddRegion( const OUString& rTitle,
try
{
ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY;
- Sequence< NumberedSortingInfo > aSortingInfo(1);
+ Sequence< NumberedSortingInfo > aSortingInfo(1);
aSortingInfo.getArray()->ColumnIndex = 1;
aSortingInfo.getArray()->Ascending = sal_True;
xResultSet = rContent.createSortedCursor( aProps, aSortingInfo, m_rCompareFactory, eInclude );
@@ -2394,7 +2393,7 @@ void SfxDocTemplate_Impl::CreateFromHierarchy( Content &rTemplRoot )
try
{
ResultSetInclude eInclude = INCLUDE_FOLDERS_ONLY;
- Sequence< NumberedSortingInfo > aSortingInfo(1);
+ Sequence< NumberedSortingInfo > aSortingInfo(1);
aSortingInfo.getArray()->ColumnIndex = 1;
aSortingInfo.getArray()->Ascending = sal_True;
xResultSet = rTemplRoot.createSortedCursor( aProps, aSortingInfo, m_rCompareFactory, eInclude );
@@ -2502,7 +2501,7 @@ void SfxDocTemplate_Impl::GetTemplates( Content& rTargetFolder,
try
{
ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY;
- Sequence< NumberedSortingInfo > aSortingInfo(1);
+ Sequence< NumberedSortingInfo > aSortingInfo(1);
aSortingInfo.getArray()->ColumnIndex = 1;
aSortingInfo.getArray()->Ascending = sal_True;
xResultSet = rTargetFolder.createSortedCursor( aProps, aSortingInfo, m_rCompareFactory, eInclude );
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 98afd75354..bfef7c9f73 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -869,7 +869,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
::rtl::Reference< ::comphelper::OInteractionRequest > pRequest = new ::comphelper::OInteractionRequest( makeAny( aUpdateRequest ) );
pRequest->addContinuation( new ::comphelper::OInteractionApprove );
- pRequest->addContinuation( new ::comphelper::OInteractionDisapprove );
+ pRequest->addContinuation( new ::comphelper::OInteractionAbort );
typedef ::comphelper::OInteraction< XInteractionAskLater > OInteractionAskLater;
OInteractionAskLater* pLater = new OInteractionAskLater;
@@ -952,27 +952,27 @@ sal_uInt32 SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDo
if ( !pFORequest->isAbort() )
{
- SfxAllItemSet aNewParams( pDoc->GetPool() );
- TransformParameters( SID_OPENDOC,
- pFORequest->getFilterOptions(),
- aNewParams,
- NULL );
-
- SFX_ITEMSET_ARG( &aNewParams,
- pFilterOptions,
- SfxStringItem,
- SID_FILE_FILTEROPTIONS,
- sal_False );
- if ( pFilterOptions )
- pSet->Put( *pFilterOptions );
-
- SFX_ITEMSET_ARG( &aNewParams,
- pFilterData,
- SfxUnoAnyItem,
- SID_FILTER_DATA,
- sal_False );
- if ( pFilterData )
- pSet->Put( *pFilterData );
+ SfxAllItemSet aNewParams( pDoc->GetPool() );
+ TransformParameters( SID_OPENDOC,
+ pFORequest->getFilterOptions(),
+ aNewParams,
+ NULL );
+
+ SFX_ITEMSET_ARG( &aNewParams,
+ pFilterOptions,
+ SfxStringItem,
+ SID_FILE_FILTEROPTIONS,
+ sal_False );
+ if ( pFilterOptions )
+ pSet->Put( *pFilterOptions );
+
+ SFX_ITEMSET_ARG( &aNewParams,
+ pFilterData,
+ SfxUnoAnyItem,
+ SID_FILTER_DATA,
+ sal_False );
+ if ( pFilterData )
+ pSet->Put( *pFilterData );
}
else
bAbort = TRUE;
@@ -1796,14 +1796,14 @@ sal_Bool SfxObjectShell::SaveTo_Impl
#define CHAR_POINTER(THE_OUSTRING) ::rtl::OUStringToOString (THE_OUSTRING, RTL_TEXTENCODING_UTF8).pData->buffer
// Header for a single-valued ASCII EA data item
typedef struct _EA_ASCII_header {
- USHORT usAttr; /* value: EAT_ASCII */
- USHORT usLen; /* length of data */
- CHAR szType[_MAX_PATH]; /* ASCII data fits in here ... */
+ USHORT usAttr; /* value: EAT_ASCII */
+ USHORT usLen; /* length of data */
+ CHAR szType[_MAX_PATH]; /* ASCII data fits in here ... */
} EA_ASCII_HEADER;
- char filePath[_MAX_PATH];
- char fileExt[_MAX_PATH];
- char docType[_MAX_PATH];
- int rc;
+ char filePath[_MAX_PATH];
+ char fileExt[_MAX_PATH];
+ char docType[_MAX_PATH];
+ int rc;
oslFileError eRet;
::rtl::OUString aSystemFileURL;
const ::rtl::OUString aFileURL = rMedium.GetName();
@@ -2953,7 +2953,7 @@ sal_Bool SfxObjectShell::PreDoSaveAs_Impl
// notify the document that saving was done successfully
//REMOVE if ( bCopyTo )
//REMOVE {
-//REMOVE if ( IsHandsOff() )
+//REMOVE if ( IsHandsOff() )
//REMOVE bOk = DoSaveCompleted( pMedium );
//REMOVE }
//REMOVE else
@@ -3435,7 +3435,7 @@ sal_Bool SfxObjectShell::SaveCompleted( const uno::Reference< embed::XStorage >&
sal_Bool StoragesOfUnknownMediaTypeAreCopied_Impl( const uno::Reference< embed::XStorage >& xSource,
- const uno::Reference< embed::XStorage >& xTarget )
+ const uno::Reference< embed::XStorage >& xTarget )
{
OSL_ENSURE( xSource.is() && xTarget.is(), "Source and/or target storages are not available!\n" );
if ( !xSource.is() || !xTarget.is() || xSource == xTarget )
diff --git a/svx/inc/svx/numitem.hxx b/svx/inc/svx/numitem.hxx
index 89be46dea9..5b01d7a9e3 100644
--- a/svx/inc/svx/numitem.hxx
+++ b/svx/inc/svx/numitem.hxx
@@ -186,6 +186,7 @@ public:
// <--
SvxNumberFormat(const SvxNumberFormat& rFormat);
SvxNumberFormat(SvStream &rStream);
+
virtual ~SvxNumberFormat();
SvStream& Store(SvStream &rStream, FontToSubsFontConverter pConverter);
diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx
index 711800fc25..64ee4c19b5 100644
--- a/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx
+++ b/svx/inc/svx/sdr/contact/viewobjectcontactofunocontrol.hxx
@@ -66,7 +66,6 @@ namespace sdr { namespace contact {
public:
ViewObjectContactOfUnoControl( ObjectContact& _rObjectContact, ViewContactOfUnoControl& _rViewContact );
-
/// determines whether an XControl already exists, and is currently visible
bool isControlVisible() const;
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 1ce09428f0..9e05ca41b0 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -56,6 +56,7 @@
#include "unopolyhelper.hxx"
#include <uno/mapping.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <com/sun/star/document/XActionLockable.hpp>
// ---------------------------
// - EnhancedCustomShapeEngine -
@@ -360,7 +361,8 @@ com::sun::star::awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds
{
com::sun::star::awt::Rectangle aTextRect;
SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
- if ( pSdrObjCustomShape && pSdrObjCustomShape->GetModel() && !pSdrObjCustomShape->GetModel()->isLocked() )
+ ::com::sun::star::uno::Reference< ::com::sun::star::document::XActionLockable > xLockable( mxShape, ::com::sun::star::uno::UNO_QUERY );
+ if ( pSdrObjCustomShape && pSdrObjCustomShape->GetModel() && xLockable.is() && !xLockable->isActionLocked() )
{
if ( pSdrObjCustomShape )
{
diff --git a/svx/source/items/numitem.cxx b/svx/source/items/numitem.cxx
index a77a49c5ed..4c3aa6d0a5 100644
--- a/svx/source/items/numitem.cxx
+++ b/svx/source/items/numitem.cxx
@@ -1177,6 +1177,11 @@ SvxNumBulletItem::SvxNumBulletItem(SvxNumRule& rRule, USHORT _nWhich ) :
{
}
+SfxPoolItem* SvxNumBulletItem::Create(SvStream &s, USHORT n) const
+{
+ return SfxPoolItem::Create(s, n );
+}
+
/* -----------------27.10.98 10:41-------------------
*
* --------------------------------------------------*/
@@ -1210,11 +1215,6 @@ SfxPoolItem* SvxNumBulletItem::Clone( SfxItemPool * ) const
/* -----------------08.12.98 10:43-------------------
*
* --------------------------------------------------*/
-SfxPoolItem* SvxNumBulletItem::Create(SvStream &rStream, USHORT) const
-{
- SvxNumRule aRule(rStream);
- return new SvxNumBulletItem(aRule, Which() );
-}
USHORT SvxNumBulletItem::GetVersion( USHORT /*nFileVersion*/ ) const
{
return NUMITEM_VERSION_03;
diff --git a/svx/source/outliner/outlvw.cxx b/svx/source/outliner/outlvw.cxx
index e15d7427c3..c0f264f000 100644
--- a/svx/source/outliner/outlvw.cxx
+++ b/svx/source/outliner/outlvw.cxx
@@ -357,6 +357,18 @@ BOOL __EXPORT OutlinerView::MouseButtonDown( const MouseEvent& rMEvt )
aDDStartPosRef=pEditView->GetWindow()->PixelToLogic( aDDStartPosPix,pOwner->GetRefMapMode());
return TRUE;
}
+
+ // special case for outliner view in impress, check if double click hits the page icon for toggle
+ if( (nPara == EE_PARA_NOT_FOUND) && (pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEVIEW) && (eTarget == MouseText) && (rMEvt.GetClicks() == 2) )
+ {
+ ESelection aSel( pEditView->GetSelection() );
+ nPara = aSel.nStartPara;
+ Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
+ if( (pPara && pOwner->pParaList->HasChilds(pPara)) && pPara->HasFlag(PARAFLAG_ISPAGE) )
+ {
+ ImpToggleExpand( pPara );
+ }
+ }
return pEditView->MouseButtonDown( rMEvt );
}
@@ -1644,14 +1656,14 @@ USHORT OutlinerView::GetSelectedScriptType() const
return pEditView->GetSelectedScriptType();
}
-String OutlinerView::GetSurroundingText() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetSurroundingText();
-}
-
-Selection OutlinerView::GetSurroundingTextSelection() const
-{
- DBG_CHKTHIS(OutlinerView,0);
- return pEditView->GetSurroundingTextSelection();
-}
+String OutlinerView::GetSurroundingText() const
+{
+ DBG_CHKTHIS(OutlinerView,0);
+ return pEditView->GetSurroundingText();
+}
+
+Selection OutlinerView::GetSurroundingTextSelection() const
+{
+ DBG_CHKTHIS(OutlinerView,0);
+ return pEditView->GetSurroundingTextSelection();
+}
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index e07f6b4d37..8e428a6c29 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -68,11 +68,10 @@ namespace sdr
// no need to correct if no extra text range
if(aTextRange != aObjectRange)
{
- const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation());
const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat());
// only correct when rotation and/or shear is used
- if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation))
+ if(rGeoStat.nShearWink || rGeoStat.nDrehWink )
{
// text range needs to be corrected by
// aObjectRange.getCenter() - aRotObjectRange.getCenter() since it's
@@ -96,11 +95,6 @@ namespace sdr
aRotMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000);
}
- if(!basegfx::fTools::equalZero(fExtraTextRotation))
- {
- aRotMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180);
- }
-
aRotMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY());
aRotObjectRange.transform(aRotMatrix);
@@ -189,6 +183,16 @@ namespace sdr
aTextRange.getMinY() - aObjectRange.getMinimum().getY());
}
+ if(!basegfx::fTools::equalZero(fExtraTextRotation))
+ {
+ basegfx::B2DVector aTranslation(
+ ( aTextRange.getWidth() / 2 ) + ( aTextRange.getMinX() - aObjectRange.getMinimum().getX() ),
+ ( aTextRange.getHeight() / 2 ) + ( aTextRange.getMinY() - aObjectRange.getMinimum().getY() ) );
+ aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() );
+ aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180);
+ aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() );
+ }
+
if(rGeoStat.nShearWink)
{
aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000));
@@ -199,11 +203,6 @@ namespace sdr
aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000);
}
- if(!basegfx::fTools::equalZero(fExtraTextRotation))
- {
- aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180);
- }
-
// give text it's target position
aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY());
}
diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
index 6dbb1298a0..80121e5a8f 100644
--- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
@@ -238,6 +238,8 @@ namespace sdr { namespace contact {
getGraphics() const { return m_xControlView->getGraphics(); }
inline void draw( const Point& _rTopLeft ) const { m_xControlView->draw( _rTopLeft.X(), _rTopLeft.Y() ); }
+ void invalidate() const;
+
public:
inline const Reference< XControl >& getControl() const { return m_xControl; }
};
@@ -298,6 +300,15 @@ namespace sdr { namespace contact {
}
//--------------------------------------------------------------------
+ void ControlHolder::invalidate() const
+ {
+ Window* pWindow = VCLUnoHelper::GetWindow( m_xControl->getPeer() );
+ OSL_ENSURE( pWindow, "ControlHolder::invalidate: no implementation access!" );
+ if ( pWindow )
+ pWindow->Invalidate();
+ }
+
+ //--------------------------------------------------------------------
::basegfx::B2DVector ControlHolder::getZoom() const
{
// no check whether we're valid, this is the responsibility of the caller
@@ -1666,6 +1677,8 @@ namespace sdr { namespace contact {
double fRotate, fShearX;
_rViewInformation.getObjectToViewTransformation().decompose( aScale, aTranslate, fRotate, fShearX );
#endif
+ const bool bHadControl = m_pVOCImpl->getExistentControl().is();
+
// force control here to make it a VCL ChildWindow. Will be fetched
// and used below by getExistentControl()
m_pVOCImpl->ensureControl( &_rViewInformation.getObjectToViewTransformation() );
@@ -1676,6 +1689,9 @@ namespace sdr { namespace contact {
Reference< XControlModel > xControlModel( rViewContactOfUnoControl.GetSdrUnoObj().GetUnoControlModel() );
const ControlHolder& rControl( m_pVOCImpl->getExistentControl() );
+ if ( !bHadControl && rControl.is() && rControl.isVisible() )
+ rControl.invalidate();
+
// check if we already have an XControl.
if ( !xControlModel.is() || !rControl.is() )
// use the default mechanism. This will create a ControlPrimitive2D without
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index dab771c211..198724a3fb 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -746,8 +746,8 @@ void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const XubString& rS
if (!aFnt.IsTransparent())
{
SfxItemSet aAttr(*pFillAttr->GetPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST);
- pFillAttr->Put(XFillStyleItem(XFILL_SOLID));
- pFillAttr->Put(XFillColorItem(String(), aFnt.GetFillColor()));
+ aAttr.Put(XFillStyleItem(XFILL_SOLID));
+ aAttr.Put(XFillColorItem(String(), aFnt.GetFillColor()));
pText->SetMergedItemSet(aAttr);
}
sal_uInt32 nWink = aFnt.GetOrientation();
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
index 3e2864dc73..6047af2099 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
@@ -446,14 +446,6 @@ DictionaryEntry::DictionaryEntry( const rtl::OUString& rTerm, const rtl::OUStrin
m_nConversionPropertyType = 1;
}
-DictionaryEntry::DictionaryEntry()
- : m_aTerm()
- , m_aMapping()
- , m_nConversionPropertyType( linguistic2::ConversionPropertyType::OTHER )
- , m_bNewEntry( sal_True )
-{
-}
-
DictionaryEntry::~DictionaryEntry()
{
}
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx
index ce8d42893c..f71e20c889 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.hxx
@@ -61,7 +61,6 @@ namespace textconversiondlgs
struct DictionaryEntry
{
- DictionaryEntry();
DictionaryEntry( const rtl::OUString& rTerm, const rtl::OUString& rMapping
, sal_Int16 nConversionPropertyType //linguistic2::ConversionPropertyType
, sal_Bool bNewEntry = sal_False );
diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java
index 8c27a50d6e..8600dcc7f1 100755
--- a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java
+++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -49,7 +49,6 @@ import com.sun.star.ucb.OpenMode;
import com.sun.star.ucb.XCommandProcessor;
import com.sun.star.ucb.XContent;
import com.sun.star.ucb.XContentAccess;
-import com.sun.star.ucb.XContentCreator;
import com.sun.star.ucb.XContentIdentifier;
import com.sun.star.ucb.XContentIdentifierFactory;
import com.sun.star.ucb.XContentProvider;
@@ -139,12 +138,16 @@ public class CheckTransientDocumentsDocumentContent extends ComplexTestCase {
}
}
// create a folder
- XContent xNewFolder = null;
log.println("Create new folder "+ folderName);
ContentInfo contentInfo = new ContentInfo();
contentInfo.Type = "application/vnd.sun.star.tdoc-folder";
- XContentCreator xContentCreator = (XContentCreator)UnoRuntime.queryInterface(XContentCreator.class, xContent);
- xNewFolder = xContentCreator.createNewContent(contentInfo);
+
+ command.Name = "createNewContent";
+ command.Argument = contentInfo;
+
+ result = xCommandProcessor.execute(command, 0, null);
+ XContent xNewFolder = (XContent)UnoRuntime.queryInterface(XContent.class, result);
+
XCommandProcessor xFolderCommandProcessor = (XCommandProcessor)UnoRuntime.queryInterface(XCommandProcessor.class, xNewFolder);
log.println("Got the new folder: " + utils.getImplName(xNewFolder));
diff --git a/ucb/source/core/cmdenv.cxx b/ucb/source/core/cmdenv.cxx
new file mode 100644
index 0000000000..0ac11b82a3
--- /dev/null
+++ b/ucb/source/core/cmdenv.cxx
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include "cppuhelper/factory.hxx"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+
+#include "cmdenv.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+using namespace com::sun::star;
+using namespace ucb_cmdenv;
+
+//=========================================================================
+//=========================================================================
+//
+// UcbCommandEnvironment Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+UcbCommandEnvironment::UcbCommandEnvironment(
+ const uno::Reference< lang::XMultiServiceFactory >& /*xSMgr*/ )
+//: m_xSMgr( xSMgr )
+{
+}
+
+//=========================================================================
+// virtual
+UcbCommandEnvironment::~UcbCommandEnvironment()
+{
+}
+
+//=========================================================================
+//
+// XInitialization methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL UcbCommandEnvironment::initialize(
+ const uno::Sequence< uno::Any >& aArguments )
+ throw( uno::Exception,
+ uno::RuntimeException )
+{
+ if ( ( aArguments.getLength() < 2 ) ||
+ !( aArguments[ 0 ] >>= m_xIH ) ||
+ !( aArguments[ 1 ] >>= m_xPH ))
+ throw lang::IllegalArgumentException();
+}
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+// virtual
+::rtl::OUString SAL_CALL UcbCommandEnvironment::getImplementationName()
+ throw ( uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL
+UcbCommandEnvironment::supportsService( const ::rtl::OUString& ServiceName )
+ throw ( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aSNL = getSupportedServiceNames();
+ const rtl::OUString * pArray = aSNL.getConstArray();
+ for ( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ {
+ if ( pArray[ i ] == ServiceName )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< ::rtl::OUString > SAL_CALL
+UcbCommandEnvironment::getSupportedServiceNames()
+ throw ( uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+//=========================================================================
+// static
+rtl::OUString UcbCommandEnvironment::getImplementationName_Static()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.ucb.CommandEnvironment" ) );
+}
+
+//=========================================================================
+// static
+uno::Sequence< rtl::OUString >
+UcbCommandEnvironment::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ]
+ = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.ucb.CommandEnvironment" ) );
+ return aSNS;
+}
+
+//=========================================================================
+//
+// XCommandInfo methods.
+//
+//=========================================================================
+
+// virtual
+uno::Reference< task::XInteractionHandler > SAL_CALL
+UcbCommandEnvironment::getInteractionHandler()
+ throw ( uno::RuntimeException )
+{
+ return m_xIH;
+}
+
+//=========================================================================
+// virtual
+uno::Reference< ucb::XProgressHandler > SAL_CALL
+UcbCommandEnvironment::getProgressHandler()
+ throw ( uno::RuntimeException )
+{
+ return m_xPH;
+}
+
+//=========================================================================
+//
+// Service factory implementation.
+//
+//=========================================================================
+
+static uno::Reference< uno::XInterface > SAL_CALL
+UcbCommandEnvironment_CreateInstance(
+ const uno::Reference< lang::XMultiServiceFactory> & rSMgr )
+ throw( uno::Exception )
+{
+ lang::XServiceInfo * pX = static_cast< lang::XServiceInfo * >(
+ new UcbCommandEnvironment( rSMgr ) );
+ return uno::Reference< uno::XInterface >::query( pX );
+}
+
+//=========================================================================
+// static
+uno::Reference< lang::XSingleServiceFactory >
+UcbCommandEnvironment::createServiceFactory(
+ const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr )
+{
+ return uno::Reference< lang::XSingleServiceFactory >(
+ cppu::createOneInstanceFactory(
+ rxServiceMgr,
+ UcbCommandEnvironment::getImplementationName_Static(),
+ UcbCommandEnvironment_CreateInstance,
+ UcbCommandEnvironment::getSupportedServiceNames_Static() ) );
+}
diff --git a/ucb/source/core/cmdenv.hxx b/ucb/source/core/cmdenv.hxx
new file mode 100644
index 0000000000..62c550b7ca
--- /dev/null
+++ b/ucb/source/core/cmdenv.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_CMDENV_HXX
+#define INCLUDED_CMDENV_HXX
+
+#include "cppuhelper/implbase3.hxx"
+
+#include "com/sun/star/lang/XInitialization.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/ucb/XCommandEnvironment.hpp"
+
+namespace ucb_cmdenv {
+
+class UcbCommandEnvironment :
+ public cppu::WeakImplHelper3< com::sun::star::lang::XInitialization,
+ com::sun::star::lang::XServiceInfo,
+ com::sun::star::ucb::XCommandEnvironment >
+{
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler > m_xIH;
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XProgressHandler > m_xPH;
+
+public:
+ UcbCommandEnvironment(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
+ virtual ~UcbCommandEnvironment();
+
+ // XInitialization
+ virtual void SAL_CALL
+ initialize( const com::sun::star::uno::Sequence<
+ com::sun::star::uno::Any >& aArguments )
+ throw( com::sun::star::uno::Exception,
+ com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw ( com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const ::rtl::OUString& ServiceName )
+ throw ( com::sun::star::uno::RuntimeException );
+
+ virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw ( com::sun::star::uno::RuntimeException );
+
+ // XCommandEnvironment
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler > SAL_CALL
+ getInteractionHandler()
+ throw ( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XProgressHandler > SAL_CALL
+ getProgressHandler()
+ throw ( com::sun::star::uno::RuntimeException );
+
+ // Non-UNO interfaces
+ static rtl::OUString
+ getImplementationName_Static();
+ static com::sun::star::uno::Sequence< rtl::OUString >
+ getSupportedServiceNames_Static();
+
+ static com::sun::star::uno::Reference<
+ com::sun::star::lang::XSingleServiceFactory >
+ createServiceFactory( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > & rxServiceMgr );
+private:
+ //com::sun::star::uno::Reference<
+ // com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+};
+
+} // namespace ucb_cmdenv
+
+#endif // INCLUDED_CMDENV_HXX
diff --git a/ucb/source/core/makefile.mk b/ucb/source/core/makefile.mk
index e70b5ca879..3f80aac74c 100644
--- a/ucb/source/core/makefile.mk
+++ b/ucb/source/core/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2008 by Sun Microsystems, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -48,7 +48,8 @@ SLOFILES=\
$(SLO)$/ucbstore.obj \
$(SLO)$/ucbprops.obj \
$(SLO)$/provprox.obj \
- $(SLO)$/ucbcmds.obj
+ $(SLO)$/ucbcmds.obj \
+ $(SLO)$/cmdenv.obj
LIB1TARGET=$(SLB)$/_$(TARGET).lib
LIB1OBJFILES=$(SLOFILES)
@@ -59,7 +60,7 @@ SHL1STDLIBS=\
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB) \
- $(UCBHELPERLIB)
+ $(UCBHELPERLIB)
SHL1LIBS=\
$(LIB1TARGET) \
$(SLB)$/regexp.lib
diff --git a/ucb/source/core/ucbcmds.cxx b/ucb/source/core/ucbcmds.cxx
index 0db14ca73f..d514ffcaa8 100644
--- a/ucb/source/core/ucbcmds.cxx
+++ b/ucb/source/core/ucbcmds.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -41,11 +41,10 @@
#include <cppuhelper/exc_hlp.hxx>
#include <rtl/ustring.h>
#include <rtl/ustring.hxx>
-#ifndef __COM_SUN_STAR_LANG_XINTERFACE_HPP_
#include <com/sun/star/uno/XInterface.hpp>
-#endif
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/io/XActiveDataSink.hpp>
@@ -53,13 +52,12 @@
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/ucb/CommandEnvironment.hpp>
#include <com/sun/star/ucb/CommandFailedException.hpp>
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#include <com/sun/star/ucb/GlobalTransferCommandArgument.hpp>
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
-#ifndef _COM_SUN_STAR_UCB_INTERACTIVEBADTRANSFRERURLEXCEPTION_HPP_
#include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp>
-#endif
#include <com/sun/star/ucb/NameClash.hpp>
#include <com/sun/star/ucb/NameClashException.hpp>
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
@@ -79,7 +77,7 @@
using namespace com::sun::star;
-namespace ucb_commands
+namespace
{
//=========================================================================
@@ -182,51 +180,6 @@ void SAL_CALL InteractionHandlerProxy::handle(
//=========================================================================
//
-// class CommandEnvironment.
-//
-//=========================================================================
-
-class CommandEnvironment :
- public cppu::WeakImplHelper1< ucb::XCommandEnvironment >
-{
- uno::Reference< task::XInteractionHandler > m_xIH;
- uno::Reference< ucb::XProgressHandler > m_xPH;
-
-public:
- CommandEnvironment(
- const uno::Reference< task::XInteractionHandler > & xIH,
- const uno::Reference< ucb::XProgressHandler > & xPH )
- : m_xIH( xIH ), m_xPH( xPH ) {}
-
- // XCommandEnvironment methods.
- virtual uno::Reference< task::XInteractionHandler > SAL_CALL
- getInteractionHandler()
- throw ( uno::RuntimeException );
- virtual uno::Reference< ucb::XProgressHandler > SAL_CALL
- getProgressHandler()
- throw ( uno::RuntimeException );
-};
-
-//=========================================================================
-// virtual
-uno::Reference< task::XInteractionHandler > SAL_CALL
-CommandEnvironment::getInteractionHandler()
- throw ( uno::RuntimeException )
-{
- return m_xIH;
-}
-
-//=========================================================================
-// virtual
-uno::Reference< ucb::XProgressHandler > SAL_CALL
-CommandEnvironment::getProgressHandler()
- throw ( uno::RuntimeException )
-{
- return m_xPH;
-}
-
-//=========================================================================
-//
// class ActiveDataSink.
//
//=========================================================================
@@ -389,7 +342,7 @@ sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByHandle( sal_Int32 Handle )
//=========================================================================
//=========================================================================
-static rtl::OUString createDesiredName(
+rtl::OUString createDesiredName(
const rtl::OUString & rSourceURL, const rtl::OUString & rNewTitle )
{
rtl::OUString aName( rNewTitle );
@@ -438,13 +391,13 @@ static rtl::OUString createDesiredName(
return rtl::OUString( aName );
}
-static rtl::OUString createDesiredName(
+rtl::OUString createDesiredName(
const ucb::GlobalTransferCommandArgument & rArg )
{
return createDesiredName( rArg.SourceURL, rArg.NewTitle );
}
-static rtl::OUString createDesiredName(
+rtl::OUString createDesiredName(
const ucb::TransferInfo & rArg )
{
return createDesiredName( rArg.SourceURL, rArg.NewTitle );
@@ -453,7 +406,7 @@ static rtl::OUString createDesiredName(
//=========================================================================
enum NameClashContinuation { NOT_HANDLED, ABORT, OVERWRITE, NEW_NAME, UNKNOWN };
-static NameClashContinuation interactiveNameClashResolve(
+NameClashContinuation interactiveNameClashResolve(
const uno::Reference< ucb::XCommandEnvironment > & xEnv,
const rtl::OUString & rTargetURL,
const rtl::OUString & rClashingName,
@@ -528,7 +481,7 @@ static NameClashContinuation interactiveNameClashResolve(
}
//=========================================================================
-static bool setTitle(
+bool setTitle(
const uno::Reference< ucb::XCommandProcessor > & xCommandProcessor,
const uno::Reference< ucb::XCommandEnvironment > & xEnv,
const rtl::OUString & rNewTitle )
@@ -576,7 +529,7 @@ static bool setTitle(
}
//=========================================================================
-static uno::Reference< ucb::XContent > createNew(
+uno::Reference< ucb::XContent > createNew(
const TransferCommandContext & rContext,
const uno::Reference< ucb::XContent > & xTarget,
sal_Bool bSourceIsFolder,
@@ -590,10 +543,12 @@ static uno::Reference< ucb::XContent > createNew(
//
//////////////////////////////////////////////////////////////////////
- uno::Reference< ucb::XContentCreator > xCreator(
- xTarget, uno::UNO_QUERY );
+ // First, try it using "CreatabeleContentsInfo" property and
+ // "createNewContent" command -> the "new" way.
- if ( !xCreator.is() )
+ uno::Reference< ucb::XCommandProcessor > xCommandProcessorT(
+ xTarget, uno::UNO_QUERY );
+ if ( !xCommandProcessorT.is() )
{
uno::Any aProps
= uno::makeAny(beans::PropertyValue(
@@ -606,24 +561,77 @@ static uno::Reference< ucb::XContent > createNew(
ucb::IOErrorCode_CANT_CREATE,
uno::Sequence< uno::Any >(&aProps, 1),
rContext.xOrigEnv,
- rtl::OUString::createFromAscii( "Target is no XContentCreator!" ),
+ rtl::OUString::createFromAscii( "Target is no XCommandProcessor!" ),
rContext.xProcessor );
// Unreachable
}
- uno::Sequence< ucb::ContentInfo > aTypesInfo
- = xCreator->queryCreatableContentsInfo();
+ uno::Sequence< beans::Property > aPropsToObtain( 1 );
+ aPropsToObtain[ 0 ].Name
+ = rtl::OUString::createFromAscii( "CreatableContentsInfo" );
+ aPropsToObtain[ 0 ].Handle
+ = -1;
- sal_Int32 nCount = aTypesInfo.getLength();
- if ( !nCount )
+ ucb::Command aGetPropsCommand(
+ rtl::OUString::createFromAscii( "getPropertyValues" ),
+ -1,
+ uno::makeAny( aPropsToObtain ) );
+
+ uno::Reference< sdbc::XRow > xRow;
+ xCommandProcessorT->execute( aGetPropsCommand, 0, rContext.xEnv ) >>= xRow;
+
+ uno::Sequence< ucb::ContentInfo > aTypesInfo;
+ bool bGotTypesInfo = false;
+
+ if ( xRow.is() )
{
- uno::Any aProps
- = uno::makeAny(beans::PropertyValue(
+ uno::Any aValue = xRow->getObject(
+ 1, uno::Reference< container::XNameAccess >() );
+ if ( aValue.hasValue() && ( aValue >>= aTypesInfo ) )
+ {
+ bGotTypesInfo = true;
+ }
+ }
+
+ uno::Reference< ucb::XContentCreator > xCreator;
+
+ if ( !bGotTypesInfo )
+ {
+ // Second, try it using XContentCreator interface -> the "old" way (not
+ // providing the chance to supply an XCommandEnvironment.
+
+ xCreator.set( xTarget, uno::UNO_QUERY );
+
+ if ( !xCreator.is() )
+ {
+ uno::Any aProps
+ = uno::makeAny(beans::PropertyValue(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"Folder")),
-1,
uno::makeAny(rContext.aArg.TargetURL),
beans::PropertyState_DIRECT_VALUE));
+ ucbhelper::cancelCommandExecution(
+ ucb::IOErrorCode_CANT_CREATE,
+ uno::Sequence< uno::Any >(&aProps, 1),
+ rContext.xOrigEnv,
+ rtl::OUString::createFromAscii( "Target is no XContentCreator!" ),
+ rContext.xProcessor );
+ // Unreachable
+ }
+
+ aTypesInfo = xCreator->queryCreatableContentsInfo();
+ }
+
+ sal_Int32 nCount = aTypesInfo.getLength();
+ if ( !nCount )
+ {
+ uno::Any aProps
+ = uno::makeAny(beans::PropertyValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Folder")),
+ -1,
+ uno::makeAny(rContext.aArg.TargetURL),
+ beans::PropertyState_DIRECT_VALUE));
ucbhelper::cancelCommandExecution(
ucb::IOErrorCode_CANT_CREATE,
uno::Sequence< uno::Any >(&aProps, 1),
@@ -673,14 +681,14 @@ static uno::Reference< ucb::XContent > createNew(
}
else
{
- // (not a and not b) or (a and b)
+ // (not a and not b) or (a and b)
// not( a or b) or (a and b)
- //
+ //
if ( ( !!bSourceIsFolder ==
!!( nAttribs
& ucb::ContentInfoAttribute::KIND_FOLDER ) )
&&
- ( !!bSourceIsDocument ==
+ ( !!bSourceIsDocument ==
!!( nAttribs
& ucb::ContentInfoAttribute::KIND_DOCUMENT ) )
)
@@ -710,7 +718,25 @@ static uno::Reference< ucb::XContent > createNew(
//
//////////////////////////////////////////////////////////////
- xNew = xCreator->createNewContent( aTypesInfo[ n ] );
+ if ( !xCreator.is() )
+ {
+ // First, try it using "CreatabeleContentsInfo" property and
+ // "createNewContent" command -> the "new" way.
+ ucb::Command aCreateNewCommand(
+ rtl::OUString::createFromAscii( "createNewContent" ),
+ -1,
+ uno::makeAny( aTypesInfo[ n ] ) );
+
+ xCommandProcessorT->execute( aCreateNewCommand, 0, rContext.xEnv )
+ >>= xNew;
+ }
+ else
+ {
+ // Second, try it using XContentCreator interface -> the "old"
+ // way (not providing the chance to supply an XCommandEnvironment.
+
+ xNew = xCreator->createNewContent( aTypesInfo[ n ] );
+ }
if ( !xNew.is() )
{
@@ -739,7 +765,7 @@ static uno::Reference< ucb::XContent > createNew(
}
//=========================================================================
-static void transferProperties(
+void transferProperties(
const TransferCommandContext & rContext,
const uno::Reference< ucb::XCommandProcessor > & xCommandProcessorS,
const uno::Reference< ucb::XCommandProcessor > & xCommandProcessorN )
@@ -859,7 +885,7 @@ static void transferProperties(
rCurrValue.Name = rCurrProp.Name;
rCurrValue.Handle = rCurrProp.Handle;
rCurrValue.Value = aValue;
-// rCurrValue.State =
+// rCurrValue.State =
nWritePos++;
}
@@ -904,7 +930,7 @@ static void transferProperties(
}
//=========================================================================
-static uno::Reference< io::XInputStream > getInputStream(
+uno::Reference< io::XInputStream > getInputStream(
const TransferCommandContext & rContext,
const uno::Reference< ucb::XCommandProcessor > & xCommandProcessorS )
throw( uno::Exception )
@@ -923,7 +949,7 @@ static uno::Reference< io::XInputStream > getInputStream(
ucb::OpenCommandArgument2 aArg;
aArg.Mode = ucb::OpenMode::DOCUMENT;
- aArg.Priority = 0; // unused
+ aArg.Priority = 0; // unused
aArg.Sink = xSink;
aArg.Properties = uno::Sequence< beans::Property >( 0 ); // unused
@@ -963,7 +989,7 @@ static uno::Reference< io::XInputStream > getInputStream(
{
ucb::OpenCommandArgument2 aArg;
aArg.Mode = ucb::OpenMode::DOCUMENT;
- aArg.Priority = 0; // unused
+ aArg.Priority = 0; // unused
aArg.Sink = xOutputStream;
aArg.Properties = uno::Sequence< beans::Property >( 0 );
@@ -992,7 +1018,7 @@ static uno::Reference< io::XInputStream > getInputStream(
}
//=========================================================================
-static uno::Reference< sdbc::XResultSet > getResultSet(
+uno::Reference< sdbc::XResultSet > getResultSet(
const TransferCommandContext & rContext,
const uno::Reference< ucb::XCommandProcessor > & xCommandProcessorS )
throw( uno::Exception )
@@ -1010,7 +1036,7 @@ static uno::Reference< sdbc::XResultSet > getResultSet(
ucb::OpenCommandArgument2 aArg;
aArg.Mode = ucb::OpenMode::ALL;
- aArg.Priority = 0; // unused
+ aArg.Priority = 0; // unused
aArg.Sink = 0;
aArg.Properties = aProps;
@@ -1038,7 +1064,7 @@ static uno::Reference< sdbc::XResultSet > getResultSet(
}
//=========================================================================
-static void handleNameClashRename(
+void handleNameClashRename(
const TransferCommandContext & rContext,
const uno::Reference< ucb::XContent > & xNew,
const uno::Reference<
@@ -1217,7 +1243,7 @@ static void handleNameClashRename(
}
//=========================================================================
-static void globalTransfer(
+void globalTransfer_(
const TransferCommandContext & rContext,
const uno::Reference< ucb::XContent > & xSource,
const uno::Reference< ucb::XContent > & xTarget,
@@ -1632,7 +1658,7 @@ static void globalTransfer(
rtl::OUString(), // NewTitle;
rContext.aArg.NameClash ); // NameClash
- ucb_commands::TransferCommandContext aSubCtx(
+ TransferCommandContext aSubCtx(
rContext.xSMgr,
rContext.xProcessor,
rContext.xEnv,
@@ -1649,10 +1675,10 @@ static void globalTransfer(
aSubCtx.aArg.SourceURL
= xChild->getIdentifier()->getContentIdentifier();
- ucb_commands::globalTransfer( aSubCtx,
- xChild,
- xNew,
- xChildRow );
+ globalTransfer_( aSubCtx,
+ xChild,
+ xNew,
+ xChildRow );
}
}
while ( xResultSet->next() );
@@ -1662,11 +1688,11 @@ static void globalTransfer(
{
}
}
-
+
try {
uno::Reference< ucb::XCommandProcessor > xcp(
xTarget, uno::UNO_QUERY );
-
+
uno::Any aAny;
uno::Reference< ucb::XCommandInfo > xci;
if(xcp.is())
@@ -1678,7 +1704,7 @@ static void globalTransfer(
uno::Any()),
0,
rContext.xEnv );
-
+
const rtl::OUString cmdName =
rtl::OUString::createFromAscii("flush");
if((aAny >>= xci) && xci->hasCommandByName(cmdName))
@@ -1695,7 +1721,7 @@ static void globalTransfer(
}
}
-} /* namescpace ucb_commands */
+} /* namescpace */
//=========================================================================
//
@@ -1706,8 +1732,7 @@ static void globalTransfer(
uno::Reference< ucb::XCommandInfo >
UniversalContentBroker::getCommandInfo()
{
- return uno::Reference< ucb::XCommandInfo >(
- new ucb_commands::CommandProcessorInfo() );
+ return uno::Reference< ucb::XCommandInfo >( new CommandProcessorInfo() );
}
//=========================================================================
@@ -1717,14 +1742,24 @@ void UniversalContentBroker::globalTransfer(
throw( uno::Exception )
{
// Use own command environment with own interaction handler intercepting
- // some interaction requests that shell not be handled by the user-supplied
+ // some interaction requests that shall not be handled by the user-supplied
// interaction handler.
uno::Reference< ucb::XCommandEnvironment > xLocalEnv;
if (xEnv.is())
- xLocalEnv.set( new ucb_commands::CommandEnvironment(
- new ucb_commands::InteractionHandlerProxy(
- xEnv->getInteractionHandler() ),
- xEnv->getProgressHandler() ) );
+ {
+ uno::Reference< beans::XPropertySet > const xProps(
+ m_xSMgr, uno::UNO_QUERY_THROW );
+ uno::Reference< uno::XComponentContext > xCtx;
+ xCtx.set( xProps->getPropertyValue(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ xLocalEnv.set( ucb::CommandEnvironment::create(
+ xCtx,
+ new InteractionHandlerProxy( xEnv->getInteractionHandler() ),
+ xEnv->getProgressHandler() ) );
+ }
//////////////////////////////////////////////////////////////////////
//
@@ -1862,27 +1897,27 @@ void UniversalContentBroker::globalTransfer(
uno::Any aExc;
rtl::OUString aNewTitle;
- ucb_commands::NameClashContinuation eCont
- = ucb_commands::interactiveNameClashResolve(
+ NameClashContinuation eCont
+ = interactiveNameClashResolve(
xEnv, // always use original environment!
rArg.TargetURL, // target folder URL
- ucb_commands::createDesiredName(
- aTransferArg ), // clashing name
+ createDesiredName(
+ aTransferArg ), // clashing name
aExc,
aNewTitle );
switch ( eCont )
{
- case ucb_commands::NOT_HANDLED:
+ case NOT_HANDLED:
// Not handled.
cppu::throwException( aExc );
// break;
- case ucb_commands::UNKNOWN:
+ case UNKNOWN:
// Handled, but not clear, how...
// fall-thru intended.
- case ucb_commands::ABORT:
+ case ABORT:
throw ucb::CommandFailedException(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
@@ -1892,13 +1927,13 @@ void UniversalContentBroker::globalTransfer(
aExc );
// break;
- case ucb_commands::OVERWRITE:
+ case OVERWRITE:
aTransferArg.NameClash
= ucb::NameClash::OVERWRITE;
bRetry = true;
break;
- case ucb_commands::NEW_NAME:
+ case NEW_NAME:
aTransferArg.NewTitle = aNewTitle;
bRetry = true;
break;
@@ -2015,7 +2050,7 @@ void UniversalContentBroker::globalTransfer(
// Unreachable
}
- ucb_commands::TransferCommandContext aTransferCtx(
+ TransferCommandContext aTransferCtx(
m_xSMgr, this, xLocalEnv, xEnv, rArg );
if ( rArg.NewTitle.getLength() == 0 )
@@ -2024,13 +2059,13 @@ void UniversalContentBroker::globalTransfer(
rtl::OUString aBaseURI( xRow->getString( 4 ) );
if ( aBaseURI.getLength() )
{
- aTransferCtx.aArg.NewTitle
- = ucb_commands::createDesiredName( aBaseURI, rtl::OUString() );
+ aTransferCtx.aArg.NewTitle
+ = createDesiredName( aBaseURI, rtl::OUString() );
}
}
// Do it!
- ucb_commands::globalTransfer( aTransferCtx, xSource, xTarget, xRow );
+ globalTransfer_( aTransferCtx, xSource, xTarget, xRow );
//////////////////////////////////////////////////////////////////////
//
@@ -2044,8 +2079,8 @@ void UniversalContentBroker::globalTransfer(
{
ucb::Command aCommand(
rtl::OUString::createFromAscii( "delete" ), // Name
- -1, // Handle
- uno::makeAny( sal_Bool( sal_True ) ) ); // Argument
+ -1, // Handle
+ uno::makeAny( sal_Bool( sal_True ) ) ); // Argument
xCommandProcessor->execute( aCommand, 0, xLocalEnv );
}
diff --git a/ucb/source/core/ucbserv.cxx b/ucb/source/core/ucbserv.cxx
index 747571d042..70e09d373d 100644
--- a/ucb/source/core/ucbserv.cxx
+++ b/ucb/source/core/ucbserv.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -37,6 +37,7 @@
#include "ucbstore.hxx"
#include "ucbprops.hxx"
#include "provprox.hxx"
+#include "cmdenv.hxx"
using namespace rtl;
using namespace com::sun::star::uno;
@@ -46,7 +47,7 @@ using namespace com::sun::star::registry;
//=========================================================================
static sal_Bool writeInfo( void * pRegistryKey,
const OUString & rImplementationName,
- Sequence< OUString > const & rServiceNames )
+ Sequence< OUString > const & rServiceNames )
{
OUString aKeyName( OUString::createFromAscii( "/" ) );
aKeyName += rImplementationName;
@@ -124,7 +125,15 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey )
writeInfo( pRegistryKey,
UcbContentProviderProxyFactory::getImplementationName_Static(),
- UcbContentProviderProxyFactory::getSupportedServiceNames_Static() );
+ UcbContentProviderProxyFactory::getSupportedServiceNames_Static() ) &&
+
+ //////////////////////////////////////////////////////////////////////
+ // Command Environment.
+ //////////////////////////////////////////////////////////////////////
+
+ writeInfo( pRegistryKey,
+ ucb_cmdenv::UcbCommandEnvironment::getImplementationName_Static(),
+ ucb_cmdenv::UcbCommandEnvironment::getSupportedServiceNames_Static() );
}
//=========================================================================
@@ -179,6 +188,17 @@ extern "C" void * SAL_CALL component_getFactory(
}
//////////////////////////////////////////////////////////////////////
+ // Command Environment.
+ //////////////////////////////////////////////////////////////////////
+
+ else if ( ucb_cmdenv::UcbCommandEnvironment::getImplementationName_Static().
+ compareToAscii( pImplName ) == 0 )
+ {
+ xFactory
+ = ucb_cmdenv::UcbCommandEnvironment::createServiceFactory( xSMgr );
+ }
+
+ //////////////////////////////////////////////////////////////////////
if ( xFactory.is() )
{
diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx
index ab279417b8..2221966376 100644
--- a/ucb/source/ucp/file/bc.cxx
+++ b/ucb/source/ucp/file/bc.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -49,7 +49,6 @@
#include <com/sun/star/beans/PropertySetInfoChange.hpp>
#include <com/sun/star/ucb/ContentAction.hpp>
#include <com/sun/star/ucb/NameClash.hpp>
-#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#include "filglob.hxx"
#include "filid.hxx"
#include "filrow.hxx"
@@ -437,6 +436,15 @@ BaseContent::execute( const Command& aCommand,
if(!xRow->wasNull())
aAny <<= CasePreservingURL;
}
+ else if( ! aCommand.Name.compareToAscii( "createNewContent" ) )
+ {
+ ucb::ContentInfo aArg;
+ if ( !( aCommand.Argument >>= aArg ) )
+ m_pMyShell->installError( CommandId,
+ TASKHANDLING_WRONG_CREATENEWCONTENT_ARGUMENT );
+ else
+ aAny <<= createNewContent( aArg );
+ }
else
m_pMyShell->installError( CommandId,
TASKHANDLER_UNSUPPORTED_COMMAND );
@@ -529,9 +537,9 @@ BaseContent::getContentType()
// Who am I ?
Sequence< beans::Property > seq(1);
seq[0] = beans::Property( rtl::OUString::createFromAscii("IsDocument"),
- -1,
- getCppuType( static_cast< sal_Bool* >(0) ),
- 0 );
+ -1,
+ getCppuType( static_cast< sal_Bool* >(0) ),
+ 0 );
Reference< sdbc::XRow > xRow = getPropertyValues( -1,seq );
sal_Bool IsDocument = xRow->getBoolean( 1 );
@@ -637,27 +645,7 @@ BaseContent::queryCreatableContentsInfo(
void )
throw( RuntimeException )
{
- Sequence< ContentInfo > seq(2);
-
- // file
- seq[0].Type = m_pMyShell->FileContentType;
- seq[0].Attributes = ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
- | ContentInfoAttribute::KIND_DOCUMENT;
-
- Sequence< beans::Property > props( 1 );
- props[0] = beans::Property(
- rtl::OUString::createFromAscii( "Title" ),
- -1,
- getCppuType( static_cast< rtl::OUString* >( 0 ) ),
- beans::PropertyAttribute::MAYBEVOID
- | beans::PropertyAttribute::BOUND );
- seq[0].Properties = props;
-
- // folder
- seq[1].Type = m_pMyShell->FolderContentType;
- seq[1].Attributes = ContentInfoAttribute::KIND_FOLDER;
- seq[1].Properties = props;
- return seq;
+ return m_pMyShell->queryCreatableContentsInfo();
}
@@ -688,18 +676,18 @@ BaseContent::createNewContent(
{
Sequence< beans::Property > seq(1);
seq[0] = beans::Property( rtl::OUString::createFromAscii("IsDocument"),
- -1,
- getCppuType( static_cast< sal_Bool* >(0) ),
- 0 );
+ -1,
+ getCppuType( static_cast< sal_Bool* >(0) ),
+ 0 );
Reference< sdbc::XRow > xRow = getPropertyValues( -1,seq );
IsDocument = xRow->getBoolean( 1 );
-
+
if ( xRow->wasNull() )
{
IsDocument = false;
-// OSL_ENSURE( false,
-// "BaseContent::createNewContent - Property value was null!" );
-// return Reference< XContent >();
+// OSL_ENSURE( false,
+// "BaseContent::createNewContent - Property value was null!" );
+// return Reference< XContent >();
}
}
catch ( sdbc::SQLException const & )
@@ -1076,13 +1064,13 @@ BaseContent::open(
aCommandArgument.Properties,
aCommandArgument.SortingInfo );
}
-// else if( aCommandArgument.Mode ==
-// OpenMode::DOCUMENT_SHARE_DENY_NONE ||
-// aCommandArgument.Mode ==
-// OpenMode::DOCUMENT_SHARE_DENY_WRITE )
-// m_pMyShell->installError( nMyCommandIdentifier,
-// TASKHANDLING_UNSUPPORTED_OPEN_MODE,
-// aCommandArgument.Mode);
+// else if( aCommandArgument.Mode ==
+// OpenMode::DOCUMENT_SHARE_DENY_NONE ||
+// aCommandArgument.Mode ==
+// OpenMode::DOCUMENT_SHARE_DENY_WRITE )
+// m_pMyShell->installError( nMyCommandIdentifier,
+// TASKHANDLING_UNSUPPORTED_OPEN_MODE,
+// aCommandArgument.Mode);
else
m_pMyShell->installError( nMyCommandIdentifier,
TASKHANDLING_UNSUPPORTED_OPEN_MODE,
diff --git a/ucb/source/ucp/file/filerror.hxx b/ucb/source/ucp/file/filerror.hxx
index 3214ffd69b..e773e5a506 100644
--- a/ucb/source/ucp/file/filerror.hxx
+++ b/ucb/source/ucp/file/filerror.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -30,34 +30,34 @@
#ifndef _FILERROR_HXX_
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
+#define TASKHANDLING_WRONG_SETPROPERTYVALUES_ARGUMENT 2
#define TASKHANDLING_WRONG_GETPROPERTYVALUES_ARGUMENT 3
#define TASKHANDLING_WRONG_OPEN_ARGUMENT 4
#define TASKHANDLING_WRONG_DELETE_ARGUMENT 5
#define TASKHANDLING_WRONG_TRANSFER_ARGUMENT 6
#define TASKHANDLING_WRONG_INSERT_ARGUMENT 7
+#define TASKHANDLING_WRONG_CREATENEWCONTENT_ARGUMENT 8
+#define TASKHANDLING_UNSUPPORTED_OPEN_MODE 9
-#define TASKHANDLING_UNSUPPORTED_OPEN_MODE 8
+#define TASKHANDLING_DELETED_STATE_IN_OPEN_COMMAND 10
+#define TASKHANDLING_INSERTED_STATE_IN_OPEN_COMMAND 11
-#define TASKHANDLING_DELETED_STATE_IN_OPEN_COMMAND 9
-#define TASKHANDLING_INSERTED_STATE_IN_OPEN_COMMAND 10
+#define TASKHANDLING_OPEN_FILE_FOR_PAGING 12
+#define TASKHANDLING_NOTCONNECTED_FOR_PAGING 13
+#define TASKHANDLING_BUFFERSIZEEXCEEDED_FOR_PAGING 14
+#define TASKHANDLING_IOEXCEPTION_FOR_PAGING 15
+#define TASKHANDLING_READING_FILE_FOR_PAGING 16
-#define TASKHANDLING_OPEN_FILE_FOR_PAGING 11
-#define TASKHANDLING_NOTCONNECTED_FOR_PAGING 12
-#define TASKHANDLING_BUFFERSIZEEXCEEDED_FOR_PAGING 13
-#define TASKHANDLING_IOEXCEPTION_FOR_PAGING 14
-#define TASKHANDLING_READING_FILE_FOR_PAGING 15
+#define TASKHANDLING_OPEN_FOR_INPUTSTREAM 17
+#define TASKHANDLING_OPEN_FOR_STREAM 18
+#define TASKHANDLING_OPEN_FOR_DIRECTORYLISTING 19
-#define TASKHANDLING_OPEN_FOR_INPUTSTREAM 16
-#define TASKHANDLING_OPEN_FOR_STREAM 17
-#define TASKHANDLING_OPEN_FOR_DIRECTORYLISTING 18
-
#define TASKHANDLING_NOFRESHINSERT_IN_INSERT_COMMAND 22
#define TASKHANDLING_NONAMESET_INSERT_COMMAND 23
#define TASKHANDLING_NOCONTENTTYPE_INSERT_COMMAND 24
@@ -104,7 +104,7 @@ namespace fileaccess {
#define TASKHANDLING_TRANSFER_BY_COPY_SOURCE 60
#define TASKHANDLING_TRANSFER_BY_COPY_SOURCESTAT 61
-#define TASKHANDLING_KEEPERROR_FOR_COPY 62
+#define TASKHANDLING_KEEPERROR_FOR_COPY 62
#define TASKHANDLING_OVERWRITE_FOR_COPY 63
#define TASKHANDLING_RENAME_FOR_COPY 64
#define TASKHANDLING_RENAMEMOVE_FOR_COPY 65
diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx
index 26392425cf..2aa5bf94c9 100644
--- a/ucb/source/ucp/file/filglob.cxx
+++ b/ucb/source/ucp/file/filglob.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -286,7 +286,8 @@ namespace fileaccess {
errorCode == TASKHANDLING_WRONG_OPEN_ARGUMENT ||
errorCode == TASKHANDLING_WRONG_DELETE_ARGUMENT ||
errorCode == TASKHANDLING_WRONG_TRANSFER_ARGUMENT ||
- errorCode == TASKHANDLING_WRONG_INSERT_ARGUMENT )
+ errorCode == TASKHANDLING_WRONG_INSERT_ARGUMENT ||
+ errorCode == TASKHANDLING_WRONG_CREATENEWCONTENT_ARGUMENT )
{
IllegalArgumentException excep;
excep.ArgumentPosition = 0;
@@ -359,7 +360,7 @@ namespace fileaccess {
ioErrorCode = IOErrorCode_INVALID_PARAMETER;
break;
case FileBase::E_NOMEM:
- // not enough memory for allocating structures
+ // not enough memory for allocating structures
ioErrorCode = IOErrorCode_OUT_OF_MEMORY;
break;
case FileBase::E_BUSY:
@@ -409,11 +410,11 @@ namespace fileaccess {
ioErrorCode = IOErrorCode_NOT_EXISTING;
break;
case FileBase::E_NOTDIR:
- // the specified path is not an directory
+ // the specified path is not an directory
ioErrorCode = IOErrorCode_NO_DIRECTORY;
break;
case FileBase::E_NOMEM:
- // not enough memory for allocating structures
+ // not enough memory for allocating structures
ioErrorCode = IOErrorCode_OUT_OF_MEMORY;
break;
case FileBase::E_ROFS:
@@ -629,15 +630,15 @@ namespace fileaccess {
aAny <<= excep;
cancelCommandExecution( aAny,xEnv );
}
-// ioErrorCode = IOErrorCode_INVALID_CHARACTER;
-// cancelCommandExecution(
-// ioErrorCode,
-// generateErrorArguments(aUncPath),
-// xEnv,
-// rtl::OUString(
-// RTL_CONSTASCII_USTRINGPARAM(
-// "the name contained invalid characters")),
-// xComProc );
+// ioErrorCode = IOErrorCode_INVALID_CHARACTER;
+// cancelCommandExecution(
+// ioErrorCode,
+// generateErrorArguments(aUncPath),
+// xEnv,
+// rtl::OUString(
+// RTL_CONSTASCII_USTRINGPARAM(
+// "the name contained invalid characters")),
+// xComProc );
}
else if( errorCode == TASKHANDLING_FOLDER_EXISTS_MKDIR )
{
@@ -655,15 +656,15 @@ namespace fileaccess {
aAny <<= excep;
cancelCommandExecution( aAny,xEnv );
}
-// ioErrorCode = IOErrorCode_ALREADY_EXISTING;
-// cancelCommandExecution(
-// ioErrorCode,
-// generateErrorArguments(aUncPath),
-// xEnv,
-// rtl::OUString(
-// RTL_CONSTASCII_USTRINGPARAM(
-// "the folder exists")),
-// xComProc );
+// ioErrorCode = IOErrorCode_ALREADY_EXISTING;
+// cancelCommandExecution(
+// ioErrorCode,
+// generateErrorArguments(aUncPath),
+// xEnv,
+// rtl::OUString(
+// RTL_CONSTASCII_USTRINGPARAM(
+// "the folder exists")),
+// xComProc );
}
else if( errorCode == TASKHANDLING_ENSUREDIR_FOR_WRITE ||
errorCode == TASKHANDLING_CREATEDIRECTORY_MKDIR )
@@ -702,7 +703,7 @@ namespace fileaccess {
case FileBase::E_INVAL: // the format of the parameters was not valid
ioErrorCode = IOErrorCode_INVALID_PARAMETER;
break;
- case FileBase::E_NOMEM: // not enough memory for allocating structures
+ case FileBase::E_NOMEM: // not enough memory for allocating structures
ioErrorCode = IOErrorCode_OUT_OF_MEMORY;
break;
case FileBase::E_ROFS: // #i4735# handle ROFS transparently as ACCESS_DENIED
@@ -728,7 +729,7 @@ namespace fileaccess {
case FileBase::E_MULTIHOP: // Multihop attempted
case FileBase::E_FAULT: // Bad address
case FileBase::E_INTR: // function call was interrupted
- case FileBase::E_NOSYS: // Function not implemented
+ case FileBase::E_NOSYS: // Function not implemented
case FileBase::E_NOSPC: // No space left on device
case FileBase::E_NXIO: // No such device or address
case FileBase::E_OVERFLOW: // Value too large for defined data type
@@ -754,7 +755,7 @@ namespace fileaccess {
case FileBase::E_INVAL: // the format of the parameters was not valid
ioErrorCode = IOErrorCode_INVALID_PARAMETER;
break;
- case FileBase::E_NOMEM: // not enough memory for allocating structures
+ case FileBase::E_NOMEM: // not enough memory for allocating structures
ioErrorCode = IOErrorCode_OUT_OF_MEMORY;
break;
case FileBase::E_ACCES: // Permission denied
@@ -767,7 +768,7 @@ namespace fileaccess {
ioErrorCode = IOErrorCode_NAME_TOO_LONG;
break;
case FileBase::E_NOLINK: // Link has been severed
- case FileBase::E_NOENT: // No such file or directory
+ case FileBase::E_NOENT: // No such file or directory
ioErrorCode = IOErrorCode_NOT_EXISTING;
break;
case FileBase::E_ISDIR: // Is a directory
@@ -804,30 +805,30 @@ namespace fileaccess {
errorCode == TASKHANDLING_DIRECTORYEXHAUSTED_FOR_REMOVE ||
errorCode == TASKHANDLING_TRANSFER_INVALIDURL )
{
- rtl::OUString aMsg;
+ rtl::OUString aMsg;
switch( minorCode )
{
- case FileBase::E_NOENT: // No such file or directory
+ case FileBase::E_NOENT: // No such file or directory
if ( errorCode == TASKHANDLING_TRANSFER_BY_COPY_SOURCE ||
errorCode == TASKHANDLING_TRANSFER_BY_COPY_SOURCESTAT ||
errorCode == TASKHANDLING_TRANSFER_BY_MOVE_SOURCE ||
errorCode == TASKHANDLING_TRANSFER_BY_MOVE_SOURCESTAT )
{
ioErrorCode = IOErrorCode_NOT_EXISTING;
- aMsg = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ aMsg = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"source file/folder does not exist"));
break;
}
else
{
ioErrorCode = IOErrorCode_GENERAL;
- aMsg = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ aMsg = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"a general error during transfer command"));
break;
}
default:
ioErrorCode = IOErrorCode_GENERAL;
- aMsg = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ aMsg = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"a general error during transfer command"));
break;
}
@@ -896,7 +897,7 @@ namespace fileaccess {
case FileBase::E_NAMETOOLONG: // File name too long
ioErrorCode = IOErrorCode_NAME_TOO_LONG;
break;
- case FileBase::E_NOENT: // No such file or directory
+ case FileBase::E_NOENT: // No such file or directory
ioErrorCode = IOErrorCode_NOT_EXISTING;
aMsg = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"file/folder does not exist"));
diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx
index d706bf9ad0..b1b7f47fc1 100644
--- a/ucb/source/ucp/file/filtask.cxx
+++ b/ucb/source/ucp/file/filtask.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -33,11 +33,11 @@
#include "filtask.hxx"
#include "filglob.hxx"
-/*********************************************************************************/
-/* */
-/* TaskHandling */
-/* */
-/*********************************************************************************/
+/******************************************************************************/
+/* */
+/* TaskHandling */
+/* */
+/******************************************************************************/
using namespace fileaccess;
@@ -70,7 +70,9 @@ TaskManager::startTask(
TaskMap::iterator it = m_aTaskMap.find( CommandId );
if( it != m_aTaskMap.end() )
{
- throw DuplicateCommandIdentifierException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ throw DuplicateCommandIdentifierException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ),
+ uno::Reference< uno::XInterface >() );
}
m_aTaskMap[ CommandId ] = TaskHandling( xCommandEnv );
}
@@ -90,13 +92,14 @@ TaskManager::endTask( sal_Int32 CommandId,
sal_Int32 ErrorCode = it->second.getInstalledError();
sal_Int32 MinorCode = it->second.getMinorErrorCode();
bool isHandled = it->second.isHandled();
-
- Reference< XCommandEnvironment > xComEnv = it->second.getCommandEnvironment();
-
+
+ Reference< XCommandEnvironment > xComEnv
+ = it->second.getCommandEnvironment();
+
m_aTaskMap.erase( it );
-
+
if( ErrorCode != TASKHANDLER_NO_ERROR )
- throw_handler(
+ throw_handler(
ErrorCode,
MinorCode,
xComEnv,
@@ -122,17 +125,6 @@ TaskManager::abort( sal_Int32 CommandId )
}
-bool SAL_CALL TaskManager::isAborted( sal_Int32 CommandId )
-{
- osl::MutexGuard aGuard( m_aMutex );
- TaskMap::iterator it = m_aTaskMap.find( CommandId );
- if( it == m_aTaskMap.end() || it->second.isAborted() )
- return false;
- else
- return true;
-}
-
-
void SAL_CALL TaskManager::clearError( sal_Int32 CommandId )
{
osl::MutexGuard aGuard( m_aMutex );
@@ -178,59 +170,18 @@ TaskManager::getCommandId( void )
-uno::Reference< task::XInteractionHandler > SAL_CALL
-TaskManager::getInteractionHandler( sal_Int32 CommandId )
-{
- osl::MutexGuard aGuard( m_aMutex );
- TaskMap::iterator it = m_aTaskMap.find( CommandId );
- if( it == m_aTaskMap.end() )
- return uno::Reference< task::XInteractionHandler >( 0 );
- else
- return it->second.getInteractionHandler();
-}
-
-
-
-uno::Reference< XProgressHandler > SAL_CALL
-TaskManager::getProgressHandler( sal_Int32 CommandId )
-{
- osl::MutexGuard aGuard( m_aMutex );
- TaskMap::iterator it = m_aTaskMap.find( CommandId );
- if( it == m_aTaskMap.end() )
- return uno::Reference< XProgressHandler >( 0 );
- else
- return it->second.getProgressHandler();
-}
-
-
-uno::Reference< XCommandEnvironment > SAL_CALL
-TaskManager::getCommandEnvironment( sal_Int32 CommandId )
-{
- osl::MutexGuard aGuard( m_aMutex );
- TaskMap::iterator it = m_aTaskMap.find( CommandId );
- if( it == m_aTaskMap.end() )
- return uno::Reference< XCommandEnvironment >( 0 );
- else
- return it->second.getCommandEnvironment();
-}
-
-
-void SAL_CALL TaskManager::handleTask( sal_Int32 CommandId,
- const uno::Reference< task::XInteractionRequest >& request )
+void SAL_CALL TaskManager::handleTask(
+ sal_Int32 CommandId,
+ const uno::Reference< task::XInteractionRequest >& request )
{
osl::MutexGuard aGuard( m_aMutex );
TaskMap::iterator it = m_aTaskMap.find( CommandId );
uno::Reference< task::XInteractionHandler > xInt;
if( it != m_aTaskMap.end() )
{
- xInt = it->second.getInteractionHandler();
+ xInt = it->second.getInteractionHandler();
if( xInt.is() )
xInt->handle( request );
it->second.setHandled();
}
}
-
-
-
-
-
diff --git a/ucb/source/ucp/file/filtask.hxx b/ucb/source/ucp/file/filtask.hxx
index bcb57587a3..642c257b6d 100644
--- a/ucb/source/ucp/file/filtask.hxx
+++ b/ucb/source/ucp/file/filtask.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -40,43 +40,38 @@
#include <com/sun/star/ucb/XProgressHandler.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/task/XInteractionRequest.hpp>
-#ifndef _FILERROR_HXX_
#include "filerror.hxx"
-#endif
namespace fileaccess
{
class BaseContent;
-
+
/*
* This implementation is inherited by class fileaccess::shell.
* The relevant methods in this class all have as first argument the CommandId,
- * so if necessary, every method has acess to its relevant XInteractionHandler and
- * XProgressHandler, simply by calling directly the method
- * getInteractionHandler( CommandId )
- * and
- * getProgressHandler();
+ * so if necessary, every method has access to its relevant XInteractionHandler and
+ * XProgressHandler.
*/
class TaskManager
{
protected:
-
+
class TaskHandling
{
private:
-
+
bool m_bAbort,m_bHandled;
sal_Int32 m_nErrorCode,m_nMinorCode;
com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInteractionHandler;
com::sun::star::uno::Reference< com::sun::star::ucb::XProgressHandler > m_xProgressHandler;
com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCommandEnvironment;
-
+
public:
-
+
TaskHandling(
const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xCommandEnv
= com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >( 0 ) )
@@ -89,22 +84,17 @@ namespace fileaccess
m_xCommandEnvironment( xCommandEnv )
{
}
-
+
void SAL_CALL abort()
- {
+ {
m_bAbort = true;
}
- bool SAL_CALL isAborted()
- {
- return m_bAbort;
- }
-
void setHandled()
{
m_bHandled = true;
}
-
+
bool isHandled()
{
return true;
@@ -115,7 +105,7 @@ namespace fileaccess
m_nErrorCode = TASKHANDLER_NO_ERROR;
m_nMinorCode = TASKHANDLER_NO_ERROR;
}
-
+
void SAL_CALL installError( sal_Int32 nErrorCode,
sal_Int32 nMinorCode = TASKHANDLER_NO_ERROR )
{
@@ -132,7 +122,7 @@ namespace fileaccess
{
return m_nMinorCode;
}
-
+
com::sun::star::uno::Reference< com::sun::star::ucb::XProgressHandler > SAL_CALL
getProgressHandler()
{
@@ -147,43 +137,42 @@ namespace fileaccess
{
if( ! m_xInteractionHandler.is() && m_xCommandEnvironment.is() )
m_xInteractionHandler = m_xCommandEnvironment->getInteractionHandler();
-
+
return m_xInteractionHandler;
}
-
+
com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > SAL_CALL
getCommandEnvironment()
{
return m_xCommandEnvironment;
}
-
+
}; // end class TaskHandling
-
-
+
+
typedef std::hash_map< sal_Int32,TaskHandling,std::hash< sal_Int32 > > TaskMap;
-
-
+
+
private:
osl::Mutex m_aMutex;
- sal_Int32 m_nCommandId;
+ sal_Int32 m_nCommandId;
TaskMap m_aTaskMap;
-
+
public:
-
+
TaskManager();
virtual ~TaskManager();
-
- void SAL_CALL startTask(
+
+ void SAL_CALL startTask(
sal_Int32 CommandId,
const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xCommandEnv )
throw( com::sun::star::ucb::DuplicateCommandIdentifierException );
-
+
sal_Int32 SAL_CALL getCommandId( void );
void SAL_CALL abort( sal_Int32 CommandId );
- bool SAL_CALL isAborted( sal_Int32 CommandId );
-
+
/**
* The error code may be one of the error codes defined in
@@ -192,20 +181,20 @@ namespace fileaccess
*/
void SAL_CALL clearError();
-
+
void SAL_CALL installError( sal_Int32 CommandId,
sal_Int32 ErrorCode,
sal_Int32 minorCode = TASKHANDLER_NO_ERROR );
-
-// void SAL_CALL installError( sal_Int32 CommandId,
-// sal_Int32 ErrorCode,
-// rtl::OUString message );
-
-// void SAL_CALL installError( sal_Int32 CommandId,
-// sal_Int32 ErrorCode,
-// rtl::OUString message );
-
+
+// void SAL_CALL installError( sal_Int32 CommandId,
+// sal_Int32 ErrorCode,
+// rtl::OUString message );
+
+// void SAL_CALL installError( sal_Int32 CommandId,
+// sal_Int32 ErrorCode,
+// rtl::OUString message );
+
void SAL_CALL retrieveError( sal_Int32 CommandId,
sal_Int32 &ErrorCode,
sal_Int32 &minorCode);
@@ -214,36 +203,26 @@ namespace fileaccess
* Deinstalls the task and evaluates a possibly set error code.
* "endTask" throws in case an error code is set the corresponding exception.
*/
-
+
void SAL_CALL endTask( sal_Int32 CommandId,
// the physical URL of the object
const rtl::OUString& aUnqPath,
BaseContent* pContent);
-
-
+
+
/**
* Handles an interactionrequest
*/
-
+
void SAL_CALL handleTask( sal_Int32 CommandId,
const com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest >& request );
-
+
/**
* Clears any error which are set on the commandid
*/
-
- void SAL_CALL clearError( sal_Int32 );
-
-
- com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > SAL_CALL
- getInteractionHandler( sal_Int32 CommandId );
-
- com::sun::star::uno::Reference< com::sun::star::ucb::XProgressHandler > SAL_CALL
- getProgressHandler( sal_Int32 CommandId );
- com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > SAL_CALL
- getCommandEnvironment( sal_Int32 CommandId );
+ void SAL_CALL clearError( sal_Int32 );
};
-
+
} // end namespace TaskHandling
diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx
index 8e3ed6d46b..6957db82ed 100644
--- a/ucb/source/ucp/file/shell.cxx
+++ b/ucb/source/ucp/file/shell.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -46,23 +46,18 @@
#include <com/sun/star/ucb/NameClash.hpp>
#include <com/sun/star/ucb/XContentIdentifier.hpp>
#include <com/sun/star/lang/XComponent.hpp>
-#ifndef _COM_SUN_STAR_UCB_XCONTENTACCESS_
#include <com/sun/star/ucb/XContentAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/ucb/OpenCommandArgument.hpp>
#include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp>
#include <com/sun/star/ucb/TransferInfo.hpp>
+#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
#include <rtl/string.hxx>
-#ifndef _FILERROR_HXX_
#include "filerror.hxx"
-#endif
#include "filglob.hxx"
#include "filcmd.hxx"
#include "filinpstr.hxx"
@@ -188,9 +183,10 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF
IsHidden( rtl::OUString::createFromAscii( "IsHidden" ) ),
ContentType( rtl::OUString::createFromAscii( "ContentType" ) ),
IsReadOnly( rtl::OUString::createFromAscii( "IsReadOnly" ) ),
+ CreatableContentsInfo( rtl::OUString::createFromAscii( "CreatableContentsInfo" ) ),
FolderContentType( rtl::OUString::createFromAscii( "application/vnd.sun.staroffice.fsys-folder" ) ),
FileContentType( rtl::OUString::createFromAscii( "application/vnd.sun.staroffice.fsys-file" ) ),
- m_sCommandInfo( 8 )
+ m_sCommandInfo( 9 )
{
// Title
m_aDefaultProperties.insert( MyProperty( true,
@@ -294,7 +290,7 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF
| beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY ) );
- // Remote
+ // Hidden
m_aDefaultProperties.insert(
MyProperty(
true,
@@ -312,7 +308,6 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF
#endif
-
// ContentType
uno::Any aAny;
aAny <<= rtl::OUString();
@@ -358,6 +353,17 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF
| beans::PropertyAttribute::BOUND ) );
+ // CreatableContentsInfo
+ m_aDefaultProperties.insert( MyProperty( true,
+ CreatableContentsInfo,
+ -1 ,
+ getCppuType( static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ uno::Any(),
+ beans::PropertyState_DEFAULT_VALUE,
+ beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY ) );
+
// Commands
m_sCommandInfo[0].Name = rtl::OUString::createFromAscii( "getCommandInfo" );
m_sCommandInfo[0].Handle = -1;
@@ -391,6 +397,9 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF
m_sCommandInfo[7].Handle = -1;
m_sCommandInfo[7].ArgType = getCppuType( static_cast< InsertCommandArgument* > ( 0 ) );
+ m_sCommandInfo[7].Name = rtl::OUString::createFromAscii( "createNewContent" );
+ m_sCommandInfo[7].Handle = -1;
+ m_sCommandInfo[7].ArgType = getCppuType( static_cast< ucb::ContentInfo * > ( 0 ) );
if(m_bWithConfig)
{
@@ -900,7 +909,7 @@ shell::setv( const rtl::OUString& aUnqPath,
aFile.open(OpenFlag_Write) != osl::FileBase::E_None ||
aFile.setSize(sal_uInt64(newSize)) != osl::FileBase::E_None ||
aFile.close() != osl::FileBase::E_None;
-
+
if( err )
{
--propChanged; // unsuccessful setting
@@ -1131,7 +1140,7 @@ shell::move( sal_Int32 CommandId,
if( srcUnqPath == dstUnqPathIn )
return;
// <--
- //
+ //
osl::FileBase::RC nError;
rtl::OUString dstUnqPath( dstUnqPathIn );
@@ -1597,7 +1606,7 @@ shell::remove( sal_Int32 CommandId,
nError = aDirectory.getNextItem( aItem );
while( nError == osl::FileBase::E_None )
{
- nError = aItem.getFileStatus( aStatus );
+ nError = aItem.getFileStatus( aStatus );
if( nError != osl::FileBase::E_None || ! aStatus.isValid( nMask ) )
{
installError( CommandId,
@@ -1623,7 +1632,7 @@ shell::remove( sal_Int32 CommandId,
nError = aDirectory.getNextItem( aItem );
}
- aDirectory.close();
+ aDirectory.close();
if( ! whileSuccess )
return sal_False; // error code is installed
@@ -1907,7 +1916,7 @@ shell::write( sal_Int32 CommandId,
err );
bSuccess = sal_False;
}
-
+
err = aFile.close();
if( err != osl::FileBase::E_None )
{
@@ -2297,9 +2306,9 @@ shell::commit( const shell::ContentMap::iterator& it,
sal_Bool isDirectory,isFile,isVolume,isRemoveable,isRemote,isFloppy,isCompactDisc;
- sal_Int64 dirSize = 0;
-
- if( aFileStatus.isValid( FileStatusMask_FileSize ) )
+ sal_Int64 dirSize = 0;
+
+ if( aFileStatus.isValid( FileStatusMask_FileSize ) )
dirSize = aFileStatus.getFileSize();
if( aFileStatus.isValid( FileStatusMask_Type ) )
@@ -2320,7 +2329,7 @@ shell::commit( const shell::ContentMap::iterator& it,
isFile =
osl::FileStatus::Regular == aFileStatus2.getFileType();
- if( aFileStatus2.isValid( FileStatusMask_FileSize ) )
+ if( aFileStatus2.isValid( FileStatusMask_FileSize ) )
dirSize = aFileStatus2.getFileSize();
}
else
@@ -2346,17 +2355,17 @@ shell::commit( const shell::ContentMap::iterator& it,
osl::FileStatus::Regular == aFileStatus.getFileType();
}
- aAny <<= isVolume;
it1 = properties.find( MyProperty( IsVolume ) );
- if( it1 != properties.end() ) it1->setValue( aAny );
+ if( it1 != properties.end() )
+ it1->setValue( uno::makeAny( isVolume ) );
- aAny <<= isDirectory;
it1 = properties.find( MyProperty( IsFolder ) );
- if( it1 != properties.end() ) it1->setValue( aAny );
+ if( it1 != properties.end() )
+ it1->setValue( uno::makeAny( isDirectory ) );
- aAny <<= isFile;
it1 = properties.find( MyProperty( IsDocument ) );
- if( it1 != properties.end() ) it1->setValue( aAny );
+ if( it1 != properties.end() )
+ it1->setValue( uno::makeAny( isFile ) );
osl::VolumeInfo aVolumeInfo( VolumeInfoMask_Attributes );
if( isVolume &&
@@ -2369,44 +2378,51 @@ shell::commit( const shell::ContentMap::iterator& it,
isCompactDisc = aVolumeInfo.getCompactDiscFlag();
isFloppy = aVolumeInfo.getFloppyDiskFlag();
- aAny <<= isRemote;
it1 = properties.find( MyProperty( IsRemote ) );
- if( it1 != properties.end() ) it1->setValue( aAny );
+ if( it1 != properties.end() )
+ it1->setValue( uno::makeAny( isRemote ) );
- aAny <<= isRemoveable;
it1 = properties.find( MyProperty( IsRemoveable ) );
- if( it1 != properties.end() ) it1->setValue( aAny );
+ if( it1 != properties.end() )
+ it1->setValue( uno::makeAny( isRemoveable ) );
- aAny <<= isCompactDisc;
it1 = properties.find( MyProperty( IsCompactDisc ) );
- if( it1 != properties.end() ) it1->setValue( aAny );
+ if( it1 != properties.end() )
+ it1->setValue( uno::makeAny( isCompactDisc ) );
- aAny <<= isFloppy;
it1 = properties.find( MyProperty( IsFloppy ) );
- if( it1 != properties.end() ) it1->setValue( aAny );
+ if( it1 != properties.end() )
+ it1->setValue( uno::makeAny( isFloppy ) );
}
else
{
sal_Bool dummy = false;
aAny <<= dummy;
it1 = properties.find( MyProperty( IsRemote ) );
- if( it1 != properties.end() ) it1->setValue( aAny );
+ if( it1 != properties.end() )
+ it1->setValue( aAny );
+
it1 = properties.find( MyProperty( IsRemoveable ) );
- if( it1 != properties.end() ) it1->setValue( aAny );
+ if( it1 != properties.end() )
+ it1->setValue( aAny );
+
it1 = properties.find( MyProperty( IsCompactDisc ) );
- if( it1 != properties.end() ) it1->setValue( aAny );
+ if( it1 != properties.end() )
+ it1->setValue( aAny );
+
it1 = properties.find( MyProperty( IsFloppy ) );
- if( it1 != properties.end() ) it1->setValue( aAny );
+ if( it1 != properties.end() )
+ it1->setValue( aAny );
}
}
-
- it1 = properties.find( MyProperty( Size ) );
- if( it1 != properties.end() )
+ else
{
- aAny <<= dirSize;
- it1->setValue( aAny );
+ isDirectory = sal_False;
}
+ it1 = properties.find( MyProperty( Size ) );
+ if( it1 != properties.end() )
+ it1->setValue( uno::makeAny( dirSize ) );
it1 = properties.find( MyProperty( IsReadOnly ) );
if( it1 != properties.end() )
@@ -2415,8 +2431,7 @@ shell::commit( const shell::ContentMap::iterator& it,
{
sal_uInt64 Attr = aFileStatus.getAttributes();
sal_Bool readonly = ( Attr & Attribute_ReadOnly ) != 0;
- aAny <<= readonly;
- it1->setValue( aAny );
+ it1->setValue( uno::makeAny( readonly ) );
}
}
@@ -2427,13 +2442,11 @@ shell::commit( const shell::ContentMap::iterator& it,
{
sal_uInt64 Attr = aFileStatus.getAttributes();
sal_Bool ishidden = ( Attr & Attribute_Hidden ) != 0;
- aAny <<= ishidden;
- it1->setValue( aAny );
+ it1->setValue( uno::makeAny( ishidden ) );
}
}
it1 = properties.find( MyProperty( DateModified ) );
-
if( it1 != properties.end() )
{
if( aFileStatus.isValid( FileStatusMask_ModifyTime ) )
@@ -2441,7 +2454,7 @@ shell::commit( const shell::ContentMap::iterator& it,
TimeValue temp = aFileStatus.getModifyTime();
// Convert system time to local time (for EA)
- TimeValue myLocalTime;
+ TimeValue myLocalTime;
osl_getLocalTimeFromSystemTime( &temp, &myLocalTime );
oslDateTime myDateTime;
@@ -2455,11 +2468,16 @@ shell::commit( const shell::ContentMap::iterator& it,
aDateTime.Day = myDateTime.Day;
aDateTime.Month = myDateTime.Month;
aDateTime.Year = myDateTime.Year;
- aAny <<= aDateTime;
- it1->setValue( aAny );
+ it1->setValue( uno::makeAny( aDateTime ) );
}
}
+ it1 = properties.find( MyProperty( CreatableContentsInfo ) );
+ if( it1 != properties.end() )
+ it1->setValue( uno::makeAny(
+ isDirectory || !aFileStatus.isValid( FileStatusMask_Type )
+ ? queryCreatableContentsInfo()
+ : uno::Sequence< ucb::ContentInfo >() ) );
}
@@ -2494,12 +2512,12 @@ shell::getv(
{
// Assume failure
aIsRegular = false;
- osl::FileBase::RC result = osl::FileBase::E_INVAL;
- osl::DirectoryItem aTargetItem;
+ 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 );
+ osl::FileStatus aTargetStatus( FileStatusMask_Type );
if ( osl::FileBase::E_None ==
( result = aTargetItem.getFileStatus( aTargetStatus ) ) )
@@ -3000,6 +3018,31 @@ shell::copyPersistentSet( const rtl::OUString& srcUnqPath,
} // end for( sal_Int...
}
+uno::Sequence< ucb::ContentInfo > shell::queryCreatableContentsInfo()
+{
+ uno::Sequence< ucb::ContentInfo > seq(2);
+
+ // file
+ seq[0].Type = FileContentType;
+ seq[0].Attributes = ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
+ | ucb::ContentInfoAttribute::KIND_DOCUMENT;
+
+ uno::Sequence< beans::Property > props( 1 );
+ props[0] = beans::Property(
+ rtl::OUString::createFromAscii( "Title" ),
+ -1,
+ getCppuType( static_cast< rtl::OUString* >( 0 ) ),
+ beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::BOUND );
+ seq[0].Properties = props;
+
+ // folder
+ seq[1].Type = FolderContentType;
+ seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER;
+ seq[1].Properties = props;
+ return seq;
+}
+
/*******************************************************************************/
/* */
/* some misceancellous static functions */
diff --git a/ucb/source/ucp/file/shell.hxx b/ucb/source/ucp/file/shell.hxx
index 89e2324d74..80ffd38f55 100644
--- a/ucb/source/ucp/file/shell.hxx
+++ b/ucb/source/ucp/file/shell.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -54,21 +54,18 @@
#include <com/sun/star/ucb/XCommandProcessor.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_protected
#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#endif
#include <com/sun/star/beans/XPropertiesChangeNotifier.hpp>
#include <com/sun/star/ucb/NumberedSortingInfo.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ucb/XContentProvider.hpp>
-#ifndef _COM_SUN_STAR_UCB_XDYNAMICRESULTSET_HPP__
#include <com/sun/star/ucb/XDynamicResultSet.hpp>
-#endif
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <com/sun/star/beans/XPropertyAccess.hpp>
#include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp>
#include <com/sun/star/ucb/TransferInfo.hpp>
+#include <com/sun/star/ucb/ContentInfo.hpp>
#include "filtask.hxx"
#include "filnot.hxx"
@@ -307,7 +304,7 @@ namespace fileaccess {
/********************************************************************************/
- /* transfer-commandos */
+ /* transfer-commands */
/********************************************************************************/
/**
@@ -398,6 +395,9 @@ namespace fileaccess {
void SAL_CALL insertDefaultProperties( const rtl::OUString& aUnqPath );
+ com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
+ queryCreatableContentsInfo();
+
/******************************************************************************/
/* */
@@ -416,11 +416,10 @@ namespace fileaccess {
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMultiServiceFactory;
com::sun::star::uno::Reference< com::sun::star::ucb::XPropertySetRegistry > m_xFileRegistry;
-
private:
/********************************************************************************/
- /* get eventListeners */
+ /* get eventListeners */
/********************************************************************************/
std::list< ContentEventNotifier* >* SAL_CALL
@@ -442,7 +441,7 @@ namespace fileaccess {
/********************************************************************************/
- /* notify eventListeners */
+ /* notify eventListeners */
/********************************************************************************/
void SAL_CALL notifyPropertyChanges(
@@ -580,6 +579,7 @@ namespace fileaccess {
const rtl::OUString IsHidden;
const rtl::OUString ContentType;
const rtl::OUString IsReadOnly;
+ const rtl::OUString CreatableContentsInfo;
public:
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index c3e6563d38..73300c1684 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -106,19 +106,6 @@ using namespace com::sun::star::sdbc;
FTPContent::FTPContent( const Reference< XMultiServiceFactory >& rxSMgr,
FTPContentProvider* pProvider,
- const Reference< XContentIdentifier >& Identifier)
- : ContentImplHelper(rxSMgr,pProvider,Identifier),
- m_pFCP(pProvider),
- m_aFTPURL(Identifier->getContentIdentifier(),
- pProvider),
- m_bInserted(false),
- m_bTitleSet(false)
-{
-}
-
-
-FTPContent::FTPContent( const Reference< XMultiServiceFactory >& rxSMgr,
- FTPContentProvider* pProvider,
const Reference< XContentIdentifier >& Identifier,
const FTPURL& aFTPURL)
: ContentImplHelper(rxSMgr,pProvider,Identifier),
@@ -175,9 +162,9 @@ XINTERFACE_IMPL_6( FTPContent,
//=========================================================================
XTYPEPROVIDER_IMPL_6( FTPContent,
- XTypeProvider,
- XServiceInfo,
- XContent,
+ XTypeProvider,
+ XServiceInfo,
+ XContent,
XCommandProcessor,
XContentCreator,
XChild);
@@ -231,7 +218,7 @@ void SAL_CALL FTPContent::abort( sal_Int32 /*CommandId*/ )
/***************************************************************************/
/* */
-/* Interne Implklasse */
+/* Internal implementation class. */
/* */
/***************************************************************************/
@@ -240,7 +227,7 @@ class ResultSetFactoryI
: public ResultSetFactory
{
public:
-
+
ResultSetFactoryI(const Reference<XMultiServiceFactory >& xSMgr,
const Reference<XContentProvider >& xProvider,
sal_Int32 nOpenMode,
@@ -255,7 +242,7 @@ public:
m_dirvec(dirvec)
{
}
-
+
virtual ResultSetBase* createResultSet()
{
return new ResultSetI(m_xSMgr,
@@ -265,9 +252,9 @@ public:
m_seqSort,
m_dirvec);
}
-
+
public:
-
+
Reference< XMultiServiceFactory > m_xSMgr;
Reference< XContentProvider > m_xProvider;
sal_Int32 m_nOpenMode;
@@ -306,10 +293,10 @@ Any SAL_CALL FTPContent::execute(
CommandAbortedException,
RuntimeException
)
-{
+{
ACTION action(NOACTION);
Any aRet;
-
+
while(true)
try {
if(action == THROWAUTHENTICATIONREQUEST) {
@@ -330,20 +317,20 @@ Any SAL_CALL FTPContent::execute(
::ENTITY_FIXED,
m_aFTPURL.username(),
ucbhelper::SimpleAuthenticationRequest
- ::ENTITY_MODIFY,
+ ::ENTITY_MODIFY,
aPassword));
-
+
Reference<XInteractionHandler> xInteractionHandler;
if(Environment.is())
xInteractionHandler =
Environment->getInteractionHandler();
-
+
if( xInteractionHandler.is()) {
xInteractionHandler->handle(p.get());
-
+
Reference<XInterface> xSelection(
p->getSelection().get());
-
+
if(Reference<XInteractionRetry>(
xSelection,UNO_QUERY).is())
action = NOACTION;
@@ -360,82 +347,101 @@ Any SAL_CALL FTPContent::execute(
}
aRet = p->getRequest();
}
-
-// if(aCommand.Name.compareToAscii(
-// "getPropertyValues") == 0 &&
-// action != NOACTION) {
-// // It is not allowed to throw if
-// // command is getPropertyValues
-// rtl::Reference<ucbhelper::PropertyValueSet> xRow =
-// new ucbhelper::PropertyValueSet(m_xSMgr);
-// Sequence<Property> Properties;
-// aCommand.Argument >>= Properties;
-// for(int i = 0; i < Properties.getLength(); ++i)
-// xRow->appendVoid(Properties[i]);
-// aRet <<= Reference<XRow>(xRow.get());
-// return aRet;
-// }
-
- if(action == THROWAUTHENTICATIONREQUEST) {
+
+// if(aCommand.Name.compareToAscii(
+// "getPropertyValues") == 0 &&
+// action != NOACTION) {
+// // It is not allowed to throw if
+// // command is getPropertyValues
+// rtl::Reference<ucbhelper::PropertyValueSet> xRow =
+// new ucbhelper::PropertyValueSet(m_xSMgr);
+// Sequence<Property> Properties;
+// aCommand.Argument >>= Properties;
+// for(int i = 0; i < Properties.getLength(); ++i)
+// xRow->appendVoid(Properties[i]);
+// aRet <<= Reference<XRow>(xRow.get());
+// return aRet;
+// }
+
+ switch (action)
+ {
+ case NOACTION:
+ break;
+
+ case THROWAUTHENTICATIONREQUEST:
ucbhelper::cancelCommandExecution(
aRet,
Reference<XCommandEnvironment>(0));
- } else if(action == THROWACCESSDENIED) {
- Sequence<Any> seq(1);
- PropertyValue value;
- value.Name =
- rtl::OUString::createFromAscii("Uri");
- value.Handle = -1;
- value.Value <<= m_aFTPURL.ident(false,false);
- value.State = PropertyState_DIRECT_VALUE;
- seq[0] <<= value;
- ucbhelper::cancelCommandExecution(
- IOErrorCode_ACCESS_DENIED,
- seq,
- Environment);
- } else if(action == THROWINTERACTIVECONNECT) {
- InteractiveNetworkConnectException
- excep;
- excep.Server = m_aFTPURL.host();
- aRet <<= excep;
- ucbhelper::cancelCommandExecution(
- aRet,
- Environment);
- } else if(action == THROWRESOLVENAME) {
- InteractiveNetworkResolveNameException
- excep;
- excep.Server = m_aFTPURL.host();
- aRet <<= excep;
- ucbhelper::cancelCommandExecution(
- aRet,
- Environment);
- } else if(action == THROWNOFILE) {
- Sequence<Any> seq(1);
- PropertyValue value;
- value.Name =
- rtl::OUString::createFromAscii("Uri");
- value.Handle = -1;
- value.Value <<= m_aFTPURL.ident(false,false);
- value.State = PropertyState_DIRECT_VALUE;
- seq[0] <<= value;
- ucbhelper::cancelCommandExecution(
- IOErrorCode_NO_FILE,
- seq,
- Environment);
- } else if(action == THROWQUOTE ||
- action == THROWGENERAL) {
+ break;
+
+ case THROWACCESSDENIED:
+ {
+ Sequence<Any> seq(1);
+ PropertyValue value;
+ value.Name = rtl::OUString::createFromAscii("Uri");
+ value.Handle = -1;
+ value.Value <<= m_aFTPURL.ident(false,false);
+ value.State = PropertyState_DIRECT_VALUE;
+ seq[0] <<= value;
+ ucbhelper::cancelCommandExecution(
+ IOErrorCode_ACCESS_DENIED,
+ seq,
+ Environment);
+ break;
+ }
+ case THROWINTERACTIVECONNECT:
+ {
+ InteractiveNetworkConnectException excep;
+ excep.Server = m_aFTPURL.host();
+ aRet <<= excep;
+ ucbhelper::cancelCommandExecution(
+ aRet,
+ Environment);
+ break;
+ }
+ case THROWRESOLVENAME:
+ {
+ InteractiveNetworkResolveNameException excep;
+ excep.Server = m_aFTPURL.host();
+ aRet <<= excep;
+ ucbhelper::cancelCommandExecution(
+ aRet,
+ Environment);
+ break;
+ }
+ case THROWNOFILE:
+ {
+ Sequence<Any> seq(1);
+ PropertyValue value;
+ value.Name = rtl::OUString::createFromAscii("Uri");
+ value.Handle = -1;
+ value.Value <<= m_aFTPURL.ident(false,false);
+ value.State = PropertyState_DIRECT_VALUE;
+ seq[0] <<= value;
+ ucbhelper::cancelCommandExecution(
+ IOErrorCode_NO_FILE,
+ seq,
+ Environment);
+ break;
+ }
+ case THROWQUOTE:
+ case THROWGENERAL:
ucbhelper::cancelCommandExecution(
IOErrorCode_GENERAL,
Sequence<Any>(0),
- Environment);
+ Environment);
+ break;
}
-
-
+
if(aCommand.Name.compareToAscii("getPropertyValues") == 0) {
Sequence<Property> Properties;
if(!(aCommand.Argument >>= Properties))
{
- aRet <<= IllegalArgumentException();
+ aRet <<= IllegalArgumentException(
+ rtl::OUString::createFromAscii(
+ "Wrong argument type!" ),
+ static_cast< cppu::OWeakObject * >(this),
+ -1);
ucbhelper::cancelCommandExecution(aRet,Environment);
}
@@ -444,12 +450,16 @@ Any SAL_CALL FTPContent::execute(
else if(aCommand.Name.compareToAscii("setPropertyValues") == 0)
{
Sequence<PropertyValue> propertyValues;
-
+
if( ! ( aCommand.Argument >>= propertyValues ) ) {
- aRet <<= IllegalArgumentException();
+ aRet <<= IllegalArgumentException(
+ rtl::OUString::createFromAscii(
+ "Wrong argument type!" ),
+ static_cast< cppu::OWeakObject * >(this),
+ -1);
ucbhelper::cancelCommandExecution(aRet,Environment);
}
-
+
aRet <<= setPropertyValues(propertyValues);
}
else if(aCommand.Name.compareToAscii("getCommandInfo") == 0) {
@@ -464,7 +474,11 @@ Any SAL_CALL FTPContent::execute(
{
InsertCommandArgument aInsertArgument;
if ( ! ( aCommand.Argument >>= aInsertArgument ) ) {
- aRet <<= IllegalArgumentException();
+ aRet <<= IllegalArgumentException(
+ rtl::OUString::createFromAscii(
+ "Wrong argument type!" ),
+ static_cast< cppu::OWeakObject * >(this),
+ -1);
ucbhelper::cancelCommandExecution(aRet,Environment);
}
insert(aInsertArgument,Environment);
@@ -476,17 +490,22 @@ Any SAL_CALL FTPContent::execute(
else if(aCommand.Name.compareToAscii( "open" ) == 0) {
OpenCommandArgument2 aOpenCommand;
if ( !( aCommand.Argument >>= aOpenCommand ) ) {
- aRet <<= IllegalArgumentException();
+ aRet <<= IllegalArgumentException(
+ rtl::OUString::createFromAscii(
+ "Wrong argument type!" ),
+ static_cast< cppu::OWeakObject * >(this),
+ -1);
+
ucbhelper::cancelCommandExecution(aRet,Environment);
}
-
+
if(aOpenCommand.Mode == OpenMode::DOCUMENT) {
// Open as a document
Reference<XActiveDataSink>
xActiveDataSink(aOpenCommand.Sink,UNO_QUERY);
Reference< XOutputStream >
xOutputStream(aOpenCommand.Sink,UNO_QUERY);
-
+
if(xActiveDataSink.is()) {
xActiveDataSink->setInputStream(
new FTPInputStream(m_aFTPURL.open()));
@@ -506,17 +525,17 @@ Any SAL_CALL FTPContent::execute(
byte_seq.realloc(n);
xOutputStream->writeBytes(byte_seq);
} catch(const NotConnectedException&) {
-
+
} catch(const BufferSizeExceededException&) {
-
+
} catch(const IOException&) {
-
+
}
}
if(n) {
Sequence<Any> seq(1);
PropertyValue value;
- value.Name =
+ value.Name =
rtl::OUString::createFromAscii("Uri");
value.Handle = -1;
value.Value <<= m_aFTPURL.ident(false,false);
@@ -529,7 +548,10 @@ Any SAL_CALL FTPContent::execute(
}
}
else {
- aRet <<= UnsupportedDataSinkException();
+ aRet <<= UnsupportedDataSinkException(
+ rtl::OUString(),
+ static_cast< cppu::OWeakObject * >(this),
+ aOpenCommand.Sink);
ucbhelper::cancelCommandExecution(aRet,Environment);
}
}
@@ -553,33 +575,58 @@ Any SAL_CALL FTPContent::execute(
aRet <<= xSet;
}
else if(aOpenCommand.Mode ==
- OpenMode::DOCUMENT_SHARE_DENY_NONE ||
+ OpenMode::DOCUMENT_SHARE_DENY_NONE ||
aOpenCommand.Mode ==
OpenMode::DOCUMENT_SHARE_DENY_WRITE) {
// Unsupported OpenMode
- aRet <<= UnsupportedOpenModeException();
+ aRet <<= UnsupportedOpenModeException(
+ rtl::OUString(),
+ static_cast< cppu::OWeakObject * >(this),
+ static_cast< sal_Int16 >(aOpenCommand.Mode));
ucbhelper::cancelCommandExecution(aRet,Environment);
}
else {
- // IllegalArgumentException:: No OpenMode
- aRet <<= IllegalArgumentException();
+ aRet <<= IllegalArgumentException(
+ rtl::OUString::createFromAscii(
+ "Unexpected OpenMode!" ),
+ static_cast< cppu::OWeakObject * >(this),
+ -1);
+
ucbhelper::cancelCommandExecution(aRet,Environment);
}
- }
- else {
- aRet <<= UnsupportedCommandException();
+ } else if(aCommand.Name.compareToAscii("createNewContent") == 0) {
+ ContentInfo aArg;
+ if (!(aCommand.Argument >>= aArg)) {
+ ucbhelper::cancelCommandExecution(
+ makeAny(
+ IllegalArgumentException(
+ rtl::OUString::createFromAscii(
+ "Wrong argument type!" ),
+ static_cast< cppu::OWeakObject * >(this),
+ -1)),
+ Environment);
+ // Unreachable
+ }
+ aRet <<= createNewContent(aArg);
+ } else {
+ aRet <<= UnsupportedCommandException(
+ aCommand.Name,
+ static_cast< cppu::OWeakObject * >(this));
ucbhelper::cancelCommandExecution(aRet,Environment);
}
-
- return aRet;
+
+ return aRet;
} catch(const curl_exception& e) {
if(e.code() == CURLE_COULDNT_CONNECT)
action = THROWINTERACTIVECONNECT;
else if(e.code() == CURLE_COULDNT_RESOLVE_HOST )
action = THROWRESOLVENAME;
else if(e.code() == CURLE_FTP_USER_PASSWORD_INCORRECT ||
- e.code() == CURLE_BAD_PASSWORD_ENTERED ||
- e.code() == CURLE_FTP_WEIRD_PASS_REPLY )
+#if LIBCURL_VERSION_NUM>=0x070d01 /* 7.13.1 */
+ e.code() == CURLE_LOGIN_DENIED ||
+#endif
+ e.code() == CURLE_BAD_PASSWORD_ENTERED ||
+ e.code() == CURLE_FTP_WEIRD_PASS_REPLY)
action = THROWAUTHENTICATIONREQUEST;
else if(e.code() == CURLE_FTP_ACCESS_DENIED)
action = THROWACCESSDENIED;
@@ -588,7 +635,7 @@ Any SAL_CALL FTPContent::execute(
else if(e.code() == CURLE_FTP_COULDNT_RETR_FILE)
action = THROWNOFILE;
else
- // nothing known about the course of the error
+ // nothing known about the cause of the error
action = THROWGENERAL;
}
}
@@ -602,14 +649,22 @@ Any SAL_CALL FTPContent::execute(
"vnd.sun.staroffice.ftp-folder")
Sequence<ContentInfo > SAL_CALL
-FTPContent::queryCreatableContentsInfo( )
+FTPContent::queryCreatableContentsInfo( )
+ throw (RuntimeException)
+{
+ return queryCreatableContentsInfo_Static();
+}
+
+// static
+Sequence<ContentInfo >
+FTPContent::queryCreatableContentsInfo_Static( )
throw (RuntimeException)
{
Sequence< ContentInfo > seq(2);
-
+
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" ),
@@ -620,14 +675,13 @@ FTPContent::queryCreatableContentsInfo( )
seq[0].Properties = props;
// folder
- seq[1].Type = FTP_FOLDER;
+ seq[1].Type = FTP_FOLDER;
seq[1].Attributes = ContentInfoAttribute::KIND_FOLDER;
seq[1].Properties = props;
return seq;
}
-
Reference<XContent > SAL_CALL
FTPContent::createNewContent( const ContentInfo& Info )
throw (RuntimeException)
@@ -655,16 +709,16 @@ FTPContent::getParent( )
Reference<XContent> xContent(m_xProvider->queryContent(xIdent));
return Reference<XInterface>(xContent,UNO_QUERY);
}
-
+
void SAL_CALL
FTPContent::setParent(const Reference<XInterface >& /*Parent*/ )
- throw (NoSupportException,
+ throw (NoSupportException,
RuntimeException)
{
throw NoSupportException();
}
-
+
rtl::OUString FTPContent::getParentURL()
@@ -677,11 +731,11 @@ class InsertData
: public CurlInput {
public:
-
+
InsertData(const Reference<XInputStream>& xInputStream)
: m_xInputStream(xInputStream) { }
virtual ~InsertData() {}
-
+
// returns the number of bytes actually read
virtual sal_Int32 read(sal_Int8 *dest,sal_Int32 nBytesRequested);
@@ -695,9 +749,9 @@ private:
sal_Int32 InsertData::read(sal_Int8 *dest,sal_Int32 nBytesRequested)
{
sal_Int32 m = 0;
-
+
if(m_xInputStream.is()) {
- Sequence<sal_Int8> seq(nBytesRequested);
+ Sequence<sal_Int8> seq(nBytesRequested);
m = m_xInputStream->readBytes(seq,nBytesRequested);
rtl_copyMemory(dest,seq.getConstArray(),m);
}
@@ -720,15 +774,15 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand,
if(m_bInserted &&
m_aInfo.Type == FTP_FILE &&
- !aInsertCommand.Data.is())
+ !aInsertCommand.Data.is())
{
MissingInputStreamException excep;
Any aAny; aAny <<= excep;
ucbhelper::cancelCommandExecution(aAny,Env);
}
-
+
bool bReplace(aInsertCommand.ReplaceExisting);
-
+
retry:
try {
if(m_aInfo.Type == FTP_FILE) {
@@ -751,17 +805,17 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand,
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 =
+
+ XInteractionRequestImpl* p =
new XInteractionRequestImpl(m_aFTPURL.child());
Reference<XInteractionRequest> req(p);
xInt->handle(req);
@@ -775,7 +829,7 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand,
else
throw;
}
-
+
// May not be reached, because both mkdir and insert can throw curl-
// exceptions
m_bInserted = false;
@@ -784,20 +838,23 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand,
-Reference< XRow > FTPContent::getPropertyValues(
+Reference< XRow > FTPContent::getPropertyValues(
const Sequence< Property >& seqProp,
const Reference<XCommandEnvironment>& /*environment*/
)
{
- rtl::Reference<ucbhelper::PropertyValueSet> xRow =
+ rtl::Reference<ucbhelper::PropertyValueSet> xRow =
new ucbhelper::PropertyValueSet(m_xSMgr);
-
+
FTPDirentry aDirEntry = m_aFTPURL.direntry();
-
+
for(sal_Int32 i = 0; i < seqProp.getLength(); ++i) {
const rtl::OUString& Name = seqProp[i].Name;
if(Name.compareToAscii("Title") == 0)
xRow->appendString(seqProp[i],aDirEntry.m_aName);
+ else if(Name.compareToAscii("CreatableContentsInfo") == 0)
+ xRow->appendObject(seqProp[i],
+ makeAny(queryCreatableContentsInfo()));
else if(aDirEntry.m_nMode != INETCOREFTP_FILEMODE_UNKNOWN) {
if(Name.compareToAscii("ContentType") == 0)
xRow->appendString(seqProp[i],
@@ -829,7 +886,7 @@ Reference< XRow > FTPContent::getPropertyValues(
} else
xRow->appendVoid(seqProp[i]);
}
-
+
return Reference<XRow>(xRow.get());
}
@@ -838,12 +895,9 @@ Reference< XRow > FTPContent::getPropertyValues(
Sequence<Any> FTPContent::setPropertyValues(
const Sequence<PropertyValue>& seqPropVal)
{
- Sequence<Property> props =
- getProperties(Reference<XCommandEnvironment>(0));
-
Sequence<Any> ret(seqPropVal.getLength());
Sequence<PropertyChangeEvent > evt;
-
+
osl::MutexGuard aGuard(m_aMutex);
for(sal_Int32 i = 0; i < ret.getLength(); ++i) {
if(seqPropVal[i].Name.equalsAscii("Title")) {
@@ -855,10 +909,10 @@ Sequence<Any> FTPContent::setPropertyValues(
ret[i] <<= IllegalArgumentException();
continue;
}
-
+
if(m_bInserted) {
m_aFTPURL.child(Title);
- m_xIdentifier =
+ m_xIdentifier =
new FTPContentIdentifier(m_aFTPURL.ident(false,false));
m_bTitleSet = true;
} else
@@ -879,21 +933,30 @@ Sequence<Any> FTPContent::setPropertyValues(
ret[i] <<= excep;
}
} else {
- // either not unknown or illegal
+ Sequence<Property> props =
+ getProperties(Reference<XCommandEnvironment>(0));
+
+ // either unknown or read-only
ret[i] <<= UnknownPropertyException();
for(sal_Int32 j = 0; j < props.getLength(); ++j)
if(props[j].Name == seqPropVal[i].Name) {
- ret[i] <<= IllegalAccessException();
+ ret[i] <<= IllegalAccessException(
+ rtl::OUString::createFromAscii(
+ "Property is read-only!"),
+ //props[j].Attributes & PropertyAttribute::READONLY
+ // ? "Property is read-only!"
+ // : "Access denied!"),
+ static_cast< cppu::OWeakObject * >( this ));
break;
}
}
}
-
+
if(evt.getLength()) {
// title has changed
notifyPropertiesChange(evt);
exchange(new FTPContentIdentifier(m_aFTPURL.ident(false,false)));
}
-
+
return ret;
}
diff --git a/ucb/source/ucp/ftp/ftpcontent.hxx b/ucb/source/ucp/ftp/ftpcontent.hxx
index 0d8cd8e425..0b41c9be1d 100644
--- a/ucb/source/ucp/ftp/ftpcontent.hxx
+++ b/ucb/source/ucp/ftp/ftpcontent.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -51,30 +51,17 @@ namespace ftp
{
//=========================================================================
-
+
// UNO service name for the content.
#define FTP_CONTENT_SERVICE_NAME "com.sun.star.ucb.FTPContent"
//=========================================================================
- struct ContentProperties
- {
- ::rtl::OUString aTitle; // Title
- ::rtl::OUString aContentType; // ContentType
- sal_Bool bIsDocument; // IsDocument
- sal_Bool bIsFolder; // IsFolder
-
- ContentProperties()
- : bIsDocument( sal_True ), bIsFolder( sal_False ) {}
- };
-
-//=========================================================================
-
class FTPContentProvider;
//=========================================================================
-
- class FTPContent
+
+ class FTPContent
: public ::ucbhelper::ContentImplHelper,
public com::sun::star::ucb::XContentCreator
{
@@ -84,23 +71,17 @@ namespace ftp
::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
FTPContentProvider* pProvider,
const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XContentIdentifier >& Identifier);
-
- FTPContent( const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
- FTPContentProvider* pProvider,
- const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XContentIdentifier >& Identifier,
const FTPURL& FtpUrl);
-
+
FTPContent( const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
FTPContentProvider* pProvider,
const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XContentIdentifier >& Identifier,
const com::sun::star::ucb::ContentInfo& aInfo);
-
-
+
+
virtual ~FTPContent();
// XInterface
@@ -126,7 +107,7 @@ namespace ftp
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);
@@ -134,62 +115,67 @@ namespace ftp
// XContentCreator
virtual com::sun::star::uno::Sequence<
com::sun::star::ucb::ContentInfo > SAL_CALL
- queryCreatableContentsInfo( )
+ queryCreatableContentsInfo( )
throw (com::sun::star::uno::RuntimeException);
-
+
virtual com::sun::star::uno::Reference<
com::sun::star::ucb::XContent > SAL_CALL
createNewContent( const com::sun::star::ucb::ContentInfo& Info )
throw (com::sun::star::uno::RuntimeException);
-
+
// XChild
-
+
virtual ::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface > SAL_CALL
- getParent( )
+ getParent( )
throw (::com::sun::star::uno::RuntimeException);
-
+
virtual void SAL_CALL
setParent( const ::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XInterface >& Parent )
- throw (::com::sun::star::lang::NoSupportException,
+ ::com::sun::star::uno::XInterface >& Parent )
+ throw (::com::sun::star::lang::NoSupportException,
::com::sun::star::uno::RuntimeException);
-
+
+
+ static com::sun::star::uno::Sequence<
+ com::sun::star::ucb::ContentInfo >
+ queryCreatableContentsInfo_Static( )
+ throw (com::sun::star::uno::RuntimeException);
private:
-
+
FTPContentProvider *m_pFCP;
FTPURL m_aFTPURL;
- bool m_bInserted;
+ bool m_bInserted;
bool m_bTitleSet;
com::sun::star::ucb::ContentInfo m_aInfo;
-
+
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<
+
+
+ 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>
+ com::sun::star::uno::Reference<com::sun::star::sdbc::XRow>
getPropertyValues(
const com::sun::star::uno::Sequence<
com::sun::star::beans::Property>& seqProp,
const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& Environment
+ com::sun::star::ucb::XCommandEnvironment >& Environment
);
com::sun::star::uno::Sequence<com::sun::star::uno::Any>
setPropertyValues(
const ::com::sun::star::uno::Sequence<
::com::sun::star::beans::PropertyValue>& seqPropVal);
-
+
void insert(const com::sun::star::ucb::InsertCommandArgument&,
const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment>&);
diff --git a/ucb/source/ucp/ftp/ftpcontentcaps.cxx b/ucb/source/ucp/ftp/ftpcontentcaps.cxx
index 7fc47b4cac..874bb9bbd0 100644
--- a/ucb/source/ucp/ftp/ftpcontentcaps.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentcaps.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -49,7 +49,7 @@ using namespace ftp;
uno::Sequence< beans::Property > FTPContent::getProperties(
const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/)
{
- #define PROPS_COUNT 7
+ #define PROPS_COUNT 8
static const beans::Property aPropsInfoTable[] =
{
@@ -57,54 +57,63 @@ uno::Sequence< beans::Property > FTPContent::getProperties(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
-1,
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::READONLY
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
),
beans::Property(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
-1,
getCppuBooleanType(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::READONLY
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
),
beans::Property(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
-1,
getCppuBooleanType(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::READONLY
+ 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
- // | beans::PropertyAttribute::READONLY
+ // | beans::PropertyAttribute::READONLY
),
beans::Property(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ),
-1,
getCppuType( static_cast< const sal_Int64 * >( 0 ) ),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::READONLY
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
),
beans::Property(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateCreated" ) ),
-1,
- getCppuType( static_cast< util::DateTime* >( 0 ) ),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::READONLY
+ getCppuType( static_cast< 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
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
+ ),
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType(
+ static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
)
};
- return uno::Sequence< beans::Property >( aPropsInfoTable,PROPS_COUNT);
+ return uno::Sequence< beans::Property >( aPropsInfoTable, PROPS_COUNT );
}
//=========================================================================
@@ -112,15 +121,15 @@ uno::Sequence< beans::Property > FTPContent::getProperties(
uno::Sequence< ucb::CommandInfo > FTPContent::getCommands(
const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
{
-// osl::MutexGuard aGuard( m_aMutex );
-
+// osl::MutexGuard aGuard( m_aMutex );
+
//=================================================================
//
// Supported commands
//
//=================================================================
- #define COMMAND_COUNT 7
+ #define COMMAND_COUNT 8
static const ucb::CommandInfo aCommandInfoTable[] =
{
@@ -133,44 +142,49 @@ uno::Sequence< ucb::CommandInfo > FTPContent::getCommands(
getCppuVoidType()
),
ucb::CommandInfo(
- rtl::OUString(
+ rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
-1,
getCppuVoidType()
),
ucb::CommandInfo(
- rtl::OUString(
+ rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
-1,
- getCppuType(
+ getCppuType(
static_cast< uno::Sequence< beans::Property > * >( 0 ) )
),
ucb::CommandInfo(
- rtl::OUString(
+ rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
-1,
- getCppuType(
+ getCppuType(
static_cast< uno::Sequence< beans::PropertyValue > * >( 0 ) )
),
ucb::CommandInfo(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
-1,
- getCppuType(
+ getCppuType(
static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
),
ucb::CommandInfo(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
-1,
- getCppuType(
+ getCppuType(
static_cast< ucb::InsertCommandArgument * >( 0 ) )
),
ucb::CommandInfo(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
-1,
- getCppuType( static_cast< sal_Bool * >( 0 ) )
+ getCppuBooleanType()
+ ),
+ ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
+ -1,
+ getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
)
};
-
- return uno::Sequence<ucb::CommandInfo>(aCommandInfoTable,COMMAND_COUNT);
+
+ return uno::Sequence< ucb::CommandInfo >( aCommandInfoTable, COMMAND_COUNT );
}
diff --git a/ucb/source/ucp/ftp/ftpdirp.cxx b/ucb/source/ucp/ftp/ftpdirp.cxx
index f25474ef53..516ad7e84d 100644
--- a/ucb/source/ucp/ftp/ftpdirp.cxx
+++ b/ucb/source/ucp/ftp/ftpdirp.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -874,17 +874,17 @@ sal_Bool FTPDirectoryParser::parseUNIX (
{
const sal_Char *p1, *p2;
p1 = p2 = pBuffer;
-
+
if (!((*p1 == '-') || (*p1 == 'd') || (*p1 == 'l')))
return sal_False;
// 1st column: FileMode.
if (*p1 == 'd')
rEntry.m_nMode |= INETCOREFTP_FILEMODE_ISDIR;
-
+
if (*p1 == 'l')
rEntry.m_nMode |= INETCOREFTP_FILEMODE_ISLINK;
-
+
// Skip to end of column and set rights by the way
while (*p1 && !ascii_isWhitespace(*p1)) {
if(*p1 == 'r')
@@ -893,7 +893,7 @@ sal_Bool FTPDirectoryParser::parseUNIX (
rEntry.m_nMode |= INETCOREFTP_FILEMODE_WRITE;
p1++;
}
-
+
/*
* Scan for the sequence of size and date fields:
* *LWS 1*DIGIT 1*LWS 3CHAR 1*LWS 1*2DIGIT 1*LWS
@@ -970,19 +970,7 @@ sal_Bool FTPDirectoryParser::parseUNIX (
// Done.
return sal_True;
}
- return sal_False;
-}
-
-/*
- * parseUNKNOWN.
- */
-sal_Bool FTPDirectoryParser::parseUNKNOWN (
- FTPDirentry &rEntry,
- const sal_Char *pBuffer,
- sal_uInt32 nLength)
-{
- setPath (rEntry.m_aName, pBuffer,sal_Int32 (nLength));
- return sal_True;
+ return sal_False;
}
/*
@@ -1204,7 +1192,7 @@ sal_Bool FTPDirectoryParser::parseUNIX_isYearTimeField (
nNumber = 10 * nNumber + (*pStart - '0');
if (pStart + 1 != pEnd || nNumber < 1970)
return sal_False;
-
+
rDateTime.SetYear(nNumber);
rDateTime.SetTime(0);
return sal_True;
@@ -1237,12 +1225,12 @@ sal_Bool FTPDirectoryParser::parseUNIX_isTime (
// else
// rDateTime.SetYear(aCurDate.GetYear());
// return sal_True;
-
+
TimeValue aTimeVal;
osl_getSystemTime(&aTimeVal);
oslDateTime aCurrDateTime;
osl_getDateTimeFromTimeValue(&aTimeVal,&aCurrDateTime);
-
+
if (rDateTime.GetMonth() > aCurrDateTime.Month)
rDateTime.SetYear(aCurrDateTime.Year - 1);
else
diff --git a/ucb/source/ucp/ftp/ftpdirp.hxx b/ucb/source/ucp/ftp/ftpdirp.hxx
index 2083a8beff..94df845d38 100644
--- a/ucb/source/ucp/ftp/ftpdirp.hxx
+++ b/ucb/source/ucp/ftp/ftpdirp.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -42,13 +42,13 @@
namespace ftp {
-
+
/*========================================================================
*
* the DateTime structure
*
*======================================================================*/
-
+
struct DateTime
: public com::sun::star::util::DateTime
{
@@ -66,7 +66,7 @@ namespace ftp {
day,
month,
year) { }
-
+
void SetYear(sal_uInt16 year) { Year = year; }
void SetMonth(sal_uInt16 month) { Month = month; }
void SetDay(sal_uInt16 day) { Day = day; }
@@ -101,12 +101,12 @@ namespace ftp {
DateTime m_aDate;
sal_uInt32 m_nMode;
sal_uInt32 m_nSize;
-
+
FTPDirentry(void)
: m_aDate(0,0,0,0,0,0,0),
m_nMode(INETCOREFTP_FILEMODE_UNKNOWN),
m_nSize((sal_uInt32)(-1)) { }
-
+
void clear() {
m_aURL = m_aName = rtl::OUString();
m_aDate = DateTime(0,0,0,0,0,0,0);
@@ -115,21 +115,21 @@ namespace ftp {
}
bool isDir() const {
- return bool(m_nMode && INETCOREFTP_FILEMODE_ISDIR);
+ return bool(m_nMode && INETCOREFTP_FILEMODE_ISDIR);
}
-
+
bool isFile() const {
- return ! bool(m_nMode && INETCOREFTP_FILEMODE_ISDIR);
+ return ! bool(m_nMode && INETCOREFTP_FILEMODE_ISDIR);
}
};
-
+
/*========================================================================
*
* the directory parser
*
*======================================================================*/
-
+
class FTPDirectoryParser
{
@@ -137,28 +137,23 @@ namespace ftp {
static sal_Bool parseDOS (
FTPDirentry &rEntry,
const sal_Char *pBuffer );
-
+
static sal_Bool parseVMS (
FTPDirentry &rEntry,
const sal_Char *pBuffer );
-
+
static sal_Bool parseUNIX (
FTPDirentry &rEntry,
const sal_Char *pBuffer );
-
- static sal_Bool parseUNKNOWN (
- FTPDirentry &rEntry,
- const sal_Char *pBuffer,
- sal_uInt32 nLength);
-
+
private:
-
+
static sal_Bool parseUNIX_isSizeField (
const sal_Char *pStart,
const sal_Char *pEnd,
sal_uInt32 &rSize);
-
+
static sal_Bool parseUNIX_isMonthField (
const sal_Char *pStart,
const sal_Char *pEnd,
@@ -168,7 +163,7 @@ namespace ftp {
const sal_Char *pStart,
const sal_Char *pEnd,
DateTime& rDateTime);
-
+
static sal_Bool parseUNIX_isYearTimeField (
const sal_Char *pStart,
const sal_Char *pEnd,
@@ -190,7 +185,7 @@ namespace ftp {
sal_Int32 length = -1);
};
-
+
}
diff --git a/ucb/source/ucp/ftp/ftpinpstr.cxx b/ucb/source/ucp/ftp/ftpinpstr.cxx
index 7600ddb6af..2f7a82baa2 100644
--- a/ucb/source/ucp/ftp/ftpinpstr.cxx
+++ b/ucb/source/ucp/ftp/ftpinpstr.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -53,11 +53,11 @@ using namespace com::sun::star::io;
FTPInputStream::FTPInputStream(FILE* tmpfl)
- : m_tmpfl(tmpfl ? tmpfl : tmpfile())
+ : 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);
@@ -65,24 +65,24 @@ FTPInputStream::FTPInputStream(FILE* tmpfl)
-FTPInputStream::~FTPInputStream()
+FTPInputStream::~FTPInputStream()
{
if ( 0 != m_tmpfl)
fclose(m_tmpfl);
}
-Any SAL_CALL FTPInputStream::queryInterface(
+Any SAL_CALL FTPInputStream::queryInterface(
const Type& rType
)
throw(
- RuntimeException
- )
+ RuntimeException
+ )
{
Any aRet = ::cppu::queryInterface(rType,
SAL_STATIC_CAST( XInputStream*,this ),
SAL_STATIC_CAST( XSeekable*,this ) );
-
+
return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
}
@@ -107,26 +107,29 @@ sal_Int32 SAL_CALL FTPInputStream::readBytes(Sequence< sal_Int8 >& aData,
RuntimeException)
{
osl::MutexGuard aGuard(m_aMutex);
-
+
if(0 <= nBytesToRead && aData.getLength() < nBytesToRead)
- aData.realloc(nBytesToRead);
-
+ aData.realloc(nBytesToRead);
+
// fpos_t bpos,epos;
-
+
// fgetpos(m_tmpfl,&bpos);
-// fread(aData.getArray(),nBytesToRead,1,m_tmpfl);
+// 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);
+ if (fread(aData.getArray(),nBytesToRead,1,m_tmpfl) != 1)
+ throw IOException();
+
epos = ftell(m_tmpfl);
-
+
return sal_Int32(epos-bpos);
}
-sal_Int32 SAL_CALL FTPInputStream::readSomeBytes( Sequence< sal_Int8 >& aData,sal_Int32 nMaxBytesToRead )
+sal_Int32 SAL_CALL FTPInputStream::readSomeBytes( Sequence< sal_Int8 >& aData,
+ sal_Int32 nMaxBytesToRead )
throw( NotConnectedException,
BufferSizeExceededException,
IOException,
@@ -146,7 +149,7 @@ void SAL_CALL FTPInputStream::skipBytes(sal_Int32 nBytesToSkip)
osl::MutexGuard aGuard(m_aMutex);
if(!m_tmpfl)
throw IOException();
-
+
fseek(m_tmpfl,long(nBytesToSkip),SEEK_CUR);
}
@@ -155,7 +158,7 @@ void SAL_CALL FTPInputStream::skipBytes(sal_Int32 nBytesToSkip)
sal_Int32 SAL_CALL FTPInputStream::available(void)
throw(NotConnectedException,
IOException,
- RuntimeException)
+ RuntimeException)
{
return sal::static_int_cast<sal_Int32>(m_nLength - getPosition());
}
@@ -177,12 +180,12 @@ void SAL_CALL FTPInputStream::closeInput(void)
void SAL_CALL FTPInputStream::seek(sal_Int64 location)
throw( IllegalArgumentException,
IOException,
- RuntimeException )
+ RuntimeException )
{
osl::MutexGuard aGuard(m_aMutex);
if(!m_tmpfl)
throw IOException();
-
+
fseek(m_tmpfl,long(location),SEEK_SET);
}
@@ -197,7 +200,7 @@ FTPInputStream::getPosition(
osl::MutexGuard aGuard(m_aMutex);
if(!m_tmpfl)
throw IOException();
-
+
// fpos_t pos;
// fgetpos(m_tmpfl,&pos);
long pos;
@@ -207,11 +210,11 @@ FTPInputStream::getPosition(
-sal_Int64 SAL_CALL FTPInputStream::getLength(
- void
+sal_Int64 SAL_CALL FTPInputStream::getLength(
+ void
) throw(
IOException,RuntimeException
)
{
- return m_nLength;
+ return m_nLength;
}
diff --git a/ucb/source/ucp/ftp/ftpintreq.cxx b/ucb/source/ucp/ftp/ftpintreq.cxx
index 78d3db6ecd..cb0712f19f 100644
--- a/ucb/source/ucp/ftp/ftpintreq.cxx
+++ b/ucb/source/ucp/ftp/ftpintreq.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -71,7 +71,7 @@ Any SAL_CALL
XInteractionApproveImpl::queryInterface( const Type& rType )
throw( RuntimeException )
{
- Any aRet = cppu::queryInterface(
+ Any aRet = cppu::queryInterface(
rType,
SAL_STATIC_CAST( lang::XTypeProvider*, this ),
SAL_STATIC_CAST( XInteractionApprove*,this) );
@@ -83,13 +83,13 @@ XInteractionApproveImpl::queryInterface( const Type& rType )
// XTypeProvider
//////////////////////////////////////////////////////////////////////////////
-XTYPEPROVIDER_IMPL_2( XInteractionApproveImpl,
+XTYPEPROVIDER_IMPL_2( XInteractionApproveImpl,
XTypeProvider,
XInteractionApprove )
-
+
void SAL_CALL XInteractionApproveImpl::select()
- throw (RuntimeException)
+ throw (RuntimeException)
{
m_bSelected = true;
}
@@ -101,7 +101,6 @@ bool XInteractionApproveImpl::isSelected() const
}
-
// XInteractionDisapproveImpl
XInteractionDisapproveImpl::XInteractionDisapproveImpl()
@@ -131,7 +130,7 @@ Any SAL_CALL
XInteractionDisapproveImpl::queryInterface( const Type& rType )
throw( RuntimeException )
{
- Any aRet = cppu::queryInterface(
+ Any aRet = cppu::queryInterface(
rType,
SAL_STATIC_CAST( lang::XTypeProvider*, this ),
SAL_STATIC_CAST( XInteractionDisapprove*,this) );
@@ -143,26 +142,19 @@ XInteractionDisapproveImpl::queryInterface( const Type& rType )
// XTypeProvider
//////////////////////////////////////////////////////////////////////////////
-XTYPEPROVIDER_IMPL_2( XInteractionDisapproveImpl,
+XTYPEPROVIDER_IMPL_2( XInteractionDisapproveImpl,
XTypeProvider,
XInteractionDisapprove )
-
+
void SAL_CALL XInteractionDisapproveImpl::select()
throw (RuntimeException)
-
-{
- m_bSelected = true;
-}
-
-bool XInteractionDisapproveImpl::isSelected() const
{
- return m_bSelected;
+ m_bSelected = true;
}
-
// XInteractionRequestImpl
XInteractionRequestImpl::XInteractionRequestImpl(const rtl::OUString& aName)
@@ -170,12 +162,12 @@ XInteractionRequestImpl::XInteractionRequestImpl(const rtl::OUString& aName)
p2( new XInteractionDisapproveImpl ),
m_aName(aName),
m_aSeq( 2 )
-{
+{
m_aSeq[0] = Reference<XInteractionContinuation>(p1);
m_aSeq[1] = Reference<XInteractionContinuation>(p2);
}
-
+
void SAL_CALL
XInteractionRequestImpl::acquire( void )
throw()
@@ -198,7 +190,7 @@ Any SAL_CALL
XInteractionRequestImpl::queryInterface( const Type& rType )
throw( RuntimeException )
{
- Any aRet = cppu::queryInterface(
+ Any aRet = cppu::queryInterface(
rType,
SAL_STATIC_CAST( lang::XTypeProvider*, this ),
SAL_STATIC_CAST( XInteractionRequest*,this) );
@@ -210,7 +202,7 @@ XInteractionRequestImpl::queryInterface( const Type& rType )
// XTypeProvider
/////////////////////////////////////////////////////////////////////////////
-XTYPEPROVIDER_IMPL_2( XInteractionRequestImpl,
+XTYPEPROVIDER_IMPL_2( XInteractionRequestImpl,
XTypeProvider,
XInteractionRequest )
@@ -234,12 +226,6 @@ XInteractionRequestImpl::getContinuations( )
}
-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
index 7b3fbca577..6d335f22ef 100644
--- a/ucb/source/ucp/ftp/ftpintreq.hxx
+++ b/ucb/source/ucp/ftp/ftpintreq.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -43,26 +43,26 @@
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 )
@@ -72,12 +72,12 @@ namespace ftp {
// XTypeProvider
XTYPEPROVIDER_DECL()
-
+
virtual void SAL_CALL select()
throw (com::sun::star::uno::RuntimeException);
-
+
bool isSelected() const;
-
+
private:
bool m_bSelected;
@@ -85,26 +85,26 @@ namespace ftp {
-
+
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 )
@@ -114,38 +114,36 @@ namespace ftp {
// 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 )
@@ -153,35 +151,33 @@ namespace ftp {
// XTypeProvider
-
+
XTYPEPROVIDER_DECL()
- com::sun::star::uno::Any SAL_CALL
+ 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::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;
+
+ 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::uno::Sequence<
+ com::sun::star::uno::Reference<
com::sun::star::task::XInteractionContinuation > > m_aSeq;
};
-
+
}
diff --git a/ucb/source/ucp/ftp/ftpresultsetI.cxx b/ucb/source/ucp/ftp/ftpresultsetI.cxx
index 40bd4569fd..6961072383 100644
--- a/ucb/source/ucp/ftp/ftpresultsetI.cxx
+++ b/ucb/source/ucp/ftp/ftpresultsetI.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -38,7 +38,7 @@
#include "com/sun/star/ucb/XCommandProcessor.hpp"
#include "com/sun/star/sdbc/XRow.hpp"
#include "ftpresultsetI.hxx"
-
+#include "ftpcontent.hxx"
using namespace std;
@@ -62,14 +62,14 @@ ResultSetI::ResultSetI(const Reference<XMultiServiceFactory>& xMSF,
m_aPath.push_back(dirvec[i].m_aURL);
// m_aIdents holds the contentidentifiers
-
+
m_aItems.resize( m_aPath.size() );
m_aIdents.resize( m_aPath.size() );
-
+
for(unsigned n = 0; n < m_aItems.size(); ++n) {
- rtl::Reference<ucbhelper::PropertyValueSet> xRow =
+ rtl::Reference<ucbhelper::PropertyValueSet> xRow =
new ucbhelper::PropertyValueSet(xMSF);
-
+
for( int i = 0; i < seqProp.getLength(); ++i) {
const rtl::OUString& Name = seqProp[i].Name;
if(Name.compareToAscii("ContentType") == 0 )
@@ -96,6 +96,10 @@ ResultSetI::ResultSetI(const Reference<XMultiServiceFactory>& xMSF,
else if(Name.compareToAscii("DateCreated") == 0)
xRow->appendTimestamp(seqProp[i],
dirvec[n].m_aDate);
+ else if(Name.compareToAscii("CreatableContentsInfo") == 0)
+ xRow->appendObject(
+ seqProp[i],
+ makeAny(FTPContent::queryCreatableContentsInfo_Static()));
else
xRow->appendVoid(seqProp[i]);
}
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index 06ea07b855..52615e79f9 100644
--- a/ucb/source/ucp/ftp/ftpurl.cxx
+++ b/ucb/source/ucp/ftp/ftpurl.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -130,7 +130,7 @@ FTPURL::FTPURL(const FTPURL& r)
m_aHost(r.m_aHost),
m_aPort(r.m_aPort),
m_aPathSegmentVec(r.m_aPathSegmentVec)
-
+
{
}
@@ -163,19 +163,18 @@ void FTPURL::parse(const rtl::OUString& url)
rtl::OString aIdent(url.getStr(),
url.getLength(),
RTL_TEXTENCODING_UTF8);
- char *buffer = new char[1+aIdent.getLength()];
-
- const char* p2 = aIdent.getStr();
rtl::OString lower = aIdent.toAsciiLowerCase();
if(lower.getLength() < 6 ||
strncmp("ftp://",lower.getStr(),6))
throw malformed_exception();
+ char *buffer = new char[1+aIdent.getLength()];
+ const char* p2 = aIdent.getStr();
p2 += 6;
char ch;
- char *p1 = buffer; // determine "username:password@host:port"
+ char *p1 = buffer; // determine "username:password@host:port"
while((ch = *p2++) != '/' && ch)
*p1++ = ch;
*p1 = 0;
@@ -393,7 +392,7 @@ namespace ftp {
#define SET_DATA_CONTAINER \
- curl_easy_setopt(curl,CURLOPT_NOBODY,false); \
+ curl_easy_setopt(curl,CURLOPT_NOBODY,false); \
MemoryContainer data; \
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,memory_write); \
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&data)
@@ -567,7 +566,7 @@ rtl::OUString FTPURL::net_title() const
SET_URL(url);
err = curl_easy_perform(curl);
- if(err == CURLE_OK) { // get the title from the server
+ if(err == CURLE_OK) { // get the title from the server
char* fwd = (char*) control.m_pBuffer;
sal_uInt32 len = (sal_uInt32) control.m_nWritePos;
@@ -590,6 +589,12 @@ rtl::OUString FTPURL::net_title() const
// the client should retry after getting the correct
// username + password
throw curl_exception(err);
+#if LIBCURL_VERSION_NUM>=0x070d01 /* 7.13.1 */
+ else if(err == CURLE_LOGIN_DENIED)
+ // the client should retry after getting the correct
+ // username + password
+ throw curl_exception(err);
+#endif
else if(try_more && err == CURLE_FTP_ACCESS_DENIED) {
// We were either denied access when trying to login to
// an FTP server or when trying to change working directory
@@ -665,8 +670,8 @@ void FTPURL::insert(bool replaceExisting,void* stream) const
throw(curl_exception)
{
if(!replaceExisting) {
-// FTPDirentry aDirentry(direntry());
-// if(aDirentry.m_nMode == INETCOREFTP_FILEMODE_UNKNOWN)
+// 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
@@ -716,8 +721,8 @@ 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,aDel.getStr());
diff --git a/ucb/source/ucp/ftp/ftpurl.hxx b/ucb/source/ucp/ftp/ftpurl.hxx
index 52103f7274..33e2c268b2 100644
--- a/ucb/source/ucp/ftp/ftpurl.hxx
+++ b/ucb/source/ucp/ftp/ftpurl.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -56,7 +56,7 @@ namespace ftp {
class FTPHandleProvider;
-
+
enum FTPErrors { FILE_EXIST_DURING_INSERT = CURL_LAST +1,
FOLDER_EXIST_DURING_INSERT,
FOLDER_MIGHT_EXIST_DURING_INSERT,
@@ -64,36 +64,36 @@ namespace ftp {
class malformed_exception { };
-
-
- class curl_exception
+
+
+ class curl_exception
{
- public:
-
+ public:
+
curl_exception(sal_Int32 err)
: n_err(err) { }
-
+
sal_Int32 code() const { return n_err; }
-
-
+
+
private:
-
+
sal_Int32 n_err;
};
class CurlInput {
-
+
public:
-
+
// returns the number of bytes actually read
virtual sal_Int32 read(sal_Int8 *dest,sal_Int32 nBytesRequested) = 0;
};
-
-
+
+
class FTPURL
{
public:
-
+
FTPURL(
const rtl::OUString& aIdent,
FTPHandleProvider* pFCP = 0
@@ -103,11 +103,11 @@ namespace ftp {
);
FTPURL(const FTPURL& r);
-
+
~FTPURL();
-
+
rtl::OUString host() const { return m_aHost; }
-
+
rtl::OUString port() const { return m_aPort; }
rtl::OUString username() const { return m_aUsername; }
@@ -115,30 +115,30 @@ namespace ftp {
/** This returns the URL, but cleaned from
* unnessary ellipses.
*/
-
+
rtl::OUString ident(bool withslash,bool internal) const;
-
+
/** returns the parent url.
*/
-
+
rtl::OUString parent(bool internal = false) const;
-
+
/** sets the unencoded title */
void child(const rtl::OUString& title);
/** returns the unencoded title */
rtl::OUString child(void) const;
-
+
std::vector<FTPDirentry> list(sal_Int16 nMode) const
throw(curl_exception);
// returns a pointer to an open tempfile,
// seeked to the beginning of.
FILE* open() throw(curl_exception);
-
+
FTPDirentry direntry() const throw(curl_exception);
-
- void insert(bool ReplaceExisting,void* stream) const
+
+ void insert(bool ReplaceExisting,void* stream) const
throw(curl_exception);
void mkdir(bool ReplaceExisting) const
@@ -146,32 +146,32 @@ namespace ftp {
rtl::OUString ren(const rtl::OUString& NewTitle)
throw(curl_exception);
-
+
void del() const
throw(curl_exception);
-
+
private:
osl::Mutex m_mutex;
-
+
FTPHandleProvider *m_pFCP;
-
+
mutable rtl::OUString m_aUsername;
bool m_bShowPassword;
mutable rtl::OUString m_aHost;
mutable rtl::OUString m_aPort;
mutable rtl::OUString m_aType;
-
+
/** Contains the encoded pathsegments of the url.
*/
std::vector<rtl::OUString> m_aPathSegmentVec;
-
+
void parse(const rtl::OUString& url)
throw(
malformed_exception
);
-
+
rtl::OUString net_title() const throw(curl_exception);
};
diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx
index fa6d8f74c8..6e214308ae 100644
--- a/ucb/source/ucp/gio/gio_content.cxx
+++ b/ucb/source/ucp/gio/gio_content.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -151,8 +151,8 @@ void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ )
rtl::OUString SAL_CALL Content::getContentType() throw( uno::RuntimeException )
{
- return isFolder(uno::Reference< ucb::XCommandEnvironment >())
- ? rtl::OUString::createFromAscii( GIO_FOLDER_TYPE )
+ return isFolder(uno::Reference< ucb::XCommandEnvironment >())
+ ? rtl::OUString::createFromAscii( GIO_FOLDER_TYPE )
: rtl::OUString::createFromAscii( GIO_FILE_TYPE );
}
@@ -183,17 +183,17 @@ uno::Any convertToException(GError *pError, const uno::Reference< uno::XInterfac
EXCEPT(aExcept); }
break;
case G_IO_ERROR_NOT_MOUNTED:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_NOT_EXISTING_PATH, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_NOT_FOUND:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_NOT_EXISTING, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_EXISTS:
- { ucb::NameClashException aExcept(sMessage, rContext,
+ { ucb::NameClashException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, sName);
EXCEPT(aExcept); }
break;
@@ -202,32 +202,32 @@ uno::Any convertToException(GError *pError, const uno::Reference< uno::XInterfac
EXCEPT(aExcept); }
break;
case G_IO_ERROR_PERMISSION_DENIED:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_ACCESS_DENIED, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_IS_DIRECTORY:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_NO_FILE, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_NOT_REGULAR_FILE:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_NO_FILE, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_NOT_DIRECTORY:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_NO_DIRECTORY, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_FILENAME_TOO_LONG:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_NAME_TOO_LONG, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_PENDING:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_PENDING, aArgs);
EXCEPT(aExcept); }
break;
@@ -235,50 +235,50 @@ uno::Any convertToException(GError *pError, const uno::Reference< uno::XInterfac
case G_IO_ERROR_CANCELLED:
case G_IO_ERROR_TOO_MANY_LINKS:
case G_IO_ERROR_WRONG_ETAG:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_GENERAL, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_NOT_SUPPORTED:
case G_IO_ERROR_CANT_CREATE_BACKUP:
case G_IO_ERROR_WOULD_MERGE:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_NOT_SUPPORTED, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_NO_SPACE:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_OUT_OF_DISK_SPACE, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_INVALID_FILENAME:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_INVALID_CHARACTER, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_READ_ONLY:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_WRITE_PROTECTED, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_TIMED_OUT:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_DEVICE_NOT_READY, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_WOULD_RECURSE:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_RECURSIVE, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_BUSY:
case G_IO_ERROR_WOULD_BLOCK:
- { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
+ { ucb::InteractiveAugmentedIOException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, ucb::IOErrorCode_LOCKING_VIOLATION, aArgs);
EXCEPT(aExcept); }
break;
case G_IO_ERROR_HOST_NOT_FOUND:
- { ucb::InteractiveNetworkResolveNameException aExcept(sMessage, rContext,
+ { ucb::InteractiveNetworkResolveNameException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR, sHost);
EXCEPT(aExcept);}
break;
@@ -288,7 +288,7 @@ uno::Any convertToException(GError *pError, const uno::Reference< uno::XInterfac
case G_IO_ERROR_NOT_SYMBOLIC_LINK:
case G_IO_ERROR_NOT_MOUNTABLE_FILE:
case G_IO_ERROR_FAILED_HANDLED:
- { ucb::InteractiveNetworkGeneralException aExcept(sMessage, rContext,
+ { ucb::InteractiveNetworkGeneralException aExcept(sMessage, rContext,
task::InteractionClassification_ERROR);
EXCEPT(aExcept);}
break;
@@ -306,7 +306,7 @@ uno::Any Content::mapGIOError( GError *pError )
uno::Any Content::getBadArgExcept()
{
- return uno::makeAny( lang::IllegalArgumentException(
+ return uno::makeAny( lang::IllegalArgumentException(
rtl::OUString::createFromAscii( "Wrong argument type!" ),
static_cast< cppu::OWeakObject * >( this ), -1) );
}
@@ -402,6 +402,7 @@ static util::DateTime getDateFromUnix (time_t t)
uno::Reference< sdbc::XRow > Content::getPropertyValuesFromGFileInfo(GFileInfo *pInfo,
const uno::Reference< lang::XMultiServiceFactory >& rSMgr,
+ const uno::Reference< ucb::XCommandEnvironment > & xEnv,
const uno::Sequence< beans::Property >& rProperties)
{
rtl::Reference< ::ucbhelper::PropertyValueSet > xRow = new ::ucbhelper::PropertyValueSet( rSMgr );
@@ -419,7 +420,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValuesFromGFileInfo(GFileInfo *
if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) )
{
if (g_file_info_has_attribute(pInfo, G_FILE_ATTRIBUTE_STANDARD_TYPE))
- xRow->appendBoolean( rProp, ( g_file_info_get_file_type( pInfo ) == G_FILE_TYPE_REGULAR ||
+ xRow->appendBoolean( rProp, ( g_file_info_get_file_type( pInfo ) == G_FILE_TYPE_REGULAR ||
g_file_info_get_file_type( pInfo ) == G_FILE_TYPE_UNKNOWN ) );
else
xRow->appendVoid( rProp );
@@ -457,7 +458,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValuesFromGFileInfo(GFileInfo *
}
else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DateModified" ) ) )
{
- if( g_file_info_has_attribute( pInfo, G_FILE_ATTRIBUTE_TIME_CHANGED ) )
+ if( g_file_info_has_attribute( pInfo, G_FILE_ATTRIBUTE_TIME_CHANGED ) )
xRow->appendTimestamp( rProp, getDateFromUnix(g_file_info_get_attribute_uint64(pInfo, G_FILE_ATTRIBUTE_TIME_CHANGED)) );
else
xRow->appendVoid( rProp );
@@ -499,10 +500,14 @@ uno::Reference< sdbc::XRow > Content::getPropertyValuesFromGFileInfo(GFileInfo *
else
xRow->appendVoid( rProp );
}
+ else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
+ {
+ xRow->appendObject( rProp, uno::makeAny( queryCreatableContentsInfo( xEnv ) ) );
+ }
#ifdef DEBUG
else
{
- fprintf(stderr, "Looking for unsupported property %s\n",
+ fprintf(stderr, "Looking for unsupported property %s\n",
rtl::OUStringToOString(rProp.Name, RTL_TEXTENCODING_UTF8).getStr());
}
#endif
@@ -520,10 +525,10 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
if (!pInfo)
ucbhelper::cancelCommandExecution(mapGIOError(pError), xEnv);
- return getPropertyValuesFromGFileInfo(pInfo, m_xSMgr, rProperties);
+ return getPropertyValuesFromGFileInfo(pInfo, m_xSMgr, xEnv, rProperties);
}
-static lang::IllegalAccessException
+static lang::IllegalAccessException
getReadOnlyException( const uno::Reference< uno::XInterface >& rContext )
{
return lang::IllegalAccessException ( rtl::OUString::createFromAscii( "Property is read-only!" ), rContext );
@@ -607,10 +612,10 @@ sal_Bool Content::exchangeIdentity( const uno::Reference< ucb::XContentIdentifie
uno::Reference< ucb::XContentIdentifier > xNewChildId
= new ::ucbhelper::ContentIdentifier( m_xSMgr, aNewChildURL );
-
+
if ( !xChild->exchangeIdentity( xNewChildId ) )
return sal_False;
-
+
++it;
}
return sal_True;
@@ -650,7 +655,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
sal_Int32 nChanged = 0, nTitlePos = -1;
const char *newName = NULL;
uno::Sequence< beans::PropertyChangeEvent > aChanges(nCount);
-
+
uno::Sequence< uno::Any > aRet( nCount );
const beans::PropertyValue* pValues = rValues.getConstArray();
for ( sal_Int32 n = 0; n < nCount; ++n )
@@ -663,7 +668,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) ||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) ||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) ||
- rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) )
+ rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) ||
+ rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
{
aRet[ n ] <<= getReadOnlyException( static_cast< cppu::OWeakObject * >(this) );
}
@@ -703,9 +709,9 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
aEvent.NewValue = uno::makeAny(aNewTitle);
aChanges.getArray()[ nChanged ] = aEvent;
nTitlePos = nChanged++;
-
+
g_file_info_set_name(pNewInfo, newName);
- }
+ }
}
else
{
@@ -737,7 +743,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
aNewURL += rtl::OUString( newName, strlen(newName), RTL_TEXTENCODING_UTF8 );
uno::Reference< ucb::XContentIdentifier > xNewId
= new ::ucbhelper::ContentIdentifier( m_xSMgr, aNewURL );
-
+
if (!exchangeIdentity( xNewId ) )
{
aRet[ nTitlePos ] <<= uno::Exception
@@ -808,7 +814,7 @@ sal_Bool Content::feedSink( uno::Reference< uno::XInterface > xSink,
uno::Reference< io::XOutputStream > xOut = uno::Reference< io::XOutputStream >(xSink, uno::UNO_QUERY );
uno::Reference< io::XActiveDataSink > xDataSink = uno::Reference< io::XActiveDataSink >(xSink, uno::UNO_QUERY );
-
+
if ( !xOut.is() && !xDataSink.is() )
return sal_False;
@@ -820,7 +826,7 @@ sal_Bool Content::feedSink( uno::Reference< uno::XInterface > xSink,
uno::Reference< io::XInputStream > xIn = new ::gio::InputStream(pStream);
if ( !xIn.is() )
return sal_False;
-
+
if ( xOut.is() )
copyData( xIn, xOut );
@@ -840,9 +846,9 @@ uno::Any Content::open(const ucb::OpenCommandArgument2 & rOpenCommand,
{
uno::Sequence< uno::Any > aArgs( 1 );
aArgs[ 0 ] <<= m_xIdentifier->getContentIdentifier();
- uno::Any aErr = uno::makeAny(
+ uno::Any aErr = uno::makeAny(
ucb::InteractiveAugmentedIOException(rtl::OUString(), static_cast< cppu::OWeakObject * >( this ),
- task::InteractionClassification_ERROR,
+ task::InteractionClassification_ERROR,
bIsFolder ? ucb::IOErrorCode_NOT_EXISTING_PATH : ucb::IOErrorCode_NOT_EXISTING, aArgs)
);
@@ -867,12 +873,12 @@ uno::Any Content::open(const ucb::OpenCommandArgument2 & rOpenCommand,
{
if (
( rOpenCommand.Mode == ucb::OpenMode::DOCUMENT_SHARE_DENY_NONE ) ||
- ( rOpenCommand.Mode == ucb::OpenMode::DOCUMENT_SHARE_DENY_WRITE )
+ ( rOpenCommand.Mode == ucb::OpenMode::DOCUMENT_SHARE_DENY_WRITE )
)
{
- ucbhelper::cancelCommandExecution(
- uno::makeAny ( ucb::UnsupportedOpenModeException
- ( rtl::OUString(), static_cast< cppu::OWeakObject * >( this ),
+ ucbhelper::cancelCommandExecution(
+ uno::makeAny ( ucb::UnsupportedOpenModeException
+ ( rtl::OUString(), static_cast< cppu::OWeakObject * >( this ),
sal_Int16( rOpenCommand.Mode ) ) ),
xEnv );
}
@@ -883,7 +889,7 @@ uno::Any Content::open(const ucb::OpenCommandArgument2 & rOpenCommand,
// implementation. Support for this type of
// sink is optional...
#ifdef DEBUG
- g_warning ("Failed to load data from '%s'",
+ g_warning ("Failed to load data from '%s'",
rtl::OUStringToOString(m_xIdentifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8).getStr());
#endif
@@ -944,6 +950,14 @@ uno::Any SAL_CALL Content::execute(
ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv );
aRet <<= setPropertyValues( aProperties, xEnv );
}
+ else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) )
+ && isFolder( xEnv ) )
+ {
+ ucb::ContentInfo arg;
+ if ( !( aCommand.Argument >>= arg ) )
+ ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv );
+ aRet <<= createNewContent( arg );
+ }
else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "insert" ) ))
{
ucb::InsertCommandArgument arg;
@@ -956,8 +970,8 @@ uno::Any SAL_CALL Content::execute(
sal_Bool bDeletePhysical = sal_False;
aCommand.Argument >>= bDeletePhysical;
- //If no delete physical, try and trashcan it, if that doesn't work go
- //ahead and try and delete it anyway
+ //If no delete physical, try and trashcan it, if that doesn't work go
+ //ahead and try and delete it anyway
if (!bDeletePhysical && !g_file_trash(getGFile(), NULL, NULL))
bDeletePhysical = true;
@@ -996,10 +1010,10 @@ void Content::destroy( sal_Bool bDeletePhysical )
::gio::Content::ContentRefList aChildren;
queryChildren( aChildren );
-
+
ContentRefList::const_iterator it = aChildren.begin();
ContentRefList::const_iterator end = aChildren.end();
-
+
while ( it != end )
{
(*it)->destroy( bDeletePhysical );
@@ -1055,7 +1069,7 @@ void Content::insert(const uno::Reference< io::XInputStream > &xInputStream,
}
}
-void Content::transfer( const ucb::TransferInfo& aTransferInfo, const uno::Reference< ucb::XCommandEnvironment >& xEnv )
+void Content::transfer( const ucb::TransferInfo& aTransferInfo, const uno::Reference< ucb::XCommandEnvironment >& xEnv )
throw( uno::Exception )
{
rtl::OUString sDest = m_xIdentifier->getContentIdentifier();
@@ -1079,36 +1093,50 @@ void Content::transfer( const ucb::TransferInfo& aTransferInfo, const uno::Refer
ucbhelper::cancelCommandExecution(mapGIOError(pError), xEnv);
}
-com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > SAL_CALL Content::queryCreatableContentsInfo()
- throw( com::sun::star::uno::RuntimeException )
+uno::Sequence< ucb::ContentInfo > Content::queryCreatableContentsInfo(
+ const uno::Reference< ucb::XCommandEnvironment >& xEnv)
+ throw( uno::RuntimeException )
+{
+ if ( isFolder( xEnv ) )
+ {
+ uno::Sequence< ucb::ContentInfo > seq(2);
+
+ // Minimum set of props we really need
+ uno::Sequence< beans::Property > props( 1 );
+ props[0] = beans::Property(
+ rtl::OUString::createFromAscii( "Title" ),
+ -1,
+ getCppuType( static_cast< rtl::OUString* >( 0 ) ),
+ beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND );
+
+ // file
+ seq[0].Type = rtl::OUString::createFromAscii( GIO_FILE_TYPE );
+ seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM |
+ ucb::ContentInfoAttribute::KIND_DOCUMENT );
+ seq[0].Properties = props;
+
+ // folder
+ seq[1].Type = rtl::OUString::createFromAscii( GIO_FOLDER_TYPE );
+ seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER;
+ seq[1].Properties = props;
+
+ return seq;
+ }
+ else
+ {
+ return uno::Sequence< ucb::ContentInfo >();
+ }
+}
+
+uno::Sequence< ucb::ContentInfo > SAL_CALL Content::queryCreatableContentsInfo()
+ throw( uno::RuntimeException )
{
- uno::Sequence< ucb::ContentInfo > seq(2);
-
- // Minimum set of props we really need
- uno::Sequence< beans::Property > props( 1 );
- props[0] = beans::Property(
- rtl::OUString::createFromAscii( "Title" ),
- -1,
- getCppuType( static_cast< rtl::OUString* >( 0 ) ),
- beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND );
-
- // file
- seq[0].Type = rtl::OUString::createFromAscii( GIO_FILE_TYPE );
- seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM |
- ucb::ContentInfoAttribute::KIND_DOCUMENT );
- seq[0].Properties = props;
-
- // folder
- seq[1].Type = rtl::OUString::createFromAscii( GIO_FOLDER_TYPE );
- seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER;
- seq[1].Properties = props;
-
- return seq;
+ return queryCreatableContentsInfo( uno::Reference< ucb::XCommandEnvironment >() );
}
-com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
- SAL_CALL Content::createNewContent( const com::sun::star::ucb::ContentInfo& Info )
- throw( com::sun::star::uno::RuntimeException )
+uno::Reference< ucb::XContent >
+ SAL_CALL Content::createNewContent( const ucb::ContentInfo& Info )
+ throw( uno::RuntimeException )
{
bool create_document;
const char *name;
@@ -1120,7 +1148,7 @@ com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
else
{
#ifdef DEBUG
- g_warning( "Failed to create new content '%s'", rtl::OUStringToOString(Info.Type,
+ g_warning( "Failed to create new content '%s'", rtl::OUStringToOString(Info.Type,
RTL_TEXTENCODING_UTF8).getStr() );
#endif
return uno::Reference< ucb::XContent >();
@@ -1223,6 +1251,9 @@ uno::Sequence< beans::Property > Content::getProperties(
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsHidden" ) ),
-1, getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
+ beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CreatableContentsInfo" ) ),
+ -1, getCppuType( static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY )
};
@@ -1232,7 +1263,7 @@ uno::Sequence< beans::Property > Content::getProperties(
uno::Sequence< ucb::CommandInfo > Content::getCommands( const uno::Reference< ucb::XCommandEnvironment > & xEnv)
{
- static ucb::CommandInfo aDocumentCommandInfoTable[] =
+ static ucb::CommandInfo aCommandInfoTable[] =
{
// Required commands
ucb::CommandInfo
@@ -1262,11 +1293,14 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( const uno::Reference< uc
// Folder Only, omitted if not a folder
ucb::CommandInfo
( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
- -1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) )
+ -1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) ),
+ ucb::CommandInfo
+ ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
+ -1, getCppuType( static_cast<ucb::ContentInfo * >( 0 ) ) )
};
- const int nProps = sizeof (aDocumentCommandInfoTable) / sizeof (aDocumentCommandInfoTable[0]);
- return uno::Sequence< ucb::CommandInfo >(aDocumentCommandInfoTable, isFolder(xEnv) ? nProps : nProps - 1);
+ const int nProps = sizeof (aCommandInfoTable) / sizeof (aCommandInfoTable[0]);
+ return uno::Sequence< ucb::CommandInfo >(aCommandInfoTable, isFolder(xEnv) ? nProps : nProps - 2);
}
XTYPEPROVIDER_COMMON_IMPL( Content );
diff --git a/ucb/source/ucp/gio/gio_content.hxx b/ucb/source/ucp/gio/gio_content.hxx
index 9b63edf0ba..1cb32e61e9 100644
--- a/ucb/source/ucp/gio/gio_content.hxx
+++ b/ucb/source/ucp/gio/gio_content.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -42,11 +42,11 @@
#include <list>
-namespace com { namespace sun { namespace star {
+namespace com { namespace sun { namespace star {
namespace beans {
struct Property;
struct PropertyValue;
- }
+ }
namespace sdbc {
class XRow;
}
@@ -65,7 +65,7 @@ namespace gio
#define GIO_FILE_TYPE "application/vnd.sun.staroffice.gio-file"
#define GIO_FOLDER_TYPE "application/vnd.sun.staroffice.gio-folder"
-com::sun::star::uno::Any convertToException(GError *pError,
+com::sun::star::uno::Any convertToException(GError *pError,
const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rContext, bool bThrow=true);
class ContentProvider;
@@ -98,7 +98,7 @@ private:
bool doSetFileInfo ( GFileInfo *pNewInfo );
com::sun::star::uno::Any open(const com::sun::star::ucb::OpenCommandArgument2 & rArg,
- const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
throw( com::sun::star::uno::Exception );
void transfer( const com::sun::star::ucb::TransferInfo& rTransferInfo,
@@ -123,7 +123,7 @@ private:
sal_Bool feedSink( com::sun::star::uno::Reference< com::sun::star::uno::XInterface> aSink,
const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv );
- com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
+ com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
createInputStream(const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw( com::sun::star::uno::Exception );
@@ -144,7 +144,8 @@ public:
virtual ~Content();
static com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > getPropertyValuesFromGFileInfo(
- GFileInfo *pInfo, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr,
+ GFileInfo *pInfo, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr,
+ const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv,
const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& rProperties);
virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
@@ -176,10 +177,10 @@ public:
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 )
+ 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 )
+ virtual void SAL_CALL abort( sal_Int32 CommandId )
throw( com::sun::star::uno::RuntimeException );
virtual com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
@@ -189,6 +190,11 @@ public:
SAL_CALL createNewContent( const com::sun::star::ucb::ContentInfo& Info )
throw( com::sun::star::uno::RuntimeException );
+ com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
+ queryCreatableContentsInfo(
+ const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv)
+ throw( com::sun::star::uno::RuntimeException );
+
GFile* getGFile();
};
diff --git a/ucb/source/ucp/gio/gio_datasupplier.cxx b/ucb/source/ucp/gio/gio_datasupplier.cxx
index 384c5278ac..530456b250 100644
--- a/ucb/source/ucp/gio/gio_datasupplier.cxx
+++ b/ucb/source/ucp/gio/gio_datasupplier.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -51,7 +51,7 @@ namespace gio
typedef std::vector< ResultListEntry* > ResultList;
DataSupplier::DataSupplier( const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
- const uno::Reference< ::gio::Content >& rContent, sal_Int32 nOpenMode )
+ const uno::Reference< ::gio::Content >& rContent, sal_Int32 nOpenMode )
: mxContent(rContent), m_xSMgr(rxSMgr), mnOpenMode(nOpenMode), mbCountFinal(false)
{
}
@@ -92,7 +92,7 @@ bool DataSupplier::getData()
}
mbCountFinal = sal_True;
-
+
g_file_enumerator_close(pEnumerator, NULL, NULL);
return true;
}
@@ -128,14 +128,14 @@ DataSupplier::~DataSupplier()
rtl::OUString aId = rtl::OUString::createFromAscii( parent );
g_free(parent);
- char *escaped_name =
+ char *escaped_name =
g_uri_escape_string( g_file_info_get_name(maResults[ nIndex ]->pInfo) , NULL, false);
if ( ( aId.lastIndexOf( '/' ) + 1 ) != aId.getLength() )
aId += rtl::OUString::createFromAscii( "/" );
aId += rtl::OUString::createFromAscii( escaped_name );
-
+
g_free( escaped_name );
maResults[ nIndex ]->aId = aId;
@@ -240,7 +240,7 @@ uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues( sal_uInt32 nInde
if ( getResult( nIndex ) )
{
uno::Reference< sdbc::XRow > xRow = Content::getPropertyValuesFromGFileInfo(
- maResults[ nIndex ]->pInfo, m_xSMgr, getResultSet()->getProperties());
+ maResults[ nIndex ]->pInfo, m_xSMgr, getResultSet()->getEnvironment(), getResultSet()->getProperties());
maResults[ nIndex ]->xRow = xRow;
return xRow;
diff --git a/ucb/source/ucp/gvfs/content.cxx b/ucb/source/ucp/gvfs/gvfs_content.cxx
index 2eb0ac2e00..c902ac71ec 100644
--- a/ucb/source/ucp/gvfs/content.cxx
+++ b/ucb/source/ucp/gvfs/gvfs_content.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -39,9 +39,7 @@
#include "osl/doublecheckedlocking.h"
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HPP_
#include <com/sun/star/beans/PropertyValue.hpp>
-#endif
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/PropertySetInfoChange.hpp>
#include <com/sun/star/beans/PropertySetInfoChangeEvent.hpp>
@@ -50,14 +48,10 @@
#include <com/sun/star/lang/IllegalAccessException.hpp>
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
-#ifndef _COM_SUN_STAR_UCB_INTERACTIVEBADTRANSFRERURLEXCEPTION_HPP_
#include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp>
-#endif
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
#include <com/sun/star/ucb/InteractiveNetworkConnectException.hpp>
-#ifndef _COM_SUN_STAR_UCB_INTERACTIVENETWORKGENBERALEXCEPTION_HPP_
#include <com/sun/star/ucb/InteractiveNetworkGeneralException.hpp>
-#endif
#include <com/sun/star/ucb/InteractiveNetworkReadException.hpp>
#include <com/sun/star/ucb/InteractiveNetworkResolveNameException.hpp>
#include <com/sun/star/ucb/InteractiveNetworkWriteException.hpp>
@@ -79,9 +73,7 @@
#include <com/sun/star/ucb/NameClashException.hpp>
#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/propertyvalueset.hxx>
-#ifndef _UCBHELPER_INTERACTIONREQUEST_HXX
#include <ucbhelper/interactionrequest.hxx>
-#endif
#include <ucbhelper/cancelcommandexecution.hxx>
#include <ucbhelper/simpleauthenticationrequest.hxx>
@@ -98,10 +90,10 @@ extern "C" { // missing in the header: doh.
# include <libgnomevfs/gnome-vfs-module-callback.h>
}
-#include "content.hxx"
-#include "provider.hxx"
-#include "directory.hxx"
-#include "stream.hxx"
+#include "gvfs_content.hxx"
+#include "gvfs_provider.hxx"
+#include "gvfs_directory.hxx"
+#include "gvfs_stream.hxx"
using namespace gvfs;
using namespace com::sun::star;
@@ -141,7 +133,7 @@ Content::Content(
#endif
}
-Content::Content(
+Content::Content(
const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
ContentProvider * pProvider,
const uno::Reference< ucb::XContentIdentifier >& Identifier,
@@ -235,7 +227,7 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
CPPU_TYPE_REF( beans::XPropertyContainer ),
CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
CPPU_TYPE_REF( container::XChild ) );
-
+
pFolderCollection = &aFolderCollection;
pFileCollection = &aFileCollection;
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
@@ -265,7 +257,7 @@ uno::Sequence< rtl::OUString > SAL_CALL Content::getSupportedServiceNames()
throw( uno::RuntimeException )
{
uno::Sequence< rtl::OUString > aSNS( 1 );
- aSNS.getArray()[ 0 ] = rtl::OUString::createFromAscii(
+ aSNS.getArray()[ 0 ] = rtl::OUString::createFromAscii(
"com.sun.star.ucb.GnomeVFSContent" );
return aSNS;
}
@@ -326,7 +318,7 @@ uno::Any SAL_CALL Content::execute(
if ( !( aCommand.Argument >>= Properties ) )
ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv );
-
+
aRet <<= getPropertyValues( Properties, xEnv );
} else if ( COMMAND_IS( aCommand, "setPropertyValues" ) ) {
@@ -398,6 +390,13 @@ uno::Any SAL_CALL Content::execute(
g_warning ("Open falling through ...");
#endif
+ } else if ( COMMAND_IS( aCommand, "createNewContent" ) && isFolder( xEnv ) ) {
+ ucb::ContentInfo arg;
+ if ( !( aCommand.Argument >>= arg ) )
+ ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv );
+
+ aRet <<= createNewContent( arg );
+
} else if ( COMMAND_IS( aCommand, "insert" ) ) {
ucb::InsertCommandArgument arg;
if ( !( aCommand.Argument >>= arg ) )
@@ -452,32 +451,45 @@ void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ )
// XContentCreator methods.
//
-uno::Sequence< ucb::ContentInfo > SAL_CALL
-Content::queryCreatableContentsInfo()
- throw( uno::RuntimeException )
+uno::Sequence< ucb::ContentInfo > Content::queryCreatableContentsInfo(
+ const uno::Reference< ucb::XCommandEnvironment >& xEnv)
+ throw( uno::RuntimeException )
{
- uno::Sequence< ucb::ContentInfo > seq(2);
-
- // Minimum set of props we really need
- uno::Sequence< beans::Property > props( 1 );
- props[0] = beans::Property(
- rtl::OUString::createFromAscii( "Title" ),
- -1,
- getCppuType( static_cast< rtl::OUString* >( 0 ) ),
- beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND );
-
- // file
- seq[0].Type = rtl::OUString::createFromAscii( GVFS_FILE_TYPE );
- seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM |
- ucb::ContentInfoAttribute::KIND_DOCUMENT );
- seq[0].Properties = props;
-
- // folder
- seq[1].Type = rtl::OUString::createFromAscii( GVFS_FOLDER_TYPE );
- seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER;
- seq[1].Properties = props;
-
- return seq;
+ if ( isFolder( xEnv ) )
+ {
+ uno::Sequence< ucb::ContentInfo > seq(2);
+
+ // Minimum set of props we really need
+ uno::Sequence< beans::Property > props( 1 );
+ props[0] = beans::Property(
+ rtl::OUString::createFromAscii( "Title" ),
+ -1,
+ getCppuType( static_cast< rtl::OUString* >( 0 ) ),
+ beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND );
+
+ // file
+ seq[0].Type = rtl::OUString::createFromAscii( GVFS_FILE_TYPE );
+ seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM |
+ ucb::ContentInfoAttribute::KIND_DOCUMENT );
+ seq[0].Properties = props;
+
+ // folder
+ seq[1].Type = rtl::OUString::createFromAscii( GVFS_FOLDER_TYPE );
+ seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER;
+ seq[1].Properties = props;
+
+ return seq;
+ }
+ else
+ {
+ return uno::Sequence< ucb::ContentInfo >();
+ }
+}
+
+uno::Sequence< ucb::ContentInfo > SAL_CALL Content::queryCreatableContentsInfo()
+ throw( uno::RuntimeException )
+{
+ return queryCreatableContentsInfo( uno::Reference< ucb::XCommandEnvironment >() );
}
uno::Reference< ucb::XContent > SAL_CALL
@@ -487,7 +499,7 @@ Content::createNewContent( const ucb::ContentInfo& Info )
bool create_document;
const char *name;
- if ( Info.Type.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( GVFS_FILE_TYPE ) ) )
+ if ( Info.Type.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( GVFS_FILE_TYPE ) ) )
create_document = true;
else if ( Info.Type.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( GVFS_FOLDER_TYPE ) ) )
create_document = false;
@@ -515,11 +527,11 @@ Content::createNewContent( const ucb::ContentInfo& Info )
uno::Reference< ucb::XContentIdentifier > xId
( new ::ucbhelper::ContentIdentifier( m_xSMgr, aURL ) );
- try {
+ try {
return new ::gvfs::Content( m_xSMgr, m_pProvider, xId, !create_document );
} catch ( ucb::ContentCreationException & ) {
return uno::Reference< ucb::XContent >();
- }
+ }
}
rtl::OUString Content::getParentURL()
@@ -581,7 +593,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
if( ( result = getInfo( xEnv ) ) != GNOME_VFS_OK )
cancelCommandExecution( result, xEnv, sal_False );
-
+
const beans::Property* pProps;
if( rProperties.getLength() ) {
@@ -609,7 +621,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ContentType" ) ) )
xRow->appendString( rProp, getContentType () );
-
+
else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) ) {
if (m_info.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE)
xRow->appendBoolean( rProp, ( m_info.type == GNOME_VFS_FILE_TYPE_REGULAR ||
@@ -669,14 +681,17 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
else
xRow->appendVoid( rProp );
}
-
+
else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) ) {
// We do this by sniffing in gnome-vfs; rather expensively.
#ifdef DEBUG
g_warning ("FIXME: Requested mime-type - an expensive op. indeed!");
#endif
xRow->appendVoid( rProp );
- } else {
+ } else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
+ xRow->appendObject( rProp, uno::makeAny( queryCreatableContentsInfo( xEnv ) ) );
+
+ else {
xRow->appendVoid( rProp );
}
}
@@ -688,7 +703,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
return uno::Reference< sdbc::XRow >( xRow.get() );
}
-static lang::IllegalAccessException
+static lang::IllegalAccessException
getReadOnlyException( Content *ctnt )
{
return lang::IllegalAccessException
@@ -740,7 +755,7 @@ Content::doSetFileInfo( const GnomeVFSFileInfo *newInfo,
result = gnome_vfs_move ((const sal_Char *)aURI, newURI, FALSE);
- g_free (newURI);
+ g_free (newURI);
}
return result;
@@ -757,7 +772,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
getInfo( xEnv );
- osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
gnome_vfs_file_info_copy( &newInfo, &m_info );
@@ -769,16 +784,16 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
beans::PropertyChangeEvent aEvent;
aEvent.Source = static_cast< cppu::OWeakObject * >( this );
- aEvent.Further = sal_False;
- aEvent.PropertyHandle = -1;
- // aEvent.PropertyName = fill in later ...
- // aEvent.OldValue =
- // aEvent.NewValue =
+ aEvent.Further = sal_False;
+ aEvent.PropertyHandle = -1;
+ // aEvent.PropertyName = fill in later ...
+ // aEvent.OldValue =
+ // aEvent.NewValue =
- int nCount = rValues.getLength();
+ int nCount = rValues.getLength();
const beans::PropertyValue* pValues = rValues.getConstArray();
- for ( sal_Int32 n = 0; n < nCount; ++n ) {
+ for ( sal_Int32 n = 0; n < nCount; ++n ) {
const beans::PropertyValue& rValue = pValues[ n ];
#ifdef DEBUG
@@ -788,7 +803,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) ||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) ||
rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) ||
- rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) )
+ rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) ||
+ rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
aRet[ n ] <<= getReadOnlyException( this );
else if ( rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Title" ) ) ) {
@@ -810,9 +826,9 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
aEvent.NewValue = uno::makeAny( aNewTitle );
aChanges.getArray()[ nChanged ] = aEvent;
nTitlePos = nChanged++;
-
+
newInfo.name = newName;
- setMask |= GNOME_VFS_SET_FILE_INFO_NAME;
+ setMask |= GNOME_VFS_SET_FILE_INFO_NAME;
} else // same name
g_free (newName);
}
@@ -832,7 +848,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
aRet[ n ] <<= getReadOnlyException( this );
}
}
-
+
GnomeVFSResult result = GNOME_VFS_OK;
if ( !m_bTransient &&
@@ -849,9 +865,9 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
if ( setMask & GNOME_VFS_SET_FILE_INFO_NAME ) {
uno::Reference< ucb::XContentIdentifier > xNewId
- = new ::ucbhelper::ContentIdentifier(
+ = new ::ucbhelper::ContentIdentifier(
m_xSMgr, makeNewURL( newInfo.name ) );
-
+
aGuard.clear();
if (!exchangeIdentity( xNewId ) )
aRet[ nTitlePos ] <<= uno::Exception
@@ -859,7 +875,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
static_cast< cppu::OWeakObject * >( this ) );
}
}
-
+
gnome_vfs_file_info_clear( &newInfo );
if ( nChanged > 0 ) {
@@ -919,7 +935,7 @@ void Content::insert(
const uno::Reference< ucb::XCommandEnvironment > &xEnv )
throw( uno::Exception )
{
- osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
#ifdef DEBUG
g_warning( "Insert '%s' (%d) (0x%x:%d)", getURI(), bReplaceExisting,
@@ -1004,9 +1020,9 @@ void Content::insert(
}
if (m_bTransient) {
- m_bTransient = sal_False;
+ m_bTransient = sal_False;
aGuard.clear();
- inserted();
+ inserted();
}
}
@@ -1035,14 +1051,14 @@ void Content::destroy( sal_Bool bDeletePhysical )
deleted();
osl::Guard< osl::Mutex > aGuard( m_aMutex );
-
+
// Process instanciated children...
::gvfs::Content::ContentRefList aChildren;
queryChildren( aChildren );
-
+
ContentRefList::const_iterator it = aChildren.begin();
ContentRefList::const_iterator end = aChildren.end();
-
+
while ( it != end ) {
(*it)->destroy( bDeletePhysical );
++it;
@@ -1100,10 +1116,10 @@ sal_Bool Content::exchangeIdentity(
uno::Reference< ucb::XContentIdentifier >
xNewChildId
= new ::ucbhelper::ContentIdentifier( m_xSMgr, aNewChildURL );
-
+
if ( !xChild->exchangeIdentity( xNewChildId ) )
return sal_False;
-
+
++it;
}
return sal_True;
@@ -1161,7 +1177,7 @@ uno::Any Content::mapVFSException( const GnomeVFSResult result, sal_Bool bWrite
if ((gvfs_message = gnome_vfs_result_to_string (result)))
message = GnomeToOUString( gvfs_message );
-
+
switch (result) {
case GNOME_VFS_OK:
g_error ("VFS_OK mapped to exception.");
@@ -1181,7 +1197,7 @@ uno::Any Content::mapVFSException( const GnomeVFSResult result, sal_Bool bWrite
break;
case GNOME_VFS_ERROR_BAD_PARAMETERS:
aException <<=
- lang::IllegalArgumentException
+ lang::IllegalArgumentException
( rtl::OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 );
@@ -1319,8 +1335,8 @@ uno::Sequence< beans::Property > Content::getProperties(
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
// FIXME: Too expensive for now (?)
// beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ),
-// -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
-// beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
+// -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
+// beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ),
-1, getCppuType( static_cast< const sal_Int64 * >( 0 ) ),
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
@@ -1335,19 +1351,22 @@ uno::Sequence< beans::Property > Content::getProperties(
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsHidden" ) ),
-1, getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ),
+ beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CreatableContentsInfo" ) ),
+ -1, getCppuType( static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY )
};
const int nProps = sizeof (aGenericProperties) / sizeof (aGenericProperties[0]);
return uno::Sequence< beans::Property > ( aGenericProperties, nProps );
-
+
}
uno::Sequence< ucb::CommandInfo > Content::getCommands(
const uno::Reference< ucb::XCommandEnvironment > & xEnv )
{
- static ucb::CommandInfo aDocumentCommandInfoTable[] = {
+ static ucb::CommandInfo aCommandInfoTable[] = {
// Required commands
ucb::CommandInfo
( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
@@ -1373,17 +1392,19 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
-1, getCppuType( static_cast<ucb::OpenCommandArgument2 * >( 0 ) ) ),
- // Folder only
+ // Folder Only, omitted if not a folder
ucb::CommandInfo
( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
- -1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) )
+ -1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) ),
+ ucb::CommandInfo
+ ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
+ -1, getCppuType( static_cast<ucb::ContentInfo * >( 0 ) ) )
};
- int num = 7;
-
- if ( isFolder( xEnv ) )
- num += 1;
- return uno::Sequence< ucb::CommandInfo >(aDocumentCommandInfoTable, num );
+ const int nProps
+ = sizeof( aCommandInfoTable ) / sizeof( aCommandInfoTable[ 0 ] );
+ return uno::Sequence< ucb::CommandInfo >(
+ aCommandInfoTable, isFolder( xEnv ) ? nProps : nProps - 2 );
}
rtl::OUString
@@ -1420,8 +1441,8 @@ Content::copyData( uno::Reference< io::XInputStream > xIn,
}
// Inherits an authentication context
-uno::Reference< io::XInputStream >
-Content::createTempStream(
+uno::Reference< io::XInputStream >
+Content::createTempStream(
const uno::Reference< ucb::XCommandEnvironment >& xEnv )
throw( uno::Exception )
{
@@ -1450,8 +1471,8 @@ Content::createTempStream(
return uno::Reference < io::XInputStream > ( xTempOut, uno::UNO_QUERY );
}
-uno::Reference< io::XInputStream >
-Content::createInputStream(
+uno::Reference< io::XInputStream >
+Content::createInputStream(
const uno::Reference< ucb::XCommandEnvironment >& xEnv )
throw( uno::Exception )
{
@@ -1471,11 +1492,11 @@ Content::createInputStream(
result = gnome_vfs_open
( &handle, (const sal_Char *)aURI,
(GnomeVFSOpenMode) (GNOME_VFS_OPEN_READ | GNOME_VFS_OPEN_RANDOM ) );
-
+
if (result == GNOME_VFS_ERROR_INVALID_OPEN_MODE ||
result == GNOME_VFS_ERROR_NOT_SUPPORTED)
return createTempStream( xEnv );
-
+
if (result != GNOME_VFS_OK)
cancelCommandExecution( result, xEnv );
@@ -1506,14 +1527,14 @@ Content::feedSink( uno::Reference< uno::XInterface > aSink,
= uno::Reference< io::XOutputStream >(aSink, uno::UNO_QUERY );
uno::Reference< io::XActiveDataSink > xDataSink
= uno::Reference< io::XActiveDataSink >(aSink, uno::UNO_QUERY );
-
+
if ( !xOut.is() && !xDataSink.is() )
return sal_False;
uno::Reference< io::XInputStream > xIn = createInputStream( xEnv );
if ( !xIn.is() )
return sal_False;
-
+
if ( xOut.is() )
copyData( xIn, xOut );
@@ -1538,7 +1559,7 @@ extern "C" {
{
task::XInteractionHandler *xIH;
-#ifdef DEBUG
+#ifdef DEBUG
g_warning ("Full authentication callback (%p) ...", callback_data);
#endif
@@ -1547,7 +1568,7 @@ extern "C" {
const GnomeVFSModuleCallbackFullAuthenticationIn *in =
(const GnomeVFSModuleCallbackFullAuthenticationIn *) in_void;
- GnomeVFSModuleCallbackFullAuthenticationOut *out =
+ GnomeVFSModuleCallbackFullAuthenticationOut *out =
(GnomeVFSModuleCallbackFullAuthenticationOut *) out_void;
g_return_if_fail (in != NULL && out != NULL);
@@ -1590,7 +1611,7 @@ extern "C" {
(aUserName.getLength() ?
ucbhelper::SimpleAuthenticationRequest::ENTITY_FIXED :
ucbhelper::SimpleAuthenticationRequest::ENTITY_NA);
-
+
// No suggested password.
ePassword = (in->flags & GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_PASSWORD) ?
ucbhelper::SimpleAuthenticationRequest::ENTITY_MODIFY :
@@ -1662,30 +1683,30 @@ extern "C" {
gsize out_size,
gpointer callback_data)
{
-#ifdef DEBUG
+#ifdef DEBUG
g_warning ("Old authentication callback (%p) [ UNTESTED ] ...", callback_data);
#endif
const GnomeVFSModuleCallbackAuthenticationIn *in =
(const GnomeVFSModuleCallbackAuthenticationIn *) in_void;
- GnomeVFSModuleCallbackAuthenticationOut *out =
+ GnomeVFSModuleCallbackAuthenticationOut *out =
(GnomeVFSModuleCallbackAuthenticationOut *) out_void;
g_return_if_fail (in != NULL && out != NULL);
g_return_if_fail (sizeof (GnomeVFSModuleCallbackAuthenticationIn) == in_size &&
sizeof (GnomeVFSModuleCallbackAuthenticationOut) == out_size);
- GnomeVFSModuleCallbackFullAuthenticationIn mapped_in = {
+ GnomeVFSModuleCallbackFullAuthenticationIn mapped_in = {
(GnomeVFSModuleCallbackFullAuthenticationFlags)
(GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_PASSWORD |
GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_USERNAME |
GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_DOMAIN),
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
GnomeVFSModuleCallbackFullAuthenticationOut mapped_out = { 0, 0, 0, 0, 0, 0, 0, 0 };
-
+
// Map the old style input auth. data to the new style structure.
if (in->previous_attempt_failed)
mapped_in.flags = (GnomeVFSModuleCallbackFullAuthenticationFlags)
- (mapped_in.flags |
+ (mapped_in.flags |
GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_PREVIOUS_ATTEMPT_FAILED);
GnomeVFSURI *pURI = NULL;
@@ -1698,11 +1719,11 @@ extern "C" {
mapped_in.server = (char *) gnome_vfs_uri_get_host_name (pURI);
mapped_in.port = gnome_vfs_uri_get_host_port (pURI);
mapped_in.username = (char *) gnome_vfs_uri_get_user_name (pURI);
- }
+ }
mapped_in.domain = in->realm;
mapped_in.default_user = mapped_in.username;
mapped_in.default_domain = mapped_in.domain;
-
+
vfs_authentication_callback ((gconstpointer) &mapped_in,
sizeof (mapped_in),
(gpointer) &mapped_out,
@@ -1710,7 +1731,7 @@ extern "C" {
callback_data);
if (pURI)
- gnome_vfs_uri_unref (pURI);
+ gnome_vfs_uri_unref (pURI);
// Map the new style auth. out data to the old style out structure.
out->username = mapped_out.username;
diff --git a/ucb/source/ucp/gvfs/content.hxx b/ucb/source/ucp/gvfs/gvfs_content.hxx
index 31254b8733..67425da4df 100644
--- a/ucb/source/ucp/gvfs/content.hxx
+++ b/ucb/source/ucp/gvfs/gvfs_content.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -82,11 +82,11 @@ class Content : public ::ucbhelper::ContentImplHelper,
public com::sun::star::ucb::XContentCreator
{
//=========================================================================
-// Internals
+// Internals
//=========================================================================
private:
typedef rtl::Reference< Content > ContentRef;
- typedef std::list< ContentRef > ContentRefList;
+ typedef std::list< ContentRef > ContentRefList;
// Instance data
ContentProvider *m_pProvider; // No need for a ref, base class holds object
@@ -98,7 +98,7 @@ private:
::com::sun::star::uno::Any getBadArgExcept ();
GnomeVFSResult getInfo ( const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& xEnv );
- sal_Bool isFolder ( const ::com::sun::star::uno::Reference<
+ sal_Bool isFolder ( const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& xEnv );
sal_Bool exchangeIdentity( const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XContentIdentifier >& xNewId);
@@ -110,7 +110,7 @@ private:
// End Internal helpers
// For ucbhelper
- virtual ::rtl::OUString getParentURL();
+ virtual ::rtl::OUString getParentURL();
// For ucbhelper
virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
getProperties( const com::sun::star::uno::Reference<
@@ -122,8 +122,8 @@ private:
public:
// Command "getPropertyValues"
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
- getPropertyValues( const ::com::sun::star::uno::Sequence<
+ ::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 );
@@ -136,22 +136,22 @@ private:
const ::com::sun::star::uno::Reference<
::com::sun::star::ucb::XCommandEnvironment >& xEnv );
- // Command "insert"
- void insert( const ::com::sun::star::uno::Reference<
+ // 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 >& xEnv )
+ sal_Bool bReplaceExisting,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw( ::com::sun::star::uno::Exception );
// Command "transfer"
void transfer( const ::com::sun::star::ucb::TransferInfo & rArgs,
const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& xEnv )
+ com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw( ::com::sun::star::uno::Exception );
// Command "delete"
- void destroy( sal_Bool bDeletePhysical )
+ void destroy( sal_Bool bDeletePhysical )
throw( ::com::sun::star::uno::Exception );
// "open" helpers
@@ -161,21 +161,21 @@ private:
::com::sun::star::io::XOutputStream > xOut );
::com::sun::star::uno::Reference<
- ::com::sun::star::io::XInputStream >
+ ::com::sun::star::io::XInputStream >
createTempStream( const ::com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw( ::com::sun::star::uno::Exception );
::com::sun::star::uno::Reference<
- ::com::sun::star::io::XInputStream >
+ ::com::sun::star::io::XInputStream >
createInputStream( const ::com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw( ::com::sun::star::uno::Exception );
- sal_Bool feedSink( ::com::sun::star::uno::Reference<
+ sal_Bool feedSink( ::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface> aSink,
const ::com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& xEnv );
- ::com::sun::star::uno::Any mapVFSException( const GnomeVFSResult result,
+ ::com::sun::star::uno::Any mapVFSException( const GnomeVFSResult result,
sal_Bool bWrite );
void cancelCommandExecution(const GnomeVFSResult result,
@@ -192,27 +192,27 @@ public:
rtl::OUString getOUURI ();
//=========================================================================
-// Externals
+// Externals
//=========================================================================
public:
- Content( const ::com::sun::star::uno::Reference<
+ 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)
throw ( ::com::sun::star::ucb::ContentCreationException );
- Content( const ::com::sun::star::uno::Reference<
+ 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,
sal_Bool isFolder)
throw ( ::com::sun::star::ucb::ContentCreationException );
- virtual ~Content();
+ virtual ~Content();
- // XInterface
- XINTERFACE_DECL()
+ // XInterface
+ XINTERFACE_DECL()
// XTypeProvider
XTYPEPROVIDER_DECL()
@@ -220,40 +220,47 @@ public:
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName()
throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- getSupportedServiceNames()
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
throw( ::com::sun::star::uno::RuntimeException );
- // XContent
- virtual rtl::OUString SAL_CALL
- getContentType()
+ // 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,
+ // 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 >& xEnv )
throw( com::sun::star::uno::Exception,
com::sun::star::ucb::CommandAbortedException,
com::sun::star::uno::RuntimeException );
- virtual void SAL_CALL
- abort( sal_Int32 CommandId )
+ virtual void SAL_CALL
+ abort( sal_Int32 CommandId )
throw( com::sun::star::uno::RuntimeException );
- //////////////////////////////////////////////////////////////////////
- // Additional interfaces
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
+ // Additional interfaces
+ //////////////////////////////////////////////////////////////////////
- // XContentCreator
+ // XContentCreator
virtual com::sun::star::uno::Sequence<
com::sun::star::ucb::ContentInfo > SAL_CALL
- queryCreatableContentsInfo()
+ queryCreatableContentsInfo()
throw( com::sun::star::uno::RuntimeException );
- virtual com::sun::star::uno::Reference<
- com::sun::star::ucb::XContent > SAL_CALL
- createNewContent( const com::sun::star::ucb::ContentInfo& Info )
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContent > SAL_CALL
+ createNewContent( const com::sun::star::ucb::ContentInfo& Info )
+ throw( com::sun::star::uno::RuntimeException );
+
+
+ com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
+ queryCreatableContentsInfo(
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& xEnv)
throw( com::sun::star::uno::RuntimeException );
};
diff --git a/ucb/source/ucp/gvfs/directory.cxx b/ucb/source/ucp/gvfs/gvfs_directory.cxx
index ff699a3c63..d8357a060a 100644
--- a/ucb/source/ucp/gvfs/directory.cxx
+++ b/ucb/source/ucp/gvfs/gvfs_directory.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -40,7 +40,7 @@
#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/providerhelper.hxx>
-#include "directory.hxx"
+#include "gvfs_directory.hxx"
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-directory.h>
@@ -96,7 +96,7 @@ struct ResultListEntry
gnome_vfs_file_info_copy (&aInfo, fileInfo);
}
- ~ResultListEntry()
+ ~ResultListEntry()
{
gnome_vfs_file_info_clear (&aInfo);
}
@@ -180,7 +180,7 @@ rtl::OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
aId += rtl::OUString::createFromAscii( "/" );
aId += rtl::OUString::createFromAscii( escaped_name );
-
+
g_free( escaped_name );
m_pImpl->m_aResults[ nIndex ]->aId = aId;
@@ -240,7 +240,7 @@ DataSupplier::queryContent( sal_uInt32 nIndex )
= m_pImpl->m_xContent->getProvider()->queryContent( xId );
m_pImpl->m_aResults[ nIndex ]->xContent = xContent;
return xContent;
-
+
}
catch ( ucb::IllegalIdentifierException& ) {
}
@@ -347,7 +347,7 @@ sal_Bool DataSupplier::getData()
char *uri = m_pImpl->m_xContent->getURI();
result = gnome_vfs_directory_open
( &dirHandle, uri, GNOME_VFS_FILE_INFO_DEFAULT );
-
+
if (result != GNOME_VFS_OK) {
#ifdef DEBUG
g_warning ("Failed open of '%s' with '%s'",
@@ -375,18 +375,18 @@ sal_Bool DataSupplier::getData()
fileInfo.type != GNOME_VFS_FILE_TYPE_DIRECTORY )
continue;
break;
-
+
case ucb::OpenMode::DOCUMENTS:
if ( !(fileInfo.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) ||
fileInfo.type != GNOME_VFS_FILE_TYPE_REGULAR )
continue;
break;
-
+
case ucb::OpenMode::ALL:
default:
break;
}
-
+
m_pImpl->m_aResults.push_back( new ResultListEntry( &fileInfo ) );
}
#ifdef DEBUG
diff --git a/ucb/source/ucp/gvfs/directory.hxx b/ucb/source/ucp/gvfs/gvfs_directory.hxx
index d5124eedb6..929eae9b18 100644
--- a/ucb/source/ucp/gvfs/directory.hxx
+++ b/ucb/source/ucp/gvfs/gvfs_directory.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -33,7 +33,7 @@
#include <rtl/ref.hxx>
#include <ucbhelper/resultset.hxx>
#include <ucbhelper/resultsethelper.hxx>
-#include "content.hxx"
+#include "gvfs_content.hxx"
namespace gvfs {
@@ -44,11 +44,11 @@ class DynamicResultSet : public ::ucbhelper::ResultSetImplHelper
com::sun::star::ucb::XCommandEnvironment > m_xEnv;
private:
- virtual void initStatic();
- virtual void initDynamic();
+ virtual void initStatic();
+ virtual void initDynamic();
public:
- DynamicResultSet( const com::sun::star::uno::Reference<
+ DynamicResultSet( const com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
const rtl::Reference< Content >& rxContent,
const com::sun::star::ucb::OpenCommandArgument2& rCommand,
diff --git a/ucb/source/ucp/gvfs/provider.cxx b/ucb/source/ucp/gvfs/gvfs_provider.cxx
index eec5dd1296..a5eca1dadd 100644
--- a/ucb/source/ucp/gvfs/provider.cxx
+++ b/ucb/source/ucp/gvfs/gvfs_provider.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -33,8 +33,8 @@
#include <ucbhelper/contentidentifier.hxx>
#include <libgnomevfs/gnome-vfs-init.h>
-#include "provider.hxx"
-#include "content.hxx"
+#include "gvfs_provider.hxx"
+#include "gvfs_content.hxx"
using namespace com::sun::star;
using namespace gvfs;
@@ -114,7 +114,7 @@ ContentProvider::queryContent(
uno::RuntimeException )
{
#ifdef DEBUG
- g_warning ("QueryContent: '%s'",
+ g_warning ("QueryContent: '%s'",
(const sal_Char *)rtl::OUStringToOString
(Identifier->getContentIdentifier(), RTL_TEXTENCODING_UTF8));
#endif
@@ -182,14 +182,14 @@ writeInfo( void *pRegistryKey,
return bSuccess;
}
-extern "C" void SAL_CALL
+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
+extern "C" sal_Bool SAL_CALL
component_writeInfo( void */*pServiceManager*/,
void *pRegistryKey )
{
diff --git a/ucb/source/ucp/gvfs/provider.hxx b/ucb/source/ucp/gvfs/gvfs_provider.hxx
index 4aa024ee96..4aa024ee96 100644
--- a/ucb/source/ucp/gvfs/provider.hxx
+++ b/ucb/source/ucp/gvfs/gvfs_provider.hxx
diff --git a/ucb/source/ucp/gvfs/stream.cxx b/ucb/source/ucp/gvfs/gvfs_stream.cxx
index 7ea1e95619..007693d46a 100644
--- a/ucb/source/ucp/gvfs/stream.cxx
+++ b/ucb/source/ucp/gvfs/gvfs_stream.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -30,7 +30,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_ucb.hxx"
-#include "stream.hxx"
+#include "gvfs_stream.hxx"
#include <rtl/memory.h>
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
@@ -89,7 +89,7 @@ Stream::getInputStream( )
}
return Reference< XInputStream >( this );
}
-
+
com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > SAL_CALL
Stream::getOutputStream( )
throw( com::sun::star::uno::RuntimeException )
@@ -187,13 +187,13 @@ sal_Int32 SAL_CALL Stream::available( )
}
void SAL_CALL Stream::closeInput( void )
- throw( NotConnectedException,
- IOException,
- RuntimeException )
+ throw( NotConnectedException,
+ IOException,
+ RuntimeException )
{
osl::MutexGuard aGuard( m_aMutex );
m_bInputStreamCalled = false;
-
+
if( ! m_bOutputStreamCalled )
closeStream();
}
@@ -234,7 +234,7 @@ sal_Int64 SAL_CALL Stream::getPosition()
throw IOException();
throwOnError( gnome_vfs_tell( m_handle, &nBytesIn ) );
-
+
return nBytesIn;
}
@@ -293,13 +293,13 @@ void SAL_CALL Stream::writeBytes( const com::sun::star::uno::Sequence< sal_Int8
p += bytesWritten;
}
}
-
+
void SAL_CALL Stream::flush( void )
throw( NotConnectedException, BufferSizeExceededException,
IOException, RuntimeException )
{
}
-
+
void SAL_CALL Stream::closeOutput( void )
throw( com::sun::star::io::NotConnectedException,
com::sun::star::io::IOException,
@@ -307,7 +307,7 @@ void SAL_CALL Stream::closeOutput( void )
{
osl::MutexGuard aGuard( m_aMutex );
m_bOutputStreamCalled = false;
-
+
if( ! m_bInputStreamCalled )
closeStream();
}
diff --git a/ucb/source/ucp/gvfs/stream.hxx b/ucb/source/ucp/gvfs/gvfs_stream.hxx
index a621c08e98..a621c08e98 100644
--- a/ucb/source/ucp/gvfs/stream.hxx
+++ b/ucb/source/ucp/gvfs/gvfs_stream.hxx
diff --git a/ucb/source/ucp/gvfs/makefile.mk b/ucb/source/ucp/gvfs/makefile.mk
index 889e3ffd41..81eb43da97 100644
--- a/ucb/source/ucp/gvfs/makefile.mk
+++ b/ucb/source/ucp/gvfs/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2008 by Sun Microsystems, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -62,10 +62,10 @@ PKGCONFIG_LIBS!:=-Wl,--export-dynamic $(PKGCONFIG_LIBS:s/ -llinc//:s/ -lbonobo-a
DLLPRE =
SLOFILES=\
- $(SLO)$/content.obj \
- $(SLO)$/directory.obj \
- $(SLO)$/stream.obj \
- $(SLO)$/provider.obj
+ $(SLO)$/gvfs_content.obj \
+ $(SLO)$/gvfs_directory.obj \
+ $(SLO)$/gvfs_stream.obj \
+ $(SLO)$/gvfs_provider.obj
SHL1NOCHECK=TRUE
SHL1TARGET=$(TARGET)$(UCPGVFS_MAJOR).uno
diff --git a/ucb/source/ucp/hierarchy/hierarchycontent.cxx b/ucb/source/ucp/hierarchy/hierarchycontent.cxx
index 49774e943f..8027700a01 100644
--- a/ucb/source/ucp/hierarchy/hierarchycontent.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchycontent.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -41,7 +41,7 @@
**************************************************************************
- Root Folder vs. 'normal' Folder
- - root doesn't support command 'delete'
+ - root doesn't support command 'delete'
- root doesn't support command 'insert'
- root needs not created via XContentCreator - queryContent with root
folder id ( HIERARCHY_ROOT_FOLDER_URL ) always returns a value != 0
@@ -457,8 +457,8 @@ uno::Any SAL_CALL HierarchyContent::execute(
aRet <<= getCommandInfo( Environment );
}
- else if ( isFolder() && aCommand.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "open" ) ) )
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "open" ) ) && isFolder() )
{
//////////////////////////////////////////////////////////////////
// open command for a folder content
@@ -481,9 +481,9 @@ uno::Any SAL_CALL HierarchyContent::execute(
= new DynamicResultSet( m_xSMgr, this, aOpenCommand );
aRet <<= xSet;
}
- else if ( ( m_eKind != ROOT ) && !isReadOnly() &&
- aCommand.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "insert" ) ) )
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "insert" ) ) &&
+ ( m_eKind != ROOT ) && !isReadOnly() )
{
//////////////////////////////////////////////////////////////////
// insert
@@ -508,9 +508,9 @@ uno::Any SAL_CALL HierarchyContent::execute(
: ucb::NameClash::ERROR;
insert( nNameClash, Environment );
}
- else if ( ( m_eKind != ROOT ) && !isReadOnly() &&
- aCommand.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "delete" ) ) )
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "delete" ) ) &&
+ ( m_eKind != ROOT ) && !isReadOnly() )
{
//////////////////////////////////////////////////////////////////
// delete
@@ -546,13 +546,13 @@ uno::Any SAL_CALL HierarchyContent::execute(
// Remove own and all children's Additional Core Properties.
removeAdditionalPropertySet( sal_True );
}
- else if ( isFolder() && !isReadOnly() &&
- aCommand.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "transfer" ) ) )
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "transfer" ) ) &&
+ isFolder() && !isReadOnly() )
{
//////////////////////////////////////////////////////////////////
// transfer
- // ( Not available at link objects )
+ // ( Not available at link objects )
//////////////////////////////////////////////////////////////////
ucb::TransferInfo aInfo;
@@ -571,6 +571,31 @@ uno::Any SAL_CALL HierarchyContent::execute(
transfer( aInfo, Environment );
}
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) ) &&
+ isFolder() && !isReadOnly() )
+ {
+ //////////////////////////////////////////////////////////////////
+ // createNewContent
+ // ( Not available at link objects )
+ //////////////////////////////////////////////////////////////////
+
+ ucb::ContentInfo aInfo;
+ if ( !( aCommand.Argument >>= aInfo ) )
+ {
+ OSL_ENSURE( sal_False, "Wrong argument type!" );
+ ucbhelper::cancelCommandExecution(
+ uno::makeAny( lang::IllegalArgumentException(
+ rtl::OUString::createFromAscii(
+ "Wrong argument type!" ),
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ // Unreachable
+ }
+
+ aRet <<= createNewContent( aInfo );
+ }
else
{
//////////////////////////////////////////////////////////////////
@@ -607,54 +632,7 @@ uno::Sequence< ucb::ContentInfo > SAL_CALL
HierarchyContent::queryCreatableContentsInfo()
throw( uno::RuntimeException )
{
- if ( isFolder() )
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
-
- uno::Sequence< ucb::ContentInfo > aSeq( 2 );
-
- // Folder.
- aSeq.getArray()[ 0 ].Type
- = rtl::OUString::createFromAscii( HIERARCHY_FOLDER_CONTENT_TYPE );
- aSeq.getArray()[ 0 ].Attributes
- = ucb::ContentInfoAttribute::KIND_FOLDER;
-
- uno::Sequence< beans::Property > aFolderProps( 1 );
- aFolderProps.getArray()[ 0 ] = beans::Property(
- rtl::OUString::createFromAscii( "Title" ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND );
- aSeq.getArray()[ 0 ].Properties = aFolderProps;
-
- // Link.
- aSeq.getArray()[ 1 ].Type
- = rtl::OUString::createFromAscii( HIERARCHY_LINK_CONTENT_TYPE );
- aSeq.getArray()[ 1 ].Attributes
- = ucb::ContentInfoAttribute::KIND_LINK;
-
- uno::Sequence< beans::Property > aLinkProps( 2 );
- aLinkProps.getArray()[ 0 ] = beans::Property(
- rtl::OUString::createFromAscii( "Title" ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND );
- aLinkProps.getArray()[ 1 ] = beans::Property(
- rtl::OUString::createFromAscii( "TargetURL" ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND );
- aSeq.getArray()[ 1 ].Properties = aLinkProps;
-
- return aSeq;
- }
- else
- {
- OSL_ENSURE( sal_False,
- "queryCreatableContentsInfo called on non-folder object!" );
-
- return uno::Sequence< ucb::ContentInfo >( 0 );
- }
+ return m_aProps.getCreatableContentsInfo();
}
//=========================================================================
@@ -974,7 +952,7 @@ sal_Bool HierarchyContent::exchangeIdentity(
aOldURL.getLength(),
xNewId->getContentIdentifier() );
uno::Reference< ucb::XContentIdentifier > xNewChildId
- = new ::ucbhelper::ContentIdentifier(
+ = new ::ucbhelper::ContentIdentifier(
m_xSMgr, aNewChildURL );
if ( !xChild->exchangeIdentity( xNewChildId ) )
@@ -1026,7 +1004,7 @@ uno::Reference< sdbc::XRow > HierarchyContent::getPropertyValues(
xRow->appendString ( rProp, rData.getContentType() );
}
else if ( rProp.Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
+ RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
{
xRow->appendString ( rProp, rData.getTitle() );
}
@@ -1041,6 +1019,12 @@ uno::Reference< sdbc::XRow > HierarchyContent::getPropertyValues(
xRow->appendBoolean( rProp, rData.getIsFolder() );
}
else if ( rProp.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
+ {
+ xRow->appendObject(
+ rProp, uno::makeAny( rData.getCreatableContentsInfo() ) );
+ }
+ else if ( rProp.Name.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM( "TargetURL" ) ) )
{
// TargetURL is only supported by links.
@@ -1123,6 +1107,15 @@ uno::Reference< sdbc::XRow > HierarchyContent::getPropertyValues(
// @@@ Might actually be read-only!
beans::PropertyAttribute::BOUND ),
rData.getTargetURL() );
+ xRow->appendObject(
+ beans::Property(
+ rtl::OUString::createFromAscii( "CreatableContentsInfo" ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY ),
+ uno::makeAny( rData.getCreatableContentsInfo() ) );
// Append all Additional Core Properties.
@@ -1161,11 +1154,11 @@ uno::Sequence< uno::Any > HierarchyContent::setPropertyValues(
beans::PropertyChangeEvent aEvent;
aEvent.Source = static_cast< cppu::OWeakObject * >( this );
- aEvent.Further = sal_False;
-// aEvent.PropertyName =
+ aEvent.Further = sal_False;
+// aEvent.PropertyName =
aEvent.PropertyHandle = -1;
-// aEvent.OldValue =
-// aEvent.NewValue =
+// aEvent.OldValue =
+// aEvent.NewValue =
const beans::PropertyValue* pValues = rValues.getConstArray();
sal_Int32 nCount = rValues.getLength();
@@ -1210,6 +1203,15 @@ uno::Sequence< uno::Any > HierarchyContent::setPropertyValues(
static_cast< cppu::OWeakObject * >( this ) );
}
else if ( rValue.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
+ {
+ // Read-only property!
+ aRet[ n ] <<= lang::IllegalAccessException(
+ rtl::OUString::createFromAscii(
+ "Property is read-only!" ),
+ static_cast< cppu::OWeakObject * >( this ) );
+ }
+ else if ( rValue.Name.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
{
if ( isReadOnly() )
@@ -1238,7 +1240,7 @@ uno::Sequence< uno::Any > HierarchyContent::setPropertyValues(
m_aProps.setTitle( aNewValue );
m_aProps.setName(
- ::ucb_impl::urihelper::encodeSegment(
+ ::ucb_impl::urihelper::encodeSegment(
aNewValue ) );
// property change event will be set later...
@@ -1350,7 +1352,7 @@ uno::Sequence< uno::Any > HierarchyContent::setPropertyValues(
rValue.Name, rValue.Value );
aEvent.PropertyName = rValue.Name;
- aEvent.OldValue = aOldValue;
+ aEvent.OldValue = aOldValue;
aEvent.NewValue = rValue.Value;
aChanges.getArray()[ nChanged ] = aEvent;
@@ -1953,3 +1955,58 @@ void HierarchyContent::transfer(
}
}
+//=========================================================================
+//=========================================================================
+//
+// HierarchyContentProperties Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+uno::Sequence< ucb::ContentInfo >
+HierarchyContentProperties::getCreatableContentsInfo() const
+{
+ if ( getIsFolder() )
+ {
+ uno::Sequence< ucb::ContentInfo > aSeq( 2 );
+
+ // Folder.
+ aSeq.getArray()[ 0 ].Type
+ = rtl::OUString::createFromAscii( HIERARCHY_FOLDER_CONTENT_TYPE );
+ aSeq.getArray()[ 0 ].Attributes
+ = ucb::ContentInfoAttribute::KIND_FOLDER;
+
+ uno::Sequence< beans::Property > aFolderProps( 1 );
+ aFolderProps.getArray()[ 0 ] = beans::Property(
+ rtl::OUString::createFromAscii( "Title" ),
+ -1,
+ getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
+ beans::PropertyAttribute::BOUND );
+ aSeq.getArray()[ 0 ].Properties = aFolderProps;
+
+ // Link.
+ aSeq.getArray()[ 1 ].Type
+ = rtl::OUString::createFromAscii( HIERARCHY_LINK_CONTENT_TYPE );
+ aSeq.getArray()[ 1 ].Attributes
+ = ucb::ContentInfoAttribute::KIND_LINK;
+
+ uno::Sequence< beans::Property > aLinkProps( 2 );
+ aLinkProps.getArray()[ 0 ] = beans::Property(
+ rtl::OUString::createFromAscii( "Title" ),
+ -1,
+ getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
+ beans::PropertyAttribute::BOUND );
+ aLinkProps.getArray()[ 1 ] = beans::Property(
+ rtl::OUString::createFromAscii( "TargetURL" ),
+ -1,
+ getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
+ beans::PropertyAttribute::BOUND );
+ aSeq.getArray()[ 1 ].Properties = aLinkProps;
+
+ return aSeq;
+ }
+ else
+ {
+ return uno::Sequence< ucb::ContentInfo >( 0 );
+ }
+}
diff --git a/ucb/source/ucp/hierarchy/hierarchycontent.hxx b/ucb/source/ucp/hierarchy/hierarchycontent.hxx
index 168ada3b23..4094d77e4c 100644
--- a/ucb/source/ucp/hierarchy/hierarchycontent.hxx
+++ b/ucb/source/ucp/hierarchy/hierarchycontent.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -101,6 +101,9 @@ public:
sal_Bool getIsDocument() const { return !getIsFolder(); }
+ com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
+ getCreatableContentsInfo() const;
+
const HierarchyEntryData & getHierarchyEntryData() const { return m_aData; }
private:
@@ -117,14 +120,14 @@ class HierarchyContent : public ::ucbhelper::ContentImplHelper,
{
enum ContentKind { LINK, FOLDER, ROOT };
enum ContentState { TRANSIENT, // created via CreateNewContent,
- // but did not process "insert" yet
+ // but did not process "insert" yet
PERSISTENT, // processed "insert"
- DEAD // processed "delete"
+ DEAD // processed "delete"
};
HierarchyContentProperties m_aProps;
- ContentKind m_eKind;
- ContentState m_eState;
+ ContentKind m_eKind;
+ ContentState m_eState;
HierarchyContentProvider* m_pProvider;
bool m_bCheckedReadOnly;
bool m_bIsReadOnly;
@@ -194,11 +197,11 @@ private:
sal_Bool exchangeIdentity(
const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XContentIdentifier >& xNewId );
+ ::com::sun::star::ucb::XContentIdentifier >& xNewId );
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
getPropertyValues( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::beans::Property >& rProperties );
+ ::com::sun::star::beans::Property >& rProperties );
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
setPropertyValues(
const ::com::sun::star::uno::Sequence<
@@ -270,7 +273,7 @@ public:
execute( const com::sun::star::ucb::Command& aCommand,
sal_Int32 CommandId,
const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& Environment )
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
throw( com::sun::star::uno::Exception,
com::sun::star::ucb::CommandAbortedException,
com::sun::star::uno::RuntimeException );
@@ -300,7 +303,7 @@ public:
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,
+ ::com::sun::star::beans::Property >& rProperties,
const HierarchyContentProperties& rData,
HierarchyContentProvider* pProvider,
const ::rtl::OUString& rContentId );
diff --git a/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx b/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx
index 2adaa8cbb3..47280ec125 100644
--- a/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -39,25 +39,28 @@
Props/Commands:
- root folder folder link link
- (new) (new)
+ root folder folder link link
+ (new) (new)
----------------------------------------------------------------
- ContentType x x x x x
- IsDocument x x x x x
- IsFolder x x x x x
- Title x x x x x
- TargetURL x x
+ ContentType x x x x x
+ IsDocument x x x x x
+ IsFolder x x x x x
+ Title x x x x x
+ TargetURL x x
+ CreatableContentsInfo x x x x x
- getCommandInfo x x x x x
- getPropertySetInfo x x x x x
- getPropertyValues x x x x x
- setPropertyValues x x x x x
- insert x x
- delete x x
- open x x
- transfer x x
+ getCommandInfo x x x x x
+ getPropertySetInfo x x x x x
+ getPropertyValues x x x x x
+ setPropertyValues x x x x x
+ createNewContent x x
+ insert x x
+ delete x x
+ open x x
+ transfer x x
*************************************************************************/
+
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -76,6 +79,12 @@ using namespace hierarchy_ucp;
//
//=========================================================================
+#define MAKEPROPSEQUENCE( a ) \
+ uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
+
+#define MAKECMDSEQUENCE( a ) \
+ uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
+
//=========================================================================
//
// IMPORTENT: If any property data ( name / type / ... ) are changed, then
@@ -143,13 +152,20 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties(
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
- )
+ ),
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY )
///////////////////////////////////////////////////////////
// New properties
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- beans::Property >( aLinkPropertyInfoTable, 5 );
+ return MAKEPROPSEQUENCE( aLinkPropertyInfoTable );
}
else
{
@@ -195,13 +211,20 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties(
-1,
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
beans::PropertyAttribute::BOUND
- )
+ ),
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY )
///////////////////////////////////////////////////////////
// New properties
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- beans::Property >( aLinkPropertyInfoTable, 5 );
+ return MAKEPROPSEQUENCE( aLinkPropertyInfoTable );
}
}
else if ( m_eKind == FOLDER )
@@ -248,16 +271,23 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties(
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
- )
+ ),
///////////////////////////////////////////////////////////
// Optional standard properties
///////////////////////////////////////////////////////////
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY )
///////////////////////////////////////////////////////////
// New properties
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- beans::Property >( aFolderPropertyInfoTable, 4 );
+ return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
}
else
{
@@ -294,16 +324,23 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties(
-1,
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
beans::PropertyAttribute::BOUND
- )
+ ),
///////////////////////////////////////////////////////////
// Optional standard properties
///////////////////////////////////////////////////////////
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY )
///////////////////////////////////////////////////////////
// New properties
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- beans::Property >( aFolderPropertyInfoTable, 4 );
+ return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
}
}
else
@@ -314,6 +351,9 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties(
//
//=================================================================
+ // Currently no difference between reonly /read-write
+ // -> all props ar read-only
+
static beans::Property aRootFolderPropertyInfoTable[] =
{
///////////////////////////////////////////////////////////////
@@ -346,16 +386,23 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties(
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
- )
+ ),
///////////////////////////////////////////////////////////////
// Optional standard properties
///////////////////////////////////////////////////////////////
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY )
///////////////////////////////////////////////////////////////
// New properties
///////////////////////////////////////////////////////////////
};
- return uno::Sequence<
- beans::Property >( aRootFolderPropertyInfoTable, 4 );
+ return MAKEPROPSEQUENCE( aRootFolderPropertyInfoTable );
}
}
@@ -416,8 +463,7 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
// New commands
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- ucb::CommandInfo >( aLinkCommandInfoTable, 4 );
+ return MAKECMDSEQUENCE( aLinkCommandInfoTable );
}
else
{
@@ -470,8 +516,7 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
// New commands
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- ucb::CommandInfo >( aLinkCommandInfoTable, 6 );
+ return MAKECMDSEQUENCE( aLinkCommandInfoTable );
}
}
else if ( m_eKind == FOLDER )
@@ -529,8 +574,7 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
// New commands
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- ucb::CommandInfo >( aFolderCommandInfoTable, 5 );
+ return MAKECMDSEQUENCE( aFolderCommandInfoTable );
}
else
{
@@ -589,13 +633,18 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
-1,
getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
+ ),
+ ucb::CommandInfo(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
+ -1,
+ getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
)
///////////////////////////////////////////////////////////
// New commands
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- ucb::CommandInfo >( aFolderCommandInfoTable, 8 );
+ return MAKECMDSEQUENCE( aFolderCommandInfoTable );
}
}
else
@@ -653,8 +702,7 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
// New commands
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- ucb::CommandInfo >( aRootFolderCommandInfoTable, 5 );
+ return MAKECMDSEQUENCE( aRootFolderCommandInfoTable );
}
else
{
@@ -703,13 +751,18 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
-1,
getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
+ ),
+ ucb::CommandInfo(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
+ -1,
+ getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
)
///////////////////////////////////////////////////////////
// New commands
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- ucb::CommandInfo >( aRootFolderCommandInfoTable, 6 );
+ return MAKECMDSEQUENCE( aRootFolderCommandInfoTable );
}
}
}
diff --git a/ucb/source/ucp/package/pkgcontent.cxx b/ucb/source/ucp/package/pkgcontent.cxx
index eafac3d769..7e8359545e 100644
--- a/ucb/source/ucp/package/pkgcontent.cxx
+++ b/ucb/source/ucp/package/pkgcontent.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -55,9 +55,7 @@
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
-#ifndef _COM_SUN_STAR_UCB_INTERACTIVEBADTRANSFRERURLEXCEPTION_HPP_
#include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp>
-#endif
#include <com/sun/star/ucb/MissingInputStreamException.hpp>
#include <com/sun/star/ucb/NameClash.hpp>
#include <com/sun/star/ucb/NameClashException.hpp>
@@ -84,9 +82,9 @@
using namespace com::sun::star;
using namespace package_ucp;
-#define NONE_MODIFIED sal_uInt32( 0x00 )
-#define MEDIATYPE_MODIFIED sal_uInt32( 0x01 )
-#define COMPRESSED_MODIFIED sal_uInt32( 0x02 )
+#define NONE_MODIFIED sal_uInt32( 0x00 )
+#define MEDIATYPE_MODIFIED sal_uInt32( 0x01 )
+#define COMPRESSED_MODIFIED sal_uInt32( 0x02 )
#define ENCRYPTED_MODIFIED sal_uInt32( 0x04 )
#define ENCRYPTIONKEY_MODIFIED sal_uInt32( 0x08 )
@@ -105,17 +103,60 @@ ContentProperties::ContentProperties( const rtl::OUString& rContentType )
bEncrypted( sal_False ),
bHasEncryptedEntries( sal_False )
{
- bIsFolder = rContentType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( PACKAGE_FOLDER_CONTENT_TYPE ) )
- || rContentType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( PACKAGE_ZIP_FOLDER_CONTENT_TYPE ) );
+ bIsFolder = rContentType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( PACKAGE_FOLDER_CONTENT_TYPE ) )
+ || rContentType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( PACKAGE_ZIP_FOLDER_CONTENT_TYPE ) );
bIsDocument = !bIsFolder;
OSL_ENSURE( bIsFolder ||
- rContentType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( PACKAGE_STREAM_CONTENT_TYPE ) ) ||
- rContentType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( PACKAGE_ZIP_STREAM_CONTENT_TYPE ) ),
+ rContentType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( PACKAGE_STREAM_CONTENT_TYPE ) )
+ || rContentType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( PACKAGE_ZIP_STREAM_CONTENT_TYPE ) ),
"ContentProperties::ContentProperties - Unknown type!" );
}
//=========================================================================
+
+uno::Sequence< ucb::ContentInfo >
+ContentProperties::getCreatableContentsInfo( PackageUri const & rUri ) const
+{
+ if ( bIsFolder )
+ {
+ uno::Sequence< beans::Property > aProps( 1 );
+ aProps.getArray()[ 0 ] = beans::Property(
+ rtl::OUString::createFromAscii( "Title" ),
+ -1,
+ getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
+ beans::PropertyAttribute::BOUND );
+
+ uno::Sequence< ucb::ContentInfo > aSeq( 2 );
+
+ // Folder.
+ aSeq.getArray()[ 0 ].Type
+ = Content::getContentType( rUri.getScheme(), sal_True );
+ aSeq.getArray()[ 0 ].Attributes
+ = ucb::ContentInfoAttribute::KIND_FOLDER;
+ aSeq.getArray()[ 0 ].Properties = aProps;
+
+ // Stream.
+ aSeq.getArray()[ 1 ].Type
+ = Content::getContentType( rUri.getScheme(), sal_False );
+ aSeq.getArray()[ 1 ].Attributes
+ = ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
+ | ucb::ContentInfoAttribute::KIND_DOCUMENT;
+ aSeq.getArray()[ 1 ].Properties = aProps;
+
+ return aSeq;
+ }
+ else
+ {
+ return uno::Sequence< ucb::ContentInfo >( 0 );
+ }
+}
+
+//=========================================================================
//=========================================================================
//
// Content Implementation.
@@ -166,9 +207,9 @@ Content* Content::create(
ucb::ContentInfo aInfo;
if ( bFolder || aURI.isRootFolder() )
- aInfo.Type = GetContentType( aURI.getScheme(), sal_True );
+ aInfo.Type = getContentType( aURI.getScheme(), sal_True );
else
- aInfo.Type = GetContentType( aURI.getScheme(), sal_False );
+ aInfo.Type = getContentType( aURI.getScheme(), sal_False );
return new Content( rxSMgr, pProvider, xId, xPackage, aURI, aInfo );
}
@@ -188,9 +229,9 @@ Content* Content::create(
PackageUri aURI( Identifier->getContentIdentifier() );
if ( !Info.Type.equalsIgnoreAsciiCase(
- GetContentType( aURI.getScheme(), sal_True ) ) &&
+ getContentType( aURI.getScheme(), sal_True ) ) &&
!Info.Type.equalsIgnoreAsciiCase(
- GetContentType( aURI.getScheme(), sal_False ) ) )
+ getContentType( aURI.getScheme(), sal_False ) ) )
return 0;
uno::Reference< container::XHierarchicalNameAccess > xPackage;
@@ -210,13 +251,13 @@ Content* Content::create(
//=========================================================================
// static
-::rtl::OUString Content::GetContentType(
+::rtl::OUString Content::getContentType(
const ::rtl::OUString& aScheme, sal_Bool bFolder )
{
return ( rtl::OUString::createFromAscii( "application/" )
+ aScheme
- + ( bFolder
- ? rtl::OUString::createFromAscii( "-folder" )
+ + ( bFolder
+ ? rtl::OUString::createFromAscii( "-folder" )
: rtl::OUString::createFromAscii( "-stream" ) ) );
}
@@ -294,7 +335,7 @@ uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType )
aRet = cppu::queryInterface(
rType, static_cast< ucb::XContentCreator * >( this ) );
- return aRet.hasValue() ? aRet : ContentImplHelper::queryInterface( rType );
+ return aRet.hasValue() ? aRet : ContentImplHelper::queryInterface( rType );
}
//=========================================================================
@@ -609,7 +650,7 @@ uno::Any SAL_CALL Content::execute(
{
//////////////////////////////////////////////////////////////////
// transfer
- // ( Not available at stream objects )
+ // ( Not available at stream objects )
//////////////////////////////////////////////////////////////////
ucb::TransferInfo aInfo;
@@ -628,11 +669,36 @@ uno::Any SAL_CALL Content::execute(
transfer( aInfo, Environment );
}
else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) ) &&
+ isFolder() )
+ {
+ //////////////////////////////////////////////////////////////////
+ // createNewContent
+ // ( Not available at stream objects )
+ //////////////////////////////////////////////////////////////////
+
+ ucb::ContentInfo aInfo;
+ if ( !( aCommand.Argument >>= aInfo ) )
+ {
+ OSL_ENSURE( sal_False, "Wrong argument type!" );
+ ucbhelper::cancelCommandExecution(
+ uno::makeAny( lang::IllegalArgumentException(
+ rtl::OUString::createFromAscii(
+ "Wrong argument type!" ),
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ // Unreachable
+ }
+
+ aRet <<= createNewContent( aInfo );
+ }
+ else if ( aCommand.Name.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM( "flush" ) ) )
{
//////////////////////////////////////////////////////////////////
// flush
- // ( Not available at stream objects )
+ // ( Not available at stream objects )
//////////////////////////////////////////////////////////////////
if( !flushData() )
@@ -693,43 +759,7 @@ uno::Sequence< ucb::ContentInfo > SAL_CALL
Content::queryCreatableContentsInfo()
throw( uno::RuntimeException )
{
- if ( isFolder() )
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
-
- uno::Sequence< beans::Property > aProps( 1 );
- aProps.getArray()[ 0 ] = beans::Property(
- rtl::OUString::createFromAscii( "Title" ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND );
-
- uno::Sequence< ucb::ContentInfo > aSeq( 2 );
-
- // Folder.
- aSeq.getArray()[ 0 ].Type
- = GetContentType( m_aUri.getScheme(), sal_True );
- aSeq.getArray()[ 0 ].Attributes
- = ucb::ContentInfoAttribute::KIND_FOLDER;
- aSeq.getArray()[ 0 ].Properties = aProps;
-
- // Stream.
- aSeq.getArray()[ 1 ].Type
- = GetContentType( m_aUri.getScheme(), sal_False );
- aSeq.getArray()[ 1 ].Attributes
- = ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
- | ucb::ContentInfoAttribute::KIND_DOCUMENT;
- aSeq.getArray()[ 1 ].Properties = aProps;
-
- return aSeq;
- }
- else
- {
- OSL_ENSURE( sal_False,
- "queryCreatableContentsInfo called on non-folder object!" );
-
- return uno::Sequence< ucb::ContentInfo >( 0 );
- }
+ return m_aProps.getCreatableContentsInfo( m_aUri );
}
//=========================================================================
@@ -746,16 +776,16 @@ Content::createNewContent( const ucb::ContentInfo& Info )
return uno::Reference< ucb::XContent >();
if ( !Info.Type.equalsIgnoreAsciiCase(
- GetContentType( m_aUri.getScheme(), sal_True ) ) &&
+ getContentType( m_aUri.getScheme(), sal_True ) ) &&
!Info.Type.equalsIgnoreAsciiCase(
- GetContentType( m_aUri.getScheme(), sal_False ) ) )
+ getContentType( m_aUri.getScheme(), sal_False ) ) )
return uno::Reference< ucb::XContent >();
rtl::OUString aURL = m_aUri.getUri();
aURL += rtl::OUString::createFromAscii( "/" );
if ( Info.Type.equalsIgnoreAsciiCase(
- GetContentType( m_aUri.getScheme(), sal_True ) ) )
+ getContentType( m_aUri.getScheme(), sal_True ) ) )
aURL += rtl::OUString::createFromAscii( "New_Folder" );
else
aURL += rtl::OUString::createFromAscii( "New_Stream" );
@@ -828,7 +858,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
const uno::Reference< lang::XMultiServiceFactory >& rSMgr,
const uno::Sequence< beans::Property >& rProperties,
const ContentProperties& rData,
- const rtl::Reference< ::ucbhelper::ContentProviderImplHelper >&
+ const rtl::Reference< ::ucbhelper::ContentProviderImplHelper >&
rProvider,
const rtl::OUString& rContentId )
{
@@ -871,6 +901,14 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
xRow->appendBoolean( rProp, rData.bIsFolder );
}
else if ( rProp.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
+ {
+ xRow->appendObject(
+ rProp, uno::makeAny(
+ rData.getCreatableContentsInfo(
+ PackageUri( rContentId ) ) ) );
+ }
+ else if ( rProp.Name.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) )
{
xRow->appendString ( rProp, rData.aMediaType );
@@ -978,6 +1016,16 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY ),
rData.bIsFolder );
+ xRow->appendObject(
+ beans::Property(
+ rtl::OUString::createFromAscii( "CreatableContentsInfo" ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY ),
+ uno::makeAny(
+ rData.getCreatableContentsInfo( PackageUri( rContentId ) ) ) );
xRow->appendString(
beans::Property(
rtl::OUString::createFromAscii( "MediaType" ),
@@ -1068,11 +1116,11 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
beans::PropertyChangeEvent aEvent;
aEvent.Source = static_cast< cppu::OWeakObject * >( this );
- aEvent.Further = sal_False;
-// aEvent.PropertyName =
+ aEvent.Further = sal_False;
+// aEvent.PropertyName =
aEvent.PropertyHandle = -1;
-// aEvent.OldValue =
-// aEvent.NewValue =
+// aEvent.OldValue =
+// aEvent.NewValue =
const beans::PropertyValue* pValues = rValues.getConstArray();
sal_Int32 nCount = rValues.getLength();
@@ -1116,6 +1164,15 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
static_cast< cppu::OWeakObject * >( this ) );
}
else if ( rValue.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
+ {
+ // Read-only property!
+ aRet[ n ] <<= lang::IllegalAccessException(
+ rtl::OUString::createFromAscii(
+ "Property is read-only!" ),
+ static_cast< cppu::OWeakObject * >( this ) );
+ }
+ else if ( rValue.Name.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
{
if ( m_aUri.isRootFolder() )
@@ -1181,7 +1238,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
aEvent.NewValue = uno::makeAny( aNewValue );
m_aProps.aMediaType = aNewValue;
- nChanged++;
+ nChanged++;
bStore = sal_True;
m_nModifiedProps |= MEDIATYPE_MODIFIED;
}
@@ -1219,7 +1276,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
aEvent.NewValue = uno::makeAny( bNewValue );
m_aProps.bCompressed = bNewValue;
- nChanged++;
+ nChanged++;
bStore = sal_True;
m_nModifiedProps |= COMPRESSED_MODIFIED;
}
@@ -1256,7 +1313,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
aEvent.NewValue = uno::makeAny( bNewValue );
m_aProps.bEncrypted = bNewValue;
- nChanged++;
+ nChanged++;
bStore = sal_True;
m_nModifiedProps |= ENCRYPTED_MODIFIED;
}
@@ -1350,7 +1407,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
rValue.Name, rValue.Value );
aEvent.PropertyName = rValue.Name;
- aEvent.OldValue = aOldValue;
+ aEvent.OldValue = aOldValue;
aEvent.NewValue = rValue.Value;
aChanges.getArray()[ nChanged ] = aEvent;
@@ -1483,7 +1540,7 @@ uno::Any Content::open(
uno::Reference< ucb::XDynamicResultSet > xSet
= new DynamicResultSet( m_xSMgr, this, rArg, xEnv );
return uno::makeAny( xSet );
- }
+ }
else
{
//////////////////////////////////////////////////////////////////
@@ -1506,7 +1563,7 @@ uno::Any Content::open(
rtl::OUString aURL = m_xIdentifier->getContentIdentifier();
uno::Reference< io::XOutputStream > xOut( rArg.Sink, uno::UNO_QUERY );
if ( xOut.is() )
- {
+ {
// PUSH: write data into xOut
uno::Reference< io::XInputStream > xIn = getInputStream();
@@ -1560,14 +1617,14 @@ uno::Any Content::open(
{
// closeOutput, readSomeBytes, writeBytes
}
- }
+ }
else
- {
+ {
uno::Reference< io::XActiveDataSink > xDataSink(
rArg.Sink, uno::UNO_QUERY );
- if ( xDataSink.is() )
+ if ( xDataSink.is() )
{
- // PULL: wait for client read
+ // PULL: wait for client read
uno::Reference< io::XInputStream > xIn = getInputStream();
if ( !xIn.is() )
@@ -1598,7 +1655,7 @@ uno::Any Content::open(
// Done.
xDataSink->setInputStream( xIn );
}
- else
+ else
{
// Note: aOpenCommand.Sink may contain an XStream
// implementation. Support for this type of
@@ -1612,7 +1669,7 @@ uno::Any Content::open(
xEnv );
// Unreachable
}
- }
+ }
}
return uno::Any();
@@ -1931,8 +1988,8 @@ void Content::transfer(
//////////////////////////////////////////////////////////////////////
rtl::OUString aType = xSource->isFolder()
- ? GetContentType( m_aUri.getScheme(), sal_True )
- : GetContentType( m_aUri.getScheme(), sal_False );
+ ? getContentType( m_aUri.getScheme(), sal_True )
+ : getContentType( m_aUri.getScheme(), sal_False );
ucb::ContentInfo aContentInfo;
aContentInfo.Type = aType;
aContentInfo.Attributes = 0;
@@ -2185,7 +2242,7 @@ sal_Bool Content::exchangeIdentity(
aOldURL.getLength(),
xNewId->getContentIdentifier() );
uno::Reference< ucb::XContentIdentifier > xNewChildId
- = new ::ucbhelper::ContentIdentifier(
+ = new ::ucbhelper::ContentIdentifier(
m_xSMgr, aNewChildURL );
if ( !xChild->exchangeIdentity( xNewChildId ) )
@@ -2413,14 +2470,14 @@ sal_Bool Content::loadData(
if ( xEnumAccess.is() )
{
// folder
- rProps.aContentType = GetContentType( rURI.getScheme(), sal_True );
+ rProps.aContentType = getContentType( rURI.getScheme(), sal_True );
rProps.bIsDocument = sal_False;
rProps.bIsFolder = sal_True;
}
else
{
// stream
- rProps.aContentType = GetContentType( rURI.getScheme(), sal_False );
+ rProps.aContentType = getContentType( rURI.getScheme(), sal_False );
rProps.bIsDocument = sal_True;
rProps.bIsFolder = sal_False;
}
@@ -2611,8 +2668,8 @@ sal_Bool Content::storeData( const uno::Reference< io::XInputStream >& xStream )
if ( !xNA->hasByHierarchicalName( m_aUri.getPath() ) )
{
-// if ( !bCreate )
-// return sal_True;
+// if ( !bCreate )
+// return sal_True;
try
{
@@ -2956,4 +3013,3 @@ uno::Reference< container::XEnumeration > Content::getIterator()
return xIter;
}
-
diff --git a/ucb/source/ucp/package/pkgcontent.hxx b/ucb/source/ucp/package/pkgcontent.hxx
index 0673465d5c..1886d72470 100644
--- a/ucb/source/ucp/package/pkgcontent.hxx
+++ b/ucb/source/ucp/package/pkgcontent.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -34,9 +34,7 @@
#include <list>
#include <rtl/ref.hxx>
-#ifndef _COM_SUN_STAR_UCB_INTERACTIVEBADTRANSFRERURLEXCEPTION_HPP_
#include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp>
-#endif
#include <com/sun/star/ucb/XContentCreator.hpp>
#include <ucbhelper/contenthelper.hxx>
#include "pkguri.hxx"
@@ -100,6 +98,9 @@ struct ContentProperties
bHasEncryptedEntries( sal_False ) {}
ContentProperties( const ::rtl::OUString& rContentType );
+
+ com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
+ getCreatableContentsInfo( PackageUri const & rUri ) const;
};
//=========================================================================
@@ -110,17 +111,17 @@ class Content : public ::ucbhelper::ContentImplHelper,
public com::sun::star::ucb::XContentCreator
{
enum ContentState { TRANSIENT, // created via CreateNewContent,
- // but did not process "insert" yet
+ // but did not process "insert" yet
PERSISTENT, // processed "insert"
- DEAD // processed "delete"
+ DEAD // processed "delete"
};
- PackageUri m_aUri;
- ContentProperties m_aProps;
- ContentState m_eState;
+ PackageUri m_aUri;
+ ContentProperties m_aProps;
+ ContentState m_eState;
com::sun::star::uno::Reference<
- com::sun::star::container::XHierarchicalNameAccess > m_xPackage;
- ContentProvider* m_pProvider;
+ com::sun::star::container::XHierarchicalNameAccess > m_xPackage;
+ ContentProvider* m_pProvider;
sal_uInt32 m_nModifiedProps;
private:
@@ -130,7 +131,7 @@ private:
const com::sun::star::uno::Reference<
com::sun::star::ucb::XContentIdentifier >& Identifier,
const ::com::sun::star::uno::Reference<
- com::sun::star::container::XHierarchicalNameAccess >& Package,
+ com::sun::star::container::XHierarchicalNameAccess >& Package,
const PackageUri& rUri,
const ContentProperties& rProps );
Content( const com::sun::star::uno::Reference<
@@ -139,7 +140,7 @@ private:
const com::sun::star::uno::Reference<
com::sun::star::ucb::XContentIdentifier >& Identifier,
const com::sun::star::uno::Reference<
- com::sun::star::container::XHierarchicalNameAccess >& Package,
+ com::sun::star::container::XHierarchicalNameAccess >& Package,
const PackageUri& rUri,
const com::sun::star::ucb::ContentInfo& Info );
@@ -155,7 +156,7 @@ private:
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,
+ ::com::sun::star::beans::Property >& rProperties,
const ContentProperties& rData,
const rtl::Reference<
::ucbhelper::ContentProviderImplHelper >& rProvider,
@@ -183,24 +184,20 @@ private:
const PackageUri& rURI,
ContentProperties& rProps,
com::sun::star::uno::Reference<
- com::sun::star::container::XHierarchicalNameAccess > &
+ com::sun::star::container::XHierarchicalNameAccess > &
rxPackage );
static sal_Bool
hasData( ContentProvider* pProvider,
const PackageUri& rURI,
com::sun::star::uno::Reference<
- com::sun::star::container::XHierarchicalNameAccess > &
+ com::sun::star::container::XHierarchicalNameAccess > &
rxPackage );
- static ::rtl::OUString
- GetContentType( const ::rtl::OUString& aScheme,
- sal_Bool bFolder );
-
sal_Bool
hasData( const PackageUri& rURI );
sal_Bool
renameData( const com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentIdentifier >& xOldId,
+ com::sun::star::ucb::XContentIdentifier >& xOldId,
const com::sun::star::uno::Reference<
com::sun::star::ucb::XContentIdentifier >& xNewId );
sal_Bool
@@ -223,7 +220,7 @@ private:
::com::sun::star::uno::Any
open( const ::com::sun::star::ucb::OpenCommandArgument2& rArg,
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 insert( const ::com::sun::star::uno::Reference<
@@ -292,7 +289,7 @@ public:
execute( const com::sun::star::ucb::Command& aCommand,
sal_Int32 CommandId,
const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& Environment )
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
throw( com::sun::star::uno::Exception,
com::sun::star::ucb::CommandAbortedException,
com::sun::star::uno::RuntimeException );
@@ -323,7 +320,7 @@ public:
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,
+ ::com::sun::star::beans::Property >& rProperties,
ContentProvider* pProvider,
const ::rtl::OUString& rContentId );
@@ -331,6 +328,9 @@ public:
::com::sun::star::uno::Reference<
::com::sun::star::container::XEnumeration >
getIterator();
+
+ static ::rtl::OUString
+ getContentType( const ::rtl::OUString& aScheme, sal_Bool bFolder );
};
}
diff --git a/ucb/source/ucp/package/pkgcontentcaps.cxx b/ucb/source/ucp/package/pkgcontentcaps.cxx
index 6e6e4a9123..b2ae1951fb 100644
--- a/ucb/source/ucp/package/pkgcontentcaps.cxx
+++ b/ucb/source/ucp/package/pkgcontentcaps.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -45,6 +45,7 @@
MediaType (w) (w) w
Title r w w
Size - - r
+ CreatableContentsInfo r r r
Compressed - - w
Encrypted - - w
HasEncryptedEntries r - -
@@ -58,6 +59,7 @@
open x x x
transfer x x -
flush x x -
+ createNewContent x x -
*************************************************************************/
#include <com/sun/star/beans/Property.hpp>
@@ -78,6 +80,12 @@ using namespace package_ucp;
//
//=========================================================================
+#define MAKEPROPSEQUENCE( a ) \
+ uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
+
+#define MAKECMDSEQUENCE( a ) \
+ uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
+
//=========================================================================
//
// IMPORTENT: If any property data ( name / type / ... ) are changed, then
@@ -145,6 +153,15 @@ uno::Sequence< beans::Property > Content::getProperties(
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
beans::PropertyAttribute::BOUND
),
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
+ ),
///////////////////////////////////////////////////////////////
// New properties
///////////////////////////////////////////////////////////////
@@ -157,8 +174,7 @@ uno::Sequence< beans::Property > Content::getProperties(
| beans::PropertyAttribute::READONLY
)
};
- return uno::Sequence< beans::Property >(
- aRootFolderPropertyInfoTable, 6 );
+ return MAKEPROPSEQUENCE( aRootFolderPropertyInfoTable );
}
else
{
@@ -210,13 +226,21 @@ uno::Sequence< beans::Property > Content::getProperties(
-1,
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
beans::PropertyAttribute::BOUND
+ ),
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
)
///////////////////////////////////////////////////////////////
// New properties
///////////////////////////////////////////////////////////////
};
- return uno::Sequence< beans::Property >(
- aFolderPropertyInfoTable, 5 );
+ return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
}
}
else
@@ -275,6 +299,15 @@ uno::Sequence< beans::Property > Content::getProperties(
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
),
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
+ ),
///////////////////////////////////////////////////////////////
// New properties
///////////////////////////////////////////////////////////////
@@ -291,7 +324,7 @@ uno::Sequence< beans::Property > Content::getProperties(
beans::PropertyAttribute::BOUND
)
};
- return uno::Sequence< beans::Property >( aStreamPropertyInfoTable, 8 );
+ return MAKEPROPSEQUENCE( aStreamPropertyInfoTable );
}
}
@@ -360,6 +393,12 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
getCppuType(
static_cast< ucb::TransferInfo * >( 0 ) )
),
+ ucb::CommandInfo(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
+ -1,
+ getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
+ ),
///////////////////////////////////////////////////////////
// New commands
///////////////////////////////////////////////////////////
@@ -370,8 +409,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
)
};
- return uno::Sequence<
- ucb::CommandInfo >( aRootFolderCommandInfoTable, 7 );
+ return MAKECMDSEQUENCE( aRootFolderCommandInfoTable );
}
else
{
@@ -439,6 +477,12 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
getCppuType(
static_cast< ucb::TransferInfo * >( 0 ) )
),
+ ucb::CommandInfo(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
+ -1,
+ getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
+ ),
///////////////////////////////////////////////////////////
// New commands
///////////////////////////////////////////////////////////
@@ -449,8 +493,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
)
};
- return uno::Sequence<
- ucb::CommandInfo >( aFolderCommandInfoTable, 9 );
+ return MAKECMDSEQUENCE( aFolderCommandInfoTable );
}
}
else
@@ -517,8 +560,6 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
///////////////////////////////////////////////////////////////
};
- return uno::Sequence< ucb::CommandInfo >(
- aStreamCommandInfoTable, 7 );
+ return MAKECMDSEQUENCE( aStreamCommandInfoTable );
}
}
-
diff --git a/ucb/source/ucp/tdoc/tdoc_content.cxx b/ucb/source/ucp/tdoc/tdoc_content.cxx
index 308dd0a934..52d5e917bd 100644
--- a/ucb/source/ucp/tdoc/tdoc_content.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_content.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -226,7 +226,7 @@ uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType )
rType, static_cast< ucb::XContentCreator * >( this ) );
if ( aRet.hasValue() )
{
- if ( !isContentCreator() )
+ if ( !m_aProps.isContentCreator() )
return uno::Any();
}
}
@@ -249,7 +249,7 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
{
cppu::OTypeCollection * pCollection = 0;
- if ( isContentCreator() )
+ if ( m_aProps.isContentCreator() )
{
static cppu::OTypeCollection* pFolderTypes = 0;
@@ -660,6 +660,49 @@ uno::Any SAL_CALL Content::execute(
transfer( aInfo, Environment );
}
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // createNewContent ( Supported by document and folders only )
+ //////////////////////////////////////////////////////////////////
+
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+
+ ContentType eType = m_aProps.getType();
+ if ( ( eType != FOLDER ) && ( eType != DOCUMENT ) )
+ {
+ ucbhelper::cancelCommandExecution(
+ uno::makeAny( ucb::UnsupportedCommandException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "createNewContent command only "
+ "supported by folders and "
+ "documents!" ) ),
+ static_cast< cppu::OWeakObject * >(
+ this ) ) ),
+ Environment );
+ // Unreachable
+ }
+ }
+
+ ucb::ContentInfo aInfo;
+ if ( !( aCommand.Argument >>= aInfo ) )
+ {
+ OSL_ENSURE( sal_False, "Wrong argument type!" );
+ ucbhelper::cancelCommandExecution(
+ uno::makeAny( lang::IllegalArgumentException(
+ rtl::OUString::createFromAscii(
+ "Wrong argument type!" ),
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ // Unreachable
+ }
+
+ aRet <<= createNewContent( aInfo );
+ }
else
{
//////////////////////////////////////////////////////////////////
@@ -695,65 +738,7 @@ uno::Sequence< ucb::ContentInfo > SAL_CALL
Content::queryCreatableContentsInfo()
throw( uno::RuntimeException )
{
- if ( isContentCreator() )
- {
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
-
- uno::Sequence< beans::Property > aProps( 1 );
- aProps.getArray()[ 0 ] = beans::Property(
- rtl::OUString::createFromAscii( "Title" ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- beans::PropertyAttribute::BOUND );
-
-#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT
- if ( m_aProps.getType() == DOCUMENT )
- {
- // streams cannot be created as direct children of document root
- uno::Sequence< ucb::ContentInfo > aSeq( 1 );
-
- // Folder.
- aSeq.getArray()[ 0 ].Type
- = rtl::OUString::createFromAscii( TDOC_FOLDER_CONTENT_TYPE );
- aSeq.getArray()[ 0 ].Attributes
- = ucb::ContentInfoAttribute::KIND_FOLDER;
- aSeq.getArray()[ 0 ].Properties = aProps;
-
- return aSeq;
- }
- else
- {
-#endif
- uno::Sequence< ucb::ContentInfo > aSeq( 2 );
-
- // Folder.
- aSeq.getArray()[ 0 ].Type
- = rtl::OUString::createFromAscii( TDOC_FOLDER_CONTENT_TYPE );
- aSeq.getArray()[ 0 ].Attributes
- = ucb::ContentInfoAttribute::KIND_FOLDER;
- aSeq.getArray()[ 0 ].Properties = aProps;
-
- // Stream.
- aSeq.getArray()[ 1 ].Type
- = rtl::OUString::createFromAscii( TDOC_STREAM_CONTENT_TYPE );
- aSeq.getArray()[ 1 ].Attributes
- = ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
- | ucb::ContentInfoAttribute::KIND_DOCUMENT;
- aSeq.getArray()[ 1 ].Properties = aProps;
-
- return aSeq;
-#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT
- }
-#endif
- }
- else
- {
- OSL_ENSURE( sal_False,
- "queryCreatableContentsInfo called on non-contentcreator "
- "object!" );
-
- return uno::Sequence< ucb::ContentInfo >( 0 );
- }
+ return m_aProps.getCreatableContentsInfo();
}
//=========================================================================
@@ -762,7 +747,7 @@ uno::Reference< ucb::XContent > SAL_CALL
Content::createNewContent( const ucb::ContentInfo& Info )
throw( uno::RuntimeException )
{
- if ( isContentCreator() )
+ if ( m_aProps.isContentCreator() )
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -963,7 +948,7 @@ sal_Bool Content::exchangeIdentity(
aOldURL.getLength(),
xNewId->getContentIdentifier() );
uno::Reference< ucb::XContentIdentifier > xNewChildId
- = new ::ucbhelper::ContentIdentifier(
+ = new ::ucbhelper::ContentIdentifier(
m_xSMgr, aNewChildURL );
if ( !xChild->exchangeIdentity( xNewChildId ) )
@@ -1061,6 +1046,12 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
xRow->appendBoolean( rProp, rData.getIsFolder() );
}
else if ( rProp.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
+ {
+ xRow->appendObject(
+ rProp, uno::makeAny( rData.getCreatableContentsInfo() ) );
+ }
+ else if ( rProp.Name.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM( "Storage" ) ) )
{
// Storage is only supported by folders.
@@ -1155,6 +1146,15 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY ),
rData.getIsFolder() );
+ xRow->appendObject(
+ beans::Property(
+ rtl::OUString::createFromAscii( "CreatableContentsInfo" ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY ),
+ uno::makeAny( rData.getCreatableContentsInfo() ) );
// Storage is only supported by folders.
if ( eType == FOLDER )
@@ -1218,11 +1218,11 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
beans::PropertyChangeEvent aEvent;
aEvent.Source = static_cast< cppu::OWeakObject * >( this );
- aEvent.Further = sal_False;
-// aEvent.PropertyName =
+ aEvent.Further = sal_False;
+ // aEvent.PropertyName =
aEvent.PropertyHandle = -1;
-// aEvent.OldValue =
-// aEvent.NewValue =
+ // aEvent.OldValue =
+ // aEvent.NewValue =
const beans::PropertyValue* pValues = rValues.getConstArray();
sal_Int32 nCount = rValues.getLength();
@@ -1266,6 +1266,15 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
static_cast< cppu::OWeakObject * >( this ) );
}
else if ( rValue.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
+ {
+ // Read-only property!
+ aRet[ n ] <<= lang::IllegalAccessException(
+ rtl::OUString::createFromAscii(
+ "Property is read-only!" ),
+ static_cast< cppu::OWeakObject * >( this ) );
+ }
+ else if ( rValue.Name.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
{
// Title is read-only for root and documents.
@@ -1382,7 +1391,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
rValue.Name, rValue.Value );
aEvent.PropertyName = rValue.Name;
- aEvent.OldValue = aOldValue;
+ aEvent.OldValue = aOldValue;
aEvent.NewValue = rValue.Value;
aChanges.getArray()[ nChanged ] = aEvent;
@@ -1943,7 +1952,7 @@ Content::queryChildContent( const rtl::OUString & rRelativeChildUri )
aBuf.append( rRelativeChildUri.copy( 1 ) );
uno::Reference< ucb::XContentIdentifier > xChildId
- = new ::ucbhelper::ContentIdentifier(
+ = new ::ucbhelper::ContentIdentifier(
m_xSMgr, aBuf.makeStringAndClear() );
uno::Reference< ucb::XContent > xChild;
@@ -2370,14 +2379,6 @@ void Content::transfer(
}
//=========================================================================
-bool Content::isContentCreator()
-{
- osl::Guard< osl::Mutex > aGuard( m_aMutex );
- return
- ( m_aProps.getType() == FOLDER ) || ( m_aProps.getType() == DOCUMENT );
-}
-
-//=========================================================================
//static
bool Content::hasData( ContentProvider* pProvider, const Uri & rUri )
{
@@ -3059,3 +3060,79 @@ uno::Reference< io::XStream > Content::getStream(
}
}
}
+
+//=========================================================================
+//=========================================================================
+//
+// ContentProperties Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+uno::Sequence< ucb::ContentInfo >
+ContentProperties::getCreatableContentsInfo() const
+{
+ if ( isContentCreator() )
+ {
+ uno::Sequence< beans::Property > aProps( 1 );
+ aProps.getArray()[ 0 ] = beans::Property(
+ rtl::OUString::createFromAscii( "Title" ),
+ -1,
+ getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
+ beans::PropertyAttribute::BOUND );
+
+#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT
+ if ( getType() == DOCUMENT )
+ {
+ // streams cannot be created as direct children of document root
+ uno::Sequence< ucb::ContentInfo > aSeq( 1 );
+
+ // Folder.
+ aSeq.getArray()[ 0 ].Type
+ = rtl::OUString::createFromAscii( TDOC_FOLDER_CONTENT_TYPE );
+ aSeq.getArray()[ 0 ].Attributes
+ = ucb::ContentInfoAttribute::KIND_FOLDER;
+ aSeq.getArray()[ 0 ].Properties = aProps;
+
+ return aSeq;
+ }
+ else
+ {
+#endif
+ uno::Sequence< ucb::ContentInfo > aSeq( 2 );
+
+ // Folder.
+ aSeq.getArray()[ 0 ].Type
+ = rtl::OUString::createFromAscii( TDOC_FOLDER_CONTENT_TYPE );
+ aSeq.getArray()[ 0 ].Attributes
+ = ucb::ContentInfoAttribute::KIND_FOLDER;
+ aSeq.getArray()[ 0 ].Properties = aProps;
+
+ // Stream.
+ aSeq.getArray()[ 1 ].Type
+ = rtl::OUString::createFromAscii( TDOC_STREAM_CONTENT_TYPE );
+ aSeq.getArray()[ 1 ].Attributes
+ = ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
+ | ucb::ContentInfoAttribute::KIND_DOCUMENT;
+ aSeq.getArray()[ 1 ].Properties = aProps;
+
+ return aSeq;
+#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT
+ }
+#endif
+ }
+ else
+ {
+ OSL_ENSURE( sal_False,
+ "getCreatableContentsInfo called on non-contentcreator "
+ "object!" );
+
+ return uno::Sequence< ucb::ContentInfo >( 0 );
+ }
+}
+
+//=========================================================================
+bool ContentProperties::isContentCreator() const
+{
+ return ( getType() == FOLDER ) || ( getType() == DOCUMENT );
+}
diff --git a/ucb/source/ucp/tdoc/tdoc_content.hxx b/ucb/source/ucp/tdoc/tdoc_content.hxx
index 1e6f03544b..5f81792cd9 100644
--- a/ucb/source/ucp/tdoc/tdoc_content.hxx
+++ b/ucb/source/ucp/tdoc/tdoc_content.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -43,7 +43,8 @@ namespace com { namespace sun { namespace star {
namespace sdbc { class XRow; }
namespace io { class XInputStream; class XOutputStream; }
namespace beans { struct PropertyValue; }
- namespace ucb { struct OpenCommandArgument2; struct TransferInfo; }
+ namespace ucb { struct OpenCommandArgument2; struct TransferInfo;
+ struct ContentInfo; }
} } }
namespace tdoc_ucp
@@ -94,6 +95,11 @@ public:
const rtl::OUString & getTitle() const { return m_aTitle; }
void setTitle( const rtl::OUString & rTitle ) { m_aTitle = rTitle; }
+ com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo >
+ getCreatableContentsInfo() const;
+
+ bool isContentCreator() const;
+
private:
ContentType m_eType;
rtl::OUString m_aContentType;
@@ -106,7 +112,7 @@ class Content : public ::ucbhelper::ContentImplHelper,
public com::sun::star::ucb::XContentCreator
{
enum ContentState { TRANSIENT, // created via createNewContent,
- // but did not process "insert" yet
+ // but did not process "insert" yet
PERSISTENT, // processed "insert"
DEAD // processed "delete" / document was closed
};
@@ -137,8 +143,6 @@ private:
com::sun::star::ucb::XCommandEnvironment > & xEnv );
virtual ::rtl::OUString getParentURL();
- bool isContentCreator();
-
static bool hasData( ContentProvider* pProvider, const Uri & rUri );
bool hasData( const Uri & rUri ) { return hasData( m_pProvider, rUri ); }
@@ -173,7 +177,7 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
getPropertyValues( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::beans::Property >& rProperties );
+ ::com::sun::star::beans::Property >& rProperties );
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
setPropertyValues(
const ::com::sun::star::uno::Sequence<
@@ -294,7 +298,7 @@ public:
execute( const com::sun::star::ucb::Command& aCommand,
sal_Int32 CommandId,
const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& Environment )
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
throw( com::sun::star::uno::Exception,
com::sun::star::ucb::CommandAbortedException,
com::sun::star::uno::RuntimeException );
diff --git a/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx b/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx
index b9a1410b55..9d026ce742 100644
--- a/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -46,6 +46,7 @@
IsDocument r r r r r r
IsFolder r r r r r r
Title r r w w w w
+ CreatableContentsInfo r r r r r r
Storage - - r r - -
DocumentModel - r - - - -
@@ -57,6 +58,7 @@
delete - - x - x -
open x x x - x -
transfer - x x - - -
+ createNewContent - x x - - -
#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT
(*) not supported by streams that are direct children of document
@@ -88,6 +90,12 @@ using namespace tdoc_ucp;
//
//=========================================================================
+#define MAKEPROPSEQUENCE( a ) \
+ uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
+
+#define MAKECMDSEQUENCE( a ) \
+ uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) )
+
//=========================================================================
//
// IMPORTENT: If any property data ( name / type / ... ) are changed, then
@@ -142,15 +150,24 @@ uno::Sequence< beans::Property > Content::getProperties(
-1,
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
beans::PropertyAttribute::BOUND
- )
+ ),
///////////////////////////////////////////////////////////
// Optional standard properties
///////////////////////////////////////////////////////////
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
+ )
///////////////////////////////////////////////////////////
// New properties
///////////////////////////////////////////////////////////
};
- return uno::Sequence< beans::Property >( aStreamPropertyInfoTable, 4 );
+ return MAKEPROPSEQUENCE( aStreamPropertyInfoTable );
}
else if ( m_aProps.getType() == FOLDER )
{
@@ -197,6 +214,15 @@ uno::Sequence< beans::Property > Content::getProperties(
///////////////////////////////////////////////////////////
// Optional standard properties
///////////////////////////////////////////////////////////
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
+ ),
///////////////////////////////////////////////////////////
// New properties
///////////////////////////////////////////////////////////
@@ -209,7 +235,7 @@ uno::Sequence< beans::Property > Content::getProperties(
| beans::PropertyAttribute::READONLY
)
};
- return uno::Sequence< beans::Property >( aFolderPropertyInfoTable, 5 );
+ return MAKEPROPSEQUENCE( aFolderPropertyInfoTable );
}
else if ( m_aProps.getType() == DOCUMENT )
{
@@ -257,6 +283,15 @@ uno::Sequence< beans::Property > Content::getProperties(
///////////////////////////////////////////////////////////
// Optional standard properties
///////////////////////////////////////////////////////////
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
+ ),
///////////////////////////////////////////////////////////
// New properties
///////////////////////////////////////////////////////////
@@ -269,7 +304,7 @@ uno::Sequence< beans::Property > Content::getProperties(
| beans::PropertyAttribute::READONLY
)
};
- return uno::Sequence< beans::Property >( aDocPropertyInfoTable, 5 );
+ return MAKEPROPSEQUENCE( aDocPropertyInfoTable );
}
else
{
@@ -313,15 +348,24 @@ uno::Sequence< beans::Property > Content::getProperties(
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY
- )
+ ),
///////////////////////////////////////////////////////////////
// Optional standard properties
///////////////////////////////////////////////////////////////
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
+ )
///////////////////////////////////////////////////////////////
// New properties
///////////////////////////////////////////////////////////////
};
- return uno::Sequence< beans::Property >( aRootPropertyInfoTable, 4 );
+ return MAKEPROPSEQUENCE( aRootPropertyInfoTable );
}
}
@@ -396,8 +440,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
// New commands
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- ucb::CommandInfo >( aStreamCommandInfoTable1, 6 );
+ return MAKECMDSEQUENCE( aStreamCommandInfoTable1 );
}
#endif
//=================================================================
@@ -461,8 +504,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
// New commands
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- ucb::CommandInfo >( aStreamCommandInfoTable, 7 );
+ return MAKECMDSEQUENCE( aStreamCommandInfoTable );
}
else if ( m_aProps.getType() == FOLDER )
{
@@ -527,13 +569,18 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
-1,
getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
+ ),
+ ucb::CommandInfo(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
+ -1,
+ getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
)
///////////////////////////////////////////////////////////
// New commands
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- ucb::CommandInfo >( aFolderCommandInfoTable, 8 );
+ return MAKECMDSEQUENCE( aFolderCommandInfoTable );
}
else if ( m_aProps.getType() == DOCUMENT )
{
@@ -588,13 +635,18 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
-1,
getCppuType( static_cast< ucb::TransferInfo * >( 0 ) )
+ ),
+ ucb::CommandInfo(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ),
+ -1,
+ getCppuType( static_cast< ucb::ContentInfo * >( 0 ) )
)
///////////////////////////////////////////////////////////
// New commands
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- ucb::CommandInfo >( aDocCommandInfoTable, 6 );
+ return MAKECMDSEQUENCE( aDocCommandInfoTable );
}
else
{
@@ -651,7 +703,6 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands(
// New commands
///////////////////////////////////////////////////////////
};
- return uno::Sequence<
- ucb::CommandInfo >( aRootCommandInfoTable, 5 );
+ return MAKECMDSEQUENCE( aRootCommandInfoTable );
}
}
diff --git a/ucb/source/ucp/webdav/DAVException.hxx b/ucb/source/ucp/webdav/DAVException.hxx
index 4e281543c8..cbbd647559 100644
--- a/ucb/source/ucp/webdav/DAVException.hxx
+++ b/ucb/source/ucp/webdav/DAVException.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -108,20 +108,40 @@ class DAVException
{
public:
enum ExceptionCode {
- DAV_HTTP_ERROR = 0, // Generic error, mData = error message
- DAV_HTTP_LOOKUP, // Name lookup failed, mData = server[:port]
- DAV_HTTP_AUTH, // User authentication failed on server
- DAV_HTTP_AUTHPROXY, // User authentication failed on proxy
- DAV_HTTP_CONNECT, // Could not connect to server, mData = server[:port]
+ DAV_HTTP_ERROR = 0, // Generic error,
+ // mData = server error message,
+ // mStatusCode = HTTP status code
+ DAV_HTTP_LOOKUP, // Name lookup failed,
+ // mData = server[:port]
+ DAV_HTTP_AUTH, // User authentication failed on server,
+ // mData = server[:port]
+ DAV_HTTP_AUTHPROXY, // User authentication failed on proxy,
+ // mData = proxy server[:port]
+ DAV_HTTP_CONNECT, // Could not connect to server,
+ // mData = server[:port]
DAV_HTTP_TIMEOUT, // Connection timed out
+ // mData = server[:port]
DAV_HTTP_FAILED, // The precondition failed
+ // mData = server[:port]
DAV_HTTP_RETRY, // Retry request
- DAV_HTTP_REDIRECT, // See http_redirect.h, mData = new URL
- DAV_SESSION_CREATE, // session creation error, mData = server[:port]
- DAV_INVALID_ARG }; // mData = file URL
+ // mData = server[:port]
+ DAV_HTTP_REDIRECT, // Request was redirected,
+ // mData = new URL
+ DAV_SESSION_CREATE, // session creation error,
+ // mData = server[:port]
+ DAV_INVALID_ARG, // invalid argument
+
+ DAV_LOCK_EXPIRED, // DAV lock expired
+
+ DAV_NOT_LOCKED, // not locked
+
+ DAV_LOCKED_SELF, // locked by this OOo session
+
+ DAV_LOCKED // locked by third party
+ };
private:
- ExceptionCode mExceptionCode;
+ ExceptionCode mExceptionCode;
rtl::OUString mData;
sal_uInt16 mStatusCode;
diff --git a/ucb/source/ucp/webdav/DAVProperties.cxx b/ucb/source/ucp/webdav/DAVProperties.cxx
index e3a1edd700..d2d434184a 100644
--- a/ucb/source/ucp/webdav/DAVProperties.cxx
+++ b/ucb/source/ucp/webdav/DAVProperties.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -137,6 +137,26 @@ void DAVProperties::createUCBPropName( const char * nspace,
rtl::OUString aName
= rtl::OStringToOUString( name, RTL_TEXTENCODING_UTF8 );
+ if ( !aNameSpace.getLength() )
+ {
+ // Some servers send XML without proper namespaces. Assume "DAV:"
+ // in this case, if name is a well-known dav property name.
+ // Although this is not 100% correct, it solves many problems.
+
+ if ( DAVProperties::RESOURCETYPE.matchIgnoreAsciiCase( aName, 4 ) ||
+ DAVProperties::SUPPORTEDLOCK.matchIgnoreAsciiCase( aName, 4 ) ||
+ DAVProperties::LOCKDISCOVERY.matchIgnoreAsciiCase( aName, 4 ) ||
+ DAVProperties::CREATIONDATE.matchIgnoreAsciiCase( aName, 4 ) ||
+ DAVProperties::DISPLAYNAME.matchIgnoreAsciiCase( aName, 4 ) ||
+ DAVProperties::GETCONTENTLANGUAGE.matchIgnoreAsciiCase( aName, 4 ) ||
+ DAVProperties::GETCONTENTLENGTH.matchIgnoreAsciiCase( aName, 4 ) ||
+ DAVProperties::GETCONTENTTYPE.matchIgnoreAsciiCase( aName, 4 ) ||
+ DAVProperties::GETETAG.matchIgnoreAsciiCase( aName, 4 ) ||
+ DAVProperties::GETLASTMODIFIED.matchIgnoreAsciiCase( aName, 4 ) ||
+ DAVProperties::SOURCE.matchIgnoreAsciiCase( aName, 4 ) )
+ aNameSpace = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DAV:" ) );
+ }
+
// Note: Concatenating strings BEFORE comparing against known namespaces
// is important. See RFC 2815 ( 23.4.2 Meaning of Qualified Names ).
rFullName = aNameSpace;
@@ -175,6 +195,8 @@ void DAVProperties::createUCBPropName( const char * nspace,
// static
bool DAVProperties::isUCBDeadProperty( const NeonPropName & rName )
{
- return ( rtl_str_compareIgnoreAsciiCase(
- rName.nspace, "http://ucb.openoffice.org/dav/props/" ) == 0 );
+ return ( rName.nspace &&
+ ( rtl_str_compareIgnoreAsciiCase(
+ rName.nspace, "http://ucb.openoffice.org/dav/props/" )
+ == 0 ) );
}
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
index f26caaedc2..00b42e24a5 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -67,6 +67,7 @@ int DAVAuthListener_Impl::authenticate(
{
uno::Reference< task::XInteractionHandler > xIH
= m_xEnv->getInteractionHandler();
+
if ( xIH.is() )
{
// #102871# - Supply username and password from previous try.
@@ -78,19 +79,15 @@ int DAVAuthListener_Impl::authenticate(
outPassWord = m_aPrevPassword;
rtl::Reference< ucbhelper::SimpleAuthenticationRequest > xRequest
- = new ucbhelper::SimpleAuthenticationRequest( m_aURL,
- inHostName,
- inRealm,
- inoutUserName,
- outPassWord,
- ::rtl::OUString(),
- bAllowPersistentStoring,
- bCanUseSystemCredentials );
+ = new ucbhelper::SimpleAuthenticationRequest(
+ m_aURL, inHostName, inRealm, inoutUserName,
+ outPassWord, ::rtl::OUString(),
+ bAllowPersistentStoring, bCanUseSystemCredentials );
xIH->handle( xRequest.get() );
rtl::Reference< ucbhelper::InteractionContinuation > xSelection
= xRequest->getSelection();
-
+
if ( xSelection.is() )
{
// Handler handled the request.
@@ -105,8 +102,9 @@ int DAVAuthListener_Impl::authenticate(
sal_Bool bUseSystemCredentials = sal_False;
if ( bCanUseSystemCredentials )
- bUseSystemCredentials = xSupp->getUseSystemCredentials();
-
+ bUseSystemCredentials
+ = xSupp->getUseSystemCredentials();
+
if ( bUseSystemCredentials )
{
// This is the (strange) way to tell neon to use
@@ -117,7 +115,7 @@ int DAVAuthListener_Impl::authenticate(
else
{
inoutUserName = xSupp->getUserName();
- outPassWord = xSupp->getPassword();
+ outPassWord = xSupp->getPassword();
}
// #102871# - Remember username and password.
@@ -178,8 +176,9 @@ DAVResourceAccess & DAVResourceAccess::operator=(
return *this;
}
+#if 0 // currently not used, but please don't remove code
//=========================================================================
-void DAVResourceAccess::OPTIONS(
+void DAVResourceAccess::OPTIONS(
DAVCapabilities & rCapabilities,
const uno::Reference< ucb::XCommandEnvironment > & xEnv )
throw( DAVException )
@@ -194,10 +193,10 @@ void DAVResourceAccess::OPTIONS(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii(
- "OPTIONS" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii(
+ "OPTIONS" ),
aHeaders );
m_xSession->OPTIONS( getRequestURI(),
@@ -217,9 +216,10 @@ void DAVResourceAccess::OPTIONS(
}
while ( bRetry );
}
+#endif
//=========================================================================
-void DAVResourceAccess::PROPFIND(
+void DAVResourceAccess::PROPFIND(
const Depth nDepth,
const std::vector< rtl::OUString > & rPropertyNames,
std::vector< DAVResource > & rResources,
@@ -237,10 +237,10 @@ void DAVResourceAccess::PROPFIND(
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii(
- "PROPFIND" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii(
+ "PROPFIND" ),
aHeaders );
m_xSession->PROPFIND( getRequestURI(),
@@ -264,7 +264,7 @@ void DAVResourceAccess::PROPFIND(
}
//=========================================================================
-void DAVResourceAccess::PROPFIND(
+void DAVResourceAccess::PROPFIND(
const Depth nDepth,
std::vector< DAVResourceInfo > & rResInfo,
const uno::Reference< ucb::XCommandEnvironment > & xEnv )
@@ -280,12 +280,12 @@ void DAVResourceAccess::PROPFIND(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii(
- "PROPFIND" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii(
+ "PROPFIND" ),
aHeaders );
-
+
m_xSession->PROPFIND( getRequestURI(),
nDepth,
rResInfo,
@@ -306,7 +306,7 @@ void DAVResourceAccess::PROPFIND(
}
//=========================================================================
-void DAVResourceAccess::PROPPATCH(
+void DAVResourceAccess::PROPPATCH(
const std::vector< ProppatchValue >& rValues,
const uno::Reference< ucb::XCommandEnvironment >& xEnv )
throw( DAVException )
@@ -321,12 +321,12 @@ void DAVResourceAccess::PROPPATCH(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii(
- "PROPPATCH" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii(
+ "PROPPATCH" ),
aHeaders );
-
+
m_xSession->PROPPATCH( getRequestURI(),
rValues,
DAVRequestEnvironment(
@@ -346,13 +346,14 @@ void DAVResourceAccess::PROPPATCH(
}
//=========================================================================
-void DAVResourceAccess::HEAD(
+void DAVResourceAccess::HEAD(
const std::vector< rtl::OUString > & rHeaderNames,
DAVResource & rResource,
const uno::Reference< ucb::XCommandEnvironment >& xEnv )
throw( DAVException )
{
initialize();
+
int errorCount = 0;
bool bRetry;
do
@@ -361,11 +362,11 @@ void DAVResourceAccess::HEAD(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii( "HEAD" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "HEAD" ),
aHeaders );
-
+
m_xSession->HEAD( getRequestURI(),
rHeaderNames,
rResource,
@@ -401,15 +402,16 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii( "GET" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "GET" ),
aHeaders );
-
+
xStream = m_xSession->GET( getRequestURI(),
DAVRequestEnvironment(
getRequestURI(),
- new DAVAuthListener_Impl( xEnv, m_aURL ),
+ new DAVAuthListener_Impl(
+ xEnv, m_aURL ),
aHeaders, xEnv ) );
}
catch ( DAVException & e )
@@ -421,12 +423,12 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
}
}
while ( bRetry );
-
+
return xStream;
}
//=========================================================================
-void DAVResourceAccess::GET(
+void DAVResourceAccess::GET(
uno::Reference< io::XOutputStream > & rStream,
const uno::Reference< ucb::XCommandEnvironment > & xEnv )
throw( DAVException )
@@ -441,11 +443,11 @@ void DAVResourceAccess::GET(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii( "GET" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "GET" ),
aHeaders );
-
+
m_xSession->GET( getRequestURI(),
rStream,
DAVRequestEnvironment(
@@ -482,17 +484,18 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii( "GET" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "GET" ),
aHeaders );
-
+
xStream = m_xSession->GET( getRequestURI(),
rHeaderNames,
rResource,
DAVRequestEnvironment(
getRequestURI(),
- new DAVAuthListener_Impl( xEnv, m_aURL ),
+ new DAVAuthListener_Impl(
+ xEnv, m_aURL ),
aHeaders, xEnv ) );
}
catch ( DAVException & e )
@@ -526,11 +529,11 @@ void DAVResourceAccess::GET(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii( "GET" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "GET" ),
aHeaders );
-
+
m_xSession->GET( getRequestURI(),
rStream,
rHeaderNames,
@@ -552,13 +555,15 @@ void DAVResourceAccess::GET(
}
//=========================================================================
-void DAVResourceAccess::ABORT()
+void DAVResourceAccess::abort()
throw( DAVException )
{
- // 17.11.09 (tkr): abort currently disabled caused by issue i106766
- // initialize();
- // m_xSession->ABORT();
+ // 17.11.09 (tkr): abort currently disabled caused by issue i106766
+ // initialize();
+ // m_xSession->abort();
+ OSL_TRACE( "Not implemented. -> #i106766#" );
}
+
//=========================================================================
namespace {
@@ -567,9 +572,9 @@ namespace {
{
try
{
- uno::Reference< io::XSeekable > xSeekable(
+ uno::Reference< io::XSeekable > xSeekable(
rStream, uno::UNO_QUERY );
- if ( xSeekable.is() )
+ if ( xSeekable.is() )
{
xSeekable->seek( 0 );
return;
@@ -588,7 +593,7 @@ namespace {
} // namespace
//=========================================================================
-void DAVResourceAccess::PUT(
+void DAVResourceAccess::PUT(
const uno::Reference< io::XInputStream > & rStream,
const uno::Reference< ucb::XCommandEnvironment > & xEnv )
throw( DAVException )
@@ -597,7 +602,7 @@ void DAVResourceAccess::PUT(
// Make stream seekable, if it not. Needed, if request must be retried.
uno::Reference< io::XInputStream > xSeekableStream
- = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
+ = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
rStream, m_xSMgr );
int errorCount = 0;
@@ -611,11 +616,11 @@ void DAVResourceAccess::PUT(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii( "PUT" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "PUT" ),
aHeaders );
-
+
m_xSession->PUT( getRequestURI(),
xSeekableStream,
DAVRequestEnvironment(
@@ -646,7 +651,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST(
// Make stream seekable, if it not. Needed, if request must be retried.
uno::Reference< io::XInputStream > xSeekableStream
- = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
+ = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
rInputStream, m_xSMgr );
uno::Reference< io::XInputStream > xStream;
@@ -663,18 +668,19 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii( "POST" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "POST" ),
aHeaders );
-
+
xStream = m_xSession->POST( getRequestURI(),
rContentType,
rReferer,
xSeekableStream,
DAVRequestEnvironment(
getRequestURI(),
- new DAVAuthListener_Impl( xEnv, m_aURL ),
+ new DAVAuthListener_Impl(
+ xEnv, m_aURL ),
aHeaders, xEnv ) );
}
catch ( DAVException & e )
@@ -692,12 +698,11 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST(
}
}
while ( bRetry );
-
+
return xStream;
}
//=========================================================================
-
void DAVResourceAccess::POST(
const rtl::OUString & rContentType,
const rtl::OUString & rReferer,
@@ -710,7 +715,7 @@ void DAVResourceAccess::POST(
// Make stream seekable, if it not. Needed, if request must be retried.
uno::Reference< io::XInputStream > xSeekableStream
- = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
+ = comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
rInputStream, m_xSMgr );
int errorCount = 0;
@@ -726,11 +731,11 @@ void DAVResourceAccess::POST(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii( "POST" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "POST" ),
aHeaders );
-
+
m_xSession->POST( getRequestURI(),
rContentType,
rReferer,
@@ -760,11 +765,12 @@ void DAVResourceAccess::POST(
}
//=========================================================================
-void DAVResourceAccess::MKCOL(
+void DAVResourceAccess::MKCOL(
const uno::Reference< ucb::XCommandEnvironment > & xEnv )
throw( DAVException )
{
initialize();
+
int errorCount = 0;
bool bRetry;
do
@@ -773,11 +779,11 @@ void DAVResourceAccess::MKCOL(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii( "MKCOL" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "MKCOL" ),
aHeaders );
-
+
m_xSession->MKCOL( getRequestURI(),
DAVRequestEnvironment(
getRequestURI(),
@@ -796,7 +802,7 @@ void DAVResourceAccess::MKCOL(
}
//=========================================================================
-void DAVResourceAccess::COPY(
+void DAVResourceAccess::COPY(
const ::rtl::OUString & rSourcePath,
const ::rtl::OUString & rDestinationURI,
sal_Bool bOverwrite,
@@ -804,6 +810,7 @@ void DAVResourceAccess::COPY(
throw( DAVException )
{
initialize();
+
int errorCount = 0;
bool bRetry;
do
@@ -812,11 +819,11 @@ void DAVResourceAccess::COPY(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii( "COPY" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "COPY" ),
aHeaders );
-
+
m_xSession->COPY( rSourcePath,
rDestinationURI,
DAVRequestEnvironment(
@@ -837,7 +844,7 @@ void DAVResourceAccess::COPY(
}
//=========================================================================
-void DAVResourceAccess::MOVE(
+void DAVResourceAccess::MOVE(
const ::rtl::OUString & rSourcePath,
const ::rtl::OUString & rDestinationURI,
sal_Bool bOverwrite,
@@ -845,6 +852,7 @@ void DAVResourceAccess::MOVE(
throw( DAVException )
{
initialize();
+
int errorCount = 0;
bool bRetry;
do
@@ -853,9 +861,9 @@ void DAVResourceAccess::MOVE(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii( "MOVE" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "MOVE" ),
aHeaders );
m_xSession->MOVE( rSourcePath,
@@ -878,7 +886,7 @@ void DAVResourceAccess::MOVE(
}
//=========================================================================
-void DAVResourceAccess::DESTROY(
+void DAVResourceAccess::DESTROY(
const uno::Reference< ucb::XCommandEnvironment > & xEnv )
throw( DAVException )
{
@@ -892,12 +900,12 @@ void DAVResourceAccess::DESTROY(
try
{
DAVRequestHeaders aHeaders;
- getUserRequestHeaders( xEnv,
- getRequestURI(),
- rtl::OUString::createFromAscii(
- "DESTROY" ),
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii(
+ "DESTROY" ),
aHeaders );
-
+
m_xSession->DESTROY( getRequestURI(),
DAVRequestEnvironment(
getRequestURI(),
@@ -916,23 +924,124 @@ void DAVResourceAccess::DESTROY(
}
//=========================================================================
-void DAVResourceAccess::LOCK (
- const ucb::Lock & /*rLock*/,
- const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
- throw( DAVException )
+// set new lock.
+void DAVResourceAccess::LOCK(
+ ucb::Lock & inLock,
+ const uno::Reference< ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException )
+{
+ initialize();
+
+ int errorCount = 0;
+ bool bRetry;
+ do
+ {
+ bRetry = false;
+ try
+ {
+ DAVRequestHeaders aHeaders;
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "LOCK" ),
+ aHeaders );
+
+ m_xSession->LOCK( getRequestURI(),
+ inLock,
+ DAVRequestEnvironment(
+ getRequestURI(),
+ new DAVAuthListener_Impl( xEnv, m_aURL ),
+ aHeaders, xEnv ) );
+ }
+ catch ( DAVException & e )
+ {
+ errorCount++;
+ bRetry = handleException( e, errorCount );
+ if ( !bRetry )
+ throw;
+ }
+ }
+ while ( bRetry );
+}
+
+//=========================================================================
+// refresh existing lock.
+sal_Int64 DAVResourceAccess::LOCK(
+ sal_Int64 nTimeout,
+ const uno::Reference< ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException )
{
-// initialize();
- OSL_ENSURE( sal_False, "DAVResourceAccess::LOCK - NYI" );
+ initialize();
+
+ sal_Int64 nNewTimeout = 0;
+ int errorCount = 0;
+ bool bRetry;
+ do
+ {
+ bRetry = false;
+ try
+ {
+ DAVRequestHeaders aHeaders;
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "LOCK" ),
+ aHeaders );
+
+ nNewTimeout = m_xSession->LOCK( getRequestURI(),
+ nTimeout,
+ DAVRequestEnvironment(
+ getRequestURI(),
+ new DAVAuthListener_Impl(
+ xEnv, m_aURL ),
+ aHeaders, xEnv ) );
+ }
+ catch ( DAVException & e )
+ {
+ errorCount++;
+ bRetry = handleException( e, errorCount );
+ if ( !bRetry )
+ throw;
+ }
+ }
+ while ( bRetry );
+
+ return nNewTimeout;
}
//=========================================================================
-void DAVResourceAccess::UNLOCK (
- const ucb::Lock & /*rLock*/,
- const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
- throw( DAVException )
+void DAVResourceAccess::UNLOCK(
+ const uno::Reference< ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException )
{
-// initialize();
- OSL_ENSURE( sal_False, "DAVResourceAccess::UNLOCK - NYI" );
+ initialize();
+
+ int errorCount = 0;
+ bool bRetry;
+ do
+ {
+ bRetry = false;
+ try
+ {
+ DAVRequestHeaders aHeaders;
+ getUserRequestHeaders( xEnv,
+ getRequestURI(),
+ rtl::OUString::createFromAscii( "UNLOCK" ),
+ aHeaders );
+
+ m_xSession->UNLOCK( getRequestURI(),
+ DAVRequestEnvironment(
+ getRequestURI(),
+ new DAVAuthListener_Impl( xEnv, m_aURL ),
+ aHeaders, xEnv ) );
+ }
+ catch ( DAVException & e )
+ {
+ errorCount++;
+ bRetry = handleException( e, errorCount );
+ if ( !bRetry )
+ throw;
+ }
+ }
+ while ( bRetry );
}
//=========================================================================
@@ -1009,9 +1118,9 @@ void DAVResourceAccess::getUserRequestHeaders(
{
if ( xEnv.is() )
{
- uno::Reference< ucb::XWebDAVCommandEnvironment > xDAVEnv(
+ uno::Reference< ucb::XWebDAVCommandEnvironment > xDAVEnv(
xEnv, uno::UNO_QUERY );
-
+
if ( xDAVEnv.is() )
{
uno::Sequence< beans::NamedValue > aRequestHeaders
@@ -1021,17 +1130,16 @@ void DAVResourceAccess::getUserRequestHeaders(
{
rtl::OUString aValue;
sal_Bool isString = aRequestHeaders[ n ].Value >>= aValue;
-
+
if ( !isString )
{
OSL_ENSURE( isString,
"DAVResourceAccess::getUserRequestHeaders :"
"Value is not a string! Ignoring..." );
}
-
- rRequestHeaders.push_back( DAVRequestHeader(
- aRequestHeaders[ n ].Name,
- aValue ) );
+
+ rRequestHeaders.push_back(
+ DAVRequestHeader( aRequestHeaders[ n ].Name, aValue ) );
}
}
}
@@ -1048,12 +1156,12 @@ sal_Bool DAVResourceAccess::detectRedirectCycle(
std::vector< NeonUri >::const_iterator it = m_aRedirectURIs.begin();
std::vector< NeonUri >::const_iterator end = m_aRedirectURIs.end();
-
+
while ( it != end )
{
if ( aUri == (*it) )
return sal_True;
-
+
it++;
}
@@ -1075,7 +1183,6 @@ void DAVResourceAccess::resetUri()
}
}
-
//=========================================================================
sal_Bool DAVResourceAccess::handleException( DAVException & e, int errorCount )
throw ( DAVException )
@@ -1095,10 +1202,12 @@ sal_Bool DAVResourceAccess::handleException( DAVException & e, int errorCount )
// if we have a bad connection try again. Up to three times.
case DAVException::DAV_HTTP_ERROR:
// retry up to three times, if not a client-side error.
- if ( ( e.getStatus() < 400 || e.getStatus() > 499 ) && errorCount < 3)
+ if ( e.getStatus() > 0 &&
+ ( e.getStatus() < 400 || e.getStatus() > 499 ) &&
+ errorCount < 3 )
{
return sal_True;
- }
+ }
return sal_False;
// <--
// --> tkr: if connection has said retry then retry!
diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.hxx b/ucb/source/ucp/webdav/DAVResourceAccess.hxx
index 0d40b57bfb..b4f6eb2b5a 100644
--- a/ucb/source/ucp/webdav/DAVResourceAccess.hxx
+++ b/ucb/source/ucp/webdav/DAVResourceAccess.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -59,22 +59,22 @@ class DAVResourceAccess
rtl::Reference< DAVSession > m_xSession;
rtl::Reference< DAVSessionFactory > m_xSessionFactory;
com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
std::vector< NeonUri > m_aRedirectURIs;
public:
DAVResourceAccess() : m_xSessionFactory( 0 ) {}
DAVResourceAccess( const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > & rSMgr,
+ com::sun::star::lang::XMultiServiceFactory > & rSMgr,
rtl::Reference<
- DAVSessionFactory > const & rSessionFactory,
+ DAVSessionFactory > const & rSessionFactory,
const rtl::OUString & rURL );
DAVResourceAccess( const DAVResourceAccess & rOther );
DAVResourceAccess & operator=( const DAVResourceAccess & rOther );
void setURL( const rtl::OUString & rNewURL )
- throw( DAVException );
+ throw ( DAVException );
void resetUri();
@@ -86,146 +86,156 @@ public:
// DAV methods
//
+#if 0 // currently not used, but please don't remove code
void
OPTIONS( DAVCapabilities & rCapabilities,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
+#endif
// allprop & named
void
PROPFIND( const Depth nDepth,
- const std::vector< rtl::OUString > & rPropertyNames,
- std::vector< DAVResource > & rResources,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ const std::vector< rtl::OUString > & rPropertyNames,
+ std::vector< DAVResource > & rResources,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
// propnames
void
PROPFIND( const Depth nDepth,
- std::vector< DAVResourceInfo > & rResInfo,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ std::vector< DAVResourceInfo > & rResInfo,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
void
PROPPATCH( const std::vector< ProppatchValue > & rValues,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& xEnv )
- throw( DAVException );
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& xEnv )
+ throw ( DAVException );
void
HEAD( const std::vector< rtl::OUString > & rHeaderNames, // empty == 'all'
DAVResource & rResource,
const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& xEnv )
- throw( DAVException );
+ com::sun::star::ucb::XCommandEnvironment >& xEnv )
+ throw ( DAVException );
com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
GET( const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
void
GET( com::sun::star::uno::Reference<
- com::sun::star::io::XOutputStream > & rStream,
+ com::sun::star::io::XOutputStream > & rStream,
const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
GET( const std::vector< rtl::OUString > & rHeaderNames, // empty == 'all'
DAVResource & rResource,
const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
void
GET( com::sun::star::uno::Reference<
- com::sun::star::io::XOutputStream > & rStream,
+ com::sun::star::io::XOutputStream > & rStream,
const std::vector< rtl::OUString > & rHeaderNames, // empty == 'all'
DAVResource & rResource,
const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
void
PUT( const com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream > & rStream,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ com::sun::star::io::XInputStream > & rStream,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
POST( const rtl::OUString & rContentType,
- const rtl::OUString & rReferer,
- const com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream > & rInputStream,
- const com::sun::star::uno::Reference<
+ const rtl::OUString & rReferer,
+ const com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > & rInputStream,
+ const com::sun::star::uno::Reference<
com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw ( DAVException );
void
POST( const rtl::OUString & rContentType,
- const rtl::OUString & rReferer,
- const com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream > & rInputStream,
- com::sun::star::uno::Reference<
- com::sun::star::io::XOutputStream > & rOutputStream,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& xEnv )
+ const rtl::OUString & rReferer,
+ const com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > & rInputStream,
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XOutputStream > & rOutputStream,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw ( DAVException );
void
MKCOL( const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
void
COPY( const ::rtl::OUString & rSourcePath,
- const ::rtl::OUString & rDestinationURI,
- sal_Bool bOverwrite,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ const ::rtl::OUString & rDestinationURI,
+ sal_Bool bOverwrite,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
void
MOVE( const ::rtl::OUString & rSourcePath,
- const ::rtl::OUString & rDestinationURI,
- sal_Bool bOverwrite,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ const ::rtl::OUString & rDestinationURI,
+ sal_Bool bOverwrite,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
void
DESTROY( const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
+ // set new lock.
void
- LOCK( const com::sun::star::ucb::Lock & rLock,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ LOCK( com::sun::star::ucb::Lock & inLock,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw( DAVException );
+
+ // refresh existing lock.
+ sal_Int64
+ LOCK( sal_Int64 nTimeout,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
void
- UNLOCK( const com::sun::star::ucb::Lock & rLock,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
- throw( DAVException );
+ UNLOCK( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ throw ( DAVException );
void
- ABORT()
- throw( DAVException );
+ abort()
+ throw ( DAVException );
// helper
- static void getUserRequestHeaders(
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv,
- const rtl::OUString & rURI,
- const rtl::OUString & rMethod,
- DAVRequestHeaders & rRequestHeaders );
+ static void
+ getUserRequestHeaders(
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv,
+ const rtl::OUString & rURI,
+ const rtl::OUString & rMethod,
+ DAVRequestHeaders & rRequestHeaders );
private:
const rtl::OUString & getRequestURI() const;
diff --git a/ucb/source/ucp/webdav/DAVSession.hxx b/ucb/source/ucp/webdav/DAVSession.hxx
index 9070b086d6..00b0b75e2a 100644
--- a/ucb/source/ucp/webdav/DAVSession.hxx
+++ b/ucb/source/ucp/webdav/DAVSession.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -42,7 +42,9 @@
#include "DAVTypes.hxx"
#include "DAVRequestEnvironment.hxx"
-
+namespace com { namespace sun { namespace star { namespace ucb {
+ struct Lock;
+} } } }
namespace webdav_ucp
{
@@ -73,28 +75,28 @@ public:
// DAV methods
//
- virtual void OPTIONS( const ::rtl::OUString & inPath,
+ virtual void OPTIONS( const ::rtl::OUString & inPath,
DAVCapabilities & outCapabilities,
const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
// allprop & named
- virtual void PROPFIND( const ::rtl::OUString & inPath,
- const Depth inDepth,
+ virtual void PROPFIND( const ::rtl::OUString & inPath,
+ const Depth inDepth,
const std::vector< ::rtl::OUString > & inPropertyNames,
- std::vector< DAVResource > & ioResources,
+ std::vector< DAVResource > & ioResources,
const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
// propnames
- virtual void PROPFIND( const ::rtl::OUString & inPath,
- const Depth inDepth,
+ virtual void PROPFIND( const ::rtl::OUString & inPath,
+ const Depth inDepth,
std::vector< DAVResourceInfo > & ioResInfo,
const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
- virtual void PROPPATCH( const ::rtl::OUString & inPath,
- const std::vector< ProppatchValue > & inValues,
+ virtual void PROPPATCH( const ::rtl::OUString & inPath,
+ const std::vector< ProppatchValue > & inValues,
const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
@@ -105,87 +107,95 @@ public:
throw( DAVException ) = 0;
virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
- GET( const ::rtl::OUString & inPath,
- const DAVRequestEnvironment & rEnv )
+ GET( const ::rtl::OUString & inPath,
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
- virtual void GET( const ::rtl::OUString & inPath,
- com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& o,
- const DAVRequestEnvironment & rEnv )
+ virtual void GET( const ::rtl::OUString & inPath,
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XOutputStream >& o,
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
- GET( const ::rtl::OUString & inPath,
- const std::vector< ::rtl::OUString > & inHeaderNames,
- DAVResource & ioResource,
- const DAVRequestEnvironment & rEnv )
+ GET( const ::rtl::OUString & inPath,
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource & ioResource,
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
- virtual void GET( const ::rtl::OUString & inPath,
- com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& o,
- const std::vector< ::rtl::OUString > & inHeaderNames,
- DAVResource & ioResource,
- const DAVRequestEnvironment & rEnv )
+ virtual void
+ GET( const ::rtl::OUString & inPath,
+ com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& o,
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource & ioResource,
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
- virtual void PUT( const ::rtl::OUString & inPath,
- const com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream >& s,
- const DAVRequestEnvironment & rEnv )
- throw( DAVException ) = 0;
-
- virtual void ABORT()
+ virtual void PUT( const ::rtl::OUString & inPath,
+ const com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream >& s,
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
- POST( const rtl::OUString & inPath,
- const rtl::OUString & rContentType,
- const rtl::OUString & rReferer,
- const com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream > & inInputStream,
- const DAVRequestEnvironment & rEnv )
+ POST( const rtl::OUString & inPath,
+ const rtl::OUString & rContentType,
+ const rtl::OUString & rReferer,
+ const com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > & inInputStream,
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException ) = 0;
virtual void POST( const rtl::OUString & inPath,
const rtl::OUString & rContentType,
const rtl::OUString & rReferer,
const com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream > & inInputStream,
+ com::sun::star::io::XInputStream > & inInputStream,
com::sun::star::uno::Reference<
- com::sun::star::io::XOutputStream > & oOutputStream,
+ com::sun::star::io::XOutputStream > & oOutputStream,
const DAVRequestEnvironment & rEnv )
throw ( DAVException ) = 0;
- virtual void MKCOL( const ::rtl::OUString & inPath,
- const DAVRequestEnvironment & rEnv )
+ virtual void MKCOL( const ::rtl::OUString & inPath,
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
- virtual void COPY( const ::rtl::OUString & inSource,
- const ::rtl::OUString & inDestination,
- const DAVRequestEnvironment & rEnv,
- sal_Bool inOverwrite = false )
+ virtual void COPY( const ::rtl::OUString & inSource,
+ const ::rtl::OUString & inDestination,
+ const DAVRequestEnvironment & rEnv,
+ sal_Bool inOverwrite = false )
throw( DAVException ) = 0;
- virtual void MOVE( const ::rtl::OUString & inSource,
- const ::rtl::OUString & inDestination,
- const DAVRequestEnvironment & rEnv,
- sal_Bool inOverwrite = false )
+ virtual void MOVE( const ::rtl::OUString & inSource,
+ const ::rtl::OUString & inDestination,
+ const DAVRequestEnvironment & rEnv,
+ sal_Bool inOverwrite = false )
throw( DAVException ) = 0;
- virtual void DESTROY( const ::rtl::OUString & inPath,
- const DAVRequestEnvironment & rEnv )
+ virtual void DESTROY( const ::rtl::OUString & inPath,
+ const DAVRequestEnvironment & rEnv )
throw( DAVException ) = 0;
- // Note: Uncomment the following if locking support is required
- /*
- virtual void LOCK ( const Lock & inLock,
- const DAVRequestEnvironment & rEnv )
- throw( DAVException ) = 0;
+ // set new lock.
+ virtual void LOCK( const ::rtl::OUString & inPath,
+ com::sun::star::ucb::Lock & inLock,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException ) = 0;
- virtual void UNLOCK ( const Lock & inLock,
- const DAVRequestEnvironment & rEnv )
+ // refresh existing lock.
+ virtual sal_Int64 LOCK( const ::rtl::OUString & inPath,
+ sal_Int64 nTimeout,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException ) = 0;
+
+ virtual void UNLOCK( const ::rtl::OUString & inPath,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException ) = 0;
+
+ virtual void abort()
throw( DAVException ) = 0;
- */
+
protected:
rtl::Reference< DAVSessionFactory > m_xFactory;
@@ -210,4 +220,3 @@ private:
} // namespace webdav_ucp
#endif // _DAVSESSION_HXX_
-
diff --git a/ucb/source/ucp/webdav/LinkSequence.cxx b/ucb/source/ucp/webdav/LinkSequence.cxx
index f890122dec..fad89d3759 100644
--- a/ucb/source/ucp/webdav/LinkSequence.cxx
+++ b/ucb/source/ucp/webdav/LinkSequence.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -64,12 +64,11 @@ struct LinkSequenceParseContext
extern "C" int LinkSequence_startelement_callback(
void *,
int parent,
- const char *nspace,
+ const char * /*nspace*/,
const char *name,
const char ** )
{
- if ( ( name != 0 ) &&
- ( ( nspace == 0 ) || ( strcmp( nspace, "" ) == 0 ) ) )
+ if ( name != 0 )
{
switch ( parent )
{
@@ -192,7 +191,7 @@ bool LinkSequence::createFromXML( const rtl::OString & rInData,
rOutData[ nCount - 1 ] = *aCtx.pLink;
}
- nStart = nEnd + TOKEN_LENGTH + 1;
+ nStart = nEnd + TOKEN_LENGTH;
nEnd = rInData.indexOf( "</link>", nStart );
}
@@ -215,11 +214,11 @@ bool LinkSequence::toXML( const uno::Sequence< ucb::Link > & rInData,
for ( sal_Int32 n = 0; n < nCount; ++n )
{
- rOutData += aPre;
- rOutData += rInData[ n ].Source;
- rOutData += aMid;
- rOutData += rInData[ n ].Destination;
- rOutData += aEnd;
+ rOutData += aPre;
+ rOutData += rInData[ n ].Source;
+ rOutData += aMid;
+ rOutData += rInData[ n ].Destination;
+ rOutData += aEnd;
}
return true;
}
diff --git a/ucb/source/ucp/webdav/LockEntrySequence.cxx b/ucb/source/ucp/webdav/LockEntrySequence.cxx
index 6d997bd0a6..50600e0ad0 100644
--- a/ucb/source/ucp/webdav/LockEntrySequence.cxx
+++ b/ucb/source/ucp/webdav/LockEntrySequence.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -64,12 +64,11 @@ struct LockEntrySequenceParseContext
extern "C" int LockEntrySequence_startelement_callback(
void *,
int parent,
- const char *nspace,
+ const char * /*nspace*/,
const char *name,
const char ** )
{
- if ( ( name != 0 ) &&
- ( ( nspace == 0 ) || ( strcmp( nspace, "" ) == 0 ) ) )
+ if ( name != 0 )
{
switch ( parent )
{
@@ -83,6 +82,31 @@ extern "C" int LockEntrySequence_startelement_callback(
return STATE_LOCKSCOPE;
else if ( strcmp( name, "locktype" ) == 0 )
return STATE_LOCKTYPE;
+
+#define IIS_BUGS_WORKAROUND
+
+#ifdef IIS_BUGS_WORKAROUND
+ /* IIS (6) returns XML violating RFC 4918
+ for DAV:supportedlock property value.
+
+ <lockentry>
+ <write></write>
+ <shared></shared>
+ </lockentry>
+ <lockentry>
+ <write></write>
+ <exclusive></exclusive>
+ </lockentry>
+
+ Bother...
+ */
+ else if ( strcmp( name, "exclusive" ) == 0 )
+ return STATE_EXCLUSIVE;
+ else if ( strcmp( name, "shared" ) == 0 )
+ return STATE_SHARED;
+ else if ( strcmp( name, "write" ) == 0 )
+ return STATE_WRITE;
+#endif
break;
case STATE_LOCKSCOPE:
@@ -165,7 +189,7 @@ extern "C" int LockEntrySequence_endelement_callback(
// static
bool LockEntrySequence::createFromXML( const rtl::OString & rInData,
uno::Sequence<
- ucb::LockEntry > & rOutData )
+ ucb::LockEntry > & rOutData )
{
const sal_Int32 TOKEN_LENGTH = 12; // </lockentry>
bool success = true;
@@ -191,8 +215,8 @@ bool LockEntrySequence::createFromXML( const rtl::OString & rInData,
&aCtx );
ne_xml_parse( parser,
- rInData.getStr() + nStart,
- nEnd - nStart + TOKEN_LENGTH );
+ rInData.getStr() + nStart,
+ nEnd - nStart + TOKEN_LENGTH );
#if NEON_VERSION >= 0x0250
success = !ne_xml_failed( parser );
@@ -214,7 +238,7 @@ bool LockEntrySequence::createFromXML( const rtl::OString & rInData,
rOutData[ nCount - 1 ] = *aCtx.pEntry;
}
- nStart = nEnd + TOKEN_LENGTH + 1;
+ nStart = nEnd + TOKEN_LENGTH;
nEnd = rInData.indexOf( "</lockentry>", nStart );
}
diff --git a/ucb/source/ucp/webdav/LockSequence.cxx b/ucb/source/ucp/webdav/LockSequence.cxx
index b959ddc109..e55de62e55 100644
--- a/ucb/source/ucp/webdav/LockSequence.cxx
+++ b/ucb/source/ucp/webdav/LockSequence.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -74,12 +74,11 @@ struct LockSequenceParseContext
extern "C" int LockSequence_startelement_callback(
void *,
int parent,
- const char *nspace,
+ const char * /*nspace*/,
const char *name,
const char ** )
{
- if ( ( name != 0 ) &&
- ( ( nspace == 0 ) || ( strcmp( nspace, "" ) == 0 ) ) )
+ if ( name != 0 )
{
switch ( parent )
{
@@ -347,7 +346,7 @@ bool LockSequence::createFromXML( const rtl::OString & rInData,
rOutData[ nCount - 1 ] = *aCtx.pLock;
}
- nStart = nEnd + TOKEN_LENGTH + 1;
+ nStart = nEnd + TOKEN_LENGTH;
nEnd = rInData.indexOf( "</activelock>", nStart );
}
diff --git a/ucb/source/ucp/webdav/NeonLockStore.cxx b/ucb/source/ucp/webdav/NeonLockStore.cxx
new file mode 100644
index 0000000000..9d151bc2ba
--- /dev/null
+++ b/ucb/source/ucp/webdav/NeonLockStore.cxx
@@ -0,0 +1,248 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucb.hxx"
+
+#include <ne_locks.h>
+#include <ne_uri.h>
+#include "rtl/ustring.hxx"
+#include "osl/time.h"
+#include "osl/thread.hxx"
+#include "NeonSession.hxx"
+#include "NeonLockStore.hxx"
+
+using namespace webdav_ucp;
+
+namespace webdav_ucp {
+
+class TickerThread : public osl::Thread
+{
+ bool m_bFinish;
+ NeonLockStore & m_rLockStore;
+
+public:
+
+ TickerThread( NeonLockStore & rLockStore )
+ : osl::Thread(), m_bFinish( false ), m_rLockStore( rLockStore ) {}
+
+ void finish() { m_bFinish = true; }
+
+protected:
+
+ virtual void SAL_CALL run();
+};
+
+} // namespace webdav_ucp
+
+// -------------------------------------------------------------------
+void TickerThread::run()
+{
+ OSL_TRACE( "TickerThread: start." );
+
+ // we have to go through the loop more often to be able to finish ~quickly
+ const int nNth = 25;
+
+ int nCount = nNth;
+ while ( !m_bFinish )
+ {
+ if ( nCount-- <= 0 )
+ {
+ m_rLockStore.refreshLocks();
+ nCount = nNth;
+ }
+
+ TimeValue aTV;
+ aTV.Seconds = 0;
+ aTV.Nanosec = 1000000000 / nNth;
+ wait( aTV );
+ }
+
+ OSL_TRACE( "TickerThread: stop." );
+}
+
+// -------------------------------------------------------------------
+NeonLockStore::NeonLockStore()
+ : m_pNeonLockStore( ne_lockstore_create() ),
+ m_pTickerThread( 0 )
+{
+ OSL_ENSURE( m_pNeonLockStore, "Unable to create neon lock store!" );
+}
+
+// -------------------------------------------------------------------
+NeonLockStore::~NeonLockStore()
+{
+ stopTicker();
+
+ // release active locks, if any.
+ OSL_ENSURE( m_aLockInfoMap.size() == 0,
+ "NeonLockStore::~NeonLockStore - Releasing active locks!" );
+
+ LockInfoMap::const_iterator it( m_aLockInfoMap.begin() );
+ const LockInfoMap::const_iterator end( m_aLockInfoMap.end() );
+ while ( it != end )
+ {
+ NeonLock * pLock = (*it).first;
+ (*it).second.xSession->UNLOCK( pLock );
+
+ ne_lockstore_remove( m_pNeonLockStore, pLock );
+ ne_lock_destroy( pLock );
+
+ ++it;
+ }
+
+ ne_lockstore_destroy( m_pNeonLockStore );
+}
+
+// -------------------------------------------------------------------
+void NeonLockStore::startTicker()
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pTickerThread )
+ {
+ m_pTickerThread = new TickerThread( *this );
+ m_pTickerThread->create();
+ }
+}
+
+// -------------------------------------------------------------------
+void NeonLockStore::stopTicker()
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pTickerThread )
+ {
+ m_pTickerThread->finish();
+ m_pTickerThread->join();
+ delete m_pTickerThread;
+ m_pTickerThread = 0;
+ }
+}
+
+// -------------------------------------------------------------------
+void NeonLockStore::registerSession( HttpSession * pHttpSession )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ ne_lockstore_register( m_pNeonLockStore, pHttpSession );
+}
+
+// -------------------------------------------------------------------
+NeonLock * NeonLockStore::findByUri( rtl::OUString const & rUri )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ ne_uri aUri;
+ ne_uri_parse( rtl::OUStringToOString(
+ rUri, RTL_TEXTENCODING_UTF8 ).getStr(), &aUri );
+ return ne_lockstore_findbyuri( m_pNeonLockStore, &aUri );
+}
+
+// -------------------------------------------------------------------
+void NeonLockStore::addLock( NeonLock * pLock,
+ rtl::Reference< NeonSession > const & xSession,
+ sal_Int32 nLastChanceToSendRefreshRequest )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ ne_lockstore_add( m_pNeonLockStore, pLock );
+ m_aLockInfoMap[ pLock ]
+ = LockInfo( xSession, nLastChanceToSendRefreshRequest );
+
+ startTicker();
+}
+
+// -------------------------------------------------------------------
+void NeonLockStore::updateLock( NeonLock * pLock,
+ sal_Int32 nLastChanceToSendRefreshRequest )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ LockInfoMap::iterator it( m_aLockInfoMap.find( pLock ) );
+ OSL_ENSURE( it != m_aLockInfoMap.end(),
+ "NeonLockStore::updateLock: lock not found!" );
+
+ if ( it != m_aLockInfoMap.end() )
+ {
+ (*it).second.nLastChanceToSendRefreshRequest
+ = nLastChanceToSendRefreshRequest;
+ }
+}
+
+// -------------------------------------------------------------------
+void NeonLockStore::removeLock( NeonLock * pLock )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ m_aLockInfoMap.erase( pLock );
+ ne_lockstore_remove( m_pNeonLockStore, pLock );
+
+ if ( m_aLockInfoMap.size() == 0 )
+ stopTicker();
+}
+
+// -------------------------------------------------------------------
+void NeonLockStore::refreshLocks()
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ LockInfoMap::iterator it( m_aLockInfoMap.begin() );
+ const LockInfoMap::const_iterator end( m_aLockInfoMap.end() );
+ while ( it != end )
+ {
+ LockInfo & rInfo = (*it).second;
+ if ( rInfo.nLastChanceToSendRefreshRequest != -1 )
+ {
+ // 30 seconds or less remaining until lock expires?
+ TimeValue t1;
+ osl_getSystemTime( &t1 );
+ if ( rInfo.nLastChanceToSendRefreshRequest - 30
+ <= sal_Int32( t1.Seconds ) )
+ {
+ // refresh the lock.
+ sal_Int32 nlastChanceToSendRefreshRequest = -1;
+ if ( rInfo.xSession->LOCK(
+ (*it).first,
+ /* out param */ nlastChanceToSendRefreshRequest ) )
+ {
+ rInfo.nLastChanceToSendRefreshRequest
+ = nlastChanceToSendRefreshRequest;
+ }
+ else
+ {
+ // refresh failed. stop auto-refresh.
+ rInfo.nLastChanceToSendRefreshRequest = -1;
+ }
+ }
+ }
+ ++it;
+ }
+}
diff --git a/ucb/source/ucp/webdav/NeonLockStore.hxx b/ucb/source/ucp/webdav/NeonLockStore.hxx
new file mode 100644
index 0000000000..b00361d55e
--- /dev/null
+++ b/ucb/source/ucp/webdav/NeonLockStore.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_NEONLOCKSTORE_HXX
+#define INCLUDED_NEONLOCKSTORE_HXX
+
+#include <map>
+#include "ne_locks.h"
+#include "osl/mutex.hxx"
+#include "rtl/ref.hxx"
+#include "NeonTypes.hxx"
+
+namespace webdav_ucp
+{
+
+class TickerThread;
+class NeonSession;
+
+struct ltptr
+{
+ bool operator()( const NeonLock * p1, const NeonLock * p2 ) const
+ {
+ return p1 < p2;
+ }
+};
+
+typedef struct _LockInfo
+{
+ rtl::Reference< NeonSession > xSession;
+ sal_Int32 nLastChanceToSendRefreshRequest;
+
+ _LockInfo()
+ : nLastChanceToSendRefreshRequest( -1 ) {}
+
+ _LockInfo( rtl::Reference< NeonSession > const & _xSession,
+ sal_Int32 _nLastChanceToSendRefreshRequest )
+ : xSession( _xSession ),
+ nLastChanceToSendRefreshRequest( _nLastChanceToSendRefreshRequest ) {}
+
+} LockInfo;
+
+typedef std::map< NeonLock *, LockInfo, ltptr > LockInfoMap;
+
+class NeonLockStore
+{
+ osl::Mutex m_aMutex;
+ ne_lock_store * m_pNeonLockStore;
+ TickerThread * m_pTickerThread;
+ LockInfoMap m_aLockInfoMap;
+
+public:
+ NeonLockStore();
+ ~NeonLockStore();
+
+ void registerSession( HttpSession * pHttpSession );
+
+ NeonLock * findByUri( rtl::OUString const & rUri );
+
+ void addLock( NeonLock * pLock,
+ rtl::Reference< NeonSession > const & xSession,
+ // time in seconds since Jan 1 1970
+ // -1: infinite lock, no refresh
+ sal_Int32 nLastChanceToSendRefreshRequest );
+
+ void updateLock( NeonLock * pLock,
+ sal_Int32 nLastChanceToSendRefreshRequest );
+
+ void removeLock( NeonLock * pLock );
+
+ void refreshLocks();
+
+private:
+ void startTicker();
+ void stopTicker();
+};
+
+} // namespace webdav_ucp
+
+#endif // INCLUDED_NEONLOCKSTORE_HXX
diff --git a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx
index ab1132fa88..2a1703336b 100644
--- a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx
+++ b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -30,14 +30,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_ucb.hxx"
-#include <osl/diagnose.h>
+
+#include "osl/diagnose.h"
+#include "rtl/strbuf.hxx"
#include "NeonTypes.hxx"
#include "DAVException.hxx"
#include "DAVProperties.hxx"
#include "NeonPropFindRequest.hxx"
-#ifndef _LINKSEQUENCE_HXX_
#include "LinkSequence.hxx"
-#endif
#include "LockSequence.hxx"
#include "LockEntrySequence.hxx"
#include "UCBDeadPropertyValue.hxx"
@@ -49,6 +49,40 @@ using namespace std;
using namespace webdav_ucp;
// -------------------------------------------------------------------
+namespace
+{
+ // strip "DAV:" namespace from XML snippets to avoid
+ // parser error (undeclared namespace) later on.
+ rtl::OString stripDavNamespace( const rtl::OString & in )
+ {
+ const rtl::OString inXML( in.toAsciiLowerCase() );
+
+ rtl::OStringBuffer buf;
+ sal_Int32 start = 0;
+ sal_Int32 end = inXML.indexOf( "dav:" );
+ while ( end != -1 )
+ {
+ if ( inXML[ end - 1 ] == '<' ||
+ inXML[ end - 1 ] == '/' )
+ {
+ // copy from original buffer - preserve case.
+ buf.append( in.copy( start, end - start ) );
+ }
+ else
+ {
+ // copy from original buffer - preserve case.
+ buf.append( in.copy( start, end - start + 4 ) );
+ }
+ start = end + 4;
+ end = inXML.indexOf( "dav:", start );
+ }
+ buf.append( inXML.copy( start ) );
+
+ return rtl::OString( buf.makeStringAndClear() );
+ }
+}
+
+// -------------------------------------------------------------------
extern "C" int NPFR_propfind_iter( void* userdata,
const NeonPropName* pname,
const char* value,
@@ -57,9 +91,9 @@ extern "C" int NPFR_propfind_iter( void* userdata,
/*
HTTP Response Status Classes:
- - 1: Informational - Request received, continuing process
+ - 1: Informational - Request received, continuing process
- - 2: Success - The action was successfully received,
+ - 2: Success - The action was successfully received,
understood, and accepted
- 3: Redirection - Further action must be taken in order to
@@ -79,18 +113,22 @@ extern "C" int NPFR_propfind_iter( void* userdata,
DAVPropertyValue thePropertyValue;
thePropertyValue.IsCaseSensitive = true;
+ OSL_ENSURE( pname->nspace, "NPFR_propfind_iter - No namespace!" );
+
DAVProperties::createUCBPropName( pname->nspace,
- pname->name,
- thePropertyValue.Name );
+ pname->name,
+ thePropertyValue.Name );
bool bHasValue = false;
if ( DAVProperties::isUCBDeadProperty( *pname ) )
{
// DAV dead property added by WebDAV UCP?
if ( UCBDeadPropertyValue::createFromXML(
- value, thePropertyValue.Value ) )
+ value, thePropertyValue.Value ) )
+ {
OSL_ENSURE( thePropertyValue.Value.hasValue(),
- "NeonPropFindRequest::propfind_iter - No value!" );
+ "NPFR_propfind_iter - No value!" );
bHasValue = true;
+ }
}
if ( !bHasValue )
@@ -102,13 +140,9 @@ extern "C" int NPFR_propfind_iter( void* userdata,
aValue = aValue.trim(); // #107358# remove leading/trailing spaces
if ( aValue.getLength() )
{
- aValue = aValue.toAsciiLowerCase();
- if (
- ( aValue.compareTo(
- RTL_CONSTASCII_STRINGPARAM( "<collection" ) ) == 0 ) ||
- ( aValue.compareTo(
- RTL_CONSTASCII_STRINGPARAM( "<dav:collection" ) ) == 0 )
- )
+ aValue = stripDavNamespace( aValue ).toAsciiLowerCase();
+ if ( aValue.compareTo(
+ RTL_CONSTASCII_STRINGPARAM( "<collection" ) ) == 0 )
{
thePropertyValue.Value
<<= OUString::createFromAscii( "collection" );
@@ -125,20 +159,23 @@ extern "C" int NPFR_propfind_iter( void* userdata,
pname->name, "supportedlock" ) == 0 )
{
Sequence< LockEntry > aEntries;
- LockEntrySequence::createFromXML( value, aEntries );
+ LockEntrySequence::createFromXML(
+ stripDavNamespace( value ), aEntries );
thePropertyValue.Value <<= aEntries;
}
else if ( rtl_str_compareIgnoreAsciiCase(
pname->name, "lockdiscovery" ) == 0 )
{
Sequence< Lock > aLocks;
- LockSequence::createFromXML( value, aLocks );
+ LockSequence::createFromXML(
+ stripDavNamespace( value ), aLocks );
thePropertyValue.Value <<= aLocks;
}
else if ( rtl_str_compareIgnoreAsciiCase( pname->name, "source" ) == 0 )
{
Sequence< Link > aLinks;
- LinkSequence::createFromXML( value, aLinks );
+ LinkSequence::createFromXML(
+ stripDavNamespace( value ), aLinks );
thePropertyValue.Value <<= aLinks;
}
else
@@ -168,10 +205,10 @@ extern "C" void NPFR_propfind_results( void* userdata,
#if NEON_VERSION >= 0x0260
DAVResource theResource(
- OStringToOUString( uri->path, RTL_TEXTENCODING_UTF8 ) );
+ OStringToOUString( uri->path, RTL_TEXTENCODING_UTF8 ) );
#else
DAVResource theResource(
- OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) );
+ OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) );
#endif
ne_propset_iterate( set, NPFR_propfind_iter, &theResource );
@@ -210,10 +247,10 @@ extern "C" void NPFR_propnames_results( void* userdata,
// Create entry for the resource.
#if NEON_VERSION >= 0x0260
DAVResourceInfo theResource(
- OStringToOUString( uri->path, RTL_TEXTENCODING_UTF8 ) );
+ OStringToOUString( uri->path, RTL_TEXTENCODING_UTF8 ) );
#else
DAVResourceInfo theResource(
- OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) );
+ OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) );
#endif
// Fill entry.
@@ -247,7 +284,7 @@ NeonPropFindRequest::NeonPropFindRequest( HttpSession* inSession,
{
// Split fullname into namespace and name!
DAVProperties::createNeonPropName(
- inPropNames[ theIndex ], thePropNames[ theIndex ] );
+ inPropNames[ theIndex ], thePropNames[ theIndex ] );
}
thePropNames[ theIndex ].nspace = NULL;
thePropNames[ theIndex ].name = NULL;
@@ -288,7 +325,7 @@ NeonPropFindRequest::NeonPropFindRequest( HttpSession* inSession,
NeonPropFindRequest::NeonPropFindRequest(
HttpSession* inSession,
const char* inPath,
- const Depth inDepth,
+ const Depth inDepth,
std::vector< DAVResourceInfo > & ioResInfo,
int & nError )
{
diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx
index 9b6bae2c15..78f351f88f 100644
--- a/ucb/source/ucp/webdav/NeonSession.cxx
+++ b/ucb/source/ucp/webdav/NeonSession.cxx
@@ -1,7 +1,6 @@
/*************************************************************************
- *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -34,12 +33,14 @@
#include <hash_map>
#include <vector>
#include <string.h>
+#include "osl/diagnose.h"
+#include "osl/time.h"
#include <rtl/string.h>
#include <ne_socket.h>
#include <ne_auth.h>
#include <ne_redirect.h>
-#include <ne_locks.h>
#include <ne_ssl.h>
+#include <ne_compress.h>
#include "libxml/parser.h"
#include "rtl/ustrbuf.hxx"
#include "comphelper/sequence.hxx"
@@ -62,6 +63,7 @@
#include <com/sun/star/security/CertificateContainer.hpp>
#include <com/sun/star/security/XCertificateContainer.hpp>
#include <com/sun/star/task/XMasterPasswordHandling.hpp>
+#include <com/sun/star/ucb/Lock.hpp>
#include <com/sun/star/xml/crypto/XSEInitializer.hpp>
using namespace com::sun::star;
@@ -119,10 +121,6 @@ typedef std::hash_map
RequestDataMap;
// -------------------------------------------------------------------
-// static members!
-bool NeonSession::m_bGlobalsInited = false;
-osl::Mutex NeonSession::m_aGlobalMutex;
-// -------------------------------------------------------------------
// Helper fuction
// -------------------------------------------------------------------
static sal_uInt16 makeStatusCode( const rtl::OUString & rStatusText )
@@ -190,21 +188,21 @@ struct NeonRequestContext
// -------------------------------------------------------------------
#if NEON_VERSION >= 0x0250
-extern "C" int NeonSession_ResponseBlockReader(void * inUserData,
+extern "C" int NeonSession_ResponseBlockReader(void * inUserData,
#else
-extern "C" void NeonSession_ResponseBlockReader(void * inUserData,
+extern "C" void NeonSession_ResponseBlockReader(void * inUserData,
#endif
- const char * inBuf,
+ const char * inBuf,
size_t inLen )
{
- // neon calls this function with (inLen == 0)...
+ // neon sometimes calls this function with (inLen == 0)...
if ( inLen > 0 )
{
NeonRequestContext * pCtx
= static_cast< NeonRequestContext * >( inUserData );
-
+
rtl::Reference< NeonInputStream > xInputStream(
- pCtx->xInputStream);
+ pCtx->xInputStream );
if ( xInputStream.is() )
xInputStream->AddToStream( inBuf, inLen );
@@ -220,11 +218,11 @@ extern "C" void NeonSession_ResponseBlockReader(void * inUserData,
// -------------------------------------------------------------------
#if NEON_VERSION >= 0x0250
-extern "C" int NeonSession_ResponseBlockWriter( void * inUserData,
+extern "C" int NeonSession_ResponseBlockWriter( void * inUserData,
#else
-extern "C" void NeonSession_ResponseBlockWriter( void * inUserData,
+extern "C" void NeonSession_ResponseBlockWriter( void * inUserData,
#endif
- const char * inBuf,
+ const char * inBuf,
size_t inLen )
{
// neon calls this function with (inLen == 0)...
@@ -232,7 +230,7 @@ extern "C" void NeonSession_ResponseBlockWriter( void * inUserData,
{
NeonRequestContext * pCtx
= static_cast< NeonRequestContext * >( inUserData );
- uno::Reference< io::XOutputStream > xOutputStream
+ uno::Reference< io::XOutputStream > xOutputStream
= pCtx->xOutputStream;
if ( xOutputStream.is() )
@@ -289,7 +287,7 @@ extern "C" int NeonSession_NeonAuth( void * inUserData,
if ( attempt == 0 )
{
- // neon does not handle username supplied with request URI (for
+ // neon does not handle username supplied with request URI (for
// instance when doing FTP over proxy - last checked: 0.23.5 )
try
@@ -327,22 +325,23 @@ extern "C" int NeonSession_NeonAuth( void * inUserData,
bool bCanUseSystemCreds = false;
#ifdef NE_FEATURE_SSPI
- bCanUseSystemCreds = (attempt == 0) && // avoid endless loops
- ne_has_support( NE_FEATURE_SSPI ) && // Windows-only feature.
- ( ( ne_strcasecmp( inAuthProtocol, "NTLM" ) == 0 ) ||
- ( ne_strcasecmp( inAuthProtocol, "Negotiate" ) == 0 ) );
+ bCanUseSystemCreds
+ = (attempt == 0) && // avoid endless loops
+ ne_has_support( NE_FEATURE_SSPI ) && // Windows-only feature.
+ ( ( ne_strcasecmp( inAuthProtocol, "NTLM" ) == 0 ) ||
+ ( ne_strcasecmp( inAuthProtocol, "Negotiate" ) == 0 ) );
#endif
- // #i97003# (tkr): Ask XMasterPasswordHandling if we should store the
+ // #i97003# (tkr): Ask XMasterPasswordHandling if we should store the
// credentials persistently and give this information to the auth listener
uno::Reference< task::XMasterPasswordHandling > xMasterPasswordHandling;
try
{
- xMasterPasswordHandling =
+ xMasterPasswordHandling =
uno::Reference< task::XMasterPasswordHandling >(
- theSession->getMSF()->createInstance(
- rtl::OUString::createFromAscii(
- "com.sun.star.task.PasswordContainer" )),
+ theSession->getMSF()->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.task.PasswordContainer" ) ),
uno::UNO_QUERY );
}
catch ( uno::Exception const & )
@@ -354,9 +353,9 @@ extern "C" int NeonSession_NeonAuth( void * inUserData,
theSession->getHostName(),
theUserName,
thePassWord,
- xMasterPasswordHandling.is()
+ xMasterPasswordHandling.is()
? xMasterPasswordHandling->
- isPersistentStoringAllowed()
+ isPersistentStoringAllowed()
: sal_False,
bCanUseSystemCreds);
@@ -400,17 +399,17 @@ namespace {
if ( nContStart != -1 )
{
nContStart = nContStart + sPartId.getLength();
- sal_Int32 nContEnd
+ sal_Int32 nContEnd
= _rRawString.indexOf( sal_Unicode( ',' ), nContStart );
sPart = _rRawString.copy( nContStart, nContEnd - nContStart );
}
return sPart;
}
-}
+} // namespace
// -------------------------------------------------------------------
-extern "C" int NeonSession_CertificationNotify( void *userdata,
- int failures,
+extern "C" int NeonSession_CertificationNotify( void *userdata,
+ int failures,
const ne_ssl_certificate *cert )
{
OSL_ASSERT( cert );
@@ -418,12 +417,12 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
NeonSession * pSession = static_cast< NeonSession * >( userdata );
uno::Reference< security::XCertificateContainer > xCertificateContainer;
try
- {
- xCertificateContainer
+ {
+ xCertificateContainer
= uno::Reference< security::XCertificateContainer >(
- pSession->getMSF()->createInstance(
- rtl::OUString::createFromAscii(
- "com.sun.star.security.CertificateContainer" ) ),
+ pSession->getMSF()->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.security.CertificateContainer" ) ),
uno::UNO_QUERY );
}
catch ( uno::Exception const & )
@@ -434,27 +433,27 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
return 1;
failures = 0;
-
+
char * dn = ne_ssl_readable_dname( ne_ssl_cert_subject( cert ) );
rtl::OUString cert_subject( dn, strlen( dn ), RTL_TEXTENCODING_UTF8, 0 );
free( dn );
security::CertificateContainerStatus certificateContainer(
- xCertificateContainer->hasCertificate(
+ xCertificateContainer->hasCertificate(
pSession->getHostName(), cert_subject ) );
if ( certificateContainer != security::CertificateContainerStatus_NOCERT )
- return
- certificateContainer == security::CertificateContainerStatus_TRUSTED
- ? 0
+ return
+ certificateContainer == security::CertificateContainerStatus_TRUSTED
+ ? 0
: 1;
-
+
uno::Reference< xml::crypto::XSEInitializer > xSEInitializer;
try
{
xSEInitializer = uno::Reference< xml::crypto::XSEInitializer >(
- pSession->getMSF()->createInstance(
+ pSession->getMSF()->createInstance(
rtl::OUString::createFromAscii( SEINITIALIZER_COMPONENT ) ),
uno::UNO_QUERY );
}
@@ -467,22 +466,22 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
uno::Reference< xml::crypto::XXMLSecurityContext > xSecurityContext(
xSEInitializer->createSecurityContext( rtl::OUString() ) );
-
+
uno::Reference< xml::crypto::XSecurityEnvironment > xSecurityEnv(
xSecurityContext->getSecurityEnvironment() );
-
+
//The end entity certificate
char * eeCertB64 = ne_ssl_cert_export( cert );
rtl::OString sEECertB64( eeCertB64 );
- uno::Reference< com::sun::star::security::XCertificate > xEECert(
- xSecurityEnv->createCertificateFromAscii(
+ uno::Reference< security::XCertificate > xEECert(
+ xSecurityEnv->createCertificateFromAscii(
rtl::OStringToOUString( sEECertB64, RTL_TEXTENCODING_ASCII_US ) ) );
ne_free( eeCertB64 );
eeCertB64 = 0;
-
+
std::vector< uno::Reference< security::XCertificate > > vecCerts;
const ne_ssl_certificate * issuerCert = cert;
do
@@ -493,24 +492,24 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
issuerCert = ne_ssl_cert_signedby( issuerCert );
if ( NULL == issuerCert )
break;
-
+
char * imCertB64 = ne_ssl_cert_export( issuerCert );
rtl::OString sInterMediateCertB64( imCertB64 );
ne_free( imCertB64 );
- uno::Reference< security::XCertificate> xImCert(
- xSecurityEnv->createCertificateFromAscii(
- rtl::OStringToOUString(
+ uno::Reference< security::XCertificate> xImCert(
+ xSecurityEnv->createCertificateFromAscii(
+ rtl::OStringToOUString(
sInterMediateCertB64, RTL_TEXTENCODING_ASCII_US ) ) );
if ( xImCert.is() )
vecCerts.push_back( xImCert );
}
while ( 1 );
- sal_Int64 certValidity = xSecurityEnv->verifyCertificate( xEECert,
+ sal_Int64 certValidity = xSecurityEnv->verifyCertificate( xEECert,
::comphelper::containerToSequence( vecCerts ) );
-
- if ( pSession->isDomainMatch(
+
+ if ( pSession->isDomainMatch(
GetHostnamePart( xEECert.get()->getSubjectName() ) ) )
{
// if host name matched with certificate then look if the
@@ -519,24 +518,24 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
return 0;
}
- const uno::Reference< ucb::XCommandEnvironment > xEnv(
+ const uno::Reference< ucb::XCommandEnvironment > xEnv(
pSession->getRequestEnvironment().m_xEnv );
if ( xEnv.is() )
{
failures = static_cast< int >( certValidity );
-
+
uno::Reference< task::XInteractionHandler > xIH(
xEnv->getInteractionHandler() );
if ( xIH.is() )
{
- rtl::Reference< ucbhelper::SimpleCertificateValidationRequest >
+ rtl::Reference< ucbhelper::SimpleCertificateValidationRequest >
xRequest( new ucbhelper::SimpleCertificateValidationRequest(
(sal_Int32)failures, xEECert, pSession->getHostName() ) );
xIH->handle( xRequest.get() );
rtl::Reference< ucbhelper::InteractionContinuation > xSelection
= xRequest->getSelection();
-
+
if ( xSelection.is() )
{
uno::Reference< task::XInteractionApprove > xApprove(
@@ -546,22 +545,22 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
xCertificateContainer->addCertificate(
pSession->getHostName(), cert_subject, sal_True );
return 0;
- }
- else
+ }
+ else
{
// Don't trust cert
xCertificateContainer->addCertificate(
pSession->getHostName(), cert_subject, sal_False );
- return 1;
+ return 1;
}
}
- }
+ }
else
{
// Don't trust cert
xCertificateContainer->addCertificate(
pSession->getHostName(), cert_subject, sal_False );
- return 1;
+ return 1;
}
}
return 1;
@@ -617,36 +616,41 @@ extern "C" void NeonSession_PreSendRequest( ne_request * req,
}
}
- const DAVRequestHeaders & rHeaders
- = pSession->getRequestEnvironment().m_aRequestHeaders;
+ const DAVRequestHeaders & rHeaders
+ = pSession->getRequestEnvironment().m_aRequestHeaders;
- DAVRequestHeaders::const_iterator it1( rHeaders.begin() );
- const DAVRequestHeaders::const_iterator end1( rHeaders.end() );
+ DAVRequestHeaders::const_iterator it1( rHeaders.begin() );
+ const DAVRequestHeaders::const_iterator end1( rHeaders.end() );
- while ( it1 != end1 )
- {
- rtl::OString aHeader
- = rtl::OUStringToOString( (*it1).first,
- RTL_TEXTENCODING_UTF8 );
- rtl::OString aValue
- = rtl::OUStringToOString( (*it1).second,
- RTL_TEXTENCODING_UTF8 );
- ne_buffer_concat( headers, aHeader.getStr(), ": ",
- aValue.getStr(), EOL, NULL );
-
- ++it1;
+ while ( it1 != end1 )
+ {
+ rtl::OString aHeader
+ = rtl::OUStringToOString( (*it1).first,
+ RTL_TEXTENCODING_UTF8 );
+ rtl::OString aValue
+ = rtl::OUStringToOString( (*it1).second,
+ RTL_TEXTENCODING_UTF8 );
+ ne_buffer_concat( headers, aHeader.getStr(), ": ",
+ aValue.getStr(), EOL, NULL );
+
+ ++it1;
+ }
}
}
-} // namespace
+// -------------------------------------------------------------------
+// static members!
+bool NeonSession::m_bGlobalsInited = false;
+osl::Mutex NeonSession::m_aGlobalMutex;
+NeonLockStore NeonSession::m_aNeonLockStore;
// -------------------------------------------------------------------
// Constructor
// -------------------------------------------------------------------
NeonSession::NeonSession(
- const rtl::Reference< DAVSessionFactory > & rSessionFactory,
- const rtl::OUString& inUri,
- const ucbhelper::InternetProxyDecider & rProxyDecider )
+ const rtl::Reference< DAVSessionFactory > & rSessionFactory,
+ const rtl::OUString& inUri,
+ const ucbhelper::InternetProxyDecider & rProxyDecider )
throw ( DAVException )
: DAVSession( rSessionFactory ),
m_pHttpSession( 0 ),
@@ -657,8 +661,6 @@ NeonSession::NeonSession(
m_aScheme = theUri.GetScheme();
m_aHostName = theUri.GetHost();
m_nPort = theUri.GetPort();
-
-// Init();
}
// -------------------------------------------------------------------
@@ -670,17 +672,17 @@ NeonSession::~NeonSession( )
{
ne_session_destroy( m_pHttpSession );
m_pHttpSession = 0;
- // Note: Uncomment the following if locking support is required
- /*
- if ( mNeonLockSession != NULL )
- {
- ne_lock_unregister( mNeonLockSession );
- mNeonLockSession = NULL;
- }
- */
}
+ delete static_cast< RequestDataMap * >( m_pRequestData );
+}
- delete static_cast<RequestDataMap*>(m_pRequestData);
+// -------------------------------------------------------------------
+void NeonSession::Init( const DAVRequestEnvironment & rEnv )
+ throw ( DAVException )
+{
+ osl::Guard< osl::Mutex > theGuard( m_aMutex );
+ m_aEnv = rEnv;
+ Init();
}
// -------------------------------------------------------------------
@@ -693,7 +695,7 @@ void NeonSession::Init()
if ( m_pHttpSession == 0 )
{
- // Ensure that Neon sockets are initialize
+ // Ensure that Neon sockets are initialized
// --> tkr #151111# crashed if copy and pasted pictures from the internet
// ne_sock_init() was executed by two threads at the same time.
@@ -705,9 +707,23 @@ void NeonSession::Init()
throw DAVException( DAVException::DAV_SESSION_CREATE,
NeonUri::makeConnectionEndPointString(
m_aHostName, m_nPort ) );
- // #122205# - libxml2 needs to be initialized once if used by
+
+ // #122205# - libxml2 needs to be initialized once if used by
// multithreaded programs like OOo.
xmlInitParser();
+#if 0
+ // for more debug flags see ne_utils.h; NE_DEBUGGING must be defined
+ // while compiling neon in order to actually activate neon debug
+ // output.
+ ne_debug_init( stderr, NE_DBG_FLUSH
+ | NE_DBG_HTTP
+ // | NE_DBG_HTTPBODY
+ // | NE_DBG_HTTPAUTH
+ // | NE_DBG_XML
+ // | NE_DBG_XMLPARSE
+ // | NE_DBG_LOCKS
+ );
+#endif
m_bGlobalsInited = true;
}
@@ -747,31 +763,30 @@ void NeonSession::Init()
// to the session
m_pHttpSession = ne_session_create(
- rtl::OUStringToOString( m_aScheme,
- RTL_TEXTENCODING_UTF8 ).getStr(),
- /* theUri.GetUserInfo(),
- @@@ for FTP via HTTP proxy, but not supported by Neon */
- rtl::OUStringToOString( m_aHostName,
- RTL_TEXTENCODING_UTF8 ).getStr(),
- m_nPort );
-
+ rtl::OUStringToOString( m_aScheme,
+ RTL_TEXTENCODING_UTF8 ).getStr(),
+ /* theUri.GetUserInfo(),
+ @@@ for FTP via HTTP proxy, but not supported by Neon */
+ rtl::OUStringToOString( m_aHostName,
+ RTL_TEXTENCODING_UTF8 ).getStr(),
+ m_nPort );
+
if ( m_pHttpSession == 0 )
throw DAVException( DAVException::DAV_SESSION_CREATE,
NeonUri::makeConnectionEndPointString(
m_aHostName, m_nPort ) );
- if (m_aScheme.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "https" ) ) ) )
- {
-
- // Get all trusted certificates from key store
-
+ // Register the session with the lock store
+ m_aNeonLockStore.registerSession( m_pHttpSession );
-
+ if ( m_aScheme.equalsIgnoreAsciiCase(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "https" ) ) ) )
+ {
// Set a failure callback for certificate check
- ne_ssl_set_verify( m_pHttpSession, NeonSession_CertificationNotify, this);
- }
-
+ ne_ssl_set_verify(
+ m_pHttpSession, NeonSession_CertificationNotify, this);
+ }
+
// Add hooks (i.e. for adding additional headers to the request)
#if 0
@@ -815,27 +830,20 @@ void NeonSession::Init()
if ( m_aProxyName.getLength() )
{
ne_session_proxy( m_pHttpSession,
- rtl::OUStringToOString( m_aProxyName,
- RTL_TEXTENCODING_UTF8 )
- .getStr(),
+ rtl::OUStringToOString(
+ m_aProxyName,
+ RTL_TEXTENCODING_UTF8 ).getStr(),
m_nProxyPort );
}
- // Note: Uncomment the following if locking support is required
- /*
- mNeonLockSession = ne_lock_register( m_pHttpSession );
-
- if ( mNeonLockSession == NULL )
- throw DAVException( DAVException::DAV_SESSION_CREATE,
- theUri::makeConnectionEndPointString() );
- */
-
// Register for redirects.
ne_redirect_register( m_pHttpSession );
// authentication callbacks.
- ne_add_server_auth( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this );
- ne_add_proxy_auth ( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this );
+ ne_add_server_auth(
+ m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this );
+ ne_add_proxy_auth(
+ m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this );
}
}
@@ -870,15 +878,13 @@ sal_Bool NeonSession::UsesProxy()
// OPTIONS
// -------------------------------------------------------------------
void NeonSession::OPTIONS( const rtl::OUString & inPath,
- DAVCapabilities & outCapabilities,
+ DAVCapabilities & outCapabilities,
const DAVRequestEnvironment & rEnv )
throw( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
HttpServerCapabilities servercaps;
memset( &servercaps, 0, sizeof( servercaps ) );
@@ -887,8 +893,9 @@ void NeonSession::OPTIONS( const rtl::OUString & inPath,
rtl::OUStringToOString(
inPath, RTL_TEXTENCODING_UTF8 ),
&servercaps );
- HandleError( theRetVal );
-
+
+ HandleError( theRetVal, inPath, rEnv );
+
outCapabilities.class1 = !!servercaps.dav_class1;
outCapabilities.class2 = !!servercaps.dav_class2;
outCapabilities.executable = !!servercaps.dav_executable;
@@ -897,60 +904,58 @@ void NeonSession::OPTIONS( const rtl::OUString & inPath,
// -------------------------------------------------------------------
// PROPFIND - allprop & named
// -------------------------------------------------------------------
-void NeonSession::PROPFIND( const rtl::OUString & inPath,
- const Depth inDepth,
+void NeonSession::PROPFIND( const rtl::OUString & inPath,
+ const Depth inDepth,
const std::vector< rtl::OUString > & inPropNames,
- std::vector< DAVResource > & ioResources,
+ std::vector< DAVResource > & ioResources,
const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
int theRetVal = NE_OK;
NeonPropFindRequest theRequest( m_pHttpSession,
rtl::OUStringToOString(
inPath, RTL_TEXTENCODING_UTF8 ),
- inDepth,
- inPropNames,
- ioResources,
- theRetVal );
- HandleError( theRetVal );
+ inDepth,
+ inPropNames,
+ ioResources,
+ theRetVal );
+
+ HandleError( theRetVal, inPath, rEnv );
}
// -------------------------------------------------------------------
// PROPFIND - propnames
// -------------------------------------------------------------------
-void NeonSession::PROPFIND( const rtl::OUString & inPath,
- const Depth inDepth,
- std::vector< DAVResourceInfo >& ioResInfo,
+void NeonSession::PROPFIND( const rtl::OUString & inPath,
+ const Depth inDepth,
+ std::vector< DAVResourceInfo > & ioResInfo,
const DAVRequestEnvironment & rEnv )
throw( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
int theRetVal = NE_OK;
NeonPropFindRequest theRequest( m_pHttpSession,
rtl::OUStringToOString(
inPath, RTL_TEXTENCODING_UTF8 ),
- inDepth,
- ioResInfo,
- theRetVal );
- HandleError( theRetVal );
+ inDepth,
+ ioResInfo,
+ theRetVal );
+
+ HandleError( theRetVal, inPath, rEnv );
}
// -------------------------------------------------------------------
// PROPPATCH
// -------------------------------------------------------------------
-void NeonSession::PROPPATCH( const rtl::OUString & inPath,
- const std::vector< ProppatchValue > & inValues,
+void NeonSession::PROPPATCH( const rtl::OUString & inPath,
+ const std::vector< ProppatchValue > & inValues,
const DAVRequestEnvironment & rEnv )
throw( DAVException )
{
@@ -960,23 +965,24 @@ void NeonSession::PROPPATCH( const rtl::OUString & inPath,
mod_dav implementation:
- creationdate r ( File System prop )
- displayname w
+ creationdate r ( File System prop )
+ displayname w
getcontentlanguage r ( #ifdef DAV_DISABLE_WRITEABLE_PROPS )
getcontentlength r ( File System prop )
getcontenttype r ( #ifdef DAV_DISABLE_WRITEABLE_PROPS )
getetag r ( File System prop )
getlastmodified r ( File System prop )
- lockdiscovery r
- resourcetype r
- source w
+ lockdiscovery r
+ resourcetype r
+ source w
supportedlock r
executable w ( #ifndef WIN32 )
All dead properties are of course writable.
- */
+ */
int theRetVal = NE_OK;
+
int n; // for the "for" loop
// Generate the list of properties we want to set.
@@ -995,13 +1001,13 @@ void NeonSession::PROPPATCH( const rtl::OUString & inPath,
if ( rValue.operation == PROPSET )
{
pItems[ n ].type = ne_propset;
-
+
rtl::OUString aStringValue;
if ( DAVProperties::isUCBDeadProperty( *pName ) )
{
// DAV dead property added by WebDAV UCP?
- if ( !UCBDeadPropertyValue::toXML(
- rValue.value, aStringValue ) )
+ if ( !UCBDeadPropertyValue::toXML( rValue.value,
+ aStringValue ) )
{
// Error!
pItems[ n ].value = 0;
@@ -1015,7 +1021,7 @@ void NeonSession::PROPPATCH( const rtl::OUString & inPath,
// complex properties...
if ( rValue.name == DAVProperties::SOURCE )
{
- uno::Sequence< ::com::sun::star::ucb::Link > aLinks;
+ uno::Sequence< ucb::Link > aLinks;
if ( rValue.value >>= aLinks )
{
LinkSequence::toXML( aLinks, aStringValue );
@@ -1050,23 +1056,21 @@ void NeonSession::PROPPATCH( const rtl::OUString & inPath,
pItems[ n ].value = 0;
}
}
-
+
if ( theRetVal == NE_OK )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
-
- Init();
- m_aEnv = rEnv;
-
+ Init( rEnv );
+
pItems[ n ].name = 0;
-
+
theRetVal = ne_proppatch( m_pHttpSession,
rtl::OUStringToOString(
inPath, RTL_TEXTENCODING_UTF8 ),
pItems );
}
-
+
for ( n = 0; n < nPropCount; ++n )
{
free( (void *)pItems[ n ].name->name );
@@ -1075,8 +1079,8 @@ void NeonSession::PROPPATCH( const rtl::OUString & inPath,
}
delete [] pItems;
-
- HandleError( theRetVal );
+
+ HandleError( theRetVal, inPath, rEnv );
}
// -------------------------------------------------------------------
@@ -1090,9 +1094,7 @@ void NeonSession::HEAD( const ::rtl::OUString & inPath,
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
int theRetVal = NE_OK;
NeonHeadRequest theRequest( m_pHttpSession,
@@ -1100,22 +1102,21 @@ void NeonSession::HEAD( const ::rtl::OUString & inPath,
inHeaderNames,
ioResource,
theRetVal );
- HandleError( theRetVal );
+
+ HandleError( theRetVal, inPath, rEnv );
}
// -------------------------------------------------------------------
// GET
// -------------------------------------------------------------------
-uno::Reference< io::XInputStream >
+uno::Reference< io::XInputStream >
NeonSession::GET( const rtl::OUString & inPath,
- const DAVRequestEnvironment & rEnv )
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
rtl::Reference< NeonInputStream > xInputStream( new NeonInputStream );
NeonRequestContext aCtx( xInputStream );
@@ -1125,23 +1126,23 @@ NeonSession::GET( const rtl::OUString & inPath,
NeonSession_ResponseBlockReader,
false,
&aCtx );
- HandleError( theRetVal );
+
+ HandleError( theRetVal, inPath, rEnv );
+
return uno::Reference< io::XInputStream >( xInputStream.get() );
}
// -------------------------------------------------------------------
// GET
// -------------------------------------------------------------------
-void NeonSession::GET( const rtl::OUString & inPath,
+void NeonSession::GET( const rtl::OUString & inPath,
uno::Reference< io::XOutputStream > & ioOutputStream,
const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
NeonRequestContext aCtx( ioOutputStream );
int theRetVal = GET( m_pHttpSession,
@@ -1150,24 +1151,23 @@ void NeonSession::GET( const rtl::OUString & inPath,
NeonSession_ResponseBlockWriter,
false,
&aCtx );
- HandleError( theRetVal );
+
+ HandleError( theRetVal, inPath, rEnv );
}
// -------------------------------------------------------------------
// GET
// -------------------------------------------------------------------
-uno::Reference< io::XInputStream >
+uno::Reference< io::XInputStream >
NeonSession::GET( const rtl::OUString & inPath,
- const std::vector< ::rtl::OUString > & inHeaderNames,
- DAVResource & ioResource,
- const DAVRequestEnvironment & rEnv )
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource & ioResource,
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
ioResource.uri = inPath;
ioResource.properties.clear();
@@ -1180,7 +1180,9 @@ NeonSession::GET( const rtl::OUString & inPath,
NeonSession_ResponseBlockReader,
true,
&aCtx );
- HandleError( theRetVal );
+
+ HandleError( theRetVal, inPath, rEnv );
+
return uno::Reference< io::XInputStream >( xInputStream.get() );
}
@@ -1188,17 +1190,15 @@ NeonSession::GET( const rtl::OUString & inPath,
// GET
// -------------------------------------------------------------------
void NeonSession::GET( const rtl::OUString & inPath,
- uno::Reference< io::XOutputStream > & ioOutputStream,
- const std::vector< ::rtl::OUString > & inHeaderNames,
- DAVResource & ioResource,
- const DAVRequestEnvironment & rEnv )
+ uno::Reference< io::XOutputStream > & ioOutputStream,
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource & ioResource,
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
ioResource.uri = inPath;
ioResource.properties.clear();
@@ -1210,27 +1210,26 @@ void NeonSession::GET( const rtl::OUString & inPath,
NeonSession_ResponseBlockWriter,
true,
&aCtx );
- HandleError( theRetVal );
+
+ HandleError( theRetVal, inPath, rEnv );
}
// -------------------------------------------------------------------
// PUT
// -------------------------------------------------------------------
-void NeonSession::PUT( const rtl::OUString & inPath,
+void NeonSession::PUT( const rtl::OUString & inPath,
const uno::Reference< io::XInputStream > & inInputStream,
const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
-
- m_aEnv = rEnv;
-
uno::Sequence< sal_Int8 > aDataToSend;
if ( !getDataFromInputStream( inInputStream, aDataToSend, false ) )
throw DAVException( DAVException::DAV_INVALID_ARG );
+ Init( rEnv );
+
int theRetVal = PUT( m_pHttpSession,
rtl::OUStringToOString(
inPath, RTL_TEXTENCODING_UTF8 ),
@@ -1238,18 +1237,18 @@ void NeonSession::PUT( const rtl::OUString & inPath,
aDataToSend.getConstArray() ),
aDataToSend.getLength() );
- HandleError( theRetVal );
+ HandleError( theRetVal, inPath, rEnv );
}
// -------------------------------------------------------------------
// POST
// -------------------------------------------------------------------
-uno::Reference< io::XInputStream >
+uno::Reference< io::XInputStream >
NeonSession::POST( const rtl::OUString & inPath,
- const rtl::OUString & rContentType,
- const rtl::OUString & rReferer,
- const uno::Reference< io::XInputStream > & inInputStream,
- const DAVRequestEnvironment & rEnv )
+ const rtl::OUString & rContentType,
+ const rtl::OUString & rReferer,
+ const uno::Reference< io::XInputStream > & inInputStream,
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
@@ -1258,15 +1257,13 @@ NeonSession::POST( const rtl::OUString & inPath,
if ( !getDataFromInputStream( inInputStream, aDataToSend, true ) )
throw DAVException( DAVException::DAV_INVALID_ARG );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
rtl::Reference< NeonInputStream > xInputStream( new NeonInputStream );
NeonRequestContext aCtx( xInputStream );
int theRetVal = POST( m_pHttpSession,
rtl::OUStringToOString(
- inPath, RTL_TEXTENCODING_UTF8 ),
+ inPath, RTL_TEXTENCODING_UTF8 ),
reinterpret_cast< const char * >(
aDataToSend.getConstArray() ),
NeonSession_ResponseBlockReader,
@@ -1274,7 +1271,8 @@ NeonSession::POST( const rtl::OUString & inPath,
rContentType,
rReferer );
- HandleError( theRetVal );
+ HandleError( theRetVal, inPath, rEnv );
+
return uno::Reference< io::XInputStream >( xInputStream.get() );
}
@@ -1295,9 +1293,7 @@ void NeonSession::POST( const rtl::OUString & inPath,
if ( !getDataFromInputStream( inInputStream, aDataToSend, true ) )
throw DAVException( DAVException::DAV_INVALID_ARG );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
NeonRequestContext aCtx( oOutputStream );
int theRetVal = POST( m_pHttpSession,
@@ -1310,20 +1306,7 @@ void NeonSession::POST( const rtl::OUString & inPath,
rContentType,
rReferer );
- HandleError( theRetVal );
-}
-
-// -------------------------------------------------------------------
-// ABORT
-// -------------------------------------------------------------------
-void NeonSession::ABORT()
- throw ( DAVException )
-{
- // 11.11.09 (tkr): The following code lines causing crashes if closing a ongoing connection. It turned out that this existing solution doesn't work in multi-threading environments.
- // So I disabled them in 3.2. . Issue #73893# should fix it in OOo 3.3.
-
- //if (NULL !=m_pHttpSession)
- // ne_close_connection(m_pHttpSession);
+ HandleError( theRetVal, inPath, rEnv );
}
// -------------------------------------------------------------------
@@ -1335,30 +1318,27 @@ void NeonSession::MKCOL( const rtl::OUString & inPath,
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
int theRetVal = ne_mkcol( m_pHttpSession,
rtl::OUStringToOString(
- inPath, RTL_TEXTENCODING_UTF8 ) );
- HandleError( theRetVal );
+ inPath, RTL_TEXTENCODING_UTF8 ) );
+
+ HandleError( theRetVal, inPath, rEnv );
}
// -------------------------------------------------------------------
// COPY
// -------------------------------------------------------------------
-void NeonSession::COPY( const rtl::OUString & inSourceURL,
- const rtl::OUString & inDestinationURL,
+void NeonSession::COPY( const rtl::OUString & inSourceURL,
+ const rtl::OUString & inDestinationURL,
const DAVRequestEnvironment & rEnv,
- sal_Bool inOverWrite )
+ sal_Bool inOverWrite )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
NeonUri theSourceUri( inSourceURL );
NeonUri theDestinationUri( inDestinationURL );
@@ -1367,12 +1347,13 @@ void NeonSession::COPY( const rtl::OUString & inSourceURL,
inOverWrite ? 1 : 0,
NE_DEPTH_INFINITE,
rtl::OUStringToOString(
- theSourceUri.GetPath(),
- RTL_TEXTENCODING_UTF8 ),
+ theSourceUri.GetPath(),
+ RTL_TEXTENCODING_UTF8 ),
rtl::OUStringToOString(
- theDestinationUri.GetPath(),
- RTL_TEXTENCODING_UTF8 ) );
- HandleError( theRetVal );
+ theDestinationUri.GetPath(),
+ RTL_TEXTENCODING_UTF8 ) );
+
+ HandleError( theRetVal, inSourceURL, rEnv );
}
// -------------------------------------------------------------------
@@ -1386,21 +1367,20 @@ void NeonSession::MOVE( const rtl::OUString & inSourceURL,
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
NeonUri theSourceUri( inSourceURL );
NeonUri theDestinationUri( inDestinationURL );
int theRetVal = ne_move( m_pHttpSession,
inOverWrite ? 1 : 0,
rtl::OUStringToOString(
- theSourceUri.GetPath(),
- RTL_TEXTENCODING_UTF8 ),
+ theSourceUri.GetPath(),
+ RTL_TEXTENCODING_UTF8 ),
rtl::OUStringToOString(
- theDestinationUri.GetPath(),
- RTL_TEXTENCODING_UTF8 ) );
- HandleError( theRetVal );
+ theDestinationUri.GetPath(),
+ RTL_TEXTENCODING_UTF8 ) );
+
+ HandleError( theRetVal, inSourceURL, rEnv );
}
// -------------------------------------------------------------------
@@ -1412,53 +1392,282 @@ void NeonSession::DESTROY( const rtl::OUString & inPath,
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
-
- m_aEnv = rEnv;
+ Init( rEnv );
int theRetVal = ne_delete( m_pHttpSession,
rtl::OUStringToOString(
- inPath, RTL_TEXTENCODING_UTF8 ) );
- HandleError( theRetVal );
+ inPath, RTL_TEXTENCODING_UTF8 ) );
+
+ HandleError( theRetVal, inPath, rEnv );
}
// -------------------------------------------------------------------
-// LOCK
+namespace
+{
+ sal_Int32 lastChanceToSendRefreshRequest( TimeValue const & rStart,
+ int timeout )
+ {
+ TimeValue aEnd;
+ osl_getSystemTime( &aEnd );
+
+ // Try to estimate a safe absolute time for sending the
+ // lock refresh request.
+ sal_Int32 lastChanceToSendRefreshRequest = -1;
+ if ( timeout != NE_TIMEOUT_INFINITE )
+ {
+ sal_Int32 calltime = aEnd.Seconds - rStart.Seconds;
+ if ( calltime <= timeout )
+ {
+ lastChanceToSendRefreshRequest
+ = aEnd.Seconds + timeout - calltime;
+ }
+ else
+ {
+ OSL_TRACE( "No chance to refresh lock before timeout!" );
+ }
+ }
+ return lastChanceToSendRefreshRequest;
+ }
+
+} // namespace
+
+// -------------------------------------------------------------------
+// LOCK (set new lock)
// -------------------------------------------------------------------
-// Note: Uncomment the following if locking support is required
-/*
-void NeonSession::LOCK( const Lock & inLock,
+void NeonSession::LOCK( const ::rtl::OUString & inPath,
+ ucb::Lock & rLock,
const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
+ Init( rEnv );
- m_aEnv = rEnv;
+ /* Create a depth zero, exclusive write lock, with default timeout
+ * (allowing a server to pick a default). token, owner and uri are
+ * unset. */
+ NeonLock * theLock = ne_lock_create();
+
+ // Set the lock uri
+ ne_uri aUri;
+ ne_uri_parse( rtl::OUStringToOString( makeAbsoluteURL( inPath ),
+ RTL_TEXTENCODING_UTF8 ).getStr(),
+ &aUri );
+ theLock->uri = aUri;
+
+ // Set the lock depth
+ switch( rLock.Depth )
+ {
+ case ucb::LockDepth_ZERO:
+ theLock->depth = NE_DEPTH_ZERO;
+ break;
+ case ucb::LockDepth_ONE:
+ theLock->depth = NE_DEPTH_ONE;
+ break;
+ case ucb::LockDepth_INFINITY:
+ theLock->depth = NE_DEPTH_INFINITE;
+ break;
+ default:
+ throw DAVException( DAVException::DAV_INVALID_ARG );
+ }
+
+ // Set the lock scope
+ switch ( rLock.Scope )
+ {
+ case ucb::LockScope_EXCLUSIVE:
+ theLock->scope = ne_lockscope_exclusive;
+ break;
+ case ucb::LockScope_SHARED:
+ theLock->scope = ne_lockscope_shared;
+ break;
+ default:
+ throw DAVException( DAVException::DAV_INVALID_ARG );
+ }
+
+ // Set the lock timeout
+ theLock->timeout = (long)rLock.Timeout;
+
+ // Set the lock owner
+ rtl::OUString aValue;
+ rLock.Owner >>= aValue;
+ theLock->owner =
+ ne_strdup( rtl::OUStringToOString( aValue,
+ RTL_TEXTENCODING_UTF8 ).getStr() );
+ TimeValue startCall;
+ osl_getSystemTime( &startCall );
- Lockit( inLock, true );
+ int theRetVal = ne_lock( m_pHttpSession, theLock );
+
+ if ( theRetVal == NE_OK )
+ {
+ m_aNeonLockStore.addLock( theLock,
+ this,
+ lastChanceToSendRefreshRequest(
+ startCall, theLock->timeout ) );
+
+ uno::Sequence< rtl::OUString > aTokens( 1 );
+ aTokens[ 0 ] = rtl::OUString::createFromAscii( theLock->token );
+ rLock.LockTokens = aTokens;
+
+ OSL_TRACE( "NeonSession::LOCK: created lock for %s. token: %s",
+ rtl::OUStringToOString( makeAbsoluteURL( inPath ),
+ RTL_TEXTENCODING_UTF8 ).getStr(),
+ theLock->token );
+ }
+ else
+ {
+ ne_lock_destroy( theLock );
+
+ OSL_TRACE( "NeonSession::LOCK: obtaining lock for %s failed!",
+ rtl::OUStringToOString( makeAbsoluteURL( inPath ),
+ RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+
+ HandleError( theRetVal, inPath, rEnv );
+}
+
+// -------------------------------------------------------------------
+// LOCK (refresh existing lock)
+// -------------------------------------------------------------------
+sal_Int64 NeonSession::LOCK( const ::rtl::OUString & inPath,
+ sal_Int64 nTimeout,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException )
+{
+ osl::Guard< osl::Mutex > theGuard( m_aMutex );
+
+ // Try to get the neon lock from lock store
+ NeonLock * theLock
+ = m_aNeonLockStore.findByUri( makeAbsoluteURL( inPath ) );
+ if ( !theLock )
+ throw DAVException( DAVException::DAV_NOT_LOCKED );
+
+ Init( rEnv );
+
+ // refresh existing lock.
+ theLock->timeout = static_cast< long >( nTimeout );
+
+ TimeValue startCall;
+ osl_getSystemTime( &startCall );
+
+ int theRetVal = ne_lock_refresh( m_pHttpSession, theLock );
+
+ if ( theRetVal == NE_OK )
+ {
+ m_aNeonLockStore.updateLock( theLock,
+ lastChanceToSendRefreshRequest(
+ startCall, theLock->timeout ) );
+ }
+
+ HandleError( theRetVal, inPath, rEnv );
+
+ return theLock->timeout;
+}
+
+// -------------------------------------------------------------------
+// LOCK (refresh existing lock)
+// -------------------------------------------------------------------
+bool NeonSession::LOCK( NeonLock * pLock,
+ sal_Int32 & rlastChanceToSendRefreshRequest )
+{
+ osl::Guard< osl::Mutex > theGuard( m_aMutex );
+
+#if OSL_DEBUG_LEVEL > 0
+ char * p = ne_uri_unparse( &(pLock->uri) );
+ OSL_TRACE( "NeonSession::LOCK: Refreshing lock for %s.", p );
+ ne_free( p );
+#endif
+
+ // refresh existing lock.
+
+ TimeValue startCall;
+ osl_getSystemTime( &startCall );
+
+ if ( ne_lock_refresh( m_pHttpSession, pLock ) == NE_OK )
+ {
+ rlastChanceToSendRefreshRequest
+ = lastChanceToSendRefreshRequest( startCall, pLock->timeout );
+
+ OSL_TRACE( "Lock successfully refreshed." );
+ return true;
+ }
+ else
+ {
+ OSL_TRACE( "Lock not refreshed!" );
+ return false;
+ }
}
-*/
// -------------------------------------------------------------------
// UNLOCK
// -------------------------------------------------------------------
-// Note: Uncomment the following if locking support is required
-/*
-void NeonSession::UNLOCK( const Lock & inLock,
+void NeonSession::UNLOCK( const ::rtl::OUString & inPath,
const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
osl::Guard< osl::Mutex > theGuard( m_aMutex );
- Init();
+ // get the neon lock from lock store
+ NeonLock * theLock
+ = m_aNeonLockStore.findByUri( makeAbsoluteURL( inPath ) );
+ if ( !theLock )
+ throw DAVException( DAVException::DAV_NOT_LOCKED );
- m_aEnv = rEnv;
+ Init( rEnv );
+
+ int theRetVal = ne_unlock( m_pHttpSession, theLock );
- Lockit( inLock, false );
+ if ( theRetVal == NE_OK )
+ {
+ m_aNeonLockStore.removeLock( theLock );
+ ne_lock_destroy( theLock );
+ }
+ else
+ {
+ OSL_TRACE( "NeonSession::UNLOCK: unlocking of %s failed.",
+ rtl::OUStringToOString( makeAbsoluteURL( inPath ),
+ RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+
+ HandleError( theRetVal, inPath, rEnv );
+}
+
+// -------------------------------------------------------------------
+// UNLOCK
+// -------------------------------------------------------------------
+bool NeonSession::UNLOCK( NeonLock * pLock )
+{
+ osl::Guard< osl::Mutex > theGuard( m_aMutex );
+
+#if OSL_DEBUG_LEVEL > 0
+ char * p = ne_uri_unparse( &(pLock->uri) );
+ OSL_TRACE( "NeonSession::UNLOCK: Unlocking %s.", p );
+ ne_free( p );
+#endif
+
+ if ( ne_unlock( m_pHttpSession, pLock ) == NE_OK )
+ {
+ OSL_TRACE( "UNLOCK succeeded." );
+ return true;
+ }
+ else
+ {
+ OSL_TRACE( "UNLOCK failed!" );
+ return false;
+ }
+}
+
+// -------------------------------------------------------------------
+void NeonSession::abort()
+ throw ( DAVException )
+{
+ // 11.11.09 (tkr): The following code lines causing crashes if
+ // closing a ongoing connection. It turned out that this existing
+ // solution doesn't work in multi-threading environments.
+ // So I disabled them in 3.2. . Issue #73893# should fix it in OOo 3.3.
+ //if ( m_pHttpSession )
+ // ne_close_connection( m_pHttpSession );
}
-*/
// -------------------------------------------------------------------
const ucbhelper::InternetProxyServer & NeonSession::getProxySettings() const
@@ -1479,10 +1688,98 @@ const ucbhelper::InternetProxyServer & NeonSession::getProxySettings() const
}
// -------------------------------------------------------------------
+namespace {
+
+bool containsLocktoken( const uno::Sequence< ucb::Lock > & rLocks,
+ const char * token )
+{
+ for ( sal_Int32 n = 0; n < rLocks.getLength(); ++n )
+ {
+ const uno::Sequence< rtl::OUString > & rTokens
+ = rLocks[ n ].LockTokens;
+ for ( sal_Int32 m = 0; m < rTokens.getLength(); ++m )
+ {
+ if ( rTokens[ m ].equalsAscii( token ) )
+ return true;
+ }
+ }
+ return false;
+}
+
+} // namespace
+
+// -------------------------------------------------------------------
+bool NeonSession::removeExpiredLocktoken( const rtl::OUString & inURL,
+ const DAVRequestEnvironment & rEnv )
+{
+ NeonLock * theLock = m_aNeonLockStore.findByUri( inURL );
+ if ( !theLock )
+ return false;
+
+ // do a lockdiscovery to check whether this lock is still valid.
+ try
+ {
+ // @@@ Alternative: use ne_lock_discover() => less overhead
+
+ std::vector< DAVResource > aResources;
+ std::vector< rtl::OUString > aPropNames;
+ aPropNames.push_back( DAVProperties::LOCKDISCOVERY );
+
+ PROPFIND( rEnv.m_aRequestURI, DAVZERO, aPropNames, aResources, rEnv );
+
+ if ( aResources.size() == 0 )
+ return false;
+
+ std::vector< DAVPropertyValue >::const_iterator it
+ = aResources[ 0 ].properties.begin();
+ std::vector< DAVPropertyValue >::const_iterator end
+ = aResources[ 0 ].properties.end();
+
+ while ( it != end )
+ {
+ if ( (*it).Name.equals( DAVProperties::LOCKDISCOVERY ) )
+ {
+ uno::Sequence< ucb::Lock > aLocks;
+ if ( !( (*it).Value >>= aLocks ) )
+ return false;
+
+ if ( !containsLocktoken( aLocks, theLock->token ) )
+ {
+ // expired!
+ break;
+ }
+
+ // still valid.
+ return false;
+ }
+ ++it;
+ }
+
+ // No lockdiscovery prop in propfind result / locktoken not found
+ // in propfind result -> not locked
+ OSL_TRACE( "NeonSession::removeExpiredLocktoken: Removing "
+ " expired lock token for %s. token: %s",
+ rtl::OUStringToOString( inURL,
+ RTL_TEXTENCODING_UTF8 ).getStr(),
+ theLock->token );
+
+ m_aNeonLockStore.removeLock( theLock );
+ ne_lock_destroy( theLock );
+ return true;
+ }
+ catch ( DAVException const & )
+ {
+ }
+ return false;
+}
+
+// -------------------------------------------------------------------
// HandleError
// Common Error Handler
// -------------------------------------------------------------------
-void NeonSession::HandleError( int nError )
+void NeonSession::HandleError( int nError,
+ const rtl::OUString & inPath,
+ const DAVRequestEnvironment & rEnv )
throw ( DAVException )
{
m_aEnv = DAVRequestEnvironment();
@@ -1491,60 +1788,84 @@ void NeonSession::HandleError( int nError )
switch ( nError )
{
case NE_OK:
- // Cleanup.
return;
case NE_ERROR: // Generic error
{
rtl::OUString aText = rtl::OUString::createFromAscii(
- ne_get_error( m_pHttpSession ) );
- throw DAVException( DAVException::DAV_HTTP_ERROR,
- aText,
- makeStatusCode( aText ) );
- }
+ ne_get_error( m_pHttpSession ) );
+
+ sal_uInt16 code = makeStatusCode( aText );
+
+ if ( code == SC_LOCKED )
+ {
+ if ( m_aNeonLockStore.findByUri(
+ makeAbsoluteURL( inPath ) ) == 0 )
+ {
+ // locked by 3rd party
+ throw DAVException( DAVException::DAV_LOCKED );
+ }
+ else
+ {
+ // locked by ourself
+ throw DAVException( DAVException::DAV_LOCKED_SELF );
+ }
+ }
+ // Special handling for 400 and 412 status codes, which may indicate
+ // that a lock previously obtained by us has been released meanwhile
+ // by the server. Unfortunately, RFC is not clear at this point,
+ // thus server implementations behave different...
+ else if ( code == SC_BAD_REQUEST || code == SC_PRECONDITION_FAILED )
+ {
+ if ( removeExpiredLocktoken( makeAbsoluteURL( inPath ), rEnv ) )
+ throw DAVException( DAVException::DAV_LOCK_EXPIRED );
+ }
+
+ throw DAVException( DAVException::DAV_HTTP_ERROR, aText, code );
+ }
case NE_LOOKUP: // Name lookup failed.
throw DAVException( DAVException::DAV_HTTP_LOOKUP,
NeonUri::makeConnectionEndPointString(
- m_aHostName, m_nPort ) );
+ m_aHostName, m_nPort ) );
case NE_AUTH: // User authentication failed on server
throw DAVException( DAVException::DAV_HTTP_AUTH,
NeonUri::makeConnectionEndPointString(
- m_aHostName, m_nPort ) );
+ m_aHostName, m_nPort ) );
case NE_PROXYAUTH: // User authentication failed on proxy
throw DAVException( DAVException::DAV_HTTP_AUTHPROXY,
NeonUri::makeConnectionEndPointString(
- m_aProxyName, m_nProxyPort ) );
-
+ m_aProxyName, m_nProxyPort ) );
+
case NE_CONNECT: // Could not connect to server
throw DAVException( DAVException::DAV_HTTP_CONNECT,
NeonUri::makeConnectionEndPointString(
- m_aHostName, m_nPort ) );
+ m_aHostName, m_nPort ) );
case NE_TIMEOUT: // Connection timed out
throw DAVException( DAVException::DAV_HTTP_TIMEOUT,
NeonUri::makeConnectionEndPointString(
- m_aHostName, m_nPort ) );
+ m_aHostName, m_nPort ) );
case NE_FAILED: // The precondition failed
throw DAVException( DAVException::DAV_HTTP_FAILED,
NeonUri::makeConnectionEndPointString(
- m_aHostName, m_nPort ) );
+ m_aHostName, m_nPort ) );
case NE_RETRY: // Retry request (ne_end_request ONLY)
throw DAVException( DAVException::DAV_HTTP_RETRY,
NeonUri::makeConnectionEndPointString(
- m_aHostName, m_nPort ) );
+ m_aHostName, m_nPort ) );
case NE_REDIRECT:
{
NeonUri aUri( ne_redirect_location( m_pHttpSession ) );
throw DAVException(
- DAVException::DAV_HTTP_REDIRECT, aUri.GetURI() );
+ DAVException::DAV_HTTP_REDIRECT, aUri.GetURI() );
}
- default:
+ default:
{
OSL_TRACE( "NeonSession::HandleError : Unknown Neon error code!" );
throw DAVException( DAVException::DAV_HTTP_ERROR,
@@ -1554,78 +1875,6 @@ void NeonSession::HandleError( int nError )
}
}
-// Note: Uncomment the following if locking support is required
-/*
-void NeonSession::Lockit( const Lock & inLock, bool inLockit )
- throw ( DAVException )
-{
- osl::Guard< osl::Mutex > theGuard( m_aMutex );
-
- // Create the neon lock
- NeonLock * theLock = new NeonLock;
- int theRetVal;
-
- // Set the lock uri
- NeonUri theUri( inLock.uri );
- theLock->uri = const_cast< char * >
- ( rtl::OUStringToOString(
- theUri.GetPath(), RTL_TEXTENCODING_UTF8 ).getStr() );
-
- if ( inLockit )
- {
- // Set the lock depth
- switch( inLock.depth )
- {
- case DAVZERO:
- case DAVINFINITY:
- theLock->depth = int ( inLock.depth );
- break;
- default:
- throw DAVException( DAVException::DAV_INVALID_ARG );
- break;
- }
-
- // Set the lock scope
- switch ( inLock.scope )
- {
- case EXCLUSIVE:
- theLock->scope = ne_lockscope_exclusive;
- break;
- case SHARED:
- theLock->scope = ne_lockscope_shared;
- break;
- default:
- throw DAVException( DAVException::DAV_INVALID_ARG );
- break;
- }
-
- // Set the lock owner
- const char * theOwner = rtl::OUStringToOString( inLock.owner,
- RTL_TEXTENCODING_UTF8 );
- theLock->owner = const_cast< char * > ( theOwner );
-
- // Set the lock timeout
- // Note: Neon ignores the timeout
- //theLock->timeout = inLock.timeout;
-
- theRetVal = ne_lock( m_pHttpSession, theLock );
- }
- else
- {
-
- // Set the lock token
- rtl::OUString theToken = inLock.locktoken.getConstArray()[ 0 ];
- theLock->token = const_cast< char * >
- ( rtl::OUStringToOString(
- theToken, RTL_TEXTENCODING_UTF8 ).getStr() );
-
- theRetVal = ne_unlock( m_pHttpSession, theLock );
- }
-
- HandleError( theRetVal );
-}
-*/
-
// -------------------------------------------------------------------
namespace {
@@ -1655,7 +1904,7 @@ void runResponseHeaderHandler( void * userdata,
while ( it != end )
{
- // header names are case insensitive
+ // header names are case insensitive
if ( (*it).equalsIgnoreAsciiCase( aHeaderName ) )
{
aHeaderName = (*it);
@@ -1663,7 +1912,7 @@ void runResponseHeaderHandler( void * userdata,
}
++it;
}
-
+
if ( it != end )
bIncludeIt = true;
}
@@ -1702,22 +1951,23 @@ int NeonSession::GET( ne_session * sess,
#if NEON_VERSION < 0x0250
if ( getheaders )
- ne_add_response_header_catcher( req, runResponseHeaderHandler, userdata );
+ ne_add_response_header_catcher(
+ req, runResponseHeaderHandler, userdata );
#endif
- ne_add_response_body_reader( req, ne_accept_2xx, reader, userdata );
+ ne_decompress * dc
+ = ne_decompress_reader( req, ne_accept_2xx, reader, userdata );
ret = ne_request_dispatch( req );
#if NEON_VERSION >= 0x0250
if ( getheaders )
{
- while ((cursor = ne_response_header_iterate(req, cursor, &name, &value))
- != NULL)
+ while ( ( cursor = ne_response_header_iterate(
+ req, cursor, &name, &value ) ) != NULL )
{
char buffer[8192];
-
- ne_snprintf(buffer, sizeof buffer, "%s: %s", name, value);
+ ne_snprintf(buffer, sizeof buffer, "%s: %s", name, value);
runResponseHeaderHandler(userdata, buffer);
}
}
@@ -1725,6 +1975,9 @@ int NeonSession::GET( ne_session * sess,
if ( ret == NE_OK && ne_get_status( req )->klass != 2 )
ret = NE_ERROR;
+ if ( dc != 0 )
+ ne_decompress_destroy(dc);
+
ne_request_destroy( req );
return ret;
}
@@ -1812,10 +2065,11 @@ int NeonSession::POST( ne_session * sess,
// -------------------------------------------------------------------
// static
-bool NeonSession::getDataFromInputStream(
- const uno::Reference< io::XInputStream > & xStream,
- uno::Sequence< sal_Int8 > & rData,
- bool bAppendTrailingZeroByte )
+bool
+NeonSession::getDataFromInputStream(
+ const uno::Reference< io::XInputStream > & xStream,
+ uno::Sequence< sal_Int8 > & rData,
+ bool bAppendTrailingZeroByte )
{
if ( xStream.is() )
{
@@ -1824,9 +2078,9 @@ bool NeonSession::getDataFromInputStream(
{
try
{
- sal_Int32 nSize
+ sal_Int32 nSize
= sal::static_int_cast<sal_Int32>(xSeekable->getLength());
- sal_Int32 nRead
+ sal_Int32 nRead
= xStream->readBytes( rData, nSize );
if ( nRead == nSize )
@@ -1898,32 +2152,56 @@ bool NeonSession::getDataFromInputStream(
}
return false;
}
-// -------------------------------------------------------------------
-//static
-
-NeonSession::Map NeonSession::certMap;
// ---------------------------------------------------------------------
sal_Bool
-NeonSession::isDomainMatch( rtl::OUString certHostName)
+NeonSession::isDomainMatch( rtl::OUString certHostName )
{
rtl::OUString hostName = getHostName();
- if (hostName.equalsIgnoreAsciiCase( certHostName ))
+ if (hostName.equalsIgnoreAsciiCase( certHostName ) )
return sal_True;
-
-
- if ( 0 == certHostName.indexOf( rtl::OUString::createFromAscii( "*" ) ) && hostName.getLength() >= certHostName.getLength() )
+ if ( 0 == certHostName.indexOf( rtl::OUString::createFromAscii( "*" ) ) &&
+ hostName.getLength() >= certHostName.getLength() )
{
rtl::OUString cmpStr = certHostName.copy( 1 );
- if ( hostName.matchIgnoreAsciiCase( cmpStr, hostName.getLength( ) - cmpStr.getLength()) )
+ if ( hostName.matchIgnoreAsciiCase(
+ cmpStr, hostName.getLength() - cmpStr.getLength() ) )
return sal_True;
-
}
-
return sal_False;
}
-
+// ---------------------------------------------------------------------
+rtl::OUString NeonSession::makeAbsoluteURL( rtl::OUString const & rURL ) const
+{
+ try
+ {
+ // Is URL relative or already absolute?
+ if ( rURL[ 0 ] != sal_Unicode( '/' ) )
+ {
+ // absolute.
+ return rtl::OUString( rURL );
+ }
+ else
+ {
+ ne_uri aUri;
+ memset( &aUri, 0, sizeof( aUri ) );
+
+ ne_fill_server_uri( m_pHttpSession, &aUri );
+ aUri.path
+ = ne_strdup( rtl::OUStringToOString(
+ rURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+ NeonUri aNeonUri( &aUri );
+ ne_uri_free( &aUri );
+ return aNeonUri.GetURI();
+ }
+ }
+ catch ( DAVException const & )
+ {
+ }
+ // error.
+ return rtl::OUString();
+}
diff --git a/ucb/source/ucp/webdav/NeonSession.hxx b/ucb/source/ucp/webdav/NeonSession.hxx
index 85daecd8e4..bb6bbbb8d3 100644
--- a/ucb/source/ucp/webdav/NeonSession.hxx
+++ b/ucb/source/ucp/webdav/NeonSession.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -35,10 +35,9 @@
#include <osl/mutex.hxx>
#include "DAVSession.hxx"
#include "NeonTypes.hxx"
+#include "NeonLockStore.hxx"
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-using namespace com::sun::star;
-
namespace ucbhelper { class ProxyDecider; }
namespace webdav_ucp
@@ -51,236 +50,249 @@ namespace webdav_ucp
class NeonSession : public DAVSession
{
- private:
- osl::Mutex m_aMutex;
- static osl::Mutex m_aGlobalMutex;
- rtl::OUString m_aScheme;
- rtl::OUString m_aHostName;
- rtl::OUString m_aProxyName;
- sal_Int32 m_nPort;
- sal_Int32 m_nProxyPort;
- HttpSession * m_pHttpSession;
- void * m_pRequestData;
- const ucbhelper::InternetProxyDecider & m_rProxyDecider;
-
- // @@@ This should really be per-request data. But Neon currently
- // (0.23.5) has no interface for passing per-request user data.
- // Theoretically, a NeonSession instance could handle multiple requests
- // at a time --currently it doesn't. Thus this is not an issue at the
- // moment.
- DAVRequestEnvironment m_aEnv;
-
- // Note: Uncomment the following if locking support is required
- // NeonLockSession * mNeonLockSession;
-
- static bool m_bGlobalsInited;
-
- protected:
- virtual ~NeonSession();
-
- public:
- NeonSession( const rtl::Reference< DAVSessionFactory > & rSessionFactory,
- const rtl::OUString& inUri,
- const ucbhelper::InternetProxyDecider & rProxyDecider )
- throw ( DAVException );
-
- // DAVSession methods
- virtual sal_Bool CanUse( const ::rtl::OUString & inUri );
-
- virtual sal_Bool UsesProxy();
-
- const DAVRequestEnvironment & getRequestEnvironment() const
- { return m_aEnv; }
-
- virtual void
- OPTIONS( const ::rtl::OUString & inPath,
- DAVCapabilities & outCapabilities,
- const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
-
- // allprop & named
- virtual void
- PROPFIND( const ::rtl::OUString & inPath,
- const Depth inDepth,
- const std::vector< ::rtl::OUString > & inPropNames,
- std::vector< DAVResource > & ioResources,
- const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
-
- // propnames
- virtual void
- PROPFIND( const ::rtl::OUString & inPath,
- const Depth inDepth,
- std::vector< DAVResourceInfo >& ioResInfo,
- const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
-
- virtual void
- PROPPATCH( const ::rtl::OUString & inPath,
- const std::vector< ProppatchValue > & inValues,
- const DAVRequestEnvironment & rEnv )
- throw( DAVException );
-
- virtual void
- HEAD( const ::rtl::OUString & inPath,
- const std::vector< ::rtl::OUString > & inHeaderNames,
- DAVResource & ioResource,
- const DAVRequestEnvironment & rEnv )
- throw( DAVException );
-
- virtual com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream >
- GET( const ::rtl::OUString & inPath,
- const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
-
- virtual void
- GET( const ::rtl::OUString & inPath,
- com::sun::star::uno::Reference<
- com::sun::star::io::XOutputStream > & ioOutputStream,
- const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
-
- virtual com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream >
- GET( const ::rtl::OUString & inPath,
- const std::vector< ::rtl::OUString > & inHeaderNames,
- DAVResource & ioResource,
- const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
-
- virtual void
- GET( const ::rtl::OUString & inPath,
- com::sun::star::uno::Reference<
- com::sun::star::io::XOutputStream > & ioOutputStream,
- const std::vector< ::rtl::OUString > & inHeaderNames,
- DAVResource & ioResource,
+private:
+ osl::Mutex m_aMutex;
+ rtl::OUString m_aScheme;
+ rtl::OUString m_aHostName;
+ rtl::OUString m_aProxyName;
+ sal_Int32 m_nPort;
+ sal_Int32 m_nProxyPort;
+ HttpSession * m_pHttpSession;
+ void * m_pRequestData;
+ const ucbhelper::InternetProxyDecider & m_rProxyDecider;
+
+ // @@@ This should really be per-request data. But Neon currently
+ // (0.23.5) has no interface for passing per-request user data.
+ // Theoretically, a NeonSession instance could handle multiple requests
+ // at a time --currently it doesn't. Thus this is not an issue at the
+ // moment.
+ DAVRequestEnvironment m_aEnv;
+
+ static bool m_bGlobalsInited;
+ static osl::Mutex m_aGlobalMutex;
+ static NeonLockStore m_aNeonLockStore;
+
+protected:
+ virtual ~NeonSession();
+
+public:
+ NeonSession( const rtl::Reference< DAVSessionFactory > & rSessionFactory,
+ const rtl::OUString& inUri,
+ const ucbhelper::InternetProxyDecider & rProxyDecider )
+ throw ( DAVException );
+
+ // DAVSession methods
+ virtual sal_Bool CanUse( const ::rtl::OUString & inUri );
+
+ virtual sal_Bool UsesProxy();
+
+ const DAVRequestEnvironment & getRequestEnvironment() const
+ { return m_aEnv; }
+
+ virtual void
+ OPTIONS( const ::rtl::OUString & inPath,
+ DAVCapabilities & outCapabilities,
const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
-
- virtual void
- PUT( const ::rtl::OUString & inPath,
- const com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream > & inInputStream,
- const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
-
- virtual com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream >
- POST( const rtl::OUString & inPath,
- const rtl::OUString & rContentType,
- const rtl::OUString & rReferer,
- const com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream > & inInputStream,
+ throw ( DAVException );
+
+ // allprop & named
+ virtual void
+ PROPFIND( const ::rtl::OUString & inPath,
+ const Depth inDepth,
+ const std::vector< ::rtl::OUString > & inPropNames,
+ std::vector< DAVResource > & ioResources,
const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
+ throw ( DAVException );
- virtual void
- POST( const rtl::OUString & inPath,
- const rtl::OUString & rContentType,
- const rtl::OUString & rReferer,
- const com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream > & inInputStream,
- com::sun::star::uno::Reference<
- com::sun::star::io::XOutputStream > & oOutputStream,
+ // propnames
+ virtual void
+ PROPFIND( const ::rtl::OUString & inPath,
+ const Depth inDepth,
+ std::vector< DAVResourceInfo >& ioResInfo,
const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
+ throw ( DAVException );
- virtual void
- MKCOL( const ::rtl::OUString & inPath,
+ virtual void
+ PROPPATCH( const ::rtl::OUString & inPath,
+ const std::vector< ProppatchValue > & inValues,
const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
-
- virtual void
- COPY( const ::rtl::OUString & inSourceURL,
- const ::rtl::OUString & inDestinationURL,
- const DAVRequestEnvironment & rEnv,
- sal_Bool inOverWrite )
- throw ( DAVException );
-
- virtual void
- MOVE( const ::rtl::OUString & inSourceURL,
- const ::rtl::OUString & inDestinationURL,
- const DAVRequestEnvironment & rEnv,
- sal_Bool inOverWrite )
- throw ( DAVException );
-
- virtual void DESTROY( const ::rtl::OUString & inPath,
- const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
-
- virtual void ABORT()
- throw ( DAVException );
-
- // Note: Uncomment the following if locking support is required
- /*
- virtual void LOCK (const Lock & inLock,
- const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
-
- virtual void UNLOCK (const Lock & inLock,
- const DAVRequestEnvironment & rEnv )
- throw ( DAVException );
- */
-
- // helpers
- const rtl::OUString & getHostName() const { return m_aHostName; }
-
- const ::uno::Reference< ::lang::XMultiServiceFactory > getMSF() { return m_xFactory->getServiceFactory(); }
-
- const void * getRequestData() const { return m_pRequestData; }
-
- sal_Bool isDomainMatch( rtl::OUString certHostName );
-
- private:
- // Initialise "Neon sockets"
- void Init( void )
- throw ( DAVException );
-
- void HandleError( int nError )
- throw ( DAVException );
-
- const ucbhelper::InternetProxyServer & getProxySettings() const;
-
- // Note: Uncomment the following if locking support is required
- // void Lockit( const Lock & inLock, bool inLockit )
- // throw ( DAVException );
-
- // low level GET implementation, used by public GET implementations
- static int GET( ne_session * sess,
- const char * uri,
- ne_block_reader reader,
- bool getheaders,
- void * userdata );
-
- // Buffer-based PUT implementation. Neon only has file descriptor-
- // based API.
- static int PUT( ne_session * sess,
- const char * uri,
- const char * buffer,
- size_t size );
-
- // Buffer-based POST implementation. Neon only has file descriptor-
- // based API.
- int POST( ne_session * sess,
- const char * uri,
- const char * buffer,
- ne_block_reader reader,
- void * userdata,
- const rtl::OUString & rContentType,
- const rtl::OUString & rReferer );
-
- // Helper: XInputStream -> Sequence< sal_Int8 >
- static bool getDataFromInputStream(
- const com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream > & xStream,
- com::sun::star::uno::Sequence< sal_Int8 > & rData,
- bool bAppendTrailingZeroByte );
-
- typedef std::map< ::rtl::OUString, ::rtl::OUString > Map;
- static Map certMap;
+ throw ( DAVException );
+
+ virtual void
+ HEAD( const ::rtl::OUString & inPath,
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource & ioResource,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
+ GET( const ::rtl::OUString & inPath,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ virtual void
+ GET( const ::rtl::OUString & inPath,
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XOutputStream > & ioOutputStream,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
+ GET( const ::rtl::OUString & inPath,
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource & ioResource,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ virtual void
+ GET( const ::rtl::OUString & inPath,
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XOutputStream > & ioOutputStream,
+ const std::vector< ::rtl::OUString > & inHeaderNames,
+ DAVResource & ioResource,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ virtual void
+ PUT( const ::rtl::OUString & inPath,
+ const com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > & inInputStream,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
+ POST( const rtl::OUString & inPath,
+ const rtl::OUString & rContentType,
+ const rtl::OUString & rReferer,
+ const com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > & inInputStream,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ virtual void
+ POST( const rtl::OUString & inPath,
+ const rtl::OUString & rContentType,
+ const rtl::OUString & rReferer,
+ const com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > & inInputStream,
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XOutputStream > & oOutputStream,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ virtual void
+ MKCOL( const ::rtl::OUString & inPath,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ virtual void
+ COPY( const ::rtl::OUString & inSourceURL,
+ const ::rtl::OUString & inDestinationURL,
+ const DAVRequestEnvironment & rEnv,
+ sal_Bool inOverWrite )
+ throw ( DAVException );
+
+ virtual void
+ MOVE( const ::rtl::OUString & inSourceURL,
+ const ::rtl::OUString & inDestinationURL,
+ const DAVRequestEnvironment & rEnv,
+ sal_Bool inOverWrite )
+ throw ( DAVException );
+
+ virtual void DESTROY( const ::rtl::OUString & inPath,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ // set new lock.
+ virtual void LOCK( const ::rtl::OUString & inURL,
+ com::sun::star::ucb::Lock & inLock,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ // refresh existing lock.
+ virtual sal_Int64 LOCK( const ::rtl::OUString & inURL,
+ sal_Int64 nTimeout,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ virtual void UNLOCK( const ::rtl::OUString & inURL,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ // helpers
+ virtual void abort()
+ throw ( DAVException );
+
+ const rtl::OUString & getHostName() const { return m_aHostName; }
+
+ const ::uno::Reference< ::lang::XMultiServiceFactory > getMSF()
+ { return m_xFactory->getServiceFactory(); }
+
+ const void * getRequestData() const { return m_pRequestData; }
+
+ sal_Bool isDomainMatch( rtl::OUString certHostName );
+
+private:
+ friend class NeonLockStore;
+
+ void Init( void )
+ throw ( DAVException );
+
+ void Init( const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ // ret: true => retry request.
+ void HandleError( int nError,
+ const rtl::OUString & inPath,
+ const DAVRequestEnvironment & rEnv )
+ throw ( DAVException );
+
+ const ucbhelper::InternetProxyServer & getProxySettings() const;
+
+ bool removeExpiredLocktoken( const rtl::OUString & inURL,
+ const DAVRequestEnvironment & rEnv );
+
+ // refresh lock, called by NeonLockStore::refreshLocks
+ bool LOCK( NeonLock * pLock,
+ sal_Int32 & rlastChanceToSendRefreshRequest );
+
+ // unlock, called by NeonLockStore::~NeonLockStore
+ bool UNLOCK( NeonLock * pLock );
+
+ // low level GET implementation, used by public GET implementations
+ static int GET( ne_session * sess,
+ const char * uri,
+ ne_block_reader reader,
+ bool getheaders,
+ void * userdata );
+
+ // Buffer-based PUT implementation. Neon only has file descriptor-
+ // based API.
+ static int PUT( ne_session * sess,
+ const char * uri,
+ const char * buffer,
+ size_t size );
+
+ // Buffer-based POST implementation. Neon only has file descriptor-
+ // based API.
+ int POST( ne_session * sess,
+ const char * uri,
+ const char * buffer,
+ ne_block_reader reader,
+ void * userdata,
+ const rtl::OUString & rContentType,
+ const rtl::OUString & rReferer );
+
+ // Helper: XInputStream -> Sequence< sal_Int8 >
+ static bool getDataFromInputStream(
+ const com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > & xStream,
+ com::sun::star::uno::Sequence< sal_Int8 > & rData,
+ bool bAppendTrailingZeroByte );
+
+ rtl::OUString makeAbsoluteURL( rtl::OUString const & rURL ) const;
};
-} // namespace_ucp
+} // namespace webdav_ucp
#endif // _NEONSESSION_HXX_
diff --git a/ucb/source/ucp/webdav/NeonTypes.hxx b/ucb/source/ucp/webdav/NeonTypes.hxx
index 08c7d07460..633864d263 100644
--- a/ucb/source/ucp/webdav/NeonTypes.hxx
+++ b/ucb/source/ucp/webdav/NeonTypes.hxx
@@ -35,6 +35,7 @@
#include <ne_utils.h>
#include <ne_basic.h>
#include <ne_props.h>
+#include <ne_locks.h>
typedef ne_session HttpSession;
typedef ne_status HttpStatus;
@@ -43,4 +44,6 @@ typedef ne_server_capabilities HttpServerCapabilities;
typedef ne_propname NeonPropName;
typedef ne_prop_result_set NeonPropFindResultSet;
+typedef struct ne_lock NeonLock;
+
#endif // _NEONTYPES_HXX_
diff --git a/ucb/source/ucp/webdav/NeonUri.cxx b/ucb/source/ucp/webdav/NeonUri.cxx
index ed8315b1cd..e318cde673 100644
--- a/ucb/source/ucp/webdav/NeonUri.cxx
+++ b/ucb/source/ucp/webdav/NeonUri.cxx
@@ -42,11 +42,6 @@
using namespace webdav_ucp;
- char *scheme;
- char *host, *userinfo;
- unsigned int port;
- char *path, *query, *fragment;
-
# if defined __SUNPRO_CC
// FIXME: not sure whether initializing a ne_uri statically is supposed to work
// the string fields of ne_uri are char*, not const char*
@@ -65,38 +60,38 @@ using namespace webdav_ucp;
namespace {
-const ne_uri g_sUriDefaultsHTTP = { "http",
+const ne_uri g_sUriDefaultsHTTP = { "http",
#if NEON_VERSION >= 0x0260
- NULL,
+ NULL,
#endif
- NULL,
- DEFAULT_HTTP_PORT,
+ NULL,
+ DEFAULT_HTTP_PORT,
#if NEON_VERSION >= 0x0260
- NULL,
+ NULL,
#endif
- NULL,
+ NULL,
NULL };
-const ne_uri g_sUriDefaultsHTTPS = { "https",
+const ne_uri g_sUriDefaultsHTTPS = { "https",
#if NEON_VERSION >= 0x0260
- NULL,
+ NULL,
#endif
- NULL,
- DEFAULT_HTTPS_PORT,
+ NULL,
+ DEFAULT_HTTPS_PORT,
#if NEON_VERSION >= 0x0260
- NULL,
+ NULL,
#endif
- NULL,
+ NULL,
NULL };
-const ne_uri g_sUriDefaultsFTP = { "ftp",
+const ne_uri g_sUriDefaultsFTP = { "ftp",
#if NEON_VERSION >= 0x0260
- NULL,
+ NULL,
#endif
- NULL,
- DEFAULT_FTP_PORT,
+ NULL,
+ DEFAULT_FTP_PORT,
#if NEON_VERSION >= 0x0260
- NULL,
+ NULL,
#endif
- NULL,
+ NULL,
NULL };
} // namespace
@@ -136,7 +131,7 @@ NeonUri::NeonUri( const ne_uri * inUri )
init( rtl::OString( uri ), inUri );
free( uri );
-
+
calculateURI();
}
@@ -149,7 +144,7 @@ NeonUri::NeonUri( const rtl::OUString & inUri )
// #i77023#
rtl::OUString aEscapedUri( ucb_impl::urihelper::encodeURI( inUri ) );
- rtl::OString theInputUri(
+ rtl::OString theInputUri(
aEscapedUri.getStr(), aEscapedUri.getLength(), RTL_TEXTENCODING_UTF8 );
ne_uri theUri;
@@ -196,17 +191,17 @@ void NeonUri::init( const rtl::OString & rUri, const ne_uri * pUri )
RTL_TEXTENCODING_UTF8 );
#if NEON_VERSION >= 0x0260
- if ( pUri->query )
+ if ( pUri->query )
{
mPath += rtl::OUString::createFromAscii( "?" );
- mPath += rtl::OStringToOUString(
+ mPath += rtl::OStringToOUString(
pUri->query, RTL_TEXTENCODING_UTF8 );
}
if ( pUri->fragment )
{
mPath += rtl::OUString::createFromAscii( "#" );
- mPath += rtl::OStringToOUString(
+ mPath += rtl::OStringToOUString(
pUri->fragment, RTL_TEXTENCODING_UTF8 );
}
#endif
@@ -230,7 +225,7 @@ void NeonUri::calculateURI ()
aBuf.appendAscii( "@" );
}
// Is host a numeric IPv6 address?
- if ( ( mHostName.indexOf( ':' ) != -1 ) &&
+ if ( ( mHostName.indexOf( ':' ) != -1 ) &&
( mHostName[ 0 ] != sal_Unicode( '[' ) ) )
{
aBuf.appendAscii( "[" );
@@ -283,7 +278,7 @@ void NeonUri::calculateURI ()
}
if (nPos != -1)
{
- rtl::OUString aTemp(
+ rtl::OUString aTemp(
mPath.copy (nPos + 1, mPath.getLength () - nPos - 1 - nTrail) );
// query, fragment present?
@@ -343,7 +338,7 @@ rtl::OUString NeonUri::makeConnectionEndPointString(
rtl::OUStringBuffer aBuf;
// Is host a numeric IPv6 address?
- if ( ( rHostName.indexOf( ':' ) != -1 ) &&
+ if ( ( rHostName.indexOf( ':' ) != -1 ) &&
( rHostName[ 0 ] != sal_Unicode( '[' ) ) )
{
aBuf.appendAscii( "[" );
diff --git a/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx b/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx
index 012bd85c92..532a6f745b 100644
--- a/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx
+++ b/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -89,12 +89,11 @@ const rtl::OUString UCBDeadPropertyValue::aXMLEnd
extern "C" int UCBDeadPropertyValue_startelement_callback(
void *,
int parent,
- const char *nspace,
+ const char * /*nspace*/,
const char *name,
const char ** )
{
- if ( ( name != 0 ) &&
- ( ( nspace == 0 ) || ( strcmp( nspace, "" ) == 0 ) ) )
+ if ( name != 0 )
{
switch ( parent )
{
@@ -187,7 +186,7 @@ static rtl::OUString encodeValue( const rtl::OUString & rValue )
// PROPPATCH:
// - Encoded property value: x&lt;z
// - UCBDeadPropertyValue::toXML result:
- // <ucbprop><type>string</type><value>x&lt;z</value></ucbprop>
+ // <ucbprop><type>string</type><value>x&lt;z</value></ucbprop>
// PROPFIND:
// - parser replaces &lt; by > ==> error (not well formed)
@@ -361,7 +360,7 @@ bool UCBDeadPropertyValue::supportsType( const uno::Type & rType )
//////////////////////////////////////////////////////////////////////////
// static
bool UCBDeadPropertyValue::createFromXML( const rtl::OString & rInData,
- uno::Any & rOutData )
+ uno::Any & rOutData )
{
bool success = false;
@@ -450,7 +449,7 @@ bool UCBDeadPropertyValue::createFromXML( const rtl::OString & rInData,
//////////////////////////////////////////////////////////////////////////
// static
bool UCBDeadPropertyValue::toXML( const uno::Any & rInData,
- rtl::OUString & rOutData )
+ rtl::OUString & rOutData )
{
// <ucbprop><type>the_type</type><value>the_value</value></ucbprop>
@@ -466,7 +465,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData,
rInData >>= aStringValue;
aStringType = aTypeString;
}
- else if ( rType == getCppuType( static_cast< const sal_Int32 * >( 0 ) ) )
+ else if ( rType == getCppuType( static_cast< const sal_Int32 * >( 0 ) ) )
{
// long
sal_Int32 nValue = 0;
@@ -541,7 +540,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData,
// Encode value! It must not contain XML reserved chars!
aStringValue = encodeValue( aStringValue );
- rOutData = aXMLPre;
+ rOutData = aXMLPre;
rOutData += aStringType;
rOutData += aXMLMid;
rOutData += aStringValue;
diff --git a/ucb/source/ucp/webdav/makefile.mk b/ucb/source/ucp/webdav/makefile.mk
index c8891723cd..848cecd882 100644
--- a/ucb/source/ucp/webdav/makefile.mk
+++ b/ucb/source/ucp/webdav/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2008 by Sun Microsystems, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -87,25 +87,26 @@ CFLAGS+= $(OPENSSL_CFLAGS)
# --- General -----------------------------------------------------
SLOFILES=\
- $(SLO)$/webdavservices.obj \
- $(SLO)$/webdavprovider.obj \
- $(SLO)$/webdavcontent.obj \
- $(SLO)$/webdavcontentcaps.obj \
- $(SLO)$/webdavresultset.obj \
- $(SLO)$/webdavdatasupplier.obj \
- $(SLO)$/ContentProperties.obj \
- $(SLO)$/DAVProperties.obj \
- $(SLO)$/DAVSessionFactory.obj \
- $(SLO)$/DAVResourceAccess.obj \
- $(SLO)$/NeonUri.obj \
- $(SLO)$/NeonInputStream.obj \
- $(SLO)$/NeonPropFindRequest.obj \
- $(SLO)$/NeonHeadRequest.obj \
- $(SLO)$/NeonSession.obj \
- $(SLO)$/DateTimeHelper.obj \
- $(SLO)$/LinkSequence.obj \
- $(SLO)$/LockSequence.obj \
- $(SLO)$/LockEntrySequence.obj \
+ $(SLO)$/webdavservices.obj \
+ $(SLO)$/webdavprovider.obj \
+ $(SLO)$/webdavcontent.obj \
+ $(SLO)$/webdavcontentcaps.obj \
+ $(SLO)$/webdavresultset.obj \
+ $(SLO)$/webdavdatasupplier.obj \
+ $(SLO)$/ContentProperties.obj \
+ $(SLO)$/DAVProperties.obj \
+ $(SLO)$/DAVSessionFactory.obj \
+ $(SLO)$/DAVResourceAccess.obj \
+ $(SLO)$/NeonUri.obj \
+ $(SLO)$/NeonInputStream.obj \
+ $(SLO)$/NeonPropFindRequest.obj \
+ $(SLO)$/NeonHeadRequest.obj \
+ $(SLO)$/NeonSession.obj \
+ $(SLO)$/NeonLockStore.obj \
+ $(SLO)$/DateTimeHelper.obj \
+ $(SLO)$/LinkSequence.obj \
+ $(SLO)$/LockSequence.obj \
+ $(SLO)$/LockEntrySequence.obj \
$(SLO)$/UCBDeadPropertyValue.obj
LIB1TARGET=$(SLB)$/_$(TARGET).lib
@@ -119,17 +120,15 @@ SHL1IMPLIB=i$(TARGET)
SHL1VERSIONMAP=exports.map
SHL1STDLIBS=\
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(UCBHELPERLIB) \
- $(COMPHELPERLIB) \
- $(NEON3RDLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(SALHELPERLIB) \
+ $(UCBHELPERLIB) \
+ $(COMPHELPERLIB) \
+ $(NEON3RDLIB) \
$(LIBXML2LIB)
-
-
.IF "$(GUI)"=="WNT"
SHL1STDLIBS+= $(WSOCK32LIB)
.IF "$(WINDOWS_VISTA_PSDK)" != ""
@@ -150,8 +149,6 @@ SHL1STDLIBS+= $(OPENSSLLIBST)
.ENDIF
.ENDIF # WNT
-
-
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
SHL1LIBS=$(LIB1TARGET)
@@ -165,4 +162,3 @@ DEF1NAME=$(SHL1TARGET)
# --- Targets ----------------------------------------------------------
.INCLUDE: target.mk
-
diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index 9dd59c4441..def33876eb 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -36,13 +36,16 @@
**************************************************************************
*************************************************************************/
-#include <osl/diagnose.h>
+#include <osl/diagnose.h>
#include "osl/doublecheckedlocking.h"
#include <rtl/uri.hxx>
#include <rtl/ustrbuf.hxx>
-#include "com/sun/star/task/XPasswordContainer.hpp"
-#include "com/sun/star/task/NoMasterException.hpp"
+#include <ucbhelper/contentidentifier.hxx>
+#include <ucbhelper/propertyvalueset.hxx>
+#include <ucbhelper/simpleinteractionrequest.hxx>
+#include <ucbhelper/cancelcommandexecution.hxx>
+
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/PropertySetInfoChange.hpp>
#include <com/sun/star/beans/PropertySetInfoChangeEvent.hpp>
@@ -50,39 +53,37 @@
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/lang/IllegalAccessException.hpp>
-#include "com/sun/star/ucb/AuthenticationRequest.hpp"
+#include <com/sun/star/task/PasswordContainerInteractionHandler.hpp>
+#include <com/sun/star/ucb/CommandEnvironment.hpp>
#include <com/sun/star/ucb/CommandFailedException.hpp>
#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
-#ifndef _COM_SUN_STAR_UCB_INTERACTIVEBADTRANSFRERURLEXCEPTION_HPP_
#include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp>
-#endif
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#include "com/sun/star/ucb/InteractiveLockingLockedException.hpp"
+#include "com/sun/star/ucb/InteractiveLockingLockExpiredException.hpp"
+#include "com/sun/star/ucb/InteractiveLockingNotLockedException.hpp"
#include <com/sun/star/ucb/InteractiveNetworkConnectException.hpp>
-#ifndef _COM_SUN_STAR_UCB_INTERACTIVENETWORKGENBERALEXCEPTION_HPP_
#include <com/sun/star/ucb/InteractiveNetworkGeneralException.hpp>
-#endif
#include <com/sun/star/ucb/InteractiveNetworkReadException.hpp>
#include <com/sun/star/ucb/InteractiveNetworkResolveNameException.hpp>
#include <com/sun/star/ucb/InteractiveNetworkWriteException.hpp>
+#include <com/sun/star/ucb/MissingInputStreamException.hpp>
+#include <com/sun/star/ucb/MissingPropertiesException.hpp>
#include <com/sun/star/ucb/NameClash.hpp>
#include <com/sun/star/ucb/NameClashException.hpp>
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
#include <com/sun/star/ucb/OpenMode.hpp>
#include <com/sun/star/ucb/PostCommandArgument2.hpp>
#include <com/sun/star/ucb/TransferInfo.hpp>
-#include <com/sun/star/ucb/XCommandInfo.hpp>
-#include <com/sun/star/ucb/XPersistentPropertySet.hpp>
-#include <com/sun/star/ucb/MissingInputStreamException.hpp>
-#include <com/sun/star/ucb/MissingPropertiesException.hpp>
#include <com/sun/star/ucb/UnsupportedCommandException.hpp>
#include <com/sun/star/ucb/UnsupportedDataSinkException.hpp>
#include <com/sun/star/ucb/UnsupportedNameClashException.hpp>
#include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
-#include <ucbhelper/contentidentifier.hxx>
-#include <ucbhelper/propertyvalueset.hxx>
-#include <ucbhelper/simpleinteractionrequest.hxx>
-#include <ucbhelper/cancelcommandexecution.hxx>
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#include <com/sun/star/ucb/XPersistentPropertySet.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
#include "webdavcontent.hxx"
#include "webdavprovider.hxx"
#include "webdavresultset.hxx"
@@ -96,250 +97,6 @@ using namespace webdav_ucp;
//=========================================================================
//=========================================================================
//
-// CommandEnvironment_Impl Implementation.
-//
-//=========================================================================
-//=========================================================================
-
-class CommandEnvironment_Impl : public cppu::OWeakObject,
- public ucb::XCommandEnvironment,
- public task::XInteractionHandler
-{
-public:
-
- CommandEnvironment_Impl(
- const uno::Reference< lang::XMultiServiceFactory >& xSMgr )
- : m_xSMgr( xSMgr )
- {
- }
-
- // XInterface
- XINTERFACE_DECL()
-
- // XCommandEnvironment
- virtual uno::Reference< task::XInteractionHandler > SAL_CALL
- getInteractionHandler( )
- throw (uno::RuntimeException)
- {
- return this;
- }
-
- virtual uno::Reference< ucb::XProgressHandler > SAL_CALL
- getProgressHandler( )
- throw (uno::RuntimeException)
- {
- return 0;
- }
-
- // XInteractionHandler
- virtual void SAL_CALL
- handle( const uno::Reference< task::XInteractionRequest >& Request )
- throw (uno::RuntimeException);
-
-private:
-
- void
- handleAuthenticationRequest(
- ucb::AuthenticationRequest const&,
- uno::Sequence< uno::Reference< task::XInteractionContinuation > > const&)
- SAL_THROW((uno::RuntimeException))
- {
- }
-
- uno::Reference< lang::XMultiServiceFactory > m_xSMgr;
-};
-
-//=========================================================================
-void SAL_CALL CommandEnvironment_Impl::acquire()
- throw()
-{
- OWeakObject::acquire();
-}
-
-//=========================================================================
-void SAL_CALL CommandEnvironment_Impl::release()
- throw()
-{
- OWeakObject::release();
-}
-
-//=========================================================================
-uno::Any SAL_CALL CommandEnvironment_Impl::queryInterface(
- const uno::Type & rType )
- throw( uno::RuntimeException )
-{
- uno::Any aRet = cppu::queryInterface(
- rType,
- static_cast< ucb::XCommandEnvironment * >( this ),
- static_cast< task::XInteractionHandler * >( this ) );
- return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
-}
-
-//=========================================================================
-void SAL_CALL CommandEnvironment_Impl::handle(
- const uno::Reference< task::XInteractionRequest >& rIRequest )
- throw (uno::RuntimeException)
-{
- if (!rIRequest.is())
- return;
-
- uno::Any aAnyRequest(rIRequest->getRequest());
-
- ucb::AuthenticationRequest rRequest;
- if (!(aAnyRequest >>= rRequest))
- return;
-
- uno::Sequence< uno::Reference< task::XInteractionContinuation > >
- rContinuations = rIRequest->getContinuations();
-
- // get continuations
- uno::Reference< task::XInteractionRetry > xRetry;
- uno::Reference< task::XInteractionAbort > xAbort;
- uno::Reference< ucb::XInteractionSupplyAuthentication >
- xSupplyAuthentication;
-
- for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i) {
- xRetry = uno::Reference< task::XInteractionRetry >(
- rContinuations[i], uno::UNO_QUERY );
- if( xRetry.is() )
- continue;
-
- xAbort = uno::Reference< task::XInteractionAbort >(
- rContinuations[i], uno::UNO_QUERY );
- if (xAbort.is())
- continue;
-
- xSupplyAuthentication
- = uno::Reference< ucb::XInteractionSupplyAuthentication >(
- rContinuations[i], uno::UNO_QUERY );
- if( xSupplyAuthentication.is() )
- continue;
- }
-
- bool bRemember;
- bool bRememberPersistent;
- if (xSupplyAuthentication.is())
- {
- ucb::RememberAuthentication eDefault;
- uno::Sequence< ucb::RememberAuthentication > aModes(
- xSupplyAuthentication->getRememberPasswordModes(eDefault));
- bRemember = eDefault != ucb::RememberAuthentication_NO;
- bRememberPersistent = false;
- for (sal_Int32 i = 0; i < aModes.getLength(); ++i)
- if (aModes[i] == ucb::RememberAuthentication_PERSISTENT)
- {
- bRememberPersistent = true;
- break;
- }
- }
- else
- {
- bRemember = false;
- bRememberPersistent = false;
- }
-
- uno::Reference< task::XPasswordContainer > xContainer;
- try
- {
- xContainer
- = uno::Reference< task::XPasswordContainer >(
- m_xSMgr->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.task.PasswordContainer"))),
- uno::UNO_QUERY);
- }
- catch (uno::Exception const &)
- {
- }
-
- // xContainer works with userName passwdSequences pairs:
- if (xContainer.is() && rRequest.HasUserName && rRequest.HasPassword )
- {
- try
- {
- if (rRequest.UserName.getLength() == 0)
- {
- task::UrlRecord
- aRec(xContainer->find(rRequest.ServerName, this));
- if (aRec.UserList.getLength() != 0)
- {
- if (xSupplyAuthentication->canSetUserName())
- xSupplyAuthentication->
- setUserName(aRec.UserList[0].UserName.getStr());
- if (xSupplyAuthentication->canSetPassword())
- {
- OSL_ENSURE(aRec.UserList[0].Passwords.getLength() != 0,
- "empty password list");
- xSupplyAuthentication->
- setPassword(aRec.UserList[0].Passwords[0].getStr());
- }
- if (aRec.UserList[0].Passwords.getLength() > 1)
- {
- if (rRequest.HasRealm)
- {
- if (xSupplyAuthentication->canSetRealm())
- xSupplyAuthentication->
- setRealm(aRec.UserList[0].Passwords[1].
- getStr());
- }
- else if (xSupplyAuthentication->canSetAccount())
- xSupplyAuthentication->
- setAccount(aRec.UserList[0].Passwords[1].
- getStr());
- }
- xSupplyAuthentication->select();
- return;
- }
- }
- else
- {
- task::UrlRecord
- aRec(xContainer->findForName(rRequest.ServerName,
- rRequest.UserName,
- this));
- if (aRec.UserList.getLength() != 0)
- {
- OSL_ENSURE(aRec.UserList[0].Passwords.getLength() != 0,
- "empty password list");
- if (!rRequest.HasPassword
- || rRequest.Password != aRec.UserList[0].Passwords[0])
- {
- if (xSupplyAuthentication->canSetUserName())
- xSupplyAuthentication->
- setUserName(aRec.UserList[0].UserName.getStr());
- if (xSupplyAuthentication->canSetPassword())
- xSupplyAuthentication->
- setPassword(aRec.UserList[0].Passwords[0].
- getStr());
- if (aRec.UserList[0].Passwords.getLength() > 1)
- {
- if (rRequest.HasRealm)
- {
- if (xSupplyAuthentication->canSetRealm())
- xSupplyAuthentication->
- setRealm(aRec.UserList[0].Passwords[1].
- getStr());
- }
- else if (xSupplyAuthentication->canSetAccount())
- xSupplyAuthentication->
- setAccount(aRec.UserList[0].Passwords[1].
- getStr());
- }
- xSupplyAuthentication->select();
- return;
- }
- }
- }
- }
- catch (task::NoMasterException const &)
- {} // user did not enter master password
- }
- return;
-}
-
-//=========================================================================
-//=========================================================================
-//
// Content Implementation.
//
//=========================================================================
@@ -363,8 +120,8 @@ Content::Content(
try
{
m_xResAccess.reset( new DAVResourceAccess(
- rxSMgr,
- rSessionFactory,
+ rxSMgr,
+ rSessionFactory,
Identifier->getContentIdentifier() ) );
NeonUri aURI( Identifier->getContentIdentifier() );
@@ -439,16 +196,35 @@ uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType )
{
// Note: isFolder may require network activities! So call it only
// if it is really necessary!!!
- uno::Any aRet = cppu::queryInterface(
+ uno::Any aRet = cppu::queryInterface(
rType,
static_cast< ucb::XContentCreator * >( this ) );
if ( aRet.hasValue() )
{
try
{
- return isFolder( new CommandEnvironment_Impl(m_xSMgr) )
- ? aRet
- : uno::Any();
+ uno::Reference< beans::XPropertySet > const xProps(
+ m_xSMgr, uno::UNO_QUERY_THROW );
+ uno::Reference< uno::XComponentContext > xCtx;
+ xCtx.set( xProps->getPropertyValue(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ uno::Reference< task::XInteractionHandler > xIH(
+ task::PasswordContainerInteractionHandler::create( xCtx ) );
+
+ // Supply a command env to isFolder() that contains an interaction
+ // handler that uses the password container service to obtain
+ // credentials without displaying a password gui.
+
+ uno::Reference< ucb::XCommandEnvironment > xCmdEnv(
+ ucb::CommandEnvironment::create(
+ xCtx,
+ xIH,
+ uno::Reference< ucb::XProgressHandler >() ) );
+
+ return isFolder( xCmdEnv ) ? aRet : uno::Any();
}
catch ( uno::RuntimeException const & )
{
@@ -630,17 +406,22 @@ uno::Any SAL_CALL Content::execute(
ucb::CommandAbortedException,
uno::RuntimeException )
{
+ OSL_TRACE( ">>>>> Content::execute: start: command: %s, env: %s",
+ rtl::OUStringToOString( aCommand.Name,
+ RTL_TEXTENCODING_UTF8 ).getStr(),
+ Environment.is() ? "present" : "missing" );
+
uno::Any aRet;
-
+
if ( aCommand.Name.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM( "getPropertyValues" ) ) )
{
- //////////////////////////////////////////////////////////////////
- // getPropertyValues
- //////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////
+ // getPropertyValues
+ //////////////////////////////////////////////////////////////////
uno::Sequence< beans::Property > Properties;
- if ( !( aCommand.Argument >>= Properties ) )
+ if ( !( aCommand.Argument >>= Properties ) )
{
ucbhelper::cancelCommandExecution(
uno::makeAny( lang::IllegalArgumentException(
@@ -652,17 +433,17 @@ uno::Any SAL_CALL Content::execute(
// Unreachable
}
- aRet <<= getPropertyValues( Properties, Environment );
+ aRet <<= getPropertyValues( Properties, Environment );
}
else if ( aCommand.Name.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM( "setPropertyValues" ) ) )
{
- //////////////////////////////////////////////////////////////////
- // setPropertyValues
- //////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////
+ // setPropertyValues
+ //////////////////////////////////////////////////////////////////
uno::Sequence< beans::PropertyValue > aProperties;
- if ( !( aCommand.Argument >>= aProperties ) )
+ if ( !( aCommand.Argument >>= aProperties ) )
{
ucbhelper::cancelCommandExecution(
uno::makeAny( lang::IllegalArgumentException(
@@ -674,7 +455,7 @@ uno::Any SAL_CALL Content::execute(
// Unreachable
}
- if ( !aProperties.getLength() )
+ if ( !aProperties.getLength() )
{
ucbhelper::cancelCommandExecution(
uno::makeAny( lang::IllegalArgumentException(
@@ -713,8 +494,8 @@ uno::Any SAL_CALL Content::execute(
RTL_CONSTASCII_STRINGPARAM( "open" ) ) )
{
//////////////////////////////////////////////////////////////////
- // open
- //////////////////////////////////////////////////////////////////
+ // open
+ //////////////////////////////////////////////////////////////////
ucb::OpenCommandArgument2 aOpenCommand;
if ( !( aCommand.Argument >>= aOpenCommand ) )
@@ -735,11 +516,11 @@ uno::Any SAL_CALL Content::execute(
RTL_CONSTASCII_STRINGPARAM( "insert" ) ) )
{
//////////////////////////////////////////////////////////////////
- // insert
- //////////////////////////////////////////////////////////////////
+ // insert
+ //////////////////////////////////////////////////////////////////
ucb::InsertCommandArgument arg;
- if ( !( aCommand.Argument >>= arg ) )
+ if ( !( aCommand.Argument >>= arg ) )
{
ucbhelper::cancelCommandExecution(
uno::makeAny( lang::IllegalArgumentException(
@@ -751,23 +532,23 @@ uno::Any SAL_CALL Content::execute(
// Unreachable
}
- insert( arg.Data, arg.ReplaceExisting, Environment );
+ insert( arg.Data, arg.ReplaceExisting, Environment );
}
else if ( aCommand.Name.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM( "delete" ) ) )
{
- //////////////////////////////////////////////////////////////////
- // delete
- //////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////
+ // delete
+ //////////////////////////////////////////////////////////////////
- sal_Bool bDeletePhysical = sal_False;
- aCommand.Argument >>= bDeletePhysical;
+ sal_Bool bDeletePhysical = sal_False;
+ aCommand.Argument >>= bDeletePhysical;
-// KSO: Ignore parameter and destroy the content, if you don't support
+// KSO: Ignore parameter and destroy the content, if you don't support
// putting objects into trashcan. ( Since we do not have a trash can
// service yet (src603), you actually have no other choice. )
// if ( bDeletePhysical )
-// {
+// {
try
{
std::auto_ptr< DAVResourceAccess > xResAccess;
@@ -815,7 +596,7 @@ uno::Any SAL_CALL Content::execute(
Environment );
// Unreachable
}
-
+
transfer( transferArgs, Environment );
}
else if ( aCommand.Name.equalsAsciiL(
@@ -823,8 +604,8 @@ uno::Any SAL_CALL Content::execute(
{
//////////////////////////////////////////////////////////////////
// post
- //////////////////////////////////////////////////////////////////
-
+ //////////////////////////////////////////////////////////////////
+
ucb::PostCommandArgument2 aArg;
if ( !( aCommand.Argument >>= aArg ) )
{
@@ -840,20 +621,67 @@ uno::Any SAL_CALL Content::execute(
post( aArg, Environment );
}
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "lock" ) ) &&
+ supportsExclusiveWriteLock( Environment ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // lock
+ //////////////////////////////////////////////////////////////////
+
+ lock( Environment );
+ }
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "unlock" ) ) &&
+ supportsExclusiveWriteLock( Environment ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // unlock
+ //////////////////////////////////////////////////////////////////
+
+ unlock( Environment );
+ }
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) ) &&
+ isFolder( Environment ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // createNewContent
+ //////////////////////////////////////////////////////////////////
+
+ ucb::ContentInfo aArg;
+ if ( !( aCommand.Argument >>= aArg ) )
+ {
+ ucbhelper::cancelCommandExecution(
+ uno::makeAny( lang::IllegalArgumentException(
+ rtl::OUString::createFromAscii(
+ "Wrong argument type!" ),
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ // Unreachable
+ }
+
+ aRet = uno::makeAny( createNewContent( aArg ) );
+ }
else
{
- //////////////////////////////////////////////////////////////////
- // Unsupported command
- //////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////
+ // Unsupported command
+ //////////////////////////////////////////////////////////////////
ucbhelper::cancelCommandExecution(
uno::makeAny( ucb::UnsupportedCommandException(
- rtl::OUString(),
- static_cast< cppu::OWeakObject * >( this ) ) ),
+ aCommand.Name,
+ static_cast< cppu::OWeakObject * >( this ) ) ),
Environment );
// Unreachable
}
+ OSL_TRACE( "<<<<< Content::execute: end: command: %s",
+ rtl::OUStringToOString( aCommand.Name,
+ RTL_TEXTENCODING_UTF8 ).getStr() );
+
return aRet;
}
@@ -863,19 +691,22 @@ void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ )
throw( uno::RuntimeException )
{
try
+ {
+ std::auto_ptr< DAVResourceAccess > xResAccess;
{
- std::auto_ptr< DAVResourceAccess > xResAccess;
- {
- osl::MutexGuard aGuard( m_aMutex );
- xResAccess.reset(
- new DAVResourceAccess( *m_xResAccess.get() ) );
- }
- xResAccess->ABORT();
+ osl::MutexGuard aGuard( m_aMutex );
+ xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
}
- catch ( DAVException const & /*e*/ )
+ xResAccess->abort();
{
- // ABORT command failed!
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) );
}
+ }
+ catch ( DAVException const & )
+ {
+ // abort failed!
+ }
}
//=========================================================================
@@ -893,8 +724,8 @@ void SAL_CALL Content::addProperty( const rtl::OUString& Name,
lang::IllegalArgumentException,
uno::RuntimeException )
{
-// if ( m_bTransient )
-// @@@ ???
+// if ( m_bTransient )
+// @@@ ???
if ( !Name.getLength() )
throw lang::IllegalArgumentException();
@@ -902,8 +733,8 @@ void SAL_CALL Content::addProperty( const rtl::OUString& Name,
// Check property type.
if ( !UCBDeadPropertyValue::supportsType( DefaultValue.getValueType() ) )
{
- OSL_ENSURE( sal_False, "Content::addProperty - "
- "Unsupported property type!" );
+ OSL_ENSURE( sal_False,
+ "Content::addProperty - Unsupported property type!" );
throw beans::IllegalTypeException();
}
@@ -950,10 +781,10 @@ void SAL_CALL Content::addProperty( const rtl::OUString& Name,
// Notify propertyset info change listeners.
beans::PropertySetInfoChangeEvent evt(
- static_cast< cppu::OWeakObject * >( this ),
- Name,
- -1, // No handle available
- beans::PropertySetInfoChange::PROPERTY_INSERTED );
+ static_cast< cppu::OWeakObject * >( this ),
+ Name,
+ -1, // No handle available
+ beans::PropertySetInfoChange::PROPERTY_INSERTED );
notifyPropertySetInfoChange( evt );
}
catch ( DAVException const & e )
@@ -961,9 +792,9 @@ void SAL_CALL Content::addProperty( const rtl::OUString& Name,
if ( e.getStatus() == SC_FORBIDDEN )
{
// Support for setting arbitrary dead properties is optional!
-
+
// Store property locally.
- ContentImplHelper::addProperty(
+ ContentImplHelper::addProperty(
Name, Attributes, DefaultValue );
}
else
@@ -978,7 +809,7 @@ void SAL_CALL Content::addProperty( const rtl::OUString& Name,
case UNKNOWN:
case DAV:
throw lang::IllegalArgumentException();
-
+
case FTP:
case NON_DAV:
// Store property locally.
@@ -1029,7 +860,7 @@ void SAL_CALL Content::removeProperty( const rtl::OUString& Name )
{
beans::Property aProp
= getPropertySetInfo( xEnv, sal_False /* don't cache data */ )
- ->getPropertyByName( Name );
+ ->getPropertyByName( Name );
if ( !( aProp.Attributes & beans::PropertyAttribute::REMOVEABLE ) )
{
@@ -1039,7 +870,7 @@ void SAL_CALL Content::removeProperty( const rtl::OUString& Name )
}
catch ( beans::UnknownPropertyException const & )
{
-// OSL_ENSURE( sal_False, "removeProperty - Unknown property!" );
+ //OSL_ENSURE( sal_False, "removeProperty - Unknown property!" );
throw;
}
#endif
@@ -1053,7 +884,7 @@ void SAL_CALL Content::removeProperty( const rtl::OUString& Name )
std::vector< ProppatchValue > aProppatchValues;
ProppatchValue aValue( PROPREMOVE, Name, uno::Any() );
aProppatchValues.push_back( aValue );
-
+
// Remove property value from server.
std::auto_ptr< DAVResourceAccess > xResAccess;
{
@@ -1079,7 +910,7 @@ void SAL_CALL Content::removeProperty( const rtl::OUString& Name )
if ( e.getStatus() == SC_FORBIDDEN )
{
// Support for setting arbitrary dead properties is optional!
-
+
// Try to remove property from local store.
ContentImplHelper::removeProperty( Name );
}
@@ -1139,9 +970,9 @@ Content::queryCreatableContentsInfo()
throw( uno::RuntimeException )
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
-
+
uno::Sequence< ucb::ContentInfo > aSeq( 2 );
-
+
// document.
aSeq.getArray()[ 0 ].Type
= rtl::OUString::createFromAscii( WEBDAV_CONTENT_TYPE );
@@ -1270,7 +1101,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
const rtl::Reference< ::ucbhelper::ContentProviderImplHelper >& rProvider,
const rtl::OUString& rContentId )
{
- // Note: Empty sequence means "get values of all supported properties".
+ // Note: Empty sequence means "get values of all supported properties".
rtl::Reference< ::ucbhelper::PropertyValueSet > xRow
= new ::ucbhelper::PropertyValueSet( rSMgr );
@@ -1279,10 +1110,10 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
if ( nCount )
{
uno::Reference< beans::XPropertySet > xAdditionalPropSet;
- sal_Bool bTriedToGetAdditonalPropSet = sal_False;
+ sal_Bool bTriedToGetAdditonalPropSet = sal_False;
const beans::Property* pProps = rProperties.getConstArray();
- for ( sal_Int32 n = 0; n < nCount; ++n )
+ for ( sal_Int32 n = 0; n < nCount; ++n )
{
const beans::Property& rProp = pProps[ n ];
@@ -1338,9 +1169,9 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
// Append all local Additional Properties.
uno::Reference< beans::XPropertySet > xSet(
- rProvider->getAdditionalPropertySet( rContentId, sal_False ),
- uno::UNO_QUERY );
- xRow->appendPropertySet( xSet );
+ rProvider->getAdditionalPropertySet( rContentId, sal_False ),
+ uno::UNO_QUERY );
+ xRow->appendPropertySet( xSet );
}
return uno::Reference< sdbc::XRow >( xRow.get() );
@@ -1357,8 +1188,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
std::auto_ptr< DAVResourceAccess > xResAccess;
rtl::OUString aEscapedTitle;
bool bHasAll = false;
- uno::Reference< lang::XMultiServiceFactory > xSMgr;
- uno::Reference< ucb::XContentIdentifier > xIdentifier;
+ uno::Reference< lang::XMultiServiceFactory > xSMgr;
+ uno::Reference< ucb::XContentIdentifier > xIdentifier;
rtl::Reference< ::ucbhelper::ContentProviderImplHelper > xProvider;
{
@@ -1400,68 +1231,73 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
if ( DAV == rType )
{
- // cache lookup... getResourceType may fill the props cache via PROPFIND!
+ // cache lookup... getResourceType may fill the props cache via
+ // PROPFIND!
if ( m_xCachedProps.get() )
{
- xCachedProps.reset( new ContentProperties( *m_xCachedProps.get() ) );
-
+ xCachedProps.reset(
+ new ContentProperties( *m_xCachedProps.get() ) );
+
std::vector< rtl::OUString > aMissingProps;
- if ( xCachedProps->containsAllNames( rProperties, aMissingProps ) )
+ if ( xCachedProps->containsAllNames(
+ rProperties, aMissingProps ) )
{
- // All properties are already in cache! No server access needed.
+ // All properties are already in cache! No server access
+ // needed.
bHasAll = true;
}
-
+
// use the cached ContentProperties instance
xProps.reset( new ContentProperties( *xCachedProps.get() ) );
}
-
+
if ( !bHasAll )
{
// Only DAV resources support PROPFIND
std::vector< rtl::OUString > aPropNames;
-
- uno::Sequence< beans::Property > aProperties( rProperties.getLength() );
+
+ uno::Sequence< beans::Property > aProperties(
+ rProperties.getLength() );
if ( m_aFailedPropNames.size() > 0 )
- {
+ {
sal_Int32 nProps = 0;
sal_Int32 nCount = rProperties.getLength();
for ( sal_Int32 n = 0; n < nCount; ++n )
{
const rtl::OUString & rName = rProperties[ n ].Name;
-
+
std::vector< rtl::OUString >::const_iterator it
= m_aFailedPropNames.begin();
std::vector< rtl::OUString >::const_iterator end
= m_aFailedPropNames.end();
-
+
while ( it != end )
{
if ( *it == rName )
break;
-
+
++it;
}
-
+
if ( it == end )
{
aProperties[ nProps ] = rProperties[ n ];
nProps++;
}
}
-
+
aProperties.realloc( nProps );
}
else
{
aProperties = rProperties;
}
-
+
if ( aProperties.getLength() > 0 )
- ContentProperties::UCBNamesToDAVNames(
+ ContentProperties::UCBNamesToDAVNames(
aProperties, aPropNames );
-
+
if ( aPropNames.size() > 0 )
{
std::vector< DAVResource > resources;
@@ -1469,22 +1305,23 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
{
xResAccess->PROPFIND(
DAVZERO, aPropNames, resources, xEnv );
-
+
if ( 1 == resources.size() )
{
if ( xProps.get())
- xProps->addProperties(
- aPropNames, ContentProperties( resources[ 0 ] ));
+ xProps->addProperties(
+ aPropNames,
+ ContentProperties( resources[ 0 ] ));
else
- xProps.reset(
+ xProps.reset(
new ContentProperties( resources[ 0 ] ) );
}
}
catch ( DAVException const & e )
{
bNetworkAccessAllowed
- = shouldAccessNetworkAfterException( e );
-
+ = shouldAccessNetworkAfterException( e );
+
if ( !bNetworkAccessAllowed )
{
cancelCommandExecution( e, xEnv );
@@ -1501,7 +1338,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
std::vector< rtl::OUString > aMissingProps;
if ( !( xProps.get()
&& xProps->containsAllNames(
- rProperties, aMissingProps ) )
+ rProperties, aMissingProps ) )
&& !m_bDidGetOrHead )
{
// Possibly the missing props can be obtained using a HEAD
@@ -1520,19 +1357,19 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
DAVResource resource;
xResAccess->HEAD( aHeaderNames, resource, xEnv );
m_bDidGetOrHead = true;
-
+
if ( xProps.get() )
xProps->addProperties(
- aMissingProps,
- ContentProperties( resource ) );
+ aMissingProps,
+ ContentProperties( resource ) );
else
xProps.reset ( new ContentProperties( resource ) );
if ( m_eResourceType == NON_DAV )
xProps->addProperties( aMissingProps,
ContentProperties(
- aEscapedTitle,
- false ) );
+ aEscapedTitle,
+ false ) );
}
catch ( DAVException const & e )
{
@@ -1548,15 +1385,15 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
}
}
}
+
// might trigger HTTP redirect.
- // Therefore, title must be upadated here.
+ // Therefore, title must be updated here.
NeonUri aUri( xResAccess->getURL() );
aEscapedTitle = aUri.GetPathBaseName();
if ( UNKNOWN == rType )
{
- xProps.reset(
- new ContentProperties( aEscapedTitle ) );
+ xProps.reset( new ContentProperties( aEscapedTitle ) );
}
// For DAV resources we only know the Title, for non-DAV
@@ -1565,32 +1402,30 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
{
//xProps.reset(
// new ContentProperties( aEscapedTitle ) );
- xProps->addProperty( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "Title" )),
- uno::makeAny( aEscapedTitle), true);
+ xProps->addProperty(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
+ uno::makeAny( aEscapedTitle ),
+ true );
}
else
{
if ( !xProps.get() )
- xProps.reset(
- new ContentProperties( aEscapedTitle, false ) );
+ xProps.reset( new ContentProperties( aEscapedTitle, false ) );
else
- xProps->addProperty( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "Title" )),
- uno::makeAny( aEscapedTitle), true);
+ xProps->addProperty(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
+ uno::makeAny( aEscapedTitle ),
+ true );
- xProps->addProperty( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "IsFolder" )),
- uno::makeAny( false), true);
- xProps->addProperty( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "IsDocument" )),
- uno::makeAny( true), true);
-
- }
+ xProps->addProperty(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
+ uno::makeAny( false ),
+ true );
+ xProps->addProperty(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
+ uno::makeAny( true ),
+ true );
+ }
}
else
{
@@ -1601,18 +1436,37 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
m_bCollection ) );
}
- // Add BaseURI property, if requested.
- if ( !xProps->contains(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BaseURI" ) ) ) )
+ sal_Int32 nCount = rProperties.getLength();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
{
- xProps->addProperty( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "BaseURI" ) ),
- uno::makeAny(
- getBaseURI( xResAccess ) ),
- true );
+ const rtl::OUString rName = rProperties[ n ].Name;
+ if ( rName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "BaseURI" ) ) )
+ {
+ // Add BaseURI property, if requested.
+ xProps->addProperty(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BaseURI" ) ),
+ uno::makeAny( getBaseURI( xResAccess ) ),
+ true );
+ }
+ else if ( rName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
+ {
+ // Add CreatableContentsInfo property, if requested.
+ sal_Bool bFolder = sal_False;
+ xProps->getValue(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ) )
+ >>= bFolder;
+ xProps->addProperty(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "CreatableContentsInfo" ) ),
+ uno::makeAny( bFolder
+ ? queryCreatableContentsInfo()
+ : uno::Sequence< ucb::ContentInfo >() ),
+ true );
+ }
}
-
+
uno::Reference< sdbc::XRow > xResultRow
= getPropertyValues( xSMgr,
rProperties,
@@ -1622,12 +1476,12 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
-
+
if ( !m_xCachedProps.get() )
m_xCachedProps.reset( new ContentProperties( *xProps.get() ) );
else
m_xCachedProps->addProperties( *xProps.get() );
-
+
m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) );
m_aEscapedTitle = aEscapedTitle;
}
@@ -1663,10 +1517,10 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
beans::PropertyChangeEvent aEvent;
aEvent.Source = static_cast< cppu::OWeakObject * >( this );
- aEvent.Further = sal_False;
+ aEvent.Further = sal_False;
// aEvent.PropertyName =
aEvent.PropertyHandle = -1;
- // aEvent.OldValue =
+ // aEvent.OldValue =
// aEvent.NewValue =
std::vector< ProppatchValue > aProppatchValues;
@@ -1724,7 +1578,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
static_cast< cppu::OWeakObject * >( this ) );
}
else if ( rName.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) )
+ RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) )
{
// Read-only property!
aRet[ n ] <<= lang::IllegalAccessException(
@@ -1740,17 +1594,17 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
// No empty titles!
if ( aNewValue.getLength() > 0 )
{
- try
+ try
{
NeonUri aURI( xIdentifier->getContentIdentifier() );
aOldTitle = aURI.GetPathBaseNameUnescaped();
-
+
if ( aNewValue != aOldTitle )
{
// modified title -> modified URL -> exchange !
if ( !bTransient )
bExchange = sal_True;
-
+
// new value will be set later...
aNewTitle = aNewValue;
@@ -1843,6 +1697,15 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
"Property is read-only!" ),
static_cast< cppu::OWeakObject * >( this ) );
}
+ if ( rName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) )
+ {
+ // Read-only property!
+ aRet[ n ] <<= lang::IllegalAccessException(
+ rtl::OUString::createFromAscii(
+ "Property is read-only!" ),
+ static_cast< cppu::OWeakObject * >( this ) );
+ }
else
{
if ( getResourceType( xEnv, xResAccess ) == DAV )
@@ -1920,7 +1783,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
{
// Set property values at server.
xResAccess->PROPPATCH( aProppatchValues, xEnv );
-
+
std::vector< ProppatchValue >::const_iterator it
= aProppatchValues.begin();
std::vector< ProppatchValue >::const_iterator end
@@ -1931,7 +1794,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
aEvent.PropertyName = (*it).name;
aEvent.OldValue = uno::Any(); // @@@ to expensive to obtain!
aEvent.NewValue = (*it).value;
-
+
aChanges.getArray()[ nChanged ] = aEvent;
nChanged++;
@@ -1953,7 +1816,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
= aProppatchPropsPositions.begin();
std::vector< sal_Int32 >::const_iterator end
= aProppatchPropsPositions.end();
-
+
while ( it != end )
{
// Set error.
@@ -1989,28 +1852,28 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
// @@@ Should check for resources that could not be moved
// (due to source access or target overwrite) and send
// this information through the interaction handler.
-
+
// @@@ Existing content should be checked to see if it needs
// to be deleted at the source
-
+
// @@@ Existing content should be checked to see if it has
// been overwritten at the target
-
+
if ( exchangeIdentity( xNewId ) )
{
xResAccess->setURL( aNewURL );
-
+
// DAV resources store all additional props on server!
-// // Adapt Additional Core Properties.
-// renameAdditionalPropertySet( xOldId->getContentIdentifier(),
-// xNewId->getContentIdentifier(),
-// sal_True );
+// // Adapt Additional Core Properties.
+// renameAdditionalPropertySet( xOldId->getContentIdentifier(),
+// xNewId->getContentIdentifier(),
+// sal_True );
}
else
{
// Do not set new title!
aNewTitle = rtl::OUString();
-
+
// Set error .
aRet[ nTitlePos ] <<= uno::Exception(
rtl::OUString::createFromAscii( "Exchange failed!" ),
@@ -2026,7 +1889,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
aRet[ nTitlePos ] <<= MapDAVException( e, sal_True );
}
}
-
+
if ( aNewTitle.getLength() )
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -2035,16 +1898,16 @@ uno::Sequence< uno::Any > Content::setPropertyValues(
aEvent.OldValue = uno::makeAny( aOldTitle );
aEvent.NewValue = uno::makeAny( aNewTitle );
- m_aEscapedTitle = NeonUri::escapeSegment( aNewTitle );
-
+ m_aEscapedTitle = NeonUri::escapeSegment( aNewTitle );
+
aChanges.getArray()[ nChanged ] = aEvent;
nChanged++;
}
if ( nChanged > 0 )
{
- aChanges.realloc( nChanged );
- notifyPropertiesChange( aChanges );
+ aChanges.realloc( nChanged );
+ notifyPropertiesChange( aChanges );
}
{
@@ -2144,17 +2007,18 @@ uno::Any Content::open(
xResAccess->GET( xOut, aHeaders, aResource, xEnv );
m_bDidGetOrHead = true;
-
+
{
osl::MutexGuard aGuard( m_aMutex );
// cache headers.
if ( !m_xCachedProps.get())
- m_xCachedProps.reset( new ContentProperties( aResource ) );
+ m_xCachedProps.reset(
+ new ContentProperties( aResource ) );
else
m_xCachedProps->addProperties( aResource );
- m_xResAccess.reset(
+ m_xResAccess.reset(
new DAVResourceAccess( *xResAccess.get() ) );
}
}
@@ -2178,7 +2042,7 @@ uno::Any Content::open(
{
osl::MutexGuard aGuard( m_aMutex );
- xResAccess.reset(
+ xResAccess.reset(
new DAVResourceAccess( *m_xResAccess.get() ) );
}
@@ -2189,17 +2053,19 @@ uno::Any Content::open(
uno::Reference< io::XInputStream > xIn
= xResAccess->GET( aHeaders, aResource, xEnv );
m_bDidGetOrHead = true;
-
+
{
osl::MutexGuard aGuard( m_aMutex );
-
+
// cache headers.
if ( !m_xCachedProps.get())
- m_xCachedProps.reset( new ContentProperties( aResource ) );
+ m_xCachedProps.reset(
+ new ContentProperties( aResource ) );
else
- m_xCachedProps->addProperties( aResource.properties );
-
- m_xResAccess.reset(
+ m_xCachedProps->addProperties(
+ aResource.properties );
+
+ m_xResAccess.reset(
new DAVResourceAccess( *xResAccess.get() ) );
}
@@ -2245,7 +2111,7 @@ void Content::post(
std::auto_ptr< DAVResourceAccess > xResAccess;
{
osl::MutexGuard aGuard( m_aMutex );
- xResAccess.reset(
+ xResAccess.reset(
new DAVResourceAccess( *m_xResAccess.get() ) );
}
@@ -2254,10 +2120,10 @@ void Content::post(
rArg.Referer,
rArg.Source,
xEnv );
-
+
{
osl::MutexGuard aGuard( m_aMutex );
- m_xResAccess.reset(
+ m_xResAccess.reset(
new DAVResourceAccess( *xResAccess.get() ) );
}
@@ -2279,7 +2145,7 @@ void Content::post(
std::auto_ptr< DAVResourceAccess > xResAccess;
{
osl::MutexGuard aGuard( m_aMutex );
- xResAccess.reset(
+ xResAccess.reset(
new DAVResourceAccess( *m_xResAccess.get() ) );
}
@@ -2291,7 +2157,7 @@ void Content::post(
{
osl::MutexGuard aGuard( m_aMutex );
- m_xResAccess.reset(
+ m_xResAccess.reset(
new DAVResourceAccess( *xResAccess.get() ) );
}
}
@@ -2327,7 +2193,7 @@ void Content::queryChildren( ContentRefList& rChildren )
rtl::OUString aURL = m_xIdentifier->getContentIdentifier();
sal_Int32 nURLPos = aURL.lastIndexOf( '/' );
-
+
if ( nURLPos != ( aURL.getLength() - 1 ) )
{
// No trailing slash found. Append.
@@ -2335,7 +2201,7 @@ void Content::queryChildren( ContentRefList& rChildren )
}
sal_Int32 nLen = aURL.getLength();
-
+
::ucbhelper::ContentRefList::const_iterator it = aAllContents.begin();
::ucbhelper::ContentRefList::const_iterator end = aAllContents.end();
@@ -2344,14 +2210,14 @@ void Content::queryChildren( ContentRefList& rChildren )
::ucbhelper::ContentImplHelperRef xChild = (*it);
rtl::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 ) ) )
{
@@ -2407,17 +2273,17 @@ void Content::insert(
{
/* [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
- 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.
*/
// ==> Complain on PUT, continue on MKCOL.
@@ -2493,13 +2359,13 @@ void Content::insert(
rtl::OUString aURL = getParentURL();
if ( aURL.lastIndexOf( '/' ) != ( aURL.getLength() - 1 ) )
aURL += rtl::OUString::createFromAscii( "/" );
-
+
aURL += aEscapedTitle;
-
+
try
{
xResAccess->setURL( aURL );
-
+
if ( bCollection )
xResAccess->MKCOL( Environment );
else
@@ -2527,16 +2393,16 @@ void Content::insert(
cancelCommandExecution( e, Environment, sal_True );
// Unreachable
}
-
+
// Insert (recursion!).
insert( xInputStream, bReplaceExisting, Environment );
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
- m_xResAccess.reset(
+ m_xResAccess.reset(
new DAVResourceAccess( *xResAccess.get() ) );
}
-
+
// Success!
return;
}
@@ -2564,19 +2430,19 @@ void Content::insert(
}
}
}
-
+
cancelCommandExecution( except, Environment, sal_True );
// Unreachable
}
-
+
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
- m_xIdentifier
+ m_xIdentifier
= new ::ucbhelper::ContentIdentifier( m_xSMgr, aURL );
}
-
+
inserted();
-
+
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
m_bTransient = sal_False;
@@ -2594,7 +2460,7 @@ void Content::insert(
Environment );
// Unreachable
}
-
+
try
{
xResAccess->PUT( xInputStream, Environment );
@@ -2686,7 +2552,7 @@ void Content::transfer(
RTL_CONSTASCII_STRINGPARAM( DAV_URL_SCHEME ) ) )
targetURI.SetScheme(
rtl::OUString::createFromAscii( HTTP_URL_SCHEME ) );
-
+
// @@@ This implementation of 'transfer' only works
// if the source and target are located at same host.
// (Neon does not support cross-server copy/move)
@@ -2868,14 +2734,14 @@ void Content::destroy( sal_Bool bDeletePhysical )
uno::Reference< ucb::XContent > xThis = this;
deleted();
-
+
osl::Guard< osl::Mutex > aGuard( m_aMutex );
-
+
// Process instanciated children...
::webdav_ucp::Content::ContentRefList aChildren;
queryChildren( aChildren );
-
+
ContentRefList::const_iterator it = aChildren.begin();
ContentRefList::const_iterator end = aChildren.end();
@@ -2887,12 +2753,105 @@ void Content::destroy( sal_Bool bDeletePhysical )
}
//=========================================================================
+bool Content::supportsExclusiveWriteLock(
+ const uno::Reference< ucb::XCommandEnvironment >& Environment )
+{
+ if ( getResourceType( Environment ) == DAV )
+ {
+ if ( m_xCachedProps.get() )
+ {
+ uno::Sequence< ucb::LockEntry > aSupportedLocks;
+ if ( m_xCachedProps->getValue( DAVProperties::SUPPORTEDLOCK )
+ >>= aSupportedLocks )
+ {
+ for ( sal_Int32 n = 0; n < aSupportedLocks.getLength(); ++n )
+ {
+ if ( aSupportedLocks[ n ].Scope
+ == ucb::LockScope_EXCLUSIVE &&
+ aSupportedLocks[ n ].Type
+ == ucb::LockType_WRITE )
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
+//=========================================================================
+void Content::lock(
+ const uno::Reference< ucb::XCommandEnvironment >& Environment )
+ throw( uno::Exception )
+{
+ try
+ {
+ std::auto_ptr< DAVResourceAccess > xResAccess;
+ {
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+ }
+
+ uno::Any aOwnerAny;
+ aOwnerAny
+ <<= rtl::OUString::createFromAscii( "http://ucb.openoffice.org" );
+
+ ucb::Lock aLock(
+ ucb::LockScope_EXCLUSIVE,
+ ucb::LockType_WRITE,
+ ucb::LockDepth_ZERO,
+ aOwnerAny,
+ 180, // lock timeout in secs
+ //-1, // infinite lock
+ uno::Sequence< ::rtl::OUString >() );
+
+ xResAccess->LOCK( aLock, Environment );
+
+ {
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) );
+ }
+ }
+ catch ( DAVException const & e )
+ {
+ cancelCommandExecution( e, Environment, sal_False );
+ // Unreachable
+ }
+}
+
+//=========================================================================
+void Content::unlock(
+ const uno::Reference< ucb::XCommandEnvironment >& Environment )
+ throw( uno::Exception )
+{
+ try
+ {
+ std::auto_ptr< DAVResourceAccess > xResAccess;
+ {
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
+ }
+
+ xResAccess->UNLOCK( Environment );
+
+ {
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) );
+ }
+ }
+ catch ( DAVException const & e )
+ {
+ cancelCommandExecution( e, Environment, sal_False );
+ // Unreachable
+ }
+}
+
+//=========================================================================
sal_Bool Content::exchangeIdentity(
const uno::Reference< ucb::XContentIdentifier >& xNewId )
{
if ( !xNewId.is() )
return sal_False;
-
+
osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
uno::Reference< ucb::XContent > xThis = this;
@@ -2907,7 +2866,7 @@ sal_Bool Content::exchangeIdentity(
// Exchange own identitity.
// Fail, if a content with given id already exists.
-// if ( !hasData( xNewId ) )
+// if ( !hasData( xNewId ) )
{
rtl::OUString aOldURL = m_xIdentifier->getContentIdentifier();
@@ -2915,10 +2874,10 @@ sal_Bool Content::exchangeIdentity(
if ( exchange( xNewId ) )
{
// Process instanciated children...
-
+
ContentRefList aChildren;
queryChildren( aChildren );
-
+
ContentRefList::const_iterator it = aChildren.begin();
ContentRefList::const_iterator end = aChildren.end();
@@ -2936,13 +2895,13 @@ sal_Bool Content::exchangeIdentity(
0,
aOldURL.getLength(),
xNewId->getContentIdentifier() );
- uno::Reference< ucb::XContentIdentifier >
- xNewChildId
- = new ::ucbhelper::ContentIdentifier( m_xSMgr, aNewChildURL );
-
+ uno::Reference< ucb::XContentIdentifier > xNewChildId
+ = new ::ucbhelper::ContentIdentifier(
+ m_xSMgr, aNewChildURL );
+
if ( !xChild->exchangeIdentity( xNewChildId ) )
return sal_False;
-
+
++it;
}
return sal_True;
@@ -2962,7 +2921,7 @@ sal_Bool Content::isFolder(
{
{
osl::MutexGuard aGuard( m_aMutex );
-
+
if ( m_bTransient )
return m_bCollection;
}
@@ -3010,11 +2969,10 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite )
aArgs );
return aException;
}
-
default:
break;
}
-
+
switch ( e.getError() )
{
case DAVException::DAV_HTTP_ERROR:
@@ -3022,14 +2980,14 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite )
if ( bWrite )
aException <<=
ucb::InteractiveNetworkWriteException(
- rtl::OUString(),
+ e.getData(),
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR,
e.getData() );
else
aException <<=
ucb::InteractiveNetworkReadException(
- rtl::OUString(),
+ e.getData(),
static_cast< cppu::OWeakObject * >( this ),
task::InteractionClassification_ERROR,
e.getData() );
@@ -3044,14 +3002,14 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite )
task::InteractionClassification_ERROR,
e.getData() );
break;
-
+
// @@@ No matching InteractiveNetwork*Exception
-// case DAVException::DAV_HTTP_AUTH:
-// break;
+// case DAVException::DAV_HTTP_AUTH:
+// break;
// @@@ No matching InteractiveNetwork*Exception
-// case DAVException::DAV_HTTP_AUTHPROXY:
-// break;
+// case DAVException::DAV_HTTP_AUTHPROXY:
+// break;
case DAVException::DAV_HTTP_CONNECT:
aException <<=
@@ -3063,16 +3021,16 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite )
break;
// @@@ No matching InteractiveNetwork*Exception
-// case DAVException::DAV_HTTP_TIMEOUT:
-// break;
+// case DAVException::DAV_HTTP_TIMEOUT:
+// break;
// @@@ No matching InteractiveNetwork*Exception
-// case DAVException::DAV_HTTP_REDIRECT:
-// break;
+// case DAVException::DAV_HTTP_REDIRECT:
+// break;
// @@@ No matching InteractiveNetwork*Exception
-// case DAVException::DAV_SESSION_CREATE:
-// break;
+// case DAVException::DAV_SESSION_CREATE:
+// break;
case DAVException::DAV_INVALID_ARG:
aException <<=
@@ -3081,7 +3039,63 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite )
static_cast< cppu::OWeakObject * >( this ),
-1 );
break;
-
+
+ case DAVException::DAV_LOCKED:
+#if 1
+ aException <<=
+ ucb::InteractiveLockingLockedException(
+ rtl::OUString::createFromAscii( "Locked!" ),
+ static_cast< cppu::OWeakObject * >( this ),
+ task::InteractionClassification_ERROR,
+ m_xIdentifier->getContentIdentifier(),
+ sal_True );
+#else
+ {
+ uno::Sequence< uno::Any > aArgs( 1 );
+ aArgs[ 0 ] <<= beans::PropertyValue(
+ rtl::OUString::createFromAscii("Uri"), -1,
+ uno::makeAny(m_xIdentifier->getContentIdentifier()),
+ beans::PropertyState_DIRECT_VALUE);
+
+ aException <<=
+ ucb::InteractiveAugmentedIOException(
+ rtl::OUString::createFromAscii( "Locked!" ),
+ static_cast< cppu::OWeakObject * >( this ),
+ task::InteractionClassification_ERROR,
+ ucb::IOErrorCode_LOCKING_VIOLATION,
+ aArgs );
+ }
+#endif
+ break;
+
+ case DAVException::DAV_LOCKED_SELF:
+ aException <<=
+ ucb::InteractiveLockingLockedException(
+ rtl::OUString::createFromAscii( "Locked (self)!" ),
+ static_cast< cppu::OWeakObject * >( this ),
+ task::InteractionClassification_ERROR,
+ m_xIdentifier->getContentIdentifier(),
+ sal_True );
+ break;
+
+ case DAVException::DAV_NOT_LOCKED:
+ aException <<=
+ ucb::InteractiveLockingNotLockedException(
+ rtl::OUString::createFromAscii( "Not locked!" ),
+ static_cast< cppu::OWeakObject * >( this ),
+ task::InteractionClassification_ERROR,
+ m_xIdentifier->getContentIdentifier() );
+ break;
+
+ case DAVException::DAV_LOCK_EXPIRED:
+ aException <<=
+ ucb::InteractiveLockingLockExpiredException(
+ rtl::OUString::createFromAscii( "Lock expired!" ),
+ static_cast< cppu::OWeakObject * >( this ),
+ task::InteractionClassification_ERROR,
+ m_xIdentifier->getContentIdentifier() );
+ break;
+
default:
aException <<=
ucb::InteractiveNetworkGeneralException(
@@ -3090,7 +3104,7 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite )
task::InteractionClassification_ERROR );
break;
}
-
+
return aException;
}
@@ -3120,7 +3134,8 @@ void Content::cancelCommandExecution(
}
//=========================================================================
-const rtl::OUString Content::getBaseURI( const std::auto_ptr< DAVResourceAccess > & rResAccess )
+const rtl::OUString
+Content::getBaseURI( const std::auto_ptr< DAVResourceAccess > & rResAccess )
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
@@ -3176,35 +3191,44 @@ const Content::ResourceType & Content::getResourceType(
{
try
{
- // Try to fetch some frequently used property value, e.g. those
+ // Try to fetch some frequently used property value, e.g. those
// used when loading documents... along with identifying whether
// this is a DAV resource.
std::vector< DAVResource > resources;
std::vector< rtl::OUString > aPropNames;
- uno::Sequence< beans::Property > aProperties( 4 );
- aProperties[ 0 ].Name = rtl::OUString::createFromAscii( "IsFolder" );
- aProperties[ 1 ].Name = rtl::OUString::createFromAscii( "IsDocument" );
- aProperties[ 2 ].Name = rtl::OUString::createFromAscii( "IsReadOnly" );
- aProperties[ 3 ].Name = rtl::OUString::createFromAscii( "MediaType" );
+ uno::Sequence< beans::Property > aProperties( 5 );
+ aProperties[ 0 ].Name
+ = rtl::OUString::createFromAscii( "IsFolder" );
+ aProperties[ 1 ].Name
+ = rtl::OUString::createFromAscii( "IsDocument" );
+ aProperties[ 2 ].Name
+ = rtl::OUString::createFromAscii( "IsReadOnly" );
+ aProperties[ 3 ].Name
+ = rtl::OUString::createFromAscii( "MediaType" );
+ aProperties[ 4 ].Name
+ = DAVProperties::SUPPORTEDLOCK;
ContentProperties::UCBNamesToDAVNames(
aProperties, aPropNames );
rResAccess->PROPFIND(
DAVZERO, aPropNames, resources, xEnv );
-
+
if ( resources.size() == 1 )
- {
- m_xCachedProps.reset( new ContentProperties( resources[ 0 ] ) );
- m_xCachedProps->containsAllNames( aProperties, m_aFailedPropNames );
+ {
+ m_xCachedProps.reset(
+ new ContentProperties( resources[ 0 ] ) );
+ m_xCachedProps->containsAllNames(
+ aProperties, m_aFailedPropNames );
}
+
eResourceType = DAV;
}
- catch ( DAVException const& e)
+ catch ( DAVException const & e )
{
rResAccess->resetUri();
- if (e.getStatus() == SC_METHOD_NOT_ALLOWED)
+ if ( e.getStatus() == SC_METHOD_NOT_ALLOWED )
{
// Status SC_METHOD_NOT_ALLOWED is a safe indicator that the
// resource is NON_DAV
@@ -3213,7 +3237,6 @@ const Content::ResourceType & Content::getResourceType(
}
}
m_eResourceType = eResourceType;
-
}
return m_eResourceType;
}
diff --git a/ucb/source/ucp/webdav/webdavcontent.hxx b/ucb/source/ucp/webdav/webdavcontent.hxx
index 030fcc2b7e..78e2a4a184 100644
--- a/ucb/source/ucp/webdav/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav/webdavcontent.hxx
@@ -88,7 +88,7 @@ class Content : public ::ucbhelper::ContentImplHelper,
rtl::OUString m_aEscapedTitle;
ResourceType m_eResourceType;
ContentProvider* m_pProvider; // No need for a ref, base class holds object
- bool m_bTransient;
+ bool m_bTransient;
bool m_bCollection;
bool m_bDidGetOrHead;
std::vector< rtl::OUString > m_aFailedPropNames;
@@ -96,81 +96,91 @@ class Content : public ::ucbhelper::ContentImplHelper,
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 );
+ 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::ucb::XCommandEnvironment > & xEnv );
+ virtual ::rtl::OUString getParentURL();
- sal_Bool isFolder( const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
+ sal_Bool isFolder( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw ( ::com::sun::star::uno::Exception );
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
- getPropertyValues( const ::com::sun::star::uno::Sequence<
+ ::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 )
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw ( ::com::sun::star::uno::Exception );
::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 )
+ 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 )
throw ( ::com::sun::star::uno::Exception );
typedef rtl::Reference< Content > ContentRef;
- typedef std::list< ContentRef > ContentRefList;
- void queryChildren( ContentRefList& rChildren);
+ typedef std::list< ContentRef > ContentRefList;
+ void queryChildren( ContentRefList& rChildren);
- sal_Bool exchangeIdentity(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XContentIdentifier >& xNewId );
+ sal_Bool
+ exchangeIdentity( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& xNewId );
- const rtl::OUString getBaseURI( const std::auto_ptr< DAVResourceAccess > & rResAccess );
+ const rtl::OUString
+ getBaseURI( const std::auto_ptr< DAVResourceAccess > & rResAccess );
- const ResourceType & getResourceType(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
+ const ResourceType &
+ getResourceType( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
throw ( ::com::sun::star::uno::Exception );
- const ResourceType & getResourceType(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::ucb::XCommandEnvironment >& xEnv,
- const std::auto_ptr< DAVResourceAccess > & rResAccess )
+ const ResourceType &
+ getResourceType( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& xEnv,
+ const std::auto_ptr< DAVResourceAccess > & rResAccess )
throw ( ::com::sun::star::uno::Exception );
// Command "open"
com::sun::star::uno::Any open(
const com::sun::star::ucb::OpenCommandArgument2 & rArg,
const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ com::sun::star::ucb::XCommandEnvironment > & xEnv )
throw( ::com::sun::star::uno::Exception );
// Command "post"
void post( const com::sun::star::ucb::PostCommandArgument2 & rArg,
const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ 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,
- sal_Bool bReplaceExisting,
- const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& Environment )
+ // 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 "transfer"
void transfer( const ::com::sun::star::ucb::TransferInfo & rArgs,
const com::sun::star::uno::Reference<
- com::sun::star::ucb::XCommandEnvironment >& Environment )
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
throw( ::com::sun::star::uno::Exception );
// Command "delete"
- void destroy( sal_Bool bDeletePhysical )
+ void destroy( sal_Bool bDeletePhysical )
+ throw( ::com::sun::star::uno::Exception );
+
+ // Command "lock"
+ void lock( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
+ throw( ::com::sun::star::uno::Exception );
+
+ // Command "unlock"
+ void unlock( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
throw( ::com::sun::star::uno::Exception );
::com::sun::star::uno::Any MapDAVException( const DAVException & e,
@@ -184,57 +194,62 @@ private:
static bool shouldAccessNetworkAfterException( const DAVException & e );
+ bool supportsExclusiveWriteLock(
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& Environment );
+
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,
+ 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,
rtl::Reference< DAVSessionFactory > const & rSessionFactory )
throw ( ::com::sun::star::ucb::ContentCreationException );
- 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,
+ 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,
rtl::Reference< DAVSessionFactory > const & rSessionFactory,
- sal_Bool isCollection )
+ sal_Bool isCollection )
throw ( ::com::sun::star::ucb::ContentCreationException );
- virtual ~Content();
+ virtual ~Content();
- // XInterface
- XINTERFACE_DECL()
+ // XInterface
+ XINTERFACE_DECL()
// XTypeProvider
XTYPEPROVIDER_DECL()
// XServiceInfo
virtual ::rtl::OUString SAL_CALL
- getImplementationName()
+ getImplementationName()
throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- getSupportedServiceNames()
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
throw( ::com::sun::star::uno::RuntimeException );
- // XContent
- virtual rtl::OUString SAL_CALL
- getContentType()
+ // 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 )
+ // 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 )
+ com::sun::star::ucb::CommandAbortedException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ abort( sal_Int32 CommandId )
throw( com::sun::star::uno::RuntimeException );
- // XPropertyContainer
+ // XPropertyContainer
virtual void SAL_CALL
addProperty( const rtl::OUString& Name,
sal_Int16 Attributes,
@@ -250,36 +265,36 @@ public:
com::sun::star::beans::NotRemoveableException,
com::sun::star::uno::RuntimeException );
- //////////////////////////////////////////////////////////////////////
- // Additional interfaces
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
+ // Additional interfaces
+ //////////////////////////////////////////////////////////////////////
- // XContentCreator
+ // XContentCreator
virtual com::sun::star::uno::Sequence<
com::sun::star::ucb::ContentInfo > SAL_CALL
- queryCreatableContentsInfo()
+ queryCreatableContentsInfo()
throw( com::sun::star::uno::RuntimeException );
- virtual com::sun::star::uno::Reference<
- com::sun::star::ucb::XContent > SAL_CALL
- createNewContent( const com::sun::star::ucb::ContentInfo& Info )
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContent > SAL_CALL
+ createNewContent( const com::sun::star::ucb::ContentInfo& Info )
throw( com::sun::star::uno::RuntimeException );
- //////////////////////////////////////////////////////////////////////
- // Non-interface methods.
- //////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
DAVResourceAccess & getResourceAccess() { return *m_xResAccess; }
- // 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,
+ // 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 ContentProperties& rData,
+ ::com::sun::star::beans::Property >& rProperties,
+ const ContentProperties& rData,
const rtl::Reference<
::ucbhelper::ContentProviderImplHelper >& rProvider,
- const ::rtl::OUString& rContentId );
+ const ::rtl::OUString& rContentId );
};
}
diff --git a/ucb/source/ucp/webdav/webdavcontentcaps.cxx b/ucb/source/ucp/webdav/webdavcontentcaps.cxx
index 16800fb29c..7f3c20eb08 100644
--- a/ucb/source/ucp/webdav/webdavcontentcaps.cxx
+++ b/ucb/source/ucp/webdav/webdavcontentcaps.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -31,7 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_ucb.hxx"
/**************************************************************************
- TODO
+ TODO
**************************************************************************
*************************************************************************/
@@ -41,24 +41,19 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/ucb/CommandInfo.hpp>
+#include <com/sun/star/ucb/ContentInfo.hpp>
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
#include <com/sun/star/ucb/PostCommandArgument2.hpp>
#include <com/sun/star/ucb/TransferInfo.hpp>
#include <com/sun/star/uno/Sequence.hxx>
-#ifndef _COM_SUN_STAR_UTIL_DATETIME_HXX_
#include <com/sun/star/util/DateTime.hpp>
-#endif
#include <com/sun/star/ucb/Link.hpp>
#include <com/sun/star/ucb/Lock.hpp>
#include <com/sun/star/ucb/LockEntry.hpp>
#include "webdavcontent.hxx"
-#ifndef _WEBDAV_UCP_PROVIDFER_HXX
#include "webdavprovider.hxx"
-#endif
-#ifndef _WEBDAV_SESSION_HXX
#include "DAVSession.hxx"
-#endif
#include "ContentProperties.hxx"
using namespace com::sun::star;
@@ -162,6 +157,16 @@ bool ContentProvider::getProperty(
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY ) );
+ m_pProps->insert(
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ),
+ -1,
+ getCppuType( static_cast<
+ const uno::Sequence< ucb::ContentInfo > * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY ) );
+
// Standard DAV properties.
m_pProps->insert(
@@ -221,17 +226,16 @@ bool ContentProvider::getProperty(
m_pProps->insert(
beans::Property(
- DAVProperties::LOCKDISCOVERY,
+ DAVProperties::LOCKDISCOVERY,
-1,
getCppuType( static_cast<
- const uno::Sequence<
- com::sun::star::ucb::Lock > * >( 0 ) ),
+ const uno::Sequence< ucb::Lock > * >( 0 ) ),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY ) );
m_pProps->insert(
beans::Property(
- DAVProperties::RESOURCETYPE,
+ DAVProperties::RESOURCETYPE,
-1,
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
beans::PropertyAttribute::BOUND
@@ -239,27 +243,25 @@ bool ContentProvider::getProperty(
m_pProps->insert(
beans::Property(
- DAVProperties::SOURCE,
+ DAVProperties::SOURCE,
-1,
getCppuType( static_cast<
- const uno::Sequence<
- com::sun::star::ucb::Link > * >( 0 ) ),
+ const uno::Sequence< ucb::Link > * >( 0 ) ),
beans::PropertyAttribute::BOUND ) );
m_pProps->insert(
beans::Property(
- DAVProperties::SUPPORTEDLOCK,
+ DAVProperties::SUPPORTEDLOCK,
-1,
getCppuType( static_cast<
const uno::Sequence<
- com::sun::star::ucb::LockEntry > * >(
- 0 ) ),
+ ucb::LockEntry > * >( 0 ) ),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::READONLY ) );
m_pProps->insert(
beans::Property(
- DAVProperties::EXECUTABLE,
+ DAVProperties::EXECUTABLE,
-1,
getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
beans::PropertyAttribute::BOUND ) );
@@ -301,7 +303,7 @@ bool ContentProvider::getProperty(
// virtual
uno::Sequence< beans::Property > Content::getProperties(
- const uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
+ const uno::Reference< ucb::XCommandEnvironment > & xEnv )
{
sal_Bool bTransient;
std::auto_ptr< DAVResourceAccess > xResAccess;
@@ -314,7 +316,8 @@ uno::Sequence< beans::Property > Content::getProperties(
bTransient = m_bTransient;
xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) );
if ( m_xCachedProps.get() )
- xCachedProps.reset( new ContentProperties( *m_xCachedProps.get() ) );
+ xCachedProps.reset(
+ new ContentProperties( *m_xCachedProps.get() ) );
xProvider.set( m_pProvider );
}
@@ -356,6 +359,7 @@ uno::Sequence< beans::Property > Content::getProperties(
sal_Bool bHasDateModified = sal_False;
sal_Bool bHasMediaType = sal_False;
sal_Bool bHasSize = sal_False;
+ sal_Bool bHasCreatableInfos = sal_False;
{
std::set< rtl::OUString >::const_iterator it = aPropSet.begin();
@@ -436,7 +440,13 @@ uno::Sequence< beans::Property > Content::getProperties(
{
bHasSize = sal_True;
}
-
+ else if ( !bHasCreatableInfos &&
+ (*it).equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(
+ "CreatableContentsInfo" ) ) )
+ {
+ bHasCreatableInfos = sal_True;
+ }
it++;
}
}
@@ -486,6 +496,11 @@ uno::Sequence< beans::Property > Content::getProperties(
aPropSet.insert(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ) );
+ if ( !bHasCreatableInfos )
+ aPropSet.insert(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "CreatableContentsInfo" ) ) );
+
// Add cached properties, if present and still missing.
if ( xCachedProps.get() )
{
@@ -525,236 +540,136 @@ uno::Sequence< beans::Property > Content::getProperties(
//=========================================================================
// virtual
-uno::Sequence< com::sun::star::ucb::CommandInfo > Content::getCommands(
- const uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv )
+uno::Sequence< ucb::CommandInfo > Content::getCommands(
+ const uno::Reference< ucb::XCommandEnvironment > & xEnv )
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
- sal_Bool bFolder = sal_False;
-
- try
- {
- bFolder = isFolder( xEnv );
- }
- catch ( uno::Exception const & )
- {
- static com::sun::star::ucb::CommandInfo aDefaultCommandInfoTable[] =
- {
- ///////////////////////////////////////////////////////////////
- // Just mandatory commands avail.
- ///////////////////////////////////////////////////////////////
-
- com::sun::star::ucb::CommandInfo(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
- -1,
- getCppuVoidType()
- ),
- com::sun::star::ucb::CommandInfo(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
- -1,
- getCppuVoidType()
- ),
- com::sun::star::ucb::CommandInfo(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
- -1,
- getCppuType( static_cast<
- uno::Sequence< beans::Property > * >( 0 ) )
- ),
- com::sun::star::ucb::CommandInfo(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
- -1,
- getCppuType( static_cast<
- uno::Sequence< beans::PropertyValue > * >( 0 ) )
- )
- };
- return uno::Sequence< com::sun::star::ucb::CommandInfo >(
- aDefaultCommandInfoTable, 4 );
- }
-
- if ( bFolder )
- {
- //=================================================================
- //
- // Folder: Supported commands
- //
- //=================================================================
+ uno::Sequence< ucb::CommandInfo > aCmdInfo( 8 );
- static com::sun::star::ucb::CommandInfo aFolderCommandInfoTable[] =
- {
- ///////////////////////////////////////////////////////////////
- // Required commands
- ///////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////
+ // Mandatory commands
+ ///////////////////////////////////////////////////////////////
- com::sun::star::ucb::CommandInfo(
+ aCmdInfo[ 0 ] =
+ ucb::CommandInfo(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
-1,
- getCppuVoidType()
- ),
- com::sun::star::ucb::CommandInfo(
+ getCppuVoidType() );
+ aCmdInfo[ 1 ] =
+ ucb::CommandInfo(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
-1,
- getCppuVoidType()
- ),
- com::sun::star::ucb::CommandInfo(
+ getCppuVoidType() );
+ aCmdInfo[ 2 ] =
+ ucb::CommandInfo(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
-1,
getCppuType( static_cast<
- uno::Sequence< beans::Property > * >( 0 ) )
- ),
- com::sun::star::ucb::CommandInfo(
+ uno::Sequence< beans::Property > * >( 0 ) ) );
+ aCmdInfo[ 3 ] =
+ ucb::CommandInfo(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
-1,
getCppuType( static_cast<
- uno::Sequence< beans::PropertyValue > * >( 0 ) )
- ),
+ uno::Sequence< beans::PropertyValue > * >( 0 ) ) );
- ///////////////////////////////////////////////////////////////
- // Optional standard commands
- ///////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////
+ // Optional standard commands
+ ///////////////////////////////////////////////////////////////
- com::sun::star::ucb::CommandInfo(
+ aCmdInfo[ 4 ] =
+ ucb::CommandInfo(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
-1,
- getCppuBooleanType()
- ),
- com::sun::star::ucb::CommandInfo(
+ getCppuBooleanType() );
+ aCmdInfo[ 5 ] =
+ ucb::CommandInfo(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
-1,
getCppuType( static_cast<
- com::sun::star::ucb::InsertCommandArgument * >( 0 ) )
- ),
- com::sun::star::ucb::CommandInfo(
+ ucb::InsertCommandArgument * >( 0 ) ) );
+ aCmdInfo[ 6 ] =
+ ucb::CommandInfo(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
-1,
getCppuType( static_cast<
- com::sun::star::ucb::OpenCommandArgument2 * >( 0 ) )
- ),
- com::sun::star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
- -1,
- getCppuType( static_cast<
- com::sun::star::ucb::TransferInfo * >( 0 ) )
- )
+ ucb::OpenCommandArgument2 * >( 0 ) ) );
- ///////////////////////////////////////////////////////////////
- // New commands
- ///////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////
+ // New commands
+ ///////////////////////////////////////////////////////////////
- /*
- com::sun::star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COPY" ) ),
- -1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- ),
- com::sun::star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MOVE" ) ),
+ aCmdInfo[ 7 ] =
+ ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "post" ) ),
-1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- )
- */
- };
+ getCppuType( static_cast<
+ ucb::PostCommandArgument2 * >( 0 ) ) );
- return uno::Sequence< com::sun::star::ucb::CommandInfo >(
- aFolderCommandInfoTable, 8 );
+ sal_Bool bFolder = sal_False;
+
+ try
+ {
+ bFolder = isFolder( xEnv );
}
- else
+ catch ( uno::Exception const & )
{
- //=================================================================
- //
- // Document: Supported commands
- //
- //=================================================================
+ return aCmdInfo;
+ }
- static com::sun::star::ucb::CommandInfo aDocumentCommandInfoTable[] =
- {
- ///////////////////////////////////////////////////////////////
- // Required commands
- ///////////////////////////////////////////////////////////////
+ sal_Bool bSupportsLocking = supportsExclusiveWriteLock( xEnv );
- com::sun::star::ucb::CommandInfo(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
- -1,
- getCppuVoidType()
- ),
- com::sun::star::ucb::CommandInfo(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
- -1,
- getCppuVoidType()
- ),
- com::sun::star::ucb::CommandInfo(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
- -1,
- getCppuType( static_cast<
- uno::Sequence< beans::Property > * >( 0 ) )
- ),
- com::sun::star::ucb::CommandInfo(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
- -1,
- getCppuType( static_cast<
- uno::Sequence< beans::PropertyValue > * >( 0 ) )
- ),
+ sal_Int32 nPos = aCmdInfo.getLength();
+ sal_Int32 nMoreCmds = ( bFolder ? 2 : 0 ) + ( bSupportsLocking ? 2 : 0 );
+ if ( nMoreCmds )
+ aCmdInfo.realloc( nPos + nMoreCmds );
+ else
+ return aCmdInfo;
- ///////////////////////////////////////////////////////////////
- // Optional standard commands
- ///////////////////////////////////////////////////////////////
+ if ( bFolder )
+ {
+ ///////////////////////////////////////////////////////////////
+ // Optional standard commands
+ ///////////////////////////////////////////////////////////////
- com::sun::star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
- -1,
- getCppuBooleanType()
- ),
- com::sun::star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
- -1,
- getCppuType( static_cast<
- com::sun::star::ucb::InsertCommandArgument * >( 0 ) )
- ),
- com::sun::star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
+ aCmdInfo[ nPos ] =
+ ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ),
-1,
- getCppuType( static_cast<
- com::sun::star::ucb::OpenCommandArgument2 * >( 0 ) )
- ),
-
- ///////////////////////////////////////////////////////////////
- // New commands
- ///////////////////////////////////////////////////////////////
-
- com::sun::star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "post" ) ),
+ getCppuType( static_cast< ucb::TransferInfo * >( 0 ) ) );
+ nPos++;
+ aCmdInfo[ nPos ] =
+ ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "createNewContent" ) ),
-1,
- getCppuType( static_cast<
- com::sun::star::ucb::PostCommandArgument2 * >( 0 ) )
- )
+ getCppuType( static_cast< ucb::ContentInfo * >( 0 ) ) );
+ nPos++;
+ }
+ else
+ {
+ // no document-only commands at the moment.
+ }
- /*
- com::sun::star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COPY" ) ),
+ if ( bSupportsLocking )
+ {
+ aCmdInfo[ nPos ] =
+ ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "lock" ) ),
-1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- ),
- com::sun::star::ucb::CommandInfo(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MOVE" ) ),
+ getCppuVoidType() );
+ nPos++;
+ aCmdInfo[ nPos ] =
+ ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unlock" ) ),
-1,
- getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
- )
- */
- };
-
- return uno::Sequence< com::sun::star::ucb::CommandInfo >(
- aDocumentCommandInfoTable, 8 );
+ getCppuVoidType() );
+ nPos++;
}
+ return aCmdInfo;
}
-
diff --git a/uui/source/getcontinuations.hxx b/uui/source/getcontinuations.hxx
new file mode 100644
index 0000000000..9cc39b3823
--- /dev/null
+++ b/uui/source/getcontinuations.hxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: iahndl.cxx,v $
+ * $Revision: 1.67.22.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_UUI_GETCONTINUATIONS_HXX
+#define INCLUDED_UUI_GETCONTINUATIONS_HXX
+
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/Sequence.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace task {
+ class XInteractionContinuation;
+ }
+} } }
+
+template< class t1 >
+bool setContinuation(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > const & rContinuation,
+ com::sun::star::uno::Reference< t1 > * pContinuation)
+{
+ if (pContinuation && !pContinuation->is())
+ {
+ pContinuation->set(rContinuation, com::sun::star::uno::UNO_QUERY);
+ if (pContinuation->is())
+ return true;
+ }
+ return false;
+}
+
+template< class t1, class t2 >
+void getContinuations(
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ com::sun::star::uno::Reference< t1 > * pContinuation1,
+ com::sun::star::uno::Reference< t2 > * pContinuation2)
+{
+ for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+ {
+ if (setContinuation(rContinuations[i], pContinuation1))
+ continue;
+ if (setContinuation(rContinuations[i], pContinuation2))
+ continue;
+ }
+}
+
+template< class t1, class t2, class t3 >
+void getContinuations(
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ com::sun::star::uno::Reference< t1 > * pContinuation1,
+ com::sun::star::uno::Reference< t2 > * pContinuation2,
+ com::sun::star::uno::Reference< t3 > * pContinuation3)
+{
+ for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+ {
+ if (setContinuation(rContinuations[i], pContinuation1))
+ continue;
+ if (setContinuation(rContinuations[i], pContinuation2))
+ continue;
+ if (setContinuation(rContinuations[i], pContinuation3))
+ continue;
+ }
+}
+
+template< class t1, class t2, class t3, class t4 >
+void getContinuations(
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ com::sun::star::uno::Reference< t1 > * pContinuation1,
+ com::sun::star::uno::Reference< t2 > * pContinuation2,
+ com::sun::star::uno::Reference< t3 > * pContinuation3,
+ com::sun::star::uno::Reference< t4 > * pContinuation4)
+{
+ for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+ {
+ if (setContinuation(rContinuations[i], pContinuation1))
+ continue;
+ if (setContinuation(rContinuations[i], pContinuation2))
+ continue;
+ if (setContinuation(rContinuations[i], pContinuation3))
+ continue;
+ if (setContinuation(rContinuations[i], pContinuation4))
+ continue;
+ }
+}
+
+#endif /* INCLUDED_UUI_GETCONTINUATIONS_HXX */
diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx
new file mode 100644
index 0000000000..9154122187
--- /dev/null
+++ b/uui/source/iahndl-authentication.cxx
@@ -0,0 +1,588 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "com/sun/star/task/DocumentPasswordRequest.hpp"
+#include "com/sun/star/task/DocumentMSPasswordRequest.hpp"
+#include "com/sun/star/task/MasterPasswordRequest.hpp"
+#include "com/sun/star/task/XInteractionAbort.hpp"
+#include "com/sun/star/task/XInteractionPassword.hpp"
+#include "com/sun/star/task/XInteractionRetry.hpp"
+#include "com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp"
+#include "com/sun/star/ucb/URLAuthenticationRequest.hpp"
+
+#include "rtl/digest.h"
+#include "vos/mutex.hxx"
+#include "tools/errcode.hxx"
+#include "vcl/msgbox.hxx"
+#include "vcl/svapp.hxx"
+
+#include "ids.hrc"
+#include "getcontinuations.hxx"
+#include "passwordcontainer.hxx"
+#include "loginerr.hxx"
+#include "logindlg.hxx"
+#include "masterpasscrtdlg.hxx"
+#include "masterpassworddlg.hxx"
+#include "passcrtdlg.hxx"
+#include "passworddlg.hxx"
+
+#include "iahndl.hxx"
+
+using namespace com::sun::star;
+
+namespace {
+
+void
+executeLoginDialog(
+ Window * pParent,
+ LoginErrorInfo & rInfo,
+ rtl::OUString const & rRealm)
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ bool bAccount = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT)
+ != 0;
+ bool bSavePassword = rInfo.GetIsPersistentPassword()
+ || rInfo.GetIsSavePassword();
+ bool bCanUseSysCreds = rInfo.GetCanUseSystemCredentials();
+
+ sal_uInt16 nFlags = 0;
+ if (rInfo.GetPath().Len() == 0)
+ nFlags |= LF_NO_PATH;
+ if (rInfo.GetErrorText().Len() == 0)
+ nFlags |= LF_NO_ERRORTEXT;
+ if (!bAccount)
+ nFlags |= LF_NO_ACCOUNT;
+ if (!(rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_USER_NAME))
+ nFlags |= LF_USERNAME_READONLY;
+
+ if (!bSavePassword)
+ nFlags |= LF_NO_SAVEPASSWORD;
+
+ if (!bCanUseSysCreds)
+ nFlags |= LF_NO_USESYSCREDS;
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ UniString aRealm(rRealm);
+ std::auto_ptr< LoginDialog > xDialog(
+ new LoginDialog(pParent,
+ nFlags,
+ rInfo.GetServer(),
+ &aRealm,
+ xManager.get()));
+ if (rInfo.GetErrorText().Len() != 0)
+ xDialog->SetErrorText(rInfo.GetErrorText());
+ xDialog->SetName(rInfo.GetUserName());
+ if (bAccount)
+ xDialog->ClearAccount();
+ else
+ xDialog->ClearPassword();
+ xDialog->SetPassword(rInfo.GetPassword());
+
+ if (bSavePassword)
+ {
+ xDialog->
+ SetSavePasswordText(ResId(rInfo.GetIsPersistentPassword() ?
+ RID_SAVE_PASSWORD :
+ RID_KEEP_PASSWORD,
+ *xManager.get()));
+ xDialog->SetSavePassword(rInfo.GetIsSavePassword());
+ }
+
+ if ( bCanUseSysCreds )
+ xDialog->SetUseSystemCredentials(
+ rInfo.GetIsUseSystemCredentials() );
+
+ rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
+ ERRCODE_BUTTON_CANCEL);
+ rInfo.SetUserName(xDialog->GetName());
+ rInfo.SetPassword(xDialog->GetPassword());
+ rInfo.SetAccount(xDialog->GetAccount());
+ rInfo.SetSavePassword(xDialog->IsSavePassword());
+
+ if ( bCanUseSysCreds )
+ rInfo.SetIsUseSystemCredentials( xDialog->IsUseSystemCredentials() );
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+void
+handleAuthenticationRequest_(
+ Window * pParent,
+ uno::Reference< task::XInteractionHandler > const & xIH,
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ ucb::AuthenticationRequest const & rRequest,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations,
+ const rtl::OUString & rURL)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionRetry > xRetry;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< ucb::XInteractionSupplyAuthentication >
+ xSupplyAuthentication;
+ uno::Reference< ucb::XInteractionSupplyAuthentication2 >
+ xSupplyAuthentication2;
+ getContinuations(rContinuations, &xRetry, &xAbort, &xSupplyAuthentication);
+ if (xSupplyAuthentication.is())
+ xSupplyAuthentication2.set(xSupplyAuthentication, uno::UNO_QUERY);
+
+ //////////////////////////
+ // First, try to obatin credentials from password container service.
+ uui::PasswordContainerHelper aPwContainerHelper(xServiceFactory);
+ if (aPwContainerHelper.handleAuthenticationRequest(rRequest,
+ xSupplyAuthentication,
+ rURL,
+ xIH))
+ {
+ xSupplyAuthentication->select();
+ return;
+ }
+
+ //////////////////////////
+ // Second, try to obtain credentials from user via password dialog.
+ bool bRemember;
+ bool bRememberPersistent;
+ if (xSupplyAuthentication.is())
+ {
+ ucb::RememberAuthentication eDefault;
+ uno::Sequence< ucb::RememberAuthentication >
+ aModes(xSupplyAuthentication->getRememberPasswordModes(eDefault));
+ bRemember = eDefault != ucb::RememberAuthentication_NO;
+ bRememberPersistent = false;
+ for (sal_Int32 i = 0; i < aModes.getLength(); ++i)
+ if (aModes[i] == ucb::RememberAuthentication_PERSISTENT)
+ {
+ bRememberPersistent = true;
+ break;
+ }
+ }
+ else
+ {
+ bRemember = false;
+ bRememberPersistent = false;
+ }
+
+ sal_Bool bCanUseSystemCredentials;
+ sal_Bool bDefaultUseSystemCredentials;
+ if (xSupplyAuthentication2.is())
+ {
+ bCanUseSystemCredentials
+ = xSupplyAuthentication2->canUseSystemCredentials(
+ bDefaultUseSystemCredentials);
+ }
+ else
+ {
+ bCanUseSystemCredentials = sal_False;
+ bDefaultUseSystemCredentials = sal_False;
+ }
+
+ LoginErrorInfo aInfo;
+ aInfo.SetTitle(rRequest.ServerName);
+ aInfo.SetServer(rRequest.ServerName);
+ if (rRequest.HasAccount)
+ aInfo.SetAccount(rRequest.Account);
+ if (rRequest.HasUserName)
+ aInfo.SetUserName(rRequest.UserName);
+ if (rRequest.HasPassword)
+ aInfo.SetPassword(rRequest.Password);
+ aInfo.SetErrorText(rRequest.Diagnostic);
+ aInfo.SetPersistentPassword(bRememberPersistent);
+ aInfo.SetSavePassword(bRemember);
+ aInfo.SetCanUseSystemCredentials(bCanUseSystemCredentials);
+ aInfo.SetIsUseSystemCredentials( bDefaultUseSystemCredentials );
+ aInfo.SetModifyAccount(rRequest.HasAccount
+ && xSupplyAuthentication.is()
+ && xSupplyAuthentication->canSetAccount());
+ aInfo.SetModifyUserName(rRequest.HasUserName
+ && xSupplyAuthentication.is()
+ && xSupplyAuthentication->canSetUserName());
+ executeLoginDialog(pParent,
+ aInfo,
+ rRequest.HasRealm ? rRequest.Realm : rtl::OUString());
+ switch (aInfo.GetResult())
+ {
+ case ERRCODE_BUTTON_OK:
+ if (xSupplyAuthentication.is())
+ {
+ if (xSupplyAuthentication->canSetUserName())
+ xSupplyAuthentication->setUserName(aInfo.GetUserName());
+ if (xSupplyAuthentication->canSetPassword())
+ xSupplyAuthentication->setPassword(aInfo.GetPassword());
+ xSupplyAuthentication->
+ setRememberPassword(
+ aInfo.GetIsSavePassword() ?
+ bRememberPersistent ?
+ ucb::RememberAuthentication_PERSISTENT :
+ ucb::RememberAuthentication_SESSION :
+ ucb::RememberAuthentication_NO);
+ if (rRequest.HasRealm)
+ {
+ if (xSupplyAuthentication->canSetRealm())
+ xSupplyAuthentication->setRealm(aInfo.GetAccount());
+ }
+ else if (xSupplyAuthentication->canSetAccount())
+ xSupplyAuthentication->setAccount(aInfo.GetAccount());
+
+ if ( xSupplyAuthentication2.is() && bCanUseSystemCredentials )
+ xSupplyAuthentication2->setUseSystemCredentials(
+ aInfo.GetIsUseSystemCredentials() );
+
+ xSupplyAuthentication->select();
+ }
+
+ //////////////////////////
+ // Third, store credentials in password container.
+
+ if ( aInfo.GetIsUseSystemCredentials() )
+ {
+ if (aInfo.GetIsSavePassword())
+ {
+ aPwContainerHelper.addRecord(
+ rURL.getLength() ? rURL : rRequest.ServerName,
+ rtl::OUString(), // empty u/p -> sys creds
+ uno::Sequence< rtl::OUString >(),
+ xIH,
+ bRememberPersistent);
+ }
+ }
+ // Empty user name can not be valid:
+ else if (aInfo.GetUserName().Len() != 0)
+ {
+ if (aInfo.GetIsSavePassword())
+ {
+ uno::Sequence< rtl::OUString >
+ aPassList(aInfo.GetAccount().Len() == 0 ? 1 : 2);
+ aPassList[0] = aInfo.GetPassword();
+ if (aInfo.GetAccount().Len() != 0)
+ aPassList[1] = aInfo.GetAccount();
+
+ aPwContainerHelper.addRecord(
+ rURL.getLength() ? rURL : rRequest.ServerName,
+ aInfo.GetUserName(),
+ aPassList,
+ xIH,
+ bRememberPersistent);
+ }
+ }
+ break;
+
+ case ERRCODE_BUTTON_RETRY:
+ if (xRetry.is())
+ xRetry->select();
+ break;
+
+ default:
+ if (xAbort.is())
+ xAbort->select();
+ break;
+ }
+}
+
+void
+executeMasterPasswordDialog(
+ Window * pParent,
+ LoginErrorInfo & rInfo,
+ task::PasswordRequestMode nMode)
+ SAL_THROW((uno::RuntimeException))
+{
+ rtl::OString aMaster;
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if( nMode == task::PasswordRequestMode_PASSWORD_CREATE )
+ {
+ std::auto_ptr< MasterPasswordCreateDialog > xDialog(
+ new MasterPasswordCreateDialog(pParent, xManager.get()));
+ rInfo.SetResult(xDialog->Execute()
+ == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL);
+ aMaster = rtl::OUStringToOString(
+ xDialog->GetMasterPassword(), RTL_TEXTENCODING_UTF8);
+ }
+ else
+ {
+ std::auto_ptr< MasterPasswordDialog > xDialog(
+ new MasterPasswordDialog(pParent, nMode, xManager.get()));
+ rInfo.SetResult(xDialog->Execute()
+ == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL);
+ aMaster = rtl::OUStringToOString(
+ xDialog->GetMasterPassword(), RTL_TEXTENCODING_UTF8);
+ }
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+
+ sal_uInt8 aKey[RTL_DIGEST_LENGTH_MD5];
+ rtl_digest_PBKDF2(aKey,
+ RTL_DIGEST_LENGTH_MD5,
+ reinterpret_cast< sal_uInt8 const * >(aMaster.getStr()),
+ aMaster.getLength(),
+ reinterpret_cast< sal_uInt8 const * >(
+ "3B5509ABA6BC42D9A3A1F3DAD49E56A51"),
+ 32,
+ 1000);
+
+ rtl::OUStringBuffer aBuffer;
+ for (int i = 0; i < RTL_DIGEST_LENGTH_MD5; ++i)
+ {
+ aBuffer.append(static_cast< sal_Unicode >('a' + (aKey[i] >> 4)));
+ aBuffer.append(static_cast< sal_Unicode >('a' + (aKey[i] & 15)));
+ }
+ rInfo.SetPassword(aBuffer.makeStringAndClear());
+}
+
+void
+handleMasterPasswordRequest_(
+ Window * pParent,
+ task::PasswordRequestMode nMode,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionRetry > xRetry;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< ucb::XInteractionSupplyAuthentication >
+ xSupplyAuthentication;
+ getContinuations(rContinuations, &xRetry, &xAbort, &xSupplyAuthentication);
+ LoginErrorInfo aInfo;
+
+ // in case of master password a hash code is returned
+ executeMasterPasswordDialog(pParent, aInfo, nMode);
+
+ switch (aInfo.GetResult())
+ {
+ case ERRCODE_BUTTON_OK:
+ if (xSupplyAuthentication.is())
+ {
+ if (xSupplyAuthentication->canSetPassword())
+ xSupplyAuthentication->setPassword(aInfo.GetPassword());
+ xSupplyAuthentication->select();
+ }
+ break;
+
+ case ERRCODE_BUTTON_RETRY:
+ if (xRetry.is())
+ xRetry->select();
+ break;
+
+ default:
+ if (xAbort.is())
+ xAbort->select();
+ break;
+ }
+}
+
+void
+executePasswordDialog(
+ Window * pParent,
+ LoginErrorInfo & rInfo,
+ task::PasswordRequestMode nMode,
+ ::rtl::OUString aDocName,
+ bool bMSCryptoMode)
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if( nMode == task::PasswordRequestMode_PASSWORD_CREATE )
+ {
+ std::auto_ptr< PasswordCreateDialog > xDialog(
+ new PasswordCreateDialog(pParent,
+ xManager.get(),
+ bMSCryptoMode));
+
+ rInfo.SetResult(xDialog->Execute()
+ == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL);
+ rInfo.SetPassword( xDialog->GetPassword() );
+ }
+ else
+ {
+ std::auto_ptr< PasswordDialog > xDialog(
+ new PasswordDialog(pParent, nMode, xManager.get(), aDocName));
+
+ rInfo.SetResult(xDialog->Execute()
+ == RET_OK ? ERRCODE_BUTTON_OK : ERRCODE_BUTTON_CANCEL);
+ rInfo.SetPassword( xDialog->GetPassword() );
+ }
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface>());
+ }
+}
+
+void
+handlePasswordRequest_(
+ Window * pParent,
+ task::PasswordRequestMode nMode,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations,
+ ::rtl::OUString aDocumentName,
+ bool bMSCryptoMode )
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionRetry > xRetry;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< task::XInteractionPassword > xPassword;
+ getContinuations(rContinuations, &xRetry, &xAbort, &xPassword);
+ LoginErrorInfo aInfo;
+
+ executePasswordDialog(pParent,
+ aInfo,
+ nMode,
+ aDocumentName,
+ bMSCryptoMode);
+
+ switch (aInfo.GetResult())
+ {
+ case ERRCODE_BUTTON_OK:
+ if (xPassword.is())
+ {
+ xPassword->setPassword(aInfo.GetPassword());
+ xPassword->select();
+ }
+ break;
+
+ case ERRCODE_BUTTON_RETRY:
+ if (xRetry.is())
+ xRetry->select();
+ break;
+
+ default:
+ if (xAbort.is())
+ xAbort->select();
+ break;
+ }
+}
+
+} // namespace
+
+bool
+UUIInteractionHelper::handleAuthenticationRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ ucb::URLAuthenticationRequest aURLAuthenticationRequest;
+ if (aAnyRequest >>= aURLAuthenticationRequest)
+ {
+ handleAuthenticationRequest_(getParentProperty(),
+ getInteractionHandler(),
+ m_xServiceFactory,
+ aURLAuthenticationRequest,
+ rRequest->getContinuations(),
+ aURLAuthenticationRequest.URL);
+ return true;
+ }
+
+ ucb::AuthenticationRequest aAuthenticationRequest;
+ if (aAnyRequest >>= aAuthenticationRequest)
+ {
+ handleAuthenticationRequest_(getParentProperty(),
+ getInteractionHandler(),
+ m_xServiceFactory,
+ aAuthenticationRequest,
+ rRequest->getContinuations(),
+ rtl::OUString());
+ return true;
+ }
+ return false;
+}
+
+bool
+UUIInteractionHelper::handleMasterPasswordRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ task::MasterPasswordRequest aMasterPasswordRequest;
+ if (aAnyRequest >>= aMasterPasswordRequest)
+ {
+ handleMasterPasswordRequest_(getParentProperty(),
+ aMasterPasswordRequest.Mode,
+ rRequest->getContinuations());
+ return true;
+ }
+ return false;
+}
+
+bool
+UUIInteractionHelper::handlePasswordRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ task::DocumentPasswordRequest aDocumentPasswordRequest;
+ if (aAnyRequest >>= aDocumentPasswordRequest)
+ {
+ handlePasswordRequest_(getParentProperty(),
+ aDocumentPasswordRequest.Mode,
+ rRequest->getContinuations(),
+ aDocumentPasswordRequest.Name,
+ false /* bool bMSCryptoMode */);
+ return true;
+ }
+
+ task::DocumentMSPasswordRequest aDocumentMSPasswordRequest;
+ if (aAnyRequest >>= aDocumentMSPasswordRequest)
+ {
+ handlePasswordRequest_(getParentProperty(),
+ aDocumentMSPasswordRequest.Mode,
+ rRequest->getContinuations(),
+ aDocumentMSPasswordRequest.Name,
+ true /* bool bMSCryptoMode */);
+ return true;
+ }
+ return false;
+}
diff --git a/uui/source/iahndl-cookies.cxx b/uui/source/iahndl-cookies.cxx
new file mode 100644
index 0000000000..9e8f45b5c1
--- /dev/null
+++ b/uui/source/iahndl-cookies.cxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "com/sun/star/ucb/HandleCookiesRequest.hpp"
+#include "com/sun/star/ucb/XInteractionCookieHandling.hpp"
+#include "com/sun/star/task/XInteractionRequest.hpp"
+
+#include "vos/mutex.hxx"
+#include "tools/list.hxx"
+#include "svl/httpcook.hxx"
+#include "vcl/svapp.hxx"
+
+#include "cookiedg.hxx"
+
+#include "iahndl.hxx"
+
+using namespace com::sun::star;
+
+namespace {
+
+class CookieList: public List
+{
+public:
+ ~CookieList() SAL_THROW(());
+};
+
+CookieList::~CookieList() SAL_THROW(())
+{
+ while (Count() != 0)
+ delete static_cast< CntHTTPCookie * >(Remove(Count() - 1));
+}
+
+void
+executeCookieDialog(Window * pParent, CntHTTPCookieRequest & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ std::auto_ptr< CookiesDialog > xDialog(
+ new CookiesDialog(pParent, &rRequest, xManager.get()));
+ xDialog->Execute();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface>());
+ }
+}
+
+void
+handleCookiesRequest_(
+ Window * pParent,
+ ucb::HandleCookiesRequest const & rRequest,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((uno::RuntimeException))
+{
+ CookieList aCookies;
+ for (sal_Int32 i = 0; i < rRequest.Cookies.getLength(); ++i)
+ {
+ try
+ {
+ std::auto_ptr< CntHTTPCookie > xCookie(new CntHTTPCookie);
+ xCookie->m_aName = UniString(rRequest.Cookies[i].Name);
+ xCookie->m_aValue = UniString(rRequest.Cookies[i].Value);
+ xCookie->m_aDomain = UniString(rRequest.Cookies[i].Domain);
+ xCookie->m_aPath = UniString(rRequest.Cookies[i].Path);
+ xCookie->m_aExpires
+ = DateTime(Date(rRequest.Cookies[i].Expires.Day,
+ rRequest.Cookies[i].Expires.Month,
+ rRequest.Cookies[i].Expires.Year),
+ Time(rRequest.Cookies[i].Expires.Hours,
+ rRequest.Cookies[i].Expires.Minutes,
+ rRequest.Cookies[i].Expires.Seconds,
+ rRequest.Cookies[i].Expires.HundredthSeconds));
+ xCookie->m_nFlags
+ = rRequest.Cookies[i].Secure ? CNTHTTP_COOKIE_FLAG_SECURE : 0;
+ switch (rRequest.Cookies[i].Policy)
+ {
+ case ucb::CookiePolicy_CONFIRM:
+ xCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_INTERACTIVE;
+ break;
+
+ case ucb::CookiePolicy_ACCEPT:
+ xCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_ACCEPTED;
+ break;
+
+ case ucb::CookiePolicy_IGNORE:
+ xCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_BANNED;
+ break;
+
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ aCookies.Insert(xCookie.get(), LIST_APPEND);
+ xCookie.release();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+ }
+
+ CntHTTPCookieRequest
+ aRequest(rRequest.URL,
+ aCookies,
+ rRequest.Request == ucb::CookieRequest_RECEIVE
+ ? CNTHTTP_COOKIE_REQUEST_RECV
+ : CNTHTTP_COOKIE_REQUEST_SEND);
+ executeCookieDialog(pParent, aRequest);
+ for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
+ {
+ uno::Reference< ucb::XInteractionCookieHandling >
+ xCookieHandling(rContinuations[i], uno::UNO_QUERY);
+ if (xCookieHandling.is())
+ {
+ switch (aRequest.m_nRet)
+ {
+ case CNTHTTP_COOKIE_POLICY_INTERACTIVE:
+ xCookieHandling->
+ setGeneralPolicy(ucb::CookiePolicy_CONFIRM);
+ break;
+
+ case CNTHTTP_COOKIE_POLICY_ACCEPTED:
+ xCookieHandling->
+ setGeneralPolicy(ucb::CookiePolicy_ACCEPT);
+ break;
+
+ case CNTHTTP_COOKIE_POLICY_BANNED:
+ xCookieHandling->
+ setGeneralPolicy(ucb::CookiePolicy_IGNORE);
+ break;
+ }
+ for (sal_Int32 j = 0; j < rRequest.Cookies.getLength(); ++j)
+ if (rRequest.Cookies[j].Policy
+ == ucb::CookiePolicy_CONFIRM)
+ switch (static_cast< CntHTTPCookie * >(aCookies.
+ GetObject(j))->
+ m_nPolicy)
+ {
+ case CNTHTTP_COOKIE_POLICY_ACCEPTED:
+ xCookieHandling->
+ setSpecificPolicy(rRequest.Cookies[j], true);
+ break;
+
+ case CNTHTTP_COOKIE_POLICY_BANNED:
+ xCookieHandling->
+ setSpecificPolicy(rRequest.Cookies[j], false);
+ break;
+ }
+ xCookieHandling->select();
+ break;
+ }
+ }
+}
+
+} // namespace
+
+bool
+UUIInteractionHelper::handleCookiesRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ ucb::HandleCookiesRequest aCookiesRequest;
+ if (aAnyRequest >>= aCookiesRequest)
+ {
+ handleCookiesRequest_(getParentProperty(),
+ aCookiesRequest,
+ rRequest->getContinuations());
+ return true;
+ }
+ return false;
+}
+
diff --git a/uui/source/iahndl-errorhandler.cxx b/uui/source/iahndl-errorhandler.cxx
new file mode 100644
index 0000000000..ed8fd21181
--- /dev/null
+++ b/uui/source/iahndl-errorhandler.cxx
@@ -0,0 +1,321 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: iahndl.cxx,v $
+ * $Revision: 1.67.22.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <memory>
+
+#include "vos/mutex.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/msgbox.hxx"
+
+#include "com/sun/star/task/XInteractionAbort.hpp"
+#include "com/sun/star/task/XInteractionApprove.hpp"
+#include "com/sun/star/task/XInteractionDisapprove.hpp"
+#include "com/sun/star/task/XInteractionRetry.hpp"
+
+#include "tools/errinf.hxx" // ErrorHandler, ErrorContext, ...
+#include "svl/svtools.hrc" // RID_ERRHDL
+
+#include "ids.hrc"
+#include "getcontinuations.hxx"
+
+#include "iahndl.hxx"
+
+using namespace com::sun::star;
+
+namespace {
+
+USHORT
+executeErrorDialog(
+ Window * pParent,
+ task::InteractionClassification eClassification,
+ rtl::OUString const & rContext,
+ rtl::OUString const & rMessage,
+ WinBits nButtonMask)
+ SAL_THROW((uno::RuntimeException))
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ rtl::OUStringBuffer aText(rContext);
+ if (rContext.getLength() != 0 && rMessage.getLength() != 0)
+ aText.appendAscii(RTL_CONSTASCII_STRINGPARAM(":\n"));
+ //TODO! must be internationalized
+ aText.append(rMessage);
+
+ std::auto_ptr< MessBox > xBox;
+ try
+ {
+ switch (eClassification)
+ {
+ case task::InteractionClassification_ERROR:
+ xBox.reset(new ErrorBox(pParent,
+ nButtonMask,
+ aText.makeStringAndClear()));
+ break;
+
+ case task::InteractionClassification_WARNING:
+ xBox.reset(new WarningBox(pParent,
+ nButtonMask,
+ aText.makeStringAndClear()));
+ break;
+
+ case task::InteractionClassification_INFO:
+ if ((nButtonMask & 0x01F00000) == WB_DEF_OK)
+ //TODO! missing win bit button mask define (want to ignore
+ // any default button settings)...
+ xBox.reset(new InfoBox(pParent,
+ aText.makeStringAndClear()));
+ else
+ xBox.reset(new ErrorBox(pParent,
+ nButtonMask,
+ aText.makeStringAndClear()));
+ break;
+
+ case task::InteractionClassification_QUERY:
+ xBox.reset(new QueryBox(pParent,
+ nButtonMask,
+ aText.makeStringAndClear()));
+ break;
+
+ default:
+ OSL_ASSERT(false);
+ break;
+ }
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+
+ USHORT aResult = xBox->Execute();
+ switch( aResult )
+ {
+ case BUTTONID_OK:
+ aResult = ERRCODE_BUTTON_OK;
+ break;
+ case BUTTONID_CANCEL:
+ aResult = ERRCODE_BUTTON_CANCEL;
+ break;
+ case BUTTONID_YES:
+ aResult = ERRCODE_BUTTON_YES;
+ break;
+ case BUTTONID_NO:
+ aResult = ERRCODE_BUTTON_NO;
+ break;
+ case BUTTONID_RETRY:
+ aResult = ERRCODE_BUTTON_RETRY;
+ break;
+ }
+
+ return aResult;
+}
+
+}
+
+void
+UUIInteractionHelper::handleErrorHandlerRequest(
+ task::InteractionClassification eClassification,
+ ErrCode nErrorCode,
+ std::vector< rtl::OUString > const & rArguments,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((uno::RuntimeException))
+{
+ if (bObtainErrorStringOnly)
+ {
+ bHasErrorString = isInformationalErrorMessageRequest(rContinuations);
+ if (!bHasErrorString)
+ return;
+ }
+
+ rtl::OUString aMessage;
+ {
+ enum Source { SOURCE_DEFAULT, SOURCE_CNT, SOURCE_SVX, SOURCE_UUI };
+ static char const * const aManager[4]
+ = { CREATEVERSIONRESMGR_NAME(ofa),
+ CREATEVERSIONRESMGR_NAME(cnt),
+ CREATEVERSIONRESMGR_NAME(svx),
+ CREATEVERSIONRESMGR_NAME(uui) };
+ static USHORT const aId[4]
+ = { RID_ERRHDL,
+ RID_CHAOS_START + 12,
+ // cf. chaos/source/inc/cntrids.hrc, where
+ // #define RID_CHAOS_ERRHDL (RID_CHAOS_START + 12)
+ RID_SVX_START + 350, // RID_SVXERRCODE
+ RID_UUI_ERRHDL };
+ ErrCode nErrorId = nErrorCode & ~ERRCODE_WARNING_MASK;
+ Source eSource = nErrorId < ERRCODE_AREA_LIB1 ?
+ SOURCE_DEFAULT :
+ nErrorId >= ERRCODE_AREA_CHAOS
+ && nErrorId < ERRCODE_AREA_CHAOS_END ?
+ SOURCE_CNT :
+ nErrorId >= ERRCODE_AREA_SVX
+ && nErrorId <= ERRCODE_AREA_SVX_END ?
+ SOURCE_SVX :
+ SOURCE_UUI;
+
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ std::auto_ptr< ResMgr > xManager;
+ xManager.reset(ResMgr::CreateResMgr(aManager[eSource]));
+ if (!xManager.get())
+ return;
+ ResId aResId(aId[eSource], *xManager.get());
+ if (!ErrorResource(aResId).getString(nErrorCode, &aMessage))
+ return;
+ }
+
+ aMessage = replaceMessageWithArguments( aMessage, rArguments );
+
+ if (bObtainErrorStringOnly)
+ {
+ rErrorString = aMessage;
+ return;
+ }
+ else
+ {
+ //TODO! It can happen that the buttons calculated below do not match
+ // the error text from the resource (e.g., some text that is not a
+ // question, but YES and NO buttons). Some error texts have
+ // ExtraData that specifies a set of buttons, but that data is not
+ // really useful, because a single error text may well make sense
+ // both with only an OK button and with RETRY and CANCEL buttons.
+
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionDisapprove > xDisapprove;
+ uno::Reference< task::XInteractionRetry > xRetry;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ getContinuations(
+ rContinuations, &xApprove, &xDisapprove, &xRetry, &xAbort);
+
+ // The following mapping uses the bit mask
+ // Approve = 8,
+ // Disapprove = 4,
+ // Retry = 2,
+ // Abort = 1
+ //
+ // The mapping has five properties on which the code to select the
+ // correct continuation relies:
+ // 1 The OK button is mapped to Approve if that is available,
+ // otherwise to Abort if that is available, otherwise to none.
+ // 2 The CANCEL button is always mapped to Abort.
+ // 3 The RETRY button is always mapped to Retry.
+ // 4 The NO button is always mapped to Disapprove.
+ // 5 The YES button is always mapped to Approve.
+ //
+ // Because the WinBits button combinations are quite restricted, not
+ // every request can be served here.
+ //
+ // Finally, it seems to be better to leave default button
+ // determination to VCL (the favouring of CANCEL as default button
+ // seems to not always be what the user wants)...
+ WinBits const aButtonMask[16]
+ = { 0,
+ WB_OK /*| WB_DEF_OK*/, // Abort
+ 0,
+ WB_RETRY_CANCEL /*| WB_DEF_CANCEL*/, // Retry, Abort
+ 0,
+ 0,
+ 0,
+ 0,
+ WB_OK /*| WB_DEF_OK*/, // Approve
+ WB_OK_CANCEL /*| WB_DEF_CANCEL*/, // Approve, Abort
+ 0,
+ 0,
+ WB_YES_NO /*| WB_DEF_NO*/, // Approve, Disapprove
+ WB_YES_NO_CANCEL /*| WB_DEF_CANCEL*/,
+ // Approve, Disapprove, Abort
+ 0,
+ 0 };
+
+ WinBits nButtonMask = aButtonMask[(xApprove.is() ? 8 : 0)
+ | (xDisapprove.is() ? 4 : 0)
+ | (xRetry.is() ? 2 : 0)
+ | (xAbort.is() ? 1 : 0)];
+ if (nButtonMask == 0)
+ return;
+
+ //TODO! remove this backwards compatibility?
+ rtl::OUString aContext(getContextProperty());
+ if (aContext.getLength() == 0 && nErrorCode != 0)
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ ErrorContext * pContext = ErrorContext::GetContext();
+ if (pContext)
+ {
+ UniString aContextString;
+ if (pContext->GetString(nErrorCode, aContextString))
+ aContext = aContextString;
+ }
+ }
+
+ USHORT nResult = executeErrorDialog(
+ getParentProperty(), eClassification, aContext, aMessage, nButtonMask );
+
+ switch (nResult)
+ {
+ case ERRCODE_BUTTON_OK:
+ OSL_ENSURE(xApprove.is() || xAbort.is(), "unexpected situation");
+ if (xApprove.is())
+ xApprove->select();
+ else if (xAbort.is())
+ xAbort->select();
+ break;
+
+ case ERRCODE_BUTTON_CANCEL:
+ OSL_ENSURE(xAbort.is(), "unexpected situation");
+ if (xAbort.is())
+ xAbort->select();
+ break;
+
+ case ERRCODE_BUTTON_RETRY:
+ OSL_ENSURE(xRetry.is(), "unexpected situation");
+ if (xRetry.is())
+ xRetry->select();
+ break;
+
+ case ERRCODE_BUTTON_NO:
+ OSL_ENSURE(xDisapprove.is(), "unexpected situation");
+ if (xDisapprove.is())
+ xDisapprove->select();
+ break;
+
+ case ERRCODE_BUTTON_YES:
+ OSL_ENSURE(xApprove.is(), "unexpected situation");
+ if (xApprove.is())
+ xApprove->select();
+ break;
+ }
+
+ }
+}
diff --git a/uui/source/iahndl-filter.cxx b/uui/source/iahndl-filter.cxx
new file mode 100644
index 0000000000..4c56e8566c
--- /dev/null
+++ b/uui/source/iahndl-filter.cxx
@@ -0,0 +1,474 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "com/sun/star/beans/XPropertyAccess.hpp"
+#include "com/sun/star/container/XContainerQuery.hpp"
+#include "com/sun/star/container/XNameContainer.hpp"
+#include "com/sun/star/document/AmbigousFilterRequest.hpp"
+#include "com/sun/star/document/FilterOptionsRequest.hpp"
+#include "com/sun/star/document/NoSuchFilterRequest.hpp"
+#include "com/sun/star/document/XImporter.hpp"
+#include "com/sun/star/document/XInteractionFilterOptions.hpp"
+#include "com/sun/star/document/XInteractionFilterSelect.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/task/XInteractionAbort.hpp"
+#include "com/sun/star/task/XInteractionRequest.hpp"
+#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp"
+
+#include "vos/mutex.hxx"
+#include "comphelper/sequenceashashmap.hxx"
+#include "vcl/svapp.hxx"
+
+#include "getcontinuations.hxx"
+#include "fltdlg.hxx"
+
+#include "iahndl.hxx"
+
+using namespace com::sun::star;
+
+namespace {
+
+void
+executeFilterDialog(
+ Window * pParent ,
+ rtl::OUString const & rURL ,
+ uui::FilterNameList const & rFilters,
+ rtl::OUString & rFilter )
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+
+ std::auto_ptr< uui::FilterDialog > xDialog(
+ new uui::FilterDialog(pParent, xManager.get()));
+
+ xDialog->SetURL(rURL);
+ xDialog->ChangeFilters(&rFilters);
+
+ uui::FilterNameListPtr pSelected = rFilters.end();
+ if( xDialog->AskForFilter( pSelected ) )
+ {
+ rFilter = pSelected->sInternal;
+ }
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+void
+handleNoSuchFilterRequest_(
+ Window * pParent,
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ document::NoSuchFilterRequest const & rRequest,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations )
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< document::XInteractionFilterSelect > xFilterTransport;
+ getContinuations(rContinuations, &xAbort, &xFilterTransport);
+
+ // check neccessary ressources - if they don't exist - abort or
+ // break this operation
+ if (!xAbort.is())
+ return;
+
+ if (!xFilterTransport.is())
+ {
+ xAbort->select();
+ return;
+ }
+
+ uno::Reference< container::XContainerQuery > xFilterContainer;
+ try
+ {
+ xFilterContainer.set( xServiceFactory->createInstance(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.document.FilterFactory") ),
+ uno::UNO_QUERY );
+ }
+ catch ( uno::Exception const & )
+ {
+ }
+
+ if (!xFilterContainer.is())
+ {
+ xAbort->select();
+ return;
+ }
+
+ uui::FilterNameList lNames;
+
+ // Note: We look for all filters here which match the following criteria:
+ // - they are import filters as minimum (of course they can
+ // support export too)
+ // - we don't show any filter which are flaged as "don't show it
+ // at the UI" or "they are not installed"
+ // - we ignore filters, which have not set any valid
+ // DocumentService (e.g. our pure graphic filters)
+ // - we show it sorted by her UIName's
+ // - We don't use the order flag or prefer default filters.
+ // (Because this list shows all filters and the user should
+ // find his filter vry easy by his UIName ...)
+ // - We use "_query_all" here ... but we filter graphic filters
+ // out by using DocumentService property later!
+ uno::Reference< container::XEnumeration > xFilters
+ = xFilterContainer->createSubSetEnumerationByQuery(
+ ::rtl::OUString::createFromAscii(
+ "_query_all:sort_prop=uiname:iflags=1:eflags=143360"));
+ while (xFilters->hasMoreElements())
+ {
+ try
+ {
+ ::comphelper::SequenceAsHashMap lProps(xFilters->nextElement());
+ uui::FilterNamePair aPair;
+
+ aPair.sInternal = lProps.getUnpackedValueOrDefault(
+ rtl::OUString::createFromAscii("Name"), ::rtl::OUString());
+ aPair.sUI = lProps.getUnpackedValueOrDefault(
+ rtl::OUString::createFromAscii("UIName"), ::rtl::OUString());
+ if ( (!aPair.sInternal.Len()) || (!aPair.sUI.Len() ) )
+ {
+ continue;
+ }
+ lNames.push_back( aPair );
+ }
+ catch(const uno::RuntimeException&)
+ {
+ throw;
+ }
+ catch(const uno::Exception&)
+ {
+ continue;
+ }
+ }
+
+ // no list available for showing
+ // -> abort operation
+ if (lNames.size()<1)
+ {
+ xAbort->select();
+ return;
+ }
+
+ // let the user select the right filter
+ rtl::OUString sSelectedFilter;
+ executeFilterDialog( pParent,
+ rRequest.URL,
+ lNames,
+ sSelectedFilter );
+
+ // If he doesn't select anyone
+ // -> abort operation
+ if (sSelectedFilter.getLength()<1)
+ {
+ xAbort->select();
+ return;
+ }
+
+ // otherwhise set it for return
+ xFilterTransport->setFilter( sSelectedFilter );
+ xFilterTransport->select();
+}
+
+void
+handleAmbigousFilterRequest_(
+ Window * pParent,
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ document::AmbigousFilterRequest const & rRequest,
+ uno::Sequence<
+ uno::Reference<
+ task::XInteractionContinuation > > const & rContinuations)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< document::XInteractionFilterSelect > xFilterTransport;
+ getContinuations(rContinuations, &xAbort, &xFilterTransport);
+
+ uui::FilterNameList lNames;
+
+ uno::Reference< container::XNameContainer > xFilterContainer;
+ try
+ {
+ xFilterContainer.set( xServiceFactory->createInstance(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.document.FilterFactory") ),
+ uno::UNO_QUERY );
+ }
+ catch ( uno::Exception & )
+ {
+ }
+
+ if( xFilterContainer.is() )
+ {
+ uno::Any aPackedSet ;
+ uno::Sequence< beans::PropertyValue > lProps ;
+ sal_Int32 nStep ;
+ uui::FilterNamePair aPair ;
+
+ try
+ {
+ aPackedSet = xFilterContainer->getByName( rRequest.SelectedFilter );
+ }
+ catch(const container::NoSuchElementException&)
+ {
+ aPackedSet.clear();
+ }
+ aPackedSet >>= lProps;
+ for( nStep=0; nStep<lProps.getLength(); ++nStep )
+ {
+ if( lProps[nStep].Name.compareToAscii("UIName") == 0 )
+ {
+ ::rtl::OUString sTemp;
+ lProps[nStep].Value >>= sTemp;
+ aPair.sUI = sTemp;
+ aPair.sInternal = rRequest.SelectedFilter;
+ lNames.push_back( aPair );
+ break;
+ }
+ }
+
+ try
+ {
+ aPackedSet = xFilterContainer->getByName( rRequest.DetectedFilter );
+ }
+ catch(const container::NoSuchElementException&)
+ {
+ aPackedSet.clear();
+ }
+ aPackedSet >>= lProps;
+ for( nStep=0; nStep<lProps.getLength(); ++nStep )
+ {
+ if( lProps[nStep].Name.compareToAscii("UIName") == 0 )
+ {
+ ::rtl::OUString sTemp;
+ lProps[nStep].Value >>= sTemp;
+ aPair.sUI = sTemp;
+ aPair.sInternal = rRequest.DetectedFilter;
+ lNames.push_back( aPair );
+ break;
+ }
+ }
+ }
+
+ if( xAbort.is() && xFilterTransport.is() )
+ {
+ if( lNames.size() < 1 )
+ {
+ xAbort->select();
+ }
+ else
+ {
+ rtl::OUString sFilter;
+ executeFilterDialog( pParent,
+ rRequest.URL,
+ lNames,
+ sFilter );
+
+ if( sFilter.getLength() > 0 )
+ {
+ xFilterTransport->setFilter( sFilter );
+ xFilterTransport->select();
+ }
+ else
+ xAbort->select();
+ }
+ }
+}
+
+void
+handleFilterOptionsRequest_(
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ document::FilterOptionsRequest const & rRequest,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< document::XInteractionFilterOptions > xFilterOptions;
+ getContinuations(rContinuations, &xAbort, &xFilterOptions);
+
+ uno::Reference< container::XNameAccess > xFilterCFG;
+ try
+ {
+ xFilterCFG.set( xServiceFactory->createInstance(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.document.FilterFactory" ) ),
+ uno::UNO_QUERY );
+ }
+ catch ( uno::Exception const & )
+ {
+ }
+
+ if( xFilterCFG.is() && rRequest.rProperties.getLength() )
+ {
+ try
+ {
+ ::rtl::OUString aFilterName;
+ sal_Int32 nPropCount = rRequest.rProperties.getLength();
+ for( sal_Int32 ind = 0; ind < nPropCount; ++ind )
+ {
+ rtl::OUString tmp = rRequest.rProperties[ind].Name;
+ if( rRequest.rProperties[ind].Name.equals(
+ ::rtl::OUString::createFromAscii("FilterName")) )
+ {
+ rRequest.rProperties[ind].Value >>= aFilterName;
+ break;
+ }
+ }
+
+ uno::Sequence < beans::PropertyValue > aProps;
+ if ( xFilterCFG->getByName( aFilterName ) >>= aProps )
+ {
+ sal_Int32 nPropertyCount = aProps.getLength();
+ for( sal_Int32 nProperty=0;
+ nProperty < nPropertyCount;
+ ++nProperty )
+ if( aProps[nProperty].Name.equals(
+ ::rtl::OUString::createFromAscii("UIComponent")) )
+ {
+ ::rtl::OUString aServiceName;
+ aProps[nProperty].Value >>= aServiceName;
+ if( aServiceName.getLength() )
+ {
+ uno::Reference<
+ ui::dialogs::XExecutableDialog > xFilterDialog(
+ xServiceFactory->createInstance(
+ aServiceName ),
+ uno::UNO_QUERY );
+ uno::Reference< beans::XPropertyAccess >
+ xFilterProperties( xFilterDialog,
+ uno::UNO_QUERY );
+
+ if( xFilterDialog.is() && xFilterProperties.is() )
+ {
+ uno::Reference<
+ document::XImporter > xImporter(
+ xFilterDialog, uno::UNO_QUERY );
+ if( xImporter.is() )
+ xImporter->setTargetDocument(
+ uno::Reference< lang::XComponent >(
+ rRequest.rModel, uno::UNO_QUERY ) );
+
+ xFilterProperties->setPropertyValues(
+ rRequest.rProperties );
+
+ if( xFilterDialog->execute() )
+ {
+ xFilterOptions->setFilterOptions(
+ xFilterProperties->getPropertyValues() );
+ xFilterOptions->select();
+ return;
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ catch( container::NoSuchElementException& )
+ {
+ // the filter name is unknown
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+
+ xAbort->select();
+}
+
+} // namespace
+
+bool
+UUIInteractionHelper::handleNoSuchFilterRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ document::NoSuchFilterRequest aNoSuchFilterRequest;
+ if (aAnyRequest >>= aNoSuchFilterRequest)
+ {
+ handleNoSuchFilterRequest_(getParentProperty(),
+ m_xServiceFactory,
+ aNoSuchFilterRequest,
+ rRequest->getContinuations());
+ return true;
+ }
+ return false;
+}
+
+bool
+UUIInteractionHelper::handleAmbigousFilterRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ document::AmbigousFilterRequest aAmbigousFilterRequest;
+ if (aAnyRequest >>= aAmbigousFilterRequest)
+ {
+ handleAmbigousFilterRequest_(getParentProperty(),
+ m_xServiceFactory,
+ aAmbigousFilterRequest,
+ rRequest->getContinuations());
+ return true;
+ }
+ return false;
+}
+
+bool
+UUIInteractionHelper::handleFilterOptionsRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ document::FilterOptionsRequest aFilterOptionsRequest;
+ if (aAnyRequest >>= aFilterOptionsRequest)
+ {
+ handleFilterOptionsRequest_(m_xServiceFactory,
+ aFilterOptionsRequest,
+ rRequest->getContinuations());
+ return true;
+ }
+ return false;
+}
+
+
diff --git a/uui/source/iahndl-ioexceptions.cxx b/uui/source/iahndl-ioexceptions.cxx
new file mode 100644
index 0000000000..b9bc7b4017
--- /dev/null
+++ b/uui/source/iahndl-ioexceptions.cxx
@@ -0,0 +1,346 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: iahndl.cxx,v $
+ * $Revision: 1.67.22.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/task/XInteractionRequest.hpp"
+#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp"
+
+#include "ids.hrc"
+
+#include "iahndl.hxx"
+
+using namespace com::sun::star;
+
+namespace {
+
+bool
+getStringRequestArgument(uno::Sequence< uno::Any > const & rArguments,
+ rtl::OUString const & rKey,
+ rtl::OUString * pValue)
+ SAL_THROW(())
+{
+ for (sal_Int32 i = 0; i < rArguments.getLength(); ++i)
+ {
+ beans::PropertyValue aProperty;
+ if ((rArguments[i] >>= aProperty) && aProperty.Name == rKey)
+ {
+ rtl::OUString aValue;
+ if (aProperty.Value >>= aValue)
+ {
+ if (pValue)
+ *pValue = aValue;
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool
+getBoolRequestArgument(uno::Sequence< uno::Any > const & rArguments,
+ rtl::OUString const & rKey,
+ bool * pValue)
+ SAL_THROW(())
+{
+ for (sal_Int32 i = 0; i < rArguments.getLength(); ++i)
+ {
+ beans::PropertyValue aProperty;
+ if ((rArguments[i] >>= aProperty) && aProperty.Name == rKey)
+ {
+ sal_Bool bValue = sal_Bool();
+ if (aProperty.Value >>= bValue)
+ {
+ if (pValue)
+ *pValue = bValue;
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool
+getResourceNameRequestArgument(uno::Sequence< uno::Any > const & rArguments,
+ rtl::OUString * pValue)
+ SAL_THROW(())
+{
+ if (!getStringRequestArgument(rArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Uri")),
+ pValue))
+ return false;
+ // Use the resource name only for file URLs, to avoid confusion:
+ //TODO! work with ucp locality concept instead of hardcoded "file"?
+ if (pValue
+ && pValue->matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(
+ "file:")))
+ getStringRequestArgument(rArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "ResourceName")),
+ pValue);
+ return true;
+}
+
+} // namespace
+
+bool
+UUIInteractionHelper::handleInteractiveIOException(
+ uno::Reference< task::XInteractionRequest > const & rRequest,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+ bHasErrorString = false;
+
+ ucb::InteractiveIOException aIoException;
+ if (aAnyRequest >>= aIoException)
+ {
+ uno::Sequence< uno::Any > aRequestArguments;
+ ucb::InteractiveAugmentedIOException aAugmentedIoException;
+ if (aAnyRequest >>= aAugmentedIoException)
+ aRequestArguments = aAugmentedIoException.Arguments;
+
+ ErrCode nErrorCode;
+ std::vector< rtl::OUString > aArguments;
+ static ErrCode const
+ aErrorCode[ucb::IOErrorCode_WRONG_VERSION + 1][2]
+ = { { ERRCODE_IO_ABORT, ERRCODE_UUI_IO_ABORT }, // ABORT
+ { ERRCODE_IO_ACCESSDENIED, ERRCODE_UUI_IO_ACCESSDENIED },
+ // ACCESS_DENIED
+ { ERRCODE_IO_ALREADYEXISTS,
+ ERRCODE_UUI_IO_ALREADYEXISTS }, // ALREADY_EXISTING
+ { ERRCODE_IO_BADCRC, ERRCODE_UUI_IO_BADCRC }, // BAD_CRC
+ { ERRCODE_IO_CANTCREATE, ERRCODE_UUI_IO_CANTCREATE },
+ // CANT_CREATE
+ { ERRCODE_IO_CANTREAD, ERRCODE_UUI_IO_CANTREAD },
+ // CANT_READ
+ { ERRCODE_IO_CANTSEEK, ERRCODE_UUI_IO_CANTSEEK },
+ // CANT_SEEK
+ { ERRCODE_IO_CANTTELL, ERRCODE_UUI_IO_CANTTELL },
+ // CANT_TELL
+ { ERRCODE_IO_CANTWRITE, ERRCODE_UUI_IO_CANTWRITE },
+ // CANT_WRITE
+ { ERRCODE_IO_CURRENTDIR, ERRCODE_UUI_IO_CURRENTDIR },
+ // CURRENT_DIRECTORY
+ { ERRCODE_IO_DEVICENOTREADY, ERRCODE_UUI_IO_NOTREADY },
+ // DEVICE_NOT_READY
+ { ERRCODE_IO_NOTSAMEDEVICE,
+ ERRCODE_UUI_IO_NOTSAMEDEVICE }, // DIFFERENT_DEVICES
+ { ERRCODE_IO_GENERAL, ERRCODE_UUI_IO_GENERAL }, // GENERAL
+ { ERRCODE_IO_INVALIDACCESS,
+ ERRCODE_UUI_IO_INVALIDACCESS }, // INVALID_ACCESS
+ { ERRCODE_IO_INVALIDCHAR, ERRCODE_UUI_IO_INVALIDCHAR },
+ // INVALID_CHARACTER
+ { ERRCODE_IO_INVALIDDEVICE,
+ ERRCODE_UUI_IO_INVALIDDEVICE }, // INVALID_DEVICE
+ { ERRCODE_IO_INVALIDLENGTH,
+ ERRCODE_UUI_IO_INVALIDLENGTH }, // INVALID_LENGTH
+ { ERRCODE_IO_INVALIDPARAMETER,
+ ERRCODE_UUI_IO_INVALIDPARAMETER }, // INVALID_PARAMETER
+ { ERRCODE_IO_ISWILDCARD, ERRCODE_UUI_IO_ISWILDCARD },
+ // IS_WILDCARD
+ { ERRCODE_IO_LOCKVIOLATION,
+ ERRCODE_UUI_IO_LOCKVIOLATION }, // LOCKING_VIOLATION
+ { ERRCODE_IO_MISPLACEDCHAR,
+ ERRCODE_UUI_IO_MISPLACEDCHAR }, // MISPLACED_CHARACTER
+ { ERRCODE_IO_NAMETOOLONG, ERRCODE_UUI_IO_NAMETOOLONG },
+ // NAME_TOO_LONG
+ { ERRCODE_IO_NOTEXISTS, ERRCODE_UUI_IO_NOTEXISTS },
+ // NOT_EXISTING
+ { ERRCODE_IO_NOTEXISTSPATH,
+ ERRCODE_UUI_IO_NOTEXISTSPATH }, // NOT_EXISTING_PATH
+ { ERRCODE_IO_NOTSUPPORTED, ERRCODE_UUI_IO_NOTSUPPORTED },
+ // NOT_SUPPORTED
+ { ERRCODE_IO_NOTADIRECTORY,
+ ERRCODE_UUI_IO_NOTADIRECTORY }, // NO_DIRECTORY
+ { ERRCODE_IO_NOTAFILE, ERRCODE_UUI_IO_NOTAFILE },
+ // NO_FILE
+ { ERRCODE_IO_OUTOFSPACE, ERRCODE_UUI_IO_OUTOFSPACE },
+ // OUT_OF_DISK_SPACE
+ { ERRCODE_IO_TOOMANYOPENFILES,
+ ERRCODE_UUI_IO_TOOMANYOPENFILES },
+ // OUT_OF_FILE_HANDLES
+ { ERRCODE_IO_OUTOFMEMORY, ERRCODE_UUI_IO_OUTOFMEMORY },
+ // OUT_OF_MEMORY
+ { ERRCODE_IO_PENDING, ERRCODE_UUI_IO_PENDING }, // PENDING
+ { ERRCODE_IO_RECURSIVE, ERRCODE_UUI_IO_RECURSIVE },
+ // RECURSIVE
+ { ERRCODE_IO_UNKNOWN, ERRCODE_UUI_IO_UNKNOWN }, // UNKNOWN
+ { ERRCODE_IO_WRITEPROTECTED,
+ ERRCODE_UUI_IO_WRITEPROTECTED }, // WRITE_PROTECTED
+ { ERRCODE_IO_WRONGFORMAT, ERRCODE_UUI_IO_WRONGFORMAT },
+ // WRONG_FORMAT
+ { ERRCODE_IO_WRONGVERSION,
+ ERRCODE_UUI_IO_WRONGVERSION } }; // WRONG_VERSION
+ switch (aIoException.Code)
+ {
+ case ucb::IOErrorCode_CANT_CREATE:
+ {
+ rtl::OUString aArgFolder;
+ if (getStringRequestArgument(
+ aRequestArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Folder")),
+ &aArgFolder))
+ {
+ rtl::OUString aArgUri;
+ if (getResourceNameRequestArgument(aRequestArguments,
+ &aArgUri))
+ {
+ nErrorCode = ERRCODE_UUI_IO_CANTCREATE;
+ aArguments.reserve(2);
+ aArguments.push_back(aArgUri);
+ aArguments.push_back(aArgFolder);
+ }
+ else
+ {
+ nErrorCode = ERRCODE_UUI_IO_CANTCREATE_NONAME;
+ aArguments.push_back(aArgFolder);
+ }
+ }
+ else
+ nErrorCode = aErrorCode[aIoException.Code][0];
+ break;
+ }
+
+ case ucb::IOErrorCode_DEVICE_NOT_READY:
+ {
+ rtl::OUString aArgUri;
+ if (getResourceNameRequestArgument(aRequestArguments,
+ &aArgUri))
+ {
+ rtl::OUString aResourceType;
+ getStringRequestArgument(
+ aRequestArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "ResourceType")),
+ &aResourceType);
+ bool bRemovable = false;
+ getBoolRequestArgument(aRequestArguments,
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "Removable")),
+ &bRemovable);
+ nErrorCode
+ = aResourceType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("volume"))
+ ? (bRemovable
+ ? ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE
+ : ERRCODE_UUI_IO_NOTREADY_VOLUME)
+ : (bRemovable
+ ? ERRCODE_UUI_IO_NOTREADY_REMOVABLE
+ : ERRCODE_UUI_IO_NOTREADY);
+ aArguments.push_back(aArgUri);
+ }
+ else
+ nErrorCode = aErrorCode[aIoException.Code][0];
+ break;
+ }
+
+ case ucb::IOErrorCode_DIFFERENT_DEVICES:
+ {
+ rtl::OUString aArgVolume;
+ rtl::OUString aArgOtherVolume;
+ if (getStringRequestArgument(
+ aRequestArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "Volume")),
+ &aArgVolume)
+ && getStringRequestArgument(
+ aRequestArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "OtherVolume")),
+ &aArgOtherVolume))
+ {
+ nErrorCode = aErrorCode[aIoException.Code][1];
+ aArguments.reserve(2);
+ aArguments.push_back(aArgVolume);
+ aArguments.push_back(aArgOtherVolume);
+ }
+ else
+ nErrorCode = aErrorCode[aIoException.Code][0];
+ break;
+ }
+
+ case ucb::IOErrorCode_NOT_EXISTING:
+ {
+ rtl::OUString aArgUri;
+ if (getResourceNameRequestArgument(aRequestArguments,
+ &aArgUri))
+ {
+ rtl::OUString aResourceType;
+ getStringRequestArgument(
+ aRequestArguments,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "ResourceType")),
+ &aResourceType);
+ nErrorCode
+ = aResourceType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("volume"))
+ ? ERRCODE_UUI_IO_NOTEXISTS_VOLUME
+ : (aResourceType.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("folder"))
+ ? ERRCODE_UUI_IO_NOTEXISTS_FOLDER
+ : ERRCODE_UUI_IO_NOTEXISTS);
+ aArguments.push_back(aArgUri);
+ }
+ else
+ nErrorCode = aErrorCode[aIoException.Code][0];
+ break;
+ }
+
+ default:
+ {
+ rtl::OUString aArgUri;
+ if (getResourceNameRequestArgument(aRequestArguments,
+ &aArgUri))
+ {
+ nErrorCode = aErrorCode[aIoException.Code][1];
+ aArguments.push_back(aArgUri);
+ }
+ else
+ nErrorCode = aErrorCode[aIoException.Code][0];
+ break;
+ }
+ }
+
+ handleErrorHandlerRequest(aIoException.Classification,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+ return false;
+}
diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx
new file mode 100644
index 0000000000..48409235d6
--- /dev/null
+++ b/uui/source/iahndl-locking.cxx
@@ -0,0 +1,319 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <memory>
+
+#include "com/sun/star/document/ChangedByOthersRequest.hpp"
+#include "com/sun/star/document/LockedDocumentRequest.hpp"
+#include "com/sun/star/document/LockedOnSavingRequest.hpp"
+#include "com/sun/star/document/LockFileIgnoreRequest.hpp"
+#include "com/sun/star/document/OwnLockOnDocumentRequest.hpp"
+#include "com/sun/star/task/XInteractionApprove.hpp"
+#include "com/sun/star/task/XInteractionDisapprove.hpp"
+#include "com/sun/star/task/XInteractionAbort.hpp"
+#include "com/sun/star/task/XInteractionRequest.hpp"
+
+#include "vos/mutex.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/msgbox.hxx"
+
+#include "ids.hrc"
+#include "getcontinuations.hxx"
+#include "openlocked.hxx"
+#include "trylater.hxx"
+#include "alreadyopen.hxx"
+#include "filechanged.hxx"
+#include "lockfailed.hxx"
+
+#include "iahndl.hxx"
+
+#define UUI_DOC_LOAD_LOCK 0
+#define UUI_DOC_OWN_LOAD_LOCK 1
+#define UUI_DOC_SAVE_LOCK 2
+#define UUI_DOC_OWN_SAVE_LOCK 3
+
+using namespace com::sun::star;
+
+namespace {
+
+void
+handleLockedDocumentRequest_(
+ Window * pParent,
+ const ::rtl::OUString& aDocumentURL,
+ const ::rtl::OUString& aInfo,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations,
+ sal_uInt16 nMode )
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionDisapprove > xDisapprove;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ getContinuations(rContinuations, &xApprove, &xDisapprove, &xAbort);
+
+ if ( !xApprove.is() || !xDisapprove.is() || !xAbort.is() )
+ return;
+
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if (!xManager.get())
+ return;
+
+ ::rtl::OUString aMessage;
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back( aDocumentURL );
+
+ sal_Int32 nResult = RET_CANCEL;
+ if ( nMode == UUI_DOC_LOAD_LOCK )
+ {
+ aArguments.push_back( aInfo.getLength()
+ ? aInfo
+ : ::rtl::OUString( String(
+ ResId( STR_UNKNOWNUSER,
+ *xManager.get() ) ) ) );
+ aMessage = String( ResId( STR_OPENLOCKED_MSG, *xManager.get() ) );
+ aMessage = UUIInteractionHelper::replaceMessageWithArguments(
+ aMessage, aArguments );
+
+ std::auto_ptr< OpenLockedQueryBox > xDialog(new OpenLockedQueryBox(
+ pParent, xManager.get(), aMessage ) );
+ nResult = xDialog->Execute();
+ }
+ else if ( nMode == UUI_DOC_SAVE_LOCK )
+ {
+ aArguments.push_back( aInfo.getLength()
+ ? aInfo
+ : ::rtl::OUString( String(
+ ResId( STR_UNKNOWNUSER,
+ *xManager.get() ) ) ) );
+ aMessage = String( ResId( STR_TRYLATER_MSG, *xManager.get() ) );
+ aMessage = UUIInteractionHelper::replaceMessageWithArguments(
+ aMessage, aArguments );
+
+ std::auto_ptr< TryLaterQueryBox > xDialog(
+ new TryLaterQueryBox( pParent, xManager.get(), aMessage ) );
+ nResult = xDialog->Execute();
+ }
+ else if ( nMode == UUI_DOC_OWN_LOAD_LOCK ||
+ nMode == UUI_DOC_OWN_SAVE_LOCK )
+ {
+ aArguments.push_back( aInfo );
+ aMessage = String( ResId( nMode == UUI_DOC_OWN_SAVE_LOCK
+ ? STR_ALREADYOPEN_SAVE_MSG
+ : STR_ALREADYOPEN_MSG,
+ *xManager.get() ) );
+ aMessage = UUIInteractionHelper::replaceMessageWithArguments(
+ aMessage, aArguments );
+
+ std::auto_ptr< AlreadyOpenQueryBox > xDialog(
+ new AlreadyOpenQueryBox( pParent,
+ xManager.get(),
+ aMessage,
+ nMode == UUI_DOC_OWN_SAVE_LOCK ) );
+ nResult = xDialog->Execute();
+ }
+
+ if ( nResult == RET_YES )
+ xApprove->select();
+ else if ( nResult == RET_NO )
+ xDisapprove->select();
+ else
+ xAbort->select();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+void
+handleChangedByOthersRequest_(
+ Window * pParent,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations )
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ getContinuations(rContinuations, &xApprove, &xAbort);
+
+ if ( !xApprove.is() || !xAbort.is() )
+ return;
+
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if (!xManager.get())
+ return;
+
+ std::auto_ptr< FileChangedQueryBox > xDialog(
+ new FileChangedQueryBox( pParent, xManager.get() ) );
+ sal_Int32 nResult = xDialog->Execute();
+
+ if ( nResult == RET_YES )
+ xApprove->select();
+ else
+ xAbort->select();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+void
+handleLockFileIgnoreRequest_(
+ Window * pParent,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations )
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ getContinuations(rContinuations, &xApprove, &xAbort);
+
+ if ( !xApprove.is() || !xAbort.is() )
+ return;
+
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ if (!xManager.get())
+ return;
+
+ std::auto_ptr< LockFailedQueryBox > xDialog(
+ new LockFailedQueryBox( pParent, xManager.get() ) );
+ sal_Int32 nResult = xDialog->Execute();
+
+ if ( nResult == RET_OK )
+ xApprove->select();
+ else
+ xAbort->select();
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+} // namespace
+
+bool
+UUIInteractionHelper::handleLockedDocumentRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((::com::sun::star::uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ document::LockedDocumentRequest aLockedDocumentRequest;
+ if (aAnyRequest >>= aLockedDocumentRequest )
+ {
+ handleLockedDocumentRequest_( getParentProperty(),
+ aLockedDocumentRequest.DocumentURL,
+ aLockedDocumentRequest.UserInfo,
+ rRequest->getContinuations(),
+ UUI_DOC_LOAD_LOCK );
+ return true;
+ }
+
+ document::OwnLockOnDocumentRequest aOwnLockOnDocumentRequest;
+ if (aAnyRequest >>= aOwnLockOnDocumentRequest )
+ {
+ handleLockedDocumentRequest_( getParentProperty(),
+ aOwnLockOnDocumentRequest.DocumentURL,
+ aOwnLockOnDocumentRequest.TimeInfo,
+ rRequest->getContinuations(),
+ aOwnLockOnDocumentRequest.IsStoring
+ ? UUI_DOC_OWN_SAVE_LOCK
+ : UUI_DOC_OWN_LOAD_LOCK );
+ return true;
+ }
+
+ document::LockedOnSavingRequest aLockedOnSavingRequest;
+ if (aAnyRequest >>= aLockedOnSavingRequest )
+ {
+ handleLockedDocumentRequest_( getParentProperty(),
+ aLockedOnSavingRequest.DocumentURL,
+ aLockedOnSavingRequest.UserInfo,
+ rRequest->getContinuations(),
+ UUI_DOC_SAVE_LOCK );
+ return true;
+ }
+ return false;
+}
+
+bool
+UUIInteractionHelper::handleChangedByOthersRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ document::ChangedByOthersRequest aChangedByOthersRequest;
+ if (aAnyRequest >>= aChangedByOthersRequest )
+ {
+ handleChangedByOthersRequest_( getParentProperty(),
+ rRequest->getContinuations() );
+ return true;
+ }
+ return false;
+}
+
+bool
+UUIInteractionHelper::handleLockFileIgnoreRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ document::LockFileIgnoreRequest aLockFileIgnoreRequest;
+ if (aAnyRequest >>= aLockFileIgnoreRequest )
+ {
+ handleLockFileIgnoreRequest_( getParentProperty(),
+ rRequest->getContinuations() );
+ return true;
+ }
+ return false;
+}
+
+
diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx
new file mode 100644
index 0000000000..e5e1a14bb2
--- /dev/null
+++ b/uui/source/iahndl-ssl.cxx
@@ -0,0 +1,360 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "com/sun/star/security/CertificateValidity.hpp"
+#include "com/sun/star/task/XInteractionAbort.hpp"
+#include "com/sun/star/task/XInteractionApprove.hpp"
+#include "com/sun/star/task/XInteractionRequest.hpp"
+#include "com/sun/star/ucb/CertificateValidationRequest.hpp"
+
+#include "vos/mutex.hxx"
+#include "tools/datetime.hxx"
+#include "svl/zforlist.hxx"
+#include "vcl/svapp.hxx"
+
+#include "ids.hrc"
+#include "getcontinuations.hxx"
+#include "sslwarndlg.hxx"
+#include "unknownauthdlg.hxx"
+
+#include "iahndl.hxx"
+
+#define DESCRIPTION_1 1
+#define DESCRIPTION_2 2
+#define TITLE 3
+
+using namespace com::sun::star;
+
+namespace {
+
+String
+getContentPart( const String& _rRawString )
+{
+ // search over some parts to find a string
+ //static char* aIDs[] = { "CN", "OU", "O", "E", NULL };
+ static char const * aIDs[] = { "CN=", "OU=", "O=", "E=", NULL };// By CP
+ String sPart;
+ int i = 0;
+ while ( aIDs[i] )
+ {
+ String sPartId = String::CreateFromAscii( aIDs[i++] );
+ xub_StrLen nContStart = _rRawString.Search( sPartId );
+ if ( nContStart != STRING_NOTFOUND )
+ {
+ nContStart = nContStart + sPartId.Len();
+ xub_StrLen nContEnd
+ = _rRawString.Search( sal_Unicode( ',' ), nContStart );
+ sPart = String( _rRawString, nContStart, nContEnd - nContStart );
+ break;
+ }
+ }
+ return sPart;
+}
+
+bool
+isDomainMatch(
+ rtl::OUString hostName, rtl::OUString certHostName)
+{
+ if (hostName.equalsIgnoreAsciiCase( certHostName ))
+ return true;
+
+ if ( 0 == certHostName.indexOf( rtl::OUString::createFromAscii( "*" ) ) &&
+ hostName.getLength() >= certHostName.getLength() )
+ {
+ rtl::OUString cmpStr = certHostName.copy( 1 );
+
+ if ( hostName.matchIgnoreAsciiCase(
+ cmpStr, hostName.getLength() - cmpStr.getLength()) )
+ return true;
+ }
+
+ return false;
+}
+
+rtl::OUString
+getLocalizedDatTimeStr(
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ util::DateTime const & rDateTime )
+{
+ rtl::OUString aDateTimeStr;
+ Date aDate;
+ Time aTime;
+
+ aDate = Date( rDateTime.Day, rDateTime.Month, rDateTime.Year );
+ aTime = Time( rDateTime.Hours, rDateTime.Minutes, rDateTime.Seconds );
+
+ LanguageType eUILang = Application::GetSettings().GetUILanguage();
+ SvNumberFormatter *pNumberFormatter
+ = new SvNumberFormatter( xServiceFactory, eUILang );
+ String aTmpStr;
+ Color* pColor = NULL;
+ Date* pNullDate = pNumberFormatter->GetNullDate();
+ sal_uInt32 nFormat
+ = pNumberFormatter->GetStandardFormat( NUMBERFORMAT_DATE, eUILang );
+
+ pNumberFormatter->GetOutputString(
+ aDate - *pNullDate, nFormat, aTmpStr, &pColor );
+ aDateTimeStr = aTmpStr + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
+
+ nFormat = pNumberFormatter->GetStandardFormat( NUMBERFORMAT_TIME, eUILang );
+ pNumberFormatter->GetOutputString(
+ aTime.GetTimeInDays(), nFormat, aTmpStr, &pColor );
+ aDateTimeStr += aTmpStr;
+
+ return aDateTimeStr;
+}
+
+sal_Bool
+executeUnknownAuthDialog(
+ Window * pParent,
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ const uno::Reference< security::XCertificate >& rXCert)
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ std::auto_ptr< UnknownAuthDialog > xDialog(
+ new UnknownAuthDialog( pParent,
+ rXCert,
+ xServiceFactory,
+ xManager.get()));
+
+ // Get correct ressource string
+ rtl::OUString aMessage;
+
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back( getContentPart( rXCert->getSubjectName()) );
+
+ if (xManager.get())
+ {
+ ResId aResId(RID_UUI_ERRHDL, *xManager.get());
+ if (ErrorResource(aResId).getString(
+ ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED, &aMessage))
+ {
+ aMessage = UUIInteractionHelper::replaceMessageWithArguments(
+ aMessage, aArguments );
+ xDialog->setDescriptionText( aMessage );
+ }
+ }
+
+ return static_cast<sal_Bool> (xDialog->Execute());
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+sal_Bool
+executeSSLWarnDialog(
+ Window * pParent,
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ const uno::Reference< security::XCertificate >& rXCert,
+ sal_Int32 const & failure,
+ const rtl::OUString & hostName )
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ std::auto_ptr< SSLWarnDialog > xDialog(
+ new SSLWarnDialog( pParent,
+ rXCert,
+ xServiceFactory,
+ xManager.get()));
+
+ // Get correct ressource string
+ rtl::OUString aMessage_1;
+ std::vector< rtl::OUString > aArguments_1;
+
+ switch( failure )
+ {
+ case SSLWARN_TYPE_DOMAINMISMATCH:
+ aArguments_1.push_back( hostName );
+ aArguments_1.push_back(
+ getContentPart( rXCert->getSubjectName()) );
+ aArguments_1.push_back( hostName );
+ break;
+ case SSLWARN_TYPE_EXPIRED:
+ aArguments_1.push_back(
+ getContentPart( rXCert->getSubjectName()) );
+ aArguments_1.push_back(
+ getLocalizedDatTimeStr( xServiceFactory,
+ rXCert->getNotValidAfter() ) );
+ aArguments_1.push_back(
+ getLocalizedDatTimeStr( xServiceFactory,
+ rXCert->getNotValidAfter() ) );
+ break;
+ case SSLWARN_TYPE_INVALID:
+ break;
+ }
+
+ if (xManager.get())
+ {
+ ResId aResId(RID_UUI_ERRHDL, *xManager.get());
+ if (ErrorResource(aResId).getString(
+ ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + DESCRIPTION_1,
+ &aMessage_1))
+ {
+ aMessage_1 = UUIInteractionHelper::replaceMessageWithArguments(
+ aMessage_1, aArguments_1 );
+ xDialog->setDescription1Text( aMessage_1 );
+ }
+
+ rtl::OUString aTitle;
+ ErrorResource(aResId).getString(
+ ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + TITLE, &aTitle);
+ xDialog->SetText( aTitle );
+ }
+
+ return static_cast<sal_Bool> (xDialog->Execute());
+ }
+ catch (std::bad_alloc const &)
+ {
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+ uno::Reference< uno::XInterface >());
+ }
+}
+
+void
+handleCertificateValidationRequest_(
+ Window * pParent,
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory,
+ ucb::CertificateValidationRequest const & rRequest,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ getContinuations(rContinuations, &xApprove, &xAbort);
+
+ sal_Int32 failures = rRequest.CertificateValidity;
+ sal_Bool trustCert = sal_True;
+
+ if ( ((failures & security::CertificateValidity::UNTRUSTED)
+ == security::CertificateValidity::UNTRUSTED ) ||
+ ((failures & security::CertificateValidity::ISSUER_UNTRUSTED)
+ == security::CertificateValidity::ISSUER_UNTRUSTED) ||
+ ((failures & security::CertificateValidity::ROOT_UNTRUSTED)
+ == security::CertificateValidity::ROOT_UNTRUSTED) )
+ {
+ trustCert = executeUnknownAuthDialog( pParent,
+ xServiceFactory,
+ rRequest.Certificate );
+ }
+
+ if ( (!isDomainMatch(
+ rRequest.HostName,
+ getContentPart(
+ rRequest.Certificate->getSubjectName()) )) &&
+ trustCert )
+ {
+ trustCert = executeSSLWarnDialog( pParent,
+ xServiceFactory,
+ rRequest.Certificate,
+ SSLWARN_TYPE_DOMAINMISMATCH,
+ rRequest.HostName );
+ }
+
+ if ( (((failures & security::CertificateValidity::TIME_INVALID)
+ == security::CertificateValidity::TIME_INVALID) ||
+ ((failures & security::CertificateValidity::NOT_TIME_NESTED)
+ == security::CertificateValidity::NOT_TIME_NESTED)) &&
+ trustCert )
+ {
+ trustCert = executeSSLWarnDialog( pParent,
+ xServiceFactory,
+ rRequest.Certificate,
+ SSLWARN_TYPE_EXPIRED,
+ rRequest.HostName );
+ }
+
+ if ( (((failures & security::CertificateValidity::REVOKED)
+ == security::CertificateValidity::REVOKED) ||
+ ((failures & security::CertificateValidity::SIGNATURE_INVALID)
+ == security::CertificateValidity::SIGNATURE_INVALID) ||
+ ((failures & security::CertificateValidity::EXTENSION_INVALID)
+ == security::CertificateValidity::EXTENSION_INVALID) ||
+ ((failures & security::CertificateValidity::INVALID)
+ == security::CertificateValidity::INVALID)) &&
+ trustCert )
+ {
+ trustCert = executeSSLWarnDialog( pParent,
+ xServiceFactory,
+ rRequest.Certificate,
+ SSLWARN_TYPE_INVALID,
+ rRequest.HostName );
+ }
+
+ if ( trustCert )
+ {
+ if (xApprove.is())
+ xApprove->select();
+ }
+ else
+ {
+ if (xAbort.is())
+ xAbort->select();
+ }
+}
+
+} // namespace
+
+bool
+UUIInteractionHelper::handleCertificateValidationRequest(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ ucb::CertificateValidationRequest aCertificateValidationRequest;
+ if (aAnyRequest >>= aCertificateValidationRequest)
+ {
+ handleCertificateValidationRequest_(getParentProperty(),
+ m_xServiceFactory,
+ aCertificateValidationRequest,
+ rRequest->getContinuations());
+ return true;
+ }
+
+ return false;
+}
+
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index cc65580aec..98acd5f1c3 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -28,411 +28,93 @@
*
************************************************************************/
-#include "iahndl.hxx"
-
#include <memory>
-#include "osl/diagnose.h"
-#include "osl/conditn.hxx"
-#include "rtl/digest.h"
-#include "rtl/ustrbuf.hxx"
+#include "com/sun/star/awt/XWindow.hpp"
#include "com/sun/star/beans/PropertyValue.hpp"
-#include "com/sun/star/beans/XPropertyAccess.hpp"
#include "com/sun/star/configuration/backend/MergeRecoveryRequest.hpp"
#include "com/sun/star/configuration/backend/StratumCreationException.hpp"
-#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
-#include "com/sun/star/container/XContainerQuery.hpp"
-#include "com/sun/star/container/XNameAccess.hpp"
-#include "com/sun/star/container/XNameContainer.hpp"
+#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
#include "com/sun/star/document/BrokenPackageRequest.hpp"
-#include "com/sun/star/document/FilterOptionsRequest.hpp"
-#include "com/sun/star/document/NoSuchFilterRequest.hpp"
-#include "com/sun/star/document/AmbigousFilterRequest.hpp"
-#include "com/sun/star/document/LockedDocumentRequest.hpp"
-#include "com/sun/star/document/OwnLockOnDocumentRequest.hpp"
-#include "com/sun/star/document/LockedOnSavingRequest.hpp"
-#include "com/sun/star/document/ChangedByOthersRequest.hpp"
-#include "com/sun/star/document/LockFileIgnoreRequest.hpp"
-#include "com/sun/star/document/XImporter.hpp"
-#include "com/sun/star/document/XInteractionFilterOptions.hpp"
-#include "com/sun/star/document/XInteractionFilterSelect.hpp"
+#include "com/sun/star/task/DocumentMacroConfirmationRequest.hpp"
+#include "com/sun/star/task/DocumentMacroConfirmationRequest2.hpp"
#include "com/sun/star/java/WrongJavaVersionException.hpp"
+#include "com/sun/star/lang/XInitialization.hpp"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/script/ModuleSizeExceededRequest.hpp"
#include "com/sun/star/sync2/BadPartnershipException.hpp"
-#include "com/sun/star/task/XInteractionHandler.hpp"
-#include "com/sun/star/task/XInteractionHandler2.hpp"
-#include "com/sun/star/task/DocumentPasswordRequest.hpp"
-#include "com/sun/star/task/DocumentMSPasswordRequest.hpp"
+#include "com/sun/star/task/DocumentMacroConfirmationRequest2.hpp"
#include "com/sun/star/task/ErrorCodeIOException.hpp"
#include "com/sun/star/task/ErrorCodeRequest.hpp"
-#include "com/sun/star/task/MasterPasswordRequest.hpp"
-#include "com/sun/star/task/NoMasterException.hpp"
-#include "com/sun/star/task/DocumentMacroConfirmationRequest.hpp"
-#include "com/sun/star/task/DocumentMacroConfirmationRequest2.hpp"
+#include "com/sun/star/task/FutureDocumentVersionProductUpdateRequest.hpp"
#include "com/sun/star/task/XInteractionAbort.hpp"
#include "com/sun/star/task/XInteractionApprove.hpp"
+#include "com/sun/star/task/XInteractionAskLater.hpp"
#include "com/sun/star/task/XInteractionDisapprove.hpp"
-#include "com/sun/star/task/XInteractionPassword.hpp"
+#include "com/sun/star/task/XInteractionHandler2.hpp"
#include "com/sun/star/task/XInteractionRequest.hpp"
#include "com/sun/star/task/XInteractionRetry.hpp"
-#include "com/sun/star/task/XPasswordContainer.hpp"
-#include "com/sun/star/task/XUrlContainer.hpp"
-#include "com/sun/star/task/XInteractionAskLater.hpp"
-#include "com/sun/star/ucb/AuthenticationRequest.hpp"
-#include "com/sun/star/ucb/URLAuthenticationRequest.hpp"
-#include "com/sun/star/ucb/CertificateValidationRequest.hpp"
-#include "com/sun/star/ucb/HandleCookiesRequest.hpp"
#include "com/sun/star/ucb/InteractiveAppException.hpp"
-#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp"
#include "com/sun/star/ucb/InteractiveCHAOSException.hpp"
+#include "com/sun/star/ucb/InteractiveLockingLockedException.hpp"
+#include "com/sun/star/ucb/InteractiveLockingNotLockedException.hpp"
+#include "com/sun/star/ucb/InteractiveLockingLockExpiredException.hpp"
#include "com/sun/star/ucb/InteractiveNetworkConnectException.hpp"
-#include "com/sun/star/ucb/InteractiveNetworkException.hpp"
-#include "com/sun/star/ucb/InteractiveNetworkGeneralException.hpp"
#include "com/sun/star/ucb/InteractiveNetworkOffLineException.hpp"
#include "com/sun/star/ucb/InteractiveNetworkReadException.hpp"
#include "com/sun/star/ucb/InteractiveNetworkResolveNameException.hpp"
#include "com/sun/star/ucb/InteractiveNetworkWriteException.hpp"
#include "com/sun/star/ucb/InteractiveWrongMediumException.hpp"
-#include "com/sun/star/ucb/IOErrorCode.hpp"
#include "com/sun/star/ucb/NameClashException.hpp"
#include "com/sun/star/ucb/NameClashResolveRequest.hpp"
#include "com/sun/star/ucb/UnsupportedNameClashException.hpp"
-#include "com/sun/star/ucb/XInteractionCookieHandling.hpp"
#include "com/sun/star/ucb/XInteractionReplaceExistingData.hpp"
-#include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp"
-#include "com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp"
#include "com/sun/star/ucb/XInteractionSupplyName.hpp"
-#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
-#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/xforms/InvalidDataOnSubmitException.hpp"
-#include <com/sun/star/security/CertificateValidity.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-
+#include "osl/conditn.hxx"
+#include "tools/rcid.h" // RSC_STRING
+#include "tools/errinf.hxx" // ErrorHandler, ErrorContext, ...
#include "vos/mutex.hxx"
-#include "tools/rcid.h"
+#include "comphelper/documentconstants.hxx" // ODFVER_012_TEXT
+#include "svtools/sfxecode.hxx" // ERRCODE_SFX_*
+#include "vcl/msgbox.hxx"
#include "vcl/svapp.hxx"
-#include "svl/svtools.hrc"
-#include "svl/httpcook.hxx"
-#include "svtools/sfxecode.hxx"
-#include "toolkit/helper/vclunohelper.hxx"
-#include "comphelper/sequenceashashmap.hxx"
-#include "comphelper/documentconstants.hxx"
#include "unotools/configmgr.hxx"
+#include "toolkit/helper/vclunohelper.hxx"
#include "ids.hrc"
-#include "cookiedg.hxx"
+
+#include "getcontinuations.hxx"
#include "secmacrowarnings.hxx"
-#include "masterpasscrtdlg.hxx"
-#include "masterpassworddlg.hxx"
-#include "logindlg.hxx"
-#include "passcrtdlg.hxx"
-#include "passworddlg.hxx"
-#include "unknownauthdlg.hxx"
-#include "sslwarndlg.hxx"
-#include "openlocked.hxx"
#include "newerverwarn.hxx"
-#include "alreadyopen.hxx"
-#include "filechanged.hxx"
-#include "trylater.hxx"
-#include "lockfailed.hxx"
-#include "loginerr.hxx"
-
-#include <comphelper/processfactory.hxx>
-#include <svl/zforlist.hxx>
-using namespace com::sun;
-
-namespace csss = ::com::sun::star::security;
-
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::task::XInteractionContinuation;
-using ::com::sun::star::task::XInteractionAbort;
-using ::com::sun::star::task::XInteractionApprove;
-using ::com::sun::star::task::XInteractionAskLater;
-using ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest;
+#include "iahndl.hxx"
-#define CONFIG_INTERACTIONHANDLERS_KEY "/org.openoffice.ucb.InteractionHandler/InteractionHandlers"
+using namespace com::sun::star;
namespace {
-class CookieList: public List
+class HandleData : public osl::Condition
{
public:
- ~CookieList() SAL_THROW(());
-};
-
-CookieList::~CookieList() SAL_THROW(())
-{
- while (Count() != 0)
- delete static_cast< CntHTTPCookie * >(Remove(Count() - 1));
-}
-
-class ErrorResource: private Resource
-{
-public:
- inline ErrorResource(ResId & rResId) SAL_THROW(()): Resource(rResId) {}
-
- inline ~ErrorResource() SAL_THROW(()) { FreeResource(); }
-
- bool getString(ErrCode nErrorCode, rtl::OUString * pString) const
- SAL_THROW(());
-};
-
-bool ErrorResource::getString(ErrCode nErrorCode, rtl::OUString * pString)
- const SAL_THROW(())
-{
- OSL_ENSURE(pString, "specification violation");
- ResId aResId(static_cast< USHORT >(nErrorCode & ERRCODE_RES_MASK), *m_pResMgr);
- aResId.SetRT(RSC_STRING);
- if (!IsAvailableRes(aResId))
- return false;
- aResId.SetAutoRelease(false);
- *pString = UniString(aResId);
- m_pResMgr->PopContext();
- return true;
-}
-
-void
-getContinuations(
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const & rContinuations,
- star::uno::Reference< star::task::XInteractionApprove > * pApprove,
- star::uno::Reference< star::task::XInteractionDisapprove > * pDisapprove,
- star::uno::Reference< star::task::XInteractionRetry > * pRetry,
- star::uno::Reference< star::task::XInteractionAbort > * pAbort,
- star::uno::Reference< star::ucb::XInteractionSupplyAuthentication > *
- pSupplyAuthentication,
- star::uno::Reference< star::ucb::XInteractionSupplyAuthentication2 > *
- pSupplyAuthentication2,
- star::uno::Reference< star::task::XInteractionPassword > * pPassword,
- star::uno::Reference< star::ucb::XInteractionSupplyName > *
- pSupplyName,
- star::uno::Reference< star::ucb::XInteractionReplaceExistingData > *
- pReplaceExistingData)
- SAL_THROW((star::uno::RuntimeException))
-{
- for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
- {
- if (pApprove && !pApprove->is())
- {
- *pApprove
- = star::uno::Reference< star::task::XInteractionApprove >(
- rContinuations[i], star::uno::UNO_QUERY);
- if (pApprove->is())
- continue;
- }
- if (pDisapprove && !pDisapprove->is())
- {
- *pDisapprove
- = star::uno::Reference< star::task::XInteractionDisapprove >(
- rContinuations[i], star::uno::UNO_QUERY);
- if (pDisapprove->is())
- continue;
- }
- if (pRetry && !pRetry->is())
- {
- *pRetry = star::uno::Reference< star::task::XInteractionRetry >(
- rContinuations[i], star::uno::UNO_QUERY);
- if (pRetry->is())
- continue;
- }
- if (pAbort && !pAbort->is())
- {
- *pAbort = star::uno::Reference< star::task::XInteractionAbort >(
- rContinuations[i], star::uno::UNO_QUERY);
- if (pAbort->is())
- continue;
- }
- if (pSupplyAuthentication && !pSupplyAuthentication->is())
- {
- *pSupplyAuthentication
- = star::uno::Reference<
- star::ucb::XInteractionSupplyAuthentication >(
- rContinuations[i], star::uno::UNO_QUERY);
- if (pSupplyAuthentication->is())
- {
- // is it even a supplyauthentication2, which is derived from
- // supplyauthentication?
- if (pSupplyAuthentication2 && !pSupplyAuthentication2->is())
- *pSupplyAuthentication2
- = star::uno::Reference<
- star::ucb::XInteractionSupplyAuthentication2 >(
- rContinuations[i], star::uno::UNO_QUERY);
- continue;
- }
- }
- if (pPassword && !pPassword->is())
- {
- *pPassword
- = star::uno::Reference< star::task::XInteractionPassword >(
- rContinuations[i], star::uno::UNO_QUERY);
- if (pPassword->is())
- continue;
- }
- if (pSupplyName && !pSupplyName->is())
- {
- *pSupplyName
- = star::uno::Reference< star::ucb::XInteractionSupplyName >(
- rContinuations[i], star::uno::UNO_QUERY);
- if (pSupplyName->is())
- continue;
- }
- if (pReplaceExistingData && !pReplaceExistingData->is())
- {
- *pReplaceExistingData
- = star::uno::Reference<
- star::ucb::XInteractionReplaceExistingData >(
- rContinuations[i], star::uno::UNO_QUERY);
- if (pReplaceExistingData->is())
- continue;
- }
- }
-}
-
-::rtl::OUString replaceMessageWithArguments(
- ::rtl::OUString aMessage,
- std::vector< rtl::OUString > const & rArguments )
-{
- for (sal_Int32 i = 0;;)
- {
- i = aMessage.
- indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(ARG")), i);
- if (i == -1)
- break;
- if (aMessage.getLength() - i >= RTL_CONSTASCII_LENGTH("$(ARGx)")
- && aMessage.getStr()[i + RTL_CONSTASCII_LENGTH("$(ARGx")] == ')')
- {
- sal_Unicode c
- = aMessage.getStr()[i + RTL_CONSTASCII_LENGTH("$(ARG")];
- if (c >= '1' && c <= '2')
- {
- std::vector< rtl::OUString >::size_type nIndex
- = static_cast< std::vector< rtl::OUString >::size_type >(
- c - '1');
- if (nIndex < rArguments.size())
- {
- aMessage
- = aMessage.replaceAt(i,
- RTL_CONSTASCII_LENGTH("$(ARGx)"),
- rArguments[nIndex]);
- i += rArguments[nIndex].getLength();
- continue;
- }
- }
- }
- ++i;
- }
-
- return aMessage;
-}
-
-
-bool
-getStringRequestArgument(star::uno::Sequence< star::uno::Any > const &
- rArguments,
- rtl::OUString const & rKey,
- rtl::OUString * pValue)
- SAL_THROW(())
-{
- for (sal_Int32 i = 0; i < rArguments.getLength(); ++i)
+ HandleData(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ : osl::Condition(),
+ m_rRequest(rRequest),
+ bHandled( false )
{
- star::beans::PropertyValue aProperty;
- if ((rArguments[i] >>= aProperty) && aProperty.Name == rKey)
- {
- rtl::OUString aValue;
- if (aProperty.Value >>= aValue)
- {
- if (pValue)
- *pValue = aValue;
- return true;
- }
- }
}
- return false;
-}
-
-bool
-getBoolRequestArgument(star::uno::Sequence< star::uno::Any > const &
- rArguments,
- rtl::OUString const & rKey,
- bool * pValue)
- SAL_THROW(())
-{
- for (sal_Int32 i = 0; i < rArguments.getLength(); ++i)
- {
- star::beans::PropertyValue aProperty;
- if ((rArguments[i] >>= aProperty) && aProperty.Name == rKey)
- {
- sal_Bool bValue = sal_Bool();
- if (aProperty.Value >>= bValue)
- {
- if (pValue)
- *pValue = bValue;
- return true;
- }
- }
- }
- return false;
-}
-
-bool
-getResourceNameRequestArgument(star::uno::Sequence< star::uno::Any > const &
- rArguments,
- rtl::OUString * pValue)
- SAL_THROW(())
-{
- if (!getStringRequestArgument(rArguments,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "Uri")),
- pValue))
- return false;
- // Use the resource name only for file URLs, to avoid confusion:
- //TODO! work with ucp locality concept instead of hardcoded "file"?
- if (pValue
- && pValue->matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(
- "file:")))
- getStringRequestArgument(rArguments,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "ResourceName")),
- pValue);
- return true;
-}
-
-bool isInformationalErrorMessageRequest(
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const &
- rContinuations)
-{
- // Only requests with a single continuation (user has no choice, request
- // is just informational)
- if (rContinuations.getLength() != 1 )
- return false;
-
- // user can only abort or approve, all other continuations are not
- // considered to be informational.
- star::uno::Reference< star::task::XInteractionApprove > xApprove(
- rContinuations[0], star::uno::UNO_QUERY);
- if (xApprove.is())
- return true;
-
- star::uno::Reference< star::task::XInteractionAbort > xAbort(
- rContinuations[0], star::uno::UNO_QUERY);
- if (xAbort.is())
- return true;
-
- return false;
-}
+ uno::Reference< task::XInteractionRequest > m_rRequest;
+ bool bHandled;
+ beans::Optional< rtl::OUString > m_aResult;
+};
} /* namespace */
UUIInteractionHelper::UUIInteractionHelper(
- star::uno::Reference< star::lang::XMultiServiceFactory > const &
- rServiceFactory,
- star::uno::Sequence< star::uno::Any > const & rArguments)
+ uno::Reference< lang::XMultiServiceFactory > const & rServiceFactory,
+ uno::Sequence< uno::Any > const & rArguments)
SAL_THROW(()):
m_xServiceFactory(rServiceFactory),
m_aProperties(rArguments)
@@ -440,8 +122,7 @@ UUIInteractionHelper::UUIInteractionHelper(
}
UUIInteractionHelper::UUIInteractionHelper(
- star::uno::Reference< star::lang::XMultiServiceFactory > const &
- rServiceFactory)
+ uno::Reference< lang::XMultiServiceFactory > const & rServiceFactory)
SAL_THROW(()):
m_xServiceFactory(rServiceFactory)
{
@@ -451,41 +132,32 @@ UUIInteractionHelper::~UUIInteractionHelper()
{
}
-class HandleData : public osl::Condition {
-public:
- HandleData(
- star::uno::Reference< star::task::XInteractionRequest > const &
- rRequest)
- : osl::Condition(),
- m_rRequest(rRequest),
- bHandled( false )
- {
- }
- star::uno::Reference< star::task::XInteractionRequest > m_rRequest;
- bool bHandled;
- star::beans::Optional< rtl::OUString > m_aResult;
-};
-
-long UUIInteractionHelper::handlerequest(
- void* pHandleData,void* pInteractionHelper)
-{
- HandleData* pHND = (HandleData*) pHandleData;
- UUIInteractionHelper* pUUI = (UUIInteractionHelper*) pInteractionHelper;
- pHND->bHandled = pUUI->handle_impl(pHND->m_rRequest);
+long
+UUIInteractionHelper::handlerequest(
+ void* pHandleData, void* pInteractionHelper)
+{
+ HandleData* pHND
+ = static_cast< HandleData * >(pHandleData);
+ UUIInteractionHelper* pUUI
+ = static_cast< UUIInteractionHelper * >(pInteractionHelper);
+ bool bDummy = false;
+ rtl::OUString aDummy;
+ pHND->bHandled
+ = pUUI->handleRequest_impl(pHND->m_rRequest, false, bDummy, aDummy);
pHND->set();
return 0;
}
-
bool
UUIInteractionHelper::handleRequest(
- star::uno::Reference< star::task::XInteractionRequest > const & rRequest)
- throw (star::uno::RuntimeException)
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
{
Application* pApp = 0;
if(
// be aware,it is the same type
- ((oslThreadIdentifier) Application::GetMainThreadIdentifier())
+ static_cast< oslThreadIdentifier >(
+ Application::GetMainThreadIdentifier())
!= osl_getThreadIdentifier(NULL)
&&
(pApp = GetpApp())
@@ -501,10 +173,15 @@ UUIInteractionHelper::handleRequest(
return aHD.bHandled;
}
else
- return handle_impl(rRequest);
+ {
+ bool bDummy = false;
+ rtl::OUString aDummy;
+ return handleRequest_impl(rRequest, false, bDummy, aDummy);
+ }
}
-long UUIInteractionHelper::getstringfromrequest(
+long
+UUIInteractionHelper::getstringfromrequest(
void* pHandleData,void* pInteractionHelper)
{
HandleData* pHND = (HandleData*) pHandleData;
@@ -514,30 +191,34 @@ long UUIInteractionHelper::getstringfromrequest(
return 0;
}
-star::beans::Optional< rtl::OUString >
+beans::Optional< rtl::OUString >
UUIInteractionHelper::getStringFromRequest_impl(
- star::uno::Reference< star::task::XInteractionRequest > const & rRequest)
- throw (star::uno::RuntimeException)
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
{
bool bSuccess = false;
rtl::OUString aMessage;
- handleMessageboxRequests(rRequest, true, bSuccess, aMessage);
+ handleRequest_impl(rRequest, true, bSuccess, aMessage);
- if (!bSuccess)
- handleErrorHandlerRequests(rRequest, true, bSuccess, aMessage);
+ OSL_ENSURE(bSuccess ||
+ !isInformationalErrorMessageRequest(
+ rRequest->getContinuations()),
+ "Interaction request is a candidate for a string representation."
+ "Please implement!");
- return star::beans::Optional< rtl::OUString >(bSuccess, aMessage);
+ return beans::Optional< rtl::OUString >(bSuccess, aMessage);
}
-star::beans::Optional< rtl::OUString >
+beans::Optional< rtl::OUString >
UUIInteractionHelper::getStringFromRequest(
- star::uno::Reference< star::task::XInteractionRequest > const & rRequest)
- throw (star::uno::RuntimeException)
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
{
Application* pApp = 0;
if(
// be aware,it is the same type
- ((oslThreadIdentifier) Application::GetMainThreadIdentifier())
+ static_cast< oslThreadIdentifier >(
+ Application::GetMainThreadIdentifier())
!= osl_getThreadIdentifier(NULL)
&&
(pApp = GetpApp())
@@ -556,879 +237,660 @@ UUIInteractionHelper::getStringFromRequest(
return getStringFromRequest_impl(rRequest);
}
-bool UUIInteractionHelper::handleMessageboxRequests(
- star::uno::Reference< star::task::XInteractionRequest > const & rRequest,
- bool bObtainErrorStringOnly,
- bool & bHasErrorString,
- rtl::OUString & rErrorString)
+::rtl::OUString
+UUIInteractionHelper::replaceMessageWithArguments(
+ ::rtl::OUString aMessage,
+ std::vector< rtl::OUString > const & rArguments )
{
- star::uno::Any aAnyRequest(rRequest->getRequest());
-
- star::script::ModuleSizeExceededRequest aModSizeException;
- if (aAnyRequest >>= aModSizeException )
+ for (sal_Int32 i = 0;;)
{
- ErrCode nErrorCode = ERRCODE_UUI_IO_MODULESIZEEXCEEDED;
- std::vector< rtl::OUString > aArguments;
- star::uno::Sequence< rtl::OUString > sModules
- = aModSizeException.Names;
- if ( sModules.getLength() )
+ i = aMessage.
+ indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$(ARG")), i);
+ if (i == -1)
+ break;
+ if (aMessage.getLength() - i >= RTL_CONSTASCII_LENGTH("$(ARGx)")
+ && aMessage.getStr()[i + RTL_CONSTASCII_LENGTH("$(ARGx")] == ')')
{
- rtl::OUString aName;
- for ( sal_Int32 index=0; index< sModules.getLength(); ++index )
+ sal_Unicode c
+ = aMessage.getStr()[i + RTL_CONSTASCII_LENGTH("$(ARG")];
+ if (c >= '1' && c <= '2')
{
- if ( index )
- aName = aName + rtl::OUString( ',' ) + sModules[index];
- else
- aName = sModules[index]; // 1st name
+ std::vector< rtl::OUString >::size_type nIndex
+ = static_cast< std::vector< rtl::OUString >::size_type >(
+ c - '1');
+ if (nIndex < rArguments.size())
+ {
+ aMessage
+ = aMessage.replaceAt(i,
+ RTL_CONSTASCII_LENGTH("$(ARGx)"),
+ rArguments[nIndex]);
+ i += rArguments[nIndex].getLength();
+ continue;
+ }
}
- aArguments.push_back( aName );
}
- handleErrorRequest( star::task::InteractionClassification_WARNING,
- nErrorCode,
- aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
+ ++i;
}
- star::ucb::NameClashException aNCException;
- if (aAnyRequest >>= aNCException)
- {
- ErrCode nErrorCode = ERRCODE_UUI_IO_TARGETALREADYEXISTS;
- std::vector< rtl::OUString > aArguments;
+ return aMessage;
+}
- if( aNCException.Name.getLength() )
- {
- nErrorCode = ERRCODE_UUI_IO_ALREADYEXISTS;
- aArguments.push_back( aNCException.Name );
- }
+bool
+UUIInteractionHelper::isInformationalErrorMessageRequest(
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations)
+{
+ // Only requests with a single continuation (user has no choice, request
+ // is just informational)
+ if (rContinuations.getLength() != 1 )
+ return false;
- handleErrorRequest( aNCException.Classification,
- nErrorCode,
- aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
+ // user can only abort or approve, all other continuations are not
+ // considered to be informational.
+ uno::Reference< task::XInteractionApprove > xApprove(
+ rContinuations[0], uno::UNO_QUERY);
+ if (xApprove.is())
return true;
- }
- star::ucb::UnsupportedNameClashException aUORequest;
- if (aAnyRequest >>= aUORequest)
- {
- ErrCode nErrorCode = ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE;
- std::vector< rtl::OUString > aArguments;
+ uno::Reference< task::XInteractionAbort > xAbort(
+ rContinuations[0], uno::UNO_QUERY);
+ if (xAbort.is())
+ return true;
- star::uno::Reference< star::task::XInteractionApprove > xApprove;
- star::uno::Reference<
- star::task::XInteractionDisapprove > xDisapprove;
- getContinuations(
- rRequest->getContinuations(),
- &xApprove, &xDisapprove, 0, 0, 0, 0, 0, 0, 0);
+ return false;
+}
+
+bool
+UUIInteractionHelper::tryOtherInteractionHandler(
+ uno::Reference< task::XInteractionRequest > const & rRequest)
+ SAL_THROW((uno::RuntimeException))
+{
+ InteractionHandlerDataList dataList;
+ getInteractionHandlerList(dataList);
+
+ InteractionHandlerDataList::const_iterator aEnd(dataList.end());
+ for (InteractionHandlerDataList::const_iterator aIt(dataList.begin());
+ aIt != aEnd;
+ ++aIt)
+ {
+ uno::Reference< uno::XInterface > xIfc;
- if( xApprove.is() && xDisapprove.is() )
+ try
+ {
+ xIfc = m_xServiceFactory->createInstance(aIt->ServiceName);
+ }
+ catch ( uno::RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( uno::Exception const & )
{
- handleErrorRequest( star::task::InteractionClassification_QUERY,
- nErrorCode,
- aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
}
- return true;
- }
- star::document::BrokenPackageRequest aBrokenPackageRequest;
- if (aAnyRequest >>= aBrokenPackageRequest)
- {
- std::vector< rtl::OUString > aArguments;
+ uno::Reference< lang::XInitialization >
+ xInitialization( xIfc, uno::UNO_QUERY );
- if( aBrokenPackageRequest.aName.getLength() )
- aArguments.push_back( aBrokenPackageRequest.aName );
+ OSL_ENSURE( xInitialization.is(),
+ "Custom Interactionhandler does not "
+ "implement mandatory interface XInitialization!" );
+ if (xInitialization.is())
+ {
+ uno::Sequence< uno::Any > propertyValues(1);
+ beans::PropertyValue aProperty;
- handleBrokenPackageRequest( aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
+ aProperty.Name = rtl::OUString::createFromAscii( "Parent" );
+ aProperty.Value <<= getParentXWindow();
+ propertyValues[ 0 ] <<= aProperty;
+
+ xInitialization->initialize(propertyValues);
+ }
+
+ uno::Reference< task::XInteractionHandler2 >
+ xIH( xIfc, uno::UNO_QUERY );
+
+ OSL_ENSURE( xIH.is(),
+ "Custom Interactionhandler does not "
+ "implement mandatory interface XInteractionHandler2!" );
+ if (xIH.is() && xIH->handleInteractionRequest(rRequest))
+ return true;
}
+ return false;
+}
- star::ucb::InteractiveIOException aIoException;
- if (aAnyRequest >>= aIoException)
+bool
+UUIInteractionHelper::handleRequest_impl(
+ uno::Reference< task::XInteractionRequest > const & rRequest,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((uno::RuntimeException))
+{
+ try
{
- star::uno::Sequence< star::uno::Any > aRequestArguments;
- star::ucb::InteractiveAugmentedIOException aAugmentedIoException;
- if (aAnyRequest >>= aAugmentedIoException)
- aRequestArguments = aAugmentedIoException.Arguments;
-
- ErrCode nErrorCode;
- std::vector< rtl::OUString > aArguments;
- static ErrCode const
- aErrorCode[star::ucb::IOErrorCode_WRONG_VERSION + 1][2]
- = { { ERRCODE_IO_ABORT, ERRCODE_UUI_IO_ABORT }, // ABORT
- { ERRCODE_IO_ACCESSDENIED, ERRCODE_UUI_IO_ACCESSDENIED },
- // ACCESS_DENIED
- { ERRCODE_IO_ALREADYEXISTS,
- ERRCODE_UUI_IO_ALREADYEXISTS }, // ALREADY_EXISTING
- { ERRCODE_IO_BADCRC, ERRCODE_UUI_IO_BADCRC }, // BAD_CRC
- { ERRCODE_IO_CANTCREATE, ERRCODE_UUI_IO_CANTCREATE },
- // CANT_CREATE
- { ERRCODE_IO_CANTREAD, ERRCODE_UUI_IO_CANTREAD },
- // CANT_READ
- { ERRCODE_IO_CANTSEEK, ERRCODE_UUI_IO_CANTSEEK },
- // CANT_SEEK
- { ERRCODE_IO_CANTTELL, ERRCODE_UUI_IO_CANTTELL },
- // CANT_TELL
- { ERRCODE_IO_CANTWRITE, ERRCODE_UUI_IO_CANTWRITE },
- // CANT_WRITE
- { ERRCODE_IO_CURRENTDIR, ERRCODE_UUI_IO_CURRENTDIR },
- // CURRENT_DIRECTORY
- { ERRCODE_IO_DEVICENOTREADY, ERRCODE_UUI_IO_NOTREADY },
- // DEVICE_NOT_READY
- { ERRCODE_IO_NOTSAMEDEVICE,
- ERRCODE_UUI_IO_NOTSAMEDEVICE }, // DIFFERENT_DEVICES
- { ERRCODE_IO_GENERAL, ERRCODE_UUI_IO_GENERAL }, // GENERAL
- { ERRCODE_IO_INVALIDACCESS,
- ERRCODE_UUI_IO_INVALIDACCESS }, // INVALID_ACCESS
- { ERRCODE_IO_INVALIDCHAR, ERRCODE_UUI_IO_INVALIDCHAR },
- // INVALID_CHARACTER
- { ERRCODE_IO_INVALIDDEVICE,
- ERRCODE_UUI_IO_INVALIDDEVICE }, // INVALID_DEVICE
- { ERRCODE_IO_INVALIDLENGTH,
- ERRCODE_UUI_IO_INVALIDLENGTH }, // INVALID_LENGTH
- { ERRCODE_IO_INVALIDPARAMETER,
- ERRCODE_UUI_IO_INVALIDPARAMETER }, // INVALID_PARAMETER
- { ERRCODE_IO_ISWILDCARD, ERRCODE_UUI_IO_ISWILDCARD },
- // IS_WILDCARD
- { ERRCODE_IO_LOCKVIOLATION,
- ERRCODE_UUI_IO_LOCKVIOLATION }, // LOCKING_VIOLATION
- { ERRCODE_IO_MISPLACEDCHAR,
- ERRCODE_UUI_IO_MISPLACEDCHAR }, // MISPLACED_CHARACTER
- { ERRCODE_IO_NAMETOOLONG, ERRCODE_UUI_IO_NAMETOOLONG },
- // NAME_TOO_LONG
- { ERRCODE_IO_NOTEXISTS, ERRCODE_UUI_IO_NOTEXISTS },
- // NOT_EXISTING
- { ERRCODE_IO_NOTEXISTSPATH,
- ERRCODE_UUI_IO_NOTEXISTSPATH }, // NOT_EXISTING_PATH
- { ERRCODE_IO_NOTSUPPORTED, ERRCODE_UUI_IO_NOTSUPPORTED },
- // NOT_SUPPORTED
- { ERRCODE_IO_NOTADIRECTORY,
- ERRCODE_UUI_IO_NOTADIRECTORY }, // NO_DIRECTORY
- { ERRCODE_IO_NOTAFILE, ERRCODE_UUI_IO_NOTAFILE },
- // NO_FILE
- { ERRCODE_IO_OUTOFSPACE, ERRCODE_UUI_IO_OUTOFSPACE },
- // OUT_OF_DISK_SPACE
- { ERRCODE_IO_TOOMANYOPENFILES,
- ERRCODE_UUI_IO_TOOMANYOPENFILES },
- // OUT_OF_FILE_HANDLES
- { ERRCODE_IO_OUTOFMEMORY, ERRCODE_UUI_IO_OUTOFMEMORY },
- // OUT_OF_MEMORY
- { ERRCODE_IO_PENDING, ERRCODE_UUI_IO_PENDING }, // PENDING
- { ERRCODE_IO_RECURSIVE, ERRCODE_UUI_IO_RECURSIVE },
- // RECURSIVE
- { ERRCODE_IO_UNKNOWN, ERRCODE_UUI_IO_UNKNOWN }, // UNKNOWN
- { ERRCODE_IO_WRITEPROTECTED,
- ERRCODE_UUI_IO_WRITEPROTECTED }, // WRITE_PROTECTED
- { ERRCODE_IO_WRONGFORMAT, ERRCODE_UUI_IO_WRONGFORMAT },
- // WRONG_FORMAT
- { ERRCODE_IO_WRONGVERSION,
- ERRCODE_UUI_IO_WRONGVERSION } }; // WRONG_VERSION
- switch (aIoException.Code)
+ if (!rRequest.is())
+ return false;
+
+ uno::Any aAnyRequest(rRequest->getRequest());
+
+ script::ModuleSizeExceededRequest aModSizeException;
+ if (aAnyRequest >>= aModSizeException )
{
- case star::ucb::IOErrorCode_CANT_CREATE:
+ ErrCode nErrorCode = ERRCODE_UUI_IO_MODULESIZEEXCEEDED;
+ std::vector< rtl::OUString > aArguments;
+ uno::Sequence< rtl::OUString > sModules
+ = aModSizeException.Names;
+ if ( sModules.getLength() )
{
- rtl::OUString aArgFolder;
- if (getStringRequestArgument(
- aRequestArguments,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "Folder")),
- &aArgFolder))
+ rtl::OUString aName;
+ for ( sal_Int32 index=0; index< sModules.getLength(); ++index )
{
- rtl::OUString aArgUri;
- if (getResourceNameRequestArgument(aRequestArguments,
- &aArgUri))
- {
- nErrorCode = ERRCODE_UUI_IO_CANTCREATE;
- aArguments.reserve(2);
- aArguments.push_back(aArgUri);
- aArguments.push_back(aArgFolder);
- }
+ if ( index )
+ aName = aName + rtl::OUString( ',' ) + sModules[index];
else
- {
- nErrorCode = ERRCODE_UUI_IO_CANTCREATE_NONAME;
- aArguments.push_back(aArgFolder);
- }
+ aName = sModules[index]; // 1st name
}
- else
- nErrorCode = aErrorCode[aIoException.Code][0];
- break;
+ aArguments.push_back( aName );
}
+ handleErrorHandlerRequest( task::InteractionClassification_WARNING,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
+
+ ucb::NameClashException aNCException;
+ if (aAnyRequest >>= aNCException)
+ {
+ ErrCode nErrorCode = ERRCODE_UUI_IO_TARGETALREADYEXISTS;
+ std::vector< rtl::OUString > aArguments;
- case star::ucb::IOErrorCode_DEVICE_NOT_READY:
+ if( aNCException.Name.getLength() )
{
- rtl::OUString aArgUri;
- if (getResourceNameRequestArgument(aRequestArguments,
- &aArgUri))
- {
- rtl::OUString aResourceType;
- getStringRequestArgument(
- aRequestArguments,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "ResourceType")),
- &aResourceType);
- bool bRemovable = false;
- getBoolRequestArgument(aRequestArguments,
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "Removable")),
- &bRemovable);
- nErrorCode
- = aResourceType.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("volume"))
- ? (bRemovable
- ? ERRCODE_UUI_IO_NOTREADY_VOLUME_REMOVABLE
- : ERRCODE_UUI_IO_NOTREADY_VOLUME)
- : (bRemovable
- ? ERRCODE_UUI_IO_NOTREADY_REMOVABLE
- : ERRCODE_UUI_IO_NOTREADY);
- aArguments.push_back(aArgUri);
- }
- else
- nErrorCode = aErrorCode[aIoException.Code][0];
- break;
+ nErrorCode = ERRCODE_UUI_IO_ALREADYEXISTS;
+ aArguments.push_back( aNCException.Name );
}
- case star::ucb::IOErrorCode_DIFFERENT_DEVICES:
- {
- rtl::OUString aArgVolume;
- rtl::OUString aArgOtherVolume;
- if (getStringRequestArgument(
- aRequestArguments,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "Volume")),
- &aArgVolume)
- && getStringRequestArgument(
- aRequestArguments,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "OtherVolume")),
- &aArgOtherVolume))
- {
- nErrorCode = aErrorCode[aIoException.Code][1];
- aArguments.reserve(2);
- aArguments.push_back(aArgVolume);
- aArguments.push_back(aArgOtherVolume);
- }
- else
- nErrorCode = aErrorCode[aIoException.Code][0];
- break;
+ handleErrorHandlerRequest( aNCException.Classification,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
}
- case star::ucb::IOErrorCode_NOT_EXISTING:
- {
- rtl::OUString aArgUri;
- if (getResourceNameRequestArgument(aRequestArguments,
- &aArgUri))
- {
- rtl::OUString aResourceType;
- getStringRequestArgument(
- aRequestArguments,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "ResourceType")),
- &aResourceType);
- nErrorCode
- = aResourceType.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("volume"))
- ? ERRCODE_UUI_IO_NOTEXISTS_VOLUME
- : (aResourceType.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("folder"))
- ? ERRCODE_UUI_IO_NOTEXISTS_FOLDER
- : ERRCODE_UUI_IO_NOTEXISTS);
- aArguments.push_back(aArgUri);
- }
- else
- nErrorCode = aErrorCode[aIoException.Code][0];
- break;
- }
+ ucb::UnsupportedNameClashException aUORequest;
+ if (aAnyRequest >>= aUORequest)
+ {
+ ErrCode nErrorCode = ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE;
+ std::vector< rtl::OUString > aArguments;
+
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionDisapprove > xDisapprove;
+ getContinuations(
+ rRequest->getContinuations(), &xApprove, &xDisapprove);
- default:
+ if ( xApprove.is() && xDisapprove.is() )
{
- rtl::OUString aArgUri;
- if (getResourceNameRequestArgument(aRequestArguments,
- &aArgUri))
- {
- nErrorCode = aErrorCode[aIoException.Code][1];
- aArguments.push_back(aArgUri);
- }
- else
- nErrorCode = aErrorCode[aIoException.Code][0];
- break;
+ handleErrorHandlerRequest( task::InteractionClassification_QUERY,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
}
+ return true;
}
- handleErrorRequest(aIoException.Classification,
- nErrorCode,
- aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
- }
-
- star::ucb::InteractiveAppException aAppException;
- if (aAnyRequest >>= aAppException)
- {
- std::vector< rtl::OUString > aArguments;
- handleErrorRequest( aAppException.Classification,
- aAppException.Code,
- aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
- }
+ if ( handleInteractiveIOException( rRequest,
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString ) )
+ return true;
- star::ucb::InteractiveNetworkException aNetworkException;
- if (aAnyRequest >>= aNetworkException)
- {
- ErrCode nErrorCode;
- std::vector< rtl::OUString > aArguments;
- star::ucb::InteractiveNetworkOffLineException aOffLineException;
- star::ucb::InteractiveNetworkResolveNameException
- aResolveNameException;
- star::ucb::InteractiveNetworkConnectException aConnectException;
- star::ucb::InteractiveNetworkReadException aReadException;
- star::ucb::InteractiveNetworkWriteException aWriteException;
- if (aAnyRequest >>= aOffLineException)
- nErrorCode = ERRCODE_INET_OFFLINE;
- else if (aAnyRequest >>= aResolveNameException)
- {
- nErrorCode = ERRCODE_INET_NAME_RESOLVE;
- aArguments.push_back(aResolveNameException.Server);
- }
- else if (aAnyRequest >>= aConnectException)
- {
- nErrorCode = ERRCODE_INET_CONNECT;
- aArguments.push_back(aConnectException.Server);
- }
- else if (aAnyRequest >>= aReadException)
- {
- nErrorCode = ERRCODE_INET_READ;
- aArguments.push_back(aReadException.Diagnostic);
+ ucb::InteractiveAppException aAppException;
+ if (aAnyRequest >>= aAppException)
+ {
+ std::vector< rtl::OUString > aArguments;
+ handleErrorHandlerRequest( aAppException.Classification,
+ aAppException.Code,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
}
- else if (aAnyRequest >>= aWriteException)
+
+ ucb::InteractiveNetworkException aNetworkException;
+ if (aAnyRequest >>= aNetworkException)
{
- nErrorCode = ERRCODE_INET_WRITE;
- aArguments.push_back(aWriteException.Diagnostic);
+ ErrCode nErrorCode;
+ std::vector< rtl::OUString > aArguments;
+ ucb::InteractiveNetworkOffLineException aOffLineException;
+ ucb::InteractiveNetworkResolveNameException aResolveNameException;
+ ucb::InteractiveNetworkConnectException aConnectException;
+ ucb::InteractiveNetworkReadException aReadException;
+ ucb::InteractiveNetworkWriteException aWriteException;
+ if (aAnyRequest >>= aOffLineException)
+ nErrorCode = ERRCODE_INET_OFFLINE;
+ else if (aAnyRequest >>= aResolveNameException)
+ {
+ nErrorCode = ERRCODE_INET_NAME_RESOLVE;
+ aArguments.push_back(aResolveNameException.Server);
+ }
+ else if (aAnyRequest >>= aConnectException)
+ {
+ nErrorCode = ERRCODE_INET_CONNECT;
+ aArguments.push_back(aConnectException.Server);
+ }
+ else if (aAnyRequest >>= aReadException)
+ {
+ nErrorCode = ERRCODE_INET_READ;
+ aArguments.push_back(aReadException.Diagnostic);
+ }
+ else if (aAnyRequest >>= aWriteException)
+ {
+ nErrorCode = ERRCODE_INET_WRITE;
+ aArguments.push_back(aWriteException.Diagnostic);
+ }
+ else
+ nErrorCode = ERRCODE_INET_GENERAL;
+
+ handleErrorHandlerRequest(aNetworkException.Classification,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
}
- else
- nErrorCode = ERRCODE_INET_GENERAL;
-
- handleErrorRequest(aNetworkException.Classification,
- nErrorCode,
- aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
- }
- star::ucb::InteractiveCHAOSException aChaosException;
- if (aAnyRequest >>= aChaosException)
- {
- std::vector< rtl::OUString > aArguments;
- sal_Int32 nCount
- = std::min< sal_Int32 >(aChaosException.Arguments.getLength(),
- 2);
- aArguments.
- reserve(
- static_cast< std::vector< rtl::OUString >::size_type >(
+ ucb::InteractiveCHAOSException aChaosException;
+ if (aAnyRequest >>= aChaosException)
+ {
+ std::vector< rtl::OUString > aArguments;
+ sal_Int32 nCount
+ = std::min< sal_Int32 >(aChaosException.Arguments.getLength(),
+ 2);
+ aArguments.
+ reserve(static_cast< std::vector< rtl::OUString >::size_type >(
nCount));
- for (sal_Int32 i = 0; i < nCount; ++i)
- aArguments.push_back(aChaosException.Arguments[i]);
- handleErrorRequest(aChaosException.Classification,
- aChaosException.ID,
- aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
- }
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ aArguments.push_back(aChaosException.Arguments[i]);
+ handleErrorHandlerRequest(aChaosException.Classification,
+ aChaosException.ID,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
- star::ucb::InteractiveWrongMediumException aWrongMediumException;
- if (aAnyRequest >>= aWrongMediumException)
- {
- sal_Int32 nMedium = 0;
- aWrongMediumException.Medium >>= nMedium;
- std::vector< rtl::OUString > aArguments;
- aArguments.push_back(UniString::CreateFromInt32(nMedium + 1));
- handleErrorRequest(aWrongMediumException.Classification,
- ERRCODE_UUI_WRONGMEDIUM,
- aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
- }
+ ucb::InteractiveWrongMediumException aWrongMediumException;
+ if (aAnyRequest >>= aWrongMediumException)
+ {
+ sal_Int32 nMedium = 0;
+ aWrongMediumException.Medium >>= nMedium;
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back(UniString::CreateFromInt32(nMedium + 1));
+ handleErrorHandlerRequest(aWrongMediumException.Classification,
+ ERRCODE_UUI_WRONGMEDIUM,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
- star::java::WrongJavaVersionException aWrongJavaVersionException;
- if (aAnyRequest >>= aWrongJavaVersionException)
- {
- ErrCode nErrorCode;
- std::vector< rtl::OUString > aArguments;
- if (aWrongJavaVersionException.DetectedVersion.getLength() == 0)
- if (aWrongJavaVersionException.LowestSupportedVersion.
- getLength()
- == 0)
- nErrorCode = ERRCODE_UUI_WRONGJAVA;
+ java::WrongJavaVersionException aWrongJavaVersionException;
+ if (aAnyRequest >>= aWrongJavaVersionException)
+ {
+ ErrCode nErrorCode;
+ std::vector< rtl::OUString > aArguments;
+ if (aWrongJavaVersionException.DetectedVersion.getLength() == 0)
+ if (aWrongJavaVersionException.LowestSupportedVersion.
+ getLength()
+ == 0)
+ nErrorCode = ERRCODE_UUI_WRONGJAVA;
+ else
+ {
+ nErrorCode = ERRCODE_UUI_WRONGJAVA_MIN;
+ aArguments.push_back(aWrongJavaVersionException.
+ LowestSupportedVersion);
+ }
+ else if (aWrongJavaVersionException.LowestSupportedVersion.
+ getLength()
+ == 0)
+ {
+ nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION;
+ aArguments.push_back(aWrongJavaVersionException.
+ DetectedVersion);
+ }
else
{
- nErrorCode = ERRCODE_UUI_WRONGJAVA_MIN;
+ nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION_MIN;
+ aArguments.reserve(2);
+ aArguments.push_back(aWrongJavaVersionException.
+ DetectedVersion);
aArguments.push_back(aWrongJavaVersionException.
LowestSupportedVersion);
}
- else if (aWrongJavaVersionException.LowestSupportedVersion.
- getLength()
- == 0)
- {
- nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION;
- aArguments.push_back(aWrongJavaVersionException.
- DetectedVersion);
+ handleErrorHandlerRequest(task::InteractionClassification_ERROR,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
}
- else
+
+ sync2::BadPartnershipException aBadPartnershipException;
+ if (aAnyRequest >>= aBadPartnershipException)
{
- nErrorCode = ERRCODE_UUI_WRONGJAVA_VERSION_MIN;
- aArguments.reserve(2);
- aArguments.push_back(aWrongJavaVersionException.
- DetectedVersion);
- aArguments.push_back(aWrongJavaVersionException.
- LowestSupportedVersion);
+ ErrCode nErrorCode;
+ std::vector< rtl::OUString > aArguments;
+ if (aBadPartnershipException.Partnership.getLength() == 0)
+ nErrorCode = ERRCODE_UUI_BADPARTNERSHIP;
+ else
+ {
+ nErrorCode = ERRCODE_UUI_BADPARTNERSHIP_NAME;
+ aArguments.push_back(aBadPartnershipException.Partnership);
+ }
+ handleErrorHandlerRequest(task::InteractionClassification_ERROR,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
}
- handleErrorRequest(star::task::InteractionClassification_ERROR,
- nErrorCode,
- aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
- }
- star::sync2::BadPartnershipException aBadPartnershipException;
- if (aAnyRequest >>= aBadPartnershipException)
- {
- ErrCode nErrorCode;
- std::vector< rtl::OUString > aArguments;
- if (aBadPartnershipException.Partnership.getLength() == 0)
- nErrorCode = ERRCODE_UUI_BADPARTNERSHIP;
- else
+ configuration::backend::MergeRecoveryRequest aMergeRecoveryRequest;
+ if (aAnyRequest >>= aMergeRecoveryRequest)
{
- nErrorCode = ERRCODE_UUI_BADPARTNERSHIP_NAME;
- aArguments.push_back(aBadPartnershipException.Partnership);
+ ErrCode nErrorCode = aMergeRecoveryRequest.IsRemovalRequest
+ ? ERRCODE_UUI_CONFIGURATION_BROKENDATA_WITHREMOVE
+ : ERRCODE_UUI_CONFIGURATION_BROKENDATA_NOREMOVE;
+
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back(aMergeRecoveryRequest.ErrorLayerId);
+
+ handleErrorHandlerRequest(task::InteractionClassification_ERROR,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
}
- handleErrorRequest(star::task::InteractionClassification_ERROR,
- nErrorCode,
- aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
- }
- star::configuration::backend::MergeRecoveryRequest aMergeRecoveryRequest;
- if (aAnyRequest >>= aMergeRecoveryRequest)
- {
- ErrCode nErrorCode = aMergeRecoveryRequest.IsRemovalRequest
- ? ERRCODE_UUI_CONFIGURATION_BROKENDATA_WITHREMOVE
- : ERRCODE_UUI_CONFIGURATION_BROKENDATA_NOREMOVE;
-
- std::vector< rtl::OUString > aArguments;
- aArguments.push_back(aMergeRecoveryRequest.ErrorLayerId);
-
- handleErrorRequest(star::task::InteractionClassification_ERROR,
- nErrorCode,
- aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
- }
+ configuration::backend::StratumCreationException
+ aStratumCreationException;
- star::configuration::backend::StratumCreationException
- aStratumCreationException;
+ if (aAnyRequest >>= aStratumCreationException)
+ {
+ const ErrCode nErrorCode = ERRCODE_UUI_CONFIGURATION_BACKENDMISSING;
- if (aAnyRequest >>= aStratumCreationException)
- {
- const ErrCode nErrorCode = ERRCODE_UUI_CONFIGURATION_BACKENDMISSING;
-
- rtl::OUString aStratum = aStratumCreationException.StratumData;
- if (aStratum.getLength() == 0)
- aStratum = aStratumCreationException.StratumService;
-
- std::vector< rtl::OUString > aArguments;
- aArguments.push_back(aStratum);
-
- handleErrorRequest(star::task::InteractionClassification_ERROR,
- nErrorCode,
- aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
- }
+ rtl::OUString aStratum = aStratumCreationException.StratumData;
+ if (aStratum.getLength() == 0)
+ aStratum = aStratumCreationException.StratumService;
- star::xforms::InvalidDataOnSubmitException aInvalidDataOnSubmitException;
- if (aAnyRequest >>= aInvalidDataOnSubmitException)
- {
- const ErrCode nErrorCode = ERRCODE_UUI_INVALID_XFORMS_SUBMISSION_DATA;
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back(aStratum);
- std::vector< rtl::OUString > aArguments;
+ handleErrorHandlerRequest(task::InteractionClassification_ERROR,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
- handleErrorRequest(star::task::InteractionClassification_QUERY,
- nErrorCode,
- aArguments,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
- }
+ xforms::InvalidDataOnSubmitException aInvalidDataOnSubmitException;
+ if (aAnyRequest >>= aInvalidDataOnSubmitException)
+ {
+ const ErrCode nErrorCode =
+ ERRCODE_UUI_INVALID_XFORMS_SUBMISSION_DATA;
- return false;
-}
+ std::vector< rtl::OUString > aArguments;
-bool UUIInteractionHelper::handleDialogRequests(
- star::uno::Reference< star::task::XInteractionRequest > const & rRequest)
-{
- star::uno::Any aAnyRequest(rRequest->getRequest());
+ handleErrorHandlerRequest(task::InteractionClassification_QUERY,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
- star::ucb::URLAuthenticationRequest aURLAuthenticationRequest;
- if (aAnyRequest >>= aURLAuthenticationRequest)
- {
- handleAuthenticationRequest(aURLAuthenticationRequest,
- rRequest->getContinuations(),
- aURLAuthenticationRequest.URL);
- return true;
- }
+ ucb::InteractiveLockingLockedException aLLException;
+ if (aAnyRequest >>= aLLException)
+ {
+ ErrCode nErrorCode = aLLException.SelfOwned
+ ? ERRCODE_UUI_LOCKING_LOCKED_SELF : ERRCODE_UUI_LOCKING_LOCKED;
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back( aLLException.Url );
- star::ucb::AuthenticationRequest aAuthenticationRequest;
- if (aAnyRequest >>= aAuthenticationRequest)
- {
- handleAuthenticationRequest(aAuthenticationRequest,
- rRequest->getContinuations(),
- rtl::OUString());
- return true;
- }
+ handleErrorHandlerRequest( aLLException.Classification,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString );
+ return true;
+ }
- star::ucb::CertificateValidationRequest aCertificateValidationRequest;
- if (aAnyRequest >>= aCertificateValidationRequest)
- {
- handleCertificateValidationRequest(aCertificateValidationRequest,
- rRequest->getContinuations());
- return true;
- }
+ ucb::InteractiveLockingNotLockedException aLNLException;
+ if (aAnyRequest >>= aLNLException)
+ {
+ ErrCode nErrorCode = ERRCODE_UUI_LOCKING_NOT_LOCKED;
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back( aLNLException.Url );
-// @@@ Todo #i29340#: activate!
-// star::ucb::NameClashResolveRequest aNameClashResolveRequest;
-// if (aAnyRequest >>= aNameClashResolveRequest)
-// {
-// handleNameClashResolveRequest(aNameClashResolveRequest,
-// rRequest->getContinuations());
-// return;
-// }
-
- star::task::MasterPasswordRequest aMasterPasswordRequest;
- if (aAnyRequest >>= aMasterPasswordRequest)
- {
- handleMasterPasswordRequest(aMasterPasswordRequest.Mode,
- rRequest->getContinuations());
- return true;
- }
+ handleErrorHandlerRequest( aLNLException.Classification,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString );
+ return true;
+ }
- star::task::DocumentPasswordRequest aDocumentPasswordRequest;
- if (aAnyRequest >>= aDocumentPasswordRequest)
- {
- handlePasswordRequest(aDocumentPasswordRequest.Mode,
- rRequest->getContinuations(),
- aDocumentPasswordRequest.Name);
- return true;
- }
+ ucb::InteractiveLockingLockExpiredException aLLEException;
+ if (aAnyRequest >>= aLLEException)
+ {
+ ErrCode nErrorCode = ERRCODE_UUI_LOCKING_LOCK_EXPIRED;
+ std::vector< rtl::OUString > aArguments;
+ aArguments.push_back( aLLEException.Url );
- star::task::DocumentMSPasswordRequest aDocumentMSPasswordRequest;
- if (aAnyRequest >>= aDocumentMSPasswordRequest)
- {
- handleMSPasswordRequest(aDocumentMSPasswordRequest.Mode,
- rRequest->getContinuations(),
- aDocumentMSPasswordRequest.Name);
- return true;
- }
+ handleErrorHandlerRequest( aLLEException.Classification,
+ nErrorCode,
+ aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString );
+ return true;
+ }
- star::task::PasswordRequest aPasswordRequest;
- if (aAnyRequest >>= aPasswordRequest)
- {
- handlePasswordRequest(aPasswordRequest.Mode,
- rRequest->getContinuations());
- return true;
- }
+ document::BrokenPackageRequest aBrokenPackageRequest;
+ if (aAnyRequest >>= aBrokenPackageRequest)
+ {
+ std::vector< rtl::OUString > aArguments;
- star::ucb::HandleCookiesRequest aCookiesRequest;
- if (aAnyRequest >>= aCookiesRequest)
- {
- handleCookiesRequest(aCookiesRequest,
- rRequest->getContinuations());
- return true;
- }
+ if( aBrokenPackageRequest.aName.getLength() )
+ aArguments.push_back( aBrokenPackageRequest.aName );
- star::document::NoSuchFilterRequest aNoSuchFilterRequest;
- if (aAnyRequest >>= aNoSuchFilterRequest)
- {
- handleNoSuchFilterRequest(aNoSuchFilterRequest,
- rRequest->getContinuations());
- return true;
- }
+ handleBrokenPackageRequest( aArguments,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString );
+ return true;
+ }
- star::document::AmbigousFilterRequest aAmbigousFilterRequest;
- if (aAnyRequest >>= aAmbigousFilterRequest)
- {
- handleAmbigousFilterRequest(aAmbigousFilterRequest,
- rRequest->getContinuations());
- return true;
- }
+ task::ErrorCodeRequest aErrorCodeRequest;
+ if (aAnyRequest >>= aErrorCodeRequest)
+ {
+ handleGenericErrorRequest( aErrorCodeRequest.ErrCode,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
- star::document::FilterOptionsRequest aFilterOptionsRequest;
- if (aAnyRequest >>= aFilterOptionsRequest)
- {
- handleFilterOptionsRequest(aFilterOptionsRequest,
- rRequest->getContinuations());
- return true;
- }
+ task::ErrorCodeIOException aErrorCodeIOException;
+ if (aAnyRequest >>= aErrorCodeIOException)
+ {
+ handleGenericErrorRequest( aErrorCodeIOException.ErrCode,
+ rRequest->getContinuations(),
+ bObtainErrorStringOnly,
+ bHasErrorString,
+ rErrorString);
+ return true;
+ }
- star::document::LockedDocumentRequest aLockedDocumentRequest;
- if (aAnyRequest >>= aLockedDocumentRequest )
- {
- handleLockedDocumentRequest( aLockedDocumentRequest.DocumentURL,
- aLockedDocumentRequest.UserInfo,
- rRequest->getContinuations(),
- UUI_DOC_LOAD_LOCK );
- return true;
- }
- star::document::OwnLockOnDocumentRequest aOwnLockOnDocumentRequest;
- if (aAnyRequest >>= aOwnLockOnDocumentRequest )
- {
- handleLockedDocumentRequest( aOwnLockOnDocumentRequest.DocumentURL,
- aOwnLockOnDocumentRequest.TimeInfo,
- rRequest->getContinuations(),
- aOwnLockOnDocumentRequest.IsStoring ? UUI_DOC_OWN_SAVE_LOCK : UUI_DOC_OWN_LOAD_LOCK );
- return true;
- }
+ ///////////////////////////////////////////////////////////////////
+ // Handle requests which do not have a plain string representation.
+ ///////////////////////////////////////////////////////////////////
+ if (!bObtainErrorStringOnly)
+ {
+ if ( handleAuthenticationRequest( rRequest ) )
+ return true;
- star::document::LockedOnSavingRequest aLockedOnSavingRequest;
- if (aAnyRequest >>= aLockedOnSavingRequest )
- {
- handleLockedDocumentRequest( aLockedOnSavingRequest.DocumentURL,
- aLockedOnSavingRequest.UserInfo,
- rRequest->getContinuations(),
- UUI_DOC_SAVE_LOCK );
- return true;
- }
+ if ( handleCertificateValidationRequest( rRequest ) )
+ return true;
- star::document::ChangedByOthersRequest aChangedByOthersRequest;
- if (aAnyRequest >>= aChangedByOthersRequest )
- {
- handleChangedByOthersRequest( rRequest->getContinuations() );
- return true;
- }
+// @@@ Todo #i29340#: activate!
+// ucb::NameClashResolveRequest aNameClashResolveRequest;
+// if (aAnyRequest >>= aNameClashResolveRequest)
+// {
+// handleNameClashResolveRequest(aNameClashResolveRequest,
+// rRequest->getContinuations());
+// return true;
+// }
+
+ if ( handleMasterPasswordRequest( rRequest ) )
+ return true;
- star::document::LockFileIgnoreRequest aLockFileIgnoreRequest;
- if (aAnyRequest >>= aLockFileIgnoreRequest )
- {
- handleLockFileIgnoreRequest( rRequest->getContinuations() );
- return true;
- }
+ if ( handlePasswordRequest( rRequest ) )
+ return true;
- return false;
-}
+ if ( handleCookiesRequest( rRequest ) )
+ return true;
-bool UUIInteractionHelper::handleErrorHandlerRequests(
- star::uno::Reference< star::task::XInteractionRequest > const & rRequest,
- bool bObtainErrorStringOnly,
- bool & bHasErrorString,
- rtl::OUString & rErrorString)
-{
- star::uno::Any aAnyRequest(rRequest->getRequest());
+ if ( handleNoSuchFilterRequest( rRequest ) )
+ return true;
- star::task::ErrorCodeRequest aErrorCodeRequest;
- if (aAnyRequest >>= aErrorCodeRequest)
- {
- handleGenericErrorRequest( aErrorCodeRequest.ErrCode,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
- }
+ if ( handleAmbigousFilterRequest( rRequest ) )
+ return true;
- star::task::DocumentMacroConfirmationRequest aMacroConfirmRequest;
- if (aAnyRequest >>= aMacroConfirmRequest)
- {
- handleMacroConfirmRequest(
- aMacroConfirmRequest.DocumentURL,
- aMacroConfirmRequest.DocumentStorage,
- ODFVER_012_TEXT,
- aMacroConfirmRequest.DocumentSignatureInformation,
- rRequest->getContinuations()
- );
- return true;
- }
+ if ( handleFilterOptionsRequest( rRequest ) )
+ return true;
- star::task::DocumentMacroConfirmationRequest2 aMacroConfirmRequest2;
- if (aAnyRequest >>= aMacroConfirmRequest2)
- {
- handleMacroConfirmRequest(
- aMacroConfirmRequest2.DocumentURL,
- aMacroConfirmRequest2.DocumentZipStorage,
- aMacroConfirmRequest2.DocumentVersion,
- aMacroConfirmRequest2.DocumentSignatureInformation,
- rRequest->getContinuations()
- );
- return true;
- }
+ if ( handleLockedDocumentRequest( rRequest ) )
+ return true;
- FutureDocumentVersionProductUpdateRequest aProductUpdateRequest;
- if (aAnyRequest >>= aProductUpdateRequest)
- {
- handleFutureDocumentVersionUpdateRequest(
- aProductUpdateRequest,
- rRequest->getContinuations()
- );
- return true;
- }
-
- star::task::ErrorCodeIOException aErrorCodeIOException;
- if (aAnyRequest >>= aErrorCodeIOException)
- {
- handleGenericErrorRequest( aErrorCodeIOException.ErrCode,
- rRequest->getContinuations(),
- bObtainErrorStringOnly,
- bHasErrorString,
- rErrorString);
- return true;
- }
+ if ( handleChangedByOthersRequest( rRequest ) )
+ return true;
- return false;
-}
+ if ( handleLockFileIgnoreRequest( rRequest ) )
+ return true;
-bool
-UUIInteractionHelper::handle_impl(
- star::uno::Reference< star::task::XInteractionRequest > const & rRequest)
- throw (star::uno::RuntimeException)
-{
- try
- {
- if (!rRequest.is())
- return false;
+ task::DocumentMacroConfirmationRequest aMacroConfirmRequest;
+ if (aAnyRequest >>= aMacroConfirmRequest)
+ {
+ handleMacroConfirmRequest(
+ aMacroConfirmRequest.DocumentURL,
+ aMacroConfirmRequest.DocumentStorage,
+ ODFVER_012_TEXT,
+ aMacroConfirmRequest.DocumentSignatureInformation,
+ rRequest->getContinuations());
+ return true;
+ }
- ////////////////////////////////////////////////////////////
- // Display Messagebox
- ////////////////////////////////////////////////////////////
- bool bDummy = false;
- rtl::OUString aDummy;
- if (! handleMessageboxRequests(rRequest, false, bDummy, aDummy))
- {
- ////////////////////////////////////////////////////////////
- // Use ErrorHandler::HandleError
- ////////////////////////////////////////////////////////////
- if (!handleErrorHandlerRequests(rRequest, false, bDummy, aDummy))
+ task::DocumentMacroConfirmationRequest2 aMacroConfirmRequest2;
+ if (aAnyRequest >>= aMacroConfirmRequest2)
{
- ////////////////////////////////////////////////////////////
- // Display Special Dialog
- ////////////////////////////////////////////////////////////
- if (!handleDialogRequests(rRequest))
- {
- ////////////////////////////////////////////////////////////
- // Use customized InteractionHandler from configuration
- ////////////////////////////////////////////////////////////
- InteractionHandlerDataList dataList;
-
- GetInteractionHandlerList(dataList);
-
- InteractionHandlerDataList::const_iterator aEnd(dataList.end());
- for (InteractionHandlerDataList::const_iterator aIt(dataList.begin());
- aIt != aEnd; ++aIt)
- {
- Reference< uno::XInterface > xIfc =
- m_xServiceFactory->createInstance(aIt->ServiceName);
-
-
- Reference< com::sun::star::lang::XInitialization > xInitialization =
- Reference< com::sun::star::lang::XInitialization >( xIfc, UNO_QUERY );
-
- OSL_ENSURE( xInitialization.is(), "Custom Interactionhandler does not implement mandatory interface XInitialization!" );
- if (xInitialization.is())
- {
- uno::Sequence< uno::Any > propertyValues(1);
- beans::PropertyValue aProperty;
-
- aProperty.Name = rtl::OUString::createFromAscii( "Parent" );
- aProperty.Value <<= getParentXWindow();
- propertyValues[ 0 ] <<= aProperty;
-
- xInitialization->initialize(propertyValues);
- }
-
- Reference< task::XInteractionHandler2 >
- xInteractionHandler( xIfc, UNO_QUERY );
-
- OSL_ENSURE( xInteractionHandler.is(),
- "Custom Interactionhandler does not implement "
- "mandatory interface XInteractionHandler2!" );
- if (xInteractionHandler.is())
- if (xInteractionHandler->handleInteractionRequest(rRequest))
- return true;
- }
- return false;
- }
+ handleMacroConfirmRequest(
+ aMacroConfirmRequest2.DocumentURL,
+ aMacroConfirmRequest2.DocumentZipStorage,
+ aMacroConfirmRequest2.DocumentVersion,
+ aMacroConfirmRequest2.DocumentSignatureInformation,
+ rRequest->getContinuations());
+ return true;
+ }
+
+ task::FutureDocumentVersionProductUpdateRequest
+ aProductUpdateRequest;
+ if (aAnyRequest >>= aProductUpdateRequest)
+ {
+ handleFutureDocumentVersionUpdateRequest(
+ aProductUpdateRequest,
+ rRequest->getContinuations());
+ return true;
}
+
+ ///////////////////////////////////////////////////////////////
+ // Last chance: try to find and use another IH for the request.
+ ///////////////////////////////////////////////////////////////
+ if (tryOtherInteractionHandler( rRequest ))
+ return true;
}
+
+ // Not handled.
+ return false;
}
catch (std::bad_alloc const &)
{
- throw star::uno::RuntimeException(
+ throw uno::RuntimeException(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
- star::uno::Reference< star::uno::XInterface >());
+ uno::Reference< uno::XInterface >());
}
- return true;
}
-void UUIInteractionHelper::GetInteractionHandlerList(InteractionHandlerDataList &rdataList)
+void
+UUIInteractionHelper::getInteractionHandlerList(
+ InteractionHandlerDataList &rdataList)
+ SAL_THROW((uno::RuntimeException))
{
+ try
+ {
uno::Reference< lang::XMultiServiceFactory > xConfigProv(
- m_xServiceFactory->createInstance(
- rtl::OUString::createFromAscii(
- "com.sun.star.configuration.ConfigurationProvider" ) ),
- uno::UNO_QUERY );
+ m_xServiceFactory->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.configuration.ConfigurationProvider" ) ),
+ uno::UNO_QUERY );
if ( !xConfigProv.is() )
- {
- OSL_ENSURE( false,
- "GetInteractionHandlerList - No config provider!" );
- return;
- }
+ throw uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unable to instanciate config provider service")),
+ uno::Reference< uno::XInterface >());
rtl::OUStringBuffer aFullPath;
- aFullPath.appendAscii( CONFIG_INTERACTIONHANDLERS_KEY );
+ aFullPath.appendAscii(
+ "/org.openoffice.ucb.InteractionHandler/InteractionHandlers" );
uno::Sequence< uno::Any > aArguments( 1 );
beans::PropertyValue aProperty;
@@ -1444,21 +906,20 @@ void UUIInteractionHelper::GetInteractionHandlerList(InteractionHandlerDataList
aArguments ) );
if ( !xInterface.is() )
- {
- OSL_ENSURE( false,
- "GetInteractionHandlerList - No config access!" );
- return;
- }
+ throw uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unable to instanciate config access")),
+ uno::Reference< uno::XInterface >());
uno::Reference< container::XNameAccess > xNameAccess(
- xInterface, uno::UNO_QUERY );
-
+ xInterface, uno::UNO_QUERY );
if ( !xNameAccess.is() )
- {
- OSL_ENSURE( false,
- "GetInteractionHandlerList - No XNameAccess!" );
- return;
- }
+ throw uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "config access does not implement XNameAccess")),
+ uno::Reference< uno::XInterface >());
uno::Sequence< rtl::OUString > aElems = xNameAccess->getElementNames();
const rtl::OUString* pElems = aElems.getConstArray();
@@ -1470,12 +931,11 @@ void UUIInteractionHelper::GetInteractionHandlerList(InteractionHandlerDataList
xHierNameAccess( xInterface, uno::UNO_QUERY );
if ( !xHierNameAccess.is() )
- {
- OSL_ENSURE( false,
- "GetInteractionHandlerList - "
- "No XHierarchicalNameAccess!" );
- return;
- }
+ throw uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "config access does not implement XHierarchicalNameAccess")),
+ uno::Reference< uno::XInterface >());
// Iterate over children.
for ( sal_Int32 n = 0; n < nCount; ++n )
@@ -1516,29 +976,42 @@ void UUIInteractionHelper::GetInteractionHandlerList(InteractionHandlerDataList
"caught NoSuchElementException!" );
}
}
- }
+ }
+ }
+ catch ( uno::RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( uno::Exception const & )
+ {
+ OSL_ENSURE( false, "GetInteractionHandlerList - Caught Exception!" );
+ }
}
-Window * UUIInteractionHelper::getParentProperty() SAL_THROW(())
+Window *
+UUIInteractionHelper::getParentProperty()
+ SAL_THROW(())
{
- star::uno::Reference< star::awt::XWindow > xWindow = getParentXWindow();
+ uno::Reference< awt::XWindow > xWindow = getParentXWindow();
if ( xWindow.is() )
return VCLUnoHelper::GetWindow(xWindow);
-
+
return 0;
}
-star::uno::Reference< ::com::sun::star::awt::XWindow> UUIInteractionHelper::getParentXWindow() SAL_THROW(())
+uno::Reference< awt::XWindow>
+UUIInteractionHelper::getParentXWindow()
+ SAL_THROW(())
{
osl::MutexGuard aGuard(m_aPropertyMutex);
for (sal_Int32 i = 0; i < m_aProperties.getLength(); ++i)
{
- star::beans::PropertyValue aProperty;
+ beans::PropertyValue aProperty;
if ((m_aProperties[i] >>= aProperty)
&& aProperty.
Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Parent")))
{
- star::uno::Reference< star::awt::XWindow > xWindow;
+ uno::Reference< awt::XWindow > xWindow;
aProperty.Value >>= xWindow;
return xWindow;
}
@@ -1546,12 +1019,14 @@ star::uno::Reference< ::com::sun::star::awt::XWindow> UUIInteractionHelper::get
return 0;
}
-rtl::OUString UUIInteractionHelper::getContextProperty() SAL_THROW(())
+rtl::OUString
+UUIInteractionHelper::getContextProperty()
+ SAL_THROW(())
{
osl::MutexGuard aGuard(m_aPropertyMutex);
for (sal_Int32 i = 0; i < m_aProperties.getLength(); ++i)
{
- star::beans::PropertyValue aProperty;
+ beans::PropertyValue aProperty;
if ((m_aProperties[i] >>= aProperty)
&& aProperty.
Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Context")))
@@ -1564,582 +1039,45 @@ rtl::OUString UUIInteractionHelper::getContextProperty() SAL_THROW(())
return rtl::OUString();
}
-bool
-UUIInteractionHelper::initPasswordContainer(
- star::uno::Reference< star::task::XPasswordContainer > * pContainer,
- star::uno::Reference< star::task::XUrlContainer > * pUrlContainer)
- const SAL_THROW(())
-{
- OSL_ENSURE(pContainer, "specification violation");
- if (!pContainer->is() && m_xServiceFactory.is())
- try
- {
- *pContainer
- = star::uno::Reference< star::task::XPasswordContainer >(
- m_xServiceFactory->
- createInstance(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.task.PasswordContainer"))),
- star::uno::UNO_QUERY);
-
- if ( pContainer->is() )
- {
- *pUrlContainer = star::uno::Reference< star::task::XUrlContainer >( *pContainer, UNO_QUERY );
- OSL_ENSURE( pUrlContainer->is(), "Got no XUrlContainer!" );
- }
- }
- catch (star::uno::Exception const &)
- {}
- OSL_ENSURE(pContainer->is(), "unexpected situation");
- return pContainer->is() && pUrlContainer->is();
-}
-
-
-String GetContentPart( const String& _rRawString )
-{
- // search over some parts to find a string
- //static char* aIDs[] = { "CN", "OU", "O", "E", NULL };
- static char const * aIDs[] = { "CN=", "OU=", "O=", "E=", NULL };// By CP
- String sPart;
- int i = 0;
- while ( aIDs[i] )
- {
- String sPartId = String::CreateFromAscii( aIDs[i++] );
- xub_StrLen nContStart = _rRawString.Search( sPartId );
- if ( nContStart != STRING_NOTFOUND )
- {
- nContStart = nContStart + sPartId.Len();
- //++nContStart; // now it's start of content, directly after Id // delete By CP
- xub_StrLen nContEnd = _rRawString.Search( sal_Unicode( ',' ), nContStart );
- sPart = String( _rRawString, nContStart, nContEnd - nContStart );
- break;
- }
- }
-
- return sPart;
-}
-
-
-sal_Bool UUIInteractionHelper::executeUnknownAuthDialog( const cssu::Reference< dcss::security::XCertificate >& rXCert)
- SAL_THROW((star::uno::RuntimeException))
-{
- try
- {
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- std::auto_ptr< ResMgr >
- xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
- std::auto_ptr< UnknownAuthDialog >
- xDialog(new UnknownAuthDialog( getParentProperty(),
- rXCert,
- m_xServiceFactory,
- xManager.get()));
-
- // Get correct ressource string
- rtl::OUString aMessage;
-
- std::vector< rtl::OUString > aArguments;
- aArguments.push_back( GetContentPart( rXCert.get()->getSubjectName()) );
- //aArguments.push_back( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")) );
-
- if (xManager.get())
- {
- ResId aResId(RID_UUI_ERRHDL, *xManager.get());
- if (ErrorResource(aResId).getString(ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED, &aMessage))
- {
- aMessage = replaceMessageWithArguments( aMessage, aArguments );
- xDialog->setDescriptionText( aMessage );
- }
- }
-
- return static_cast<sal_Bool> (xDialog->Execute());
- }
- catch (std::bad_alloc const &)
- {
- throw star::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
- star::uno::Reference< star::uno::XInterface >());
- }
-}
-
-rtl::OUString
-UUIInteractionHelper::getLocalizedDatTimeStr( ::com::sun::star::util::DateTime aDateTime )
-{
-
-
- rtl::OUString aDateTimeStr;
- Date aDate;
- Time aTime;
-
- aDate = Date( aDateTime.Day, aDateTime.Month, aDateTime.Year );
- aTime = Time( aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds );
-
- LanguageType eUILang = Application::GetSettings().GetUILanguage();
- SvNumberFormatter *pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessServiceFactory(), eUILang );
- String aTmpStr;
- Color* pColor = NULL;
- Date* pNullDate = pNumberFormatter->GetNullDate();
- sal_uInt32 nFormat = pNumberFormatter->GetStandardFormat( NUMBERFORMAT_DATE, eUILang );
-
- pNumberFormatter->GetOutputString( aDate - *pNullDate, nFormat, aTmpStr, &pColor );
- aDateTimeStr = aTmpStr + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "));
-
- nFormat = pNumberFormatter->GetStandardFormat( NUMBERFORMAT_TIME, eUILang );
- pNumberFormatter->GetOutputString( aTime.GetTimeInDays(), nFormat, aTmpStr, &pColor );
- aDateTimeStr += aTmpStr;
-
- return aDateTimeStr;
-}
-
-sal_Bool UUIInteractionHelper::executeSSLWarnDialog( const cssu::Reference< dcss::security::XCertificate >& rXCert,
- sal_Int32 const & failure,
- const rtl::OUString & hostName )
- SAL_THROW((star::uno::RuntimeException))
-{
- try
- {
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- std::auto_ptr< ResMgr >
- xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
- std::auto_ptr< SSLWarnDialog >
- xDialog(new SSLWarnDialog( getParentProperty(),
- rXCert,
- m_xServiceFactory,
- xManager.get()));
-
- // Get correct ressource string
- rtl::OUString aMessage_1;
- std::vector< rtl::OUString > aArguments_1;
-
- switch( failure )
- {
- case SSLWARN_TYPE_DOMAINMISMATCH:
- aArguments_1.push_back( hostName );
- aArguments_1.push_back( GetContentPart( rXCert.get()->getSubjectName()) );
- aArguments_1.push_back( hostName );
- break;
- case SSLWARN_TYPE_EXPIRED:
- aArguments_1.push_back( GetContentPart( rXCert.get()->getSubjectName()) );
- aArguments_1.push_back( getLocalizedDatTimeStr( rXCert.get()->getNotValidAfter() ) );
- aArguments_1.push_back( getLocalizedDatTimeStr( rXCert.get()->getNotValidAfter() ) );
- break;
- case SSLWARN_TYPE_INVALID:
- break;
- }
-
-
-
- //aArguments.push_back( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")) );
-
- if (xManager.get())
- {
- ResId aResId(RID_UUI_ERRHDL, *xManager.get());
- if (ErrorResource(aResId).getString( ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + DESCRIPTION_1, &aMessage_1))
- {
- aMessage_1 = replaceMessageWithArguments( aMessage_1, aArguments_1 );
- xDialog->setDescription1Text( aMessage_1 );
- }
-
- rtl::OUString aTitle;
- ErrorResource(aResId).getString( ERRCODE_AREA_UUI_UNKNOWNAUTH + failure + TITLE, &aTitle);
- xDialog->SetText( aTitle );
- }
-
-
-
- return static_cast<sal_Bool> (xDialog->Execute());
- }
- catch (std::bad_alloc const &)
- {
- throw star::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
- star::uno::Reference< star::uno::XInterface >());
- }
-}
-
-void UUIInteractionHelper::executeLoginDialog(LoginErrorInfo & rInfo,
- rtl::OUString const & rRealm)
- SAL_THROW((star::uno::RuntimeException))
-{
- try
- {
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- bool bAccount = (rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_ACCOUNT)
- != 0;
- bool bSavePassword = rInfo.GetIsPersistentPassword()
- || rInfo.GetIsSavePassword();
- bool bCanUseSysCreds = rInfo.GetCanUseSystemCredentials();
-
- sal_uInt16 nFlags = 0;
- if (rInfo.GetPath().Len() == 0)
- nFlags |= LF_NO_PATH;
- if (rInfo.GetErrorText().Len() == 0)
- nFlags |= LF_NO_ERRORTEXT;
- if (!bAccount)
- nFlags |= LF_NO_ACCOUNT;
- if (!(rInfo.GetFlags() & LOGINERROR_FLAG_MODIFY_USER_NAME))
- nFlags |= LF_USERNAME_READONLY;
-
- if (!bSavePassword)
- nFlags |= LF_NO_SAVEPASSWORD;
-
- if (!bCanUseSysCreds)
- nFlags |= LF_NO_USESYSCREDS;
-
- std::auto_ptr< ResMgr >
- xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
- UniString aRealm(rRealm); // Forte compiler needs it spelled out...
- std::auto_ptr< LoginDialog >
- xDialog(new LoginDialog(getParentProperty(),
- nFlags,
- rInfo.GetServer(),
- &aRealm,
- xManager.get()));
- if (rInfo.GetErrorText().Len() != 0)
- xDialog->SetErrorText(rInfo.GetErrorText());
- xDialog->SetName(rInfo.GetUserName());
- if (bAccount)
- xDialog->ClearAccount();
- else
- xDialog->ClearPassword();
- xDialog->SetPassword(rInfo.GetPassword());
-
- if (bSavePassword)
- {
- xDialog->
- SetSavePasswordText(ResId(rInfo.GetIsPersistentPassword() ?
- RID_SAVE_PASSWORD :
- RID_KEEP_PASSWORD,
- *xManager.get()));
- xDialog->SetSavePassword(rInfo.GetIsSavePassword());
- }
-
- if ( bCanUseSysCreds )
- xDialog->SetUseSystemCredentials( rInfo.GetIsUseSystemCredentials() );
-
- rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
- ERRCODE_BUTTON_CANCEL);
- rInfo.SetUserName(xDialog->GetName());
- rInfo.SetPassword(xDialog->GetPassword());
- rInfo.SetAccount(xDialog->GetAccount());
- rInfo.SetSavePassword(xDialog->IsSavePassword());
-
- if ( bCanUseSysCreds )
- rInfo.SetIsUseSystemCredentials( xDialog->IsUseSystemCredentials() );
- }
- catch (std::bad_alloc const &)
- {
- throw star::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
- star::uno::Reference< star::uno::XInterface >());
- }
-}
-
-void
-UUIInteractionHelper::executeMasterPasswordDialog(
- LoginErrorInfo & rInfo,
- star::task::PasswordRequestMode nMode)
- SAL_THROW((star::uno::RuntimeException))
-{
- rtl::OString aMaster;
- try
- {
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- std::auto_ptr< ResMgr >
- xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
- if( nMode == star::task::PasswordRequestMode_PASSWORD_CREATE )
- {
- std::auto_ptr< MasterPasswordCreateDialog >
- xDialog(new MasterPasswordCreateDialog(
- getParentProperty(), xManager.get()));
- rInfo.SetResult(xDialog->Execute()
- == RET_OK ? ERRCODE_BUTTON_OK
- : ERRCODE_BUTTON_CANCEL);
- aMaster = rtl::OUStringToOString(xDialog->GetMasterPassword(),
- RTL_TEXTENCODING_UTF8);
- }
- else
- {
- std::auto_ptr< MasterPasswordDialog >
- xDialog(new MasterPasswordDialog(
- getParentProperty(), nMode, xManager.get()));
- rInfo.SetResult(xDialog->Execute()
- == RET_OK ? ERRCODE_BUTTON_OK
- : ERRCODE_BUTTON_CANCEL);
- aMaster = rtl::OUStringToOString(xDialog->GetMasterPassword(),
- RTL_TEXTENCODING_UTF8);
- }
-
- }
- catch (std::bad_alloc const &)
- {
- throw star::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
- star::uno::Reference< star::uno::XInterface >());
- }
-
- sal_uInt8 aKey[RTL_DIGEST_LENGTH_MD5];
- rtl_digest_PBKDF2(aKey,
- RTL_DIGEST_LENGTH_MD5,
- reinterpret_cast< sal_uInt8 const * >(aMaster.getStr()),
- aMaster.getLength(),
- reinterpret_cast< sal_uInt8 const * >(
- "3B5509ABA6BC42D9A3A1F3DAD49E56A51"),
- 32,
- 1000);
-
- rtl::OUStringBuffer aBuffer;
- for (int i = 0; i < RTL_DIGEST_LENGTH_MD5; ++i)
- {
- aBuffer.append(static_cast< sal_Unicode >('a' + (aKey[i] >> 4)));
- aBuffer.append(static_cast< sal_Unicode >('a' + (aKey[i] & 15)));
- }
- rInfo.SetPassword(aBuffer.makeStringAndClear());
-}
-
-void
-UUIInteractionHelper::executePasswordDialog(
- LoginErrorInfo & rInfo,
- star::task::PasswordRequestMode nMode,
- ::rtl::OUString aDocName)
- SAL_THROW((star::uno::RuntimeException))
-{
- try
- {
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- std::auto_ptr< ResMgr >
- xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
- if( nMode == star::task::PasswordRequestMode_PASSWORD_CREATE )
- {
- std::auto_ptr< PasswordCreateDialog >
- xDialog(new PasswordCreateDialog(
- getParentProperty(), xManager.get()));
-
- rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
- ERRCODE_BUTTON_CANCEL);
- rInfo.SetPassword( xDialog->GetPassword() );
- }
- else
- {
- std::auto_ptr< PasswordDialog >
- xDialog(new PasswordDialog(
- getParentProperty(), nMode, xManager.get(), aDocName ));
-
- rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
- ERRCODE_BUTTON_CANCEL);
- rInfo.SetPassword( xDialog->GetPassword() );
- }
- }
- catch (std::bad_alloc const &)
- {
- throw star::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
- star::uno::Reference< star::uno::XInterface>());
- }
-}
-
-void
-UUIInteractionHelper::executeMSPasswordDialog(
- LoginErrorInfo & rInfo,
- star::task::PasswordRequestMode nMode,
- ::rtl::OUString aDocName)
- SAL_THROW((star::uno::RuntimeException))
-{
- try
- {
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- std::auto_ptr< ResMgr >
- xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
- if( nMode == star::task::PasswordRequestMode_PASSWORD_CREATE )
- {
- std::auto_ptr< PasswordCreateDialog >
- xDialog(new PasswordCreateDialog(
- getParentProperty(), xManager.get(), true));
-
- rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
- ERRCODE_BUTTON_CANCEL);
- rInfo.SetPassword( xDialog->GetPassword() );
- }
- else
- {
- std::auto_ptr< PasswordDialog >
- xDialog(new PasswordDialog(
- getParentProperty(), nMode, xManager.get(), aDocName ));
-
- rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
- ERRCODE_BUTTON_CANCEL);
- rInfo.SetPassword( xDialog->GetPassword() );
- }
- }
- catch (std::bad_alloc const &)
- {
- throw star::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
- star::uno::Reference< star::uno::XInterface>());
- }
-}
-
-void
-UUIInteractionHelper::executeCookieDialog(CntHTTPCookieRequest & rRequest)
- SAL_THROW((star::uno::RuntimeException))
+uno::Reference< task::XInteractionHandler >
+UUIInteractionHelper::getInteractionHandler()
+ SAL_THROW((uno::RuntimeException))
{
+ uno::Reference< task::XInteractionHandler > xIH;
try
{
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- std::auto_ptr< ResMgr >
- xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
- std::auto_ptr< CookiesDialog >
- xDialog(new CookiesDialog(
- getParentProperty(), &rRequest, xManager.get()));
- xDialog->Execute();
- }
- catch (std::bad_alloc const &)
- {
- throw star::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
- star::uno::Reference< star::uno::XInterface>());
+ xIH.set(m_xServiceFactory->createInstanceWithArguments(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.InteractionHandler")),
+ m_aProperties),
+ uno::UNO_QUERY);
}
-}
-
-void UUIInteractionHelper::executeFilterDialog(
- rtl::OUString const & rURL ,
- uui::FilterNameList const & rFilters,
- rtl::OUString & rFilter )
- SAL_THROW((star::uno::RuntimeException))
-{
- try
- {
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- std::auto_ptr< ResMgr >
- xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
-
- std::auto_ptr< uui::FilterDialog >
- xDialog(new uui::FilterDialog(getParentProperty(),
- xManager.get()));
-
- xDialog->SetURL(rURL);
- xDialog->ChangeFilters(&rFilters);
+ catch (uno::Exception const &)
+ {}
- uui::FilterNameListPtr pSelected = rFilters.end();
- if( xDialog->AskForFilter( pSelected ) )
- {
- rFilter = pSelected->sInternal;
- }
- }
- catch (std::bad_alloc const &)
- {
- throw star::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
- star::uno::Reference< star::uno::XInterface >());
- }
+ if (!xIH.is())
+ throw uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unable to instanciate Interaction Handler service")),
+ uno::Reference< uno::XInterface >());
+ return xIH;
}
-USHORT
-UUIInteractionHelper::executeErrorDialog(
- star::task::InteractionClassification eClassification,
- rtl::OUString const & rContext,
- rtl::OUString const & rMessage,
- WinBits nButtonMask)
- SAL_THROW((star::uno::RuntimeException))
-{
-
- vos::OGuard aGuard(Application::GetSolarMutex());
-
- rtl::OUStringBuffer aText(rContext);
- if (rContext.getLength() != 0 && rMessage.getLength() != 0)
- aText.appendAscii(RTL_CONSTASCII_STRINGPARAM(":\n"));
- //TODO! must be internationalized
- aText.append(rMessage);
-
- std::auto_ptr< MessBox > xBox;
- try
- {
- switch (eClassification)
- {
- case star::task::InteractionClassification_ERROR:
- xBox.reset(new ErrorBox(getParentProperty(),
- nButtonMask,
- aText.makeStringAndClear()));
- break;
-
- case star::task::InteractionClassification_WARNING:
- xBox.reset(new WarningBox(getParentProperty(),
- nButtonMask,
- aText.makeStringAndClear()));
- break;
-
- case star::task::InteractionClassification_INFO:
- if ((nButtonMask & 0x01F00000) == WB_DEF_OK)
- //TODO! missing win bit button mask define (want to ignore
- // any default button settings)...
- xBox.reset(new InfoBox(getParentProperty(),
- aText.makeStringAndClear()));
- else
- xBox.reset(new ErrorBox(getParentProperty(),
- nButtonMask,
- aText.makeStringAndClear()));
- break;
-
- case star::task::InteractionClassification_QUERY:
- xBox.reset(new QueryBox(getParentProperty(),
- nButtonMask,
- aText.makeStringAndClear()));
- break;
-
- default:
- OSL_ASSERT(false);
- break;
- }
- }
- catch (std::bad_alloc const &)
- {
- throw star::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
- star::uno::Reference< star::uno::XInterface >());
- }
-
- USHORT aResult = xBox->Execute();
- switch( aResult )
- {
- case BUTTONID_OK:
- aResult = ERRCODE_BUTTON_OK;
- break;
- case BUTTONID_CANCEL:
- aResult = ERRCODE_BUTTON_CANCEL;
- break;
- case BUTTONID_YES:
- aResult = ERRCODE_BUTTON_YES;
- break;
- case BUTTONID_NO:
- aResult = ERRCODE_BUTTON_NO;
- break;
- case BUTTONID_RETRY:
- aResult = ERRCODE_BUTTON_RETRY;
- break;
- }
-
- return aResult;
-}
+namespace {
USHORT
-UUIInteractionHelper::executeMessageBox(
+executeMessageBox(
+ Window * pParent,
rtl::OUString const & rTitle,
rtl::OUString const & rMessage,
WinBits nButtonMask )
- SAL_THROW((star::uno::RuntimeException))
+ SAL_THROW((uno::RuntimeException))
{
-
vos::OGuard aGuard(Application::GetSolarMutex());
- MessBox xBox( getParentProperty(), nButtonMask, rTitle, rMessage );
+ MessBox xBox( pParent, nButtonMask, rTitle, rMessage );
USHORT aResult = xBox.Execute();
switch( aResult )
@@ -2163,479 +1101,12 @@ UUIInteractionHelper::executeMessageBox(
return aResult;
}
-star::uno::Reference< star::task::XInteractionHandler >
-UUIInteractionHelper::getInteractionHandler() const
- SAL_THROW((star::uno::RuntimeException))
-{
- star::uno::Reference< star::task::XInteractionHandler > xIH;
- try
- {
- xIH = star::uno::Reference< star::task::XInteractionHandler >(
- m_xServiceFactory->createInstanceWithArguments(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.task.InteractionHandler")),
- m_aProperties),
- star::uno::UNO_QUERY);
- }
- catch (star::uno::Exception const &)
- {}
-
- if (!xIH.is())
- throw star::uno::RuntimeException(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "unable to instanciate Interaction Handler service")),
- star::uno::Reference< star::uno::XInterface >());
- return xIH;
-}
-
-namespace
-{
-bool fillContinuation(
- bool bUseSystemCredentials,
- const star::ucb::AuthenticationRequest & rRequest,
- const star::task::UrlRecord & aRec,
- const star::uno::Reference< star::ucb::XInteractionSupplyAuthentication > &
- xSupplyAuthentication,
- const star::uno::Reference< star::ucb::XInteractionSupplyAuthentication2 > &
- xSupplyAuthentication2,
- bool bCanUseSystemCredentials,
- bool bCheckForEqualPasswords )
-{
- if ( bUseSystemCredentials )
- {
- // "use system creds" record found.
- // Wants client that we use it?
- if ( xSupplyAuthentication2.is() &&
- bCanUseSystemCredentials )
- {
- xSupplyAuthentication2->setUseSystemCredentials( sal_True );
- return true;
- }
- return false;
- }
- else if (aRec.UserList.getLength() != 0)
- {
- if (aRec.UserList[0].Passwords.getLength() == 0)
- {
- // Password sequence can be empty, for instance if master
- // password was not given (e.g. master pw dialog canceled)
- // pw container does not throw NoMasterException in this case.
- // bug???
- return false;
- }
-
- // "user/pass" record found.
- if (!bCheckForEqualPasswords || !rRequest.HasPassword
- || rRequest.Password != aRec.UserList[0].Passwords[0]) // failed login attempt?
- {
- if (xSupplyAuthentication->canSetUserName())
- xSupplyAuthentication->
- setUserName(aRec.UserList[0].UserName.getStr());
-
- if (xSupplyAuthentication->canSetPassword())
- xSupplyAuthentication->
- setPassword(aRec.UserList[0].Passwords[0].getStr());
- if (aRec.UserList[0].Passwords.getLength() > 1)
- {
- if (rRequest.HasRealm)
- {
- if (xSupplyAuthentication->canSetRealm())
- xSupplyAuthentication->
- setRealm(aRec.UserList[0].Passwords[1].
- getStr());
- }
- else if (xSupplyAuthentication->canSetAccount())
- xSupplyAuthentication->
- setAccount(aRec.UserList[0].Passwords[1].
- getStr());
- }
-
- if ( xSupplyAuthentication2.is() &&
- bCanUseSystemCredentials )
- xSupplyAuthentication2->setUseSystemCredentials( sal_False );
-
- return true;
- }
- }
- return false;
-}
-
-}
-
-void
-UUIInteractionHelper::handleAuthenticationRequest(
- star::ucb::AuthenticationRequest const & rRequest,
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const &
- rContinuations,
- const rtl::OUString & rURL)
- SAL_THROW((star::uno::RuntimeException))
-{
- star::uno::Reference< star::task::XInteractionHandler > xIH;
-
- star::uno::Reference< star::task::XInteractionRetry > xRetry;
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
- star::uno::Reference< star::ucb::XInteractionSupplyAuthentication >
- xSupplyAuthentication;
- star::uno::Reference< star::ucb::XInteractionSupplyAuthentication2 >
- xSupplyAuthentication2;
- getContinuations(
- rContinuations,
- 0, 0, &xRetry, &xAbort,
- &xSupplyAuthentication, &xSupplyAuthentication2, 0, 0, 0 );
- bool bRemember;
- bool bRememberPersistent;
- if (xSupplyAuthentication.is())
- {
- star::ucb::RememberAuthentication eDefault;
- star::uno::Sequence< star::ucb::RememberAuthentication >
- aModes(xSupplyAuthentication->getRememberPasswordModes(eDefault));
- bRemember = eDefault != star::ucb::RememberAuthentication_NO;
- bRememberPersistent = false;
- for (sal_Int32 i = 0; i < aModes.getLength(); ++i)
- if (aModes[i] == star::ucb::RememberAuthentication_PERSISTENT)
- {
- bRememberPersistent = true;
- break;
- }
- }
- else
- {
- bRemember = false;
- bRememberPersistent = false;
- }
-
- sal_Bool bCanUseSystemCredentials;
- sal_Bool bDefaultUseSystemCredentials;
- if (xSupplyAuthentication2.is())
- {
- bCanUseSystemCredentials
- = xSupplyAuthentication2->canUseSystemCredentials(
- bDefaultUseSystemCredentials );
- }
- else
- {
- bCanUseSystemCredentials = sal_False;
- bDefaultUseSystemCredentials = sal_False;
- }
-
- com::sun::star::uno::Reference< com::sun::star::task::XPasswordContainer >
- xContainer;
- com::sun::star::uno::Reference< com::sun::star::task::XUrlContainer >
- xUrlContainer;
-
- if ( bCanUseSystemCredentials && initPasswordContainer( &xContainer, &xUrlContainer ) )
- {
- // Runtime / Persistent info avail for current auth request?
-
- rtl::OUString aResult = xUrlContainer->findUrl(
- rURL.getLength() ? rURL : rRequest.ServerName );
- if ( aResult.getLength() > 0 )
- {
- if ( fillContinuation( true,
- rRequest,
- star::task::UrlRecord(),
- xSupplyAuthentication,
- xSupplyAuthentication2,
- bCanUseSystemCredentials,
- false ) )
- {
- xSupplyAuthentication->select();
- return;
- }
- }
- }
-
- // xContainer works with userName passwdSequences pairs:
- if (rRequest.HasUserName
- && rRequest.HasPassword
- && initPasswordContainer(&xContainer, &xUrlContainer))
- {
- xIH = getInteractionHandler();
- try
- {
- if (rRequest.UserName.getLength() == 0)
- {
- star::task::UrlRecord aRec;
- if ( rURL.getLength() )
- aRec = xContainer->find(rURL, xIH);
-
- if ( aRec.UserList.getLength() == 0 )
- {
- // compat: try server name.
- aRec = xContainer->find(rRequest.ServerName, xIH);
- }
-
- if ( fillContinuation( false,
- rRequest,
- aRec,
- xSupplyAuthentication,
- xSupplyAuthentication2,
- bCanUseSystemCredentials,
- false ) )
- {
- xSupplyAuthentication->select();
- return;
- }
- }
- else
- {
- star::task::UrlRecord aRec;
- if ( rURL.getLength() )
- aRec = xContainer->findForName(
- rURL, rRequest.UserName, xIH);
-
- if ( aRec.UserList.getLength() == 0 )
- {
- // compat: try server name.
- aRec = xContainer->findForName(
- rRequest.ServerName, rRequest.UserName, xIH);
- }
-
- if ( fillContinuation( false,
- rRequest,
- aRec,
- xSupplyAuthentication,
- xSupplyAuthentication2,
- bCanUseSystemCredentials,
- true ) )
- {
- xSupplyAuthentication->select();
- return;
- }
- }
- }
- catch (star::task::NoMasterException const &)
- {} // user did not enter master password
- }
-
- LoginErrorInfo aInfo;
- aInfo.SetTitle(rRequest.ServerName);
- aInfo.SetServer(rRequest.ServerName);
- if (rRequest.HasAccount)
- aInfo.SetAccount(rRequest.Account);
- if (rRequest.HasUserName)
- aInfo.SetUserName(rRequest.UserName);
- if (rRequest.HasPassword)
- aInfo.SetPassword(rRequest.Password);
- aInfo.SetErrorText(rRequest.Diagnostic);
- aInfo.SetPersistentPassword(bRememberPersistent);
- aInfo.SetSavePassword(bRemember);
- aInfo.SetCanUseSystemCredentials( bCanUseSystemCredentials );
- aInfo.SetIsUseSystemCredentials( bDefaultUseSystemCredentials );
- aInfo.SetModifyAccount(rRequest.HasAccount
- && xSupplyAuthentication.is()
- && xSupplyAuthentication->canSetAccount());
- aInfo.SetModifyUserName(rRequest.HasUserName
- && xSupplyAuthentication.is()
- && xSupplyAuthentication->canSetUserName());
- executeLoginDialog(aInfo,
- rRequest.HasRealm ? rRequest.Realm : rtl::OUString());
- switch (aInfo.GetResult())
- {
- case ERRCODE_BUTTON_OK:
- if (xSupplyAuthentication.is())
- {
- if (xSupplyAuthentication->canSetUserName())
- xSupplyAuthentication->setUserName(aInfo.GetUserName());
- if (xSupplyAuthentication->canSetPassword())
- xSupplyAuthentication->setPassword(aInfo.GetPassword());
- xSupplyAuthentication->
- setRememberPassword(
- aInfo.GetIsSavePassword() ?
- bRememberPersistent ?
- star::ucb::RememberAuthentication_PERSISTENT :
- star::ucb::RememberAuthentication_SESSION :
- star::ucb::RememberAuthentication_NO);
- if (rRequest.HasRealm)
- {
- if (xSupplyAuthentication->canSetRealm())
- xSupplyAuthentication->setRealm(aInfo.GetAccount());
- }
- else if (xSupplyAuthentication->canSetAccount())
- xSupplyAuthentication->setAccount(aInfo.GetAccount());
-
- if ( xSupplyAuthentication2.is() && bCanUseSystemCredentials )
- xSupplyAuthentication2->setUseSystemCredentials(
- aInfo.GetIsUseSystemCredentials() );
-
- xSupplyAuthentication->select();
- }
-
- if ( aInfo.GetIsUseSystemCredentials() )
- {
- if (aInfo.GetIsSavePassword())
- {
- if ( initPasswordContainer(&xContainer, &xUrlContainer) )
- xUrlContainer->addUrl(
- rURL.getLength() ? rURL : rRequest.ServerName,
- bRememberPersistent );
- }
- }
- else if (aInfo.GetUserName().Len() != 0 // Empty user name can not be valid:
- && initPasswordContainer(&xContainer, &xUrlContainer))
- {
- try
- {
- if (aInfo.GetIsSavePassword())
- {
- star::uno::Sequence< rtl::OUString >
- aPassList(aInfo.GetAccount().Len() == 0 ? 1 : 2);
- aPassList[0] = aInfo.GetPassword();
- if (aInfo.GetAccount().Len() != 0)
- aPassList[1] = aInfo.GetAccount();
-
- if (!xIH.is())
- xIH = getInteractionHandler();
-
- if (bRememberPersistent)
- xContainer->addPersistent(
- rURL.getLength() ? rURL : rRequest.ServerName,
- aInfo.GetUserName(),
- aPassList,
- xIH);
- else
- xContainer->add(
- rURL.getLength() ? rURL : rRequest.ServerName,
- aInfo.GetUserName(),
- aPassList,
- xIH);
- }
- }
- catch (star::task::NoMasterException const &)
- {} // user did not enter master password
- }
- break;
-
- case ERRCODE_BUTTON_RETRY:
- if (xRetry.is())
- xRetry->select();
- break;
-
- default:
- if (xAbort.is())
- xAbort->select();
- break;
- }
-}
-
-sal_Bool
-UUIInteractionHelper::isDomainMatch( rtl::OUString hostName, rtl::OUString certHostName)
-{
- if (hostName.equalsIgnoreAsciiCase( certHostName ))
- return sal_True;
-
-
-
- if ( 0 == certHostName.indexOf( rtl::OUString::createFromAscii( "*" ) ) && hostName.getLength() >= certHostName.getLength() )
- {
- rtl::OUString cmpStr = certHostName.copy( 1 );
-
- if ( hostName.matchIgnoreAsciiCase( cmpStr, hostName.getLength( ) - cmpStr.getLength()) )
- return sal_True;
-
- }
-
- return sal_False;
-}
-
-
-void
-UUIInteractionHelper::handleCertificateValidationRequest(
- star::ucb::CertificateValidationRequest const & rRequest,
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const &
- rContinuations)
- SAL_THROW((star::uno::RuntimeException))
-{
- star::uno::Reference< star::task::XInteractionHandler > xIH = getInteractionHandler();
-
- star::uno::Reference< star::task::XInteractionApprove > xApprove;
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
-
- getContinuations(
- rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0, 0);
-
- sal_Int32 failures = rRequest.CertificateValidity;
-
- sal_Bool trustCert = sal_True;
-
-
- if ( ((failures & csss::CertificateValidity::UNTRUSTED) == csss::CertificateValidity::UNTRUSTED ) ||
- ((failures & csss::CertificateValidity::ISSUER_UNTRUSTED) == csss::CertificateValidity::ISSUER_UNTRUSTED) ||
- ((failures & csss::CertificateValidity::ROOT_UNTRUSTED) == csss::CertificateValidity::ROOT_UNTRUSTED) )
- {
- if ( executeUnknownAuthDialog( rRequest.Certificate ) )
- trustCert = sal_True;
- else
- trustCert = sal_False;
- }
-
- if ( (!isDomainMatch( rRequest.HostName, GetContentPart( rRequest.Certificate.get()->getSubjectName()) )) &&
- trustCert )
- {
- if ( executeSSLWarnDialog( rRequest.Certificate, SSLWARN_TYPE_DOMAINMISMATCH, rRequest.HostName ) )
- trustCert = sal_True;
- else
- trustCert = sal_False;
- }
-
- if ( (((failures & csss::CertificateValidity::TIME_INVALID) == csss::CertificateValidity::TIME_INVALID) ||
- ((failures & csss::CertificateValidity::NOT_TIME_NESTED) == csss::CertificateValidity::NOT_TIME_NESTED)) &&
- trustCert )
- {
- if ( executeSSLWarnDialog( rRequest.Certificate, SSLWARN_TYPE_EXPIRED, rRequest.HostName ) )
- trustCert = sal_True;
- else
- trustCert = sal_False;
- }
-
- if ( (((failures & csss::CertificateValidity::REVOKED) == csss::CertificateValidity::REVOKED) ||
- ((failures & csss::CertificateValidity::SIGNATURE_INVALID) == csss::CertificateValidity::SIGNATURE_INVALID) ||
- ((failures & csss::CertificateValidity::EXTENSION_INVALID) == csss::CertificateValidity::EXTENSION_INVALID) ||
- ((failures & csss::CertificateValidity::INVALID) == csss::CertificateValidity::INVALID)) &&
- trustCert )
- {
- if ( executeSSLWarnDialog( rRequest.Certificate, SSLWARN_TYPE_INVALID, rRequest.HostName ) )
- trustCert = sal_True;
- else
- trustCert = sal_False;
- }
-
- if ( trustCert )
- {
- if (xApprove.is())
- xApprove->select();
- } else
- {
- if (xAbort.is())
- xAbort->select();
- }
-
- /*
-
- switch (executeMessageBox( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Dialog1")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Dummy dialog")), WB_YES_NO | WB_DEF_YES ))
- {
- case ERRCODE_BUTTON_YES:
- if (xApprove.is())
- xApprove->select();
- break;
- default:
- if (xAbort.is())
- xAbort->select();
- break;
- }
- */
-}
-
-namespace {
enum NameClashResolveDialogResult { ABORT, RENAME, OVERWRITE };
NameClashResolveDialogResult
executeNameClashResolveDialog(
+ Window * /*pParent*/,
rtl::OUString const & /*rTargetFolderURL*/,
rtl::OUString const & /*rClashingName*/,
rtl::OUString & /*rProposedNewName*/)
@@ -2648,6 +1119,7 @@ executeNameClashResolveDialog(
NameClashResolveDialogResult
executeSimpleNameClashResolveDialog(
+ Window * /*pParent*/,
rtl::OUString const & /*rTargetFolderURL*/,
rtl::OUString const & /*rClashingName*/,
rtl::OUString & /*rProposedNewName*/)
@@ -2662,10 +1134,10 @@ executeSimpleNameClashResolveDialog(
void
UUIInteractionHelper::handleNameClashResolveRequest(
- star::ucb::NameClashResolveRequest const & rRequest,
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const & rContinuations)
- SAL_THROW((star::uno::RuntimeException))
+ ucb::NameClashResolveRequest const & rRequest,
+ uno::Sequence< uno::Reference<
+ task::XInteractionContinuation > > const & rContinuations)
+ SAL_THROW((uno::RuntimeException))
{
OSL_ENSURE(
rRequest.TargetFolderURL.getLength() > 0,
@@ -2675,15 +1147,11 @@ UUIInteractionHelper::handleNameClashResolveRequest(
rRequest.ClashingName.getLength() > 0,
"NameClashResolveRequest must not contain empty ClashingName" );
- star::uno::Reference< star::task::XInteractionAbort >
- xAbort;
- star::uno::Reference< star::ucb::XInteractionSupplyName >
- xSupplyName;
- star::uno::Reference< star::ucb::XInteractionReplaceExistingData >
- xReplaceExistingData;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< ucb::XInteractionSupplyName > xSupplyName;
+ uno::Reference< ucb::XInteractionReplaceExistingData > xReplaceExistingData;
getContinuations(
- rContinuations,
- 0, 0, 0, &xAbort, 0, 0, 0, &xSupplyName, &xReplaceExistingData);
+ rContinuations, &xAbort, &xSupplyName, &xReplaceExistingData);
OSL_ENSURE( xAbort.is(),
"NameClashResolveRequest must contain Abort continuation" );
@@ -2695,14 +1163,16 @@ UUIInteractionHelper::handleNameClashResolveRequest(
rtl::OUString aProposedNewName( rRequest.ProposedNewName );
if ( xReplaceExistingData.is() )
eResult = executeNameClashResolveDialog(
- rRequest.TargetFolderURL,
- rRequest.ClashingName,
- aProposedNewName);
+ getParentProperty(),
+ rRequest.TargetFolderURL,
+ rRequest.ClashingName,
+ aProposedNewName);
else
eResult = executeSimpleNameClashResolveDialog(
- rRequest.TargetFolderURL,
- rRequest.ClashingName,
- aProposedNewName);
+ getParentProperty(),
+ rRequest.TargetFolderURL,
+ rRequest.ClashingName,
+ aProposedNewName);
switch ( eResult )
{
@@ -2731,595 +1201,106 @@ UUIInteractionHelper::handleNameClashResolveRequest(
}
void
-UUIInteractionHelper::handleMasterPasswordRequest(
- star::task::PasswordRequestMode nMode,
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const &
- rContinuations)
- SAL_THROW((star::uno::RuntimeException))
-{
- star::uno::Reference< star::task::XInteractionRetry > xRetry;
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
- star::uno::Reference< star::ucb::XInteractionSupplyAuthentication >
- xSupplyAuthentication;
- getContinuations(
- rContinuations,
- 0, 0, &xRetry, &xAbort, &xSupplyAuthentication, 0, 0, 0, 0);
- LoginErrorInfo aInfo;
-
- // in case of master password a hash code is returned
- executeMasterPasswordDialog(aInfo, nMode);
-
- switch (aInfo.GetResult())
- {
- case ERRCODE_BUTTON_OK:
- if (xSupplyAuthentication.is())
- {
- if (xSupplyAuthentication->canSetPassword())
- xSupplyAuthentication->setPassword(aInfo.GetPassword());
- xSupplyAuthentication->select();
- }
- break;
-
- case ERRCODE_BUTTON_RETRY:
- if (xRetry.is())
- xRetry->select();
- break;
-
- default:
- if (xAbort.is())
- xAbort->select();
- break;
- }
-}
-
-void
-UUIInteractionHelper::handlePasswordRequest(
- star::task::PasswordRequestMode nMode,
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const &
- rContinuations,
- ::rtl::OUString aDocumentName )
- SAL_THROW((star::uno::RuntimeException))
-{
- star::uno::Reference< star::task::XInteractionRetry > xRetry;
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
- star::uno::Reference< star::task::XInteractionPassword >
- xPassword;
- getContinuations(
- rContinuations, 0, 0, &xRetry, &xAbort, 0, 0, &xPassword, 0, 0);
- LoginErrorInfo aInfo;
-
- executePasswordDialog(aInfo, nMode, aDocumentName);
-
- switch (aInfo.GetResult())
- {
- case ERRCODE_BUTTON_OK:
- if (xPassword.is())
- {
- xPassword->setPassword(aInfo.GetPassword());
- xPassword->select();
- }
- break;
-
- case ERRCODE_BUTTON_RETRY:
- if (xRetry.is())
- xRetry->select();
- break;
-
- default:
- if (xAbort.is())
- xAbort->select();
- break;
- }
-}
-
-void
-UUIInteractionHelper::handleMSPasswordRequest(
- star::task::PasswordRequestMode nMode,
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const &
- rContinuations,
- ::rtl::OUString aDocumentName )
- SAL_THROW((star::uno::RuntimeException))
-{
- star::uno::Reference< star::task::XInteractionRetry > xRetry;
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
- star::uno::Reference< star::task::XInteractionPassword >
- xPassword;
- getContinuations(
- rContinuations, 0, 0, &xRetry, &xAbort, 0, 0, &xPassword, 0, 0);
- LoginErrorInfo aInfo;
-
- executeMSPasswordDialog(aInfo, nMode, aDocumentName);
-
- switch (aInfo.GetResult())
- {
- case ERRCODE_BUTTON_OK:
- if (xPassword.is())
- {
- xPassword->setPassword(aInfo.GetPassword());
- xPassword->select();
- }
- break;
-
- case ERRCODE_BUTTON_RETRY:
- if (xRetry.is())
- xRetry->select();
- break;
-
- default:
- if (xAbort.is())
- xAbort->select();
- break;
- }
-}
-
-void
-UUIInteractionHelper::handleCookiesRequest(
- star::ucb::HandleCookiesRequest const & rRequest,
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const &
- rContinuations)
- SAL_THROW((star::uno::RuntimeException))
-{
- CookieList aCookies;
- for (sal_Int32 i = 0; i < rRequest.Cookies.getLength(); ++i)
- {
- try
- {
- std::auto_ptr< CntHTTPCookie > xCookie(new CntHTTPCookie);
- xCookie->m_aName = UniString(rRequest.Cookies[i].Name);
- xCookie->m_aValue = UniString(rRequest.Cookies[i].Value);
- xCookie->m_aDomain = UniString(rRequest.Cookies[i].Domain);
- xCookie->m_aPath = UniString(rRequest.Cookies[i].Path);
- xCookie->m_aExpires
- = DateTime(Date(rRequest.Cookies[i].Expires.Day,
- rRequest.Cookies[i].Expires.Month,
- rRequest.Cookies[i].Expires.Year),
- Time(rRequest.Cookies[i].Expires.Hours,
- rRequest.Cookies[i].Expires.Minutes,
- rRequest.Cookies[i].Expires.Seconds,
- rRequest.Cookies[i].Expires.
- HundredthSeconds));
- xCookie->m_nFlags
- = rRequest.Cookies[i].Secure ? CNTHTTP_COOKIE_FLAG_SECURE : 0;
- switch (rRequest.Cookies[i].Policy)
- {
- case star::ucb::CookiePolicy_CONFIRM:
- xCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_INTERACTIVE;
- break;
-
- case star::ucb::CookiePolicy_ACCEPT:
- xCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_ACCEPTED;
- break;
-
- case star::ucb::CookiePolicy_IGNORE:
- xCookie->m_nPolicy = CNTHTTP_COOKIE_POLICY_BANNED;
- break;
-
- default:
- OSL_ASSERT(false);
- break;
- }
- aCookies.Insert(xCookie.get(), LIST_APPEND);
- xCookie.release();
- }
- catch (std::bad_alloc const &)
- {
- throw star::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "out of memory")),
- star::uno::Reference< star::uno::XInterface >());
- }
- }
-
- CntHTTPCookieRequest
- aRequest(rRequest.URL,
- aCookies,
- rRequest.Request == star::ucb::CookieRequest_RECEIVE ?
- CNTHTTP_COOKIE_REQUEST_RECV :
- CNTHTTP_COOKIE_REQUEST_SEND);
- executeCookieDialog(aRequest);
- for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i)
- {
- star::uno::Reference< star::ucb::XInteractionCookieHandling >
- xCookieHandling(rContinuations[i], star::uno::UNO_QUERY);
- if (xCookieHandling.is())
- {
- switch (aRequest.m_nRet)
- {
- case CNTHTTP_COOKIE_POLICY_INTERACTIVE:
- xCookieHandling->
- setGeneralPolicy(star::ucb::CookiePolicy_CONFIRM);
- break;
-
- case CNTHTTP_COOKIE_POLICY_ACCEPTED:
- xCookieHandling->
- setGeneralPolicy(star::ucb::CookiePolicy_ACCEPT);
- break;
-
- case CNTHTTP_COOKIE_POLICY_BANNED:
- xCookieHandling->
- setGeneralPolicy(star::ucb::CookiePolicy_IGNORE);
- break;
- }
- for (sal_Int32 j = 0; j < rRequest.Cookies.getLength(); ++j)
- if (rRequest.Cookies[j].Policy
- == star::ucb::CookiePolicy_CONFIRM)
- switch (static_cast< CntHTTPCookie * >(aCookies.
- GetObject(j))->
- m_nPolicy)
- {
- case CNTHTTP_COOKIE_POLICY_ACCEPTED:
- xCookieHandling->
- setSpecificPolicy(rRequest.Cookies[j], true);
- break;
-
- case CNTHTTP_COOKIE_POLICY_BANNED:
- xCookieHandling->
- setSpecificPolicy(rRequest.Cookies[j], false);
- break;
- }
- xCookieHandling->select();
- break;
- }
- }
-}
-
-void
-UUIInteractionHelper::handleNoSuchFilterRequest(
- star::document::NoSuchFilterRequest const & rRequest,
- star::uno::Sequence<
- star::uno::Reference< star::task::XInteractionContinuation > > const &
- rContinuations )
- SAL_THROW((star::uno::RuntimeException))
-{
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
- star::uno::Reference<
- star::document::XInteractionFilterSelect > xFilterTransport;
-
- sal_Int32 nCount = rContinuations.getLength();
- for( sal_Int32 nStep=0; nStep<nCount; ++nStep )
- {
- if( ! xAbort.is() )
- xAbort = star::uno::Reference< star::task::XInteractionAbort >(
- rContinuations[nStep], star::uno::UNO_QUERY );
-
- if( ! xFilterTransport.is() )
- xFilterTransport = star::uno::Reference<
- star::document::XInteractionFilterSelect >(
- rContinuations[nStep], star::uno::UNO_QUERY );
- }
-
- // check neccessary ressources - if they doesn't exist - abort or
- // break this operation
- if (!xAbort.is())
- return;
-
- if (!xFilterTransport.is() || !m_xServiceFactory.is())
- {
- xAbort->select();
- return;
- }
-
- star::uno::Reference< star::container::XContainerQuery >
- xFilterContainer( m_xServiceFactory->createInstance(
- ::rtl::OUString::createFromAscii(
- "com.sun.star.document.FilterFactory") ),
- star::uno::UNO_QUERY );
- if (!xFilterContainer.is())
- {
- xAbort->select();
- return;
- }
-
- uui::FilterNameList lNames;
-
- // Note: We look for all filters here which match the following criteria:
- // - they are import filters as minimum (of course they can
- // support export too)
- // - we don't show any filter which are flaged as "don't show it
- // at the UI" or "they are not installed"
- // - we ignore filters, which have not set any valid
- // DocumentService (e.g. our pure graphic filters)
- // - we show it sorted by her UIName's
- // - We don't use the order flag or prefer default filters.
- // (Because this list shows all filters and the user should
- // find his filter vry easy by his UIName ...)
- // - We use "_query_all" here ... but we filter graphic filters
- // out by using DocumentService property later!
- star::uno::Reference< star::container::XEnumeration > xFilters
- = xFilterContainer->createSubSetEnumerationByQuery(
- ::rtl::OUString::createFromAscii(
- "_query_all:sort_prop=uiname:iflags=1:eflags=143360"));
- while (xFilters->hasMoreElements())
- {
- try
- {
- ::comphelper::SequenceAsHashMap lProps(xFilters->nextElement());
- uui::FilterNamePair aPair;
-
- aPair.sInternal = lProps.getUnpackedValueOrDefault(
- rtl::OUString::createFromAscii("Name"), ::rtl::OUString());
- aPair.sUI = lProps.getUnpackedValueOrDefault(
- rtl::OUString::createFromAscii("UIName"), ::rtl::OUString());
- if (
- (!aPair.sInternal.Len()) ||
- (!aPair.sUI.Len() )
- )
- {
- continue;
- }
- lNames.push_back( aPair );
- }
- catch(const star::uno::RuntimeException&)
- {
- throw;
- }
- catch(const star::uno::Exception&)
- {
- continue;
- }
- }
-
- // no list available for showing
- // -> abort operation
- if (lNames.size()<1)
- {
- xAbort->select();
- return;
- }
-
- // let the user select the right filter
- rtl::OUString sSelectedFilter;
- executeFilterDialog( rRequest.URL, lNames, sSelectedFilter );
-
- // If he doesn't select anyone
- // -> abort operation
- if (sSelectedFilter.getLength()<1)
- {
- xAbort->select();
- return;
- }
-
- // otherwhise set it for return
- xFilterTransport->setFilter( sSelectedFilter );
- xFilterTransport->select();
-}
-
-void
-UUIInteractionHelper::handleAmbigousFilterRequest(
- star::document::AmbigousFilterRequest const & rRequest,
- star::uno::Sequence<
- star::uno::Reference<
- star::task::XInteractionContinuation > > const & rContinuations)
- SAL_THROW((star::uno::RuntimeException))
-{
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
- star::uno::Reference<
- star::document::XInteractionFilterSelect > xFilterTransport;
-
- sal_Int32 nCount = rContinuations.getLength();
- for( sal_Int32 nStep=0; nStep<nCount; ++nStep )
- {
- if( ! xAbort.is() )
- xAbort = star::uno::Reference< star::task::XInteractionAbort >(
- rContinuations[nStep], star::uno::UNO_QUERY );
-
- if( ! xFilterTransport.is() )
- xFilterTransport = star::uno::Reference<
- star::document::XInteractionFilterSelect >(
- rContinuations[nStep], star::uno::UNO_QUERY );
- }
-
- uui::FilterNameList lNames;
-
- if( m_xServiceFactory.is() == sal_True )
- {
- star::uno::Reference< star::container::XNameContainer >
- xFilterContainer( m_xServiceFactory->createInstance(
- ::rtl::OUString::createFromAscii(
- "com.sun.star.document.FilterFactory") ),
- star::uno::UNO_QUERY );
- if( xFilterContainer.is() == sal_True )
- {
- star::uno::Any aPackedSet ;
- star::uno::Sequence< star::beans::PropertyValue > lProps ;
- sal_Int32 nStep ;
- uui::FilterNamePair aPair ;
-
- try
- {
- aPackedSet
- = xFilterContainer->getByName( rRequest.SelectedFilter );
- }
- catch(const ::com::sun::star::container::NoSuchElementException&)
- {
- aPackedSet.clear();
- }
- aPackedSet >>= lProps;
- for( nStep=0; nStep<lProps.getLength(); ++nStep )
- {
- if( lProps[nStep].Name.compareToAscii("UIName") == 0 )
- {
- ::rtl::OUString sTemp;
- lProps[nStep].Value >>= sTemp;
- aPair.sUI = sTemp;
- aPair.sInternal = rRequest.SelectedFilter;
- lNames.push_back( aPair );
- break;
- }
- }
-
- try
- {
- aPackedSet
- = xFilterContainer->getByName( rRequest.DetectedFilter );
- }
- catch(const ::com::sun::star::container::NoSuchElementException&)
- {
- aPackedSet.clear();
- }
- aPackedSet >>= lProps;
- for( nStep=0; nStep<lProps.getLength(); ++nStep )
- {
- if( lProps[nStep].Name.compareToAscii("UIName") == 0 )
- {
- ::rtl::OUString sTemp;
- lProps[nStep].Value >>= sTemp;
- aPair.sUI = sTemp;
- aPair.sInternal = rRequest.DetectedFilter;
- lNames.push_back( aPair );
- break;
- }
- }
- }
- }
-
- if( xAbort.is() && xFilterTransport.is() )
- {
- if( lNames.size() < 1 )
- {
- xAbort->select();
- }
- else
- {
- rtl::OUString sFilter;
- executeFilterDialog( rRequest.URL, lNames, sFilter );
-
- if( sFilter.getLength() > 0 )
- {
- xFilterTransport->setFilter( sFilter );
- xFilterTransport->select();
- }
- else
- xAbort->select();
- }
- }
-}
-
-void
UUIInteractionHelper::handleGenericErrorRequest(
sal_Int32 nErrorCode,
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const & rContinuations,
+ uno::Sequence< uno::Reference<
+ task::XInteractionContinuation > > const & rContinuations,
bool bObtainErrorStringOnly,
bool & bHasErrorString,
rtl::OUString & rErrorString)
- SAL_THROW((star::uno::RuntimeException))
+ SAL_THROW((uno::RuntimeException))
{
if (bObtainErrorStringOnly)
{
bHasErrorString = isInformationalErrorMessageRequest(rContinuations);
if (bHasErrorString)
- {
- String aErrorString;
- ErrorHandler::GetErrorString(nErrorCode, aErrorString);
- rErrorString = aErrorString;
- }
+ {
+ String aErrorString;
+ ErrorHandler::GetErrorString(nErrorCode, aErrorString);
+ rErrorString = aErrorString;
+ }
}
else
{
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
- star::uno::Reference< star::task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< task::XInteractionApprove > xApprove;
+ getContinuations(rContinuations, &xApprove, &xAbort);
- sal_Int32 nCount = rContinuations.getLength();
- for( sal_Int32 nStep=0; nStep<nCount; ++nStep )
- {
- if( ! xAbort.is() )
- xAbort
- = star::uno::Reference< star::task::XInteractionAbort >(
- rContinuations[nStep], star::uno::UNO_QUERY );
-
- if( ! xApprove.is() )
- xApprove
- = star::uno::Reference< star::task::XInteractionApprove >(
- rContinuations[nStep], star::uno::UNO_QUERY );
- }
+ // Note: It's important to convert the transported long to the
+ // required unsigned long value. Otherwhise using as flag field
+ // can fail ...
+ ErrCode nError = static_cast< ErrCode >(nErrorCode);
+ sal_Bool bWarning = !ERRCODE_TOERROR(nError);
- // Note: It's important to convert the transported long to the
- // required unsigned long value. Otherwhise using as flag field
- // can fail ...
- ErrCode nError = (ErrCode)nErrorCode;
- sal_Bool bWarning = !ERRCODE_TOERROR(nError);
-
- if ( nError == ERRCODE_SFX_BROKENSIGNATURE
- || nError == ERRCODE_SFX_INCOMPLETE_ENCRYPTION )
- {
- // the security warning need a special title
- String aErrorString;
- ErrorHandler::GetErrorString( nErrorCode, aErrorString );
-
- std::auto_ptr< ResMgr >
- xManager( ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) );
- ::rtl::OUString aTitle;
-
- try
+ if ( nError == ERRCODE_SFX_BROKENSIGNATURE
+ || nError == ERRCODE_SFX_INCOMPLETE_ENCRYPTION )
{
- star::uno::Any aProductNameAny =
- ::utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty(
- ::utl::ConfigManager::PRODUCTNAME );
- aProductNameAny >>= aTitle;
- } catch( star::uno::Exception& )
- {}
+ // the security warning box needs a special title
+ String aErrorString;
+ ErrorHandler::GetErrorString( nErrorCode, aErrorString );
- ::rtl::OUString aErrTitle = String( ResId( nError == ERRCODE_SFX_BROKENSIGNATURE ? STR_WARNING_BROKENSIGNATURE_TITLE : STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE, *xManager.get() ) );
+ std::auto_ptr< ResMgr > xManager(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) );
+ ::rtl::OUString aTitle;
- if ( aTitle.getLength() && aErrTitle.getLength() )
- aTitle += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " - " ) );
- aTitle += aErrTitle;
+ try
+ {
+ uno::Any aProductNameAny =
+ ::utl::ConfigManager::GetConfigManager()
+ ->GetDirectConfigProperty(
+ ::utl::ConfigManager::PRODUCTNAME );
+ aProductNameAny >>= aTitle;
+ }
+ catch( uno::Exception& )
+ {
+ }
- executeMessageBox( aTitle, aErrorString, WB_OK );
- }
- else
- ErrorHandler::HandleError(nErrorCode);
+ ::rtl::OUString aErrTitle
+ = String( ResId( nError == ERRCODE_SFX_BROKENSIGNATURE
+ ? STR_WARNING_BROKENSIGNATURE_TITLE
+ : STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE,
+ *xManager.get() ) );
- if (xApprove.is() && bWarning)
- xApprove->select();
- else if (xAbort.is())
- xAbort->select();
- }
-}
+ if ( aTitle.getLength() && aErrTitle.getLength() )
+ aTitle += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " - " ) );
+ aTitle += aErrTitle;
-namespace
-{
- template< class INTERACTION_TYPE >
- bool lcl_findContinuation( const Sequence< Reference< XInteractionContinuation > >& _rContinuations,
- Reference< INTERACTION_TYPE >& _rContinuation )
- {
- const Reference< XInteractionContinuation >* pContinuation = _rContinuations.getConstArray();
- const Reference< XInteractionContinuation >* pContinuationEnd = _rContinuations.getConstArray() + _rContinuations.getLength();
- while ( pContinuation != pContinuationEnd )
- {
- if ( _rContinuation.set( *pContinuation++, UNO_QUERY ) )
- return true;
+ executeMessageBox(
+ getParentProperty(), aTitle, aErrorString, WB_OK );
}
- return false;
+ else
+ ErrorHandler::HandleError(nErrorCode);
+
+ if (xApprove.is() && bWarning)
+ xApprove->select();
+ else if (xAbort.is())
+ xAbort->select();
}
}
void
UUIInteractionHelper::handleMacroConfirmRequest(
const ::rtl::OUString& aDocumentURL,
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xZipStorage,
+ const uno::Reference< embed::XStorage >& xZipStorage,
const ::rtl::OUString& aDocumentVersion,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation > aSignInfo,
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const & rContinuations
-)
- SAL_THROW((star::uno::RuntimeException))
+ const uno::Sequence< security::DocumentSignatureInformation > aSignInfo,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations )
+ SAL_THROW((uno::RuntimeException))
{
- Reference< XInteractionAbort > xAbort; lcl_findContinuation( rContinuations, xAbort );
- Reference< XInteractionApprove > xApprove; lcl_findContinuation( rContinuations, xApprove );
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< task::XInteractionApprove > xApprove;
+ getContinuations( rContinuations, &xApprove, &xAbort );
bool bApprove = false;
- std::auto_ptr< ResMgr > pResMgr( ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) );
+ std::auto_ptr< ResMgr > pResMgr(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) );
if ( pResMgr.get() )
{
bool bShowSignatures = aSignInfo.getLength() > 0;
- MacroWarning aWarning( getParentProperty(), bShowSignatures, *pResMgr.get() );
+ MacroWarning aWarning(
+ getParentProperty(), bShowSignatures, *pResMgr.get() );
aWarning.SetDocumentURL( aDocumentURL );
if ( aSignInfo.getLength() > 1 )
@@ -3342,372 +1323,100 @@ UUIInteractionHelper::handleMacroConfirmRequest(
void
UUIInteractionHelper::handleFutureDocumentVersionUpdateRequest(
- const FutureDocumentVersionProductUpdateRequest& _rRequest,
- Sequence< Reference< XInteractionContinuation > > const & rContinuations
-)
- SAL_THROW((star::uno::RuntimeException))
+ const task::FutureDocumentVersionProductUpdateRequest& _rRequest,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations )
+ SAL_THROW((uno::RuntimeException))
{
- Reference< XInteractionAbort > xAbort; lcl_findContinuation( rContinuations, xAbort );
- Reference< XInteractionApprove > xApprove; lcl_findContinuation( rContinuations, xApprove );
- Reference< XInteractionApprove > xAskLater; lcl_findContinuation( rContinuations, xAskLater );
+ uno::Reference< task::XInteractionAbort > xAbort;
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionAskLater > xAskLater;
+ getContinuations( rContinuations, &xApprove, &xAbort, &xAskLater );
short nResult = RET_CANCEL;
static bool s_bDeferredToNextSession = false;
- // TODO: this static variable is somewhat hacky. Formerly (before the dialog was moved from SFX2 to the
- // interaction handler implementation), this was stored in SFX_APP()'s impl structure, in member
- // bODFVersionWarningLater. Of course, we do not have access to it here.
- //
- // A proper solution which I would envision would be:
- // - There's a central implementation (this one here) of css.task.InteractionHandler
- // - There's a configuration which maps UNO names to service names
- // - If the handler is confronted with a request, it tries to find the name of the UNO structure describing
- // the request in the said configuration.
- // - If an entry is found, then
- // - the respective service is instantiated
- // - the component is queried for css.task.XInteractionHandler, and the request is delegated
- // - if no entry is found, then the request is silenced (with calling the AbortContinuation, if possible)
- // This way, the FutureDocumentVersionProductUpdateRequest could be handled in SFX (or any other
- // suitable place), again, and we would only have one place where we remember the s_bDeferredToNextSession
- // flag.
- //
- // The side effect (well, actually the more important effect) would be that we do not need to burden
- // this central implementation with all interactions which are possible. Instead, separate parts of OOo
- // can define/implement different requests. (for instance, everything which today is done in the
- // css.sdb.InteractionHandler can then be routed through a "normal" interaction handler, where today we
- // always need to tell people to instantiate the SDB-version of the handler, not the normal one.)
+ // TODO: this static variable is somewhat hacky. Formerly (before the dialog was moved from SFX2 to the
+ // interaction handler implementation), this was stored in SFX_APP()'s impl structure, in member
+ // bODFVersionWarningLater. Of course, we do not have access to it here.
+ //
+ // A proper solution which I would envision would be:
+ // - There's a central implementation (this one here) of css.task.InteractionHandler
+ // - There's a configuration which maps UNO names to service names
+ // - If the handler is confronted with a request, it tries to find the name of the UNO structure describing
+ // the request in the said configuration.
+ // - If an entry is found, then
+ // - the respective service is instantiated
+ // - the component is queried for css.task.XInteractionHandler, and the request is delegated
+ // - if no entry is found, then the request is silenced (with calling the AbortContinuation, if possible)
+ // This way, the FutureDocumentVersionProductUpdateRequest could be handled in SFX (or any other
+ // suitable place), again, and we would only have one place where we remember the s_bDeferredToNextSession
+ // flag.
+ //
+ // The side effect (well, actually the more important effect) would be that we do not need to burden
+ // this central implementation with all interactions which are possible. Instead, separate parts of OOo
+ // can define/implement different requests. (for instance, everything which today is done in the
+ // css.sdb.InteractionHandler can then be routed through a "normal" interaction handler, where today we
+ // always need to tell people to instantiate the SDB-version of the handler, not the normal one.)
if ( !s_bDeferredToNextSession )
{
- std::auto_ptr< ResMgr > pResMgr( ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) );
+ std::auto_ptr< ResMgr > pResMgr(
+ ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) );
if ( pResMgr.get() )
{
- ::uui::NewerVersionWarningDialog aDialog( getParentProperty(), _rRequest.DocumentODFVersion, *pResMgr.get() );
+ ::uui::NewerVersionWarningDialog aDialog(
+ getParentProperty(),
+ _rRequest.DocumentODFVersion,
+ *pResMgr.get() );
nResult = aDialog.Execute();
}
}
switch ( nResult )
{
- case RET_OK: if ( xApprove.is() ) xApprove->select(); break;
- case RET_CANCEL: if ( xAbort.is() ) xAbort->select(); break;
- case RET_ASK_LATER: if ( xAskLater.is() ) xAskLater->select(); s_bDeferredToNextSession = true; break;
+ case RET_OK:
+ if ( xApprove.is() )
+ xApprove->select();
+ break;
+ case RET_CANCEL:
+ if ( xAbort.is() )
+ xAbort->select();
+ break;
+ case RET_ASK_LATER:
+ if ( xAskLater.is() )
+ xAskLater->select();
+ s_bDeferredToNextSession = true;
+ break;
default:
- OSL_ENSURE( false, "UUIInteractionHelper::handleFutureDocumentVersionUpdateRequest: unexpected dialog return value!" );
+ OSL_ENSURE( false,
+ "UUIInteractionHelper::handleFutureDocumentVersionUpdateRequest: "
+ "unexpected dialog return value!" );
break;
}
}
void
-UUIInteractionHelper::handleFilterOptionsRequest(
- star::document::FilterOptionsRequest const & rRequest,
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const & rContinuations)
- SAL_THROW((com::sun::star::uno::RuntimeException))
-{
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
- star::uno::Reference<
- star::document::XInteractionFilterOptions > xFilterOptions;
-
- sal_Int32 nCount = rContinuations.getLength();
- for( sal_Int32 nStep=0; nStep<nCount; ++nStep )
- {
- if( ! xAbort.is() )
- xAbort = star::uno::Reference< star::task::XInteractionAbort >(
- rContinuations[nStep], star::uno::UNO_QUERY );
-
- if( ! xFilterOptions.is() )
- xFilterOptions = star::uno::Reference<
- star::document::XInteractionFilterOptions >(
- rContinuations[nStep], star::uno::UNO_QUERY );
- }
-
- star::uno::Reference< star::container::XNameAccess > xFilterCFG;
- if( m_xServiceFactory.is() )
- {
- xFilterCFG = star::uno::Reference< star::container::XNameAccess >(
- m_xServiceFactory->createInstance(
- ::rtl::OUString::createFromAscii(
- "com.sun.star.document.FilterFactory" ) ),
- star::uno::UNO_QUERY );
- }
-
- if( xFilterCFG.is() && rRequest.rProperties.getLength() )
- {
- try {
- ::rtl::OUString aFilterName;
- sal_Int32 nPropCount = rRequest.rProperties.getLength();
- for( sal_Int32 ind = 0; ind < nPropCount; ++ind )
- {
- rtl::OUString tmp = rRequest.rProperties[ind].Name;
- if( rRequest.rProperties[ind].Name.equals(
- ::rtl::OUString::createFromAscii("FilterName")) )
- {
- rRequest.rProperties[ind].Value >>= aFilterName;
- break;
- }
- }
-
- star::uno::Sequence < star::beans::PropertyValue > aProps;
- if ( xFilterCFG->getByName( aFilterName ) >>= aProps )
- {
- sal_Int32 nPropertyCount = aProps.getLength();
- for( sal_Int32 nProperty=0;
- nProperty < nPropertyCount;
- ++nProperty )
- if( aProps[nProperty].Name.equals(
- ::rtl::OUString::createFromAscii("UIComponent")) )
- {
- ::rtl::OUString aServiceName;
- aProps[nProperty].Value >>= aServiceName;
- if( aServiceName.getLength() )
- {
- star::uno::Reference<
- star::ui::dialogs::XExecutableDialog >
- xFilterDialog(
- m_xServiceFactory->createInstance(
- aServiceName ),
- star::uno::UNO_QUERY );
- star::uno::Reference<
- star::beans::XPropertyAccess >
- xFilterProperties(
- xFilterDialog,
- star::uno::UNO_QUERY );
-
- if( xFilterDialog.is() && xFilterProperties.is() )
- {
- star::uno::Reference<
- star::document::XImporter > xImporter(
- xFilterDialog,
- star::uno::UNO_QUERY );
- if( xImporter.is() )
- xImporter->setTargetDocument(
- star::uno::Reference<
- star::lang::XComponent >(
- rRequest.rModel,
- star::uno::UNO_QUERY ) );
-
- xFilterProperties->setPropertyValues(
- rRequest.rProperties );
-
- if( xFilterDialog->execute() )
- {
- xFilterOptions->setFilterOptions(
- xFilterProperties
- ->getPropertyValues() );
- xFilterOptions->select();
- return;
-
- }
- }
- }
- break;
- }
- }
- }
- catch( star::container::NoSuchElementException& )
- {
- // the filter name is unknown
- }
- catch( star::uno::Exception& )
- {
- }
- }
-
- xAbort->select();
-}
-
-void
-UUIInteractionHelper::handleErrorRequest(
- star::task::InteractionClassification eClassification,
- ErrCode nErrorCode,
+UUIInteractionHelper::handleBrokenPackageRequest(
std::vector< rtl::OUString > const & rArguments,
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const & rContinuations,
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > const &
+ rContinuations,
bool bObtainErrorStringOnly,
bool & bHasErrorString,
rtl::OUString & rErrorString)
- SAL_THROW((star::uno::RuntimeException))
+ SAL_THROW((uno::RuntimeException))
{
- rtl::OUString aMessage;
- {
- enum Source { SOURCE_DEFAULT, SOURCE_CNT, SOURCE_SVX, SOURCE_UUI };
- static char const * const aManager[4]
- = { CREATEVERSIONRESMGR_NAME(ofa),
- CREATEVERSIONRESMGR_NAME(cnt),
- CREATEVERSIONRESMGR_NAME(svx),
- CREATEVERSIONRESMGR_NAME(uui) };
- static USHORT const aId[4]
- = { RID_ERRHDL,
- RID_CHAOS_START + 12,
- // cf. chaos/source/inc/cntrids.hrc, where
- // #define RID_CHAOS_ERRHDL (RID_CHAOS_START + 12)
- RID_SVX_START + 350, // RID_SVXERRCODE
- RID_UUI_ERRHDL };
- ErrCode nErrorId = nErrorCode & ~ERRCODE_WARNING_MASK;
- Source eSource = nErrorId < ERRCODE_AREA_LIB1 ?
- SOURCE_DEFAULT :
- nErrorId >= ERRCODE_AREA_CHAOS
- && nErrorId < ERRCODE_AREA_CHAOS_END ?
- SOURCE_CNT :
- nErrorId >= ERRCODE_AREA_SVX
- && nErrorId <= ERRCODE_AREA_SVX_END ?
- SOURCE_SVX :
- SOURCE_UUI;
-
- vos::OGuard aGuard(Application::GetSolarMutex());
- std::auto_ptr< ResMgr > xManager;
- xManager.reset(ResMgr::CreateResMgr(aManager[eSource]));
- if (!xManager.get())
- return;
- ResId aResId(aId[eSource], *xManager.get());
- if (!ErrorResource(aResId). getString(nErrorCode, &aMessage))
- return;
- }
-
- aMessage = replaceMessageWithArguments( aMessage, rArguments );
-
if (bObtainErrorStringOnly)
{
bHasErrorString = isInformationalErrorMessageRequest(rContinuations);
- if (bHasErrorString)
- rErrorString = aMessage;
- return;
- }
- else
- {
- //TODO! It can happen that the buttons calculated below do not match
- // the error text from the resource (e.g., some text that is not a
- // question, but YES and NO buttons). Some error texts have
- // ExtraData that specifies a set of buttons, but that data is not
- // really useful, because a single error text may well make sense
- // both with only an OK button and with RETRY and CANCEL buttons.
-
- star::uno::Reference< star::task::XInteractionApprove > xApprove;
- star::uno::Reference< star::task::XInteractionDisapprove > xDisapprove;
- star::uno::Reference< star::task::XInteractionRetry > xRetry;
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
- getContinuations(
- rContinuations,
- &xApprove, &xDisapprove, &xRetry, &xAbort, 0, 0, 0, 0, 0);
-
- // The following mapping uses the bit mask
- // Approve = 8,
- // Disapprove = 4,
- // Retry = 2,
- // Abort = 1
- //
- // The mapping has five properties on which the code to select the
- // correct continuation relies:
- // 1 The OK button is mapped to Approve if that is available,
- // otherwise to Abort if that is available, otherwise to none.
- // 2 The CANCEL button is always mapped to Abort.
- // 3 The RETRY button is always mapped to Retry.
- // 4 The NO button is always mapped to Disapprove.
- // 5 The YES button is always mapped to Approve.
- //
- // Because the WinBits button combinations are quite restricted, not
- // every request can be served here.
- //
- // Finally, it seems to be better to leave default button
- // determination to VCL (the favouring of CANCEL as default button
- // seems to not always be what the user wants)...
- WinBits const aButtonMask[16]
- = { 0,
- WB_OK /*| WB_DEF_OK*/, // Abort
- 0,
- WB_RETRY_CANCEL /*| WB_DEF_CANCEL*/, // Retry, Abort
- 0,
- 0,
- 0,
- 0,
- WB_OK /*| WB_DEF_OK*/, // Approve
- WB_OK_CANCEL /*| WB_DEF_CANCEL*/, // Approve, Abort
- 0,
- 0,
- WB_YES_NO /*| WB_DEF_NO*/, // Approve, Disapprove
- WB_YES_NO_CANCEL /*| WB_DEF_CANCEL*/,
- // Approve, Disapprove, Abort
- 0,
- 0 };
-
- WinBits nButtonMask = aButtonMask[(xApprove.is() ? 8 : 0)
- | (xDisapprove.is() ? 4 : 0)
- | (xRetry.is() ? 2 : 0)
- | (xAbort.is() ? 1 : 0)];
- if (nButtonMask == 0)
+ if (!bHasErrorString)
return;
-
- //TODO! remove this backwards compatibility?
- rtl::OUString aContext(getContextProperty());
- if (aContext.getLength() == 0 && nErrorCode != 0)
- {
- vos::OGuard aGuard(Application::GetSolarMutex());
- ErrorContext * pContext = ErrorContext::GetContext();
- if (pContext)
- {
- UniString aContextString;
- if (pContext->GetString(nErrorCode, aContextString))
- aContext = aContextString;
- }
- }
-
- USHORT nResult = executeErrorDialog(
- eClassification, aContext, aMessage, nButtonMask );
- switch (nResult)
- {
- case ERRCODE_BUTTON_OK:
- OSL_ENSURE(xApprove.is() || xAbort.is(), "unexpected situation");
- if (xApprove.is())
- xApprove->select();
- else if (xAbort.is())
- xAbort->select();
- break;
-
- case ERRCODE_BUTTON_CANCEL:
- OSL_ENSURE(xAbort.is(), "unexpected situation");
- if (xAbort.is())
- xAbort->select();
- break;
-
- case ERRCODE_BUTTON_RETRY:
- OSL_ENSURE(xRetry.is(), "unexpected situation");
- if (xRetry.is())
- xRetry->select();
- break;
-
- case ERRCODE_BUTTON_NO:
- OSL_ENSURE(xDisapprove.is(), "unexpected situation");
- if (xDisapprove.is())
- xDisapprove->select();
- break;
-
- case ERRCODE_BUTTON_YES:
- OSL_ENSURE(xApprove.is(), "unexpected situation");
- if (xApprove.is())
- xApprove->select();
- break;
- }
-
}
-}
-void
-UUIInteractionHelper::handleBrokenPackageRequest(
- std::vector< rtl::OUString > const & rArguments,
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const &
- rContinuations,
- bool bObtainErrorStringOnly,
- bool & bHasErrorString,
- rtl::OUString & rErrorString)
- SAL_THROW((star::uno::RuntimeException))
-{
- star::uno::Reference< star::task::XInteractionApprove > xApprove;
- star::uno::Reference< star::task::XInteractionDisapprove > xDisapprove;
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
- getContinuations(
- rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0, 0);
+ uno::Reference< task::XInteractionApprove > xApprove;
+ uno::Reference< task::XInteractionDisapprove > xDisapprove;
+ uno::Reference< task::XInteractionAbort > xAbort;
+ getContinuations(rContinuations, &xApprove, &xDisapprove, &xAbort);
ErrCode nErrorCode;
if( xApprove.is() && xDisapprove.is() )
@@ -3725,7 +1434,7 @@ UUIInteractionHelper::handleBrokenPackageRequest(
{
vos::OGuard aGuard(Application::GetSolarMutex());
std::auto_ptr< ResMgr > xManager(
- ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+ ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
if (!xManager.get())
return;
@@ -3738,226 +1447,81 @@ UUIInteractionHelper::handleBrokenPackageRequest(
if (bObtainErrorStringOnly)
{
- bHasErrorString = isInformationalErrorMessageRequest(rContinuations);
- if (bHasErrorString)
- rErrorString = aMessage;
+ rErrorString = aMessage;
return;
}
- else
- {
- WinBits nButtonMask;
- if( xApprove.is() && xDisapprove.is() )
- {
- nButtonMask = WB_YES_NO | WB_DEF_YES;
- }
- else if ( xAbort.is() )
- {
- nButtonMask = WB_OK;
- }
- else
- return;
-
- star::uno::Any aProductNameAny =
- ::utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty(
- ::utl::ConfigManager::PRODUCTNAME );
- star::uno::Any aProductVersionAny =
- ::utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty(
- ::utl::ConfigManager::PRODUCTVERSION );
- ::rtl::OUString aProductName, aProductVersion;
- if ( !( aProductNameAny >>= aProductName ) )
- aProductName
- = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice") );
-
- ::rtl::OUString aTitle( aProductName );
- if( aProductVersionAny >>= aProductVersion )
- {
- aTitle += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" ") );
- aTitle += aProductVersion;
- }
-
- switch ( executeMessageBox( aTitle, aMessage, nButtonMask ))
- {
- case ERRCODE_BUTTON_OK:
- OSL_ENSURE( xAbort.is(), "unexpected situation" );
- if (xAbort.is())
- xAbort->select();
- break;
-
- case ERRCODE_BUTTON_NO:
- OSL_ENSURE(xDisapprove.is(), "unexpected situation");
- if (xDisapprove.is())
- xDisapprove->select();
- break;
-
- case ERRCODE_BUTTON_YES:
- OSL_ENSURE(xApprove.is(), "unexpected situation");
- if (xApprove.is())
- xApprove->select();
- break;
- }
- }
-}
-void
-UUIInteractionHelper::handleLockedDocumentRequest(
- const ::rtl::OUString& aDocumentURL,
- const ::rtl::OUString& aInfo,
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const &
- rContinuations,
- sal_uInt16 nMode )
- SAL_THROW((star::uno::RuntimeException))
-{
- star::uno::Reference< star::task::XInteractionApprove > xApprove;
- star::uno::Reference< star::task::XInteractionDisapprove > xDisapprove;
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
- getContinuations(
- rContinuations, &xApprove, &xDisapprove, 0, &xAbort, 0, 0, 0, 0, 0);
-
- if ( !xApprove.is() || !xDisapprove.is() || !xAbort.is() )
- return;
-
- try
+ WinBits nButtonMask;
+ if( xApprove.is() && xDisapprove.is() )
{
- vos::OGuard aGuard(Application::GetSolarMutex());
- std::auto_ptr< ResMgr > xManager(
- ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
- if (!xManager.get())
- return;
-
- ::rtl::OUString aMessage;
- std::vector< rtl::OUString > aArguments;
- aArguments.push_back( aDocumentURL );
-
- sal_Int32 nResult = RET_CANCEL;
- if ( nMode == UUI_DOC_LOAD_LOCK )
- {
- aArguments.push_back( aInfo.getLength()
- ? aInfo
- : ::rtl::OUString( String( ResId( STR_UNKNOWNUSER, *xManager.get() ) ) ) );
- aMessage = String( ResId( STR_OPENLOCKED_MSG, *xManager.get() ) );
- aMessage = replaceMessageWithArguments( aMessage, aArguments );
-
- std::auto_ptr< OpenLockedQueryBox > xDialog(new OpenLockedQueryBox(
- getParentProperty(), xManager.get(), aMessage ) );
- nResult = xDialog->Execute();
- }
- else if ( nMode == UUI_DOC_SAVE_LOCK )
- {
- aArguments.push_back( aInfo.getLength()
- ? aInfo
- : ::rtl::OUString( String( ResId( STR_UNKNOWNUSER, *xManager.get() ) ) ) );
- aMessage = String( ResId( STR_TRYLATER_MSG, *xManager.get() ) );
- aMessage = replaceMessageWithArguments( aMessage, aArguments );
-
- std::auto_ptr< TryLaterQueryBox > xDialog(new TryLaterQueryBox(
- getParentProperty(), xManager.get(), aMessage ) );
- nResult = xDialog->Execute();
- }
- else if ( nMode == UUI_DOC_OWN_LOAD_LOCK || nMode == UUI_DOC_OWN_SAVE_LOCK )
- {
- aArguments.push_back( aInfo );
- aMessage = String( ResId( nMode == UUI_DOC_OWN_SAVE_LOCK ? STR_ALREADYOPEN_SAVE_MSG : STR_ALREADYOPEN_MSG, *xManager.get() ) );
- aMessage = replaceMessageWithArguments( aMessage, aArguments );
-
- std::auto_ptr< AlreadyOpenQueryBox > xDialog(new AlreadyOpenQueryBox(
- getParentProperty(), xManager.get(), aMessage, nMode == UUI_DOC_OWN_SAVE_LOCK ) );
- nResult = xDialog->Execute();
- }
-
- if ( nResult == RET_YES )
- xApprove->select();
- else if ( nResult == RET_NO )
- xDisapprove->select();
- else
- xAbort->select();
+ nButtonMask = WB_YES_NO | WB_DEF_YES;
}
- catch (std::bad_alloc const &)
+ else if ( xAbort.is() )
{
- throw star::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
- star::uno::Reference< star::uno::XInterface >());
+ nButtonMask = WB_OK;
}
-}
-
-void
-UUIInteractionHelper::handleChangedByOthersRequest(
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const &
- rContinuations )
- SAL_THROW((star::uno::RuntimeException))
-{
- star::uno::Reference< star::task::XInteractionApprove > xApprove;
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
- getContinuations(
- rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0, 0);
-
- if ( !xApprove.is() || !xAbort.is() )
+ else
return;
- try
- {
- vos::OGuard aGuard(Application::GetSolarMutex());
- std::auto_ptr< ResMgr > xManager(
- ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
- if (!xManager.get())
- return;
-
- std::auto_ptr< FileChangedQueryBox > xDialog(new FileChangedQueryBox(
- getParentProperty(), xManager.get() ) );
- sal_Int32 nResult = xDialog->Execute();
+ uno::Any aProductNameAny =
+ ::utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty(
+ ::utl::ConfigManager::PRODUCTNAME );
+ uno::Any aProductVersionAny =
+ ::utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty(
+ ::utl::ConfigManager::PRODUCTVERSION );
+ ::rtl::OUString aProductName, aProductVersion;
+ if ( !( aProductNameAny >>= aProductName ) )
+ aProductName
+ = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StarOffice") );
- if ( nResult == RET_YES )
- xApprove->select();
- else
- xAbort->select();
- }
- catch (std::bad_alloc const &)
+ ::rtl::OUString aTitle( aProductName );
+ if( aProductVersionAny >>= aProductVersion )
{
- throw star::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
- star::uno::Reference< star::uno::XInterface >());
+ aTitle += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" ") );
+ aTitle += aProductVersion;
}
-}
-
-void
-UUIInteractionHelper::handleLockFileIgnoreRequest(
- star::uno::Sequence< star::uno::Reference<
- star::task::XInteractionContinuation > > const &
- rContinuations )
- SAL_THROW((star::uno::RuntimeException))
-{
- star::uno::Reference< star::task::XInteractionApprove > xApprove;
- star::uno::Reference< star::task::XInteractionAbort > xAbort;
- getContinuations(
- rContinuations, &xApprove, 0, 0, &xAbort, 0, 0, 0, 0, 0);
-
- if ( !xApprove.is() || !xAbort.is() )
- return;
- try
+ switch ( executeMessageBox( getParentProperty(),
+ aTitle,
+ aMessage,
+ nButtonMask ))
{
- vos::OGuard aGuard(Application::GetSolarMutex());
- std::auto_ptr< ResMgr > xManager(
- ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
- if (!xManager.get())
- return;
+ case ERRCODE_BUTTON_OK:
+ OSL_ENSURE( xAbort.is(), "unexpected situation" );
+ if (xAbort.is())
+ xAbort->select();
+ break;
- std::auto_ptr< LockFailedQueryBox > xDialog(new LockFailedQueryBox(
- getParentProperty(), xManager.get() ) );
- sal_Int32 nResult = xDialog->Execute();
+ case ERRCODE_BUTTON_NO:
+ OSL_ENSURE(xDisapprove.is(), "unexpected situation");
+ if (xDisapprove.is())
+ xDisapprove->select();
+ break;
- if ( nResult == RET_OK )
+ case ERRCODE_BUTTON_YES:
+ OSL_ENSURE(xApprove.is(), "unexpected situation");
+ if (xApprove.is())
xApprove->select();
- else
- xAbort->select();
- }
- catch (std::bad_alloc const &)
- {
- throw star::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
- star::uno::Reference< star::uno::XInterface >());
+ break;
}
}
+//=========================================================================
+// ErrorResource Implementation
+//=========================================================================
+bool
+ErrorResource::getString(ErrCode nErrorCode, rtl::OUString * pString)
+ const SAL_THROW(())
+{
+ OSL_ENSURE(pString, "specification violation");
+ ResId aResId(static_cast< USHORT >(nErrorCode & ERRCODE_RES_MASK),
+ *m_pResMgr);
+ aResId.SetRT(RSC_STRING);
+ if (!IsAvailableRes(aResId))
+ return false;
+ aResId.SetAutoRelease(false);
+ *pString = UniString(aResId);
+ m_pResMgr->PopContext();
+ return true;
+}
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
index 177273a032..c479bc95c5 100644
--- a/uui/source/iahndl.hxx
+++ b/uui/source/iahndl.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -31,419 +31,335 @@
#ifndef UUI_IAHNDL_HXX
#define UUI_IAHNDL_HXX
-#ifndef INCLUDED_VECTOR
#include <vector>
-#define INCLUDED_VECTOR
-#endif
+
#include "osl/mutex.hxx"
+#include "rtl/ustring.hxx"
+
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/beans/Optional.hpp"
-#include "com/sun/star/embed/XStorage.hpp"
#include "com/sun/star/task/InteractionClassification.hpp"
-#include "com/sun/star/task/PasswordRequestMode.hpp"
-#include "com/sun/star/task/FutureDocumentVersionProductUpdateRequest.hpp"
-#include "com/sun/star/security/DocumentSignatureInformation.hpp"
-#include "tools/solar.h"
-#include "tools/errcode.hxx"
-#include "vcl/wintypes.hxx"
-#include "fltdlg.hxx"
-#include <com/sun/star/security/XCertificate.hpp>
-#ifndef _COM_SUN_STAR_XML_CRYPTO_XXSECURITYENVIRONMENT_HPP_
-#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
-#endif
-class Window;
-class LoginErrorInfo;
-struct CntHTTPCookieRequest;
+#include "tools/solar.h" // USHORT
+#include "tools/errcode.hxx" // ErrCode
+#include "tools/rc.hxx" // Resource
+#include "vcl/wintypes.hxx" // WinBits
-#define DESCRIPTION_1 1
-#define DESCRIPTION_2 2
-#define TITLE 3
+namespace com { namespace sun { namespace star {
+ namespace awt {
+ class XWindow;
+ }
+ namespace embed {
+ class XStorage;
+ }
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+ namespace security {
+ class DocumentSignatureInformation;
+ }
+ namespace task {
+ class FutureDocumentVersionProductUpdateRequest;
+ class XInteractionContinuation;
+ class XInteractionHandler;
+ class XInteractionRequest;
+ }
+ namespace ucb {
+ class NameClashResolveRequest;
+ }
+} } }
-#define UUI_DOC_LOAD_LOCK 0
-#define UUI_DOC_OWN_LOAD_LOCK 1
-#define UUI_DOC_SAVE_LOCK 2
-#define UUI_DOC_OWN_SAVE_LOCK 3
+class Window;
//============================================================================
-/** Information about a InteractionHandler
- */
struct InteractionHandlerData
{
/** The UNO service name to use to instanciate the content provider.
*/
rtl::OUString ServiceName;
-
+
InteractionHandlerData() {};
- InteractionHandlerData( const rtl::OUString & rService)
+ InteractionHandlerData(const rtl::OUString & rService)
: ServiceName( rService ){}
};
typedef std::vector< InteractionHandlerData > InteractionHandlerDataList;
-namespace cssu = com::sun::star::uno;
-namespace dcss = ::com::sun::star;
-
-namespace com { namespace sun { namespace star {
- namespace document {
- class AmbigousFilterRequest;
- class FilterOptionsRequest;
- class NoSuchFilterRequest;
- }
- namespace lang {
- class XMultiServiceFactory;
- }
- namespace task {
- class XInteractionContinuation;
- class XInteractionHandler;
- class XInteractionRequest;
- class XPasswordContainer;
- class XUrlContainer;
- }
- namespace ucb {
- class AuthenticationRequest;
- class HandleCookiesRequest;
- class NameClashResolveRequest;
- class CertificateValidationRequest;
- }
- namespace uno {
- class RuntimeException;
- }
-} } }
-
+//============================================================================
class UUIInteractionHelper
{
private:
osl::Mutex m_aPropertyMutex;
com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory >
- m_xServiceFactory;
+ com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_aProperties;
UUIInteractionHelper(UUIInteractionHelper &); // not implemented
void operator =(UUIInteractionHelper); // not implemented
-
+
public:
- UUIInteractionHelper(com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory >
- const & rServiceFactory,
- com::sun::star::uno::Sequence<
- com::sun::star::uno::Any > const & rArguments)
+ UUIInteractionHelper(
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const & rServiceFactory,
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Any > const & rArguments)
SAL_THROW(());
- UUIInteractionHelper(com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory >
- const & rServiceFactory)
+ UUIInteractionHelper(
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const & rServiceFactory)
SAL_THROW(());
~UUIInteractionHelper() SAL_THROW(());
bool
- handleRequest(com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionRequest > const &
- rRequest)
- throw (com::sun::star::uno::RuntimeException);
+ handleRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
com::sun::star::beans::Optional< rtl::OUString >
- getStringFromRequest(com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionRequest > const &
- rRequest)
- throw (com::sun::star::uno::RuntimeException);
+ getStringFromRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+ // Helper.
+ static ::rtl::OUString
+ replaceMessageWithArguments(
+ ::rtl::OUString aMessage,
+ std::vector< rtl::OUString > const & rArguments );
private:
bool
- handle_impl(com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionRequest > const &
- rRequest)
- throw (com::sun::star::uno::RuntimeException);
-
- void
- GetInteractionHandlerList(InteractionHandlerDataList &rdataList);
-
- sal_Bool
- isDomainMatch( rtl::OUString hostName, rtl::OUString certHostName);
- static long
- handlerequest(void* pHandleData, void* pInteractionHandler);
-
- com::sun::star::beans::Optional< rtl::OUString >
- getStringFromRequest_impl(com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionRequest > const &
- rRequest)
- throw (com::sun::star::uno::RuntimeException);
+ handleRequest_impl(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
- static long
- getstringfromrequest(void* pHandleData, void* pInteractionHandler);
-
- Window * getParentProperty() SAL_THROW(());
+ static long
+ handlerequest(void* pHandleData, void* pInteractionHandler);
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> getParentXWindow() SAL_THROW(());
+ com::sun::star::beans::Optional< rtl::OUString >
+ getStringFromRequest_impl(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
- rtl::OUString getContextProperty() SAL_THROW(());
+ static long
+ getstringfromrequest(void* pHandleData, void* pInteractionHandler);
- bool
- initPasswordContainer(com::sun::star::uno::Reference<
- com::sun::star::task::XPasswordContainer > *
- pContainer,
- com::sun::star::uno::Reference<
- com::sun::star::task::XUrlContainer > *
- pUrlContainer)
- const SAL_THROW(());
+ Window *
+ getParentProperty()
+ SAL_THROW(());
- com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >
- getInteractionHandler() const
- SAL_THROW((com::sun::star::uno::RuntimeException));
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>
+ getParentXWindow()
+ SAL_THROW(());
- void executeLoginDialog(LoginErrorInfo & rInfo,
- rtl::OUString const & rRealm)
- SAL_THROW((com::sun::star::uno::RuntimeException));
+ rtl::OUString
+ getContextProperty()
+ SAL_THROW(());
- void
- executeMasterPasswordDialog(LoginErrorInfo & rInfo,
- com::sun::star::task::PasswordRequestMode nMode)
+ com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >
+ getInteractionHandler()
SAL_THROW((com::sun::star::uno::RuntimeException));
- void
- executePasswordDialog(LoginErrorInfo & rInfo,
- com::sun::star::task::PasswordRequestMode nMode,
- ::rtl::OUString aDocumentName)
+ bool
+ tryOtherInteractionHandler(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
SAL_THROW((com::sun::star::uno::RuntimeException));
void
- executeMSPasswordDialog(LoginErrorInfo & rInfo,
- com::sun::star::task::PasswordRequestMode nMode,
- ::rtl::OUString aDocumentName)
- SAL_THROW((com::sun::star::uno::RuntimeException));
-
- void executeCookieDialog(CntHTTPCookieRequest & rRequest)
- SAL_THROW((com::sun::star::uno::RuntimeException));
-
- void executeFilterDialog(rtl::OUString const & rURL ,
- uui::FilterNameList const & rFilters,
- rtl::OUString & rFilter )
+ getInteractionHandlerList(InteractionHandlerDataList &rdataList)
SAL_THROW((com::sun::star::uno::RuntimeException));
- sal_Bool executeUnknownAuthDialog( const cssu::Reference< dcss::security::XCertificate >& rXCert )
- SAL_THROW((com::sun::star::uno::RuntimeException));
+ static bool
+ isInformationalErrorMessageRequest(
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations);
- sal_Bool executeSSLWarnDialog( const cssu::Reference< dcss::security::XCertificate >& rXCert,
- sal_Int32 const & failures,
- const rtl::OUString & hostName)
- SAL_THROW((com::sun::star::uno::RuntimeException));
-
- rtl::OUString
- getLocalizedDatTimeStr( ::com::sun::star::util::DateTime aDateTime );
-
- USHORT
- executeErrorDialog(com::sun::star::task::InteractionClassification
- eClassification,
- rtl::OUString const & rContext,
- rtl::OUString const & rMessage,
- WinBits nButtonMask )
- SAL_THROW((com::sun::star::uno::RuntimeException));
+ //=====================================================================
- USHORT
- executeMessageBox( rtl::OUString const & rTitle,
- rtl::OUString const & rMessage,
- WinBits nButtonMask )
+ bool
+ handleInteractiveIOException(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
SAL_THROW((com::sun::star::uno::RuntimeException));
- void
+ bool
handleAuthenticationRequest(
- com::sun::star::ucb::AuthenticationRequest const & rRequest,
- com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionContinuation > > const &
- rContinuations,
- rtl::OUString const & rURL)
+ com::sun::star::task::XInteractionRequest > const & rRequest)
SAL_THROW((com::sun::star::uno::RuntimeException));
- void
+ bool
handleCertificateValidationRequest(
- com::sun::star::ucb::CertificateValidationRequest const & rRequest,
- com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionContinuation > > const &
- rContinuations)
+ com::sun::star::task::XInteractionRequest > const & rRequest)
SAL_THROW((com::sun::star::uno::RuntimeException));
void
handleNameClashResolveRequest(
com::sun::star::ucb::NameClashResolveRequest const & rRequest,
- com::sun::star::uno::Sequence< com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionContinuation > > const &
- rContinuations)
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations)
SAL_THROW((com::sun::star::uno::RuntimeException));
- void
+ bool
handleMasterPasswordRequest(
- com::sun::star::task::PasswordRequestMode nMode,
- com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionContinuation > > const &
- rContinuations)
+ com::sun::star::task::XInteractionRequest > const & rRequest)
SAL_THROW((com::sun::star::uno::RuntimeException));
-
- void
+ bool
handlePasswordRequest(
- com::sun::star::task::PasswordRequestMode nMode,
- com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionContinuation > > const &
- rContinuations,
- ::rtl::OUString aDocumentName = ::rtl::OUString())
+ com::sun::star::task::XInteractionRequest > const & rRequest)
SAL_THROW((com::sun::star::uno::RuntimeException));
- void
- handleMSPasswordRequest(
- com::sun::star::task::PasswordRequestMode nMode,
- com::sun::star::uno::Sequence<
- com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionContinuation > > const &
- rContinuations,
- ::rtl::OUString aDocumentName = ::rtl::OUString())
- SAL_THROW((com::sun::star::uno::RuntimeException));
-
- void
+ bool
handleCookiesRequest(
- com::sun::star::ucb::HandleCookiesRequest const & rRequest,
- com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionContinuation > > const &
- rContinuations)
+ com::sun::star::task::XInteractionRequest > const & rRequest)
SAL_THROW((com::sun::star::uno::RuntimeException));
- void
+ bool
handleNoSuchFilterRequest(
- com::sun::star::document::NoSuchFilterRequest const & rRequest,
- com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionContinuation > > const &
- rContinuations)
+ com::sun::star::task::XInteractionRequest > const & rRequest)
SAL_THROW((com::sun::star::uno::RuntimeException));
- void
+ bool
handleAmbigousFilterRequest(
- com::sun::star::document::AmbigousFilterRequest const & rRequest,
- com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionContinuation > > const &
- rContinuations)
+ com::sun::star::task::XInteractionRequest > const & rRequest)
SAL_THROW((com::sun::star::uno::RuntimeException));
- void
+ bool
handleFilterOptionsRequest(
- com::sun::star::document::FilterOptionsRequest const & rRequest,
- com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionContinuation > > const &
- rContinuations)
+ com::sun::star::task::XInteractionRequest > const & rRequest)
SAL_THROW((com::sun::star::uno::RuntimeException));
void
- handleErrorRequest(
+ handleErrorHandlerRequest(
com::sun::star::task::InteractionClassification eClassification,
ErrCode nErrorCode,
std::vector< rtl::OUString > const & rArguments,
com::sun::star::uno::Sequence<
- com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionContinuation > > const &
- rContinuations,
- bool bObtainErrorStringOnly,
- bool & bHasErrorString,
- rtl::OUString & rErrorString)
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
SAL_THROW((com::sun::star::uno::RuntimeException));
-
+
void
handleGenericErrorRequest(
- sal_Int32 nErrorCode,
+ sal_Int32 nErrorCode,
com::sun::star::uno::Sequence<
- com::sun::star::uno::Reference<
- com::sun::star::task::XInteractionContinuation > > const &
- rContinuations,
- bool bObtainErrorStringOnly,
- bool & bHasErrorString,
- rtl::OUString & rErrorString)
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
SAL_THROW((com::sun::star::uno::RuntimeException));
void
handleMacroConfirmRequest(
const ::rtl::OUString& aDocumentURL,
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xZipStorage,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::embed::XStorage >& xZipStorage,
const ::rtl::OUString& aDocumentVersion,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation > aSignInfo,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::security::DocumentSignatureInformation >
+ aSignInfo,
com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
com::sun::star::task::XInteractionContinuation > > const &
- rContinuations
- )
+ rContinuations)
SAL_THROW((com::sun::star::uno::RuntimeException));
void
handleFutureDocumentVersionUpdateRequest(
- const ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest& _rRequest,
+ const ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest&
+ _rRequest,
com::sun::star::uno::Sequence<
com::sun::star::uno::Reference<
com::sun::star::task::XInteractionContinuation > > const &
- rContinuations
- )
+ rContinuations)
SAL_THROW((com::sun::star::uno::RuntimeException));
void
handleBrokenPackageRequest(
- std::vector< rtl::OUString > const & rArguments,
- ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Reference<
- ::com::sun::star::task::XInteractionContinuation > > const &
- rContinuations,
- bool bObtainErrorStringOnly,
- bool & bHasErrorString,
- rtl::OUString & rErrorString)
+ std::vector< rtl::OUString > const & rArguments,
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::task::XInteractionContinuation > > const &
+ rContinuations,
+ bool bObtainErrorStringOnly,
+ bool & bHasErrorString,
+ rtl::OUString & rErrorString)
SAL_THROW((::com::sun::star::uno::RuntimeException));
- bool handleMessageboxRequests(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::task::XInteractionRequest > const &
- rRequest,
- bool bObtainErrorStringOnly,
- bool & bHasErrorString,
- rtl::OUString & rErrorString);
-
- bool handleDialogRequests(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::task::XInteractionRequest > const &
- rRequest);
-
- bool handleErrorHandlerRequests(
- ::com::sun::star::uno::Reference<
- ::com::sun::star::task::XInteractionRequest > const &
- rRequest,
- bool bObtainErrorStringOnly,
- bool & bHasErrorString,
- rtl::OUString & rErrorString);
-
- void handleLockedDocumentRequest(
- const ::rtl::OUString& aDocumentURL,
- const ::rtl::OUString& aInfo,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
- ::com::sun::star::task::XInteractionContinuation > > const &
- rContinuations,
- sal_uInt16 nMode )
+ bool handleLockedDocumentRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
SAL_THROW((::com::sun::star::uno::RuntimeException));
- void handleChangedByOthersRequest(
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
- ::com::sun::star::task::XInteractionContinuation > > const &
- rContinuations )
+ bool handleChangedByOthersRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
SAL_THROW((::com::sun::star::uno::RuntimeException));
- void handleLockFileIgnoreRequest(
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
- ::com::sun::star::task::XInteractionContinuation > > const &
- rContinuations )
+ bool handleLockFileIgnoreRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
SAL_THROW((::com::sun::star::uno::RuntimeException));
+};
+
+class ErrorResource: private Resource
+{
+public:
+ inline ErrorResource(ResId & rResId) SAL_THROW(()): Resource(rResId) {}
+
+ inline ~ErrorResource() SAL_THROW(()) { FreeResource(); }
+
+ bool getString(ErrCode nErrorCode, rtl::OUString * pString) const
+ SAL_THROW(());
+};
+
+/*
+class InteractionRequest
+{
+public:
+ InteractionRequest(
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > const & rRequest)
+ : m_aRequest( rRequest ) {}
+
+ virtual bool toString( rtl::OUString & rString ) = 0;
+ virtual bool handle( rtl::OUString & rString ) = 0;
+private:
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionRequest > m_aRequest;
};
+*/
#endif // UUI_IAHNDL_HXX
diff --git a/uui/source/ids.hrc b/uui/source/ids.hrc
index de76cced22..36a246fdbc 100644
--- a/uui/source/ids.hrc
+++ b/uui/source/ids.hrc
@@ -149,6 +149,10 @@
#define ERRCODE_UUI_CONFIGURATION_BACKENDMISSING_WITHRECOVER (ERRCODE_AREA_UUI + 56)
#define ERRCODE_UUI_INVALID_XFORMS_SUBMISSION_DATA (ERRCODE_AREA_UUI + 57)
#define ERRCODE_UUI_IO_MODULESIZEEXCEEDED (ERRCODE_AREA_UUI + 58)
+#define ERRCODE_UUI_LOCKING_LOCKED (ERRCODE_AREA_UUI + 59)
+#define ERRCODE_UUI_LOCKING_LOCKED_SELF (ERRCODE_AREA_UUI + 60)
+#define ERRCODE_UUI_LOCKING_NOT_LOCKED (ERRCODE_AREA_UUI + 61)
+#define ERRCODE_UUI_LOCKING_LOCK_EXPIRED (ERRCODE_AREA_UUI + 62)
#define ERRCODE_AREA_UUI_UNKNOWNAUTH 25000
#define SSLWARN_TYPE_DOMAINMISMATCH 10
diff --git a/uui/source/ids.src b/uui/source/ids.src
index ddd422b01a..0d692a13fa 100644
--- a/uui/source/ids.src
+++ b/uui/source/ids.src
@@ -1,7 +1,8 @@
+
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -45,12 +46,12 @@ String RID_SAVE_PASSWORD
};
-String STR_WARNING_BROKENSIGNATURE_TITLE
+String STR_WARNING_BROKENSIGNATURE_TITLE
{
Text [ en-US ] = "Invalid Document Signature" ;
};
-String STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE
+String STR_WARNING_INCOMPLETE_ENCRYPTION_TITLE
{
Text [ en-US ] = "Non-Encrypted Streams" ;
};
@@ -350,22 +351,43 @@ Resource RID_UUI_ERRHDL
{
Text [ en-US ] = "The form contains invalid data. Do you still want to continue?";
};
-
+
+ String (ERRCODE_UUI_LOCKING_LOCKED & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The file $(ARG1) is locked by another user. Currently, another write access to this file cannot be granted.";
+
+ };
+
+ String (ERRCODE_UUI_LOCKING_LOCKED_SELF & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The file $(ARG1) is locked by yourself. Currently, another write access to this file cannot be granted.";
+ };
+
+ String (ERRCODE_UUI_LOCKING_NOT_LOCKED & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The file $(ARG1) is currently not locked by yourself.";
+ };
+
+ String (ERRCODE_UUI_LOCKING_LOCK_EXPIRED & ERRCODE_RES_MASK)
+ {
+ Text [ en-US ] = "The previously obtained lock for file $(ARG1) has expired.\nThis can happen due to problems on the server managing the file lock. It cannot be guaranteed that write operations on this file will not overwrite changes done by other users!";
+ };
+
STRING (ERRCODE_UUI_UNKNOWNAUTH_UNTRUSTED)
{
Text [ en-US ] = "Unable to verify the identity of $(ARG1) site.\n\nBefore accepting this certificate, you should examine this site's certificate carefully. Are you willing to accept this certificate for the purpose of identifying the Web site $(ARG1)?";
};
-
+
STRING (ERRCODE_UUI_SSLWARN_EXPIRED_1)
{
Text [ en-US ] = "$(ARG1) is a site that uses a security certificate to encrypt data during transmission, but its certificate expired on $(ARG2).\n\nYou should check to make sure that your computer's time is correct.";
};
-
+
STRING (ERRCODE_UUI_SSLWARN_DOMAINMISMATCH_1)
{
Text [ en-US ] = "You have attempted to establish a connection with $(ARG1). However, the security certificate presented belongs to $(ARG2). It is possible, though unlikely, that someone may be trying to intercept your communication with this web site.\n\nIf you suspect the certificate shown does not belong to $(ARG1), please cancel the connection and notify the site administrator.\n\nWould you like to continue anyway?";
};
-
+
STRING (ERRCODE_UUI_SSLWARN_INVALID_1)
{
Text [ en-US ] = "The certificate could not be validated. You should examine this site's certificate carefully.\n\nIf you suspect the certificate shown, please cancel the connection and notify the site administrator.";
@@ -374,7 +396,7 @@ Resource RID_UUI_ERRHDL
{
Text [ en-US ] = "Security Warning: Domain Name Mismatch";
};
-
+
STRING (TITLE_UUI_SSLWARN_EXPIRED)
{
Text [ en-US ] = "Security Warning: Server Certificate Expired";
diff --git a/uui/source/makefile.mk b/uui/source/makefile.mk
index 95b998ffd3..d0d8d4e755 100644
--- a/uui/source/makefile.mk
+++ b/uui/source/makefile.mk
@@ -39,6 +39,13 @@ ENABLE_EXCEPTIONS = true
SLOFILES = \
$(SLO)$/cookiedg.obj \
$(SLO)$/iahndl.obj \
+ $(SLO)$/iahndl-authentication.obj \
+ $(SLO)$/iahndl-ssl.obj \
+ $(SLO)$/iahndl-cookies.obj \
+ $(SLO)$/iahndl-filter.obj \
+ $(SLO)$/iahndl-locking.obj \
+ $(SLO)$/iahndl-ioexceptions.obj \
+ $(SLO)$/iahndl-errorhandler.obj \
$(SLO)$/logindlg.obj \
$(SLO)$/services.obj \
$(SLO)$/masterpassworddlg.obj \
@@ -46,17 +53,18 @@ SLOFILES = \
$(SLO)$/openlocked.obj \
$(SLO)$/passworddlg.obj \
$(SLO)$/passcrtdlg.obj \
- $(SLO)$/fltdlg.obj\
- $(SLO)$/interactionhandler.obj\
- $(SLO)$/requeststringresolver.obj\
- $(SLO)$/unknownauthdlg.obj\
- $(SLO)$/sslwarndlg.obj\
- $(SLO)$/secmacrowarnings.obj\
- $(SLO)$/filechanged.obj\
- $(SLO)$/alreadyopen.obj\
- $(SLO)$/lockfailed.obj\
- $(SLO)$/trylater.obj\
- $(SLO)$/newerverwarn.obj
+ $(SLO)$/fltdlg.obj \
+ $(SLO)$/interactionhandler.obj \
+ $(SLO)$/requeststringresolver.obj \
+ $(SLO)$/unknownauthdlg.obj \
+ $(SLO)$/sslwarndlg.obj \
+ $(SLO)$/secmacrowarnings.obj \
+ $(SLO)$/filechanged.obj \
+ $(SLO)$/alreadyopen.obj \
+ $(SLO)$/lockfailed.obj \
+ $(SLO)$/trylater.obj \
+ $(SLO)$/newerverwarn.obj \
+ $(SLO)$/passwordcontainer.obj
SRS1NAME=$(TARGET)
SRC1FILES = \
diff --git a/uui/source/passwordcontainer.cxx b/uui/source/passwordcontainer.cxx
new file mode 100644
index 0000000000..4802f92af8
--- /dev/null
+++ b/uui/source/passwordcontainer.cxx
@@ -0,0 +1,473 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "cppuhelper/factory.hxx"
+
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/task/NoMasterException.hpp"
+#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/task/XPasswordContainer.hpp"
+#include "com/sun/star/task/XUrlContainer.hpp"
+#include "com/sun/star/ucb/AuthenticationRequest.hpp"
+#include "com/sun/star/ucb/URLAuthenticationRequest.hpp"
+#include "com/sun/star/ucb/XInteractionSupplyAuthentication.hpp"
+#include "com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp"
+
+#include "passwordcontainer.hxx"
+
+using namespace com::sun::star;
+
+namespace {
+
+//=========================================================================
+bool fillContinuation(
+ bool bUseSystemCredentials,
+ const ucb::AuthenticationRequest & rRequest,
+ const task::UrlRecord & aRec,
+ const uno::Reference< ucb::XInteractionSupplyAuthentication > &
+ xSupplyAuthentication,
+ const uno::Reference< ucb::XInteractionSupplyAuthentication2 > &
+ xSupplyAuthentication2,
+ bool bCanUseSystemCredentials,
+ bool bCheckForEqualPasswords )
+{
+ if ( bUseSystemCredentials )
+ {
+ // "use system creds" record found.
+ // Wants client that we use it?
+ if ( xSupplyAuthentication2.is() && bCanUseSystemCredentials )
+ {
+ xSupplyAuthentication2->setUseSystemCredentials( sal_True );
+ return true;
+ }
+ return false;
+ }
+ else if (aRec.UserList.getLength() != 0)
+ {
+ if (aRec.UserList[0].Passwords.getLength() == 0)
+ {
+ // Password sequence can be empty, for instance if master
+ // password was not given (e.g. master pw dialog canceled)
+ // pw container does not throw NoMasterException in this case.
+ // bug???
+ return false;
+ }
+
+ // "user/pass" record found.
+ if (!bCheckForEqualPasswords || !rRequest.HasPassword
+ || rRequest.Password != aRec.UserList[0].Passwords[0]) // failed login attempt?
+ {
+ if (xSupplyAuthentication->canSetUserName())
+ xSupplyAuthentication->
+ setUserName(aRec.UserList[0].UserName.getStr());
+
+ if (xSupplyAuthentication->canSetPassword())
+ xSupplyAuthentication->
+ setPassword(aRec.UserList[0].Passwords[0].getStr());
+ if (aRec.UserList[0].Passwords.getLength() > 1)
+ {
+ if (rRequest.HasRealm)
+ {
+ if (xSupplyAuthentication->canSetRealm())
+ xSupplyAuthentication->
+ setRealm(aRec.UserList[0].Passwords[1].
+ getStr());
+ }
+ else if (xSupplyAuthentication->canSetAccount())
+ xSupplyAuthentication->
+ setAccount(aRec.UserList[0].Passwords[1].
+ getStr());
+ }
+
+ if ( xSupplyAuthentication2.is() && bCanUseSystemCredentials )
+ xSupplyAuthentication2->setUseSystemCredentials( sal_False );
+
+ return true;
+ }
+ }
+ return false;
+}
+
+} // namespace
+
+namespace uui {
+
+//=========================================================================
+PasswordContainerHelper::PasswordContainerHelper(
+ uno::Reference< lang::XMultiServiceFactory > const & xServiceFactory )
+{
+ OSL_ENSURE(xServiceFactory.is(), "no service factory given!");
+ if (xServiceFactory.is())
+ try
+ {
+ m_xPasswordContainer
+ = uno::Reference< task::XPasswordContainer >(
+ xServiceFactory->
+ createInstance(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.PasswordContainer"))),
+ uno::UNO_QUERY);
+ }
+ catch (uno::Exception const &)
+ {}
+ OSL_ENSURE(m_xPasswordContainer.is(),
+ "unable to instanciate password container service");
+}
+
+//=========================================================================
+bool PasswordContainerHelper::handleAuthenticationRequest(
+ ucb::AuthenticationRequest const & rRequest,
+ uno::Reference< ucb::XInteractionSupplyAuthentication > const &
+ xSupplyAuthentication,
+ rtl::OUString const & rURL,
+ uno::Reference< task::XInteractionHandler > const & xIH )
+ SAL_THROW((uno::RuntimeException))
+{
+ // Is continuation even a XInteractionSupplyAuthentication2, which
+ // is derived from XInteractionSupplyAuthentication?
+ uno::Reference< ucb::XInteractionSupplyAuthentication2 >
+ xSupplyAuthentication2(xSupplyAuthentication, uno::UNO_QUERY);
+
+ sal_Bool bCanUseSystemCredentials = sal_False;
+ if (xSupplyAuthentication2.is())
+ {
+ sal_Bool bDefaultUseSystemCredentials;
+ bCanUseSystemCredentials
+ = xSupplyAuthentication2->canUseSystemCredentials(
+ bDefaultUseSystemCredentials );
+ }
+
+ uno::Reference< task::XPasswordContainer > xContainer(
+ m_xPasswordContainer );
+ uno::Reference< task::XUrlContainer > xUrlContainer(
+ m_xPasswordContainer, uno::UNO_QUERY );
+ OSL_ENSURE( xUrlContainer.is(), "Got no XUrlContainer!" );
+
+ if ( !xContainer.is() || !xUrlContainer.is() )
+ return false;
+
+ if ( bCanUseSystemCredentials )
+ {
+ // Runtime / Persistent info avail for current auth request?
+
+ rtl::OUString aResult = xUrlContainer->findUrl(
+ rURL.getLength() ? rURL : rRequest.ServerName );
+ if ( aResult.getLength() > 0 )
+ {
+ if ( fillContinuation( true,
+ rRequest,
+ task::UrlRecord(),
+ xSupplyAuthentication,
+ xSupplyAuthentication2,
+ bCanUseSystemCredentials,
+ false ) )
+ {
+ return true;
+ }
+ }
+ }
+
+ // xContainer works with userName passwdSequences pairs:
+ if (rRequest.HasUserName && rRequest.HasPassword)
+ {
+ try
+ {
+ if (rRequest.UserName.getLength() == 0)
+ {
+ task::UrlRecord aRec;
+ if ( rURL.getLength() )
+ aRec = xContainer->find(rURL, xIH);
+
+ if ( aRec.UserList.getLength() == 0 )
+ {
+ // compat: try server name.
+ aRec = xContainer->find(rRequest.ServerName, xIH);
+ }
+
+ if ( fillContinuation( false,
+ rRequest,
+ aRec,
+ xSupplyAuthentication,
+ xSupplyAuthentication2,
+ bCanUseSystemCredentials,
+ false ) )
+ {
+ return true;
+ }
+ }
+ else
+ {
+ task::UrlRecord aRec;
+ if ( rURL.getLength() )
+ aRec = xContainer->findForName(
+ rURL, rRequest.UserName, xIH);
+
+ if ( aRec.UserList.getLength() == 0 )
+ {
+ // compat: try server name.
+ aRec = xContainer->findForName(
+ rRequest.ServerName, rRequest.UserName, xIH);
+ }
+
+ if ( fillContinuation( false,
+ rRequest,
+ aRec,
+ xSupplyAuthentication,
+ xSupplyAuthentication2,
+ bCanUseSystemCredentials,
+ true ) )
+ {
+ return true;
+ }
+ }
+ }
+ catch (task::NoMasterException const &)
+ {} // user did not enter master password
+ }
+ return false;
+}
+
+//=========================================================================
+bool PasswordContainerHelper::addRecord(
+ rtl::OUString const & rURL,
+ rtl::OUString const & rUsername,
+ uno::Sequence< rtl::OUString > const & rPasswords,
+ uno::Reference< task::XInteractionHandler > const & xIH,
+ bool bPersist )
+ SAL_THROW((uno::RuntimeException))
+{
+ try
+ {
+ if ( rUsername.getLength() )
+ {
+ OSL_ENSURE( m_xPasswordContainer.is(),
+ "Got no XPasswordContainer!" );
+ if ( !m_xPasswordContainer.is() )
+ return false;
+
+ if ( bPersist )
+ m_xPasswordContainer->addPersistent( rURL,
+ rUsername,
+ rPasswords,
+ xIH );
+ else
+ m_xPasswordContainer->add( rURL,
+ rUsername,
+ rPasswords,
+ xIH );
+ }
+ else
+ {
+ uno::Reference< task::XUrlContainer >
+ xContainer( m_xPasswordContainer, uno::UNO_QUERY );
+ OSL_ENSURE( xContainer.is(), "Got no XUrlContainer!" );
+ if ( !xContainer.is() )
+ return false;
+
+ xContainer->addUrl( rURL, bPersist );
+ }
+ }
+ catch ( task::NoMasterException const & )
+ {
+ // user did not enter master password
+ return false;
+ }
+ return true;
+}
+
+//=========================================================================
+//=========================================================================
+//=========================================================================
+
+PasswordContainerInteractionHandler::PasswordContainerInteractionHandler(
+ const uno::Reference< lang::XMultiServiceFactory >& xSMgr )
+: m_aPwContainerHelper( xSMgr )
+{
+}
+
+//=========================================================================
+// virtual
+PasswordContainerInteractionHandler::~PasswordContainerInteractionHandler()
+{
+}
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+// virtual
+::rtl::OUString SAL_CALL
+PasswordContainerInteractionHandler::getImplementationName()
+ throw ( uno::RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL
+PasswordContainerInteractionHandler::supportsService(
+ const ::rtl::OUString& ServiceName )
+ throw ( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aSNL = getSupportedServiceNames();
+ const rtl::OUString * pArray = aSNL.getConstArray();
+ for ( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ {
+ if ( pArray[ i ] == ServiceName )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< ::rtl::OUString > SAL_CALL
+PasswordContainerInteractionHandler::getSupportedServiceNames()
+ throw ( uno::RuntimeException )
+{
+ return getSupportedServiceNames_Static();
+}
+
+//=========================================================================
+// static
+rtl::OUString
+PasswordContainerInteractionHandler::getImplementationName_Static()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.uui.PasswordContainerInteractionHandler" ) );
+}
+
+//=========================================================================
+// static
+uno::Sequence< rtl::OUString >
+PasswordContainerInteractionHandler::getSupportedServiceNames_Static()
+{
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ]
+ = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.task.PasswordContainerInteractionHandler" ) );
+ return aSNS;
+}
+
+//=========================================================================
+//
+// XInteractionHandler methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL
+PasswordContainerInteractionHandler::handle(
+ const uno::Reference< task::XInteractionRequest >& rRequest )
+ throw ( uno::RuntimeException )
+{
+ if ( !rRequest.is() )
+ return;
+
+ uno::Any aAnyRequest( rRequest->getRequest() );
+
+ ucb::AuthenticationRequest aAuthenticationRequest;
+ if ( !( aAnyRequest >>= aAuthenticationRequest ) )
+ return;
+
+ rtl::OUString aURL;
+ ucb::URLAuthenticationRequest aURLAuthenticationRequest;
+ if ( aAnyRequest >>= aURLAuthenticationRequest )
+ aURL = aURLAuthenticationRequest.URL;
+
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > >
+ rContinuations = rRequest->getContinuations();
+
+ uno::Reference< ucb::XInteractionSupplyAuthentication >
+ xSupplyAuthentication;
+
+ for ( sal_Int32 i = 0; i < rContinuations.getLength(); ++i )
+ {
+ xSupplyAuthentication
+ = uno::Reference< ucb::XInteractionSupplyAuthentication >(
+ rContinuations[i], uno::UNO_QUERY );
+ if( xSupplyAuthentication.is() )
+ break;
+ }
+
+ if ( !xSupplyAuthentication.is() )
+ return;
+
+ // Try to obatin credentials from password container.
+ if ( m_aPwContainerHelper.
+ handleAuthenticationRequest( aAuthenticationRequest,
+ xSupplyAuthentication,
+ aURL,
+ // @@@ FIXME: this not able to
+ // handle master pw request!
+ // master pw request is never
+ // solvabe without UI!
+ this ) )
+ {
+ // successfully handled
+ xSupplyAuthentication->select();
+ }
+}
+
+//=========================================================================
+//
+// Service factory implementation.
+//
+//=========================================================================
+
+static uno::Reference< uno::XInterface > SAL_CALL
+PasswordContainerInteractionHandler_CreateInstance(
+ const uno::Reference< lang::XMultiServiceFactory> & rSMgr )
+ throw( uno::Exception )
+{
+ lang::XServiceInfo * pX = static_cast< lang::XServiceInfo * >(
+ new PasswordContainerInteractionHandler( rSMgr ) );
+ return uno::Reference< uno::XInterface >::query( pX );
+}
+
+//=========================================================================
+// static
+uno::Reference< lang::XSingleServiceFactory >
+PasswordContainerInteractionHandler::createServiceFactory(
+ const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr )
+{
+ return uno::Reference< lang::XSingleServiceFactory >(
+ cppu::createOneInstanceFactory(
+ rxServiceMgr,
+ PasswordContainerInteractionHandler::getImplementationName_Static(),
+ PasswordContainerInteractionHandler_CreateInstance,
+ PasswordContainerInteractionHandler::getSupportedServiceNames_Static() ) );
+}
+
+} // namespace uui
diff --git a/uui/source/passwordcontainer.hxx b/uui/source/passwordcontainer.hxx
new file mode 100644
index 0000000000..c08ef70166
--- /dev/null
+++ b/uui/source/passwordcontainer.hxx
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_UUI_PASSWORDCONTAINER_HXX
+#define INCLUDED_UUI_PASSWORDCONTAINER_HXX
+
+#include "cppuhelper/implbase2.hxx"
+
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/task/XPasswordContainer.hpp"
+
+namespace com {
+ namespace sun {
+ namespace star {
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+ namespace ucb {
+ class AuthenticationRequest;
+ class XInteractionSupplyAuthentication;
+} } } }
+
+namespace uui {
+
+// ============================================================================
+
+/** Passwordcontainer UNO service (com.sun.star.task.PasswordContainer) helper.
+ */
+class PasswordContainerHelper
+{
+public:
+ PasswordContainerHelper(
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const &
+ xServiceFactory );
+
+ // ------------------------------------------------------------------------
+
+ /** This member function tries to handle an authentication interaction
+ request by looking up credentials for the given URL in the password
+ container service.
+
+ In case of success the given interaction continuation
+ (XInteractionSupplyAuthentication) is filled with the credentials found
+ in the password container.
+
+ Please note the the continuation gets not "selected" by this
+ implementation. "Selecting" the continuation is up to the caller (e.g.
+ an implementation of XInteractionHandler::handle) of this function.
+
+ @param rRequest
+ The authentication request.
+
+ @param xSupplyAuthentication
+ The "supply authentication" interaction continuation.
+
+ @param rURL
+ The URL to lookup credentials for.
+
+ @param xIH
+ The interaction handler to use, for example if a master password is
+ needed to access the password container.
+
+ @return
+ True, if the authentication request was handled successfully.
+ False, otherwise.
+ */
+ bool handleAuthenticationRequest(
+ com::sun::star::ucb::AuthenticationRequest const & rRequest,
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XInteractionSupplyAuthentication > const &
+ xSupplyAuthentication,
+ rtl::OUString const & rURL,
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler > const & xIH )
+ SAL_THROW( (com::sun::star::uno::RuntimeException) );
+
+ /** This member function adds credentials for the given URL to the password
+ container.
+
+ @param rURL
+ The URL the credentials are valid for. rURL must not be empty.
+
+ @param rUsername
+ The user name.
+
+ @param rPasswords
+ This list of passwords.
+
+ @param xIH
+ The interaction handler to use, for example if a master password is
+ needed to access the password container.
+
+ @param bPersist
+ True, the record will get stored persistently; restored upon
+ password container initialization
+ False, the record will be stored until password container instance
+ gets destroyed.
+
+ @return
+ True, if the record was added successfully.
+ False, otherwise.
+
+ */
+ bool addRecord( rtl::OUString const & rURL,
+ rtl::OUString const & rUsername,
+ com::sun::star::uno::Sequence< rtl::OUString > const &
+ rPasswords,
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler > const & xIH,
+ bool bPersist )
+ SAL_THROW( (com::sun::star::uno::RuntimeException) );
+
+ // ------------------------------------------------------------------------
+
+private:
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XPasswordContainer > m_xPasswordContainer;
+};
+
+// ============================================================================
+
+class PasswordContainerInteractionHandler :
+ public cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo,
+ com::sun::star::task::XInteractionHandler >
+{
+public:
+ PasswordContainerInteractionHandler(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
+ virtual ~PasswordContainerInteractionHandler();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw ( com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const ::rtl::OUString& ServiceName )
+ throw ( com::sun::star::uno::RuntimeException );
+
+ virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw ( com::sun::star::uno::RuntimeException );
+
+ // XInteractionHandler
+ virtual void SAL_CALL
+ handle( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::task::XInteractionRequest >& Request )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // Non-UNO interfaces
+ static rtl::OUString
+ getImplementationName_Static();
+
+ static com::sun::star::uno::Sequence< rtl::OUString >
+ getSupportedServiceNames_Static();
+
+ static com::sun::star::uno::Reference<
+ com::sun::star::lang::XSingleServiceFactory >
+ createServiceFactory( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > & rxServiceMgr );
+
+private:
+ //com::sun::star::uno::Reference<
+ // com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ PasswordContainerHelper m_aPwContainerHelper;
+};
+
+} // namespace uui
+
+#endif
diff --git a/uui/source/services.cxx b/uui/source/services.cxx
index a72f414591..92669fe0d9 100644
--- a/uui/source/services.cxx
+++ b/uui/source/services.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -37,6 +37,7 @@
#include "interactionhandler.hxx"
#include "requeststringresolver.hxx"
+#include "passwordcontainer.hxx"
using namespace rtl;
using namespace com::sun::star::uno;
@@ -46,40 +47,40 @@ using namespace com::sun::star::registry;
namespace {
sal_Bool writeInfo( void * pRegistryKey,
- const char * pImplementationName,
+ const OUString & rImplementationName,
Sequence< OUString > const & rServiceNames )
{
OUString aKeyName( OUString::createFromAscii( "/" ) );
- aKeyName += OUString::createFromAscii( pImplementationName );
+ aKeyName += rImplementationName;
aKeyName += OUString::createFromAscii( "/UNO/SERVICES" );
-
+
Reference< XRegistryKey > xKey;
try
{
- xKey = static_cast< XRegistryKey * >(
- pRegistryKey )->createKey( aKeyName );
+ xKey = static_cast< XRegistryKey * >(
+ pRegistryKey )->createKey( aKeyName );
}
catch ( InvalidRegistryException const & )
{
}
-
+
if ( !xKey.is() )
{
- return sal_False;
+ 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;
- }
+ try
+ {
+ xKey->createKey( rServiceNames[ n ] );
+ }
+ catch ( InvalidRegistryException const & )
+ {
+ bSuccess = sal_False;
+ break;
+ }
}
return bSuccess;
}
@@ -114,16 +115,26 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * pRegistryKey)
//////////////////////////////////////////////////////////////////////
writeInfo( pRegistryKey,
- UUIInteractionHandler::m_aImplementationName,
- UUIInteractionHandler::getSupportedServiceNames_static() ) &&
-
+ OUString::createFromAscii(
+ UUIInteractionHandler::m_aImplementationName ),
+ UUIInteractionHandler::getSupportedServiceNames_static() ) &&
+
//////////////////////////////////////////////////////////////////////
// UUI Interaction Request String Resolver.
//////////////////////////////////////////////////////////////////////
writeInfo( pRegistryKey,
- UUIInteractionRequestStringResolver::m_aImplementationName,
- UUIInteractionRequestStringResolver::getSupportedServiceNames_static() );
+ OUString::createFromAscii(
+ UUIInteractionRequestStringResolver::m_aImplementationName ),
+ UUIInteractionRequestStringResolver::getSupportedServiceNames_static() ) &&
+
+ //////////////////////////////////////////////////////////////////////
+ // UUI Password Container Interaction Handler.
+ //////////////////////////////////////////////////////////////////////
+
+ writeInfo( pRegistryKey,
+ uui::PasswordContainerInteractionHandler::getImplementationName_Static(),
+ uui::PasswordContainerInteractionHandler::getSupportedServiceNames_Static() );
}
//============================================================================
@@ -138,55 +149,64 @@ extern "C" void * SAL_CALL component_getFactory(sal_Char const * pImplName,
{
if (!pImplName)
return 0;
-
+
void * pRet = 0;
Reference< XMultiServiceFactory > xSMgr(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
Reference< XSingleServiceFactory > xFactory;
-
+
//////////////////////////////////////////////////////////////////////
// UUI Interaction Handler.
//////////////////////////////////////////////////////////////////////
-
+
if ( rtl_str_compare(pImplName,
UUIInteractionHandler::m_aImplementationName)
== 0)
{
- xFactory =
+ xFactory =
cppu::createSingleFactory(
- static_cast< XMultiServiceFactory * >(
- pServiceManager),
+ static_cast< XMultiServiceFactory * >(pServiceManager),
OUString::createFromAscii(
UUIInteractionHandler::m_aImplementationName),
&UUIInteractionHandler::createInstance,
UUIInteractionHandler::getSupportedServiceNames_static());
}
-
+
//////////////////////////////////////////////////////////////////////
// UUI Interaction Request String Resolver.
//////////////////////////////////////////////////////////////////////
-
+
else if ( rtl_str_compare(pImplName,
UUIInteractionRequestStringResolver::m_aImplementationName)
== 0)
{
- xFactory =
+ xFactory =
cppu::createSingleFactory(
- static_cast< XMultiServiceFactory * >(
- pServiceManager),
+ static_cast< XMultiServiceFactory * >(pServiceManager),
OUString::createFromAscii(
UUIInteractionRequestStringResolver::m_aImplementationName),
&UUIInteractionRequestStringResolver::createInstance,
UUIInteractionRequestStringResolver::getSupportedServiceNames_static());
}
-
+
+ //////////////////////////////////////////////////////////////////////
+ // UUI Password Container Interaction Handler.
+ //////////////////////////////////////////////////////////////////////
+
+ else if ( uui::PasswordContainerInteractionHandler::getImplementationName_Static().
+ compareToAscii( pImplName ) == 0 )
+ {
+ xFactory =
+ uui::PasswordContainerInteractionHandler::createServiceFactory( xSMgr );
+ }
+
//////////////////////////////////////////////////////////////////////
-
+
if ( xFactory.is() )
{
- xFactory->acquire();
- pRet = xFactory.get();
+ xFactory->acquire();
+ pRet = xFactory.get();
}
return pRet;
diff --git a/xmloff/inc/xmlnmspe.hxx b/xmloff/inc/xmlnmspe.hxx
index c2447dd7b6..2a1c9f4961 100644
--- a/xmloff/inc/xmlnmspe.hxx
+++ b/xmloff/inc/xmlnmspe.hxx
@@ -89,8 +89,9 @@ const sal_uInt16 XML_NAMESPACE_##prefix##_EXT = key; \
const sal_uInt16 XML_NAMESPACE_##prefix##_EXT_IDX = key;
XML_NAMESPACE_EXT( OFFICE, 37U )
+XML_NAMESPACE_EXT( TABLE, 38U )
-#define _XML_OLD_NAMESPACE_BASE 38U
+#define _XML_OLD_NAMESPACE_BASE 39U
// namespaces used in the technical preview (SO 5.2)
XML_OLD_NAMESPACE( FO, 0U )
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index daca654692..738105740d 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -147,6 +147,9 @@ namespace xmloff { namespace token {
// ODF Enhanced namespaces
XML_NP_OFFICE_EXT,
XML_N_OFFICE_EXT,
+
+ XML_NP_TABLE_EXT,
+ XML_N_TABLE_EXT,
// units
XML_UNIT_MM,
@@ -520,6 +523,7 @@ namespace xmloff { namespace token {
XML_DATA_LABEL_SYMBOL,
XML_DATA_LABEL_TEXT,
XML_DATA_PILOT_FIELD,
+ XML_DATA_PILOT_GRAND_TOTAL,
XML_DATA_PILOT_LEVEL,
XML_DATA_PILOT_MEMBER,
XML_DATA_PILOT_MEMBERS,
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 26ce46ee60..ee29b3161d 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -322,6 +322,12 @@ void SvXMLExport::_InitCtor()
mpNamespaceMap->Add( GetXMLToken(XML_NP_OOOW), GetXMLToken(XML_N_OOOW), XML_NAMESPACE_OOOW );
mpNamespaceMap->Add( GetXMLToken(XML_NP_OOOC), GetXMLToken(XML_N_OOOC), XML_NAMESPACE_OOOC );
mpNamespaceMap->Add( GetXMLToken(XML_NP_OF), GetXMLToken(XML_N_OF), XML_NAMESPACE_OF );
+
+ if (getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST)
+ {
+ mpNamespaceMap->Add(
+ GetXMLToken(XML_NP_TABLE_EXT), GetXMLToken(XML_N_TABLE_EXT), XML_NAMESPACE_TABLE_EXT);
+ }
}
if( (getExportFlags() & (EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
{
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index a53bfec75e..0ecf904cbe 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -101,6 +101,7 @@ sal_Char __READONLY_DATA sXML_np__of[] = "_of";
sal_Char __READONLY_DATA sXML_np__style[] = "_style";
sal_Char __READONLY_DATA sXML_np__text[] = "_text";
sal_Char __READONLY_DATA sXML_np__table[] = "_table";
+sal_Char __READONLY_DATA sXML_np__table_ext[] = "_table_ooo";
sal_Char __READONLY_DATA sXML_np__draw[] = "_draw";
sal_Char __READONLY_DATA sXML_np__dr3d[] = "_dr3d";
sal_Char __READONLY_DATA sXML_np__fo[] = "_fo";
@@ -259,6 +260,9 @@ void SvXMLImport::_InitCtor()
mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__table ) ),
GetXMLToken(XML_N_TABLE),
XML_NAMESPACE_TABLE );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__table_ext ) ),
+ GetXMLToken(XML_N_TABLE_EXT),
+ XML_NAMESPACE_TABLE_EXT );
mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__draw ) ),
GetXMLToken(XML_N_DRAW),
XML_NAMESPACE_DRAW );
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 0a2ccd57d1..7a509428a6 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -156,6 +156,9 @@ namespace xmloff { namespace token {
TOKEN( "officeooo", XML_NP_OFFICE_EXT ),
TOKEN( "http://openoffice.org/2009/office", XML_N_OFFICE_EXT ),
+ TOKEN( "tableooo", XML_NP_TABLE_EXT ),
+ TOKEN( "http://openoffice.org/2009/table", XML_N_TABLE_EXT ),
+
// units
TOKEN( "mm", XML_UNIT_MM ),
TOKEN( "m", XML_UNIT_M ),
@@ -528,6 +531,7 @@ namespace xmloff { namespace token {
TOKEN( "data-label-symbol", XML_DATA_LABEL_SYMBOL ),
TOKEN( "data-label-text", XML_DATA_LABEL_TEXT ),
TOKEN( "data-pilot-field", XML_DATA_PILOT_FIELD ),
+ TOKEN( "data-pilot-grand-total", XML_DATA_PILOT_GRAND_TOTAL ),
TOKEN( "data-pilot-level", XML_DATA_PILOT_LEVEL ),
TOKEN( "data-pilot-member", XML_DATA_PILOT_MEMBER ),
TOKEN( "data-pilot-members", XML_DATA_PILOT_MEMBERS ),
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 6b6aedbfa9..1e76667fd8 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -2994,7 +2994,18 @@ void SdXMLPluginShapeContext::EndElement()
else
{
// in case we have a media object
- xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaURL" ) ), uno::makeAny( maHref ) );
+
+ OUString sTempRef;
+
+ // check for package URL
+ if( GetImport().IsPackageURL( maHref ) )
+ {
+ sTempRef = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
+ }
+
+ sTempRef += maHref;
+
+ xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaURL" ) ), uno::makeAny( sTempRef ) );
for( sal_Int32 nParam = 0; nParam < maParams.getLength(); ++nParam )
{