summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/deployment/misc/dp_ucb.cxx75
-rw-r--r--fileaccess/source/FileAccess.cxx90
-rw-r--r--fpicker/source/office/fpsmartcontent.cxx35
-rw-r--r--sfx2/source/doc/doctempl.cxx11
-rwxr-xr-xucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java13
5 files changed, 103 insertions, 121 deletions
diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx
index 8a4f55caae..013ba0e2ce 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 5d568dc994..3f387afe4b 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 32a699895f..3ee5166fed 100644
--- a/fpicker/source/office/fpsmartcontent.cxx
+++ b/fpicker/source/office/fpsmartcontent.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
@@ -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>
@@ -127,7 +126,7 @@ namespace svt
if (!m_xCmdEnv.is())
return IHT_NONE;
-
+
return IHT_DEFAULT;
}
@@ -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 5e0a295201..f3e7b789a0 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>
@@ -130,7 +129,7 @@ using namespace ::ucbhelper;
//#define PARAMETER_OLD_TYPEDETECTION "DeepDetection"
#define SERVICENAME_DOCINFO "com.sun.star.document.DocumentProperties"
#define SERVICENAME_DOCTEMPLATES "com.sun.star.frame.DocumentTemplates"
-#define SERVICENAME_DESKTOP "com.sun.star.frame.Desktop"
+#define SERVICENAME_DESKTOP "com.sun.star.frame.Desktop"
//========================================================================
@@ -238,7 +237,7 @@ class SfxDocTemplate_Impl : public SvRefBase
// the following member is intended to prevent clearing of the global data when it is in use
// TODO/LATER: it still does not make the implementation complete thread-safe
- sal_Int32 mnLockCounter;
+ sal_Int32 mnLockCounter;
private:
void Clear();
@@ -247,12 +246,12 @@ public:
SfxDocTemplate_Impl();
~SfxDocTemplate_Impl();
- void IncrementLock();
- void DecrementLock();
+ void IncrementLock();
+ void DecrementLock();
sal_Bool Construct( );
void CreateFromHierarchy( Content &rTemplRoot );
- void ReInitFromComponent();
+ void ReInitFromComponent();
void AddRegion( const OUString& rTitle,
Content& rContent );
diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java
index 8c27a50d6e..8600dcc7f1 100755
--- a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java
+++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java
@@ -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
@@ -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));