diff options
author | Kai Sommerfeld <kso@openoffice.org> | 2010-01-06 16:46:36 +0100 |
---|---|---|
committer | Kai Sommerfeld <kso@openoffice.org> | 2010-01-06 16:46:36 +0100 |
commit | 93551bdf06411cbb37acf68192c94a41c146a03c (patch) | |
tree | a2a529b964a95b0b2d87253b018abf21c659b218 | |
parent | whitespace cleanup. (diff) | |
download | core-93551bdf06411cbb37acf68192c94a41c146a03c.tar.gz core-93551bdf06411cbb37acf68192c94a41c146a03c.zip |
#i61429# - Adapted UCB clients to deprecated XContentCreator interface.
-rw-r--r-- | desktop/source/deployment/misc/dp_ucb.cxx | 75 | ||||
-rw-r--r-- | fileaccess/source/FileAccess.cxx | 90 | ||||
-rw-r--r-- | fpicker/source/office/fpsmartcontent.cxx | 31 | ||||
-rw-r--r-- | sfx2/source/doc/doctempl.cxx | 1 | ||||
-rwxr-xr-x | ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java | 11 |
5 files changed, 95 insertions, 113 deletions
diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx index 8a4f55caae1a..013ba0e2ce23 100644 --- a/desktop/source/deployment/misc/dp_ucb.cxx +++ b/desktop/source/deployment/misc/dp_ucb.cxx @@ -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" @@ -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; + // 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; - } + 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; } } } diff --git a/fileaccess/source/FileAccess.cxx b/fileaccess/source/FileAccess.cxx index 5d568dc994cb..3f387afe4b4c 100644 --- a/fileaccess/source/FileAccess.cxx +++ b/fileaccess/source/FileAccess.cxx @@ -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> @@ -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; @@ -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 34be031fdf6e..3ee5166fed9b 100644 --- a/fpicker/source/office/fpsmartcontent.cxx +++ b/fpicker/source/office/fpsmartcontent.cxx @@ -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> @@ -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 e43da0b0bacc..f3e7b789a062 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> diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java index fc8cf81c4aaf..8600dcc7f1b7 100755 --- a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java +++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java @@ -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)); |