summaryrefslogtreecommitdiff
path: root/fileaccess
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-02-08 09:18:14 +0100
committersb <sb@openoffice.org>2010-02-08 09:18:14 +0100
commit5e4a461d828cae088818a96355525bd96d033c3f (patch)
tree85ac2a1356764d29f89fac7ec2a4fd47a0b2a8ed /fileaccess
parent954da1067458684f2bac0712caa0cb7fd3726b14 (diff)
parent1813942ec2be139a3cd7992f9e25671b2280334c (diff)
sb118: merged in DEV300_m71
Diffstat (limited to 'fileaccess')
-rw-r--r--fileaccess/source/FileAccess.cxx102
1 files changed, 46 insertions, 56 deletions
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;
}
}
}