summaryrefslogtreecommitdiff
path: root/fileaccess
diff options
context:
space:
mode:
authorKai Sommerfeld <kso@openoffice.org>2010-01-06 16:46:36 +0100
committerKai Sommerfeld <kso@openoffice.org>2010-01-06 16:46:36 +0100
commit93551bdf06411cbb37acf68192c94a41c146a03c (patch)
treea2a529b964a95b0b2d87253b018abf21c659b218 /fileaccess
parentca5ed72ceb4ec26d5867b7e1abfc7a2f176cf181 (diff)
#i61429# - Adapted UCB clients to deprecated XContentCreator interface.
Diffstat (limited to 'fileaccess')
-rw-r--r--fileaccess/source/FileAccess.cxx90
1 files changed, 40 insertions, 50 deletions
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;
}
}
}