From 93551bdf06411cbb37acf68192c94a41c146a03c Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Wed, 6 Jan 2010 16:46:36 +0100 Subject: #i61429# - Adapted UCB clients to deprecated XContentCreator interface. --- fileaccess/source/FileAccess.cxx | 90 ++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 50 deletions(-) (limited to 'fileaccess/source') 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 #include #include -#include #include #include @@ -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 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 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; } } } -- cgit