diff options
author | Kai Sommerfeld <kso@openoffice.org> | 2000-11-17 14:38:10 +0000 |
---|---|---|
committer | Kai Sommerfeld <kso@openoffice.org> | 2000-11-17 14:38:10 +0000 |
commit | 1fd2287cc92ec6efbdbd441f22983af63e33e40b (patch) | |
tree | cae0b2409f6e81a78cf4da2395a78646d2dbb8a2 /ucbhelper | |
parent | 21b600477d72a7714e1ecc758a2c019531e97147 (diff) |
Changed: Misc adaptions.
Diffstat (limited to 'ucbhelper')
-rw-r--r-- | ucbhelper/workben/myucp/myucp_content.cxx | 90 | ||||
-rw-r--r-- | ucbhelper/workben/myucp/myucp_content.hxx | 14 | ||||
-rw-r--r-- | ucbhelper/workben/myucp/myucp_datasupplier.cxx | 19 | ||||
-rw-r--r-- | ucbhelper/workben/myucp/myucp_datasupplier.hxx | 7 | ||||
-rw-r--r-- | ucbhelper/workben/myucp/myucp_provider.hxx | 6 | ||||
-rw-r--r-- | ucbhelper/workben/myucp/myucp_resultset.cxx | 22 | ||||
-rw-r--r-- | ucbhelper/workben/myucp/myucp_resultset.hxx | 10 |
7 files changed, 117 insertions, 51 deletions
diff --git a/ucbhelper/workben/myucp/myucp_content.cxx b/ucbhelper/workben/myucp/myucp_content.cxx index 938dec90661d..6f0019d875e7 100644 --- a/ucbhelper/workben/myucp/myucp_content.cxx +++ b/ucbhelper/workben/myucp/myucp_content.cxx @@ -2,9 +2,9 @@ * * $RCSfile: myucp_content.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $ + * last change: $Author: kso $ $Date: 2000-11-17 15:38:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -77,6 +77,9 @@ #ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_ #include <com/sun/star/ucb/OpenCommandArgument2.hpp> #endif +#ifndef _COM_SUN_STAR_UCB_OPENMODE_HPP_ +#include <com/sun/star/ucb/OpenMode.hpp> +#endif #ifndef _COM_SUN_STAR_UCB_XCOMMANDINFO_HPP_ #include <com/sun/star/ucb/XCommandInfo.hpp> #endif @@ -331,24 +334,71 @@ Any SAL_CALL Content::execute( const Command& aCommand, aRet <<= getCommandInfo(); } #if 0 - else if ( isFolder() && ( aCommand.Name.compareToAscii( "open" ) == 0 ) ) + else if ( aCommand.Name.compareToAscii( "open" ) == 0 ) { - ////////////////////////////////////////////////////////////////// - // open command for a folder content - ////////////////////////////////////////////////////////////////// + OpenCommandArgument2 aOpenCommand; + if ( !( aCommand.Argument >>= aOpenCommand ) ) + { + VOS_ENSURE( sal_False, + "Content::execute - invalid parameter!" ); + throw CommandAbortedException(); + } - OpenCommandArgument2 aOpenCommand; - if ( aCommand.Argument >>= aOpenCommand ) + if ( isFolder() ) { + ////////////////////////////////////////////////////////////// + // open command for a folder content + ////////////////////////////////////////////////////////////// + Reference< XDynamicResultSet > xSet - = new DynamicResultSet( m_xSMgr, this, aOpenCommand ); + = new DynamicResultSet( m_xSMgr, + this, + aOpenCommand, + Environment ); aRet <<= xSet; - } - else + } + else { - VOS_ENSURE( sal_False, - "Content::execute - invalid parameter!" ); - throw CommandAbortedException(); + ////////////////////////////////////////////////////////////// + // open command for a document content + ////////////////////////////////////////////////////////////// + + if ( ( aOpenCommand.Mode + == OpenMode::DOCUMENT_SHARE_DENY_NONE ) || + ( aOpenCommand.Mode + == OpenMode::DOCUMENT_SHARE_DENY_WRITE ) ) + { + // Currently(?) unsupported. + throw CommandAbortedException(); + } + + OUString aURL = m_xIdentifier->getContentIdentifier(); + Reference< XOutputStream > xOut + = Reference< XOutputStream >( aOpenCommand.Sink, UNO_QUERY ); + if ( xOut.is() ) + { + // @@@ PUSH: write data into xOut + } + else + { + Reference< XActiveDataSink > xDataSink + = Reference< XActiveDataSink >( + aOpenCommand.Sink, UNO_QUERY ); + if ( xDataSink.is() ) + { + // @@@ PULL: wait for client read + + Reference< XInputStream > xIn + = new // @@@ your XInputStream + XSeekable impl. object + xDataSink->setInputStream( xIn ); + } + else + { + VOS_ENSURE( sal_False, + "Content::execute - invalid parameter!" ); + throw CommandAbortedException(); + } + } } } else if ( aCommand.Name.compareToAscii( "insert" ) == 0 ) @@ -369,6 +419,9 @@ Any SAL_CALL Content::execute( const Command& aCommand, aCommand.Argument >>= bDeletePhysical; destroy( bDeletePhysical ); + // Remove own and all children's Additional Core Properties. + removeAdditionalPropertySet( sal_True ); + // Remove own and all childrens(!) persistent data. // removeData(); } @@ -692,7 +745,7 @@ void Content::setPropertyValues( const Sequence< PropertyValue >& rValues ) #if 0 //========================================================================= -void Content::queryChildren( ::myucp::ContentRefList& rChildren ) +void Content::queryChildren( ContentRefList& rChildren ) { // @@@ Adapt method to your URL scheme... @@ -734,9 +787,8 @@ void Content::queryChildren( ::myucp::ContentRefList& rChildren ) { // No further slashes / only a final slash. It's a child! rChildren.push_back( - HierarchyContentRef( - static_cast< HierarchyContent * >( - xChild.getBodyPtr() ) ) ); + ContentRef( + static_cast< Content * >( xChild.getBodyPtr() ) ) ); } } ++it; @@ -789,7 +841,7 @@ void Content::destroy( sal_Bool bDeletePhysical ) // Process instanciated children... - ::myucp::ContentRefList aChildren; + ContentRefList aChildren; queryChildren( aChildren ); ContentRefList::const_iterator it = aChildren.begin(); diff --git a/ucbhelper/workben/myucp/myucp_content.hxx b/ucbhelper/workben/myucp/myucp_content.hxx index cef039ec6ffa..041eaddb5787 100644 --- a/ucbhelper/workben/myucp/myucp_content.hxx +++ b/ucbhelper/workben/myucp/myucp_content.hxx @@ -2,9 +2,9 @@ * * $RCSfile: myucp_content.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:03:37 $ + * last change: $Author: kso $ $Date: 2000-11-17 15:38:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -107,7 +107,7 @@ struct ContentProperties // @@@ Add other properties supported by your content. ContentProperties() - : bIsDocument( sal_False ), bIsFolder( sal_True ) {} + : bIsDocument( sal_True ), bIsFolder( sal_False ) {} }; //========================================================================= @@ -128,9 +128,9 @@ private: const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues ); -// typedef vos::ORef< HierarchyContent > HierarchyContentRef; -// typedef std::list< HierarchyContentRef > HierarchyContentRefList; -// void queryChildren( HierarchyContentRefList& rChildren ); +// typedef vos::ORef< Content > ContentRef; +// typedef std::list< ContentRef > ContentRefList; +// void queryChildren( ContentRefList& rChildren ); // // Command "insert" // void insert() @@ -184,7 +184,7 @@ public: // Additional interfaces ////////////////////////////////////////////////////////////////////// - // Add additional interfaces ( like com::sun:.star::ucb::XContentCreator ). + // @@@ Add additional interfaces ( like com::sun:.star::ucb::XContentCreator ). ////////////////////////////////////////////////////////////////////// // Non-interface methods. diff --git a/ucbhelper/workben/myucp/myucp_datasupplier.cxx b/ucbhelper/workben/myucp/myucp_datasupplier.cxx index 3fc120d1f40d..a6276e5867d7 100644 --- a/ucbhelper/workben/myucp/myucp_datasupplier.cxx +++ b/ucbhelper/workben/myucp/myucp_datasupplier.cxx @@ -2,9 +2,9 @@ * * $RCSfile: myucp_datasupplier.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $ + * last change: $Author: kso $ $Date: 2000-11-17 15:38:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -137,15 +137,17 @@ struct DataSupplier_Impl vos::ORef< Content > m_xContent; Reference< XMultiServiceFactory > m_xSMgr; // @@@ The data source and an iterator for it -// HierarchyEntry m_aFolder; -// HierarchyEntry::iterator m_aIterator; +// Entry m_aFolder; +// Entry::iterator m_aIterator; + sal_Int32 m_nOpenMode; sal_Bool m_bCountFinal; DataSupplier_Impl( const Reference< XMultiServiceFactory >& rxSMgr, - const vos::ORef< Content >& rContent ) + const vos::ORef< Content >& rContent, + sal_Int32 nOpenMode ) : m_xContent( rContent ), m_xSMgr( rxSMgr ), // m_aFolder( rxSMgr, rContent->getIdentifier()->getContentIdentifier() ), - m_bCountFinal( sal_False ) {} + m_nOpenMode( nOpenMode ), m_bCountFinal( sal_False ) {} ~DataSupplier_Impl(); }; @@ -173,8 +175,9 @@ DataSupplier_Impl::~DataSupplier_Impl() //========================================================================= DataSupplier::DataSupplier( const Reference< XMultiServiceFactory >& rxSMgr, - const vos::ORef< Content >& rContent ) -: m_pImpl( new DataSupplier_Impl( rxSMgr, rContent ) ) + const vos::ORef< Content >& rContent, + sal_Int32 nOpenMode ) +: m_pImpl( new DataSupplier_Impl( rxSMgr, rContent, nOpenMode ) ) { } diff --git a/ucbhelper/workben/myucp/myucp_datasupplier.hxx b/ucbhelper/workben/myucp/myucp_datasupplier.hxx index a7337d565d5f..433934b4c80a 100644 --- a/ucbhelper/workben/myucp/myucp_datasupplier.hxx +++ b/ucbhelper/workben/myucp/myucp_datasupplier.hxx @@ -2,9 +2,9 @@ * * $RCSfile: myucp_datasupplier.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $ + * last change: $Author: kso $ $Date: 2000-11-17 15:38:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,7 +80,8 @@ class DataSupplier : public ucb::ResultSetDataSupplier public: DataSupplier( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSMgr, - const vos::ORef< Content >& rContent ); + const vos::ORef< Content >& rContent, + sal_Int32 nOpenMode ); virtual ~DataSupplier(); virtual rtl::OUString queryContentIdentifierString( sal_uInt32 nIndex ); diff --git a/ucbhelper/workben/myucp/myucp_provider.hxx b/ucbhelper/workben/myucp/myucp_provider.hxx index 4d52c82fa7e9..68eb0d8b0246 100644 --- a/ucbhelper/workben/myucp/myucp_provider.hxx +++ b/ucbhelper/workben/myucp/myucp_provider.hxx @@ -2,9 +2,9 @@ * * $RCSfile: myucp_provider.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $ + * last change: $Author: kso $ $Date: 2000-11-17 15:38:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,7 +85,7 @@ namespace myucp { // contents ) according to this scheme. #define MYUCP_URL_SCHEME \ "vnd.sun.star.myucp" -#define MYUCP_URL_SCHEME_LENGTH 24 +#define MYUCP_URL_SCHEME_LENGTH 18 // UCB Content Type. #define MYUCP_CONTENT_TYPE \ diff --git a/ucbhelper/workben/myucp/myucp_resultset.cxx b/ucbhelper/workben/myucp/myucp_resultset.cxx index 07f470972f87..692cf07371f3 100644 --- a/ucbhelper/workben/myucp/myucp_resultset.cxx +++ b/ucbhelper/workben/myucp/myucp_resultset.cxx @@ -2,9 +2,9 @@ * * $RCSfile: myucp_resultset.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $ + * last change: $Author: kso $ $Date: 2000-11-17 15:38:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,9 +95,11 @@ using namespace myucp; DynamicResultSet::DynamicResultSet( const Reference< XMultiServiceFactory >& rxSMgr, const vos::ORef< Content >& rxContent, - const OpenCommandArgument2& rCommand ) + const OpenCommandArgument2& rCommand, + const Reference< XCommandEnvironment >& rxEnv ) : ResultSetImplHelper( rxSMgr, rCommand ), - m_xContent( rxContent ) + m_xContent( rxContent ), + m_xEnv( rxEnv ) { } @@ -112,8 +114,10 @@ void DynamicResultSet::initStatic() m_xResultSet1 = new ::ucb::ResultSet( m_xSMgr, m_aCommand.Properties, - new ResultSetDataSupplier( m_xSMgr, - m_xContent ) ); + new DataSupplier( m_xSMgr, + m_xContent, + m_aCommand.Mode ), + m_xEnv ); } //========================================================================= @@ -122,8 +126,10 @@ void DynamicResultSet::initDynamic() m_xResultSet1 = new ::ucb::ResultSet( m_xSMgr, m_aCommand.Properties, - new ResultSetDataSupplier( m_xSMgr, - m_xContent ) ); + new DataSupplier( m_xSMgr, + m_xContent, + m_aCommand.Mode ), + m_xEnv ); m_xResultSet2 = m_xResultSet1; } diff --git a/ucbhelper/workben/myucp/myucp_resultset.hxx b/ucbhelper/workben/myucp/myucp_resultset.hxx index e6899a26c319..fa45fe6f8c6b 100644 --- a/ucbhelper/workben/myucp/myucp_resultset.hxx +++ b/ucbhelper/workben/myucp/myucp_resultset.hxx @@ -2,9 +2,9 @@ * * $RCSfile: myucp_resultset.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:03:38 $ + * last change: $Author: kso $ $Date: 2000-11-17 15:38:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,6 +81,8 @@ namespace myucp { class DynamicResultSet : public ::ucb::ResultSetImplHelper { vos::ORef< Content > m_xContent; + com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment > m_xEnv; private: virtual void initStatic(); @@ -91,7 +93,9 @@ public: const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSMgr, const vos::ORef< Content >& rxContent, - const com::sun::star::ucb::OpenCommandArgument2& rCommand ); + const com::sun::star::ucb::OpenCommandArgument2& rCommand, + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment >& rxEnv ); }; } |