summaryrefslogtreecommitdiff
path: root/ucbhelper
diff options
context:
space:
mode:
Diffstat (limited to 'ucbhelper')
-rw-r--r--ucbhelper/inc/makefile.mk52
-rw-r--r--ucbhelper/inc/pch/precompiled_ucbhelper.cxx32
-rw-r--r--ucbhelper/inc/pch/precompiled_ucbhelper.hxx35
-rw-r--r--ucbhelper/inc/ucbhelper/activedatasink.hxx78
-rw-r--r--ucbhelper/inc/ucbhelper/activedatastreamer.hxx73
-rw-r--r--ucbhelper/inc/ucbhelper/cancelcommandexecution.hxx113
-rw-r--r--ucbhelper/inc/ucbhelper/commandenvironment.hxx105
-rw-r--r--ucbhelper/inc/ucbhelper/commandenvironmentproxy.hxx102
-rw-r--r--ucbhelper/inc/ucbhelper/configurationkeys.hxx46
-rw-r--r--ucbhelper/inc/ucbhelper/configureucb.hxx204
-rw-r--r--ucbhelper/inc/ucbhelper/content.hxx1024
-rw-r--r--ucbhelper/inc/ucbhelper/contentbroker.hxx208
-rw-r--r--ucbhelper/inc/ucbhelper/contenthelper.hxx527
-rw-r--r--ucbhelper/inc/ucbhelper/contentidentifier.hxx103
-rw-r--r--ucbhelper/inc/ucbhelper/contentinfo.hxx180
-rw-r--r--ucbhelper/inc/ucbhelper/fileidentifierconverter.hxx130
-rw-r--r--ucbhelper/inc/ucbhelper/handleinteractionrequest.hxx217
-rw-r--r--ucbhelper/inc/ucbhelper/interactionrequest.hxx704
-rw-r--r--ucbhelper/inc/ucbhelper/interceptedinteraction.hxx354
-rw-r--r--ucbhelper/inc/ucbhelper/macros.hxx750
-rw-r--r--ucbhelper/inc/ucbhelper/propertyvalueset.hxx407
-rw-r--r--ucbhelper/inc/ucbhelper/providerhelper.hxx288
-rw-r--r--ucbhelper/inc/ucbhelper/proxydecider.hxx146
-rw-r--r--ucbhelper/inc/ucbhelper/resultset.hxx582
-rw-r--r--ucbhelper/inc/ucbhelper/resultsethelper.hxx223
-rw-r--r--ucbhelper/inc/ucbhelper/resultsetmetadata.hxx479
-rw-r--r--ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx136
-rwxr-xr-xucbhelper/inc/ucbhelper/simplecertificatevalidationrequest.hxx81
-rw-r--r--ucbhelper/inc/ucbhelper/simpleinteractionrequest.hxx99
-rw-r--r--ucbhelper/inc/ucbhelper/simpleioerrorrequest.hxx78
-rw-r--r--ucbhelper/inc/ucbhelper/simplenameclashresolverequest.hxx86
-rw-r--r--ucbhelper/inc/ucbhelper/ucbhelperdllapi.h44
-rw-r--r--ucbhelper/prj/build.lst6
-rw-r--r--ucbhelper/prj/d.lst40
-rw-r--r--ucbhelper/source/client/activedatasink.cxx96
-rw-r--r--ucbhelper/source/client/activedatastreamer.cxx95
-rw-r--r--ucbhelper/source/client/commandenvironment.cxx142
-rw-r--r--ucbhelper/source/client/content.cxx1910
-rw-r--r--ucbhelper/source/client/contentbroker.cxx379
-rw-r--r--ucbhelper/source/client/fileidentifierconverter.cxx110
-rw-r--r--ucbhelper/source/client/interceptedinteraction.cxx204
-rw-r--r--ucbhelper/source/client/makefile.mk64
-rw-r--r--ucbhelper/source/client/proxydecider.cxx864
-rw-r--r--ucbhelper/source/provider/cancelcommandexecution.cxx133
-rw-r--r--ucbhelper/source/provider/commandenvironmentproxy.cxx170
-rw-r--r--ucbhelper/source/provider/configureucb.cxx245
-rw-r--r--ucbhelper/source/provider/contenthelper.cxx1130
-rw-r--r--ucbhelper/source/provider/contentidentifier.cxx224
-rw-r--r--ucbhelper/source/provider/contentinfo.cxx426
-rw-r--r--ucbhelper/source/provider/handleinteractionrequest.cxx167
-rw-r--r--ucbhelper/source/provider/interactionrequest.cxx1126
-rw-r--r--ucbhelper/source/provider/makefile.mk76
-rw-r--r--ucbhelper/source/provider/propertyvalueset.cxx926
-rw-r--r--ucbhelper/source/provider/provconf.cxx269
-rw-r--r--ucbhelper/source/provider/provconf.hxx55
-rw-r--r--ucbhelper/source/provider/providerhelper.cxx675
-rw-r--r--ucbhelper/source/provider/registerucb.cxx205
-rw-r--r--ucbhelper/source/provider/registerucb.hxx99
-rw-r--r--ucbhelper/source/provider/resultset.cxx1698
-rw-r--r--ucbhelper/source/provider/resultsethelper.cxx332
-rw-r--r--ucbhelper/source/provider/resultsetmetadata.cxx605
-rw-r--r--ucbhelper/source/provider/simpleauthenticationrequest.cxx153
-rwxr-xr-xucbhelper/source/provider/simplecertificatevalidationrequest.cxx91
-rw-r--r--ucbhelper/source/provider/simpleinteractionrequest.cxx135
-rw-r--r--ucbhelper/source/provider/simpleioerrorrequest.cxx63
-rw-r--r--ucbhelper/source/provider/simplenameclashresolverequest.cxx70
-rw-r--r--ucbhelper/util/makefile.mk79
-rw-r--r--ucbhelper/util/makefile.pmk35
-rw-r--r--ucbhelper/util/ucbhelper.flt181
-rw-r--r--ucbhelper/util/ucbhelper.xml114
-rw-r--r--ucbhelper/version.mk46
-rw-r--r--ucbhelper/workben/myucp/exports.map8
-rw-r--r--ucbhelper/workben/myucp/makefile.mk93
-rw-r--r--ucbhelper/workben/myucp/myucp_content.cxx986
-rw-r--r--ucbhelper/workben/myucp/myucp_content.hxx194
-rw-r--r--ucbhelper/workben/myucp/myucp_contentcaps.cxx226
-rw-r--r--ucbhelper/workben/myucp/myucp_datasupplier.cxx401
-rw-r--r--ucbhelper/workben/myucp/myucp_datasupplier.hxx80
-rw-r--r--ucbhelper/workben/myucp/myucp_provider.cxx174
-rw-r--r--ucbhelper/workben/myucp/myucp_provider.hxx98
-rw-r--r--ucbhelper/workben/myucp/myucp_resultset.cxx100
-rw-r--r--ucbhelper/workben/myucp/myucp_resultset.hxx65
-rw-r--r--ucbhelper/workben/myucp/myucp_services.cxx139
-rw-r--r--ucbhelper/workben/ucbexplorer/bmp/document.bmpbin0 -> 1318 bytes
-rw-r--r--ucbhelper/workben/ucbexplorer/bmp/fldclose.bmpbin0 -> 298 bytes
-rw-r--r--ucbhelper/workben/ucbexplorer/bmp/fldopen.bmpbin0 -> 322 bytes
-rw-r--r--ucbhelper/workben/ucbexplorer/bmp/link.bmpbin0 -> 1318 bytes
-rw-r--r--ucbhelper/workben/ucbexplorer/makefile.mk75
-rw-r--r--ucbhelper/workben/ucbexplorer/ucbexplorer.cxx1199
-rw-r--r--ucbhelper/workben/ucbexplorer/ucbexplorer.hrc68
-rw-r--r--ucbhelper/workben/ucbexplorer/ucbexplorer.src159
91 files changed, 25189 insertions, 0 deletions
diff --git a/ucbhelper/inc/makefile.mk b/ucbhelper/inc/makefile.mk
new file mode 100644
index 000000000000..8cbc2fe60678
--- /dev/null
+++ b/ucbhelper/inc/makefile.mk
@@ -0,0 +1,52 @@
+#*************************************************************************
+#
+# 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
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.3 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..
+
+PRJNAME=ucbhelper
+TARGET=inc
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.IF "$(ENABLE_PCH)"!=""
+ALLTAR : \
+ $(SLO)$/precompiled.pch \
+ $(SLO)$/precompiled_ex.pch
+
+.ENDIF # "$(ENABLE_PCH)"!=""
+
diff --git a/ucbhelper/inc/pch/precompiled_ucbhelper.cxx b/ucbhelper/inc/pch/precompiled_ucbhelper.cxx
new file mode 100644
index 000000000000..77ad420e3821
--- /dev/null
+++ b/ucbhelper/inc/pch/precompiled_ucbhelper.cxx
@@ -0,0 +1,32 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: precompiled_ucbhelper.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_ucbhelper.hxx"
+
diff --git a/ucbhelper/inc/pch/precompiled_ucbhelper.hxx b/ucbhelper/inc/pch/precompiled_ucbhelper.hxx
new file mode 100644
index 000000000000..0b9b1340ae12
--- /dev/null
+++ b/ucbhelper/inc/pch/precompiled_ucbhelper.hxx
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: precompiled_ucbhelper.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): Generated on 2006-09-01 17:50:16.373334
+
+#ifdef PRECOMPILED_HEADERS
+#endif
+
diff --git a/ucbhelper/inc/ucbhelper/activedatasink.hxx b/ucbhelper/inc/ucbhelper/activedatasink.hxx
new file mode 100644
index 000000000000..3ca863ae79e4
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/activedatasink.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: activedatasink.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_ACTIVEDATASINK_HXX
+#define _UCBHELPER_ACTIVEDATASINK_HXX
+
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <cppuhelper/weak.hxx>
+#include <ucbhelper/macros.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace ucbhelper
+{
+
+//=========================================================================
+
+/**
+ * This class implements the interface com::sun::star::io::XActiveDataSink.
+ * Instances of this class can be passed with the parameters of an
+ * "open" command.
+ */
+
+class UCBHELPER_DLLPUBLIC ActiveDataSink : public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::io::XActiveDataSink
+{
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > m_xStream;
+
+public:
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XActiveDataSink methods.
+ virtual void SAL_CALL
+ setInputStream( const com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream >& aStream )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > SAL_CALL
+ getInputStream()
+ throw( com::sun::star::uno::RuntimeException );
+};
+
+} /* namespace ucbhelper */
+
+#endif /* !_UCBHELPER_ACTIVEDATASINK_HXX */
diff --git a/ucbhelper/inc/ucbhelper/activedatastreamer.hxx b/ucbhelper/inc/ucbhelper/activedatastreamer.hxx
new file mode 100644
index 000000000000..f1d823199de4
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/activedatastreamer.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: activedatastreamer.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_ACTIVEDATASTREAMER_HXX
+#define _UCBHELPER_ACTIVEDATASTREAMER_HXX
+
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/io/XActiveDataStreamer.hpp>
+#include <cppuhelper/weak.hxx>
+#include <ucbhelper/macros.hxx>
+
+namespace ucbhelper
+{
+
+//=========================================================================
+
+/**
+ * This class implements the interface com::sun::star::io::XActiveDataStreamer.
+ * Instances of this class can be passed with the parameters of an
+ * "open" command.
+ */
+
+class ActiveDataStreamer : public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::io::XActiveDataStreamer
+{
+ com::sun::star::uno::Reference<
+ com::sun::star::io::XStream > m_xStream;
+
+public:
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XActiveDataStreamer methods.
+ virtual void SAL_CALL setStream( const com::sun::star::uno::Reference< com::sun::star::io::XStream >& xStream )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference< com::sun::star::io::XStream > SAL_CALL getStream()
+ throw( com::sun::star::uno::RuntimeException );
+};
+
+} /* namespace ucbhelper */
+
+#endif /* !_UCBHELPER_ACTIVEDATASTREAMER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/cancelcommandexecution.hxx b/ucbhelper/inc/ucbhelper/cancelcommandexecution.hxx
new file mode 100644
index 000000000000..89dca8edd4d7
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/cancelcommandexecution.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: cancelcommandexecution.hxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CANCELCOMMANDEXECUTION_HXX_
+#define _UCBHELPER_CANCELCOMMANDEXECUTION_HXX_
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/ucb/IOErrorCode.hpp>
+#include <com/sun/star/ucb/XCommandProcessor.hpp>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace uno { class Any; }
+ namespace ucb { class XCommandEnvironment; }
+} } }
+
+namespace ucbhelper
+{
+
+//============================================================================
+/** Cancel the execution of a command by throwing the appropriate exception.
+ If an Interaction Handler is given with the command environment and the
+ handler handles the exception by selecting the supplied continuation,
+ then this function will put the original exception supplied into a
+ com::sun::star::ucb::CommandFailedException and throw the
+ CommandFailedException. If no handler was given or the handler was not
+ able to handle the exception, then the given exception will be thrown
+ directly.
+
+ NOTE THAT THIS FUNCTION NEVER RETURNS! IT ALWAYS THROWS AN EXCEPTION!
+
+ @param rException is the exception describing the error to handle.
+
+ @param xEnv is the command environment that may contain an Interaction
+ Handler to use before throwing the appropriate exception.
+ */
+UCBHELPER_DLLPUBLIC void cancelCommandExecution( const com::sun::star::uno::Any & rException,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > &
+ xEnv )
+ throw( com::sun::star::uno::Exception );
+
+/** Cancel the execution of a command by throwing the appropriate exception.
+ If an Interaction Handler is given with the command environment and the
+ handler handles the exception by selecting the supplied continuation,
+ then this function will put the original exception supplied into a
+ com::sun::star::ucb::CommandFailedException and throw the
+ CommandFailedException. If no handler was given or the handler was not
+ able to handle the exception, then the given exception will be thrown
+ directly.
+
+ NOTE THAT THIS FUNCTION NEVER RETURNS! IT ALWAYS THROWS AN EXCEPTION!
+
+ @param eError is an IO error code.
+
+ @param rArgs is a sequeence containing the arguments to pass along with
+ the exception. Each IO error code can be combined with one or
+ more additional arguments. Refer to com/sun/star/ucb/IOErroprCode.idl
+ for details.
+
+ @param xEnv is the command environment that may contain an Interaction
+ Handler to use before throwing the appropriate exception.
+
+ @param rMessage is a text containing additional error information.
+ Used as debugging aid only. Passed to the member 'Message' of the
+ uno::Exception thrown by this function.
+
+ @param xContext is the command processor executing the command to cancel.
+ Used as debugging aid only. Passed to the member 'Context' of the
+ uno::Exception thrown by this function.
+ */
+UCBHELPER_DLLPUBLIC void cancelCommandExecution( const com::sun::star::ucb::IOErrorCode eError,
+ const com::sun::star::uno::Sequence<
+ com::sun::star::uno::Any > & rArgs,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > &
+ xEnv,
+ const rtl::OUString & rMessage = rtl::OUString(),
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandProcessor > &
+ xContext = 0 )
+ throw( com::sun::star::uno::Exception );
+}
+
+#endif // _UCBHELPER_CANCELCOMMANDEXECUTION_HXX_
diff --git a/ucbhelper/inc/ucbhelper/commandenvironment.hxx b/ucbhelper/inc/ucbhelper/commandenvironment.hxx
new file mode 100644
index 000000000000..e5ebc300bca1
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/commandenvironment.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: commandenvironment.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_COMMANDENVIRONMENT_HXX
+#define _UCBHELPER_COMMANDENVIRONMENT_HXX
+
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#ifndef _COM_SUN_STAR_UCB_XCOMMMANDENVIRONMENT_HPP_
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#endif
+#include <cppuhelper/weak.hxx>
+#include <ucbhelper/macros.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace ucbhelper
+{
+
+struct CommandEnvironment_Impl;
+
+//=========================================================================
+
+/**
+ * This class implements the interface
+ * com::sun::star::ucb::XCommandEnvironement. Instances of this class can
+ * be used to supply environments to commands executed by UCB contents.
+ */
+class UCBHELPER_DLLPUBLIC CommandEnvironment : public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::ucb::XCommandEnvironment
+{
+ CommandEnvironment_Impl* m_pImpl;
+
+private:
+ UCBHELPER_DLLPRIVATE CommandEnvironment( const CommandEnvironment& ); // n.i.
+ UCBHELPER_DLLPRIVATE CommandEnvironment& operator=( const CommandEnvironment& ); // n.i.
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rxInteractionHandler is the implementation of an Interaction
+ * Handler or an empty reference.
+ * @param rxProgressHandler is the implementation of a Progress
+ * Handler or an empty reference.
+ */
+ CommandEnvironment(
+ const com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler >&
+ rxInteractionHandler,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XProgressHandler >&
+ rxProgressHandler );
+ /**
+ * Destructor.
+ */
+ virtual ~CommandEnvironment();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XCommandEnvironemnt
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler > SAL_CALL
+ getInteractionHandler()
+ throw ( com::sun::star::uno::RuntimeException );
+
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XProgressHandler > SAL_CALL
+ getProgressHandler()
+ throw ( com::sun::star::uno::RuntimeException );
+};
+
+} /* namespace ucbhelper */
+
+#endif /* !_UCBHELPER_COMMANDENVIRONMENT_HXX */
diff --git a/ucbhelper/inc/ucbhelper/commandenvironmentproxy.hxx b/ucbhelper/inc/ucbhelper/commandenvironmentproxy.hxx
new file mode 100644
index 000000000000..d0839805817c
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/commandenvironmentproxy.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: commandenvironmentproxy.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_COMMANDENVIRONMENTPROXY_HXX
+#define _UCBHELPER_COMMANDENVIRONMENTPROXY_HXX
+
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#ifndef _COM_SUN_STAR_UCB_XCOMMMANDENVIRONMENT_HPP_
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#endif
+#include <cppuhelper/weak.hxx>
+#include <ucbhelper/macros.hxx>
+
+namespace ucbhelper
+{
+
+struct CommandEnvironmentProxy_Impl;
+
+//=========================================================================
+
+/**
+ * This class implements the interface
+ * com::sun::star::ucb::XCommandEnvironement.
+ *
+ * Instances of this class can be used to create a (local) proxy for (remote)
+ * command environment implementations. This implementation caches the
+ * (remote) interfaces supplied by the given environment in order to avoid the
+ * overhead produced by multiple (remote) calls to methods of the given
+ * (remote) command environment.
+ */
+class CommandEnvironmentProxy : public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::ucb::XCommandEnvironment
+{
+ CommandEnvironmentProxy_Impl* m_pImpl;
+
+private:
+ CommandEnvironmentProxy( const CommandEnvironmentProxy& ); // n.i.
+ CommandEnvironmentProxy& operator=( const CommandEnvironmentProxy& ); // n.i.
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rxEnv is the implementation of a (remote) command environment.
+ */
+ CommandEnvironmentProxy(
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& rxEnv );
+ /**
+ * Destructor.
+ */
+ virtual ~CommandEnvironmentProxy();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XCommandEnvironemnt
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionHandler > SAL_CALL
+ getInteractionHandler()
+ throw ( com::sun::star::uno::RuntimeException );
+
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XProgressHandler > SAL_CALL
+ getProgressHandler()
+ throw ( com::sun::star::uno::RuntimeException );
+};
+
+} /* namespace ucbhelper */
+
+#endif /* !_UCBHELPER_COMMANDENVIRONMENTPROXY_HXX */
diff --git a/ucbhelper/inc/ucbhelper/configurationkeys.hxx b/ucbhelper/inc/ucbhelper/configurationkeys.hxx
new file mode 100644
index 000000000000..3415146003b9
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/configurationkeys.hxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: configurationkeys.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONFIGURATIONKEYS_HXX_
+#define _UCBHELPER_CONFIGURATIONKEYS_HXX_
+
+//============================================================================
+/** Various primary and secondary keys under which UCB configurations can be
+ accessed in the configuration database.
+ */
+#define UCB_CONFIGURATION_KEY1_LOCAL "Local"
+#define UCB_CONFIGURATION_KEY1_SERVER "Server"
+#define UCB_CONFIGURATION_KEY2_UNIVERSAL_CONTENT_BROKER \
+ "UniversalContentBroker"
+#define UCB_CONFIGURATION_KEY2_OFFICE "Office"
+#define UCB_CONFIGURATION_KEY2_WEB_SERVER "WebServer"
+#define UCB_CONFIGURATION_KEY2_CLIENT_ACCESS "ClientAccess"
+
+#endif // _UCBHELPER_CONFIGURATIONKEYS_HXX_
diff --git a/ucbhelper/inc/ucbhelper/configureucb.hxx b/ucbhelper/inc/ucbhelper/configureucb.hxx
new file mode 100644
index 000000000000..479130c0624f
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/configureucb.hxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: configureucb.hxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONFIGUREUCB_HXX_
+#define _UCBHELPER_CONFIGUREUCB_HXX_
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ustring.hxx>
+
+#include <vector>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace lang { class XMultiServiceFactory; }
+ namespace ucb {
+ class XContentProvider;
+ class XContentProviderManager;
+ }
+ namespace uno { class Any; }
+} } }
+
+namespace ucbhelper {
+
+//============================================================================
+/** Information about a registered content provider, passed from
+ <method>configureUcb</method> to <method>unconfigureUcb</method> (and from
+ <method>registerAtUcb</method> to <method>deregisterFromUcb</method>).
+ */
+struct ContentProviderRegistrationInfo
+{
+ /** The registered content provider (or null if registration failed).
+ */
+ com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider >
+ m_xProvider;
+
+ /** The arguments the content provider was instantiated with.
+ */
+ rtl::OUString m_aArguments;
+
+ /** The URL template the content provider is registered on.
+ */
+ rtl::OUString m_aTemplate;
+};
+ //@@@ if registerucb.hxx were exported, too, this might better reside in
+ // there...
+
+typedef std::vector< ContentProviderRegistrationInfo >
+ ContentProviderRegistrationInfoList;
+
+//============================================================================
+/** Information about a content provider, passed to
+ <method>configureUcb</method>.
+ */
+struct ContentProviderData
+{
+ /** The UNO service name to use to instanciate the content provider.
+ */
+ rtl::OUString ServiceName;
+
+ /** The URL template to use to instanciate the content provider.
+ */
+ rtl::OUString URLTemplate;
+
+ /** The arguments to use to instanciate the content provider.
+ */
+ rtl::OUString Arguments;
+
+ ContentProviderData() {};
+ ContentProviderData( const rtl::OUString & rService,
+ const rtl::OUString & rTemplate,
+ const rtl::OUString & rArgs )
+ : ServiceName( rService ), URLTemplate( rTemplate ), Arguments( rArgs ) {}
+};
+
+typedef std::vector< ContentProviderData > ContentProviderDataList;
+
+//============================================================================
+/** Configure a (newly instantiated) Universal Content Broker.
+
+ @descr This function tries to register at the given content provider
+ manager all the content provider services listed under a given key in the
+ configuration database.
+
+ @param rManager A content provider manager (normally, this would be a
+ newly intantiated UCB).
+
+ @param rServiceFactory A service factory through which to obtain the
+ various services required.
+
+ @param rData A list containing the data for the content providers for
+ the UCB to configure.
+
+ @pInfos If not null, an entry will be added to this vector for every
+ content provider that is registered (sucessfully or not).
+
+ @return True if the UCB has successfuly been configured (though not all
+ content providers have necessarily been registered due to individual
+ problems).
+ */
+bool
+configureUcb(
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentProviderManager > const &
+ rManager,
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const &
+ rServiceFactory,
+ ContentProviderDataList const & rData,
+ ContentProviderRegistrationInfoList * pInfos)
+ throw (com::sun::star::uno::RuntimeException);
+
+
+//============================================================================
+/** Configure a (newly instantiated) Universal Content Broker.
+
+ @descr This function tries to register at the given content provider
+ manager all the content provider services listed under a given key in the
+ configuration database.
+
+ @param rManager A content provider manager (normally, this would be a
+ newly intantiated UCB).
+
+ @param rServiceFactory A service factory through which to obtain the
+ various services required.
+
+ @param rArguments A sequence of at least two strings: the primary and
+ secondary key addressing a chosen UCB configuration in the configuration
+ database. The sequence can be longer, in which case the excess elements
+ must be strings that form key/value pairs. These key/value pairs will be
+ used to replace placeholders in the data from the configuration database
+ with (dynamic) values. This is a (rather unstructured) sequence of
+ <type>Any<type/>s, since normally this parameter will simply be forwarded
+ by the UCB's <method>initialize<method/> method, which has a parameter of
+ the same type.
+
+ @pInfos If not null, an entry will be added to this vector for every
+ content provider that is registered (sucessfully or not).
+
+ @return True if the UCB has successfuly been configured (though not all
+ content providers have necessarily been registered due to individual
+ problems).
+ */
+UCBHELPER_DLLPUBLIC bool
+configureUcb(
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentProviderManager > const &
+ rManager,
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const &
+ rServiceFactory,
+ com::sun::star::uno::Sequence< com::sun::star::uno::Any > const &
+ rArguments,
+ std::vector< ContentProviderRegistrationInfo > * pInfos)
+ throw (com::sun::star::uno::RuntimeException);
+
+//============================================================================
+/** Undo the configuration of a Universal Content Broker.
+
+ @descr This function is the reverse of <method>configureUcb</method>.
+
+ @param rManager A content provider manager.
+
+ @param rInfos Information about all the registered content providers.
+ */
+void
+unconfigureUcb(
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentProviderManager > const &
+ rManager,
+ std::vector< ContentProviderRegistrationInfo > const & rInfos)
+ throw (com::sun::star::uno::RuntimeException);
+
+}
+
+#endif // _UCBHELPER_CONFIGUREUCB_HXX_
diff --git a/ucbhelper/inc/ucbhelper/content.hxx b/ucbhelper/inc/ucbhelper/content.hxx
new file mode 100644
index 000000000000..03cfa0bc8290
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/content.hxx
@@ -0,0 +1,1024 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: content.hxx,v $
+ * $Revision: 1.20 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UCBHELPER_CONTENT_HXX
+#define _UCBHELPER_CONTENT_HXX
+
+#include "rtl/ref.hxx"
+#include <com/sun/star/ucb/ContentCreationException.hpp>
+#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace beans {
+ class XPropertySetInfo;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace io {
+ class XActiveDataSink;
+ class XOutputStream;
+ class XInputStream;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace sdbc {
+ class XResultSet;
+ class XRow;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class XCommandEnvironment;
+ class XCommandInfo;
+ class XContent;
+ class XContentIdentifier;
+ class XDynamicResultSet;
+ class XAnyCompareFactory;
+ struct NumberedSortingInfo;
+} } } }
+
+namespace ucbhelper
+{
+
+//=========================================================================
+
+/**
+ * These are the possible values for the parameter eMode of method
+ * ucb::Content::createCursor.
+ */
+enum ResultSetInclude
+{
+ INCLUDE_FOLDERS_ONLY,
+ INCLUDE_DOCUMENTS_ONLY,
+ INCLUDE_FOLDERS_AND_DOCUMENTS
+};
+
+/**
+ * These are the possible values for the parameter eOperation of method
+ * ucb::Content::insertNewContent.
+ */
+enum InsertOperation
+{
+ InsertOperation_COPY, // copy source data
+ InsertOperation_MOVE, // move source data
+ InsertOperation_LINK // create a link to source
+};
+
+//=========================================================================
+
+class Content_Impl;
+
+/**
+ * This class simplifies access to UCB contents by providing a more
+ * convenient API for frequently used functionality then the "raw"
+ * UCB-API does.
+ */
+class UCBHELPER_DLLPUBLIC Content
+{
+ rtl::Reference< Content_Impl > m_xImpl;
+
+protected:
+ ::com::sun::star::uno::Any createCursorAny( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ ResultSetInclude eMode )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ ::com::sun::star::uno::Any createCursorAny( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+public:
+ /**
+ * Constructor.
+ */
+ Content();
+
+ /**
+ * Constructor.
+ *
+ * @param rURL is the URL of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ */
+ Content( const rtl::OUString& rURL,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv )
+ throw ( ::com::sun::star::ucb::ContentCreationException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Constructor.
+ *
+ * @param rId is the content identifier of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ */
+ Content( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& rId,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv )
+ throw ( ::com::sun::star::ucb::ContentCreationException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Constructor.
+ *
+ * @param rContent is the content object of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ */
+ Content( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContent >& rContent,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv )
+ throw ( ::com::sun::star::ucb::ContentCreationException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Copy Constructor.
+ *
+ * @param rContent is the content this content shall be a copy of.
+ */
+ Content( const Content& rOther );
+
+ /**
+ * Destructor.
+ */
+ ~Content();
+
+ /**
+ * Assignment operator.
+ *
+ * @param rContent is the content this content shall be a copy of.
+ */
+ Content& operator=( const Content& rOther );
+
+ /**
+ * Constructor. This method should be used, if the exception thrown
+ * by the direct ctors of this class are to 'expensive' for your
+ * application
+ *
+ * @param rURL is the URL of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ * @param rContent will be filled by this method with the content created.
+ * @return true, if the operation was successful - false, otherwise.
+ */
+ static sal_Bool
+ create( const rtl::OUString& rURL,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv,
+ Content& rContent );
+
+ /**
+ * Constructor. This method should be used, if the exception thrown
+ * by the direct ctors of this class are to 'expensive' for your
+ * application
+ *
+ * @param rId is the content identifier of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ * @param rContent will be filled by this method with the content created.
+ * @return true, if the operation was successful - false, otherwise.
+ */
+ static sal_Bool
+ create( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& rId,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv,
+ Content& rContent );
+
+ /**
+ * Constructor. This method should be used, if the exception thrown
+ * by the direct ctors of this class are to 'expensive' for your
+ * application
+ *
+ * @param xContent is the content object of the content to create.
+ * @param rEnv is the environment to use for commands executed by the
+ * content. The command environment is used by the content
+ * implementation to interact with the client and to propagate
+ * errors.
+ * @param rContent will be filled by this method with the content created.
+ * @return true, if the operation was successful - false, otherwise.
+ */
+ static sal_Bool
+ create( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContent >& xContent,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& rEnv,
+ Content& rContent );
+
+ //////////////////////////////////////////////////////////////////////
+ // Direct access to UCB content.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method provides access to the "native" UCB content interface(s).
+ * This is usefull in case the convenience methods provided by this
+ * class are insufficient for your needs. You may obtain all interfaces
+ * supported by the underlying UCB content by calling this method and
+ * after that doing a queryInterface call.
+ *
+ * @return the XContent interface of the underlying UCB content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >
+ get() const;
+
+ //////////////////////////////////////////////////////////////////////
+ // Object identity.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns the URL of the content.
+ *
+ * @return the URL of the content.
+ */
+ const ::rtl::OUString& getURL() const;
+
+ //////////////////////////////////////////////////////////////////////
+ // Command environment.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns the environment to use when executing commands.
+ *
+ * @return the command environment.
+ */
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >&
+ getCommandEnvironment() const;
+
+ /**
+ * This method sets a new command environment.
+ *
+ * @param xNewEnv is the new command environment.
+ */
+ void setCommandEnvironment(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& xNewEnv );
+
+ //////////////////////////////////////////////////////////////////////
+ // Access to supported commands/properties.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This methods provides access to meta data of the commands supported
+ * by this content.
+ *
+ * @return an XCommandInfo interface implementation, which can be used
+ * to obtain meta data of the commands supported by this content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandInfo >
+ getCommands()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods provides access to meta data of the properties supported
+ * by this content.
+ *
+ * @return an XPropertSetInfo interface implementation, which can be used
+ * to obtain meta data of the properties supported by this content.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo >
+ getProperties()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ //////////////////////////////////////////////////////////////////////
+ // Access to property value(s).
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method can be used to read a single property value.
+ *
+ * @param rPropertyName is the name of the property for that the value
+ * shall be obtained.
+ * @return the property value.
+ */
+ ::com::sun::star::uno::Any
+ getPropertyValue( const rtl::OUString& rPropertyName )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read a single property value.
+ *
+ * @param nPropertyHande is the handle of the property for that the
+ * value shall be obtained.
+ * @return the property value.
+ */
+ ::com::sun::star::uno::Any
+ getPropertyValue( sal_Int32 nPropertyHandle )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to set a single property value.
+ *
+ * @param rPropertyName is the name of the property for that the
+ * value shall be set.
+ * @return an any containing:
+ * - No value indicates, that the property value was set
+ * successfully.
+ * - com::sun::star::beans::UnknownPropertyException indicates,
+ * that the property is not known to the content implementation.
+ * - com::sun::star::beans::IllegalTypeException indicates, that
+ * the data type of the property value is not acceptable.
+ * - com::sun::star::lang::IllegalAccessException indicates, that
+ * the property is constant.
+ * - com::sun::star::lang::IllegalArgumentException indicates,
+ * that the property value is not acceptable. For instance,
+ * setting an empty title may be illegal.
+ * - Any other execption derived from
+ * com::sun::star::uno::Exception indicates, that the value was
+ * not set successfully. For example, this can be a
+ * com::sun:star::ucb::InteractiveAugmentedIOException
+ * transporting the error code
+ * com::sun::star::ucb::IOErrorCode::ACCESS_DENIED.
+ */
+ ::com::sun::star::uno::Any
+ setPropertyValue( const rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rValue )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to set a single property value.
+ *
+ * @param nPropertyHande is the handle of the property for that the
+ * value shall be set.
+ * @return an any containing:
+ * - No value indicates, that the property value was set
+ * successfully.
+ * - com::sun::star::beans::UnknownPropertyException indicates,
+ * that the property is not known to the content implementation.
+ * - com::sun::star::beans::IllegalTypeException indicates, that
+ * the data type of the property value is not acceptable.
+ * - com::sun::star::lang::IllegalAccessException indicates, that
+ * the property is constant.
+ * - com::sun::star::lang::IllegalArgumentException indicates,
+ * that the property value is not acceptable. For instance,
+ * setting an empty title may be illegal.
+ * - Any other execption derived from
+ * com::sun::star::uno::Exception indicates, that the value was
+ * not set successfully. For example, this can be a
+ * com::sun:star::ucb::InteractiveAugmentedIOException
+ * transporting the error code
+ * com::sun::star::ucb::IOErrorCode::ACCESS_DENIED.
+ */
+ ::com::sun::star::uno::Any
+ setPropertyValue( const sal_Int32 nPropertyHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values shall be obtained.
+ * @return the property values.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ getPropertyValues( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param nPropertyHandles is a sequence of handles of properties for
+ * that the values shall be obtained.
+ * @return an XRow interface that can be used to obtain the property
+ * values.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ getPropertyValues( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values shall be obtained.
+ * @return the property values.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
+ getPropertyValuesInterface( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to read multiple property values.
+ *
+ * @param nPropertyHandles is a sequence of handles of properties for
+ * that the values shall be obtained.
+ * @return an XRow interface that can be used to obtain the property
+ * values.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
+ getPropertyValuesInterface( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to set multiple property values.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that values shall be set.
+ * @return a sequence of any's which has exactly the same number
+ * of elements as the number of properties to set. Every
+ * sequence element contains the status for a property. The
+ * first sequence elements corresponds to the first element in
+ * the sequence of property names and so on.
+ *
+ * An any containing:
+ * - No value indicates, that the property value was set
+ * successfully.
+ * - com::sun::star::beans::UnknownPropertyException indicates,
+ * that the property is not known to the content implementation.
+ * - com::sun::star::beans::IllegalTypeException indicates, that
+ * the data type of the property value is not acceptable.
+ * - com::sun::star::lang::IllegalAccessException indicates, that
+ * the property is constant.
+ * - com::sun::star::lang::IllegalArgumentException indicates,
+ * that the property value is not acceptable. For instance,
+ * setting an empty title may be illegal.
+ * - Any other execption derived from
+ * com::sun::star::uno::Exception indicates, that the value was
+ * not set successfully. For example, this can be a
+ * com::sun:star::ucb::InteractiveAugmentedIOException
+ * transporting the error code
+ * com::sun::star::ucb::IOErrorCode::ACCESS_DENIED.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ setPropertyValues( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rValues )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to set multiple property values.
+ *
+ * @param nPropertyHandles is a sequence of handles of properties for
+ * that values shall be set.
+ * @return a sequence of any's which has exactly the same number
+ * of elements as the number of properties to set. Every
+ * sequence element contains the status for a property. The
+ * first sequence elements corresponds to the first element in
+ * the sequence of property names and so on.
+ *
+ * An any containing:
+ * - No value indicates, that the property value was set
+ * successfully.
+ * - com::sun::star::beans::UnknownPropertyException indicates,
+ * that the property is not known to the content implementation.
+ * - com::sun::star::beans::IllegalTypeException indicates, that
+ * the data type of the property value is not acceptable.
+ * - com::sun::star::lang::IllegalAccessException indicates, that
+ * the property is constant.
+ * - com::sun::star::lang::IllegalArgumentException indicates,
+ * that the property value is not acceptable. For instance,
+ * setting an empty title may be illegal.
+ * - Any other execption derived from
+ * com::sun::star::uno::Exception indicates, that the value was
+ * not set successfully. For example, this can be a
+ * com::sun:star::ucb::InteractiveAugmentedIOException
+ * transporting the error code
+ * com::sun::star::ucb::IOErrorCode::ACCESS_DENIED.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ setPropertyValues( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rValues )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ //////////////////////////////////////////////////////////////////////
+ // General command execution.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method can be used to execute any command supported by the
+ * content.
+ *
+ * @param rCommandName is the name of the command to execute.
+ * @param rCommandArgument is the argument for the command. Type and
+ * values of this parameter must correspond to the command
+ * specification.
+ * @return the result of the command according to its specification.
+ */
+ ::com::sun::star::uno::Any
+ executeCommand( const rtl::OUString& rCommandName,
+ const ::com::sun::star::uno::Any& rCommandArgument )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ ::com::sun::star::uno::Any
+ /**
+ * This method can be used to execute any command supported by the
+ * content.
+ *
+ * @param rCommandHandle is the handle of the command to execute.
+ * @param rCommandArgument is the argument for the command. Type and
+ * values of this parameter must correspond to the command
+ * specification.
+ * @return the result of the command according to its specification.
+ */
+ executeCommand( sal_Int32 nCommandHandle,
+ const ::com::sun::star::uno::Any& rCommandArgument )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method can be used to abort the command currently executed by
+ * a content. Note that a content can only process one command per
+ * thread at a time. The implementation of the content is responsible
+ * for determining the command to abort when this method is called.
+ */
+ void
+ abortCommand();
+
+ //////////////////////////////////////////////////////////////////////
+ // Special commands.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values should be accessible via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.ContentResultSet, which can be used to
+ * get access to the children of a content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
+ createCursor( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param nPropertyHandles is a sequence of handles of properties for
+ * that the values should be accessible via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.ContentResultSet, which can be used to
+ * get access to the children of a content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
+ createCursor( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rPropertyNames is a sequence of names of properties for
+ * that the values should be accessible via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.DynamicResultSet, which can be used to
+ * get access to the children of a content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet >
+ createDynamicCursor( const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ ResultSetInclude eMode
+ = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives access to the children of a folder content.
+ * Additionally, the result set returned provides efficient access to
+ * preselected property values of the children.
+ * Internally it executes the command "open" at the content.
+ *
+ * @param nPropertyHandes is a sequence of handles of properties for
+ * that the values should be accessible via the resultset
+ * returned by this method.
+ * @param eMode is a very simple filter for the children contained
+ * in the resultset.
+ * @return an implementation of the service
+ * com.cun.star.ucb.DynamicResultSet, which can be used to
+ * get access to the children of a content.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet >
+ createDynamicCursor( const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode
+ = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet >
+ createSortedDynamicCursor( const ::com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo,
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompareFactory > rAnyCompareFactory,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet >
+ createSortedDynamicCursor( const ::com::sun::star::uno::Sequence< sal_Int32 >& rPropertyHandles,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo,
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompareFactory > rAnyCompareFactory,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
+ createSortedCursor( const ::com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo,
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompareFactory > rAnyCompareFactory,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
+ createSortedCursor( const ::com::sun::star::uno::Sequence< sal_Int32 >& rPropertyHandles,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo,
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompareFactory > rAnyCompareFactory,
+ ResultSetInclude eMode = INCLUDE_FOLDERS_AND_DOCUMENTS )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @return an implementation of the interface XInputStream, which can
+ * be used to read the content's data.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openStream()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ * The method requests opening without locking.
+ *
+ * @return an implementation of the interface XInputStream, which can
+ * be used to read the content's data.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openStreamNoLock()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ /**
+ * This methods gives read/write access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @return an implementation of the interface XStream, which can
+ * be used to read/write the content's data.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >
+ openWriteableStream()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives read/write access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ * The method requests opening without locking.
+ *
+ * @return an implementation of the interface XStream, which can
+ * be used to read/write the content's data.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >
+ openWriteableStreamNoLock()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rSink is the implementation of an XActiveDataSink interface,
+ * which shall be used by the content to deliver the data.
+ */
+ sal_Bool
+ openStream( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XActiveDataSink >& rSink )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives read access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "open" at the content.
+ *
+ * @param rStream is the implementation of an XOutputStream interface,
+ * which shall be used by the content to deliver the data.
+ */
+ sal_Bool
+ openStream( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XOutputStream >& rStream )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This methods gives write access to the content stream of a content (i.e
+ * the content of a file located at the local file system).
+ * Internally it executes the command "insert" at the content.
+ *
+ * @param rStream is the implementation of an XInputStream interface,
+ * which contains the content data to write.
+ * @param bReplaceExisting specifies, whether any existing content data
+ * shall be overwritten.
+ */
+ void
+ writeStream( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >& rStream,
+ sal_Bool bReplaceExisting )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method creates, initializes and inserts ( commits ) a new content
+ * (i.e. it could be used to create a new file system folder).
+ * Internally this method does a XContentCreator::createNewContent(...)-
+ * XCommandProcessor::execute( "setPropertyValues", ... )-
+ * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its contnt
+ * objects.
+ * @param rPropertyNames is a sequence of names of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( commited ).
+ * The order of the names must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( commited ).
+ * The order of the values must correspond to the order of the
+ * property names.
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ */
+ sal_Bool
+ insertNewContent( const ::rtl::OUString& rContentType,
+ const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rPropertyValues,
+ Content& rNewContent )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method creates, initializes and inserts ( commits ) a new content
+ * (i.e. it could be used to create a new file system folder).
+ * Internally this method does a XContentCreator::createNewContent(...)-
+ * XCommandProcessor::execute( "setPropertyValues", ... )-
+ * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its contnt
+ * objects.
+ * @param nPropertyHandes is a sequence of handles of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( commited ).
+ * The order of the handles must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( commited ).
+ * The order of the values must correspond to the order of the
+ * property handles.
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ */
+ sal_Bool
+ insertNewContent( const ::rtl::OUString& rContentType,
+ const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rPropertyValues,
+ Content& rNewContent )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method creates, initializes and inserts (commits) a new content
+ * inside this (the target folder) content. For example, it can be used to
+ * create a new file system folder.
+ * Internally this method does a XContentCreator::createNewContent(...)-
+ * XCommandProcessor::execute( "setPropertyValues", ... )-
+ * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its contnt
+ * objects.
+ * @param rPropertyNames is a sequence of names of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( commited ).
+ * The order of the names must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( commited ).
+ * The order of the values must correspond to the order of the
+ * property names.
+ * @param rStream is a stream containing the content data for the new
+ * content (i.e. the content of a file to create)
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ */
+ sal_Bool
+ insertNewContent( const ::rtl::OUString& rContentType,
+ const ::com::sun::star::uno::Sequence<
+ rtl::OUString >& rPropertyNames,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rPropertyValues,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >& rStream,
+ Content& rNewContent )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method creates, initializes and inserts (commits) a new content
+ * inside this (the target folder) content. For example, it can be used to
+ * create a new file system folder.
+ * Internally this method does a XContentCreator::createNewContent(...)-
+ * XCommandProcessor::execute( "setPropertyValues", ... )-
+ * XCommandProcessor::execute( "insert", ... ) calling sequence.
+ *
+ * @param rContentType is the type for the new UCB content. Each content
+ * provider implementation may introduce own types for its contnt
+ * objects.
+ * @param nPropertyHandes is a sequence of handles of properties for that
+ * values are to set at the new content before it will be inserted
+ * ( commited ).
+ * The order of the handles must correspond to the order of the
+ * property values.
+ * @param rPropertyValues is a sequence of property values that are to
+ * set at the new content before it will be inserted ( commited ).
+ * The order of the values must correspond to the order of the
+ * property handles.
+ * @param rStream is a stream containing the content data for the new
+ * content (i.e. the content of a file to create)
+ * @param rNewContent will be filled by the implementation of this method
+ * with the new content.
+ */
+ sal_Bool
+ insertNewContent( const ::rtl::OUString& rContentType,
+ const ::com::sun::star::uno::Sequence<
+ sal_Int32 >& nPropertyHandles,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rPropertyValues,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >& rStream,
+ Content& rNewContent )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method transfers (copies/moves) a content. It creates a new
+ * resource inside this (the target folder) content.
+ * The implementation is able to do cross-provider transfers (like copying
+ * a file from the local file system to a directory located on an HTTP
+ * server).
+ * Internally this method executes the command "globalTransfer" at the UCB.
+ *
+ * @param rSourceContent is the content that contains the data for the
+ * new UCB content.
+ * @param eOperation defines what shall be done with the source data
+ * ( COPY, MOVE, LINK ).
+ * @param rTitle contains a title for the new content. If this is an empty
+ * string, the new content will have the same title as the source
+ * content.
+ * @param rNameClashAction describes how the implementation shall behave
+ * in case a content with a clashing name exists in the target
+ * folder.
+ * NameClash::ERROR will abort the operation, NameClash::OVERWRITE
+ * will overwrite the clashing content and all its data,
+ * NameClash::RENAME will generate and supply a non-clashing title.
+ * @see com/sun/star/ucb/NameClash.idl
+ */
+ sal_Bool
+ transferContent( const Content& rSourceContent,
+ InsertOperation eOperation,
+ const ::rtl::OUString & rTitle,
+ const sal_Int32 nNameClashAction )
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+
+ //////////////////////////////////////////////////////////////////////
+ // Required properties.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns the value of the content's property "IsFolder".
+ *
+ * @return true, if the content is a folder ( it can contain other
+ * UCB contents). false, otherwise.
+ */
+ sal_Bool
+ isFolder()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+ /**
+ * This method returns the value of the content's property "IsDocument".
+ *
+ * @return true, if the content is a document ( it has a content stream ).
+ * false, otherwise.
+ */
+ sal_Bool
+ isDocument()
+ throw( ::com::sun::star::ucb::CommandAbortedException,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::uno::Exception );
+};
+
+} /* namespace ucbhelper */
+
+#endif /* !_UCBHELPER_CONTENT_HXX */
diff --git a/ucbhelper/inc/ucbhelper/contentbroker.hxx b/ucbhelper/inc/ucbhelper/contentbroker.hxx
new file mode 100644
index 000000000000..f119e9c61284
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/contentbroker.hxx
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: contentbroker.hxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTBROKER_HXX
+#define _UCBHELPER_CONTENTBROKER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.h>
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XMultiServiceFactory;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class XContentIdentifierFactory;
+ class XContentProvider;
+ class XContentProviderManager;
+ class XCommandProcessor;
+} } } }
+#include <ucbhelper/configureucb.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace ucbhelper
+{
+
+class ContentBroker_Impl;
+
+//=========================================================================
+
+/**
+ * This class simplifies access to the Universal Content Broker (UCB).
+ * Currently there can only be one UCB instance per process. This class can
+ * be used to initialize and deinitialize the Broker and to access its
+ * interfaces directly.
+ */
+class UCBHELPER_DLLPUBLIC ContentBroker
+{
+ ContentBroker_Impl* m_pImpl;
+ // The "one and only" Broker.
+ static ContentBroker* m_pTheBroker;
+
+private:
+ UCBHELPER_DLLPRIVATE ContentBroker( const ContentBroker& ); // n.i.
+ UCBHELPER_DLLPRIVATE ContentBroker& operator=( const ContentBroker& ); // n.i.
+
+ /** Constructor.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rArguments are the arguments to pass to the
+ * com.sun.star.ucb.UniversalContentBroker service when creating it.
+ * Currently, this must be a sequence containing exactly two
+ * strings, a primary and a secondary configuration key.
+ * Refer to http://ucb.openoffice.org/docs/ucb-configuration.html
+ * for more information on UCB configuration.
+ */
+ UCBHELPER_DLLPRIVATE ContentBroker( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rArguments );
+
+ /** Constructor.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rData are the data for the for the content providers for
+ * the new UCB.
+ */
+ UCBHELPER_DLLPRIVATE ContentBroker( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
+ const ContentProviderDataList & rData );
+
+protected:
+ /**
+ * Destructor.
+ */
+ ~ContentBroker();
+
+public:
+ /** Initialize "the one and only" Broker. This method must be called
+ * exactly once, before the Broker is used in any way.
+ *
+ * @param rSMgr is a factory to create services needed in the Broker's
+ * implementation.
+ *
+ * @param rArguments are the arguments to pass to the
+ * com.sun.star.ucb.UniversalContentBroker service when creating
+ * it. Currently, this must be a sequence containing exactly two
+ * strings, a primary and a secondary configuration key.
+ * Refer to http://ucb.openoffice.org/docs/ucb-configuration.html
+ * for more information on UCB configuration.
+ *
+ * @return True if creation and possible configuration of the Broker
+ * was successful.
+ */
+ static sal_Bool
+ initialize( const::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& rArguments );
+
+ /** Initialize "the one and only" Broker. This method must be called
+ * exactly once, before the Broker is used in any way.
+ *
+ * @param rSMgr is a factory to create services needed in the Broker's
+ * implementation.
+ *
+ * @param rData are the data for the for the content providers for
+ * the UCB to initialize.
+ *
+ * @return True if creation and possible configuration of the Broker
+ * was successful.
+ */
+ static sal_Bool
+ initialize( const::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
+ const ContentProviderDataList & rData );
+
+ /** Deinitialize "the one and only" Broker. Once this method has been
+ * called, the Broker must not be used any longer.
+ */
+ static void
+ deinitialize();
+
+ /**
+ * This method returns the Broker, if it was already initialized.
+ *
+ * @return the Broker or 0, if ContentBroker::initialize() was not yet
+ * called or did fail.
+ */
+ static ContentBroker*
+ get();
+
+ /**
+ * This method returns the Service Manager used to instanciate the Broker.
+ *
+ * @return a Service Manager.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >
+ getServiceManager() const;
+
+ /**
+ * This method returns the XContentIdentifierFactory interface of the
+ * Broker.
+ *
+ * @return a XContentIdentifierFactory interface.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifierFactory >
+ getContentIdentifierFactoryInterface() const;
+
+ /**
+ * This method returns the XContentProvider interface of the Broker.
+ *
+ * @return a XContentProvider interface.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentProvider >
+ getContentProviderInterface() const;
+
+ /**
+ * This method returns the XContentProviderManager interface of the Broker.
+ *
+ * @return a XContentProviderManager interface.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentProviderManager >
+ getContentProviderManagerInterface() const;
+
+ /**
+ * This method returns the XCommandProcessor interface of the Broker.
+ *
+ * @return a XCommandProcessor interface.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandProcessor >
+ getCommandProcessorInterface() const;
+};
+
+} /* namespace ucbhelper */
+
+#endif /* !_UCBHELPER_CONTENTBROKER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/contenthelper.hxx b/ucbhelper/inc/ucbhelper/contenthelper.hxx
new file mode 100644
index 000000000000..cc29676efde0
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/contenthelper.hxx
@@ -0,0 +1,527 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: contenthelper.hxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTHELPER_HXX
+#define _UCBHELPER_CONTENTHELPER_HXX
+
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/beans/XPropertiesChangeNotifier.hpp>
+#include <com/sun/star/ucb/XCommandProcessor.hpp>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <com/sun/star/beans/XPropertySetInfoChangeNotifier.hpp>
+#include <com/sun/star/ucb/XCommandInfoChangeNotifier.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#include <cppuhelper/weak.hxx>
+
+#include "osl/mutex.hxx"
+#include "rtl/ref.hxx"
+#include <ucbhelper/macros.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ struct CommandInfo;
+ class XCommandEnvironment;
+ class XCommandInfo;
+ class XPersistentPropertySet;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace beans {
+ struct Property;
+ class XPropertySetInfo;
+} } } }
+
+namespace ucbhelper_impl { struct ContentImplHelper_Impl; }
+
+namespace ucbhelper
+{
+
+//=========================================================================
+
+class ContentProviderImplHelper;
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.Content. Implementations derived from this class are
+ * objects provided by implementations derived from
+ * class ucb::ContentProviderImplHelper.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - all required interfaces for service com::sun::star::ucb::Content
+ * - all required listener containers
+ * ( XComponent, XPropertiesChangeNotifier, XPropertySetInfoChangeNotifier,
+ * XCommandInfoChangeNotifier )
+ * - XPropertyContainer implementation ( persistence is implemented using
+ * service com.sun.star.ucb.Store )
+ * - complete XPropertySetInfo implementation ( including Additioanl Core
+ * Properties supplied via XPropertyContainer interface )
+ * -> protected method: getPropertySetInfo
+ * - complete XCommandInfo implementation
+ * -> protected method: getCommandInfo
+ */
+class UCBHELPER_DLLPUBLIC ContentImplHelper :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::lang::XComponent,
+ public com::sun::star::ucb::XContent,
+ public com::sun::star::ucb::XCommandProcessor,
+ public com::sun::star::beans::XPropertiesChangeNotifier,
+ public com::sun::star::beans::XPropertyContainer,
+ public com::sun::star::beans::XPropertySetInfoChangeNotifier,
+ public com::sun::star::ucb::XCommandInfoChangeNotifier,
+ public com::sun::star::container::XChild
+{
+ friend class PropertySetInfo;
+ friend class CommandProcessorInfo;
+
+ ucbhelper_impl::ContentImplHelper_Impl* m_pImpl;
+
+protected:
+ osl::Mutex m_aMutex;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xSMgr;
+ com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >
+ m_xIdentifier;
+ rtl::Reference< ContentProviderImplHelper >
+ m_xProvider;
+ sal_uInt32 m_nCommandId;
+
+private:
+ /**
+ * Your implementation of this method must return a sequence containing
+ * the meta data of the properties supported by the content.
+ * Note: If you wish to provide your own implementation of the interface
+ * XPropertyContainer ( completely override addContent and removeContent
+ * implementation of this base class in this case ), you can supply the
+ * meta data for your Additional Core Properties here to get a fully
+ * featured getPropertySetInfo method ( see below ).
+ *
+ * @param xEnv is an environment to use for example, for interactions.
+ * @return a sequence containing the property meta data.
+ */
+ UCBHELPER_DLLPRIVATE
+ virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
+ getProperties( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv ) = 0;
+
+ /**
+ * Your implementation of this method must return a sequence containing
+ * the meta data of the commands supported by the content.
+ *
+ * @param xEnv is an environment to use for example, for interactions.
+ * @return a sequence containing the command meta data.
+ */
+ UCBHELPER_DLLPRIVATE
+ virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
+ getCommands( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv ) = 0;
+
+ /**
+ * The implementation of this method shall return the URL of the parent
+ * of your content.
+ *
+ * @return the URL of the parent content or an empty string.
+ * Note that not all contents must have one parent. There may
+ * be contents with no parent. In that case an empty string must
+ * be returned. If your content has more than one parent you may
+ * return the URL of one "preferred" parent or an empty string.
+ */
+ UCBHELPER_DLLPRIVATE virtual ::rtl::OUString getParentURL() = 0;
+
+protected:
+ /**
+ * This method returns complete meta data for the properties ( including
+ * Additional Core Properties supplied via XPropertyContainer interface )
+ * supported by the content. To implement the required command
+ * "getPropertySetInfo" simply return the return value of this method.
+ *
+ * @param xEnv is an environment to use for example, for interactions.
+ * @param bCache indicates, whether the implemetation should use
+ * cached data, if exist.
+ * @return an XPropertySetInfo implementation object containing meta data
+ * for the properties supported by this content.
+ */
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >
+ getPropertySetInfo( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv,
+ sal_Bool bCache = sal_True );
+
+ /**
+ * This method returns complete meta data for the commands supported by
+ * the content. To implement the required command "getCommandInfo" simply
+ * return the return value of this method.
+ *
+ * @param xEnv is an environment to use for example, for interactions.
+ * @param bCache indicates, whether the implemetation should use
+ * cached data, if exist.
+ * @return an XCommandInfo implementation object containing meta data
+ * for the commands supported by this content.
+ */
+ com::sun::star::uno::Reference< com::sun::star::ucb::XCommandInfo >
+ getCommandInfo( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv,
+ sal_Bool bCache = sal_True );
+
+ /**
+ * This method can be used to propagate changes of property values.
+ *
+ * @param evt is a sequence of property change events.
+ */
+ void notifyPropertiesChange(
+ const com::sun::star::uno::Sequence<
+ com::sun::star::beans::PropertyChangeEvent >& evt ) const;
+
+ /**
+ * This method can be used to propagate changes of the propertyset
+ * info of your content (i.e. this happens if a new property is added
+ * to your content via its XPropertyContainer interface). This base class
+ * automatically generates events when the propertyset info changes. If
+ * you provide your own implementations of addproperty and removeProperty,
+ * then you must call "notifyPropertySetInfoChange" by yourself.
+ *
+ * @param evt is a sequence of property change events.
+ */
+ void notifyPropertySetInfoChange(
+ const com::sun::star::beans::PropertySetInfoChangeEvent& evt ) const;
+
+ /**
+ * This method can be used to propagate changes of the command info of
+ * your content. This can happen at any time if there shall be a new
+ * command available at a content or a currently present command shall no
+ * longer be present. (i.e. only if the content count of a trash can
+ * object is greater then zero, there will be available a command
+ * "emptyTrash". If there are no objects in the trash can, this command
+ * won't be available.
+ *
+ * @param evt is a sequence of command info change events.
+ */
+ void notifyCommandInfoChange(
+ const com::sun::star::ucb::CommandInfoChangeEvent& evt ) const;
+
+ /**
+ * This method can be used to propagate content events.
+ *
+ * @param evt is a sequence of content events.
+ */
+ void notifyContentEvent(
+ const com::sun::star::ucb::ContentEvent& evt ) const;
+
+ /**
+ * Use this method to announce the insertion of this content at
+ * the end of your implementation of the command "insert". The
+ * implementation of is method propagates a ContentEvent( INSERTED ).
+ */
+ void inserted();
+
+ /**
+ * Use this method to announce the destruction of this content at
+ * the end of your implementation of the command "delete". The
+ * implementation of is method propagates a ContentEvent( DELETED )
+ * and a ContentEvent( REMOVED ) at the parent of the deleted content,
+ * if a parent exists.
+ */
+ void deleted();
+
+ /**
+ * Use this method to change the identity of a content. The implementation
+ * of this method will replace the content identifier of the content and
+ * propagate the appropriate ContentEvent( EXCHANGED ).
+ *
+ * @param rNewId is the new content identifier for the contant.
+ * @return a success indicator.
+ */
+ sal_Bool exchange( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier >& rNewId );
+
+ /**
+ * Use this method to get access to the Additional Core Properties of
+ * the content ( added using content's XPropertyContainer interface ).
+ * If you supply your own XPropertyContainer implementation, this method
+ * will always return an empty propertyset.
+ *
+ * @param bCreate indicates whether a new propertyset shall be created
+ * if it does not exist.
+ * @return the implementation of the service
+ * com.sun.star.ucb.PersistentPropertySet.
+ */
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XPersistentPropertySet >
+ getAdditionalPropertySet( sal_Bool bCreate );
+
+ /**
+ * This method renames the propertyset containing the Additional Core
+ * Properties of the content.
+ *
+ * @param rOldKey is the old key of the propertyset.
+ * @param rNewKey is the new key for the propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be renamed too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool renameAdditionalPropertySet( const ::rtl::OUString& rOldKey,
+ const ::rtl::OUString& rNewKey,
+ sal_Bool bRecursive );
+
+ /**
+ * This method copies the propertyset containing the Additional Core
+ * Properties of the content.
+ *
+ * @param rSourceKey is the key of the source propertyset.
+ * @param rTargetKey is the key of the target propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rSourceKey shall be copied too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool copyAdditionalPropertySet( const ::rtl::OUString& rSourceKey,
+ const ::rtl::OUString& rTargetKey,
+ sal_Bool bRecursive );
+
+ /**
+ * This method removes the propertyset containing the Additional Core
+ * Properties of the content.
+ *
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be removed too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool removeAdditionalPropertySet( sal_Bool bRecursive );
+
+public:
+ /**
+ * Constructor.
+ *
+ * Note that the implementation of this ctor registers itself at its
+ * content provider. The provider implementation inserts the content
+ * in a hash map. So it easyly can be found and reused when the provider
+ * is asked for a content.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rxProvider is the provider for the content.
+ * @param Identifier is the content identifier for the content.
+ */
+ ContentImplHelper(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const rtl::Reference< ContentProviderImplHelper >& rxProvider,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier >& Identifier );
+
+ /**
+ * Destructor.
+ *
+ * Note that the implementation of this dtor deregisters itself from its
+ * content provider. The provider implementation removes the content
+ * from a hash map.
+ */
+ virtual ~ContentImplHelper();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException ) = 0;
+ virtual sal_Bool SAL_CALL
+ supportsService( const ::rtl::OUString& ServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ // XComponent
+ virtual void SAL_CALL
+ dispose()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ addEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XContent
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier > SAL_CALL
+ getIdentifier()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL
+ getContentType()
+ throw( com::sun::star::uno::RuntimeException ) = 0;
+ virtual void SAL_CALL
+ addContentEventListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeContentEventListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XCommandProcessor
+ virtual sal_Int32 SAL_CALL
+ createCommandIdentifier()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Any SAL_CALL
+ execute( const com::sun::star::ucb::Command& aCommand,
+ sal_Int32 CommandId,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
+ throw( com::sun::star::uno::Exception,
+ com::sun::star::ucb::CommandAbortedException,
+ com::sun::star::uno::RuntimeException ) = 0;
+ virtual void SAL_CALL
+ abort( sal_Int32 CommandId )
+ throw( com::sun::star::uno::RuntimeException ) = 0;
+
+ // XPropertiesChangeNotifier
+ virtual void SAL_CALL
+ addPropertiesChangeListener(
+ const com::sun::star::uno::Sequence< rtl::OUString >& PropertyNames,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertiesChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removePropertiesChangeListener(
+ const com::sun::star::uno::Sequence< rtl::OUString >& PropertyNames,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertiesChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XCommandInfoChangeNotifier
+ virtual void SAL_CALL
+ addCommandInfoChangeListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandInfoChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeCommandInfoChangeListener(
+ const com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandInfoChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XPropertyContainer
+
+ /**
+ * This method adds a property to the content according to the interface
+ * specification. The properties will be stored using the service
+ * com.sun.star.ucb.Store.
+ *
+ * Note: You may provide your own implementation of this method, for
+ * instance, if your data source supports adding/removing of properties.
+ * Don't forget to return the meta data for these properties in your
+ * implementation of getPropertyInfoTable.
+ */
+ virtual void SAL_CALL
+ addProperty( const rtl::OUString& Name,
+ sal_Int16 Attributes,
+ const com::sun::star::uno::Any& DefaultValue )
+ throw( com::sun::star::beans::PropertyExistException,
+ com::sun::star::beans::IllegalTypeException,
+ com::sun::star::lang::IllegalArgumentException,
+ com::sun::star::uno::RuntimeException );
+
+ /**
+ * This method removes a property from the content according to the
+ * interface specification. The properties will be stored using the
+ * service com.sun.star.ucb.Store.
+ *
+ * Note: You may provide your own implementation of this method, for
+ * instance, if your data source supports adding/removing of properties.
+ * Don't forget to return the meta data for these properties in your
+ * implementation of getPropertyInfoTable.
+ */
+ virtual void SAL_CALL
+ removeProperty( const rtl::OUString& Name )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::beans::NotRemoveableException,
+ com::sun::star::uno::RuntimeException );
+
+ // XPropertySetInfoChangeNotifier
+ virtual void SAL_CALL
+ addPropertySetInfoChangeListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySetInfoChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removePropertySetInfoChangeListener(
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySetInfoChangeListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XChild
+
+ /**
+ * This method returns the content representing the parent of a content,
+ * if such a parent exists. The implementation of this method uses your
+ * implementation of getParentURL.
+ */
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::uno::XInterface > SAL_CALL
+ getParent()
+ throw( com::sun::star::uno::RuntimeException );
+
+ /**
+ * The implementation of this method always throws a NoSupportException.
+ */
+ virtual void SAL_CALL
+ setParent( const com::sun::star::uno::Reference<
+ com::sun::star::uno::XInterface >& Parent )
+ throw( com::sun::star::lang::NoSupportException,
+ com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns the provider of the content.
+ *
+ * @return the provider of the content.
+ */
+ const rtl::Reference< ContentProviderImplHelper >& getProvider() const
+ { return m_xProvider; }
+};
+
+} // namespace ucbhelper
+
+#endif /* !_UCBHELPER_CONTENTHELPER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/contentidentifier.hxx b/ucbhelper/inc/ucbhelper/contentidentifier.hxx
new file mode 100644
index 000000000000..8c7a3efe3e67
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/contentidentifier.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: contentidentifier.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#define _UCBHELPER_CONTENTIDENTIFIER_HXX
+
+#include <cppuhelper/weak.hxx>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/ucb/XContentIdentifier.hpp>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XMultiServiceFactory;
+} } } }
+
+namespace rtl {
+ class OUString;
+}
+
+namespace ucbhelper
+{
+
+struct ContentIdentifier_Impl;
+
+//=========================================================================
+
+/**
+ * This class implements a simple identifier object for UCB contents.
+ * It mainly stores and returns the URL as it was passed to the constructor -
+ * The only difference is that the URL scheme will be lower cased. This can
+ * be done, because URL schemes are never case sensitive.
+ */
+class UCBHELPER_DLLPUBLIC ContentIdentifier :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::ucb::XContentIdentifier
+{
+public:
+ ContentIdentifier( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const rtl::OUString& rURL );
+ ContentIdentifier( const rtl::OUString& rURL );
+ virtual ~ContentIdentifier();
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface( const com::sun::star::uno::Type & rType )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ acquire() throw();
+ virtual void SAL_CALL
+ release() throw();
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
+ getTypes()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XContentIdentifier
+ virtual rtl::OUString SAL_CALL
+ getContentIdentifier()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL
+ getContentProviderScheme()
+ throw( com::sun::star::uno::RuntimeException );
+
+private:
+ ContentIdentifier_Impl* m_pImpl;
+};
+
+} /* namespace ucbhelper */
+
+#endif /* !_UCBHELPER_CONTENTIDENTIFIER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/contentinfo.hxx b/ucbhelper/inc/ucbhelper/contentinfo.hxx
new file mode 100644
index 000000000000..46e575dd8f31
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/contentinfo.hxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: contentinfo.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_CONTENTINFO_HXX
+#define _UCBHELPER_CONTENTINFO_HXX
+
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <cppuhelper/weak.hxx>
+
+#include "osl/mutex.hxx"
+#include <ucbhelper/macros.hxx>
+
+namespace ucbhelper {
+
+//============================================================================
+//
+// class PropertySetInfo.
+//
+//============================================================================
+
+class ContentImplHelper;
+
+/**
+ * This class provides a propertyset info ( the complete implementation of
+ * the interface XPropertySetInfo ) for an object derived from class
+ * ucb::ContentImplHelper. The implementation takes care about Additional
+ * Core Properties that may have been added to the content.
+ */
+class PropertySetInfo :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::beans::XPropertySetInfo
+{
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xSMgr;
+ com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >
+ m_xEnv;
+ com::sun::star::uno::Sequence< com::sun::star::beans::Property >*
+ m_pProps;
+ osl::Mutex m_aMutex;
+ ContentImplHelper* m_pContent;
+
+private:
+ sal_Bool queryProperty( const rtl::OUString& rName,
+ com::sun::star::beans::Property& rProp );
+
+public:
+ PropertySetInfo( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& rxEnv,
+ ContentImplHelper* pContent );
+ virtual ~PropertySetInfo();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XPropertySetInfo
+ virtual com::sun::star::uno::Sequence<
+ com::sun::star::beans::Property > SAL_CALL
+ getProperties()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::beans::Property SAL_CALL
+ getPropertyByName( const rtl::OUString& aName )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ hasPropertyByName( const rtl::OUString& Name )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // Non-Interface methods.
+ void reset();
+};
+
+//============================================================================
+//
+// class CommandProcessorInfo.
+//
+//============================================================================
+
+/**
+ * This class provides a command info ( the complete implementation of
+ * the interface XCommandInfo ) for an object derived from class
+ * ucb::ContentImplHelper.
+ */
+class CommandProcessorInfo :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::ucb::XCommandInfo
+{
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xSMgr;
+ com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >
+ m_xEnv;
+ com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >*
+ m_pCommands;
+ osl::Mutex m_aMutex;
+ ContentImplHelper* m_pContent;
+
+private:
+ sal_Bool queryCommand( const rtl::OUString& rName,
+ com::sun::star::ucb::CommandInfo& rCommand );
+ sal_Bool queryCommand( sal_Int32 nHandle,
+ com::sun::star::ucb::CommandInfo& rCommand );
+
+public:
+ CommandProcessorInfo( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& rxEnv,
+ ContentImplHelper* pContent );
+ virtual ~CommandProcessorInfo();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XCommandInfo
+ virtual com::sun::star::uno::Sequence<
+ com::sun::star::ucb::CommandInfo > SAL_CALL
+ getCommands()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::ucb::CommandInfo SAL_CALL
+ getCommandInfoByName( const rtl::OUString& Name )
+ throw( com::sun::star::ucb::UnsupportedCommandException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::ucb::CommandInfo SAL_CALL
+ getCommandInfoByHandle( sal_Int32 Handle )
+ throw( com::sun::star::ucb::UnsupportedCommandException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ hasCommandByName( const rtl::OUString& Name )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ hasCommandByHandle( sal_Int32 Handle )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // Non-Interface methods.
+ void reset();
+};
+
+} // namespace ucbhelper
+
+#endif /* !_UCBHELPER_CONTENTINFO_HXX */
diff --git a/ucbhelper/inc/ucbhelper/fileidentifierconverter.hxx b/ucbhelper/inc/ucbhelper/fileidentifierconverter.hxx
new file mode 100644
index 000000000000..9b1bf4b7706f
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/fileidentifierconverter.hxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: fileidentifierconverter.hxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_FILEIDENTIFIERCONVERTER_HXX_
+#define _UCBHELPER_FILEIDENTIFIERCONVERTER_HXX_
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <sal/types.h>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class XContentProviderManager;
+} } } }
+namespace rtl { class OUString; }
+
+namespace ucbhelper {
+
+//============================================================================
+/** Get a 'root' URL for the most 'local' file content provider.
+
+ @descr
+ The result can be used as the rBaseURL parameter of
+ ucb::getFileURLFromSystemPath().
+
+ @param rManager
+ A content provider manager. Must not be null.
+
+ @returns
+ either a 'root' URL for the most 'local' file content provider, or an
+ empty string, if no such URL can meaningfully be constructed.
+ */
+UCBHELPER_DLLPUBLIC rtl::OUString getLocalFileURL(
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentProviderManager > const &
+ rManager)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+//============================================================================
+/** Using a specific content provider manager, convert a file path in system
+ dependent notation to a (file) URL.
+
+ @param rManager
+ A content provider manager. Must not be null.
+
+ @param rBaseURL
+ See the corresponding parameter of
+ com::sun::star::ucb::XFileIdentifierConverter::getFileURLFromSystemPath().
+
+ @param rURL
+ See the corresponding parameter of
+ com::sun::star::ucb::XFileIdentifierConverter::getFileURLFromSystemPath().
+
+ @returns
+ a URL, if the content provider registered at the content provider manager
+ that is responsible for the base URL returns a URL when calling
+ com::sun::star::ucb::XFileIdentiferConverter::getFileURLFromSystemPath()
+ on it. Otherwise, an empty string is returned.
+
+ @see
+ com::sun::star::ucb::XFileIdentiferConverter::getFileURLFromSystemPath().
+ */
+UCBHELPER_DLLPUBLIC rtl::OUString
+getFileURLFromSystemPath(
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentProviderManager > const &
+ rManager,
+ rtl::OUString const & rBaseURL,
+ rtl::OUString const & rSystemPath)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+//============================================================================
+/** Using a specific content provider manager, convert a (file) URL to a
+ file path in system dependent notation.
+
+ @param rManager
+ A content provider manager. Must not be null.
+
+ @param rURL
+ See the corresponding parameter of
+ com::sun::star::ucb::XFileIdentiferConverter::getSystemPathFromFileURL().
+
+ @returns
+ a system path, if the content provider registered at the content provider
+ manager that is responsible for the base URL returns a system path when
+ calling
+ com::sun::star::ucb::XFileIdentiferConverter::getSystemPathFromFileURL()
+ on it. Otherwise, an empty string is returned.
+
+ @see
+ com::sun::star::ucb::XFileIdentiferConverter::getSystemPathFromFileURL().
+ */
+UCBHELPER_DLLPUBLIC rtl::OUString
+getSystemPathFromFileURL(
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentProviderManager > const &
+ rManager,
+ rtl::OUString const & rURL)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
+
+}
+
+#endif // _UCBHELPER_FILEIDENTIFIERCONVERTER_HXX_
diff --git a/ucbhelper/inc/ucbhelper/handleinteractionrequest.hxx b/ucbhelper/inc/ucbhelper/handleinteractionrequest.hxx
new file mode 100644
index 000000000000..4e50eb0051c7
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/handleinteractionrequest.hxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: handleinteractionrequest.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_UCBHELPER_HANDLEINTERACTIONREQUEST_HXX
+#define INCLUDED_UCBHELPER_HANDLEINTERACTIONREQUEST_HXX
+
+#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "rtl/ref.hxx"
+#include "sal/types.h"
+
+#ifndef INCLUDED_UTILITY
+#include <utility>
+#define INCLUDED_UTILITY
+#endif
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class XCommandEnvironment;
+} } } }
+namespace ucbhelper {
+ class InteractionSupplyAuthentication;
+ class SimpleAuthenticationRequest;
+ class SimpleInteractionRequest;
+ class SimpleCertificateValidationRequest;
+}
+
+/** Pass a <type scope="ucbhelper">SimpleInteractionRequest</type> to an
+ <type scope="com::sun::star::task">XInteractionHandler</type>, and handle
+ (by throwing the request as an exception) those cases where an interaction
+ handler is either not available or does not handle the request.
+
+ @param rRequest
+ a <type scope="ucbhelper">SimpleInteractionRequest</type>. Must not be
+ <NULL/>.
+
+ @param rEnvironment
+ At the moment, only the
+ <type scope="com::sun::star::task">XInteractionHandler</type> part is
+ used. May be <NULL/>.
+
+ @param bThrowOnAbort
+ determines what is done if the interaction handler selects a
+ <const scope="ucbhelper">CONTINUATION_ABORT</const> continuation: If
+ <TRUE/>, an appropriate
+ <type scope="com::sun::star::ucb">CommandFailedException</type> is thrown.
+ If <FALSE/>, <const scope="ucbhelper">CONTINUATION_ABORT</const> is passed
+ to the caller of this function.
+
+ @returns
+ the constant (defined in ucbhelper/simpelinteractionrequest.hxx) that
+ corresponds to the continuation selected by the interaction handler.
+ The constant <const scope="ucbhelper">CONTINUATION_UNKNOWN</const> will
+ never be returned.
+
+ @throws
+ <ul>
+ <li>the exception specified by the request, if an interaction handler is
+ either not available or does not handle the request;</li>
+ <li>a <type scope="com::sun::star::ucb">CommandFailedException</type> if
+ the interaction handler selects a
+ <const scope="ucbhelper">CONTINUATION_ABORT</const> continuation and
+ <code>bThrowOnAbort</code> is <TRUE/>;</li>
+ <li>a <type scope="com::sun::star::uno">RuntimeException</type> if such an
+ exception is thrown by code called from within this function.</li>
+ </ul>
+ */
+namespace ucbhelper {
+
+sal_Int32
+handleInteractionRequest(
+ rtl::Reference< ucbhelper::SimpleInteractionRequest > const & rRequest,
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > const &
+ rEnvironment,
+ bool bThrowOnAbort = true)
+ SAL_THROW((com::sun::star::uno::Exception));
+
+}
+
+/** Pass a <type scope="ucbhelper">SimpleAuthenticationRequest</type> to an
+ <type scope="com::sun::star::task">XInteractionHandler</type>, and handle
+ (by throwing the request as an exception) those cases where an interaction
+ handler is either not available or does not handle the request.
+
+ @param rRequest
+ a <type scope="ucbhelper">SimpleAuthenticationRequest</type>. Must not be
+ <NULL/>.
+
+ @param rEnvironment
+ At the moment, only the
+ <type scope="com::sun::star::task">XInteractionHandler</type> part is
+ used. May be <NULL/>.
+
+ @param bThrowOnAbort
+ determines what is done if the interaction handler selects a
+ <const scope="ucbhelper">CONTINUATION_ABORT</const> continuation: If
+ <TRUE/>, an appropriate
+ <type scope="com::sun::star::ucb">CommandFailedException</type> is thrown.
+ If <FALSE/>, <const scope="ucbhelper">CONTINUATION_ABORT</const> is passed
+ to the caller of this function.
+
+ @returns
+ either a pair consisting of one of the constants
+ <const scope="ucbhelper">CONTINUATION_ABORT</const> or
+ <const scope="ucbhelper">CONTINUATION_RETRY</const> (defined in
+ ucbhelper/simpelinteractionrequest.hxx) and an empty reference, or a pair
+ consisting of the constant
+ <const scope="ucbhelper">CONTINUATION_UNKNOWN</const> and a reference to
+ an <type scope="ucbhelper">InteractionSupplyAuthentication</type> that
+ contains the supplied data.
+
+ @throws
+ <ul>
+ <li>the exception specified by the request, if an interaction handler is
+ either not available or does not handle the request;</li>
+ <li>a <type scope="com::sun::star::ucb">CommandFailedException</type> if
+ the interaction handler selects a
+ <const scope="ucbhelper">CONTINUATION_ABORT</const> continuation and
+ <code>bThrowOnAbort</code> is <TRUE/>;</li>
+ <li>a <type scope="com::sun::star::uno">RuntimeException</type> if such an
+ exception is thrown by code called from within this function.</li>
+ </ul>
+ */
+namespace ucbhelper {
+
+std::pair< sal_Int32,
+ rtl::Reference< ucbhelper::InteractionSupplyAuthentication > >
+handleInteractionRequest(
+ rtl::Reference< ucbhelper::SimpleAuthenticationRequest > const & rRequest,
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > const &
+ rEnvironment,
+ bool bThrowOnAbort = true)
+ SAL_THROW((com::sun::star::uno::Exception));
+
+}
+
+/** Pass a <type scope="ucbhelper">SimpleCertificateValidationRequest</type> to an
+ <type scope="com::sun::star::task">XInteractionHandler</type>, and handle
+ (by throwing the request as an exception) those cases where an interaction
+ handler is either not available or does not handle the request.
+
+ @param rRequest
+ a <type scope="ucbhelper">SimpleCertificateValidationRequest</type>. Must not be
+ <NULL/>.
+
+ @param rEnvironment
+ At the moment, only the
+ <type scope="com::sun::star::task">XInteractionHandler</type> part is
+ used. May be <NULL/>.
+
+ @param bThrowOnAbort
+ determines what is done if the interaction handler selects a
+ <const scope="ucbhelper">CONTINUATION_ABORT</const> continuation: If
+ <TRUE/>, an appropriate
+ <type scope="com::sun::star::ucb">CommandFailedException</type> is thrown.
+ If <FALSE/>, <const scope="ucbhelper">CONTINUATION_ABORT</const> is passed
+ to the caller of this function.
+
+ @returns
+ the constant (defined in ucbhelper/simpelinteractionrequest.hxx) that
+ corresponds to the continuation selected by the interaction handler.
+ The constant <const scope="ucbhelper">CONTINUATION_UNKNOWN</const> will
+ never be returned.
+
+ @throws
+ <ul>
+ <li>the exception specified by the request, if an interaction handler is
+ either not available or does not handle the request;</li>
+ <li>a <type scope="com::sun::star::ucb">CommandFailedException</type> if
+ the interaction handler selects a
+ <const scope="ucbhelper">CONTINUATION_ABORT</const> continuation and
+ <code>bThrowOnAbort</code> is <TRUE/>;</li>
+ <li>a <type scope="com::sun::star::uno">RuntimeException</type> if such an
+ exception is thrown by code called from within this function.</li>
+ </ul>
+ */
+namespace ucbhelper {
+
+sal_Int32
+handleInteractionRequest(
+ rtl::Reference< ucbhelper::SimpleCertificateValidationRequest > const & rRequest,
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > const &
+ rEnvironment,
+ bool bThrowOnAbort = true)
+ SAL_THROW((com::sun::star::uno::Exception));
+
+}
+#endif // INCLUDED_UCBHELPER_HANDLEINTERACTIONREQUEST_HXX
diff --git a/ucbhelper/inc/ucbhelper/interactionrequest.hxx b/ucbhelper/inc/ucbhelper/interactionrequest.hxx
new file mode 100644
index 000000000000..b66a07caceb7
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/interactionrequest.hxx
@@ -0,0 +1,704 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: interactionrequest.hxx,v $
+ * $Revision: 1.12 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_INTERATIONREQUEST_HXX
+#define _UCBHELPER_INTERATIONREQUEST_HXX
+
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <com/sun/star/task/XInteractionAbort.hpp>
+#include <com/sun/star/task/XInteractionRetry.hpp>
+#include <com/sun/star/task/XInteractionApprove.hpp>
+#include <com/sun/star/task/XInteractionDisapprove.hpp>
+#include <com/sun/star/ucb/XInteractionReplaceExistingData.hpp>
+#include <com/sun/star/ucb/XInteractionSupplyAuthentication.hpp>
+#include <com/sun/star/ucb/XInteractionSupplyName.hpp>
+#include <rtl/ref.hxx>
+#include <cppuhelper/weak.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace ucbhelper {
+
+class InteractionContinuation;
+
+//============================================================================
+struct InteractionRequest_Impl;
+
+/**
+ * This class implements the interface XInteractionRequest. Instances can
+ * be passed directly to XInteractionHandler::handle(...). Each interaction
+ * request contains an exception describing the error and a number of
+ * interaction continuations describing the possible "answers" for the request.
+ * After the request was passed to XInteractionHandler::handle(...) the method
+ * getSelection() returns the continuation choosen by the interaction handler.
+ *
+ * The typical usage of this class would be:
+ *
+ * 1) Create exception object that shall be handled by the interaction handler.
+ * 2) Create InteractionRequest, supply exception as ctor parameter
+ * 3) Create continuations needed and add them to a sequence
+ * 4) Supply the continuations to the InteractionRequest by calling
+ * setContinuations(...)
+ *
+ * This class can also be used as base class for more specialized requests,
+ * like authentication requests.
+ */
+class UCBHELPER_DLLPUBLIC InteractionRequest : public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::task::XInteractionRequest
+{
+ InteractionRequest_Impl * m_pImpl;
+
+protected:
+ void setRequest( const com::sun::star::uno::Any & rRequest );
+
+ InteractionRequest();
+ virtual ~InteractionRequest();
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rRequest is the exception describing the error.
+ */
+ InteractionRequest( const com::sun::star::uno::Any & rRequest );
+
+ /**
+ * This method sets the continuations for the request.
+ *
+ * @param rContinuations contains the possible continuations.
+ */
+ void setContinuations(
+ const com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > &
+ rContinuations );
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface( const com::sun::star::uno::Type & rType )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL acquire()
+ throw();
+ virtual void SAL_CALL release()
+ throw();
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
+ getTypes()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInteractionRequest
+ virtual com::sun::star::uno::Any SAL_CALL
+ getRequest()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > SAL_CALL
+ getContinuations()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // Non-interface methods.
+
+ /**
+ * After passing this request to XInteractionHandler::handle, this method
+ * returns the continuation that was choosen by the interaction handler.
+ *
+ * @return the continuation choosen by an interaction handler or an empty
+ * reference, if the request was not (yet) handled.
+ */
+ rtl::Reference< InteractionContinuation > getSelection() const;
+
+ /**
+ * This method sets a continuation for the request. It also can be used
+ * to reset the continuation set by a previous XInteractionHandler::handle
+ * call in order to use this request object more then once.
+ *
+ * @param rxSelection is the interaction continuation to activate for
+ * the request or an empty reference in order to reset the
+ * current selection.
+ */
+ void
+ setSelection(
+ const rtl::Reference< InteractionContinuation > & rxSelection );
+};
+
+//============================================================================
+struct InteractionContinuation_Impl;
+
+/**
+ * This class is the base for implementations of the interface
+ * XInteractionContinuation. Classes derived from this bas class work together
+ * with class InteractionRequest.
+ *
+ * Derived classes must implement their XInteractionContinuation::select()
+ * method the way that they simply call recordSelection() which is provided by
+ * this class.
+ */
+class UCBHELPER_DLLPUBLIC InteractionContinuation : public cppu::OWeakObject
+{
+ InteractionContinuation_Impl * m_pImpl;
+
+protected:
+ /**
+ * This method marks this continuation as "selected" at the request it
+ * belongs to.
+ *
+ * Derived classes must implement their XInteractionContinuation::select()
+ * method the way that they call this method.
+ */
+ void recordSelection();
+ virtual ~InteractionContinuation();
+
+public:
+ InteractionContinuation( InteractionRequest * pRequest );
+};
+
+//============================================================================
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionAbort. Instances of this class can be passed
+ * along with an interaction request to indicate the possiblity to abort
+ * the operation that caused the request.
+ */
+class UCBHELPER_DLLPUBLIC InteractionAbort : public InteractionContinuation,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::task::XInteractionAbort
+{
+public:
+ InteractionAbort( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface( const com::sun::star::uno::Type & rType )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL acquire()
+ throw();
+ virtual void SAL_CALL release()
+ throw();
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
+ getTypes()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select()
+ throw( com::sun::star::uno::RuntimeException );
+};
+
+//============================================================================
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionRetry. Instances of this class can be passed
+ * along with an interaction request to indicate the possiblity to retry
+ * the operation that caused the request.
+ */
+class UCBHELPER_DLLPUBLIC InteractionRetry : public InteractionContinuation,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::task::XInteractionRetry
+{
+public:
+ InteractionRetry( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface( const com::sun::star::uno::Type & rType )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL acquire()
+ throw();
+ virtual void SAL_CALL release()
+ throw();
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
+ getTypes()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select()
+ throw( com::sun::star::uno::RuntimeException );
+};
+
+//============================================================================
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionApprove. Instances of this class can be passed
+ * along with an interaction request to indicate the possiblity to approve
+ * the request.
+ */
+class UCBHELPER_DLLPUBLIC InteractionApprove : public InteractionContinuation,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::task::XInteractionApprove
+{
+public:
+ InteractionApprove( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface( const com::sun::star::uno::Type & rType )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL acquire()
+ throw();
+ virtual void SAL_CALL release()
+ throw();
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
+ getTypes()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select()
+ throw( com::sun::star::uno::RuntimeException );
+};
+
+//============================================================================
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionDisapprove. Instances of this class can be passed
+ * along with an interaction request to indicate the possiblity to disapprove
+ * the request.
+ */
+class UCBHELPER_DLLPUBLIC InteractionDisapprove : public InteractionContinuation,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::task::XInteractionDisapprove
+{
+public:
+ InteractionDisapprove( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface( const com::sun::star::uno::Type & rType )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL acquire()
+ throw();
+ virtual void SAL_CALL release()
+ throw();
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
+ getTypes()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select()
+ throw( com::sun::star::uno::RuntimeException );
+};
+
+//============================================================================
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionSupplyAuthentication. Instances of this class can be
+ * passed along with an authentication interaction request to enable the
+ * interaction handler to supply the missing authentication data.
+ */
+class UCBHELPER_DLLPUBLIC InteractionSupplyAuthentication :
+ public InteractionContinuation,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::ucb::XInteractionSupplyAuthentication
+{
+ com::sun::star::uno::Sequence< com::sun::star::ucb::RememberAuthentication >
+ m_aRememberPasswordModes;
+ com::sun::star::uno::Sequence< com::sun::star::ucb::RememberAuthentication >
+ m_aRememberAccountModes;
+ rtl::OUString m_aRealm;
+ rtl::OUString m_aUserName;
+ rtl::OUString m_aPassword;
+ rtl::OUString m_aAccount;
+ com::sun::star::ucb::RememberAuthentication m_eRememberPasswordMode;
+ com::sun::star::ucb::RememberAuthentication m_eDefaultRememberPasswordMode;
+ com::sun::star::ucb::RememberAuthentication m_eRememberAccountMode;
+ com::sun::star::ucb::RememberAuthentication m_eDefaultRememberAccountMode;
+ unsigned m_bCanSetRealm : 1;
+ unsigned m_bCanSetUserName : 1;
+ unsigned m_bCanSetPassword : 1;
+ unsigned m_bCanSetAccount : 1;
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rxRequest is the interaction request that owns this continuation.
+ * @param bCanSetRealm indicates, whether the realm given with the
+ * authentication request is read-only.
+ * @param bCanSetUserName indicates, whether the username given with the
+ * authentication request is read-only.
+ * @param bCanSetPassword indicates, whether the password given with the
+ * authentication request is read-only.
+ * @param bCanSetAccount indicates, whether the account given with the
+ * authentication request is read-only.
+ *
+ * @see com::sun::star::ucb::AuthenticationRequest
+ */
+ inline InteractionSupplyAuthentication(
+ InteractionRequest * pRequest,
+ sal_Bool bCanSetRealm,
+ sal_Bool bCanSetUserName,
+ sal_Bool bCanSetPassword,
+ sal_Bool bCanSetAccount );
+ /**
+ * Constructor.
+ *
+ * Note: The remember-authentication stuff is interesting only for
+ * clients implementing own password storage functionality.
+ *
+ * @param rxRequest is the interaction request that owns this continuation.
+ * @param bCanSetRealm indicates, whether the realm given with the
+ * authentication request is read-only.
+ * @param bCanSetUserName indicates, whether the username given with the
+ * authentication request is read-only.
+ * @param bCanSetPassword indicates, whether the password given with the
+ * authentication request is read-only.
+ * @param bCanSetAccount indicates, whether the account given with the
+ * authentication request is read-only.
+ * @param rRememberPasswordModes specifies the authentication-remember-
+ * modes for passwords supported by the requesting client.
+ * @param eDefaultRememberPasswordMode specifies the default
+ * authentication-remember-mode for passwords preferred by the
+ * requesting client.
+ * @param rRememberAccountModes specifies the authentication-remember-
+ * modes for accounts supported by the requesting client.
+ * @param eDefaultRememberAccountMode specifies the default
+ * authentication-remember-mode for accounts preferred by the
+ * requesting client.
+ *
+ * @see com::sun::star::ucb::AuthenticationRequest
+ * @see com::sun::star::ucb::RememberAuthentication
+ */
+ inline InteractionSupplyAuthentication(
+ InteractionRequest * pRequest,
+ sal_Bool bCanSetRealm,
+ sal_Bool bCanSetUserName,
+ sal_Bool bCanSetPassword,
+ sal_Bool bCanSetAccount,
+ const com::sun::star::uno::Sequence<
+ com::sun::star::ucb::RememberAuthentication > &
+ rRememberPasswordModes,
+ const com::sun::star::ucb::RememberAuthentication
+ eDefaultRememberPasswordMode,
+ const com::sun::star::uno::Sequence<
+ com::sun::star::ucb::RememberAuthentication > &
+ rRememberAccountModes,
+ const com::sun::star::ucb::RememberAuthentication
+ eDefaultRememberAccountMode );
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface( const com::sun::star::uno::Type & rType )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL acquire()
+ throw();
+ virtual void SAL_CALL release()
+ throw();
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
+ getTypes()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInteractionSupplyAuthentication
+ virtual sal_Bool SAL_CALL
+ canSetRealm()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ setRealm( const rtl::OUString& Realm )
+ throw( com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ canSetUserName()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ setUserName( const rtl::OUString& UserName )
+ throw( com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ canSetPassword()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ setPassword( const rtl::OUString& Password )
+ throw( com::sun::star::uno::RuntimeException );
+
+ virtual com::sun::star::uno::Sequence<
+ com::sun::star::ucb::RememberAuthentication > SAL_CALL
+ getRememberPasswordModes(
+ com::sun::star::ucb::RememberAuthentication& Default )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ setRememberPassword( com::sun::star::ucb::RememberAuthentication Remember )
+ throw( com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ canSetAccount()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ setAccount( const rtl::OUString& Account )
+ throw( com::sun::star::uno::RuntimeException );
+
+ virtual com::sun::star::uno::Sequence<
+ com::sun::star::ucb::RememberAuthentication > SAL_CALL
+ getRememberAccountModes(
+ com::sun::star::ucb::RememberAuthentication& Default )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ setRememberAccount( com::sun::star::ucb::RememberAuthentication Remember )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // Non-interface methods.
+
+ /**
+ * This method returns the realm that was supplied by the interaction
+ * handler.
+ *
+ * @return the realm.
+ */
+ const rtl::OUString & getRealm() const { return m_aRealm; }
+
+ /**
+ * This method returns the username that was supplied by the interaction
+ * handler.
+ *
+ * @return the username.
+ */
+ const rtl::OUString & getUserName() const { return m_aUserName; }
+
+ /**
+ * This method returns the password that was supplied by the interaction
+ * handler.
+ *
+ * @return the password.
+ */
+ const rtl::OUString & getPassword() const { return m_aPassword; }
+
+ /**
+ * This method returns the account that was supplied by the interaction
+ * handler.
+ *
+ * @return the account.
+ */
+ const rtl::OUString & getAccount() const { return m_aAccount; }
+
+ /**
+ * This method returns the authentication remember-mode for the password
+ * that was supplied by the interaction handler.
+ *
+ * @return the remember-mode for the password.
+ */
+ const com::sun::star::ucb::RememberAuthentication &
+ getRememberPasswordMode() const { return m_eRememberPasswordMode; }
+
+ /**
+ * This method returns the authentication remember-mode for the account
+ * that was supplied by the interaction handler.
+ *
+ * @return the remember-mode for the account.
+ */
+ const com::sun::star::ucb::RememberAuthentication &
+ getRememberAccountMode() const { return m_eRememberAccountMode; }
+};
+
+//============================================================================
+inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
+ InteractionRequest * pRequest,
+ sal_Bool bCanSetRealm,
+ sal_Bool bCanSetUserName,
+ sal_Bool bCanSetPassword,
+ sal_Bool bCanSetAccount )
+: InteractionContinuation( pRequest ),
+ m_aRememberPasswordModes( com::sun::star::uno::Sequence<
+ com::sun::star::ucb::RememberAuthentication >( 1 ) ),
+ m_aRememberAccountModes( com::sun::star::uno::Sequence<
+ com::sun::star::ucb::RememberAuthentication >( 1 ) ),
+ m_eRememberPasswordMode( com::sun::star::ucb::RememberAuthentication_NO ),
+ m_eDefaultRememberPasswordMode(
+ com::sun::star::ucb::RememberAuthentication_NO ),
+ m_eRememberAccountMode( com::sun::star::ucb::RememberAuthentication_NO ),
+ m_eDefaultRememberAccountMode(
+ com::sun::star::ucb::RememberAuthentication_NO ),
+ m_bCanSetRealm( bCanSetRealm ),
+ m_bCanSetUserName( bCanSetUserName ),
+ m_bCanSetPassword( bCanSetPassword ),
+ m_bCanSetAccount( bCanSetAccount )
+{
+ m_aRememberPasswordModes[ 0 ]
+ = com::sun::star::ucb::RememberAuthentication_NO;
+ m_aRememberAccountModes [ 0 ]
+ = com::sun::star::ucb::RememberAuthentication_NO;
+}
+
+//============================================================================
+inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
+ InteractionRequest * pRequest,
+ sal_Bool bCanSetRealm,
+ sal_Bool bCanSetUserName,
+ sal_Bool bCanSetPassword,
+ sal_Bool bCanSetAccount,
+ const com::sun::star::uno::Sequence<
+ com::sun::star::ucb::RememberAuthentication > & rRememberPasswordModes,
+ const com::sun::star::ucb::RememberAuthentication
+ eDefaultRememberPasswordMode,
+ const com::sun::star::uno::Sequence<
+ com::sun::star::ucb::RememberAuthentication > & rRememberAccountModes,
+ const com::sun::star::ucb::RememberAuthentication
+ eDefaultRememberAccountMode )
+: InteractionContinuation( pRequest ),
+ m_aRememberPasswordModes( rRememberPasswordModes ),
+ m_aRememberAccountModes( rRememberAccountModes ),
+ m_eRememberPasswordMode( eDefaultRememberPasswordMode ),
+ m_eDefaultRememberPasswordMode( eDefaultRememberPasswordMode ),
+ m_eRememberAccountMode( eDefaultRememberAccountMode ),
+ m_eDefaultRememberAccountMode( eDefaultRememberAccountMode ),
+ m_bCanSetRealm( bCanSetRealm ),
+ m_bCanSetUserName( bCanSetUserName ),
+ m_bCanSetPassword( bCanSetPassword ),
+ m_bCanSetAccount( bCanSetAccount )
+{
+}
+
+//============================================================================
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionSupplyName. Instances of this class can be passed
+ * along with an interaction request to indicate the possiblity to
+ * supply a new name.
+ */
+class InteractionSupplyName : public InteractionContinuation,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::ucb::XInteractionSupplyName
+{
+ rtl::OUString m_aName;
+
+public:
+ InteractionSupplyName( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface( const com::sun::star::uno::Type & rType )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL acquire()
+ throw();
+ virtual void SAL_CALL release()
+ throw();
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
+ getTypes()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInteractionSupplyName
+ virtual void SAL_CALL setName( const ::rtl::OUString& Name )
+ throw ( com::sun::star::uno::RuntimeException );
+
+ // Non-interface methods.
+
+ /**
+ * This method returns the name that was supplied by the interaction
+ * handler.
+ *
+ * @return the name.
+ */
+ const rtl::OUString & getName() const { return m_aName; }
+};
+
+//============================================================================
+/**
+ * This class implements a standard interaction continuation, namely the
+ * interface XInteractionReplaceExistingData. Instances of this class can be
+ * passed along with an interaction request to indicate the possiblity to
+ * replace existing data.
+ */
+class InteractionReplaceExistingData :
+ public InteractionContinuation,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::ucb::XInteractionReplaceExistingData
+{
+public:
+ InteractionReplaceExistingData( InteractionRequest * pRequest )
+ : InteractionContinuation( pRequest ) {}
+
+ // XInterface
+ virtual com::sun::star::uno::Any SAL_CALL
+ queryInterface( const com::sun::star::uno::Type & rType )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL acquire()
+ throw();
+ virtual void SAL_CALL release()
+ throw();
+
+ // XTypeProvider
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
+ getTypes()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getImplementationId()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select()
+ throw( com::sun::star::uno::RuntimeException );
+};
+
+} // namespace ucbhelper
+
+#endif /* !_UCBHELPER_INTERATIONREQUEST_HXX */
diff --git a/ucbhelper/inc/ucbhelper/interceptedinteraction.hxx b/ucbhelper/inc/ucbhelper/interceptedinteraction.hxx
new file mode 100644
index 000000000000..1a81525f66f2
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/interceptedinteraction.hxx
@@ -0,0 +1,354 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: interceptedinteraction.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_INTERCEPTEDINTERACTION_HXX_
+#define _UCBHELPER_INTERCEPTEDINTERACTION_HXX_
+
+//_______________________________________________
+// includes
+
+#include <vector>
+
+#ifndef __COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP__
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#endif
+
+#ifndef __COM_SUN_STAR_TASK_XINTERACTIONREQUEST_HPP__
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#endif
+#include <cppuhelper/implbase1.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+//_______________________________________________
+// namespace
+
+namespace ucbhelper{
+
+//_______________________________________________
+// definitions
+
+/** @short it wraps any other interaction handler and intercept
+ its handle() requests.
+
+ @descr This class can be used as:
+ - instance if special interactions must be supressed
+ only
+ - or as base class if interactions must be modified.
+ */
+class UCBHELPER_DLLPUBLIC InterceptedInteraction : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionHandler >
+{
+ //-------------------------------------------
+ // types
+ public:
+
+ struct InterceptedRequest
+ {
+ //-----------------------------------
+ /** @short marks an Handle as invalid.
+ */
+ static const sal_Int32 INVALID_HANDLE = -1;
+
+ //-----------------------------------
+ /** @short contains the interaction request, which should be intercepted. */
+ ::com::sun::star::uno::Any Request;
+
+ //-----------------------------------
+ /** @short specify the fix continuation, which must be selected, if the
+ interaction could be intercepted successfully.
+ */
+ ::com::sun::star::uno::Type Continuation;
+
+ //-----------------------------------
+ /** @short specify, if both interactions must have the same type
+ or can be derived from.
+
+ @descr Interaction base on exceptions - and exceptions are real types.
+ So they can be checked in its type. These parameter "MatchExact"
+ influence the type-check in the following way:
+ TRUE => the exception will be intercepted only
+ if it supports exactly the same type ...
+ or
+ FALSE => derived exceptions will be intercepted too.
+
+ @attention This parameter does not influence the check of the continuation
+ type! The continuation must be matched exactly everytimes ...
+ */
+ sal_Bool MatchExact;
+
+ //-----------------------------------
+ /** @short its an unique identifier, which must be managed by the outside code.
+
+ @descr If there is a derived class, which overwrites the InterceptedInteraction::intercepted()
+ method, it will be called with a reference to an InterceptedRequest struct.
+ Then it can use the handle to react without checking the request type again.
+ */
+ sal_Int32 Handle;
+
+ //-----------------------------------
+ /** @short default ctor.
+
+ @descr Such constructed object cant be used realy.
+ Might it will crash if its used!
+ Dont forget to initialize all(!) members ...
+ */
+ InterceptedRequest()
+ {
+ MatchExact = sal_False;
+ Handle = INVALID_HANDLE;
+ }
+
+ //-----------------------------------
+ /** @short initialize this instance.
+
+ @param nHandle
+ used to identify every intercepted request
+
+ @param aRequest
+ must contain an exception object, which can be checked
+ in its uno-type against the later handled interaction.
+
+ @param aContinuation
+ must contain a continuation object, which is used
+ in its uno-type to locate the same continuation
+ inside the list of possible ones.
+
+ @param bMatchExact
+ influence the type check of the interception request.
+ Its not used to check the continuation!
+ */
+ InterceptedRequest( sal_Int32 nHandle ,
+ const ::com::sun::star::uno::Any& aRequest ,
+ const ::com::sun::star::uno::Type& aContinuation,
+ sal_Bool bMatchExact )
+ {
+ Handle = nHandle;
+ Request = aRequest;
+ Continuation = aContinuation;
+ MatchExact = bMatchExact;
+ }
+ };
+
+ //---------------------------------------
+ /** @short represent the different states, which can occure
+ as result of an interception.
+
+ @see impl_interceptRequest()
+ */
+ enum EInterceptionState
+ {
+ /** none of the specified interceptions match the incoming request */
+ E_NOT_INTERCEPTED,
+ /** the request could be intercepted - but the specified continuation could not be located.
+ Thats normaly an error of the programmer. May be the interaction request does not use
+ the right set of continuations ... or the interception list contains the wrong continuation. */
+ E_NO_CONTINUATION_FOUND,
+ /** the request could be intercepted and the specified continuation could be selected successfully. */
+ E_INTERCEPTED
+ };
+
+ //-------------------------------------------
+ // member
+ protected:
+
+ //---------------------------------------
+ /** @short reference to the intercepted interaction handler.
+
+ @descr NULL is allowed for this member!
+ All interaction will be aborted then ...
+ expecting th handle() was overwritten by
+ a derived class.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > m_xInterceptedHandler;
+
+ //---------------------------------------
+ /** @short these list contains the requests, which should be intercepted.
+ */
+ ::std::vector< InterceptedRequest > m_lInterceptions;
+
+ //-------------------------------------------
+ // native interface
+ public:
+
+ //---------------------------------------
+ /** @short initialize a new instance with default values.
+ */
+ InterceptedInteraction();
+
+ //---------------------------------------
+ /** @short initialize a new instance with real values.
+
+ @param xInterceptedHandler
+ the outside interaction handler, which should
+ be intercepted here.
+
+ @param lInterceptions
+ the list of intercepted requests.
+ */
+ InterceptedInteraction(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xInterceptedHandler,
+ const ::std::vector< InterceptedRequest >& lInterceptions );
+
+ //---------------------------------------
+ /** @short initialize a new instance with the interaction handler,
+ which should be intercepted.
+
+ @attention If such interaction handler isnt set here,
+ all incoming requests will be aborted ...
+ if the right continuation is available!
+
+ @param xInterceptedHandler
+ the outside interaction handler, which should
+ be intercepted here.
+ */
+ void setInterceptedHandler(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xInterceptedHandler);
+
+ //---------------------------------------
+ /** @short set a new list of intercepted interactions.
+
+ @attention If the interface method handle() will be overwritten by
+ a derived class, the functionality behind these static list
+ cant be used.
+
+ @param lInterceptions
+ the list of intercepted requests.
+ */
+ void setInterceptions(const ::std::vector< InterceptedRequest >& lInterceptions);
+
+ //---------------------------------------
+ /** @short extract a requested continuation from te list of available ones.
+
+ @param lContinuations
+ the list of available continuations.
+
+ @param aType
+ is used to locate the right continuation,
+ by checking its interface type.
+
+ @return A valid reference to the continuation, if it could be located ...
+ or an empty reference otherwhise.
+ */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > extractContinuation(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >& lContinuations,
+ const ::com::sun::star::uno::Type& aType );
+
+ //-------------------------------------------
+ // useable for derived classes
+ protected:
+
+ //---------------------------------------
+ /** @short can be overwritten by a derived class to handle interceptions
+ outside.
+
+ @descr This base implementation checks, if the request could be intercepted
+ successfully. Then this method intercepted() is called.
+ The default implementation returns "NOT_INTERCEPTED" everytimes.
+ So the method impl_interceptRequest() uses the right continuation automaticly.
+
+ If this method was overwritten and something different "NO_INTERCEPTED"
+ is returned, the method impl_interceptRequest() will return immediatly with
+ the result, which is returned by this intercepted() method.
+ Then the continuations must be selected inside the intercepted() call!
+
+ @param rRequest
+ it points to the intercepted request (means the item of the
+ set interception list). e.g. its "Handle" member can be used
+ to identify it and react very easy, without the need to check the
+ type of the exception ...
+
+ @param xOrgRequest
+ points to the original interaction, which was intercepted.
+ It provides access to the exception and the list of possible
+ continuations.
+
+ @return The result of this operation.
+ Note: If E_NOT_INTERCEPTED is returned the default handling of the base class
+ will be used automaticly for this request!
+ */
+ virtual EInterceptionState intercepted(const InterceptedRequest& rRequest ,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xOrgRequest);
+
+ //-------------------------------------------
+ // uno interface
+ public:
+
+ //---------------------------------------
+ /** @short implements the default handling of this class ....
+ or can be overwritten by any derived class.
+
+ @descr If no further class is derived from this one
+ -> the default implementation is used. Then the
+ internal list of requests is used to handle different
+ interactions automaticly.
+ (see impl_interceptRequest())
+
+ If this method was overwritten by a derived implementation
+ -> the new implementation has to do everything by itself.
+ Of course it can access all members/helpers and work with it.
+ But the default implementation isnt used automaticly then.
+
+ @param xRequest
+ the interaction request, which should be intercepted.
+ */
+ virtual void SAL_CALL handle(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest)
+ throw(::com::sun::star::uno::RuntimeException);
+
+ //-------------------------------------------
+ // helper
+ private:
+
+ //---------------------------------------
+ /** @short implements the default handling:
+ - intercept or forward to internal handler.
+ */
+ UCBHELPER_DLLPRIVATE void impl_handleDefault(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest);
+
+ //---------------------------------------
+ /** @short implements the interception of requests.
+
+ @descr The incoming request will be analyzed, if it match
+ any request of the m_lIntercepions list.
+ If an interception could be found, its continuation will be
+ searched and selected.
+
+ The method return the state of that operation.
+ But it doesnt call the intercepted and here set
+ interaction handler. That has to be done in the outside method.
+
+ @param xRequest
+ the interaction request, which should be intercepted.
+
+ @return A identifier, which inidicates if the request was intercepted,
+ the continuation was found and selected ... or not.
+ */
+ UCBHELPER_DLLPRIVATE EInterceptionState impl_interceptRequest(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest);
+};
+
+} // namespace ucbhelper
+
+#endif // _UCBHELPER_INTERCEPTEDINTERACTION_HXX_
diff --git a/ucbhelper/inc/ucbhelper/macros.hxx b/ucbhelper/inc/ucbhelper/macros.hxx
new file mode 100644
index 000000000000..daadcef6e8da
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/macros.hxx
@@ -0,0 +1,750 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: macros.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_MACROS_HXX
+#define _UCBHELPER_MACROS_HXX
+
+#include <sal/types.h>
+#include <cppuhelper/queryinterface.hxx>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+#include "osl/mutex.hxx"
+
+//=========================================================================
+
+#define CPPU_TYPE( T ) getCppuType( static_cast< T * >( 0 ) )
+#define CPPU_TYPE_REF( T ) CPPU_TYPE( com::sun::star::uno::Reference< T > )
+
+//=========================================================================
+//
+// XInterface decl.
+//
+//=========================================================================
+
+#define XINTERFACE_DECL() \
+ virtual com::sun::star::uno::Any SAL_CALL \
+ queryInterface( const com::sun::star::uno::Type & rType ) \
+ throw( com::sun::star::uno::RuntimeException ); \
+ virtual void SAL_CALL \
+ acquire() \
+ throw(); \
+ virtual void SAL_CALL \
+ release() \
+ throw();
+
+//=========================================================================
+//
+// XInterface impl. internals.
+//
+//=========================================================================
+
+#define XINTERFACE_COMMON_IMPL( Class ) \
+void SAL_CALL Class::acquire() \
+ throw() \
+{ \
+ OWeakObject::acquire(); \
+} \
+ \
+void SAL_CALL Class::release() \
+ throw() \
+{ \
+ OWeakObject::release(); \
+}
+
+#define QUERYINTERFACE_IMPL_START( Class ) \
+com::sun::star::uno::Any SAL_CALL Class::queryInterface( \
+ const com::sun::star::uno::Type & rType ) \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ com::sun::star::uno::Any aRet = cppu::queryInterface( rType,
+
+#define QUERYINTERFACE_IMPL_END \
+ ); \
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ); \
+}
+
+//=========================================================================
+//
+// XInterface impl.
+//
+//=========================================================================
+
+// 1 interface implemented
+#define XINTERFACE_IMPL_1( Class, Ifc1 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 2 interfaces implemented
+#define XINTERFACE_IMPL_2( Class, Ifc1, Ifc2 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ), \
+ SAL_STATIC_CAST( Ifc2*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 3 interfaces implemented
+#define XINTERFACE_IMPL_3( Class, Ifc1, Ifc2, Ifc3 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ), \
+ SAL_STATIC_CAST( Ifc2*, this ), \
+ SAL_STATIC_CAST( Ifc3*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 4 interfaces implemented
+#define XINTERFACE_IMPL_4( Class, Ifc1, Ifc2, Ifc3, Ifc4 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ), \
+ SAL_STATIC_CAST( Ifc2*, this ), \
+ SAL_STATIC_CAST( Ifc3*, this ), \
+ SAL_STATIC_CAST( Ifc4*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 5 interfaces implemented
+#define XINTERFACE_IMPL_5( Class, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( Ifc1*, this ), \
+ SAL_STATIC_CAST( Ifc2*, this ), \
+ SAL_STATIC_CAST( Ifc3*, this ), \
+ SAL_STATIC_CAST( Ifc4*, this ), \
+ SAL_STATIC_CAST( Ifc5*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 6 interfaces implemented
+#define XINTERFACE_IMPL_6( Class,I1,I2,I3,I4,I5,I6 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 7 interfaces implemented
+#define XINTERFACE_IMPL_7( Class,I1,I2,I3,I4,I5,I6,I7 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 8 interfaces implemented
+#define XINTERFACE_IMPL_8( Class,I1,I2,I3,I4,I5,I6,I7,I8 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 9 interfaces implemented
+#define XINTERFACE_IMPL_9( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 10 interfaces implemented
+#define XINTERFACE_IMPL_10( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 11 interfaces implemented
+#define XINTERFACE_IMPL_11( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 12 interfaces implemented
+#define XINTERFACE_IMPL_12( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ), \
+ SAL_STATIC_CAST( I12*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 13 interfaces implemented
+#define XINTERFACE_IMPL_13( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ), \
+ SAL_STATIC_CAST( I12*, this ), \
+ SAL_STATIC_CAST( I13*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 14 interfaces implemented
+#define XINTERFACE_IMPL_14( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ), \
+ SAL_STATIC_CAST( I12*, this ), \
+ SAL_STATIC_CAST( I13*, this ), \
+ SAL_STATIC_CAST( I14*, this ) \
+QUERYINTERFACE_IMPL_END
+
+// 15 interfaces implemented
+#define XINTERFACE_IMPL_15( Class,I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14,I15 ) \
+XINTERFACE_COMMON_IMPL( Class ) \
+QUERYINTERFACE_IMPL_START( Class ) \
+ SAL_STATIC_CAST( I1*, this ), \
+ SAL_STATIC_CAST( I2*, this ), \
+ SAL_STATIC_CAST( I3*, this ), \
+ SAL_STATIC_CAST( I4*, this ), \
+ SAL_STATIC_CAST( I5*, this ), \
+ SAL_STATIC_CAST( I6*, this ), \
+ SAL_STATIC_CAST( I7*, this ), \
+ SAL_STATIC_CAST( I8*, this ), \
+ SAL_STATIC_CAST( I9*, this ), \
+ SAL_STATIC_CAST( I10*, this ), \
+ SAL_STATIC_CAST( I11*, this ), \
+ SAL_STATIC_CAST( I12*, this ), \
+ SAL_STATIC_CAST( I13*, this ), \
+ SAL_STATIC_CAST( I14*, this ), \
+ SAL_STATIC_CAST( I15*, this ) \
+QUERYINTERFACE_IMPL_END
+
+//=========================================================================
+//
+// XTypeProvider decl.
+//
+//=========================================================================
+
+#define XTYPEPROVIDER_DECL() \
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL \
+ getImplementationId() \
+ throw( com::sun::star::uno::RuntimeException ); \
+ virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL \
+ getTypes() \
+ throw( com::sun::star::uno::RuntimeException );
+
+//=========================================================================
+//
+// XTypeProvider impl. internals
+//
+//=========================================================================
+
+#define XTYPEPROVIDER_COMMON_IMPL( Class ) \
+com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL \
+Class::getImplementationId() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ static cppu::OImplementationId* pId = NULL; \
+ if ( !pId ) \
+ { \
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); \
+ if ( !pId ) \
+ { \
+ static cppu::OImplementationId id( sal_False ); \
+ pId = &id; \
+ } \
+ } \
+ return (*pId).getImplementationId(); \
+}
+
+#define GETTYPES_IMPL_START( Class ) \
+com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL \
+Class::getTypes() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ static cppu::OTypeCollection* pCollection = NULL; \
+ if ( !pCollection ) \
+ { \
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); \
+ if ( !pCollection ) \
+ { \
+ static cppu::OTypeCollection collection(
+
+#define GETTYPES_IMPL_END \
+ ); \
+ pCollection = &collection; \
+ } \
+ } \
+ return (*pCollection).getTypes(); \
+}
+
+//=========================================================================
+//
+// XTypeProvider impl.
+//
+//=========================================================================
+
+// 1 interface supported
+#define XTYPEPROVIDER_IMPL_1( Class, I1 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ) \
+GETTYPES_IMPL_END
+
+// 2 interfaces supported
+#define XTYPEPROVIDER_IMPL_2( Class, I1,I2 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ) \
+GETTYPES_IMPL_END
+
+// 3 interfaces supported
+#define XTYPEPROVIDER_IMPL_3( Class, I1,I2,I3 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ) \
+GETTYPES_IMPL_END
+
+// 4 interfaces supported
+#define XTYPEPROVIDER_IMPL_4( Class, I1,I2,I3,I4 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ) \
+GETTYPES_IMPL_END
+
+// 5 interfaces supported
+#define XTYPEPROVIDER_IMPL_5( Class, I1,I2,I3,I4,I5 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ) \
+GETTYPES_IMPL_END
+
+// 6 interfaces supported
+#define XTYPEPROVIDER_IMPL_6( Class, I1,I2,I3,I4,I5,I6 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ) \
+GETTYPES_IMPL_END
+
+// 7 interfaces supported
+#define XTYPEPROVIDER_IMPL_7( Class, I1,I2,I3,I4,I5,I6,I7 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ) \
+GETTYPES_IMPL_END
+
+// 8 interfaces supported
+#define XTYPEPROVIDER_IMPL_8( Class, I1,I2,I3,I4,I5,I6,I7,I8 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ) \
+GETTYPES_IMPL_END
+
+// 9 interfaces supported
+#define XTYPEPROVIDER_IMPL_9( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ) \
+GETTYPES_IMPL_END
+
+// 10 interfaces supported
+#define XTYPEPROVIDER_IMPL_10( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ) \
+GETTYPES_IMPL_END
+
+// 11 interfaces supported
+#define XTYPEPROVIDER_IMPL_11( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ) \
+GETTYPES_IMPL_END
+
+// 12 interfaces supported
+#define XTYPEPROVIDER_IMPL_12( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ), \
+ CPPU_TYPE_REF( I12 ) \
+GETTYPES_IMPL_END
+
+// 13 interfaces supported
+#define XTYPEPROVIDER_IMPL_13( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ), \
+ CPPU_TYPE_REF( I12 ), \
+ CPPU_TYPE_REF( I13 ) \
+GETTYPES_IMPL_END
+
+// 14 interfaces supported
+#define XTYPEPROVIDER_IMPL_14( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ), \
+ CPPU_TYPE_REF( I12 ), \
+ CPPU_TYPE_REF( I13 ), \
+ CPPU_TYPE_REF( I14 ) \
+GETTYPES_IMPL_END
+
+// 15 interfaces supported
+#define XTYPEPROVIDER_IMPL_15( Class, I1,I2,I3,I4,I5,I6,I7,I8,I9,I10,I11,I12,I13,I14,I15 ) \
+XTYPEPROVIDER_COMMON_IMPL( Class ) \
+GETTYPES_IMPL_START( Class ) \
+ CPPU_TYPE_REF( I1 ), \
+ CPPU_TYPE_REF( I2 ), \
+ CPPU_TYPE_REF( I3 ), \
+ CPPU_TYPE_REF( I4 ), \
+ CPPU_TYPE_REF( I5 ), \
+ CPPU_TYPE_REF( I6 ), \
+ CPPU_TYPE_REF( I7 ), \
+ CPPU_TYPE_REF( I8 ), \
+ CPPU_TYPE_REF( I9 ), \
+ CPPU_TYPE_REF( I10 ), \
+ CPPU_TYPE_REF( I11 ), \
+ CPPU_TYPE_REF( I12 ), \
+ CPPU_TYPE_REF( I13 ), \
+ CPPU_TYPE_REF( I14 ), \
+ CPPU_TYPE_REF( I15 ) \
+GETTYPES_IMPL_END
+
+//=========================================================================
+//
+// XServiceInfo decl.
+//
+//=========================================================================
+
+#define XSERVICEINFO_NOFACTORY_DECL() \
+ virtual rtl::OUString SAL_CALL \
+ getImplementationName() \
+ throw( com::sun::star::uno::RuntimeException ); \
+ virtual sal_Bool SAL_CALL \
+ supportsService( const rtl::OUString& ServiceName ) \
+ throw( com::sun::star::uno::RuntimeException ); \
+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL \
+ getSupportedServiceNames() \
+ throw( com::sun::star::uno::RuntimeException ); \
+ \
+ static rtl::OUString \
+ getImplementationName_Static(); \
+ static com::sun::star::uno::Sequence< rtl::OUString > \
+ getSupportedServiceNames_Static();
+
+#define XSERVICEINFO_DECL() \
+ XSERVICEINFO_NOFACTORY_DECL() \
+ \
+ static com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory > \
+ createServiceFactory( const com::sun::star::uno::Reference< \
+ com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr );
+
+//=========================================================================
+//
+// XServiceInfo impl. internals
+//
+//=========================================================================
+
+#define XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+rtl::OUString SAL_CALL Class::getImplementationName() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ return getImplementationName_Static(); \
+} \
+ \
+rtl::OUString Class::getImplementationName_Static() \
+{ \
+ return ImplName; \
+} \
+ \
+sal_Bool SAL_CALL \
+Class::supportsService( const rtl::OUString& ServiceName ) \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ com::sun::star::uno::Sequence< rtl::OUString > aSNL = \
+ getSupportedServiceNames(); \
+ const rtl::OUString* pArray = aSNL.getArray(); \
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) \
+ { \
+ if( pArray[ i ] == ServiceName ) \
+ return sal_True; \
+ } \
+ \
+ return sal_False; \
+} \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL \
+Class::getSupportedServiceNames() \
+ throw( com::sun::star::uno::RuntimeException ) \
+{ \
+ return getSupportedServiceNames_Static(); \
+}
+
+#define XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \
+static com::sun::star::uno::Reference< \
+ com::sun::star::uno::XInterface > SAL_CALL \
+Class##_CreateInstance( const com::sun::star::uno::Reference< \
+ com::sun::star::lang::XMultiServiceFactory> & rSMgr ) \
+ throw( com::sun::star::uno::Exception ) \
+{ \
+ com::sun::star::lang::XServiceInfo* pX = \
+ (com::sun::star::lang::XServiceInfo*)new Class( rSMgr ); \
+ return com::sun::star::uno::Reference< \
+ com::sun::star::uno::XInterface >::query( pX ); \
+}
+
+//=========================================================================
+//
+// XServiceInfo impl.
+//
+//=========================================================================
+
+#define ONE_INSTANCE_SERVICE_FACTORY_IMPL( Class ) \
+com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory > \
+Class::createServiceFactory( const com::sun::star::uno::Reference< \
+ com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr ) \
+{ \
+ return com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory >( \
+ cppu::createOneInstanceFactory( \
+ rxServiceMgr, \
+ Class::getImplementationName_Static(), \
+ Class##_CreateInstance, \
+ Class::getSupportedServiceNames_Static() ) ); \
+}
+
+#define SINGLE_SERVICE_FACTORY_IMPL( Class ) \
+com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory > \
+Class::createServiceFactory( const com::sun::star::uno::Reference< \
+ com::sun::star::lang::XMultiServiceFactory >& rxServiceMgr ) \
+{ \
+ return com::sun::star::uno::Reference< \
+ com::sun::star::lang::XSingleServiceFactory >( \
+ cppu::createSingleFactory( \
+ rxServiceMgr, \
+ Class::getImplementationName_Static(), \
+ Class##_CreateInstance, \
+ Class::getSupportedServiceNames_Static() ) ); \
+}
+
+// Service without service factory.
+
+// Own implementation of getSupportedServiceNames_Static().
+#define XSERVICEINFO_NOFACTORY_IMPL_0( Class, ImplName ) \
+XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > \
+Class::getSupportedServiceNames_Static()
+
+// 1 service name
+#define XSERVICEINFO_NOFACTORY_IMPL_1( Class, ImplName, Service1 ) \
+XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > \
+Class::getSupportedServiceNames_Static() \
+{ \
+ com::sun::star::uno::Sequence< rtl::OUString > aSNS( 1 ); \
+ aSNS.getArray()[ 0 ] = Service1; \
+ return aSNS; \
+}
+
+// Service with service factory.
+
+// Own implementation of getSupportedServiceNames_Static().
+#define XSERVICEINFO_IMPL_0( Class, ImplName ) \
+XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > \
+Class::getSupportedServiceNames_Static()
+
+// 1 service name
+#define XSERVICEINFO_IMPL_1( Class, ImplName, Service1 ) \
+XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > \
+Class::getSupportedServiceNames_Static() \
+{ \
+ com::sun::star::uno::Sequence< rtl::OUString > aSNS( 1 ); \
+ aSNS.getArray()[ 0 ] = Service1; \
+ return aSNS; \
+}
+
+#endif /* !_UCBHELPER_MACROS_HXX */
diff --git a/ucbhelper/inc/ucbhelper/propertyvalueset.hxx b/ucbhelper/inc/ucbhelper/propertyvalueset.hxx
new file mode 100644
index 000000000000..910e35aa4810
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/propertyvalueset.hxx
@@ -0,0 +1,407 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: propertyvalueset.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_PROPERTYVALUESET_HXX
+#define _UCBHELPER_PROPERTYVALUESET_HXX
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <cppuhelper/weak.hxx>
+
+#include "osl/mutex.hxx"
+#include <ucbhelper/macros.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace script {
+ class XTypeConverter;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace beans {
+ struct Property;
+ struct PropertyValue;
+ class XPropertySet;
+} } } }
+
+namespace ucbhelper {
+
+class PropertyValues;
+
+//=========================================================================
+
+/**
+ * This class implements the interface XRow. After construction of a valueset
+ * the user can append properties ( incl. its values ) to the set. This class
+ * is useful when implementing the command "getPropertyValues", because the
+ * values to return can easyly appended to a valueset object. That object can
+ * directly be returned by the implementation of the command.
+ */
+class UCBHELPER_DLLPUBLIC PropertyValueSet :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::sdbc::XRow,
+ public com::sun::star::sdbc::XColumnLocate
+{
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ m_xSMgr;
+ com::sun::star::uno::Reference< com::sun::star::script::XTypeConverter >
+ m_xTypeConverter;
+ osl::Mutex m_aMutex;
+ PropertyValues* m_pValues;
+ sal_Bool m_bWasNull;
+ sal_Bool m_bTriedToGetTypeConverter;
+
+private:
+ UCBHELPER_DLLPRIVATE const com::sun::star::uno::Reference<
+ com::sun::star::script::XTypeConverter >&
+ getTypeConverter();
+
+public:
+ PropertyValueSet(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr );
+ PropertyValueSet(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const com::sun::star::uno::Sequence<
+ com::sun::star::beans::PropertyValue >& rValues );
+ virtual ~PropertyValueSet();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XRow
+ virtual sal_Bool SAL_CALL
+ wasNull()
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL
+ getString( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ getBoolean( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int8 SAL_CALL
+ getByte( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int16 SAL_CALL
+ getShort( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL
+ getInt( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int64 SAL_CALL
+ getLong( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual float SAL_CALL
+ getFloat( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual double SAL_CALL
+ getDouble( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getBytes( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::util::Date SAL_CALL
+ getDate( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::util::Time SAL_CALL
+ getTime( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::util::DateTime SAL_CALL
+ getTimestamp( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream > SAL_CALL
+ getBinaryStream( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream > SAL_CALL
+ getCharacterStream( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getObject( sal_Int32 columnIndex,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameAccess >& typeMap )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XRef > SAL_CALL
+ getRef( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XBlob > SAL_CALL
+ getBlob( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XClob > SAL_CALL
+ getClob( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XArray > SAL_CALL
+ getArray( sal_Int32 columnIndex )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XColumnLocate
+ virtual sal_Int32 SAL_CALL
+ findColumn( const ::rtl::OUString& columnName )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns the number of elements of the value set.
+ *
+ * @return the number of elements of the value set.
+ */
+ sal_Int32 getLength() const;
+
+ /**
+ * This method appends a string to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendString ( const ::com::sun::star::beans::Property& rProp,
+ const ::rtl::OUString& rValue );
+
+ /**
+ * This method appends a boolean to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendBoolean ( const ::com::sun::star::beans::Property& rProp,
+ sal_Bool bValue );
+
+ /**
+ * This method appends a byte to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendByte ( const ::com::sun::star::beans::Property& rProp,
+ sal_Int8 nValue );
+
+ /**
+ * This method appends a short to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendShort ( const ::com::sun::star::beans::Property& rProp,
+ sal_Int16 nValue );
+
+ /**
+ * This method appends an int to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendInt ( const ::com::sun::star::beans::Property& rProp,
+ sal_Int32 nValue );
+
+ /**
+ * This method appends a long to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendLong ( const ::com::sun::star::beans::Property& rProp,
+ sal_Int64 nValue );
+
+ /**
+ * This method appends a float to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendFloat ( const ::com::sun::star::beans::Property& rProp,
+ float nValue );
+
+ /**
+ * This method appends a double to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendDouble ( const ::com::sun::star::beans::Property& rProp,
+ double nValue );
+
+ /**
+ * This method appends a byte sequence to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendBytes ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Sequence<
+ sal_Int8 >& rValue );
+
+ /**
+ * This method appends a date to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendDate ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::util::Date& rValue );
+
+ /**
+ * This method appends a time to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendTime ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::util::Time& rValue );
+
+ /**
+ * This method appends a timestamp to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendTimestamp( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::util::DateTime& rValue );
+
+ /**
+ * This method appends a binary stream to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendBinaryStream ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >&
+ rValue );
+
+ /**
+ * This method appends a character stream to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendCharacterStream( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream >&
+ rValue );
+
+ /**
+ * This method appends an object ( any ) to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendObject ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Any& rValue );
+
+ /**
+ * This method appends a ref to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendRef ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XRef >& rValue );
+
+ /**
+ * This method appends a blob to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendBlob ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XBlob >& rValue );
+
+ /**
+ * This method appends a clob to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendClob ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XClob >& rValue );
+
+ /**
+ * This method appends an array to the value set.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendArray ( const ::com::sun::star::beans::Property& rProp,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::sdbc::XArray >& rValue );
+
+ /**
+ * This method appends a void value ( a "hole" ) to the value set. This
+ * is useful, since void values indicate errors, like non-existing
+ * property (-values) etc.
+ *
+ * @param rProp is the property the value belongs to.
+ */
+ void appendVoid ( const ::com::sun::star::beans::Property& rProp );
+
+ /**
+ * This method tries to append all property values contained in a
+ * property set to the value set.
+ *
+ * @param rSet is a property set containing the property values.
+ */
+ void appendPropertySet( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& rSet );
+
+ /** This method tries to append a single property value contained in a
+ * property set to the value set.
+ *
+ * @param rSet is a property set containing the property values.
+ * @param rProperty is the property for that the value shall be obtained
+ * from the given property set.
+ * @return False, if the property value cannot be obtained from the
+ * given property pet. True, otherwise.
+ */
+ sal_Bool appendPropertySetValue(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& rSet,
+ const ::com::sun::star::beans::Property& rProperty );
+};
+
+}
+
+#endif /* !_UCBHELPER_PROPERTYVALUESET_HXX */
diff --git a/ucbhelper/inc/ucbhelper/providerhelper.hxx b/ucbhelper/inc/ucbhelper/providerhelper.hxx
new file mode 100644
index 000000000000..fcc43a3762f1
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/providerhelper.hxx
@@ -0,0 +1,288 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: providerhelper.hxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_PROVIDERHELPER_HXX
+#define _UCBHELPER_PROVIDERHELPER_HXX
+
+#ifndef __LIST__
+#include <list>
+#endif
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <cppuhelper/weak.hxx>
+
+#include "osl/mutex.hxx"
+#include "rtl/ref.hxx"
+#include <ucbhelper/macros.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+//=========================================================================
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class XPropertySetRegistry;
+ class XPersistentPropertySet;
+} } } }
+
+namespace ucbhelper_impl { struct ContentProviderImplHelper_Impl; }
+
+namespace ucbhelper {
+
+//=========================================================================
+
+class ContentImplHelper;
+typedef rtl::Reference< ContentImplHelper > ContentImplHelperRef;
+typedef std::list< ContentImplHelperRef > ContentRefList;
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.ContentProvider. It provides contents derived from
+ * class ucb::ContentImplHelper.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - maintains a set of ContentImplHelper objects, which were created by
+ * the provider implementation. So there will be exactly one object for
+ * one Content Identifier.
+ * - Provides access to the Additional Core PropertySet of a content.
+ * ( These set contains the properties added to a content using its
+ * XPropertyContainer interface )
+ */
+class UCBHELPER_DLLPUBLIC ContentProviderImplHelper : public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::ucb::XContentProvider
+{
+ friend class ContentImplHelper;
+
+ ucbhelper_impl::ContentProviderImplHelper_Impl* m_pImpl;
+
+protected:
+ osl::Mutex m_aMutex;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+
+private:
+ UCBHELPER_DLLPRIVATE void removeContent( ContentImplHelper* pContent );
+
+ UCBHELPER_DLLPRIVATE ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XPropertySetRegistry >
+ getAdditionalPropertySetRegistry();
+
+ UCBHELPER_DLLPRIVATE void cleanupRegisteredContents();
+
+protected:
+ /**
+ * This method returns a content with the given id, if it already exists.
+ * Use this method in your "queryContent" implementation to ensure unique
+ * objects.
+ *
+ * @param Identifier is the content identifier, for that an existing
+ * content object is requested.
+ * @return the content with the given identifier, if it exists or 0, if it
+ * does not exist.
+ */
+ rtl::Reference< ContentImplHelper >
+ queryExistingContent( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Identifier );
+
+ /**
+ * This method returns a content with the given URL, if it already exists.
+ *
+ * @param rURL is the URL ( content identifier string ), for that an
+ * existing content object is requested.
+ * @return the content with the given URL, if it exists or 0, if it
+ * does not exist.
+ */
+ rtl::Reference< ContentImplHelper >
+ queryExistingContent( const ::rtl::OUString& rURL );
+
+ /**
+ * This method registers a newly created content instance with the
+ * content provider. It should be called directly after creating a new
+ * content instance. The provider can reuse a registered instance upon
+ * subsedent requests for content instances with an idententifier
+ * of a registered instance.
+ * Note that the provider does not hold a hard reference on the
+ * registered instance. If last external reference is gone, the provider
+ * will remove the instance from its inventory of known instances.
+ * Nothing will happen in case an already registered instance shall
+ * be registered more than once.
+ *
+ * @param the content instance that is to be registered.
+ */
+ void registerNewContent(
+ const com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContent > & xContent );
+
+public:
+
+ //////////////////////////////////////////////////////////////////////
+ // Contsruction/Destruction
+ //////////////////////////////////////////////////////////////////////
+
+ ContentProviderImplHelper(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rXSMgr );
+ virtual ~ContentProviderImplHelper();
+
+ //////////////////////////////////////////////////////////////////////
+ // XInterface
+ //////////////////////////////////////////////////////////////////////
+
+ XINTERFACE_DECL()
+
+ //////////////////////////////////////////////////////////////////////
+ // XTypeProvider
+ //////////////////////////////////////////////////////////////////////
+
+ XTYPEPROVIDER_DECL()
+
+ //////////////////////////////////////////////////////////////////////
+ // XServiceInfo
+ //////////////////////////////////////////////////////////////////////
+
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException ) = 0;
+ virtual sal_Bool SAL_CALL
+ supportsService( const ::rtl::OUString& ServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ //////////////////////////////////////////////////////////////////////
+ // XContentProvider
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns a content with the requested id.
+ *
+ * The implementation should:
+ *
+ * - Check, whether the Identifier is valid ( URL syntax ).
+ * - Use queryExistingContent(...) to determine, whether there exists
+ * already a content with the given id.
+ * - Return the possibly existing content.Create and return a new
+ * content, otherwise
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContent > SAL_CALL
+ queryContent( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Identifier )
+ throw( ::com::sun::star::ucb::IllegalIdentifierException,
+ ::com::sun::star::uno::RuntimeException ) = 0;
+ virtual sal_Int32 SAL_CALL
+ compareContentIds( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Id1,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Id2 )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns a mutex, which protects the content list of the
+ * provider. So you can prevent modifications of that list easyly.
+ *
+ * @return the mutex.
+ */
+ osl::Mutex& getContentListMutex() { return m_aMutex; }
+
+ /**
+ * This method fills a list with all contents existing at calling time.
+ * Note: You may prevent modifications of the content list at any time
+ * by acquiring the content list mutex of the provider.
+ *
+ * @param rContents is the list to fill with the children.
+ */
+ void queryExistingContents( ContentRefList& rContents );
+
+ /**
+ * This method returns the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rKey is the key for the propertyset.
+ * @param bCreate is a flag indicating whether the propertyset shall
+ * be created in case it does not exist.
+ * @return the propertyset containing the Additional Core Properties.
+ */
+ ::com::sun::star::uno::Reference<
+ com::sun::star::ucb::XPersistentPropertySet >
+ getAdditionalPropertySet( const ::rtl::OUString& rKey, sal_Bool bCreate );
+
+ /**
+ * This method renames the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rOldKey is the old key of the propertyset.
+ * @param rNewKey is the new key for the propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be renamed, too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool renameAdditionalPropertySet( const ::rtl::OUString& rOldKey,
+ const ::rtl::OUString& rNewKey,
+ sal_Bool bRecursive );
+
+ /**
+ * This method copies the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rSourceKey is the key of the source propertyset.
+ * @param rTargetKey is the key of the target propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rSourceKey shall be copied, too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool copyAdditionalPropertySet( const ::rtl::OUString& rSourceKey,
+ const ::rtl::OUString& rTargetKey,
+ sal_Bool bRecursive );
+
+ /**
+ * This method removes the propertyset containing the Additional Core
+ * Properties of a content.
+ *
+ * @param rKey is the key of the propertyset.
+ * @param bRecursive is a flag indicating whether propertysets for
+ * children described by rOldKey shall be removed, too.
+ * @return True, if the operation succeeded - False, otherwise.
+ */
+ sal_Bool removeAdditionalPropertySet( const ::rtl::OUString& rKey,
+ sal_Bool bRecursive );
+};
+
+} // namespace ucbhelper
+
+#endif /* !_UCBHELPER_PROVIDERHELPER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/proxydecider.hxx b/ucbhelper/inc/ucbhelper/proxydecider.hxx
new file mode 100644
index 000000000000..219b3aa5870f
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/proxydecider.hxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: proxydecider.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_PROXYDECIDER_HXX
+#define _UCBHELPER_PROXYDECIDER_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XMultiServiceFactory;
+} } } }
+
+namespace ucbhelper
+{
+
+/**
+ * This struct describes a proxy server.
+ */
+struct InternetProxyServer
+{
+ /**
+ * The name of the proxy server.
+ */
+ ::rtl::OUString aName;
+
+ /**
+ * The port of the proxy server.
+ */
+ sal_Int32 nPort;
+
+ /**
+ * Constructor.
+ */
+ InternetProxyServer() : nPort( -1 ) {}
+};
+
+namespace proxydecider_impl { class InternetProxyDecider_Impl; }
+
+/**
+ * This class is able to decide whether and which internet proxy server is to
+ * be used to access a given URI.
+ *
+ * The implementation reads the internet proxy settings from Office
+ * configuration. It listens for configuration changes and adapts itself
+ * accordingly. Because configuration data can change during runtime clients
+ * should not cache results obtained from InternetProxyDecider instances. One
+ * instance should be kept to be queried multiple times instead.
+ */
+class UCBHELPER_DLLPUBLIC InternetProxyDecider
+{
+public:
+ /**
+ * Constructor.
+ *
+ * Note: Every instance should be held alive as long as possible because
+ * because construction is quite expensive.
+ *
+ * @param rxSMgr is a Service Manager.
+ */
+ InternetProxyDecider( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr );
+
+ /**
+ * Destructor.
+ */
+ ~InternetProxyDecider();
+
+ /**
+ * Informs whether a proxy server should be used.
+ *
+ * @param rProtocol contains the internet protocol to be used to
+ * access the server (i.e. "ftp", "http"). The protocol string
+ * is handled case-insensitive and must not be empty.
+ * @param rHost contains the name of the server that should be accessed.
+ * This parameter might be left empty. In this case the
+ * implementation will return whether a proxy is configured
+ * for the given protocol.
+ * @param nPort contains the port of the server that should be accessed.
+ * If host is not empty this parameter must always contain a valid
+ * port number, for instance the default port for the requested
+ * protocol(i.e. 80 or http).
+ * @return true if a proxy server should be used, false otherwise.
+ */
+ bool
+ shouldUseProxy( const rtl::OUString & rProtocol,
+ const rtl::OUString & rHost,
+ sal_Int32 nPort ) const;
+
+ /**
+ * Returns the proxy server to be used.
+ *
+ * @param rProtocol contains the internet protocol to be used to
+ * access the server (i.e. "ftp", "http"). The protocol string
+ * is handled case-insensitive and must not be empty.
+ * @param rHost contains the name of the server that should be accessed.
+ * This parameter might be left empty. In this case the
+ * implementation will return the proxy that is configured
+ * for the given protocol.
+ * @param nPort contains the port of the server that should be accessed.
+ * If host is not empty this parameter must always contain a valid
+ * port number, for instance the default port for the requested
+ * protocol(i.e. 80 or http).
+ * @return a InternetProxyServer reference. If member aName of the
+ * InternetProxyServer is empty no proxy server is to be used.
+ */
+ const InternetProxyServer &
+ getProxy( const rtl::OUString & rProtocol,
+ const rtl::OUString & rHost,
+ sal_Int32 nPort ) const;
+
+private:
+ proxydecider_impl::InternetProxyDecider_Impl * m_pImpl;
+};
+
+} // namespace ucbhelper
+
+#endif /* !_UCBHELPER_PROXYDECIDER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/resultset.hxx b/ucbhelper/inc/ucbhelper/resultset.hxx
new file mode 100644
index 000000000000..8ab560245b58
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/resultset.hxx
@@ -0,0 +1,582 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: resultset.hxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_RESULTSET_HXX
+#define _UCBHELPER_RESULTSET_HXX
+
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/ucb/ResultSetException.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include "rtl/ref.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+#include <cppuhelper/weak.hxx>
+#include <ucbhelper/macros.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace ucbhelper {
+
+//=========================================================================
+
+#define RESULTSET_SERVICE_NAME "com.sun.star.ucb.ContentResultSet"
+
+//=========================================================================
+
+class ResultSetDataSupplier;
+struct ResultSet_Impl;
+
+/**
+ * This is an implementation of the service com.sun.star.ucb.ContentResultSet.
+ * It can be used to implement the method XDynamicResultSet::getStaticResultSet,
+ * which needs to be implemented for instance to implement the command "open"
+ * at folder objects. This class uses a user supplied ResultSetDataSupplier
+ * object to request data on demand.
+ *
+ * @see ResultSetDataSupplier
+ */
+class UCBHELPER_DLLPUBLIC ResultSet :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::lang::XComponent,
+ public com::sun::star::ucb::XContentAccess,
+ public com::sun::star::sdbc::XResultSet,
+ public com::sun::star::sdbc::XResultSetMetaDataSupplier,
+ public com::sun::star::sdbc::XRow,
+ public com::sun::star::sdbc::XCloseable,
+ public com::sun::star::beans::XPropertySet
+{
+ ResultSet_Impl* m_pImpl;
+
+public:
+ /**
+ * Construction.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rProperties is a sequence of properties for that the resultset
+ * shall be able to obtain the values.
+ * @param rDataSupplier is a supplier for the resultset data.
+ */
+ ResultSet(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const com::sun::star::uno::Sequence<
+ com::sun::star::beans::Property >& rProperties,
+ const rtl::Reference< ResultSetDataSupplier >& rDataSupplier );
+ /**
+ * Construction.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rProperties is a sequence of properties for that the resultset
+ * shall be able to obtain the values.
+ * @param rDataSupplier is a supplier for the resultset data.
+ * @param rxEnv is the environment for interactions, progress propagation,
+ * ...
+ */
+ ResultSet(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const com::sun::star::uno::Sequence<
+ com::sun::star::beans::Property >& rProperties,
+ const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& rxEnv );
+ virtual ~ResultSet();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ XSERVICEINFO_NOFACTORY_DECL()
+
+ // XComponent
+ virtual void SAL_CALL
+ dispose()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ addEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XContentAccess
+ virtual rtl::OUString SAL_CALL
+ queryContentIdentifierString()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier > SAL_CALL
+ queryContentIdentifier()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContent > SAL_CALL
+ queryContent()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XResultSetMetaDataSupplier
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XResultSetMetaData > SAL_CALL
+ getMetaData()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+
+ // XResultSet
+ virtual sal_Bool SAL_CALL
+ next()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ isBeforeFirst()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ isAfterLast()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ isFirst()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ isLast()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ beforeFirst()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ afterLast()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ first()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ last()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL
+ getRow()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ absolute( sal_Int32 row )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ relative( sal_Int32 rows )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ previous()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ refreshRow()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ rowUpdated()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ rowInserted()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ rowDeleted()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::uno::XInterface > SAL_CALL
+ getStatement()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+
+ // XRow
+ virtual sal_Bool SAL_CALL
+ wasNull()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL
+ getString( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL
+ getBoolean( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int8 SAL_CALL
+ getByte( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int16 SAL_CALL
+ getShort( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL
+ getInt( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual sal_Int64 SAL_CALL
+ getLong( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual float SAL_CALL
+ getFloat( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual double SAL_CALL
+ getDouble( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
+ getBytes( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::util::Date SAL_CALL
+ getDate( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::util::Time SAL_CALL
+ getTime( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::util::DateTime SAL_CALL
+ getTimestamp( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > SAL_CALL
+ getBinaryStream( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::io::XInputStream > SAL_CALL
+ getCharacterStream( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Any SAL_CALL
+ getObject( sal_Int32 columnIndex,
+ const com::sun::star::uno::Reference<
+ com::sun::star::container::XNameAccess >& typeMap )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XRef > SAL_CALL
+ getRef( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XBlob > SAL_CALL
+ getBlob( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XClob > SAL_CALL
+ getClob( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XArray > SAL_CALL
+ getArray( sal_Int32 columnIndex )
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+
+ // XCloseable
+ virtual void SAL_CALL
+ close()
+ throw( com::sun::star::sdbc::SQLException,
+ com::sun::star::uno::RuntimeException );
+
+ // XPropertySet
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ setPropertyValue( const rtl::OUString& aPropertyName,
+ const com::sun::star::uno::Any& aValue )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::beans::PropertyVetoException,
+ com::sun::star::lang::IllegalArgumentException,
+ com::sun::star::lang::WrappedTargetException,
+ com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Any SAL_CALL
+ getPropertyValue( const rtl::OUString& PropertyName )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::lang::WrappedTargetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ addPropertyChangeListener( const rtl::OUString& aPropertyName,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::lang::WrappedTargetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removePropertyChangeListener( const rtl::OUString& aPropertyName,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::lang::WrappedTargetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ addVetoableChangeListener( const rtl::OUString& PropertyName,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::lang::WrappedTargetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeVetoableChangeListener( const rtl::OUString& PropertyName,
+ const com::sun::star::uno::Reference<
+ com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw( com::sun::star::beans::UnknownPropertyException,
+ com::sun::star::lang::WrappedTargetException,
+ com::sun::star::uno::RuntimeException );
+
+ /////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ /////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method propagates property value changes to all registered
+ * listeners.
+ *
+ * @param rEvt is a property change event.
+ */
+ void propertyChanged(
+ const com::sun::star::beans::PropertyChangeEvent& rEvt );
+
+ /**
+ * This method should be called by the data supplier for the result set
+ * to indicate that there were new data obtained from the data source.
+ *
+ * @param nOld is the old count of rows; must be non-negative.
+ * @param nnew is the new count of rows; must be non-negative.
+ */
+ void rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew );
+
+ /**
+ * This method should be called by the data supplier for the result set
+ * to indicate that there were all rows obtained from the data source.
+ */
+ void rowCountFinal();
+
+ /**
+ * This method returns a sequence containing all properties ( not the
+ * values! ) of the result set.
+ *
+ * @return a sequence of properties.
+ */
+ const com::sun::star::uno::Sequence< com::sun::star::beans::Property >&
+ getProperties();
+
+ /**
+ * This method returns the environment to use for interactions, progress
+ * propagation, ... It can by empty.
+ *
+ * @return an environment or an empty reference.
+ */
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >&
+ getEnvironment();
+};
+
+//=========================================================================
+
+/**
+ * This is the base class for an object that supplies data to a result set
+ *
+ * @see ResultSet
+ */
+class ResultSetDataSupplier : public salhelper::SimpleReferenceObject
+{
+ friend class ResultSet;
+
+ // No ref, otherwise we get a cyclic reference between supplier and set!
+ // Will be set from ResultSet ctor.
+ ResultSet* m_pResultSet;
+
+public:
+ ResultSetDataSupplier() : m_pResultSet( 0 ) {}
+
+ /**
+ * This method returns the resultset this supplier belongs to.
+ *
+ * @return the resultset for that the supplier supplies data.
+ */
+ rtl::Reference< ResultSet > getResultSet() const { return m_pResultSet; }
+
+ /**
+ * This method returns the identifier string of the content at the
+ * specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier; must be non-negative.
+ * @return the content's identifier string.
+ */
+ virtual rtl::OUString queryContentIdentifierString( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the identifier of the content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier; must be non-negative.
+ * @return the content's identifier.
+ */
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier >
+ queryContentIdentifier( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the the content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier; must be non-negative.
+ * @return the content.
+ */
+ virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
+ queryContent( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns whether there is a content at the specified index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier; must be non-negative.
+ * @return true, if there is a content at the given index.
+ */
+ virtual sal_Bool getResult( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method returns the total count of objects in the logical data array
+ * of the supplier. The implementation of this method may be very
+ * "expensive", because it can be necessary to obtain all data in order
+ * to determine the count. Therefor the ResultSet implementation calls
+ * it very seldom.
+ *
+ * @return the total count of objects; will always be non-negative.
+ */
+ virtual sal_uInt32 totalCount() = 0;
+
+ /**
+ * This method returns the count of objects obtained so far. There is no
+ * for the implemetation to obtain all objects at once. It can obtain
+ * all data on demand.
+ *
+ * The implementation should call m_pResultSet->rowCountChanged(...)
+ * everytime it has inserted a new entry in its logical result array.
+ *
+ * @return the count of objects obtained so far; will always be
+ * non-negative.
+ */
+ virtual sal_uInt32 currentCount() = 0;
+
+ /**
+ * This method returns whether the value returned by currentCount() is
+ * "final". This is the case, if that there was all data obtained by the
+ * supplier and the current count won't increase any more.
+ *
+ * The implementation should call m_pResultSet->rowCountFinal(...) if
+ * it has inserted all entries in its logical result array.
+ *
+ * @return true, if the the value returned by currentCount() won't change
+ anymore.
+ */
+ virtual sal_Bool isCountFinal() = 0;
+
+ /**
+ * This method returns an object for accessing the property values at
+ * the specified index. The implementation may use the helper class
+ * ucb::PropertyValueSet to provide the return value.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ * @return the object for accessing the property values.
+ */
+ virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
+ queryPropertyValues( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method is called to instruct the supplier to release the (possibly
+ * presnt) property values at the given index.
+ *
+ * @param nIndex is the zero-based index within the logical data array
+ * of the supplier.
+ */
+ virtual void releasePropertyValues( sal_uInt32 nIndex ) = 0;
+
+ /**
+ * This method will be called by the resultset implementation in order
+ * to instruct the data supplier to release all resources it has
+ * allocated so far. In case the supplier is collecting data
+ * asynchronously, that process must be stopped.
+ */
+ virtual void close() = 0;
+
+ /**
+ * This method will be called by the resultset implementation in order
+ * check, whether an error has occured while collecting data. The
+ * implementation of this method must throw an exception in that case.
+ *
+ * Note: An exception thrown to indicate an error must always be thrown
+ * by the thread that created the data supplier. If the supplier collects
+ * data asynchronously ( i.e. in a separate thread ) and an error
+ * occures, throwing of the appropriate exception must be deferred
+ * until validate() is called by the ResultSet implementation from
+ * inside the main thread.
+ * In case data are obtained synchronously, the ResultSetException can
+ * be thrown directly.
+ *
+ * @exception ResultSetException thrown, if an error has occured
+ */
+ virtual void validate()
+ throw( com::sun::star::ucb::ResultSetException ) = 0;
+};
+
+}
+
+#endif /* !_UCBHELPER_RESULTSET_HXX */
diff --git a/ucbhelper/inc/ucbhelper/resultsethelper.hxx b/ucbhelper/inc/ucbhelper/resultsethelper.hxx
new file mode 100644
index 000000000000..b8ac262c5b8f
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/resultsethelper.hxx
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: resultsethelper.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_RESULTSETHELPER_HXX
+#define _UCBHELPER_RESULTSETHELPER_HXX
+
+#include <osl/mutex.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ucb/XDynamicResultSet.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#include <cppuhelper/weak.hxx>
+#include <ucbhelper/macros.hxx>
+#include <ucbhelper/contenthelper.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace cppu {
+ class OInterfaceContainerHelper;
+}
+
+namespace ucbhelper {
+
+//=========================================================================
+
+#define DYNAMICRESULTSET_SERVICE_NAME "com.sun.star.ucb.DynamicResultSet"
+
+//=========================================================================
+
+/**
+ * This is an abstract base class for implementations of the service
+ * com.sun.star.ucb.DynamicResultSet, which is the result of the command
+ * "open" executed at a UCB folder content.
+ *
+ * Features of the base class implementation:
+ * - standard interfaces ( XInterface, XTypeProvider, XServiceInfo )
+ * - all required interfaces for service com::sun::star::ucb::DynamicResultSet
+ */
+class UCBHELPER_DLLPUBLIC ResultSetImplHelper :
+ public cppu::OWeakObject,
+ public com::sun::star::lang::XTypeProvider,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::ucb::XDynamicResultSet
+{
+ cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
+ sal_Bool m_bStatic;
+ sal_Bool m_bInitDone;
+
+protected:
+ osl::Mutex m_aMutex;
+ com::sun::star::ucb::OpenCommandArgument2 m_aCommand;
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ // Resultset #1
+ com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XResultSet > m_xResultSet1;
+ // Resultset #2
+ com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XResultSet > m_xResultSet2;
+ // Resultset changes listener.
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XDynamicResultSetListener > m_xListener;
+
+private:
+ UCBHELPER_DLLPRIVATE void init( sal_Bool bStatic );
+
+ /**
+ * Your implementation of this method has to fill the protected member
+ * m_xResultSet1. This resultset must implement a complete static
+ * resultset ( service com.sun.star.ucb.ContentResultSet ). This method
+ * will be called at most once in the life of your implementation object.
+ * After this method was called, the type of this resultset will be
+ * "static". There is no way to change the type afterwards.
+ * If this method gets called the client wants to use your resultset
+ * exclusively statically. You may deploy this factum to optimize your
+ * implementation (i.e. "switch off" all changes detection code in
+ * your implementation).
+ * Note that you may use the class ucb::ResultSet to implement the
+ * static resultset, that is required here.
+ */
+ UCBHELPER_DLLPRIVATE virtual void initStatic() = 0;
+
+ /**
+ * Your implementation of this method has to fill the protected members
+ * m_xResultSet1 and m_xResultSet2 of this base class. Each of these
+ * resultsets must implement a complete static resultset
+ * ( service com.sun.star.ucb.ContentResultSet ). This method will be
+ * called at most once in the life of your implementation object.
+ * After this method was called, the type of this resultset will be
+ * "dynamic". There is no way to change the type afterwards.
+ * If this method gets called the client wants to use your resultset
+ * exclusively dynamically. This means, it is interested in getting
+ * notifications on changes of data of the resultset contents. ( These
+ * changes are to propagate by your implementation throw the member
+ * m_xListener of this base class ).
+ * If your implementation cannot detect changes of relevant data, you
+ * may fill m_xResultSet1 and m_xResultSet2 with the same static resultset
+ * implementation object. This normally will be the same instance you put
+ * into m_xResultSet1 when initStatic() is called.
+ */
+ UCBHELPER_DLLPRIVATE virtual void initDynamic() = 0;
+
+public:
+ /**
+ * Construtor.
+ *
+ * @param rxSMgr is a Service Manager.
+ */
+ ResultSetImplHelper(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr );
+
+ /**
+ * Construtor.
+ *
+ * @param rxSMgr is a Service Manager.
+ * @param rCommand is the paramter for the open command that produces
+ * this resultset.
+ */
+ ResultSetImplHelper(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const com::sun::star::ucb::OpenCommandArgument2& rCommand );
+
+ /**
+ * Destructor.
+ */
+ virtual ~ResultSetImplHelper();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ XSERVICEINFO_NOFACTORY_DECL()
+
+ // XComponent ( base class of XDynamicResultSet )
+ virtual void SAL_CALL
+ dispose()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ addEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ removeEventListener( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener >& Listener )
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XDynamicResultSet
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::sdbc::XResultSet > SAL_CALL
+ getStaticResultSet()
+ throw( com::sun::star::ucb::ListenerAlreadySetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ setListener( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XDynamicResultSetListener >& Listener )
+ throw( com::sun::star::ucb::ListenerAlreadySetException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ connectToCache( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XDynamicResultSet > & xCache )
+ throw( com::sun::star::ucb::ListenerAlreadySetException,
+ com::sun::star::ucb::AlreadyInitializedException,
+ com::sun::star::ucb::ServiceNotFoundException,
+ com::sun::star::uno::RuntimeException );
+
+ /**
+ * The implemetation of this method always returns 0. Override this
+ * method, if necassary.
+ */
+ virtual sal_Int16 SAL_CALL
+ getCapabilities()
+ throw( com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * This method returns, whether the resultset is static or dynamic.
+ * If neither getStatic() nor getDynamic() was called, the type
+ * of the resultset is "dynamic".
+ *
+ * @return true, if the resultset type is "static". False, otherwise.
+ */
+ sal_Bool isStatic() const { return m_bStatic; }
+};
+
+}
+
+#endif /* !_UCBHELPER_RESULTSETHELPER_HXX */
diff --git a/ucbhelper/inc/ucbhelper/resultsetmetadata.hxx b/ucbhelper/inc/ucbhelper/resultsetmetadata.hxx
new file mode 100644
index 000000000000..ba7f0e992bf8
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/resultsetmetadata.hxx
@@ -0,0 +1,479 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: resultsetmetadata.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_RESULTSETMETADATA_HXX
+#define _UCBHELPER_RESULTSETMETADATA_HXX
+
+#include <vector>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#include <cppuhelper/weak.hxx>
+#include <ucbhelper/macros.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace lang { class XMultiServiceFactory; }
+ namespace beans { struct Property; }
+} } }
+
+namespace ucbhelper_impl {
+ struct ResultSetMetaData_Impl;
+}
+
+namespace ucbhelper
+{
+
+//=========================================================================
+
+/**
+ * This is a structure that holds additional meta data for one column
+ * of a resultset. The default values set in the constructor should be a
+ * good guess for many UCB use cases.
+ */
+struct ResultSetColumnData
+{
+ /** @see ResultSetMetaData::isAutoIncrement */
+ sal_Bool isAutoIncrement;
+
+ /** @see ResultSetMetaData::isCaseSensitive */
+ sal_Bool isCaseSensitive;
+
+ /** @see ResultSetMetaData::isSearchable */
+ sal_Bool isSearchable;
+
+ /** @see ResultSetMetaData::isCurrency */
+ sal_Bool isCurrency;
+
+ /** @see ResultSetMetaData::isNullable */
+ sal_Int32 isNullable;
+
+ /** @see ResultSetMetaData::isSigned */
+ sal_Bool isSigned;
+
+ /** @see ResultSetMetaData::getColumnDisplaySize */
+ sal_Int32 columnDisplaySize;
+
+ /** @see ResultSetMetaData::getColumnLabel */
+ ::rtl::OUString columnLabel;
+
+ /** @see ResultSetMetaData::getSchemaName */
+ ::rtl::OUString schemaName;
+
+ /** @see ResultSetMetaData::getPrecision */
+ sal_Int32 precision;
+
+ /** @see ResultSetMetaData::getScale */
+ sal_Int32 scale;
+
+ /** @see ResultSetMetaData::getTableName */
+ ::rtl::OUString tableName;
+
+ /** @see ResultSetMetaData::getCatalogName */
+ ::rtl::OUString catalogName;
+
+ /** @see ResultSetMetaData::getColumnTypeName */
+ ::rtl::OUString columnTypeName;
+
+ /** @see ResultSetMetaData::isReadOnly */
+ sal_Bool isReadOnly;
+
+ /** @see ResultSetMetaData::isWritable */
+ sal_Bool isWritable;
+
+ /** @see ResultSetMetaData::isDefinitelyWritable */
+ sal_Bool isDefinitelyWritable;
+
+ /** @see ResultSetMetaData::getColumnServiceName */
+ ::rtl::OUString columnServiceName;
+
+ inline ResultSetColumnData();
+};
+
+// Note: Never change the initial values! Implementations using this struct
+// may havily depend on the behaviour of the default constructor.
+
+ResultSetColumnData::ResultSetColumnData()
+: isAutoIncrement( sal_False ),
+ isCaseSensitive( sal_True ),
+ isSearchable( sal_False ),
+ isCurrency( sal_False ),
+ isNullable( ::com::sun::star::sdbc::ColumnValue::NULLABLE ),
+ isSigned( sal_False ),
+ columnDisplaySize( 16 ),
+ precision( -1 ),
+ scale( 0 ),
+ isReadOnly( sal_True ),
+ isWritable( sal_False ),
+ isDefinitelyWritable( sal_False )
+{
+}
+
+//=========================================================================
+
+/**
+ * This is an implementation of the interface XResultSetMetaData. It can be
+ * used to implement the interface
+ * com::sun::star::sdbc::XResultSetMetaDataSupplier, which is required for
+ * implementations of service com.sun.star.ucb.ContentResultSet.
+ */
+class UCBHELPER_DLLPUBLIC ResultSetMetaData :
+ public ::cppu::OWeakObject,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::sdbc::XResultSetMetaData
+{
+private:
+ ucbhelper_impl::ResultSetMetaData_Impl* m_pImpl;
+
+protected:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::Property > m_aProps;
+ sal_Bool m_bReadOnly;
+
+public:
+
+ /**
+ * Constructor.
+ *
+ * @param rxSMgr is a Servive Manager.
+ * @param rProps is a sequence of properties (partially) describing the
+ * columns of a resultset.
+ * @param bReadOnly is used to specify whether the whole(!) resultset
+ * is read-only.
+ */
+ ResultSetMetaData(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::Property >& rProps,
+ sal_Bool bReadOnly = sal_True );
+
+ /**
+ * Constructor.
+ *
+ * @param rxSMgr is a Servive Manager.
+ * @param rProps is a sequence of properties (partially) describing the
+ * columns of a resultset.
+ * @param rColumnData contains additional meta data for the columns of
+ * a resultset, which override the default values returned by the
+ * appropriate methods of this class. The length of rColumnData
+ * must be the same as length of rProps.
+ * rColumnData[ 0 ] corresponds to data in rProps[ 0 ],
+ * rColumnData[ 1 ] corresponds to data in rProps[ 1 ], ...
+ */
+ ResultSetMetaData(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::Property >& rProps,
+ const std::vector< ResultSetColumnData >& rColumnData );
+
+ /**
+ * Destructor.
+ */
+ virtual ~ResultSetMetaData();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XResultSetMetaData
+
+ /**
+ * Returns the number of columns of the resultset.
+ *
+ * @return the length of the property sequence.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnCount()
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Checks whether column is automatically numbered, which makes it
+ * read-only.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if column is automatically numbered.
+ */
+ virtual sal_Bool SAL_CALL
+ isAutoIncrement( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Checks whether column is case sensitive.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if column is case sensitive.
+ */
+ virtual sal_Bool SAL_CALL
+ isCaseSensitive( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Checks whether the value stored in column can be used in a
+ * WHERE clause.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if the column is searchable.
+ */
+ virtual sal_Bool SAL_CALL
+ isSearchable( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Checks whether column is a cash value.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if the column is a cash value.
+ */
+ virtual sal_Bool SAL_CALL
+ isCurrency( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Checks whether a NULL can be stored in column.
+ *
+ * @see com::sun::star::sdbc::ColumnValue
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return ::com::sun::star::sdbc::ColumnValue::NULLABLE, if a NULL
+ * can be stored in the column.
+ */
+ virtual sal_Int32 SAL_CALL
+ isNullable( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Checks whether the value stored in column is a signed number.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if the value stored in column is a signed number.
+ */
+ virtual sal_Bool SAL_CALL
+ isSigned( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Gets the normal maximum width in characters for column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the normal maximum width in characters for column.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnDisplaySize( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Gets the suggested column title for column, to be used in print-
+ * outs and displays.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the column label.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getColumnLabel( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Gets the name of column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the name of the property that corresponds to column.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getColumnName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Gets the schema name for the table from which column of this
+ * result set was derived.
+ * Because this feature is not widely supported, the return value
+ * for many DBMSs will be an empty string.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the schema name of column or an empty string.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getSchemaName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * For number types, getprecision gets the number of decimal digits
+ * in column.
+ * For character types, it gets the maximum length in characters for
+ * column.
+ * For binary types, it gets the maximum length in bytes for column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the precision for the column.
+ */
+ virtual sal_Int32 SAL_CALL
+ getPrecision( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Gets the number of digits to the right of the decimal point for
+ * values in column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the scale of the column.
+ */
+ virtual sal_Int32 SAL_CALL
+ getScale( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Gets the name of the table from which column of this result set
+ * was derived or "" if there is none (for example, for a join).
+ * Because this feature is not widely supported, the return value
+ * for many DBMSs will be an empty string.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the table name for column or an empty string.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getTableName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::rtl::OUString SAL_CALL
+ /**
+ * Gets the catalog name for the table from which column of this
+ * result set was derived.
+ * Because this feature is not widely supported, the return value
+ * for many DBMSs will be an empty string.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the catalog name for column or an empty string.
+ */
+ getCatalogName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Gets the JDBC type for the value stored in column. ... The STRUCT
+ * and DISTINCT type codes are always returned for structured and
+ * distinct types, regardless of whether the value will be mapped
+ * according to the standard mapping or be a custom mapping.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the type of the property that corresponds to column - mapped
+ * from UNO-Type to SQL-Type.
+ */
+ virtual sal_Int32 SAL_CALL
+ getColumnType( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Gets the type name used by this particular data source for the
+ * values stored in column. If the type code for the type of value
+ * stored in column is STRUCT, DISTINCT or JAVA_OBJECT, this method
+ * returns a fully-qualified SQL type name.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the column type name.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getColumnTypeName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Indicates whether a column is definitely not writable.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if the column is definetely not writable.
+ */
+ virtual sal_Bool SAL_CALL
+ isReadOnly( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Indicates whether it is possible for a write on the column to succeed.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if it is possible for a write to succeed.
+ */
+ virtual sal_Bool SAL_CALL
+ isWritable( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Indicates whether a write on the column will definitely succeed.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return true, if a write on the column will definetely succeed.
+ */
+ virtual sal_Bool SAL_CALL
+ isDefinitelyWritable( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+ /**
+ * Returns the fully-qualified name of the service whose instances
+ * are manufactured if the method
+ * com::sun::star::sdbc::ResultSet::getObject is called to retrieve a
+ * value from the column.
+ *
+ * @param column is the number of the column for that a value shall
+ * be returned. The first column is 1, the second is 2, ...
+ * @return the service name for column or an empty string, if no service
+ * is applicable.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getColumnServiceName( sal_Int32 column )
+ throw( ::com::sun::star::sdbc::SQLException,
+ ::com::sun::star::uno::RuntimeException );
+};
+
+} // namespace ucbhelper
+
+#endif /* !_UCBHELPER_RESULTSETMETADATA_HXX */
diff --git a/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx b/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx
new file mode 100644
index 000000000000..e4190da641e5
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: simpleauthenticationrequest.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_SIMPLEAUTHENTICATIONREQUEST_HXX
+#define _UCBHELPER_SIMPLEAUTHENTICATIONREQUEST_HXX
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/interactionrequest.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace ucbhelper {
+
+/**
+ * This class implements a simple authentication interaction request.
+ * Instances can be passed directly to XInteractionHandler::handle(...). Each
+ * instance contains an AuthenticationRequest and three interaction
+ * continuations: "Abort", "Retry" and "SupplyAuthentication". The parameters
+ * for the AuthenticationRequest and the InteractionSupplyAuthentication
+ * objects are partly taken from contructors parameters and partly defaulted
+ * as follows:
+ *
+ * Read-only values : servername, realm
+ * Read-write values: username, password, account
+ * All remember-authentication values: RememberAuthentication_NO
+ *
+ * @see com::sun::star::ucb::AuthenticationRequest
+ * @see com::sun::star::ucb::RememberAuthentication
+ * @see InteractionAbort
+ * @see InteractionRetry
+ * @see InteractionSupplyAuthentication
+ */
+class UCBHELPER_DLLPUBLIC SimpleAuthenticationRequest : public ucbhelper::InteractionRequest
+{
+ rtl::Reference<
+ ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier;
+
+public:
+ /** Specification whether some entity (realm, username, password, account)
+ is either not applicable at all, has a fixed value, or is modifiable.
+ */
+ enum EntityType
+ {
+ ENTITY_NA,
+ ENTITY_FIXED,
+ ENTITY_MODIFY
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param rServerName contains a server name.
+ * @param rRealm contains a realm, if applicable.
+ * @param rUserName contains a username, if available (for instance from
+ * a previous try).
+ * @param rPassword contains a password, if available (for instance from
+ * a previous try).
+ * @param rAccount contains an account, if applicable.
+ */
+ SimpleAuthenticationRequest( const rtl::OUString & rServerName,
+ const rtl::OUString & rRealm,
+ const rtl::OUString & rUserName,
+ const rtl::OUString & rPassword,
+ const rtl::OUString & rAccount
+ = rtl::OUString() );
+
+ /**
+ * Constructor.
+ *
+ * @param rServerName contains a server name.
+ * @param eRealmType specifies whether a realm is applicable and
+ modifiable.
+ * @param rRealm contains a realm, if applicable.
+ * @param eUserNameType specifies whether a username is applicable and
+ modifiable.
+ * @param rUserName contains a username, if available (for instance from
+ * a previous try).
+ * @param ePasswordType specifies whether a password is applicable and
+ modifiable.
+ * @param rPassword contains a password, if available (for instance from
+ * a previous try).
+ * @param eAccountType specifies whether an account is applicable and
+ modifiable.
+ * @param rAccount contains an account, if applicable.
+ */
+ SimpleAuthenticationRequest( const rtl::OUString & rServerName,
+ EntityType eRealmType,
+ const rtl::OUString & rRealm,
+ EntityType eUserNameType,
+ const rtl::OUString & rUserName,
+ EntityType ePasswordType,
+ const rtl::OUString & rPassword,
+ EntityType eAccountType = ENTITY_NA,
+ const rtl::OUString & rAccount
+ = rtl::OUString() );
+
+ /**
+ * This method returns the supplier for the missing authentication data,
+ * that, for instance can be used to query the password supplied by the
+ * interaction handler.
+ *
+ * @return the supplier for the missing authentication data.
+ */
+ const rtl::Reference< ucbhelper::InteractionSupplyAuthentication > &
+ getAuthenticationSupplier() const { return m_xAuthSupplier; }
+};
+
+} // namespace ucbhelper
+
+#endif /* !_UCBHELPER_SIMPLEAUTHENTICATIONREQUEST_HXX */
diff --git a/ucbhelper/inc/ucbhelper/simplecertificatevalidationrequest.hxx b/ucbhelper/inc/ucbhelper/simplecertificatevalidationrequest.hxx
new file mode 100755
index 000000000000..be53bb9fd7ba
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/simplecertificatevalidationrequest.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: simplecertificatevalidationrequest.hxx,v $
+ * $Revision: 1.3.20.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_SIMPLECERTIFICATEVALIDATIONREQUEST_HXX
+#define _UCBHELPER_SIMPLECERTIFICATEVALIDATIONREQUEST_HXX
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/interactionrequest.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+#include <com/sun/star/security/XCertificate.hpp>
+
+
+namespace ucbhelper {
+
+/**
+ * This class implements a simple validation interaction request of a certificate.
+ * Instances can be passed directly to XInteractionHandler::handle(...). Each
+ * instance contains an CertificateValidationRequest and two interaction
+ * continuations: "Abort" and "Approved". The parameters
+ * for the CertificateValidationRequest object are partly taken from contructors parameters and partly defaulted
+ * as follows:
+ *
+ * Read-write values: certificateValidity, certificate
+ *
+ * @see com::sun::star::ucb::CertificateValidationRequest
+ * @see InteractionApproved
+ * @see InteractionRetry
+ */
+class UCBHELPER_DLLPUBLIC SimpleCertificateValidationRequest : public ucbhelper::InteractionRequest
+{
+public:
+ /**
+ * Constructor.
+ *
+ * @param lCertificateValidity contains a bitmask which validation error occur.
+ * @param pCertificate contaisn the server certificate.
+ */
+ SimpleCertificateValidationRequest( const sal_Int32 & lCertificateValidity,
+ const com::sun::star::uno::Reference<com::sun::star::security::XCertificate> pCertificate,
+ const rtl::OUString & hostname );
+
+ /**
+ * After passing this request to XInteractionHandler::handle, this method
+ * returns the continuation that was choosen by the interaction handler.
+ *
+ * @return the continuation choosen by an interaction handler or
+ * CONTINUATION_UNKNOWN, if the request was not (yet) handled.
+ */
+ sal_Int32 getResponse() const;
+};
+
+} // namespace ucbhelper
+
+#endif /* !_UCBHELPER_SIMPLECERTIFICATEVALIDATIONREQUEST_HXX */
diff --git a/ucbhelper/inc/ucbhelper/simpleinteractionrequest.hxx b/ucbhelper/inc/ucbhelper/simpleinteractionrequest.hxx
new file mode 100644
index 000000000000..a7dfb86f33da
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/simpleinteractionrequest.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: simpleinteractionrequest.hxx,v $
+ * $Revision: 1.4.20.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX
+#define _UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX
+
+#include <ucbhelper/interactionrequest.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace ucbhelper {
+
+/** These are the constants that can be passed to the constructor of class
+ * SimpleInteractionRequest and that are returned by method
+ * SimpleInteractionRequest::getResponse().
+ */
+
+/** The request was not (yet) handled by the interaction handler. */
+static const sal_Int32 CONTINUATION_UNKNOWN = 0;
+
+/** The interaction handler selected XInteractionAbort. */
+static const sal_Int32 CONTINUATION_ABORT = 1;
+
+/** The interaction handler selected XInteractionRetry. */
+static const sal_Int32 CONTINUATION_RETRY = 2;
+
+/** The interaction handler selected XInteractionApprove. */
+static const sal_Int32 CONTINUATION_APPROVE = 4;
+
+/** The interaction handler selected XInteractionDisapprove. */
+static const sal_Int32 CONTINUATION_DISAPPROVE = 8;
+
+/**
+ * This class implements a simple interaction request. The user must not deal
+ * with XInteractionContinuations directly, but can use constants that are
+ * mapped internally to the according objects. This class encapsulates the
+ * standard Interaction Continuations "Abort", "Retry", "Approve" and
+ * "Disaprrove". Instances can be passed directly to
+ * XInteractionHandler::handle(...).
+ *
+ * @see InteractionRequest
+ * @see InteractionAbort
+ * @see InteractionRetry
+ * @see InteractionApprove
+ * @see InteractionDisapprove
+ */
+class UCBHELPER_DLLPUBLIC SimpleInteractionRequest : public ucbhelper::InteractionRequest
+{
+public:
+ /**
+ * Constructor.
+ *
+ * @param rRequest is the exception describing the error.
+ * @param nContinuations contains the possible "answers" for the request.
+ * This can be any of the CONTINUATION_* constants combinations
+ * listed above.
+ */
+ SimpleInteractionRequest( const com::sun::star::uno::Any & rRequest,
+ const sal_Int32 nContinuations );
+
+ /**
+ * After passing this request to XInteractionHandler::handle, this method
+ * returns the continuation that was choosen by the interaction handler.
+ *
+ * @return the continuation choosen by an interaction handler or
+ * CONTINUATION_UNKNOWN, if the request was not (yet) handled.
+ */
+ sal_Int32 getResponse() const;
+};
+
+} // namespace ucbhelper
+
+#endif /* !_UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX */
diff --git a/ucbhelper/inc/ucbhelper/simpleioerrorrequest.hxx b/ucbhelper/inc/ucbhelper/simpleioerrorrequest.hxx
new file mode 100644
index 000000000000..cce5a5e113bd
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/simpleioerrorrequest.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: simpleioerrorrequest.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_SIMPLEIOERRORREQUEST_HXX
+#define _UCBHELPER_SIMPLEIOERRORREQUEST_HXX
+
+#include <com/sun/star/ucb/IOErrorCode.hpp>
+#include <ucbhelper/interactionrequest.hxx>
+
+namespace com { namespace sun { namespace star { namespace ucb {
+ class XCommandProcessor;
+} } } }
+
+namespace ucbhelper {
+
+/**
+ * This class implements a simple IO error interaction request. Instances
+ * can be passed directly to XInteractionHandler::handle(...). Each
+ * instance contains an InteractiveIOException and one interaction
+ * continuation: "Abort".
+ *
+ * @see com::sun::star::ucb::InteractiveIOException
+ * @see InteractionAbort
+ */
+class SimpleIOErrorRequest : public ucbhelper::InteractionRequest
+{
+public:
+ /**
+ * Constructor.
+ *
+ * @param xContext contains the command processor that executes the
+ * command related to the request.
+ *
+ * @param eError is the error code to pass along with the request.
+ *
+ * qparam rArgs are additional parameters according to the specification
+ * of the error code. Refer to com/sun/star/ucb/IOErrorCode.idl
+ * for details.
+ */
+ SimpleIOErrorRequest( const com::sun::star::ucb::IOErrorCode eError,
+ const com::sun::star::uno::Sequence<
+ com::sun::star::uno::Any > & rArgs,
+ const rtl::OUString & rMessage,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandProcessor > & xContext
+ );
+};
+
+} // namespace ucbhelper
+
+#endif /* !_UCBHELPER_SIMPLEIOERRORREQUEST_HXX */
diff --git a/ucbhelper/inc/ucbhelper/simplenameclashresolverequest.hxx b/ucbhelper/inc/ucbhelper/simplenameclashresolverequest.hxx
new file mode 100644
index 000000000000..96e0fa2ff004
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/simplenameclashresolverequest.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: simplenameclashresolverequest.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_SIMPLENAMECLASHRESOLVEREQUEST_HXX
+#define _UCBHELPER_SIMPLENAMECLASHRESOLVEREQUEST_HXX
+
+#include <rtl/ref.hxx>
+#include <ucbhelper/interactionrequest.hxx>
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace ucbhelper {
+
+/**
+ * This class implements a simple name clash resolve interaction request.
+ * Instances can be passed directly to XInteractionHandler::handle(...). Each
+ * instance contains an NameClashResolveRequest and two interaction
+ * continuations: "Abort" and "SupplyName". Another continuation
+ * ("ReplaceExistingData") may be supplied optionally.
+ *
+ * @see com::sun::star::ucb::NameClashResolveRequest
+ * @see InteractionAbort
+ * @see InteractioneplaceExistingData
+ * @see InteractionSupplyName
+ */
+class UCBHELPER_DLLPUBLIC SimpleNameClashResolveRequest : public ucbhelper::InteractionRequest
+{
+ rtl::Reference< InteractionSupplyName > m_xNameSupplier;
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param rTargetFolderURL contains the URL of the folder that contains
+ * the clashing resource.
+ * @param rClashingName contains the clashing name,
+ * @param rProposedNewName contains a proposal for the new name or is
+ * empty.
+ * @param bSupportsOverwriteData indictes whether an
+ * InteractioneplaceExistingData continuation shall be supplied
+ * with the interaction request.
+ */
+ SimpleNameClashResolveRequest( const rtl::OUString & rTargetFolderURL,
+ const rtl::OUString & rClashingName,
+ const rtl::OUString & rProposedNewName,
+ sal_Bool bSupportsOverwriteData = sal_True );
+ /**
+ * This method returns the new name that was supplied by the interaction
+ * handler.
+ *
+ * @return the new name, if supplied.
+ */
+ const rtl::OUString getNewName() const
+ { return m_xNameSupplier->getName(); }
+
+};
+
+} // namespace ucbhelper
+
+#endif /* !_UCBHELPER_SIMPLENAMECLASHRESOLVEREQUEST_HXX */
diff --git a/ucbhelper/inc/ucbhelper/ucbhelperdllapi.h b/ucbhelper/inc/ucbhelper/ucbhelperdllapi.h
new file mode 100644
index 000000000000..6abc4c118d7e
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/ucbhelperdllapi.h
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: ucbhelperdllapi.h,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_UCBHELPERDLLAPI_H
+#define INCLUDED_UCBHELPERDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(UCBHELPER_DLLIMPLEMENTATION)
+#define UCBHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define UCBHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define UCBHELPER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_UCBHELPERDLLAPI_H */
+
diff --git a/ucbhelper/prj/build.lst b/ucbhelper/prj/build.lst
new file mode 100644
index 000000000000..fb9e7d7ab45f
--- /dev/null
+++ b/ucbhelper/prj/build.lst
@@ -0,0 +1,6 @@
+uh ucbhelper : offuh sal cppu cppuhelper salhelper NULL
+uh ucbhelper usr1 - all uh_mkout NULL
+uh ucbhelper\inc nmake - all uh_inc NULL
+uh ucbhelper\source\client nmake - all uh_client uh_inc NULL
+uh ucbhelper\source\provider nmake - all uh_provider uh_inc NULL
+uh ucbhelper\util nmake - all uh_util uh_client uh_provider NULL
diff --git a/ucbhelper/prj/d.lst b/ucbhelper/prj/d.lst
new file mode 100644
index 000000000000..64da268b6143
--- /dev/null
+++ b/ucbhelper/prj/d.lst
@@ -0,0 +1,40 @@
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
+..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so
+..\%__SRC%\lib\lib*.dylib %_DEST%\lib%_EXT%\lib*.dylib
+..\%__SRC%\lib\*.lib %_DEST%\lib%_EXT%\*.lib
+..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map
+..\%__SRC%\misc\*.sym %_DEST%\bin%_EXT%\*.sym
+
+..\util\ucbhelper.xml %_DEST%\xml%_EXT%\ucbhelper.xml
+
+mkdir: %_DEST%\inc%_EXT%\ucbhelper
+..\inc\ucbhelper\configurationkeys.hxx %_DEST%\inc%_EXT%\ucbhelper\configurationkeys.hxx
+..\inc\ucbhelper\configureucb.hxx %_DEST%\inc%_EXT%\ucbhelper\configureucb.hxx
+..\inc\ucbhelper\content.hxx %_DEST%\inc%_EXT%\ucbhelper\content.hxx
+..\inc\ucbhelper\contentbroker.hxx %_DEST%\inc%_EXT%\ucbhelper\contentbroker.hxx
+..\inc\ucbhelper\commandenvironment.hxx %_DEST%\inc%_EXT%\ucbhelper\commandenvironment.hxx
+..\inc\ucbhelper\contentidentifier.hxx %_DEST%\inc%_EXT%\ucbhelper\contentidentifier.hxx
+..\inc\ucbhelper\contenthelper.hxx %_DEST%\inc%_EXT%\ucbhelper\contenthelper.hxx
+..\inc\ucbhelper\contentidentifier.hxx %_DEST%\inc%_EXT%\ucbhelper\contentidentifier.hxx
+..\inc\ucbhelper\contentinfo.hxx %_DEST%\inc%_EXT%\ucbhelper\contentinfo.hxx
+..\inc\ucbhelper\fileidentifierconverter.hxx %_DEST%\inc%_EXT%\ucbhelper\fileidentifierconverter.hxx
+..\inc\ucbhelper\macros.hxx %_DEST%\inc%_EXT%\ucbhelper\macros.hxx
+..\inc\ucbhelper\propertyvalueset.hxx %_DEST%\inc%_EXT%\ucbhelper\propertyvalueset.hxx
+..\inc\ucbhelper\providerhelper.hxx %_DEST%\inc%_EXT%\ucbhelper\providerhelper.hxx
+..\inc\ucbhelper\resultset.hxx %_DEST%\inc%_EXT%\ucbhelper\resultset.hxx
+..\inc\ucbhelper\resultsetmetadata.hxx %_DEST%\inc%_EXT%\ucbhelper\resultsetmetadata.hxx
+..\inc\ucbhelper\resultsethelper.hxx %_DEST%\inc%_EXT%\ucbhelper\resultsethelper.hxx
+..\inc\ucbhelper\activedatasink.hxx %_DEST%\inc%_EXT%\ucbhelper\activedatasink.hxx
+..\inc\ucbhelper\commandenvironmentproxy.hxx %_DEST%\inc%_EXT%\ucbhelper\commandenvironmentproxy.hxx
+..\inc\ucbhelper\interactionrequest.hxx %_DEST%\inc%_EXT%\ucbhelper\interactionrequest.hxx
+..\inc\ucbhelper\interceptedinteraction.hxx %_DEST%\inc%_EXT%\ucbhelper\interceptedinteraction.hxx
+..\inc\ucbhelper\simpleinteractionrequest.hxx %_DEST%\inc%_EXT%\ucbhelper\simpleinteractionrequest.hxx
+..\inc\ucbhelper\simpleauthenticationrequest.hxx %_DEST%\inc%_EXT%\ucbhelper\simpleauthenticationrequest.hxx
+..\inc\ucbhelper\simplenameclashresolverequest.hxx %_DEST%\inc%_EXT%\ucbhelper\simplenameclashresolverequest.hxx
+..\inc\ucbhelper\simplecertificatevalidationrequest.hxx %_DEST%\inc%_EXT%\ucbhelper\simplecertificatevalidationrequest.hxx
+..\inc\ucbhelper\simpleioerrorrequest.hxx %_DEST%\inc%_EXT%\ucbhelper\simpleioerrorrequest.hxx
+..\inc\ucbhelper\cancelcommandexecution.hxx %_DEST%\inc%_EXT%\ucbhelper\cancelcommandexecution.hxx
+..\inc\ucbhelper\handleinteractionrequest.hxx %_DEST%\inc%_EXT%\ucbhelper\handleinteractionrequest.hxx
+..\inc\ucbhelper\proxydecider.hxx %_DEST%\inc%_EXT%\ucbhelper\proxydecider.hxx
+..\version.mk %_DEST%\inc%_EXT%\ucbhelper\version.mk
+..\inc\ucbhelper\ucbhelperdllapi.h %_DEST%\inc%_EXT%\ucbhelper\ucbhelperdllapi.h
diff --git a/ucbhelper/source/client/activedatasink.cxx b/ucbhelper/source/client/activedatasink.cxx
new file mode 100644
index 000000000000..301e28f3657f
--- /dev/null
+++ b/ucbhelper/source/client/activedatasink.cxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: activedatasink.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+#include "ucbhelper/activedatasink.hxx"
+
+using namespace com::sun::star;
+
+namespace ucbhelper
+{
+
+//=========================================================================
+//=========================================================================
+//
+// ActiveDataSink Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+//=========================================================================
+//
+// XInterface methods
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( ActiveDataSink,
+ lang::XTypeProvider,
+ io::XActiveDataSink );
+
+//=========================================================================
+//
+// XTypeProvider methods
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( ActiveDataSink,
+ lang::XTypeProvider,
+ io::XActiveDataSink );
+
+//=========================================================================
+//
+// XActiveDataSink methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ActiveDataSink::setInputStream(
+ const uno::Reference< io::XInputStream >& aStream )
+ throw( uno::RuntimeException )
+{
+ m_xStream = aStream;
+}
+
+//=========================================================================
+// virtual
+uno::Reference< io::XInputStream > SAL_CALL ActiveDataSink::getInputStream()
+ throw( uno::RuntimeException )
+{
+ return m_xStream;
+}
+
+} // namespace ucbhelper
diff --git a/ucbhelper/source/client/activedatastreamer.cxx b/ucbhelper/source/client/activedatastreamer.cxx
new file mode 100644
index 000000000000..9ede3931d0d4
--- /dev/null
+++ b/ucbhelper/source/client/activedatastreamer.cxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: activedatastreamer.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+#include "ucbhelper/activedatastreamer.hxx"
+
+using namespace com::sun::star;
+
+namespace ucbhelper
+{
+
+//=========================================================================
+//=========================================================================
+//
+// ActiveDataStreamer Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+//=========================================================================
+//
+// XInterface methods
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( ActiveDataStreamer,
+ lang::XTypeProvider,
+ io::XActiveDataStreamer );
+
+//=========================================================================
+//
+// XTypeProvider methods
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( ActiveDataStreamer,
+ lang::XTypeProvider,
+ io::XActiveDataStreamer );
+
+//=========================================================================
+//
+// XActiveDataStreamer methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ActiveDataStreamer::setStream( const uno::Reference< io::XStream >& xStream )
+ throw( uno::RuntimeException )
+{
+ m_xStream = xStream;
+}
+
+//=========================================================================
+// virtual
+uno::Reference< io::XStream > SAL_CALL ActiveDataStreamer::getStream()
+ throw( uno::RuntimeException )
+{
+ return m_xStream;
+}
+
+} // namespace ucbhelper
diff --git a/ucbhelper/source/client/commandenvironment.cxx b/ucbhelper/source/client/commandenvironment.cxx
new file mode 100644
index 000000000000..01745869a9f2
--- /dev/null
+++ b/ucbhelper/source/client/commandenvironment.cxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: commandenvironment.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#include <ucbhelper/commandenvironment.hxx>
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::task;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+namespace ucbhelper
+{
+
+//=========================================================================
+//=========================================================================
+//
+// struct CommandEnvironment_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+struct CommandEnvironment_Impl
+{
+ Reference< XInteractionHandler > m_xInteractionHandler;
+ Reference< XProgressHandler > m_xProgressHandler;
+
+ CommandEnvironment_Impl(
+ const Reference< XInteractionHandler >& rxInteractionHandler,
+ const Reference< XProgressHandler >& rxProgressHandler )
+ : m_xInteractionHandler( rxInteractionHandler ),
+ m_xProgressHandler( rxProgressHandler ) {}
+};
+
+//=========================================================================
+//=========================================================================
+//
+// CommandEnvironment Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+CommandEnvironment::CommandEnvironment(
+ const Reference< XInteractionHandler >& rxInteractionHandler,
+ const Reference< XProgressHandler >& rxProgressHandler )
+{
+ m_pImpl = new CommandEnvironment_Impl( rxInteractionHandler,
+ rxProgressHandler );
+}
+
+//=========================================================================
+// virtual
+CommandEnvironment::~CommandEnvironment()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( CommandEnvironment,
+ XTypeProvider,
+ XCommandEnvironment );
+
+//=========================================================================
+//
+// XTypeProvider methods
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( CommandEnvironment,
+ XTypeProvider,
+ XCommandEnvironment );
+
+//=========================================================================
+//
+// XCommandEnvironemnt methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XInteractionHandler > SAL_CALL
+CommandEnvironment::getInteractionHandler()
+ throw ( RuntimeException )
+{
+ return m_pImpl->m_xInteractionHandler;
+}
+
+//=========================================================================
+// virtual
+Reference< XProgressHandler > SAL_CALL
+CommandEnvironment::getProgressHandler()
+ throw ( RuntimeException )
+{
+ return m_pImpl->m_xProgressHandler;
+}
+
+} /* namespace ucbhelper */
+
diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx
new file mode 100644
index 000000000000..c82a0bc19b77
--- /dev/null
+++ b/ucbhelper/source/client/content.cxx
@@ -0,0 +1,1910 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: content.cxx,v $
+ * $Revision: 1.38 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+#include <osl/diagnose.h>
+#include <osl/mutex.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <cppuhelper/weak.hxx>
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/ucb/ContentCreationError.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#include <com/sun/star/ucb/XCommandProcessor.hpp>
+#include <com/sun/star/ucb/Command.hpp>
+#include <com/sun/star/ucb/CommandInfo.hpp>
+#include <com/sun/star/ucb/ContentAction.hpp>
+#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#include <com/sun/star/ucb/InsertCommandArgument.hpp>
+#include <com/sun/star/ucb/GlobalTransferCommandArgument.hpp>
+#include <com/sun/star/ucb/NameClash.hpp>
+#include <com/sun/star/ucb/OpenMode.hpp>
+#include <com/sun/star/ucb/XContentCreator.hpp>
+#include <com/sun/star/ucb/XContentEventListener.hpp>
+#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#include <com/sun/star/ucb/XDynamicResultSet.hpp>
+#include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/beans/UnknownPropertyException.hpp>
+#include <ucbhelper/macros.hxx>
+#include <ucbhelper/content.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <ucbhelper/activedatasink.hxx>
+#include <ucbhelper/activedatastreamer.hxx>
+#ifndef _UCBHELPER_INTERACTIONREQUEST_HXX
+#include <ucbhelper/interactionrequest.hxx>
+#endif
+#include <ucbhelper/cancelcommandexecution.hxx>
+
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::task;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+
+namespace ucbhelper
+{
+
+class EmptyInputStream : public ::cppu::WeakImplHelper1< XInputStream >
+{
+public:
+ virtual sal_Int32 SAL_CALL readBytes(
+ Sequence< sal_Int8 > & data, sal_Int32 nBytesToRead )
+ throw (IOException, RuntimeException);
+ virtual sal_Int32 SAL_CALL readSomeBytes(
+ Sequence< sal_Int8 > & data, sal_Int32 nMaxBytesToRead )
+ throw (IOException, RuntimeException);
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
+ throw (IOException, RuntimeException);
+ virtual sal_Int32 SAL_CALL available()
+ throw (IOException, RuntimeException);
+ virtual void SAL_CALL closeInput()
+ throw (IOException, RuntimeException);
+};
+
+sal_Int32 EmptyInputStream::readBytes(
+ Sequence< sal_Int8 > & data, sal_Int32 )
+ throw (IOException, RuntimeException)
+{
+ data.realloc( 0 );
+ return 0;
+}
+
+sal_Int32 EmptyInputStream::readSomeBytes(
+ Sequence< sal_Int8 > & data, sal_Int32 )
+ throw (IOException, RuntimeException)
+{
+ data.realloc( 0 );
+ return 0;
+}
+
+void EmptyInputStream::skipBytes( sal_Int32 )
+ throw (IOException, RuntimeException)
+{
+}
+
+sal_Int32 EmptyInputStream::available()
+ throw (IOException, RuntimeException)
+{
+ return 0;
+}
+
+void EmptyInputStream::closeInput()
+ throw (IOException, RuntimeException)
+{
+}
+
+
+//=========================================================================
+//=========================================================================
+//
+// class ContentEventListener_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+class ContentEventListener_Impl : public cppu::OWeakObject,
+ public XContentEventListener
+{
+ Content_Impl& m_rContent;
+
+public:
+ ContentEventListener_Impl( Content_Impl& rContent )
+ : m_rContent( rContent ) {}
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XContentEventListener
+ virtual void SAL_CALL contentEvent( const ContentEvent& evt )
+ throw( RuntimeException );
+
+ // XEventListener ( base of XContentEventListener )
+ virtual void SAL_CALL disposing( const EventObject& Source )
+ throw( RuntimeException );
+};
+
+//=========================================================================
+//=========================================================================
+//
+// class Content_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+class Content_Impl : public salhelper::SimpleReferenceObject
+{
+friend class ContentEventListener_Impl;
+
+ mutable rtl::OUString m_aURL;
+ Reference< XMultiServiceFactory > m_xSMgr;
+ Reference< XContent > m_xContent;
+ Reference< XCommandProcessor > m_xCommandProcessor;
+ Reference< XCommandEnvironment > m_xEnv;
+ Reference< XContentEventListener > m_xContentEventListener;
+ mutable osl::Mutex m_aMutex;
+ sal_Int32 m_nCommandId;
+
+private:
+ void reinit( const Reference< XContent >& xContent );
+ void disposing(const EventObject& Source);
+
+public:
+ Content_Impl() : m_nCommandId( 0 ) {};
+ Content_Impl( const Reference< XMultiServiceFactory >& rSMgr,
+ const Reference< XContent >& rContent,
+ const Reference< XCommandEnvironment >& rEnv );
+
+ virtual ~Content_Impl();
+
+ const rtl::OUString& getURL() const;
+ Reference< XContent > getContent();
+ Reference< XCommandProcessor > getCommandProcessor();
+ sal_Int32 getCommandId();
+ Reference< XMultiServiceFactory > getServiceManager() { return m_xSMgr; }
+
+ Any executeCommand( const Command& rCommand );
+ void abortCommand();
+ inline const Reference< XCommandEnvironment >& getEnvironment() const;
+ inline void setEnvironment(
+ const Reference< XCommandEnvironment >& xNewEnv );
+
+ void inserted();
+};
+
+//=========================================================================
+// Helpers.
+//=========================================================================
+
+static void ensureContentProviderForURL( const ContentBroker & rBroker,
+ const rtl::OUString & rURL )
+ throw ( ContentCreationException, RuntimeException )
+{
+ Reference< XContentProviderManager > xMgr
+ = rBroker.getContentProviderManagerInterface();
+ if ( !xMgr.is() )
+ {
+ throw RuntimeException(
+ rtl::OUString::createFromAscii(
+ "UCB does not implement mandatory interface "
+ "XContentProviderManager!" ),
+ Reference< XInterface >() );
+ }
+ else
+ {
+ Reference< XContentProvider > xProv
+ = xMgr->queryContentProvider( rURL );
+ if ( !xProv.is() )
+ {
+ throw ContentCreationException(
+ rtl::OUString::createFromAscii(
+ "No Content Provider available for given URL!" ),
+ Reference< XInterface >(),
+ ContentCreationError_NO_CONTENT_PROVIDER );
+ }
+ }
+}
+
+//=========================================================================
+static ContentBroker* getContentBroker( bool bThrow )
+ throw ( ContentCreationException, RuntimeException )
+{
+ ContentBroker* pBroker = ContentBroker::get();
+
+ if ( !pBroker )
+ {
+ if ( bThrow )
+ throw RuntimeException(
+ rtl::OUString::createFromAscii( "No Content Broker!" ),
+ Reference< XInterface >() );
+ }
+ else
+ {
+#if OSL_DEBUG_LEVEL > 1
+ Reference< XContentProviderManager > xMgr
+ = pBroker->getContentProviderManagerInterface();
+ if ( !xMgr.is() )
+ {
+ if ( bThrow )
+ throw RuntimeException(
+ rtl::OUString::createFromAscii(
+ "UCB does not implement mandatory interface "
+ "XContentProviderManager!" ),
+ Reference< XInterface >() );
+ }
+ else
+ {
+ OSL_ENSURE( xMgr->queryContentProviders().getLength(),
+ "Content Broker not configured (no providers)!" );
+ }
+#endif
+ }
+
+ return pBroker;
+}
+
+//=========================================================================
+static Reference< XContentIdentifier > getContentIdentifier(
+ const ContentBroker & rBroker,
+ const rtl::OUString & rURL,
+ bool bThrow )
+ throw ( ContentCreationException, RuntimeException )
+{
+ Reference< XContentIdentifierFactory > xIdFac
+ = rBroker.getContentIdentifierFactoryInterface();
+ if ( xIdFac.is() )
+ {
+ Reference< XContentIdentifier > xId
+ = xIdFac->createContentIdentifier( rURL );
+
+ if ( xId.is() )
+ return xId;
+
+ if ( bThrow )
+ {
+ ensureContentProviderForURL( rBroker, rURL );
+
+ throw ContentCreationException(
+ rtl::OUString::createFromAscii(
+ "Unable to create Content Identifier!" ),
+ Reference< XInterface >(),
+ ContentCreationError_IDENTIFIER_CREATION_FAILED );
+ }
+ }
+ else
+ {
+ if ( bThrow )
+ throw RuntimeException(
+ rtl::OUString::createFromAscii(
+ "UCB does not implement mandatory interface "
+ "XContentIdentifierFactory!" ),
+ Reference< XInterface >() );
+ }
+
+ return Reference< XContentIdentifier >();
+}
+
+//=========================================================================
+static Reference< XContent > getContent(
+ const ContentBroker & rBroker,
+ const Reference< XContentIdentifier > & xId,
+ bool bThrow )
+ throw ( ContentCreationException, RuntimeException )
+{
+ Reference< XContentProvider > xProvider
+ = rBroker.getContentProviderInterface();
+ if ( xProvider.is() )
+ {
+ Reference< XContent > xContent;
+ try
+ {
+ xContent = xProvider->queryContent( xId );
+ }
+ catch ( IllegalIdentifierException const & )
+ {
+ // handled below.
+ }
+
+ if ( xContent.is() )
+ return xContent;
+
+ if ( bThrow )
+ {
+ ensureContentProviderForURL( rBroker, xId->getContentIdentifier() );
+
+ throw ContentCreationException(
+ rtl::OUString::createFromAscii(
+ "Unable to create Content!" ),
+ Reference< XInterface >(),
+ ContentCreationError_CONTENT_CREATION_FAILED );
+ }
+ }
+ else
+ {
+ if ( bThrow )
+ throw RuntimeException(
+ rtl::OUString::createFromAscii(
+ "UCB does not implement mandatory interface "
+ "XContentProvider!" ),
+ Reference< XInterface >() );
+ }
+
+ return Reference< XContent >();
+}
+
+//=========================================================================
+//=========================================================================
+//
+// Content Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+Content::Content()
+: m_xImpl( new Content_Impl )
+{
+}
+
+//=========================================================================
+Content::Content( const rtl::OUString& rURL,
+ const Reference< XCommandEnvironment >& rEnv )
+ throw ( ContentCreationException, RuntimeException )
+{
+ ContentBroker* pBroker = getContentBroker( true );
+
+ Reference< XContentIdentifier > xId
+ = getContentIdentifier( *pBroker, rURL, true );
+
+ Reference< XContent > xContent = getContent( *pBroker, xId, true );
+
+ m_xImpl = new Content_Impl( pBroker->getServiceManager(), xContent, rEnv );
+}
+
+//=========================================================================
+Content::Content( const Reference< XContentIdentifier >& rId,
+ const Reference< XCommandEnvironment >& rEnv )
+ throw ( ContentCreationException, RuntimeException )
+{
+ ContentBroker* pBroker = getContentBroker( true );
+
+ Reference< XContent > xContent = getContent( *pBroker, rId, true );
+
+ m_xImpl = new Content_Impl( pBroker->getServiceManager(), xContent, rEnv );
+}
+
+//=========================================================================
+Content::Content( const Reference< XContent >& rContent,
+ const Reference< XCommandEnvironment >& rEnv )
+ throw ( ContentCreationException, RuntimeException )
+{
+ ContentBroker* pBroker = getContentBroker( true );
+
+ m_xImpl = new Content_Impl( pBroker->getServiceManager(), rContent, rEnv );
+}
+
+//=========================================================================
+Content::Content( const Content& rOther )
+{
+ m_xImpl = rOther.m_xImpl;
+}
+
+//=========================================================================
+// static
+sal_Bool Content::create( const rtl::OUString& rURL,
+ const Reference< XCommandEnvironment >& rEnv,
+ Content& rContent )
+{
+ ContentBroker* pBroker = getContentBroker( false );
+ if ( !pBroker )
+ return sal_False;
+
+ Reference< XContentIdentifier > xId
+ = getContentIdentifier( *pBroker, rURL, false );
+ if ( !xId.is() )
+ return sal_False;
+
+ Reference< XContent > xContent = getContent( *pBroker, xId, false );
+ if ( !xContent.is() )
+ return sal_False;
+
+ rContent.m_xImpl
+ = new Content_Impl( pBroker->getServiceManager(), xContent, rEnv );
+
+ return sal_True;
+}
+
+//=========================================================================
+// static
+sal_Bool Content::create( const Reference< XContentIdentifier >& rId,
+ const Reference< XCommandEnvironment >& rEnv,
+ Content& rContent )
+{
+ ContentBroker* pBroker = getContentBroker( false );
+ if ( !pBroker )
+ return sal_False;
+
+ Reference< XContent > xContent = getContent( *pBroker, rId, false );
+ if ( !xContent.is() )
+ return sal_False;
+
+ rContent.m_xImpl
+ = new Content_Impl( pBroker->getServiceManager(), xContent, rEnv );
+
+ return sal_True;
+}
+
+//=========================================================================
+// static
+sal_Bool Content::create( const Reference< XContent >& xContent,
+ const Reference< XCommandEnvironment >& rEnv,
+ Content& rContent )
+{
+ ContentBroker* pBroker = getContentBroker( false );
+ if ( !pBroker )
+ return sal_False;
+
+ rContent.m_xImpl
+ = new Content_Impl( pBroker->getServiceManager(), xContent, rEnv );
+
+ return sal_True;
+}
+
+//=========================================================================
+Content::~Content()
+{
+}
+
+//=========================================================================
+Content& Content::operator=( const Content& rOther )
+{
+ m_xImpl = rOther.m_xImpl;
+ return *this;
+}
+
+//=========================================================================
+Reference< XContent > Content::get() const
+{
+ return m_xImpl->getContent();
+}
+
+//=========================================================================
+const rtl::OUString& Content::getURL() const
+{
+ return m_xImpl->getURL();
+}
+
+//=========================================================================
+const Reference< XCommandEnvironment >& Content::getCommandEnvironment() const
+{
+ return m_xImpl->getEnvironment();
+}
+
+//=========================================================================
+void Content::setCommandEnvironment(
+ const Reference< XCommandEnvironment >& xNewEnv )
+{
+ m_xImpl->setEnvironment( xNewEnv );
+}
+
+//=========================================================================
+Reference< XCommandInfo > Content::getCommands()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "getCommandInfo" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument = Any();
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XCommandInfo > xInfo;
+ aResult >>= xInfo;
+ return xInfo;
+}
+
+//=========================================================================
+Reference< XPropertySetInfo > Content::getProperties()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "getPropertySetInfo" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument = Any();
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XPropertySetInfo > xInfo;
+ aResult >>= xInfo;
+ return xInfo;
+}
+
+//=========================================================================
+Any Content::getPropertyValue( const rtl::OUString& rPropertyName )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Sequence< rtl::OUString > aNames( 1 );
+ aNames.getArray()[ 0 ] = rPropertyName;
+
+ Sequence< Any > aRet = getPropertyValues( aNames );
+ return aRet.getConstArray()[ 0 ];
+}
+
+//=========================================================================
+Any Content::getPropertyValue( sal_Int32 nPropertyHandle )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Sequence< sal_Int32 > aHandles( 1 );
+ aHandles.getArray()[ 0 ] = nPropertyHandle;
+
+ Sequence< Any > aRet = getPropertyValues( aHandles );
+ return aRet.getConstArray()[ 0 ];
+}
+
+//=========================================================================
+Any Content::setPropertyValue( const rtl::OUString& rName,
+ const Any& rValue )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Sequence< rtl::OUString > aNames( 1 );
+ aNames.getArray()[ 0 ] = rName;
+
+ Sequence< Any > aValues( 1 );
+ aValues.getArray()[ 0 ] = rValue;
+
+ Sequence< Any > aErrors = setPropertyValues( aNames, aValues );
+ return aErrors.getConstArray()[ 0 ];
+}
+
+//=========================================================================
+Any Content::setPropertyValue( const sal_Int32 nPropertyHandle,
+ const Any& rValue )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Sequence< sal_Int32 > aHandles( 1 );
+ aHandles.getArray()[ 0 ] = nPropertyHandle;
+
+ Sequence< Any > aValues( 1 );
+ aValues.getArray()[ 0 ] = rValue;
+
+ Sequence< Any > aErrors = setPropertyValues( aHandles, aValues );
+ return aErrors.getConstArray()[ 0 ];
+}
+
+//=========================================================================
+Sequence< Any > Content::getPropertyValues(
+ const Sequence< rtl::OUString >& rPropertyNames )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Reference< XRow > xRow = getPropertyValuesInterface( rPropertyNames );
+
+ sal_Int32 nCount = rPropertyNames.getLength();
+ Sequence< Any > aValues( nCount );
+
+ if ( xRow.is() )
+ {
+ Any* pValues = aValues.getArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ pValues[ n ] = xRow->getObject( n + 1, Reference< XNameAccess >() );
+ }
+
+ return aValues;
+}
+
+//=========================================================================
+Sequence< Any > Content::getPropertyValues(
+ const Sequence< sal_Int32 >& nPropertyHandles )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Reference< XRow > xRow = getPropertyValuesInterface( nPropertyHandles );
+
+ sal_Int32 nCount = nPropertyHandles.getLength();
+ Sequence< Any > aValues( nCount );
+
+ if ( xRow.is() )
+ {
+ Any* pValues = aValues.getArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ pValues[ n ] = xRow->getObject( n + 1, Reference< XNameAccess >() );
+ }
+
+ return aValues;
+}
+
+//=========================================================================
+Reference< XRow > Content::getPropertyValuesInterface(
+ const Sequence< rtl::OUString >& rPropertyNames )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Int32 nCount = rPropertyNames.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+
+ const rtl::OUString* pNames = rPropertyNames.getConstArray();
+
+ for ( sal_Int32 n = 0; n< nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+
+ rProp.Name = pNames[ n ];
+ rProp.Handle = -1; // n/a
+// rProp.Type =
+// rProp.Attributes = ;
+ }
+
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "getPropertyValues" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aProps;
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XRow > xRow;
+ aResult >>= xRow;
+ return xRow;
+}
+
+//=========================================================================
+Reference< XRow > Content::getPropertyValuesInterface(
+ const Sequence< sal_Int32 >& nPropertyHandles )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Int32 nCount = nPropertyHandles.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+
+ const sal_Int32* pHandles = nPropertyHandles.getConstArray();
+
+ for ( sal_Int32 n = 0; n< nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+
+ rProp.Name = rtl::OUString(); // n/a
+ rProp.Handle = pHandles[ n ];
+// rProp.Type =
+// rProp.Attributes = ;
+ }
+
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "getPropertyValues" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aProps;
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Reference< XRow > xRow;
+ aResult >>= xRow;
+ return xRow;
+}
+
+//=========================================================================
+Sequence< Any > Content::setPropertyValues(
+ const Sequence< rtl::OUString >& rPropertyNames,
+ const Sequence< Any >& rValues )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( rPropertyNames.getLength() != rValues.getLength() )
+ {
+ ucbhelper::cancelCommandExecution(
+ makeAny( IllegalArgumentException(
+ rtl::OUString::createFromAscii(
+ "Length of property names sequence and value "
+ "sequence are unequal!" ),
+ get(),
+ -1 ) ),
+ m_xImpl->getEnvironment() );
+ // Unreachable
+ }
+
+ sal_Int32 nCount = rValues.getLength();
+ Sequence< PropertyValue > aProps( nCount );
+ PropertyValue* pProps = aProps.getArray();
+
+ const rtl::OUString* pNames = rPropertyNames.getConstArray();
+ const Any* pValues = rValues.getConstArray();
+
+ for ( sal_Int32 n = 0; n< nCount; ++n )
+ {
+ PropertyValue& rProp = pProps[ n ];
+
+ rProp.Name = pNames[ n ];
+ rProp.Handle = -1; // n/a
+ rProp.Value = pValues[ n ];
+// rProp.State = ;
+ }
+
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "setPropertyValues" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aProps;
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Sequence< Any > aErrors;
+ aResult >>= aErrors;
+ return aErrors;
+}
+
+//=========================================================================
+Sequence< Any > Content::setPropertyValues(
+ const Sequence< sal_Int32 >& nPropertyHandles,
+ const Sequence< Any >& rValues )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( nPropertyHandles.getLength() != rValues.getLength() )
+ {
+ ucbhelper::cancelCommandExecution(
+ makeAny( IllegalArgumentException(
+ rtl::OUString::createFromAscii(
+ "Length of property handles sequence and value "
+ "sequence are unequal!" ),
+ get(),
+ -1 ) ),
+ m_xImpl->getEnvironment() );
+ // Unreachable
+ }
+
+ sal_Int32 nCount = rValues.getLength();
+ Sequence< PropertyValue > aProps( nCount );
+ PropertyValue* pProps = aProps.getArray();
+
+ const sal_Int32* pHandles = nPropertyHandles.getConstArray();
+ const Any* pValues = rValues.getConstArray();
+
+ for ( sal_Int32 n = 0; n< nCount; ++n )
+ {
+ PropertyValue& rProp = pProps[ n ];
+
+ rProp.Name = rtl::OUString(); // n/a
+ rProp.Handle = pHandles[ n ];
+ rProp.Value = pValues[ n ];
+// rProp.State = ;
+ }
+
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "setPropertyValues" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aProps;
+
+ Any aResult = m_xImpl->executeCommand( aCommand );
+
+ Sequence< Any > aErrors;
+ aResult >>= aErrors;
+ return aErrors;
+}
+
+//=========================================================================
+Any Content::executeCommand( const rtl::OUString& rCommandName,
+ const Any& rCommandArgument )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Command aCommand;
+ aCommand.Name = rCommandName;
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument = rCommandArgument;
+
+ return m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+Any Content::executeCommand( sal_Int32 nCommandHandle,
+ const Any& rCommandArgument )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Command aCommand;
+ aCommand.Name = rtl::OUString(); // n/a
+ aCommand.Handle = nCommandHandle;
+ aCommand.Argument = rCommandArgument;
+
+ return m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+void Content::abortCommand()
+{
+ m_xImpl->abortCommand();
+}
+
+//=========================================================================
+Any Content::createCursorAny( const Sequence< rtl::OUString >& rPropertyNames,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Int32 nCount = rPropertyNames.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+ const rtl::OUString* pNames = rPropertyNames.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+ rProp.Name = pNames[ n ];
+ rProp.Handle = -1; // n/a
+ }
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = ( eMode == INCLUDE_FOLDERS_ONLY )
+ ? OpenMode::FOLDERS
+ : ( eMode == INCLUDE_DOCUMENTS_ONLY )
+ ? OpenMode::DOCUMENTS : OpenMode::ALL;
+ aArg.Priority = 0; // unused
+ aArg.Sink = Reference< XInterface >(); // unused
+ aArg.Properties = aProps;
+
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ return m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+Any Content::createCursorAny( const Sequence< sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Int32 nCount = rPropertyHandles.getLength();
+ Sequence< Property > aProps( nCount );
+ Property* pProps = aProps.getArray();
+ const sal_Int32* pHandles = rPropertyHandles.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+ rProp.Name = rtl::OUString(); // n/a
+ rProp.Handle = pHandles[ n ];
+ }
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = ( eMode == INCLUDE_FOLDERS_ONLY )
+ ? OpenMode::FOLDERS
+ : ( eMode == INCLUDE_DOCUMENTS_ONLY )
+ ? OpenMode::DOCUMENTS : OpenMode::ALL;
+ aArg.Priority = 0; // unused
+ aArg.Sink = Reference< XInterface >(); // unused
+ aArg.Properties = aProps;
+
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ return m_xImpl->executeCommand( aCommand );
+}
+
+//=========================================================================
+Reference< XResultSet > Content::createCursor(
+ const Sequence< rtl::OUString >& rPropertyNames,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Any aCursorAny = createCursorAny( rPropertyNames, eMode );
+
+ Reference< XDynamicResultSet > xDynSet;
+ Reference< XResultSet > aResult;
+
+ aCursorAny >>= xDynSet;
+ if ( xDynSet.is() )
+ aResult = xDynSet->getStaticResultSet();
+
+ OSL_ENSURE( aResult.is(), "Content::createCursor - no cursor!" );
+
+ if ( !aResult.is() )
+ {
+ // Former, the open command directly returned a XResultSet.
+ aCursorAny >>= aResult;
+
+ OSL_ENSURE( !aResult.is(),
+ "Content::createCursor - open-Command must "
+ "return a Reference< XDynnamicResultSet >!" );
+ }
+
+ return aResult;
+}
+
+//=========================================================================
+Reference< XResultSet > Content::createCursor(
+ const Sequence< sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Any aCursorAny = createCursorAny( rPropertyHandles, eMode );
+
+ Reference< XDynamicResultSet > xDynSet;
+ Reference< XResultSet > aResult;
+
+ aCursorAny >>= xDynSet;
+ if ( xDynSet.is() )
+ aResult = xDynSet->getStaticResultSet();
+
+ OSL_ENSURE( aResult.is(), "Content::createCursor - no cursor!" );
+
+ if ( !aResult.is() )
+ {
+ // Former, the open command directly returned a XResultSet.
+ aCursorAny >>= aResult;
+
+ OSL_ENSURE( !aResult.is(),
+ "Content::createCursor - open-Command must "
+ "return a Reference< XDynnamicResultSet >!" );
+ }
+
+ return aResult;
+}
+
+//=========================================================================
+Reference< XDynamicResultSet > Content::createDynamicCursor(
+ const Sequence< rtl::OUString >& rPropertyNames,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Reference< XDynamicResultSet > aResult;
+ createCursorAny( rPropertyNames, eMode ) >>= aResult;
+
+ OSL_ENSURE( aResult.is(), "Content::createDynamicCursor - no cursor!" );
+
+ return aResult;
+}
+
+//=========================================================================
+Reference< XDynamicResultSet > Content::createDynamicCursor(
+ const Sequence< sal_Int32 >& rPropertyHandles,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Reference< XDynamicResultSet > aResult;
+ createCursorAny( rPropertyHandles, eMode ) >>= aResult;
+
+ OSL_ENSURE( aResult.is(), "Content::createDynamicCursor - no cursor!" );
+
+ return aResult;
+}
+
+//=========================================================================
+Reference< XDynamicResultSet > Content::createSortedDynamicCursor(
+ const Sequence< rtl::OUString >& rPropertyNames,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo,
+ Reference< XAnyCompareFactory > rAnyCompareFactory,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Reference< XDynamicResultSet > aResult;
+ Reference< XDynamicResultSet > aOrigCursor = createDynamicCursor( rPropertyNames, eMode );
+
+ if( aOrigCursor.is() )
+ {
+ Reference< XMultiServiceFactory > aServiceManager = m_xImpl->getServiceManager();
+
+ if( aServiceManager.is() )
+ {
+ Reference< XSortedDynamicResultSetFactory > aSortFactory( aServiceManager->createInstance(
+ rtl::OUString::createFromAscii( "com.sun.star.ucb.SortedDynamicResultSetFactory" )),
+ UNO_QUERY );
+
+ aResult = aSortFactory->createSortedDynamicResultSet( aOrigCursor,
+ rSortInfo,
+ rAnyCompareFactory );
+ }
+
+ OSL_ENSURE( aResult.is(), "Content::createSortedDynamicCursor - no sorted cursor!\n" );
+
+ if( !aResult.is() )
+ aResult = aOrigCursor;
+ }
+
+ return aResult;
+}
+
+//=========================================================================
+Reference< XDynamicResultSet > Content::createSortedDynamicCursor(
+ const Sequence< sal_Int32 >& rPropertyHandles,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo,
+ Reference< XAnyCompareFactory > rAnyCompareFactory,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Reference< XDynamicResultSet > aResult;
+ Reference< XDynamicResultSet > aOrigCursor = createDynamicCursor( rPropertyHandles, eMode );
+
+ if( aOrigCursor.is() )
+ {
+ Reference< XMultiServiceFactory > aServiceManager = m_xImpl->getServiceManager();
+
+ if( aServiceManager.is() )
+ {
+ Reference< XSortedDynamicResultSetFactory > aSortFactory( aServiceManager->createInstance(
+ rtl::OUString::createFromAscii( "com.sun.star.ucb.SortedDynamicResultSetFactory" )),
+ UNO_QUERY );
+
+ aResult = aSortFactory->createSortedDynamicResultSet( aOrigCursor,
+ rSortInfo,
+ rAnyCompareFactory );
+ }
+
+ OSL_ENSURE( aResult.is(), "Content::createSortedDynamicCursor - no sorted cursor!\n" );
+
+ if( !aResult.is() )
+ aResult = aOrigCursor;
+ }
+
+ return aResult;
+}
+
+//=========================================================================
+Reference< XResultSet > Content::createSortedCursor(
+ const Sequence< rtl::OUString >& rPropertyNames,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo,
+ Reference< XAnyCompareFactory > rAnyCompareFactory,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Reference< XResultSet > aResult;
+ Reference< XDynamicResultSet > aDynSet;
+
+ Any aCursorAny = createCursorAny( rPropertyNames, eMode );
+
+ aCursorAny >>= aDynSet;
+
+ if( aDynSet.is() )
+ {
+ Reference< XDynamicResultSet > aDynResult;
+ Reference< XMultiServiceFactory > aServiceManager = m_xImpl->getServiceManager();
+
+ if( aServiceManager.is() )
+ {
+ Reference< XSortedDynamicResultSetFactory > aSortFactory( aServiceManager->createInstance(
+ rtl::OUString::createFromAscii( "com.sun.star.ucb.SortedDynamicResultSetFactory" )),
+ UNO_QUERY );
+
+ aDynResult = aSortFactory->createSortedDynamicResultSet( aDynSet,
+ rSortInfo,
+ rAnyCompareFactory );
+ }
+
+ OSL_ENSURE( aDynResult.is(), "Content::createSortedCursor - no sorted cursor!\n" );
+
+ if( aDynResult.is() )
+ aResult = aDynResult->getStaticResultSet();
+ else
+ aResult = aDynSet->getStaticResultSet();
+ }
+
+ OSL_ENSURE( aResult.is(), "Content::createSortedCursor - no cursor!" );
+
+ if ( !aResult.is() )
+ {
+ // Former, the open command directly returned a XResultSet.
+ aCursorAny >>= aResult;
+
+ OSL_ENSURE( !aResult.is(),
+ "Content::createCursor - open-Command must "
+ "return a Reference< XDynnamicResultSet >!" );
+ }
+
+ return aResult;
+}
+
+//=========================================================================
+Reference< XResultSet > Content::createSortedCursor(
+ const Sequence< sal_Int32 >& rPropertyHandles,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::ucb::NumberedSortingInfo >& rSortInfo,
+ Reference< XAnyCompareFactory > rAnyCompareFactory,
+ ResultSetInclude eMode )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ Reference< XResultSet > aResult;
+ Reference< XDynamicResultSet > aDynSet;
+
+ Any aCursorAny = createCursorAny( rPropertyHandles, eMode );
+
+ aCursorAny >>= aDynSet;
+
+ if( aDynSet.is() )
+ {
+ Reference< XDynamicResultSet > aDynResult;
+ Reference< XMultiServiceFactory > aServiceManager = m_xImpl->getServiceManager();
+
+ if( aServiceManager.is() )
+ {
+ Reference< XSortedDynamicResultSetFactory > aSortFactory( aServiceManager->createInstance(
+ rtl::OUString::createFromAscii( "com.sun.star.ucb.SortedDynamicResultSetFactory" )),
+ UNO_QUERY );
+
+ aDynResult = aSortFactory->createSortedDynamicResultSet( aDynSet,
+ rSortInfo,
+ rAnyCompareFactory );
+ }
+
+ OSL_ENSURE( aDynResult.is(), "Content::createSortedCursor - no sorted cursor!\n" );
+
+ if( aDynResult.is() )
+ aResult = aDynResult->getStaticResultSet();
+ else
+ aResult = aDynSet->getStaticResultSet();
+ }
+
+ OSL_ENSURE( aResult.is(), "Content::createSortedCursor - no cursor!" );
+
+ if ( !aResult.is() )
+ {
+ // Former, the open command directly returned a XResultSet.
+ aCursorAny >>= aResult;
+
+ OSL_ENSURE( !aResult.is(),
+ "Content::createCursor - open-Command must "
+ "return a Reference< XDynnamicResultSet >!" );
+ }
+
+ return aResult;
+}
+
+//=========================================================================
+Reference< XInputStream > Content::openStream()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isDocument() )
+ return Reference< XInputStream >();
+
+ Reference< XActiveDataSink > xSink = new ActiveDataSink;
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = OpenMode::DOCUMENT;
+ aArg.Priority = 0; // unused
+ aArg.Sink = xSink;
+ aArg.Properties = Sequence< Property >( 0 ); // unused
+
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ m_xImpl->executeCommand( aCommand );
+
+ return xSink->getInputStream();
+}
+
+//=========================================================================
+Reference< XInputStream > Content::openStreamNoLock()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isDocument() )
+ return Reference< XInputStream >();
+
+ Reference< XActiveDataSink > xSink = new ActiveDataSink;
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = OpenMode::DOCUMENT_SHARE_DENY_NONE;
+ aArg.Priority = 0; // unused
+ aArg.Sink = xSink;
+ aArg.Properties = Sequence< Property >( 0 ); // unused
+
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ m_xImpl->executeCommand( aCommand );
+
+ return xSink->getInputStream();
+}
+
+//=========================================================================
+Reference< XStream > Content::openWriteableStream()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isDocument() )
+ return Reference< XStream >();
+
+ Reference< XActiveDataStreamer > xStreamer = new ActiveDataStreamer;
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = OpenMode::DOCUMENT;
+ aArg.Priority = 0; // unused
+ aArg.Sink = xStreamer;
+ aArg.Properties = Sequence< Property >( 0 ); // unused
+
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ m_xImpl->executeCommand( aCommand );
+
+ return xStreamer->getStream();
+}
+
+//=========================================================================
+Reference< XStream > Content::openWriteableStreamNoLock()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isDocument() )
+ return Reference< XStream >();
+
+ Reference< XActiveDataStreamer > xStreamer = new ActiveDataStreamer;
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = OpenMode::DOCUMENT_SHARE_DENY_NONE;
+ aArg.Priority = 0; // unused
+ aArg.Sink = xStreamer;
+ aArg.Properties = Sequence< Property >( 0 ); // unused
+
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ m_xImpl->executeCommand( aCommand );
+
+ return xStreamer->getStream();
+}
+
+//=========================================================================
+sal_Bool Content::openStream( const Reference< XActiveDataSink >& rSink )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isDocument() )
+ return sal_False;
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = OpenMode::DOCUMENT;
+ aArg.Priority = 0; // unused
+ aArg.Sink = rSink;
+ aArg.Properties = Sequence< Property >( 0 ); // unused
+
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ m_xImpl->executeCommand( aCommand );
+
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool Content::openStream( const Reference< XOutputStream >& rStream )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( !isDocument() )
+ return sal_False;
+
+ OpenCommandArgument2 aArg;
+ aArg.Mode = OpenMode::DOCUMENT;
+ aArg.Priority = 0; // unused
+ aArg.Sink = rStream;
+ aArg.Properties = Sequence< Property >( 0 ); // unused
+
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "open" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ m_xImpl->executeCommand( aCommand );
+
+ return sal_True;
+}
+
+//=========================================================================
+void Content::writeStream( const Reference< XInputStream >& rStream,
+ sal_Bool bReplaceExisting )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ InsertCommandArgument aArg;
+ aArg.Data = rStream.is() ? rStream : new EmptyInputStream;
+ aArg.ReplaceExisting = bReplaceExisting;
+
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "insert" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aArg;
+
+ m_xImpl->executeCommand( aCommand );
+
+ m_xImpl->inserted();
+}
+
+//=========================================================================
+sal_Bool Content::insertNewContent( const rtl::OUString& rContentType,
+ const Sequence< rtl::OUString >&
+ rPropertyNames,
+ const Sequence< Any >& rPropertyValues,
+ Content& rNewContent )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ return insertNewContent( rContentType,
+ rPropertyNames,
+ rPropertyValues,
+ new EmptyInputStream,
+ rNewContent );
+}
+
+//=========================================================================
+sal_Bool Content::insertNewContent( const rtl::OUString& rContentType,
+ const Sequence< sal_Int32 >&
+ nPropertyHandles,
+ const Sequence< Any >& rPropertyValues,
+ Content& rNewContent )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ return insertNewContent( rContentType,
+ nPropertyHandles,
+ rPropertyValues,
+ new EmptyInputStream,
+ rNewContent );
+}
+
+//=========================================================================
+sal_Bool Content::insertNewContent( const rtl::OUString& rContentType,
+ const Sequence< rtl::OUString >&
+ rPropertyNames,
+ const Sequence< Any >& rPropertyValues,
+ const Reference< XInputStream >& rData,
+ Content& rNewContent )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( rContentType.getLength() == 0 )
+ return sal_False;
+
+ Reference< XContentCreator > xCreator( m_xImpl->getContent(), UNO_QUERY );
+
+ OSL_ENSURE( xCreator.is(),
+ "Content::insertNewContent - Not a XContentCreator!" );
+
+ if ( !xCreator.is() )
+ return sal_False;
+
+ ContentInfo aInfo;
+ aInfo.Type = rContentType;
+ aInfo.Attributes = 0;
+
+ Reference< XContent > xNew = xCreator->createNewContent( aInfo );
+ if ( !xNew.is() )
+ return sal_False;
+
+ Content aNewContent( xNew, m_xImpl->getEnvironment() );
+ aNewContent.setPropertyValues( rPropertyNames, rPropertyValues );
+ aNewContent.executeCommand( rtl::OUString::createFromAscii( "insert" ),
+ makeAny(
+ InsertCommandArgument(
+ rData.is() ? rData : new EmptyInputStream,
+ sal_False /* ReplaceExisting */ ) ) );
+ aNewContent.m_xImpl->inserted();
+
+ rNewContent = aNewContent;
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool Content::insertNewContent( const rtl::OUString& rContentType,
+ const Sequence< sal_Int32 >&
+ nPropertyHandles,
+ const Sequence< Any >& rPropertyValues,
+ const Reference< XInputStream >& rData,
+ Content& rNewContent )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ if ( rContentType.getLength() == 0 )
+ return sal_False;
+
+ Reference< XContentCreator > xCreator( m_xImpl->getContent(), UNO_QUERY );
+
+ OSL_ENSURE( xCreator.is(),
+ "Content::insertNewContent - Not a XContentCreator!" );
+
+ if ( !xCreator.is() )
+ return sal_False;
+
+ ContentInfo aInfo;
+ aInfo.Type = rContentType;
+ aInfo.Attributes = 0;
+
+ Reference< XContent > xNew = xCreator->createNewContent( aInfo );
+ if ( !xNew.is() )
+ return sal_False;
+
+ Content aNewContent( xNew, m_xImpl->getEnvironment() );
+ aNewContent.setPropertyValues( nPropertyHandles, rPropertyValues );
+ aNewContent.executeCommand( rtl::OUString::createFromAscii( "insert" ),
+ makeAny(
+ InsertCommandArgument(
+ rData.is() ? rData : new EmptyInputStream,
+ sal_False /* ReplaceExisting */ ) ) );
+ aNewContent.m_xImpl->inserted();
+
+ rNewContent = aNewContent;
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool Content::transferContent( const Content& rSourceContent,
+ InsertOperation eOperation,
+ const rtl::OUString & rTitle,
+ const sal_Int32 nNameClashAction )
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ ContentBroker* pBroker = ContentBroker::get();
+ if ( !pBroker )
+ {
+ OSL_ENSURE( sal_False,
+ "Content::transferContent - No Content Broker!" );
+ return sal_False;
+ }
+
+ Reference< XCommandProcessor > xCmdProc(
+ pBroker->getCommandProcessorInterface() );
+ if ( !xCmdProc.is() )
+ {
+ OSL_ENSURE( sal_False,
+ "Content::transferContent - No XCommandProcessor!" );
+ return sal_False;
+ }
+
+ // Execute command "globalTransfer" at UCB.
+
+ TransferCommandOperation eTransOp = TransferCommandOperation();
+ switch ( eOperation )
+ {
+ case InsertOperation_COPY:
+ eTransOp = TransferCommandOperation_COPY;
+ break;
+
+ case InsertOperation_MOVE:
+ eTransOp = TransferCommandOperation_MOVE;
+ break;
+
+ case InsertOperation_LINK:
+ eTransOp = TransferCommandOperation_LINK;
+ break;
+
+ default:
+ ucbhelper::cancelCommandExecution(
+ makeAny( IllegalArgumentException(
+ rtl::OUString::createFromAscii(
+ "Unknown transfer operation!" ),
+ get(),
+ -1 ) ),
+ m_xImpl->getEnvironment() );
+ // Unreachable
+ }
+
+ GlobalTransferCommandArgument aTransferArg(
+ eTransOp,
+ rSourceContent.getURL(), // SourceURL
+ getURL(), // TargetFolderURL,
+ rTitle,
+ nNameClashAction );
+ Command aCommand;
+ aCommand.Name = rtl::OUString::createFromAscii( "globalTransfer" );
+ aCommand.Handle = -1; // n/a
+ aCommand.Argument <<= aTransferArg;
+
+ xCmdProc->execute( aCommand, 0, m_xImpl->getEnvironment() );
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool Content::isFolder()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Bool bFolder = sal_False;
+ if ( getPropertyValue( rtl::OUString::createFromAscii( "IsFolder" ) )
+ >>= bFolder )
+ return bFolder;
+
+ ucbhelper::cancelCommandExecution(
+ makeAny( UnknownPropertyException(
+ rtl::OUString::createFromAscii(
+ "Unable to retreive value of property 'IsFolder'!" ),
+ get() ) ),
+ m_xImpl->getEnvironment() );
+
+ // Unreachable - cancelCommandExecution always throws an exception.
+ // But some compilers complain...
+ return sal_False;
+}
+
+//=========================================================================
+sal_Bool Content::isDocument()
+ throw( CommandAbortedException, RuntimeException, Exception )
+{
+ sal_Bool bDoc = sal_False;
+ if ( getPropertyValue( rtl::OUString::createFromAscii( "IsDocument" ) )
+ >>= bDoc )
+ return bDoc;
+
+ ucbhelper::cancelCommandExecution(
+ makeAny( UnknownPropertyException(
+ rtl::OUString::createFromAscii(
+ "Unable to retreive value of property 'IsDocument'!" ),
+ get() ) ),
+ m_xImpl->getEnvironment() );
+
+ // Unreachable - cancelCommandExecution always throws an exception,
+ // But some compilers complain...
+ return sal_False;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// Content_Impl Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+Content_Impl::Content_Impl( const Reference< XMultiServiceFactory >& rSMgr,
+ const Reference< XContent >& rContent,
+ const Reference< XCommandEnvironment >& rEnv )
+: m_xSMgr( rSMgr ),
+ m_xContent( rContent ),
+ m_xEnv( rEnv ),
+ m_nCommandId( 0 )
+{
+ if ( m_xContent.is() )
+ {
+ m_xContentEventListener = new ContentEventListener_Impl( *this );
+ m_xContent->addContentEventListener( m_xContentEventListener );
+
+#if OSL_DEBUG_LEVEL > 1
+ // Only done on demand in product version for performance reasons,
+ // but a nice debug helper.
+ getURL();
+#endif
+ }
+}
+
+//=========================================================================
+void Content_Impl::reinit( const Reference< XContent >& xContent )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ m_xCommandProcessor = 0;
+ m_nCommandId = 0;
+
+ // #92581# - Don't reset m_aURL!!!
+
+ if ( m_xContent.is() )
+ {
+ try
+ {
+ m_xContent->removeContentEventListener( m_xContentEventListener );
+ }
+ catch ( RuntimeException const & )
+ {
+ }
+ }
+
+ if ( xContent.is() )
+ {
+ m_xContent = xContent;
+ m_xContent->addContentEventListener( m_xContentEventListener );
+
+#if OSL_DEBUG_LEVEL > 1
+ // Only done on demand in product version for performance reasons,
+ // but a nice debug helper.
+ getURL();
+#endif
+ }
+ else
+ {
+ // We need m_xContent's URL in order to be able to create the
+ // content object again if demanded ( --> Content_Impl::getContent() )
+ getURL();
+
+ m_xContent = 0;
+ }
+}
+
+//=========================================================================
+// virtual
+Content_Impl::~Content_Impl()
+{
+ if ( m_xContent.is() )
+ {
+ try
+ {
+ m_xContent->removeContentEventListener( m_xContentEventListener );
+ }
+ catch ( RuntimeException const & )
+ {
+ }
+ }
+}
+
+//=========================================================================
+void Content_Impl::disposing( const EventObject& Source )
+{
+ Reference<XContent> xContent;
+
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+ if(Source.Source != m_xContent)
+ return;
+
+ xContent = m_xContent;
+
+ m_nCommandId = 0;
+ m_aURL = rtl::OUString();
+ m_xCommandProcessor = 0;
+ m_xContent = 0;
+ }
+
+ if ( xContent.is() )
+ {
+ try
+ {
+ xContent->removeContentEventListener( m_xContentEventListener );
+ }
+ catch ( RuntimeException const & )
+ {
+ }
+ }
+}
+
+//=========================================================================
+const rtl::OUString& Content_Impl::getURL() const
+{
+ if ( !m_aURL.getLength() && m_xContent.is() )
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_aURL.getLength() && m_xContent.is() )
+ {
+ Reference< XContentIdentifier > xId = m_xContent->getIdentifier();
+ if ( xId.is() )
+ m_aURL = xId->getContentIdentifier();
+ }
+ }
+
+ return m_aURL;
+}
+
+//=========================================================================
+Reference< XContent > Content_Impl::getContent()
+{
+ if ( !m_xContent.is() && m_aURL.getLength() )
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_xContent.is() && m_aURL.getLength() )
+ {
+ ContentBroker* pBroker = ContentBroker::get();
+
+ OSL_ENSURE( pBroker, "No Content Broker!" );
+
+ if ( pBroker )
+ {
+ OSL_ENSURE( pBroker->getContentProviderManagerInterface()
+ ->queryContentProviders().getLength(),
+ "Content Broker not configured (no providers)!" );
+
+ Reference< XContentIdentifierFactory > xIdFac
+ = pBroker->getContentIdentifierFactoryInterface();
+
+ OSL_ENSURE( xIdFac.is(), "No Content Identifier factory!" );
+
+ if ( xIdFac.is() )
+ {
+ Reference< XContentIdentifier > xId
+ = xIdFac->createContentIdentifier( m_aURL );
+
+ OSL_ENSURE( xId.is(), "No Content Identifier!" );
+
+ if ( xId.is() )
+ {
+ Reference< XContentProvider > xProvider
+ = pBroker->getContentProviderInterface();
+
+ OSL_ENSURE( xProvider.is(), "No Content Provider!" );
+
+ if ( xProvider.is() )
+ {
+ try
+ {
+ m_xContent = xProvider->queryContent( xId );
+ }
+ catch ( IllegalIdentifierException const & )
+ {
+ }
+
+ if ( m_xContent.is() )
+ m_xContent->addContentEventListener(
+ m_xContentEventListener );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return m_xContent;
+}
+
+//=========================================================================
+Reference< XCommandProcessor > Content_Impl::getCommandProcessor()
+{
+ if ( !m_xCommandProcessor.is() )
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_xCommandProcessor.is() )
+ m_xCommandProcessor
+ = Reference< XCommandProcessor >( getContent(), UNO_QUERY );
+ }
+
+ return m_xCommandProcessor;
+}
+
+//=========================================================================
+sal_Int32 Content_Impl::getCommandId()
+{
+ if ( m_nCommandId == 0 )
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_nCommandId == 0 )
+ {
+ Reference< XCommandProcessor > xProc = getCommandProcessor();
+ if ( xProc.is() )
+ m_nCommandId = xProc->createCommandIdentifier();
+ }
+ }
+
+ return m_nCommandId;
+}
+
+//=========================================================================
+Any Content_Impl::executeCommand( const Command& rCommand )
+{
+ Reference< XCommandProcessor > xProc = getCommandProcessor();
+ if ( !xProc.is() )
+ return Any();
+
+ // Execute command
+ return xProc->execute( rCommand, getCommandId(), m_xEnv );
+}
+
+//=========================================================================
+void Content_Impl::abortCommand()
+{
+ sal_Int32 nCommandId;
+ Reference< XCommandProcessor > xCommandProcessor;
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+ nCommandId = m_nCommandId;
+ xCommandProcessor = m_xCommandProcessor;
+ }
+
+ if ( ( nCommandId != 0 ) && xCommandProcessor.is() )
+ xCommandProcessor->abort( nCommandId );
+}
+
+//=========================================================================
+inline const Reference< XCommandEnvironment >&
+ Content_Impl::getEnvironment() const
+{
+ return m_xEnv;
+}
+
+//=========================================================================
+inline void Content_Impl::setEnvironment(
+ const Reference< XCommandEnvironment >& xNewEnv )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+ m_xEnv = xNewEnv;
+}
+
+//=========================================================================
+void Content_Impl::inserted()
+{
+ // URL might have changed during 'insert' => recalculate in next getURL()
+ osl::MutexGuard aGuard( m_aMutex );
+ m_aURL = ::rtl::OUString();
+}
+
+//=========================================================================
+//=========================================================================
+//
+// ContentEventListener_Impl Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( ContentEventListener_Impl,
+ XContentEventListener,
+ XEventListener ); /* base of XContentEventListener */
+
+//=========================================================================
+//
+// XContentEventListener methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentEventListener_Impl::contentEvent( const ContentEvent& evt )
+ throw( RuntimeException )
+{
+ if ( evt.Source == m_rContent.m_xContent )
+ {
+ switch ( evt.Action )
+ {
+ case ContentAction::DELETED:
+ m_rContent.reinit( Reference< XContent >() );
+ break;
+
+ case ContentAction::EXCHANGED:
+ m_rContent.reinit( evt.Content );
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+//=========================================================================
+//
+// XEventListenr methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentEventListener_Impl::disposing( const EventObject& Source )
+ throw( RuntimeException )
+{
+ m_rContent.disposing(Source);
+}
+
+} /* namespace ucbhelper */
+
diff --git a/ucbhelper/source/client/contentbroker.cxx b/ucbhelper/source/client/contentbroker.cxx
new file mode 100644
index 000000000000..43d1491d8507
--- /dev/null
+++ b/ucbhelper/source/client/contentbroker.cxx
@@ -0,0 +1,379 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: contentbroker.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+#include <osl/diagnose.h>
+#include <osl/mutex.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#include <com/sun/star/ucb/XCommandProcessor.hpp>
+#include <ucbhelper/contentbroker.hxx>
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+namespace
+{
+ osl::Mutex globalContentBrokerMutex;
+ osl::Mutex & getGlobalContentBrokerMutex() { return globalContentBrokerMutex; }
+
+} // namespace
+
+namespace ucbhelper
+{
+
+//=========================================================================
+//=========================================================================
+//
+// class ContentBroker_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+class ContentBroker_Impl
+{
+ Reference< XMultiServiceFactory > m_xSMgr;
+ Reference< XContentIdentifierFactory > m_xIdFac;
+ Reference< XContentProvider > m_xProvider;
+ Reference< XContentProviderManager > m_xProviderMgr;
+ Reference< XCommandProcessor > m_xCommandProc;
+ osl::Mutex m_aMutex;
+ Sequence< Any > m_aArguments;
+ ContentProviderDataList m_aProvData;
+ bool m_bInitDone;
+
+public:
+ ContentBroker_Impl( const Reference< XMultiServiceFactory >& rSMgr,
+ const Sequence< Any >& rArguments )
+ : m_xSMgr( rSMgr ), m_aArguments( rArguments ), m_bInitDone( sal_False )
+ {}
+
+ ContentBroker_Impl( const Reference< XMultiServiceFactory >& rSMgr,
+ const ContentProviderDataList & rData )
+ : m_xSMgr( rSMgr ), m_aProvData( rData ), m_bInitDone( sal_False )
+ {}
+
+ ~ContentBroker_Impl();
+
+ bool initialize();
+
+ const Reference< XMultiServiceFactory >& getServiceManager() const
+ { return m_xSMgr; }
+
+ const Reference< XContentIdentifierFactory >& getIdFactory() const
+ { return m_xIdFac; }
+
+ const Reference< XContentProvider >& getProvider() const
+ { return m_xProvider; }
+
+ const Reference< XContentProviderManager >& getProviderManager() const
+ { return m_xProviderMgr; }
+
+ const Reference< XCommandProcessor >& getCommandProcessor() const
+ { return m_xCommandProc; }
+};
+
+//=========================================================================
+//=========================================================================
+//
+// ContentBroker Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+// static member!
+ContentBroker* ContentBroker::m_pTheBroker = 0;
+
+//=========================================================================
+ContentBroker::ContentBroker( const Reference< XMultiServiceFactory >& rSMgr,
+ const Sequence< Any >& rArguments )
+{
+ m_pImpl = new ContentBroker_Impl( rSMgr, rArguments );
+}
+
+//=========================================================================
+ContentBroker::ContentBroker( const Reference< XMultiServiceFactory >& rSMgr,
+ const ContentProviderDataList & rData )
+{
+ m_pImpl = new ContentBroker_Impl( rSMgr, rData );
+}
+
+//=========================================================================
+ContentBroker::~ContentBroker()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+Reference< XMultiServiceFactory > ContentBroker::getServiceManager() const
+{
+ return m_pImpl->getServiceManager();
+}
+
+//=========================================================================
+Reference< XContentIdentifierFactory >
+ ContentBroker::getContentIdentifierFactoryInterface() const
+{
+ return m_pImpl->getIdFactory();
+}
+
+//=========================================================================
+Reference< XContentProvider >
+ ContentBroker::getContentProviderInterface() const
+{
+ return m_pImpl->getProvider();
+}
+
+//=========================================================================
+Reference< XContentProviderManager >
+ ContentBroker::getContentProviderManagerInterface() const
+{
+ return m_pImpl->getProviderManager();
+}
+
+//=========================================================================
+Reference< XCommandProcessor >
+ ContentBroker::getCommandProcessorInterface() const
+{
+ return m_pImpl->getCommandProcessor();
+}
+
+//=========================================================================
+// static
+sal_Bool ContentBroker::initialize(
+ const Reference< XMultiServiceFactory >& rSMgr,
+ const Sequence< Any >& rArguments )
+{
+ OSL_ENSURE( !m_pTheBroker,
+ "ContentBroker::initialize - already initialized!" );
+
+ if ( !m_pTheBroker )
+ {
+ osl::Guard< osl::Mutex > aGuard( getGlobalContentBrokerMutex() );
+
+ if ( !m_pTheBroker )
+ {
+ ContentBroker * pBroker = new ContentBroker( rSMgr, rArguments );
+
+ // Force init to be able to detect UCB init trouble immediately.
+ if ( pBroker->m_pImpl->initialize() )
+ m_pTheBroker = pBroker;
+ else
+ delete pBroker;
+ }
+ }
+
+ return m_pTheBroker != 0;
+}
+
+//=========================================================================
+// static
+sal_Bool ContentBroker::initialize(
+ const Reference< XMultiServiceFactory >& rSMgr,
+ const ContentProviderDataList & rData )
+{
+ OSL_ENSURE( !m_pTheBroker,
+ "ContentBroker::initialize - already initialized!" );
+
+ if ( !m_pTheBroker )
+ {
+ osl::Guard< osl::Mutex > aGuard( getGlobalContentBrokerMutex() );
+
+ if ( !m_pTheBroker )
+ {
+ ContentBroker * pBroker = new ContentBroker( rSMgr, rData );
+
+ // Force init to be able to detect UCB init trouble immediately.
+ if ( pBroker->m_pImpl->initialize() )
+ m_pTheBroker = pBroker;
+ else
+ delete pBroker;
+ }
+ }
+
+ return m_pTheBroker != 0;
+}
+
+//=========================================================================
+// static
+void ContentBroker::deinitialize()
+{
+ osl::MutexGuard aGuard( getGlobalContentBrokerMutex() );
+
+ delete m_pTheBroker;
+ m_pTheBroker = 0;
+}
+
+//=========================================================================
+// static
+ContentBroker* ContentBroker::get()
+{
+ return m_pTheBroker;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// ContentBroker_Impl Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ContentBroker_Impl::~ContentBroker_Impl()
+{
+ Reference< XComponent > xComponent( m_xProvider, UNO_QUERY );
+ if ( xComponent.is() )
+ {
+ m_xIdFac = 0;
+ m_xProvider = 0;
+ m_xProviderMgr = 0;
+
+ xComponent->dispose();
+ }
+}
+
+//=========================================================================
+bool ContentBroker_Impl::initialize()
+{
+ if ( !m_bInitDone )
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_bInitDone )
+ {
+ Reference< XInterface > xIfc;
+
+ if ( m_aProvData.size() > 0 )
+ {
+ try
+ {
+ xIfc = m_xSMgr->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.ucb.UniversalContentBroker" ) );
+ }
+ catch ( Exception const & )
+ {
+ }
+
+ if ( xIfc.is() )
+ {
+ m_xProviderMgr
+ = Reference< XContentProviderManager >( xIfc, UNO_QUERY );
+
+ if ( m_xProviderMgr.is() )
+ {
+ if ( !configureUcb( m_xProviderMgr,
+ m_xSMgr,
+ m_aProvData,
+ 0 ) )
+ {
+ OSL_ENSURE( false, "Failed to configure UCB!" );
+ return false;
+ }
+ }
+ }
+ }
+ else
+ {
+ try
+ {
+ xIfc = m_xSMgr->createInstanceWithArguments(
+ OUString::createFromAscii(
+ "com.sun.star.ucb.UniversalContentBroker" ),
+ m_aArguments );
+ }
+ catch ( Exception const & )
+ {
+ }
+ }
+
+ OSL_ENSURE( xIfc.is(), "Error creating UCB service!" );
+
+ if ( !xIfc.is() )
+ return false;
+
+
+ m_xIdFac
+ = Reference< XContentIdentifierFactory >( xIfc, UNO_QUERY );
+
+ OSL_ENSURE( m_xIdFac.is(),
+ "UCB without required interface XContentIdentifierFactory!" );
+
+ if ( !m_xIdFac.is() )
+ return false;
+
+ m_xProvider = Reference< XContentProvider >( xIfc, UNO_QUERY );
+
+ OSL_ENSURE( m_xProvider.is(),
+ "UCB without required interface XContentProvider!" );
+
+ if ( !m_xProvider.is() )
+ return false;
+
+ if ( !m_xProviderMgr.is() )
+ m_xProviderMgr
+ = Reference< XContentProviderManager >( xIfc, UNO_QUERY );
+
+ OSL_ENSURE( m_xProviderMgr.is(),
+ "UCB without required interface XContentProviderManager!" );
+
+ if ( !m_xProviderMgr.is() )
+ return false;
+
+ m_xCommandProc = Reference< XCommandProcessor >( xIfc, UNO_QUERY );
+
+ OSL_ENSURE( m_xCommandProc.is(),
+ "UCB without required interface XCommandProcessor!" );
+
+ if ( !m_xCommandProc.is() )
+ return false;
+
+ // Everything okay.
+ m_bInitDone = sal_True;
+ }
+ }
+
+ return true;
+}
+
+} /* namespace ucbhelper */
+
diff --git a/ucbhelper/source/client/fileidentifierconverter.cxx b/ucbhelper/source/client/fileidentifierconverter.cxx
new file mode 100644
index 000000000000..6fc57607ac69
--- /dev/null
+++ b/ucbhelper/source/client/fileidentifierconverter.cxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: fileidentifierconverter.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+#include <ucbhelper/fileidentifierconverter.hxx>
+#include <com/sun/star/ucb/ContentProviderInfo.hpp>
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#include <com/sun/star/ucb/XFileIdentifierConverter.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <osl/diagnose.h>
+#include <rtl/ustring.hxx>
+#include <sal/types.h>
+
+using namespace com::sun::star;
+
+namespace ucbhelper {
+
+//============================================================================
+//
+// getLocalFileURL
+//
+//============================================================================
+
+rtl::OUString
+getLocalFileURL(
+ uno::Reference< ucb::XContentProviderManager > const &)
+ SAL_THROW((uno::RuntimeException))
+{
+ // If there were more file systems than just "file:///" (e.g., the obsolete
+ // "vnd.sun.star.wfs:///"), this code should query all relevant UCPs for
+ // their com.sun.star.ucb.XFileIdentifierConverter.getFileProviderLocality
+ // and return the most local one:
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///"));
+}
+
+//============================================================================
+//
+// getFileURLFromSystemPath
+//
+//============================================================================
+
+rtl::OUString
+getFileURLFromSystemPath(
+ uno::Reference< ucb::XContentProviderManager > const & rManager,
+ rtl::OUString const & rBaseURL,
+ rtl::OUString const & rSystemPath)
+ SAL_THROW((uno::RuntimeException))
+{
+ OSL_ASSERT(rManager.is());
+
+ uno::Reference< ucb::XFileIdentifierConverter >
+ xConverter(rManager->queryContentProvider(rBaseURL), uno::UNO_QUERY);
+ if (xConverter.is())
+ return xConverter->getFileURLFromSystemPath(rBaseURL, rSystemPath);
+ else
+ return rtl::OUString();
+}
+
+//============================================================================
+//
+// getSystemPathFromFileURL
+//
+//============================================================================
+
+rtl::OUString
+getSystemPathFromFileURL(
+ uno::Reference< ucb::XContentProviderManager > const & rManager,
+ rtl::OUString const & rURL)
+ SAL_THROW((uno::RuntimeException))
+{
+ OSL_ASSERT(rManager.is());
+
+ uno::Reference< ucb::XFileIdentifierConverter >
+ xConverter(rManager->queryContentProvider(rURL), uno::UNO_QUERY);
+ if (xConverter.is())
+ return xConverter->getSystemPathFromFileURL(rURL);
+ else
+ return rtl::OUString();
+}
+
+}
diff --git a/ucbhelper/source/client/interceptedinteraction.cxx b/ucbhelper/source/client/interceptedinteraction.cxx
new file mode 100644
index 000000000000..a328684e4692
--- /dev/null
+++ b/ucbhelper/source/client/interceptedinteraction.cxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: interceptedinteraction.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+#include <ucbhelper/interceptedinteraction.hxx>
+
+//_______________________________________________
+// includes
+
+//_______________________________________________
+// namespace
+
+namespace ucbhelper{
+
+namespace css = ::com::sun::star;
+
+//_______________________________________________
+// definitions
+
+/*-----------------------------------------------
+ 17.03.2004 11:00
+-----------------------------------------------*/
+InterceptedInteraction::InterceptedInteraction()
+{
+}
+
+/*-----------------------------------------------
+ 17.03.2004 14:55
+-----------------------------------------------*/
+void InterceptedInteraction::setInterceptedHandler(const css::uno::Reference< css::task::XInteractionHandler >& xInterceptedHandler)
+{
+ m_xInterceptedHandler = xInterceptedHandler;
+}
+
+/*-----------------------------------------------
+ 17.03.2004 14:55
+-----------------------------------------------*/
+void InterceptedInteraction::setInterceptions(const ::std::vector< InterceptedRequest >& lInterceptions)
+{
+ m_lInterceptions = lInterceptions;
+}
+
+/*-----------------------------------------------
+ 18.03.2004 10:10
+-----------------------------------------------*/
+InterceptedInteraction::EInterceptionState InterceptedInteraction::intercepted(
+ const InterceptedRequest&,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >&)
+{
+ // default behaviour! see impl_interceptRequest() for further informations ...
+ return E_NOT_INTERCEPTED;
+}
+
+/*-----------------------------------------------
+ 18.03.2004 09:46
+-----------------------------------------------*/
+css::uno::Reference< css::task::XInteractionContinuation > InterceptedInteraction::extractContinuation(const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > >& lContinuations,
+ const css::uno::Type& aType )
+{
+ const css::uno::Reference< css::task::XInteractionContinuation >* pContinuations = lContinuations.getConstArray();
+
+ sal_Int32 c = lContinuations.getLength();
+ sal_Int32 i = 0;
+
+ for (i=0; i<c; ++i)
+ {
+ css::uno::Reference< css::uno::XInterface > xCheck(pContinuations[i], css::uno::UNO_QUERY);
+ if (xCheck->queryInterface(aType).hasValue())
+ return pContinuations[i];
+ }
+
+ return css::uno::Reference< css::task::XInteractionContinuation >();
+}
+
+/*-----------------------------------------------
+ 18.03.2004 10:03
+-----------------------------------------------*/
+void SAL_CALL InterceptedInteraction::handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest)
+ throw(css::uno::RuntimeException)
+{
+ impl_handleDefault(xRequest);
+}
+
+/*-----------------------------------------------
+ 18.03.2004 10:02
+-----------------------------------------------*/
+void InterceptedInteraction::impl_handleDefault(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest)
+{
+ EInterceptionState eState = impl_interceptRequest(xRequest);
+
+ switch(eState)
+ {
+ case E_NOT_INTERCEPTED:
+ {
+ // Non of the intercepted requests match to the given one.
+ // => forward request to the internal wrapped handler - if there is one.
+ if (m_xInterceptedHandler.is())
+ m_xInterceptedHandler->handle(xRequest);
+ }
+ break;
+
+ case E_NO_CONTINUATION_FOUND:
+ {
+ // Runtime error! The defined continuation could not be located
+ // inside the set of available containuations of the incoming request.
+ // Whats wrong - the interception list or the request?
+ OSL_ENSURE(sal_False, "InterceptedInteraction::handle()\nCould intercept this interaction request - but cant locate the right continuation!");
+ }
+ break;
+
+ case E_INTERCEPTED:
+ break;
+ }
+}
+
+/*-----------------------------------------------
+ 18.03.2004 09:48
+-----------------------------------------------*/
+InterceptedInteraction::EInterceptionState InterceptedInteraction::impl_interceptRequest(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest)
+{
+ css::uno::Any aRequest = xRequest->getRequest();
+ css::uno::Type aRequestType = aRequest.getValueType();
+ css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations = xRequest->getContinuations();
+
+ // check against the list of static requests
+ sal_Int32 nHandle = 0;
+ ::std::vector< InterceptedRequest >::const_iterator pIt;
+ for ( pIt = m_lInterceptions.begin();
+ pIt != m_lInterceptions.end() ;
+ ++pIt )
+ {
+ const InterceptedRequest& rInterception = *pIt;
+ css::uno::Type aInterceptedType = rInterception.Request.getValueType();
+
+ // check the request
+ sal_Bool bMatch = sal_False;
+ if (rInterception.MatchExact)
+ bMatch = aInterceptedType.equals(aRequestType);
+ else
+ bMatch = aInterceptedType.isAssignableFrom(aRequestType); // dont change intercepted and request type here -> it will check the wrong direction!
+
+ // intercepted ...
+ // Call they might existing derived class, so they can handle that by its own.
+ // If its not interested on that (may be its not overwritten and the default implementation
+ // returns E_NOT_INTERCEPTED as default) -> break this loop and search for the right continuation.
+ if (bMatch)
+ {
+ EInterceptionState eState = intercepted(rInterception, xRequest);
+ if (eState == E_NOT_INTERCEPTED)
+ break;
+ return eState;
+ }
+
+ ++nHandle;
+ }
+
+ if (pIt != m_lInterceptions.end()) // => can be true only if bMatch=TRUE!
+ {
+ // match -> search required continuation
+ const InterceptedRequest& rInterception = *pIt;
+ css::uno::Reference< css::task::XInteractionContinuation > xContinuation = InterceptedInteraction::extractContinuation(lContinuations, rInterception.Continuation);
+ if (xContinuation.is())
+ {
+ xContinuation->select();
+ return E_INTERCEPTED;
+ }
+
+ // Can be reached only, if the request does not support the given continuation!
+ // => RuntimeError!?
+ return E_NO_CONTINUATION_FOUND;
+ }
+
+ return E_NOT_INTERCEPTED;
+}
+
+} // namespace ucbhelper
diff --git a/ucbhelper/source/client/makefile.mk b/ucbhelper/source/client/makefile.mk
new file mode 100644
index 000000000000..aa7858443778
--- /dev/null
+++ b/ucbhelper/source/client/makefile.mk
@@ -0,0 +1,64 @@
+#*************************************************************************
+#
+# 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
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.14 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME= ucbhelper
+TARGET= client
+AUTOSEG= TRUE
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+SLOFILES=\
+ $(SLO)$/content.obj \
+ $(SLO)$/contentbroker.obj \
+ $(SLO)$/commandenvironment.obj \
+ $(SLO)$/fileidentifierconverter.obj \
+ $(SLO)$/activedatasink.obj \
+ $(SLO)$/activedatastreamer.obj \
+ $(SLO)$/proxydecider.obj \
+ $(SLO)$/interceptedinteraction.obj
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/ucbhelper/source/client/proxydecider.cxx b/ucbhelper/source/client/proxydecider.cxx
new file mode 100644
index 000000000000..299eeb2ef9b6
--- /dev/null
+++ b/ucbhelper/source/client/proxydecider.cxx
@@ -0,0 +1,864 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: proxydecider.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#include <utility>
+#include <vector>
+#include <list>
+#include <osl/mutex.hxx>
+#include <rtl/ref.hxx>
+#include <osl/socket.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/XChangesListener.hpp>
+#include <com/sun/star/util/XChangesNotifier.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include "ucbhelper/proxydecider.hxx"
+
+using namespace com::sun::star;
+using namespace ucbhelper;
+
+#define CONFIG_ROOT_KEY "org.openoffice.Inet/Settings"
+#define PROXY_TYPE_KEY "ooInetProxyType"
+#define NO_PROXY_LIST_KEY "ooInetNoProxy"
+#define HTTP_PROXY_NAME_KEY "ooInetHTTPProxyName"
+#define HTTP_PROXY_PORT_KEY "ooInetHTTPProxyPort"
+#define FTP_PROXY_NAME_KEY "ooInetFTPProxyName"
+#define FTP_PROXY_PORT_KEY "ooInetFTPProxyPort"
+
+//=========================================================================
+namespace ucbhelper
+{
+
+//=========================================================================
+namespace proxydecider_impl
+{
+
+// A simple case ignoring wildcard matcher.
+class WildCard
+{
+private:
+ rtl::OString m_aWildString;
+
+public:
+ WildCard( const rtl::OUString& rWildCard )
+ : m_aWildString(
+ rtl::OUStringToOString(
+ rWildCard, RTL_TEXTENCODING_UTF8 ).toAsciiLowerCase() ) {}
+
+ bool Matches( const rtl::OUString & rStr ) const;
+};
+
+//=========================================================================
+typedef std::pair< WildCard, WildCard > NoProxyListEntry;
+
+//=========================================================================
+
+class HostnameCache
+{
+ typedef std::pair< rtl::OUString, rtl::OUString > HostListEntry;
+
+ std::list< HostListEntry > m_aHostList;
+ sal_uInt32 m_nCapacity;
+
+public:
+ explicit HostnameCache( sal_uInt32 nCapacity )
+ : m_nCapacity( nCapacity ) {}
+
+ bool get( const rtl::OUString & rKey, rtl::OUString & rValue ) const
+ {
+ std::list< HostListEntry >::const_iterator it
+ = m_aHostList.begin();
+ const std::list< HostListEntry >::const_iterator end
+ = m_aHostList.end();
+
+ while ( it != end )
+ {
+ if ( (*it).first == rKey )
+ {
+ rValue = (*it).second;
+ return true;
+ }
+ it++;
+ }
+ return false;
+ }
+
+ void put( const rtl::OUString & rKey, const rtl::OUString & rValue )
+ {
+ if ( m_aHostList.size() == m_nCapacity )
+ m_aHostList.resize( m_nCapacity / 2 );
+
+ m_aHostList.push_front( HostListEntry( rKey, rValue ) );
+ }
+};
+
+//=========================================================================
+class InternetProxyDecider_Impl :
+ public cppu::WeakImplHelper1< util::XChangesListener >
+{
+ mutable osl::Mutex m_aMutex;
+ InternetProxyServer m_aHttpProxy;
+ InternetProxyServer m_aFtpProxy;
+ const InternetProxyServer m_aEmptyProxy;
+ sal_Int32 m_nProxyType;
+ uno::Reference< util::XChangesNotifier > m_xNotifier;
+ std::vector< NoProxyListEntry > m_aNoProxyList;
+ mutable HostnameCache m_aHostnames;
+
+private:
+ bool shouldUseProxy( const rtl::OUString & rHost,
+ sal_Int32 nPort,
+ bool bUseFullyQualified ) const;
+public:
+ InternetProxyDecider_Impl(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr );
+ virtual ~InternetProxyDecider_Impl();
+
+ static rtl::Reference< InternetProxyDecider_Impl > createInstance(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr );
+
+ void dispose();
+
+ const InternetProxyServer & getProxy( const rtl::OUString & rProtocol,
+ const rtl::OUString & rHost,
+ sal_Int32 nPort ) const;
+
+ // XChangesListener
+ virtual void SAL_CALL changesOccurred( const util::ChangesEvent& Event )
+ throw( uno::RuntimeException );
+
+ // XEventListener ( base of XChangesLisetenr )
+ virtual void SAL_CALL disposing( const lang::EventObject& Source )
+ throw( uno::RuntimeException );
+
+private:
+ void setNoProxyList( const rtl::OUString & rNoProxyList );
+};
+
+//=========================================================================
+//=========================================================================
+//
+// WildCard Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+bool WildCard::Matches( const rtl::OUString& rString ) const
+{
+ rtl::OString aString
+ = rtl::OUStringToOString(
+ rString, RTL_TEXTENCODING_UTF8 ).toAsciiLowerCase();
+ const char * pStr = aString.getStr();
+ const char * pWild = m_aWildString.getStr();
+
+ int pos = 0;
+ int flag = 0;
+
+ while ( *pWild || flag )
+ {
+ switch ( *pWild )
+ {
+ case '?':
+ if ( *pStr == '\0' )
+ return 0;
+ break;
+
+ default:
+ if ( ( *pWild == '\\' ) && ( ( *( pWild + 1 ) == '?' )
+ || ( *( pWild + 1 ) == '*') ) )
+ pWild++;
+ if ( *pWild != *pStr )
+ if ( !pos )
+ return 0;
+ else
+ pWild += pos;
+ else
+ break;
+
+ // Note: fall-thru's are intended!
+
+ case '*':
+ while ( *pWild == '*' )
+ pWild++;
+ if ( *pWild == '\0' )
+ return 1;
+ flag = 1;
+ pos = 0;
+ if ( *pStr == '\0' )
+ return ( *pWild == '\0' );
+ while ( *pStr && *pStr != *pWild )
+ {
+ if ( *pWild == '?' ) {
+ pWild++;
+ while ( *pWild == '*' )
+ pWild++;
+ }
+ pStr++;
+ if ( *pStr == '\0' )
+ return ( *pWild == '\0' );
+ }
+ break;
+ }
+ if ( *pWild != '\0' )
+ pWild++;
+ if ( *pStr != '\0' )
+ pStr++;
+ else
+ flag = 0;
+ if ( flag )
+ pos--;
+ }
+ return ( *pStr == '\0' ) && ( *pWild == '\0' );
+}
+
+//=========================================================================
+//=========================================================================
+//
+// InternetProxyDecider_Impl Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+InternetProxyDecider_Impl::InternetProxyDecider_Impl(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr )
+ : m_nProxyType( 0 ),
+ m_aHostnames( 256 ) // cache size
+{
+ try
+ {
+ //////////////////////////////////////////////////////////////
+ // Read proxy configuration from config db.
+ //////////////////////////////////////////////////////////////
+
+ uno::Reference< lang::XMultiServiceFactory > xConfigProv(
+ rxSMgr->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.configuration.ConfigurationProvider" ) ),
+ uno::UNO_QUERY );
+
+ uno::Sequence< uno::Any > aArguments( 1 );
+ aArguments[ 0 ] <<= rtl::OUString::createFromAscii( CONFIG_ROOT_KEY );
+
+ uno::Reference< uno::XInterface > xInterface(
+ xConfigProv->createInstanceWithArguments(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.configuration.ConfigurationAccess" ),
+ aArguments ) );
+
+ OSL_ENSURE( xInterface.is(),
+ "InternetProxyDecider - No config access!" );
+
+ if ( xInterface.is() )
+ {
+ uno::Reference< container::XNameAccess > xNameAccess(
+ xInterface, uno::UNO_QUERY );
+ OSL_ENSURE( xNameAccess.is(),
+ "InternetProxyDecider - No name access!" );
+
+ if ( xNameAccess.is() )
+ {
+ try
+ {
+ if ( !( xNameAccess->getByName(
+ rtl::OUString::createFromAscii(
+ PROXY_TYPE_KEY ) ) >>= m_nProxyType ) )
+ {
+ OSL_ENSURE( sal_False,
+ "InternetProxyDecider - "
+ "Error getting config item value!" );
+ }
+ }
+ catch ( lang::WrappedTargetException const & )
+ {
+ }
+ catch ( container::NoSuchElementException const & )
+ {
+ }
+
+ rtl::OUString aNoProxyList;
+ try
+ {
+ if ( !( xNameAccess->getByName(
+ rtl::OUString::createFromAscii(
+ NO_PROXY_LIST_KEY ) ) >>= aNoProxyList ) )
+ {
+ OSL_ENSURE( sal_False,
+ "InternetProxyDecider - "
+ "Error getting config item value!" );
+ }
+ }
+ catch ( lang::WrappedTargetException const & )
+ {
+ }
+ catch ( container::NoSuchElementException const & )
+ {
+ }
+
+ setNoProxyList( aNoProxyList );
+
+ try
+ {
+ if ( !( xNameAccess->getByName(
+ rtl::OUString::createFromAscii(
+ HTTP_PROXY_NAME_KEY ) )
+ >>= m_aHttpProxy.aName ) )
+ {
+ OSL_ENSURE( sal_False,
+ "InternetProxyDecider - "
+ "Error getting config item value!" );
+ }
+ }
+ catch ( lang::WrappedTargetException const & )
+ {
+ }
+ catch ( container::NoSuchElementException const & )
+ {
+ }
+
+ m_aHttpProxy.nPort = -1;
+ try
+ {
+ uno::Any aValue = xNameAccess->getByName(
+ rtl::OUString::createFromAscii(
+ HTTP_PROXY_PORT_KEY ) );
+ if ( aValue.hasValue() &&
+ !( aValue >>= m_aHttpProxy.nPort ) )
+ {
+ OSL_ENSURE( sal_False,
+ "InternetProxyDecider - "
+ "Error getting config item value!" );
+ }
+ }
+ catch ( lang::WrappedTargetException const & )
+ {
+ }
+ catch ( container::NoSuchElementException const & )
+ {
+ }
+
+ if ( m_aHttpProxy.nPort == -1 )
+ m_aHttpProxy.nPort = 80; // standard HTTP port.
+
+ try
+ {
+ if ( !( xNameAccess->getByName(
+ rtl::OUString::createFromAscii(
+ FTP_PROXY_NAME_KEY ) )
+ >>= m_aFtpProxy.aName ) )
+ {
+ OSL_ENSURE( sal_False,
+ "InternetProxyDecider - "
+ "Error getting config item value!" );
+ }
+ }
+ catch ( lang::WrappedTargetException const & )
+ {
+ }
+ catch ( container::NoSuchElementException const & )
+ {
+ }
+
+ m_aFtpProxy.nPort = -1;
+ try
+ {
+ uno::Any aValue = xNameAccess->getByName(
+ rtl::OUString::createFromAscii(
+ FTP_PROXY_PORT_KEY ) );
+ if ( aValue.hasValue() &&
+ !( aValue >>= m_aFtpProxy.nPort ) )
+ {
+ OSL_ENSURE( sal_False,
+ "InternetProxyDecider - "
+ "Error getting config item value!" );
+ }
+ }
+ catch ( lang::WrappedTargetException const & )
+ {
+ }
+ catch ( container::NoSuchElementException const & )
+ {
+ }
+ }
+
+ // Register as listener for config changes.
+
+ m_xNotifier = uno::Reference< util::XChangesNotifier >(
+ xInterface, uno::UNO_QUERY );
+
+ OSL_ENSURE( m_xNotifier.is(),
+ "InternetProxyDecider - No notifier!" );
+
+ if ( m_xNotifier.is() )
+ m_xNotifier->addChangesListener( this );
+ }
+ }
+ catch ( uno::Exception const & )
+ {
+ // createInstance, createInstanceWithArguments
+ OSL_ENSURE( sal_False, "InternetProxyDecider - Exception!" );
+ }
+}
+
+//=========================================================================
+// virtual
+InternetProxyDecider_Impl::~InternetProxyDecider_Impl()
+{
+}
+
+//=========================================================================
+void InternetProxyDecider_Impl::dispose()
+{
+ uno::Reference< util::XChangesNotifier > xNotifier;
+
+ if ( m_xNotifier.is() )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_xNotifier.is() )
+ {
+ xNotifier = m_xNotifier;
+ m_xNotifier.clear();
+ }
+ }
+
+ // Do this unguarded!
+ if ( xNotifier.is() )
+ xNotifier->removeChangesListener( this );
+}
+
+//=========================================================================
+bool InternetProxyDecider_Impl::shouldUseProxy( const rtl::OUString & rHost,
+ sal_Int32 nPort,
+ bool bUseFullyQualified ) const
+{
+ rtl::OUStringBuffer aBuffer;
+
+ if ( ( rHost.indexOf( ':' ) != -1 ) &&
+ ( rHost[ 0 ] != sal_Unicode( '[' ) ) )
+ {
+ // host is given as numeric IPv6 address
+ aBuffer.appendAscii( "[" );
+ aBuffer.append( rHost );
+ aBuffer.appendAscii( "]" );
+ }
+ else
+ {
+ // host is given either as numeric IPv4 address or non-numeric hostname
+ aBuffer.append( rHost );
+ }
+
+ aBuffer.append( sal_Unicode( ':' ) );
+ aBuffer.append( rtl::OUString::valueOf( nPort ) );
+ const rtl::OUString aHostAndPort( aBuffer.makeStringAndClear() );
+
+ std::vector< NoProxyListEntry >::const_iterator it
+ = m_aNoProxyList.begin();
+ const std::vector< NoProxyListEntry >::const_iterator end
+ = m_aNoProxyList.end();
+
+ while ( it != end )
+ {
+ if ( bUseFullyQualified )
+ {
+ if ( (*it).second.Matches( aHostAndPort ) )
+ return false;
+ }
+ else
+ {
+ if ( (*it).first.Matches( aHostAndPort ) )
+ return false;
+ }
+ it++;
+ }
+
+ return true;
+}
+
+//=========================================================================
+const InternetProxyServer & InternetProxyDecider_Impl::getProxy(
+ const rtl::OUString & rProtocol,
+ const rtl::OUString & rHost,
+ sal_Int32 nPort ) const
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_nProxyType == 0 )
+ {
+ // Never use proxy.
+ return m_aEmptyProxy;
+ }
+
+ if ( rHost.getLength() && m_aNoProxyList.size() )
+ {
+ //////////////////////////////////////////////////////////////////
+ // First, try direct hostname match - #110515#
+ //////////////////////////////////////////////////////////////////
+
+ if ( !shouldUseProxy( rHost, nPort, false ) )
+ return m_aEmptyProxy;
+
+ //////////////////////////////////////////////////////////////////
+ // Second, try match against full qualified hostname - #104401#
+ //////////////////////////////////////////////////////////////////
+
+ rtl::OUString aHost;
+
+ if ( ( rHost[ 0 ] == sal_Unicode( '[' ) ) &&
+ ( rHost.getLength() > 1 ) )
+ {
+ // host is given as numeric IPv6 address. name resolution
+ // functions need hostname without square brackets.
+ aHost = rHost.copy( 1, rHost.getLength() - 2 );
+ }
+ else
+ {
+ aHost = rHost;
+ }
+
+ rtl::OUString aFullyQualifiedHost;
+ if ( !m_aHostnames.get( aHost, aFullyQualifiedHost ) )
+ {
+ // This might be quite expensive (DNS lookup).
+ const osl::SocketAddr aAddr( aHost, nPort );
+ aFullyQualifiedHost = aAddr.getHostname().toAsciiLowerCase();
+ m_aHostnames.put( aHost, aFullyQualifiedHost );
+ }
+
+ // Error resolving name? -> fallback.
+ if ( !aFullyQualifiedHost.getLength() )
+ aFullyQualifiedHost = aHost;
+
+ if ( aFullyQualifiedHost != aHost )
+ {
+ if ( !shouldUseProxy( aFullyQualifiedHost, nPort, false ) )
+ return m_aEmptyProxy;
+ }
+
+ //////////////////////////////////////////////////////////////////
+ // Third, try match of fully qualified entries in no-proxy list
+ // against full qualified hostname
+ //
+ // Example:
+ // list: staroffice-doc -> full: xyz.germany.sun.com
+ // in: staroffice-doc.germany.sun.com -> full: xyz.germany.sun.com
+ //
+ //////////////////////////////////////////////////////////////////
+
+ if ( !shouldUseProxy( aFullyQualifiedHost, nPort, true ) )
+ return m_aEmptyProxy;
+ }
+
+ if ( rProtocol.toAsciiLowerCase()
+ .equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ftp" ) ) )
+ {
+ if ( m_aFtpProxy.aName.getLength() > 0 && m_aFtpProxy.nPort >= 0 )
+ return m_aFtpProxy;
+ }
+ else if ( m_aHttpProxy.aName.getLength() )
+ {
+ // All other protocols use the HTTP proxy.
+ return m_aHttpProxy;
+ }
+ return m_aEmptyProxy;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL InternetProxyDecider_Impl::changesOccurred(
+ const util::ChangesEvent& Event )
+ throw( uno::RuntimeException )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ sal_Int32 nCount = Event.Changes.getLength();
+ if ( nCount )
+ {
+ const util::ElementChange* pElementChanges
+ = Event.Changes.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const util::ElementChange& rElem = pElementChanges[ n ];
+ rtl::OUString aKey;
+ if ( ( rElem.Accessor >>= aKey ) && aKey.getLength() )
+ {
+ if ( aKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ PROXY_TYPE_KEY ) ) )
+ {
+ if ( !( rElem.Element >>= m_nProxyType ) )
+ {
+ OSL_ENSURE( sal_False,
+ "InternetProxyDecider - changesOccurred - "
+ "Error getting config item value!" );
+ }
+ }
+ else if ( aKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ NO_PROXY_LIST_KEY ) ) )
+ {
+ rtl::OUString aNoProxyList;
+ if ( !( rElem.Element >>= aNoProxyList ) )
+ {
+ OSL_ENSURE( sal_False,
+ "InternetProxyDecider - changesOccurred - "
+ "Error getting config item value!" );
+ }
+
+ setNoProxyList( aNoProxyList );
+ }
+ else if ( aKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ HTTP_PROXY_NAME_KEY ) ) )
+ {
+ if ( !( rElem.Element >>= m_aHttpProxy.aName ) )
+ {
+ OSL_ENSURE( sal_False,
+ "InternetProxyDecider - changesOccurred - "
+ "Error getting config item value!" );
+ }
+ }
+ else if ( aKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ HTTP_PROXY_PORT_KEY ) ) )
+ {
+ if ( !( rElem.Element >>= m_aHttpProxy.nPort ) )
+ {
+ OSL_ENSURE( sal_False,
+ "InternetProxyDecider - changesOccurred - "
+ "Error getting config item value!" );
+ }
+
+ if ( m_aHttpProxy.nPort == -1 )
+ m_aHttpProxy.nPort = 80; // standard HTTP port.
+ }
+ else if ( aKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ FTP_PROXY_NAME_KEY ) ) )
+ {
+ if ( !( rElem.Element >>= m_aFtpProxy.aName ) )
+ {
+ OSL_ENSURE( sal_False,
+ "InternetProxyDecider - changesOccurred - "
+ "Error getting config item value!" );
+ }
+ }
+ else if ( aKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ FTP_PROXY_PORT_KEY ) ) )
+ {
+ if ( !( rElem.Element >>= m_aFtpProxy.nPort ) )
+ {
+ OSL_ENSURE( sal_False,
+ "InternetProxyDecider - changesOccurred - "
+ "Error getting config item value!" );
+ }
+ }
+ }
+ }
+ }
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL InternetProxyDecider_Impl::disposing(const lang::EventObject&)
+ throw( uno::RuntimeException )
+{
+ if ( m_xNotifier.is() )
+ {
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ if ( m_xNotifier.is() )
+ m_xNotifier.clear();
+ }
+}
+
+//=========================================================================
+void InternetProxyDecider_Impl::setNoProxyList(
+ const rtl::OUString & rNoProxyList )
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ m_aNoProxyList.clear();
+
+ if ( rNoProxyList.getLength() )
+ {
+ // List of connection endpoints hostname[:port],
+ // separated by semicolon. Wilcards allowed.
+
+ sal_Int32 nPos = 0;
+ sal_Int32 nEnd = rNoProxyList.indexOf( ';' );
+ sal_Int32 nLen = rNoProxyList.getLength();
+
+ do
+ {
+ if ( nEnd == -1 )
+ nEnd = nLen;
+
+ rtl::OUString aToken = rNoProxyList.copy( nPos, nEnd - nPos );
+
+ if ( aToken.getLength() )
+ {
+ rtl::OUString aServer;
+ rtl::OUString aPort;
+
+ // numerical IPv6 address?
+ bool bIPv6Address = false;
+ sal_Int32 nClosedBracketPos = aToken.indexOf( ']' );
+ if ( nClosedBracketPos == -1 )
+ nClosedBracketPos = 0;
+ else
+ bIPv6Address = true;
+
+ sal_Int32 nColonPos = aToken.indexOf( ':', nClosedBracketPos );
+ if ( nColonPos == -1 )
+ {
+ // No port given, server pattern equals current token
+ aPort = rtl::OUString::createFromAscii( "*" );
+ if ( aToken.indexOf( '*' ) == -1 )
+ {
+ // pattern describes exactly one server
+ aServer = aToken;
+ }
+
+ aToken += rtl::OUString::createFromAscii( ":*" );
+ }
+ else
+ {
+ // Port given, extract server pattern
+ sal_Int32 nAsterixPos = aToken.indexOf( '*' );
+ aPort = aToken.copy( nColonPos + 1 );
+ if ( nAsterixPos < nColonPos )
+ {
+ // pattern describes exactly one server
+ aServer = aToken.copy( 0, nColonPos );
+ }
+ }
+
+ rtl::OUStringBuffer aFullyQualifiedHost;
+ if ( aServer.getLength() )
+ {
+ // Remember fully qualified server name if current list
+ // entry specifies exactly one non-fully qualified server
+ // name.
+
+ // remove square brackets from host name in case it's
+ // a numerical IPv6 address.
+ if ( bIPv6Address )
+ aServer = aServer.copy( 1, aServer.getLength() - 2 );
+
+ // This might be quite expensive (DNS lookup).
+ const osl::SocketAddr aAddr( aServer, 0 );
+ rtl::OUString aTmp = aAddr.getHostname().toAsciiLowerCase();
+ if ( aTmp != aServer.toAsciiLowerCase() )
+ {
+ if ( bIPv6Address )
+ {
+ aFullyQualifiedHost.appendAscii( "[" );
+ aFullyQualifiedHost.append( aTmp );
+ aFullyQualifiedHost.appendAscii( "]" );
+ }
+ else
+ {
+ aFullyQualifiedHost.append( aTmp );
+ }
+ aFullyQualifiedHost.appendAscii( ":" );
+ aFullyQualifiedHost.append( aPort );
+ }
+ }
+
+ m_aNoProxyList.push_back(
+ NoProxyListEntry( WildCard( aToken ),
+ WildCard(
+ aFullyQualifiedHost
+ .makeStringAndClear() ) ) );
+ }
+
+ if ( nEnd != nLen )
+ {
+ nPos = nEnd + 1;
+ nEnd = rNoProxyList.indexOf( ';', nPos );
+ }
+ }
+ while ( nEnd != nLen );
+ }
+}
+
+} // namespace proxydecider_impl
+
+//=========================================================================
+//=========================================================================
+//
+// InternetProxyDecider Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+InternetProxyDecider::InternetProxyDecider(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr )
+: m_pImpl( new proxydecider_impl::InternetProxyDecider_Impl( rxSMgr ) )
+{
+ m_pImpl->acquire();
+}
+
+//=========================================================================
+InternetProxyDecider::~InternetProxyDecider()
+{
+ // Break circular reference between config listener and notifier.
+ m_pImpl->dispose();
+
+ // Let him go...
+ m_pImpl->release();
+}
+
+//=========================================================================
+bool InternetProxyDecider::shouldUseProxy( const rtl::OUString & rProtocol,
+ const rtl::OUString & rHost,
+ sal_Int32 nPort ) const
+{
+ const InternetProxyServer & rData = m_pImpl->getProxy( rProtocol,
+ rHost,
+ nPort );
+ return ( rData.aName.getLength() > 0 );
+}
+
+//=========================================================================
+const InternetProxyServer & InternetProxyDecider::getProxy(
+ const rtl::OUString & rProtocol,
+ const rtl::OUString & rHost,
+ sal_Int32 nPort ) const
+{
+ return m_pImpl->getProxy( rProtocol, rHost, nPort );
+}
+
+} // namespace ucbhelper
diff --git a/ucbhelper/source/provider/cancelcommandexecution.cxx b/ucbhelper/source/provider/cancelcommandexecution.cxx
new file mode 100644
index 000000000000..35e9a5c2d5c0
--- /dev/null
+++ b/ucbhelper/source/provider/cancelcommandexecution.cxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: cancelcommandexecution.cxx,v $
+ * $Revision: 1.14 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+#include <osl/diagnose.h>
+#include <cppuhelper/exc_hlp.hxx>
+#include <com/sun/star/ucb/CommandFailedException.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#ifndef _UCBHELPER_INTERACTIONREQUEST_HXX
+#include <ucbhelper/interactionrequest.hxx>
+#endif
+#include <ucbhelper/cancelcommandexecution.hxx>
+#include <ucbhelper/simpleioerrorrequest.hxx>
+
+using namespace com::sun::star;
+
+namespace ucbhelper
+{
+
+//=========================================================================
+void cancelCommandExecution( const uno::Any & rException,
+ const uno::Reference<
+ ucb::XCommandEnvironment > & xEnv )
+ throw( uno::Exception )
+{
+ if ( xEnv.is() )
+ {
+ uno::Reference<
+ task::XInteractionHandler > xIH = xEnv->getInteractionHandler();
+ if ( xIH.is() )
+ {
+ rtl::Reference< ucbhelper::InteractionRequest > xRequest
+ = new ucbhelper::InteractionRequest( rException );
+
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > >
+ aContinuations( 1 );
+ aContinuations[ 0 ]
+ = new ucbhelper::InteractionAbort( xRequest.get() );
+
+ xRequest->setContinuations( aContinuations );
+
+ xIH->handle( xRequest.get() );
+
+ rtl::Reference< ucbhelper::InteractionContinuation > xSelection
+ = xRequest->getSelection();
+
+ if ( xSelection.is() )
+ throw ucb::CommandFailedException(
+ rtl::OUString(),
+ uno::Reference< uno::XInterface >(),
+ rException );
+ }
+ }
+
+ cppu::throwException( rException );
+
+ OSL_ENSURE( sal_False, "Return from cppu::throwException call!!!" );
+ throw uno::RuntimeException();
+}
+
+
+//=========================================================================
+void cancelCommandExecution( const ucb::IOErrorCode eError,
+ const uno::Sequence< uno::Any > & rArgs,
+ const uno::Reference<
+ ucb::XCommandEnvironment > & xEnv,
+ const rtl::OUString & rMessage,
+ const uno::Reference<
+ ucb::XCommandProcessor > & xContext )
+ throw( uno::Exception )
+{
+ rtl::Reference< ucbhelper::SimpleIOErrorRequest > xRequest
+ = new ucbhelper::SimpleIOErrorRequest(
+ eError, rArgs, rMessage, xContext );
+ if ( xEnv.is() )
+ {
+ uno::Reference<
+ task::XInteractionHandler > xIH = xEnv->getInteractionHandler();
+ if ( xIH.is() )
+ {
+ xIH->handle( xRequest.get() );
+
+ rtl::Reference< ucbhelper::InteractionContinuation > xSelection
+ = xRequest->getSelection();
+
+ if ( xSelection.is() )
+ throw ucb::CommandFailedException( rtl::OUString(),
+ xContext,
+ xRequest->getRequest() );
+ }
+ }
+
+ cppu::throwException( xRequest->getRequest() );
+
+ OSL_ENSURE( sal_False, "Return from cppu::throwException call!!!" );
+ throw uno::RuntimeException();
+}
+
+}
diff --git a/ucbhelper/source/provider/commandenvironmentproxy.cxx b/ucbhelper/source/provider/commandenvironmentproxy.cxx
new file mode 100644
index 000000000000..bfa89c6c673c
--- /dev/null
+++ b/ucbhelper/source/provider/commandenvironmentproxy.cxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: commandenvironmentproxy.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#include <osl/mutex.hxx>
+#include <ucbhelper/commandenvironmentproxy.hxx>
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::task;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+namespace ucbhelper
+{
+
+//=========================================================================
+//=========================================================================
+//
+// struct CommandEnvironmentProxy_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+struct CommandEnvironmentProxy_Impl
+{
+ osl::Mutex m_aMutex;
+ Reference< XCommandEnvironment > m_xEnv;
+ Reference< XInteractionHandler > m_xInteractionHandler;
+ Reference< XProgressHandler > m_xProgressHandler;
+ sal_Bool m_bGotInteractionHandler;
+ sal_Bool m_bGotProgressHandler;
+
+ CommandEnvironmentProxy_Impl(
+ const Reference< XCommandEnvironment >& rxEnv )
+ : m_xEnv( rxEnv ), m_bGotInteractionHandler( sal_False ),
+ m_bGotProgressHandler( sal_False ) {}
+};
+
+//=========================================================================
+//=========================================================================
+//
+// CommandEnvironmentProxy Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+CommandEnvironmentProxy::CommandEnvironmentProxy(
+ const Reference< XCommandEnvironment >& rxEnv )
+{
+ m_pImpl = new CommandEnvironmentProxy_Impl( rxEnv );
+}
+
+//=========================================================================
+// virtual
+CommandEnvironmentProxy::~CommandEnvironmentProxy()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( CommandEnvironmentProxy,
+ XTypeProvider,
+ XCommandEnvironment );
+
+//=========================================================================
+//
+// XTypeProvider methods
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( CommandEnvironmentProxy,
+ XTypeProvider,
+ XCommandEnvironment );
+
+//=========================================================================
+//
+// XCommandEnvironemnt methods.
+//
+//=========================================================================
+
+// virtual
+Reference< XInteractionHandler > SAL_CALL
+CommandEnvironmentProxy::getInteractionHandler()
+ throw ( RuntimeException )
+{
+ if ( m_pImpl->m_xEnv.is() )
+ {
+ if ( !m_pImpl->m_bGotInteractionHandler )
+ {
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ if ( !m_pImpl->m_bGotInteractionHandler )
+ {
+ m_pImpl->m_xInteractionHandler
+ = m_pImpl->m_xEnv->getInteractionHandler();
+ m_pImpl->m_bGotInteractionHandler = sal_True;
+ }
+ }
+ }
+ return m_pImpl->m_xInteractionHandler;
+}
+
+//=========================================================================
+// virtual
+Reference< XProgressHandler > SAL_CALL
+CommandEnvironmentProxy::getProgressHandler()
+ throw ( RuntimeException )
+{
+ if ( m_pImpl->m_xEnv.is() )
+ {
+ if ( !m_pImpl->m_bGotProgressHandler )
+ {
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ if ( !m_pImpl->m_bGotProgressHandler )
+ {
+ m_pImpl->m_xProgressHandler
+ = m_pImpl->m_xEnv->getProgressHandler();
+ m_pImpl->m_bGotProgressHandler = sal_True;
+ }
+ }
+ }
+ return m_pImpl->m_xProgressHandler;
+}
+
+} /* namespace ucbhelper */
+
diff --git a/ucbhelper/source/provider/configureucb.cxx b/ucbhelper/source/provider/configureucb.cxx
new file mode 100644
index 000000000000..71a695953284
--- /dev/null
+++ b/ucbhelper/source/provider/configureucb.cxx
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: configureucb.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+#include <ucbhelper/configureucb.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <rtl/ustrbuf.hxx>
+
+#include "osl/diagnose.h"
+
+#ifndef _UCBHELPER_PROVCONF_HXX_
+#include <provconf.hxx>
+#endif
+#include <registerucb.hxx>
+
+using namespace com::sun::star;
+
+namespace {
+
+bool fillPlaceholders(rtl::OUString const & rInput,
+ uno::Sequence< uno::Any > const & rReplacements,
+ rtl::OUString * pOutput)
+{
+ sal_Unicode const * p = rInput.getStr();
+ sal_Unicode const * pEnd = p + rInput.getLength();
+ sal_Unicode const * pCopy = p;
+ rtl::OUStringBuffer aBuffer;
+ while (p != pEnd)
+ switch (*p++)
+ {
+ case '&':
+ if (pEnd - p >= 4
+ && p[0] == 'a' && p[1] == 'm' && p[2] == 'p'
+ && p[3] == ';')
+ {
+ aBuffer.append(pCopy, p - 1 - pCopy);
+ aBuffer.append(sal_Unicode('&'));
+ p += 4;
+ pCopy = p;
+ }
+ else if (pEnd - p >= 3
+ && p[0] == 'l' && p[1] == 't' && p[2] == ';')
+ {
+ aBuffer.append(pCopy, p - 1 - pCopy);
+ aBuffer.append(sal_Unicode('<'));
+ p += 3;
+ pCopy = p;
+ }
+ else if (pEnd - p >= 3
+ && p[0] == 'g' && p[1] == 't' && p[2] == ';')
+ {
+ aBuffer.append(pCopy, p - 1 - pCopy);
+ aBuffer.append(sal_Unicode('>'));
+ p += 3;
+ pCopy = p;
+ }
+ break;
+
+ case '<':
+ sal_Unicode const * q = p;
+ while (q != pEnd && *q != '>')
+ ++q;
+ if (q == pEnd)
+ break;
+ rtl::OUString aKey(p, q - p);
+ rtl::OUString aValue;
+ bool bFound = false;
+ for (sal_Int32 i = 2; i + 1 < rReplacements.getLength();
+ i += 2)
+ {
+ rtl::OUString aReplaceKey;
+ if ((rReplacements[i] >>= aReplaceKey)
+ && aReplaceKey == aKey
+ && (rReplacements[i + 1] >>= aValue))
+ {
+ bFound = true;
+ break;
+ }
+ }
+ if (!bFound)
+ return false;
+ aBuffer.append(pCopy, p - 1 - pCopy);
+ aBuffer.append(aValue);
+ p = q + 1;
+ pCopy = p;
+ break;
+ }
+ aBuffer.append(pCopy, pEnd - pCopy);
+ *pOutput = aBuffer.makeStringAndClear();
+ return true;
+}
+
+}
+
+namespace ucbhelper {
+
+//============================================================================
+//
+// configureUcb
+//
+//============================================================================
+
+bool
+configureUcb(
+ uno::Reference< ucb::XContentProviderManager > const & rManager,
+ uno::Reference< lang::XMultiServiceFactory > const & rServiceFactory,
+ ContentProviderDataList const & rData,
+ ContentProviderRegistrationInfoList * pInfos)
+ throw (uno::RuntimeException)
+{
+ ContentProviderDataList::const_iterator aEnd(rData.end());
+ for (ContentProviderDataList::const_iterator aIt(rData.begin());
+ aIt != aEnd; ++aIt)
+ {
+ ContentProviderRegistrationInfo aInfo;
+ bool bSuccess = registerAtUcb(rManager,
+ rServiceFactory,
+ aIt->ServiceName,
+ aIt->Arguments,
+ aIt->URLTemplate,
+ &aInfo);
+
+ if (bSuccess && pInfos)
+ pInfos->push_back(aInfo);
+ }
+
+ return true;
+}
+
+//============================================================================
+//
+// configureUcb
+//
+//============================================================================
+
+bool
+configureUcb(
+ uno::Reference< ucb::XContentProviderManager > const & rManager,
+ uno::Reference< lang::XMultiServiceFactory > const & rServiceFactory,
+ uno::Sequence< uno::Any > const & rArguments,
+ std::vector< ContentProviderRegistrationInfo > * pInfos)
+ throw (uno::RuntimeException)
+{
+ rtl::OUString aKey1;
+ rtl::OUString aKey2;
+ if (rArguments.getLength() < 2
+ || !(rArguments[0] >>= aKey1) || !(rArguments[1] >>= aKey2))
+ {
+ OSL_ENSURE(false, "ucb::configureUcb(): Bad arguments");
+ return false;
+ }
+
+ ContentProviderDataList aData;
+ if (!getContentProviderData(rServiceFactory, aKey1, aKey2, aData))
+ {
+ OSL_ENSURE(false, "ucb::configureUcb(): No configuration");
+ return false;
+ }
+
+ ContentProviderDataList::const_iterator aEnd(aData.end());
+ for (ContentProviderDataList::const_iterator aIt(aData.begin());
+ aIt != aEnd; ++aIt)
+ {
+ rtl::OUString aProviderArguments;
+ if (fillPlaceholders(aIt->Arguments,
+ rArguments,
+ &aProviderArguments))
+ {
+ ContentProviderRegistrationInfo aInfo;
+ bool bSuccess = registerAtUcb(rManager,
+ rServiceFactory,
+ aIt->ServiceName,
+ aProviderArguments,
+ aIt->URLTemplate,
+ &aInfo);
+ OSL_ENSURE(bSuccess, "ucb::configureUcb(): Bad content provider");
+
+ if (bSuccess && pInfos)
+ pInfos->push_back(aInfo);
+ }
+ else
+ OSL_ENSURE(false,
+ "ucb::configureUcb(): Bad argument placeholders");
+ }
+
+ return true;
+}
+
+}
+
+//============================================================================
+//
+// unconfigureUcb
+//
+//============================================================================
+
+namespace ucbhelper {
+
+void
+unconfigureUcb(
+ uno::Reference< ucb::XContentProviderManager > const & rManager,
+ std::vector< ContentProviderRegistrationInfo > const & rInfos)
+ throw (uno::RuntimeException)
+{
+ std::vector< ContentProviderRegistrationInfo >::const_iterator
+ aEnd(rInfos.end());
+ for (std::vector< ContentProviderRegistrationInfo >::const_iterator
+ aIt(rInfos.begin());
+ aIt != aEnd; ++aIt)
+ deregisterFromUcb(rManager, *aIt);
+}
+
+}
diff --git a/ucbhelper/source/provider/contenthelper.cxx b/ucbhelper/source/provider/contenthelper.cxx
new file mode 100644
index 000000000000..70e91a5be642
--- /dev/null
+++ b/ucbhelper/source/provider/contenthelper.cxx
@@ -0,0 +1,1130 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: contenthelper.cxx,v $
+ * $Revision: 1.16 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#include <hash_map>
+#include <com/sun/star/ucb/ContentAction.hpp>
+#include <com/sun/star/ucb/CommandInfoChange.hpp>
+#include <com/sun/star/ucb/XPersistentPropertySet.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/PropertySetInfoChange.hpp>
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include "osl/diagnose.h"
+#include "osl/mutex.hxx"
+#include "rtl/ref.hxx"
+#include <ucbhelper/contentidentifier.hxx>
+#include <ucbhelper/contenthelper.hxx>
+#include <ucbhelper/providerhelper.hxx>
+#include <ucbhelper/contentinfo.hxx>
+
+using namespace com::sun::star;
+
+namespace ucbhelper_impl
+{
+
+//=========================================================================
+//
+// class PropertyEventSequence.
+//
+//=========================================================================
+
+class PropertyEventSequence
+{
+ uno::Sequence< beans::PropertyChangeEvent > m_aSeq;
+ sal_uInt32 m_nPos;
+
+public:
+ PropertyEventSequence( sal_uInt32 nSize )
+ : m_aSeq( nSize ), m_nPos( 0 ) {};
+
+ void append( const beans::PropertyChangeEvent& rEvt )
+ { m_aSeq.getArray()[ m_nPos ] = rEvt; ++m_nPos; }
+
+ const uno::Sequence< beans::PropertyChangeEvent >& getEvents()
+ { m_aSeq.realloc( m_nPos ); return m_aSeq; }
+};
+
+//=========================================================================
+//
+// PropertiesEventListenerMap.
+//
+//=========================================================================
+
+typedef void* XPropertiesChangeListenerPtr; // -> Compiler problems!
+
+struct equalPtr
+{
+ bool operator()( const XPropertiesChangeListenerPtr& rp1,
+ const XPropertiesChangeListenerPtr& rp2 ) const
+ {
+ return ( rp1 == rp2 );
+ }
+};
+
+struct hashPtr
+{
+ size_t operator()( const XPropertiesChangeListenerPtr& rp ) const
+ {
+ return (size_t)rp;
+ }
+};
+
+typedef std::hash_map
+<
+ XPropertiesChangeListenerPtr,
+ PropertyEventSequence*,
+ hashPtr,
+ equalPtr
+>
+PropertiesEventListenerMap;
+
+//=========================================================================
+//
+// PropertyChangeListenerContainer.
+//
+//=========================================================================
+
+struct equalStr
+{
+ bool operator()( const rtl::OUString& s1, const rtl::OUString& s2 ) const
+ {
+ return !!( s1 == s2 );
+ }
+};
+
+struct hashStr
+{
+ size_t operator()( const rtl::OUString& rName ) const
+ {
+ return rName.hashCode();
+ }
+};
+
+typedef cppu::OMultiTypeInterfaceContainerHelperVar
+<
+ rtl::OUString,
+ hashStr,
+ equalStr
+> PropertyChangeListeners;
+
+//=========================================================================
+//
+// struct ContentImplHelper_Impl
+//
+//=========================================================================
+
+struct ContentImplHelper_Impl
+{
+ rtl::Reference< ::ucbhelper::PropertySetInfo > m_xPropSetInfo;
+ rtl::Reference< ::ucbhelper::CommandProcessorInfo > m_xCommandsInfo;
+ cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
+ cppu::OInterfaceContainerHelper* m_pContentEventListeners;
+ cppu::OInterfaceContainerHelper* m_pPropSetChangeListeners;
+ cppu::OInterfaceContainerHelper* m_pCommandChangeListeners;
+ PropertyChangeListeners* m_pPropertyChangeListeners;
+
+ ContentImplHelper_Impl()
+ : m_pDisposeEventListeners( 0 ),
+ m_pContentEventListeners( 0 ),
+ m_pPropSetChangeListeners( 0 ),
+ m_pCommandChangeListeners( 0 ),
+ m_pPropertyChangeListeners( 0 ) {}
+
+ ~ContentImplHelper_Impl()
+ {
+ delete m_pDisposeEventListeners;
+ delete m_pContentEventListeners;
+ delete m_pPropSetChangeListeners;
+ delete m_pCommandChangeListeners;
+ delete m_pPropertyChangeListeners;
+ }
+};
+
+} // namespace ucbhelper_impl
+
+using namespace ucbhelper_impl;
+
+//=========================================================================
+//=========================================================================
+//
+// ContentImplHelper Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+namespace ucbhelper {
+
+ContentImplHelper::ContentImplHelper(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ const rtl::Reference< ContentProviderImplHelper >& rxProvider,
+ const uno::Reference<
+ com::sun::star::ucb::XContentIdentifier >& Identifier )
+: m_pImpl( new ContentImplHelper_Impl ),
+ m_xSMgr( rxSMgr ),
+ m_xIdentifier( Identifier ),
+ m_xProvider( rxProvider ),
+ m_nCommandId( 0 )
+{
+}
+
+//=========================================================================
+// virtual
+ContentImplHelper::~ContentImplHelper()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+void SAL_CALL ContentImplHelper::acquire()
+ throw()
+{
+ cppu::OWeakObject::acquire();
+}
+
+void SAL_CALL ContentImplHelper::release()
+ throw()
+{
+ // #144882# - Call to OWeakObject::release may destroy m_xProvider.
+ // Prevent this.
+ rtl::Reference< ContentProviderImplHelper > xKeepProviderAlive(
+ m_xProvider );
+
+ {
+ osl::MutexGuard aGuard( m_xProvider->m_aMutex );
+ OWeakObject::release();
+ }
+}
+
+uno::Any SAL_CALL ContentImplHelper::queryInterface( const uno::Type & rType )
+ throw( uno::RuntimeException )
+{
+ com::sun::star::uno::Any aRet = cppu::queryInterface( rType,
+ static_cast< lang::XTypeProvider * >(this),
+ static_cast< lang::XServiceInfo * >(this),
+ static_cast< lang::XComponent * >(this),
+ static_cast< com::sun::star::ucb::XContent * >(this),
+ static_cast< com::sun::star::ucb::XCommandProcessor * >(this),
+ static_cast< beans::XPropertiesChangeNotifier * >(this),
+ static_cast< com::sun::star::ucb::XCommandInfoChangeNotifier * >(this),
+ static_cast< beans::XPropertyContainer * >(this),
+ static_cast< beans::XPropertySetInfoChangeNotifier * >(this),
+ static_cast< container::XChild * >(this));
+ return aRet.hasValue() ? aRet : cppu::OWeakObject::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_10( ContentImplHelper,
+ lang::XTypeProvider,
+ lang::XServiceInfo,
+ lang::XComponent,
+ com::sun::star::ucb::XContent,
+ com::sun::star::ucb::XCommandProcessor,
+ beans::XPropertiesChangeNotifier,
+ com::sun::star::ucb::XCommandInfoChangeNotifier,
+ beans::XPropertyContainer,
+ beans::XPropertySetInfoChangeNotifier,
+ container::XChild );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL ContentImplHelper::supportsService(
+ const rtl::OUString& ServiceName )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aSNL = getSupportedServiceNames();
+ const rtl::OUString* pArray = aSNL.getConstArray();
+ for ( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ {
+ if ( pArray[ i ] == ServiceName )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//=========================================================================
+//
+// XComponent methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::dispose()
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pDisposeEventListeners &&
+ m_pImpl->m_pDisposeEventListeners->getLength() )
+ {
+ lang::EventObject aEvt;
+ aEvt.Source = static_cast< lang::XComponent * >( this );
+ m_pImpl->m_pDisposeEventListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pContentEventListeners &&
+ m_pImpl->m_pContentEventListeners->getLength() )
+ {
+ lang::EventObject aEvt;
+ aEvt.Source = static_cast< com::sun::star::ucb::XContent * >( this );
+ m_pImpl->m_pContentEventListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pPropSetChangeListeners &&
+ m_pImpl->m_pPropSetChangeListeners->getLength() )
+ {
+ lang::EventObject aEvt;
+ aEvt.Source
+ = static_cast< beans::XPropertySetInfoChangeNotifier * >( this );
+ m_pImpl->m_pPropSetChangeListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pCommandChangeListeners &&
+ m_pImpl->m_pCommandChangeListeners->getLength() )
+ {
+ lang::EventObject aEvt;
+ aEvt.Source = static_cast< com::sun::star::ucb::XCommandInfoChangeNotifier * >( this );
+ m_pImpl->m_pCommandChangeListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pPropertyChangeListeners )
+ {
+ lang::EventObject aEvt;
+ aEvt.Source
+ = static_cast< beans::XPropertiesChangeNotifier * >( this );
+ m_pImpl->m_pPropertyChangeListeners->disposeAndClear( aEvt );
+ }
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::addEventListener(
+ const uno::Reference< lang::XEventListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pDisposeEventListeners )
+ m_pImpl->m_pDisposeEventListeners
+ = new cppu::OInterfaceContainerHelper( m_aMutex );
+
+ m_pImpl->m_pDisposeEventListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removeEventListener(
+ const uno::Reference< lang::XEventListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pDisposeEventListeners )
+ m_pImpl->m_pDisposeEventListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XContent methods.
+//
+//=========================================================================
+
+// virtual
+uno::Reference< com::sun::star::ucb::XContentIdentifier > SAL_CALL
+ContentImplHelper::getIdentifier()
+ throw( uno::RuntimeException )
+{
+ return m_xIdentifier;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::addContentEventListener(
+ const uno::Reference< com::sun::star::ucb::XContentEventListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pContentEventListeners )
+ m_pImpl->m_pContentEventListeners
+ = new cppu::OInterfaceContainerHelper( m_aMutex );
+
+ m_pImpl->m_pContentEventListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removeContentEventListener(
+ const uno::Reference< com::sun::star::ucb::XContentEventListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pContentEventListeners )
+ m_pImpl->m_pContentEventListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XCommandProcessor methods.
+//
+//=========================================================================
+
+// virtual
+sal_Int32 SAL_CALL ContentImplHelper::createCommandIdentifier()
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ // Just increase counter on every call to generate an identifier.
+ return ++m_nCommandId;
+}
+
+//=========================================================================
+//
+// XPropertiesChangeNotifier methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::addPropertiesChangeListener(
+ const uno::Sequence< rtl::OUString >& PropertyNames,
+ const uno::Reference< beans::XPropertiesChangeListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ m_pImpl->m_pPropertyChangeListeners
+ = new PropertyChangeListeners( m_aMutex );
+
+ sal_Int32 nCount = PropertyNames.getLength();
+ if ( !nCount )
+ {
+ // Note: An empty sequence means a listener for "all" properties.
+ m_pImpl->m_pPropertyChangeListeners->addInterface(
+ rtl::OUString(), Listener );
+ }
+ else
+ {
+ const rtl::OUString* pSeq = PropertyNames.getConstArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const rtl::OUString& rName = pSeq[ n ];
+ if ( rName.getLength() )
+ m_pImpl->m_pPropertyChangeListeners->addInterface(
+ rName, Listener );
+ }
+ }
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removePropertiesChangeListener(
+ const uno::Sequence< rtl::OUString >& PropertyNames,
+ const uno::Reference< beans::XPropertiesChangeListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ sal_Int32 nCount = PropertyNames.getLength();
+ if ( !nCount )
+ {
+ // Note: An empty sequence means a listener for "all" properties.
+ m_pImpl->m_pPropertyChangeListeners->removeInterface(
+ rtl::OUString(), Listener );
+ }
+ else
+ {
+ const rtl::OUString* pSeq = PropertyNames.getConstArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const rtl::OUString& rName = pSeq[ n ];
+ if ( rName.getLength() )
+ m_pImpl->m_pPropertyChangeListeners->removeInterface(
+ rName, Listener );
+ }
+ }
+}
+
+//=========================================================================
+//
+// XCommandInfoChangeNotifier methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::addCommandInfoChangeListener(
+ const uno::Reference< com::sun::star::ucb::XCommandInfoChangeListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pCommandChangeListeners )
+ m_pImpl->m_pCommandChangeListeners
+ = new cppu::OInterfaceContainerHelper( m_aMutex );
+
+ m_pImpl->m_pCommandChangeListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removeCommandInfoChangeListener(
+ const uno::Reference< com::sun::star::ucb::XCommandInfoChangeListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pCommandChangeListeners )
+ m_pImpl->m_pCommandChangeListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XPropertyContainer methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::addProperty(
+ const rtl::OUString& Name,
+ sal_Int16 Attributes,
+ const uno::Any& DefaultValue )
+ throw( beans::PropertyExistException,
+ beans::IllegalTypeException,
+ lang::IllegalArgumentException,
+ uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ //////////////////////////////////////////////////////////////////////
+ // Make sure a property with the requested name does not already
+ // exist in dynamic and static(!) properties.
+ //////////////////////////////////////////////////////////////////////
+
+ // @@@ Need real command environment here, but where to get it from?
+ // XPropertyContainer interface should be replaced by
+ // XCommandProcessor commands!
+ uno::Reference< com::sun::star::ucb::XCommandEnvironment > xEnv;
+
+ if ( getPropertySetInfo( xEnv )->hasPropertyByName( Name ) )
+ {
+ // Property does already exist.
+ throw beans::PropertyExistException();
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Add a new dynamic property.
+ //////////////////////////////////////////////////////////////////////
+
+ // Open/create persistent property set.
+ uno::Reference< com::sun::star::ucb::XPersistentPropertySet > xSet(
+ getAdditionalPropertySet( sal_True ) );
+
+ OSL_ENSURE( xSet.is(),
+ "ContentImplHelper::addProperty - No property set!" );
+
+ if ( xSet.is() )
+ {
+ uno::Reference< beans::XPropertyContainer > xContainer(
+ xSet, uno::UNO_QUERY );
+
+ OSL_ENSURE(
+ xContainer.is(),
+ "ContentImplHelper::addProperty - No property container!" );
+
+ if ( xContainer.is() )
+ {
+ // Property is always removeable.
+ Attributes |= beans::PropertyAttribute::REMOVEABLE;
+
+ try
+ {
+ xContainer->addProperty( Name, Attributes, DefaultValue );
+ }
+ catch ( beans::PropertyExistException const & )
+ {
+ OSL_ENSURE( sal_False,
+ "ContentImplHelper::addProperty - Exists!" );
+ throw;
+ }
+ catch ( beans::IllegalTypeException const & )
+ {
+ OSL_ENSURE( sal_False,
+ "ContentImplHelper::addProperty - Wrong Type!" );
+ throw;
+ }
+ catch ( lang::IllegalArgumentException const & )
+ {
+ OSL_ENSURE( sal_False,
+ "ContentImplHelper::addProperty - Illegal Arg!" );
+ throw;
+ }
+
+ // Success!
+
+ if ( m_pImpl->m_xPropSetInfo.is() )
+ {
+ // Info cached in propertyset info is invalid now!
+ m_pImpl->m_xPropSetInfo->reset();
+ }
+
+ // Notify propertyset info change listeners.
+ if ( m_pImpl->m_pPropSetChangeListeners &&
+ m_pImpl->m_pPropSetChangeListeners->getLength() )
+ {
+ beans::PropertySetInfoChangeEvent evt(
+ static_cast< cppu::OWeakObject * >( this ),
+ Name,
+ -1, // No handle available
+ beans::PropertySetInfoChange::PROPERTY_INSERTED );
+ notifyPropertySetInfoChange( evt );
+ }
+ }
+ }
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removeProperty( const rtl::OUString& Name )
+ throw( beans::UnknownPropertyException,
+ beans::NotRemoveableException,
+ uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ try
+ {
+ // @@@ Need real command environment here, but where to get it from?
+ // XPropertyContainer interface should be replaced by
+ // XCommandProcessor commands!
+ uno::Reference< com::sun::star::ucb::XCommandEnvironment > xEnv;
+
+ beans::Property aProp
+ = getPropertySetInfo( xEnv )->getPropertyByName( Name );
+
+ if ( !( aProp.Attributes & beans::PropertyAttribute::REMOVEABLE ) )
+ {
+ // Not removeable!
+ throw beans::NotRemoveableException();
+ }
+ }
+ catch ( beans::UnknownPropertyException const & )
+ {
+ OSL_ENSURE( sal_False, "ContentImplHelper::removeProperty - Unknown!" );
+ throw;
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Try to remove property from dynamic property set.
+ //////////////////////////////////////////////////////////////////////
+
+ // Open persistent property set, if exists.
+ uno::Reference< com::sun::star::ucb::XPersistentPropertySet > xSet(
+ getAdditionalPropertySet( sal_False ) );
+ if ( xSet.is() )
+ {
+ uno::Reference< beans::XPropertyContainer > xContainer(
+ xSet, uno::UNO_QUERY );
+
+ OSL_ENSURE(
+ xContainer.is(),
+ "ContentImplHelper::removeProperty - No property container!" );
+
+ if ( xContainer.is() )
+ {
+ try
+ {
+ xContainer->removeProperty( Name );
+ }
+ catch ( beans::UnknownPropertyException const & )
+ {
+ OSL_ENSURE( sal_False,
+ "ContentImplHelper::removeProperty - Unknown!" );
+ throw;
+ }
+ catch ( beans::NotRemoveableException const & )
+ {
+ OSL_ENSURE(
+ sal_False,
+ "ContentImplHelper::removeProperty - Unremoveable!" );
+ throw;
+ }
+
+ xContainer = 0;
+
+ // Success!
+
+ if ( xSet->getPropertySetInfo()->getProperties().getLength() == 0 )
+ {
+ // Remove empty propertyset from registry.
+ uno::Reference< com::sun::star::ucb::XPropertySetRegistry >
+ xReg = xSet->getRegistry();
+ if ( xReg.is() )
+ {
+ rtl::OUString aKey( xSet->getKey() );
+ xSet = 0;
+ xReg->removePropertySet( aKey );
+ }
+ }
+
+ if ( m_pImpl->m_xPropSetInfo.is() )
+ {
+ // Info cached in propertyset info is invalid now!
+ m_pImpl->m_xPropSetInfo->reset();
+ }
+
+ // Notify propertyset info change listeners.
+ if ( m_pImpl->m_pPropSetChangeListeners &&
+ m_pImpl->m_pPropSetChangeListeners->getLength() )
+ {
+ beans::PropertySetInfoChangeEvent evt(
+ static_cast< cppu::OWeakObject * >( this ),
+ Name,
+ -1, // No handle available
+ beans::PropertySetInfoChange::PROPERTY_REMOVED );
+ notifyPropertySetInfoChange( evt );
+ }
+ }
+ }
+}
+
+//=========================================================================
+//
+// XPropertySetInfoChangeNotifier methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ContentImplHelper::addPropertySetInfoChangeListener(
+ const uno::Reference< beans::XPropertySetInfoChangeListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_pPropSetChangeListeners )
+ m_pImpl->m_pPropSetChangeListeners
+ = new cppu::OInterfaceContainerHelper( m_aMutex );
+
+ m_pImpl->m_pPropSetChangeListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::removePropertySetInfoChangeListener(
+ const uno::Reference< beans::XPropertySetInfoChangeListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pImpl->m_pPropSetChangeListeners )
+ m_pImpl->m_pPropSetChangeListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XChild methods.
+//
+//=========================================================================
+
+// virtual
+uno::Reference< uno::XInterface > SAL_CALL ContentImplHelper::getParent()
+ throw( uno::RuntimeException )
+{
+ uno::Reference< uno::XInterface > xParent;
+ rtl::OUString aURL = getParentURL();
+
+ if ( aURL.getLength() )
+ {
+ uno::Reference< com::sun::star::ucb::XContentIdentifier > xId(
+ new ContentIdentifier( m_xSMgr, aURL ) );
+ try
+ {
+ xParent.set( m_xProvider->queryContent( xId ) );
+ }
+ catch ( com::sun::star::ucb::IllegalIdentifierException const & )
+ {
+ }
+ }
+
+ return xParent;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentImplHelper::setParent(
+ const uno::Reference< uno::XInterface >& )
+ throw( lang::NoSupportException, uno::RuntimeException )
+{
+ throw lang::NoSupportException();
+}
+
+//=========================================================================
+//
+// Non-interface methods
+//
+//=========================================================================
+
+uno::Reference< com::sun::star::ucb::XPersistentPropertySet >
+ContentImplHelper::getAdditionalPropertySet( sal_Bool bCreate )
+{
+ // Get propertyset from provider.
+ return m_xProvider->getAdditionalPropertySet(
+ m_xIdentifier->getContentIdentifier(), bCreate );
+}
+
+//=========================================================================
+sal_Bool ContentImplHelper::renameAdditionalPropertySet(
+ const rtl::OUString& rOldKey,
+ const rtl::OUString& rNewKey,
+ sal_Bool bRecursive )
+{
+ return m_xProvider->renameAdditionalPropertySet(
+ rOldKey, rNewKey, bRecursive );
+}
+
+//=========================================================================
+sal_Bool ContentImplHelper::copyAdditionalPropertySet(
+ const rtl::OUString& rSourceKey,
+ const rtl::OUString& rTargetKey,
+ sal_Bool bRecursive )
+{
+ return m_xProvider->copyAdditionalPropertySet(
+ rSourceKey, rTargetKey, bRecursive );
+}
+
+//=========================================================================
+sal_Bool ContentImplHelper::removeAdditionalPropertySet( sal_Bool bRecursive )
+{
+ return m_xProvider->removeAdditionalPropertySet(
+ m_xIdentifier->getContentIdentifier(), bRecursive );
+}
+
+//=========================================================================
+void ContentImplHelper::notifyPropertiesChange(
+ const uno::Sequence< beans::PropertyChangeEvent >& evt ) const
+{
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ sal_Int32 nCount = evt.getLength();
+ if ( nCount )
+ {
+ // First, notify listeners interested in changes of every property.
+ cppu::OInterfaceContainerHelper* pAllPropsContainer
+ = m_pImpl->m_pPropertyChangeListeners->getContainer(
+ rtl::OUString() );
+ if ( pAllPropsContainer )
+ {
+ cppu::OInterfaceIteratorHelper aIter( *pAllPropsContainer );
+ while ( aIter.hasMoreElements() )
+ {
+ // Propagate event.
+ uno::Reference< beans::XPropertiesChangeListener > xListener(
+ aIter.next(), uno::UNO_QUERY );
+ if ( xListener.is() )
+ xListener->propertiesChange( evt );
+ }
+ }
+
+ PropertiesEventListenerMap aListeners;
+
+ const beans::PropertyChangeEvent* pEvents = evt.getConstArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const beans::PropertyChangeEvent& rEvent = pEvents[ n ];
+ const rtl::OUString& rName = rEvent.PropertyName;
+
+ cppu::OInterfaceContainerHelper* pPropsContainer
+ = m_pImpl->m_pPropertyChangeListeners->getContainer( rName );
+ if ( pPropsContainer )
+ {
+ cppu::OInterfaceIteratorHelper aIter( *pPropsContainer );
+ while ( aIter.hasMoreElements() )
+ {
+ PropertyEventSequence* p = NULL;
+
+ beans::XPropertiesChangeListener* pListener =
+ static_cast< beans::XPropertiesChangeListener * >(
+ aIter.next() );
+ PropertiesEventListenerMap::iterator it =
+ aListeners.find( pListener );
+ if ( it == aListeners.end() )
+ {
+ // Not in map - create and insert new entry.
+ p = new PropertyEventSequence( nCount );
+ aListeners[ pListener ] = p;
+ }
+ else
+ p = (*it).second;
+
+ if ( p )
+ p->append( rEvent );
+ }
+ }
+ }
+
+ // Notify listeners.
+ PropertiesEventListenerMap::iterator it = aListeners.begin();
+ while ( !aListeners.empty() )
+ {
+ beans::XPropertiesChangeListener* pListener =
+ static_cast< beans::XPropertiesChangeListener * >( (*it).first );
+ PropertyEventSequence* pSeq = (*it).second;
+
+ // Remove current element.
+ aListeners.erase( it );
+
+ // Propagate event.
+ pListener->propertiesChange( pSeq->getEvents() );
+
+ delete pSeq;
+
+ it = aListeners.begin();
+ }
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::notifyPropertySetInfoChange(
+ const beans::PropertySetInfoChangeEvent& evt ) const
+{
+ if ( !m_pImpl->m_pPropSetChangeListeners )
+ return;
+
+ // Notify event listeners.
+ cppu::OInterfaceIteratorHelper aIter( *m_pImpl->m_pPropSetChangeListeners );
+ while ( aIter.hasMoreElements() )
+ {
+ // Propagate event.
+ uno::Reference< beans::XPropertySetInfoChangeListener >
+ xListener( aIter.next(), uno::UNO_QUERY );
+ if ( xListener.is() )
+ xListener->propertySetInfoChange( evt );
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::notifyCommandInfoChange(
+ const com::sun::star::ucb::CommandInfoChangeEvent& evt ) const
+{
+ if ( !m_pImpl->m_pCommandChangeListeners )
+ return;
+
+ // Notify event listeners.
+ cppu::OInterfaceIteratorHelper aIter(
+ *m_pImpl->m_pCommandChangeListeners );
+ while ( aIter.hasMoreElements() )
+ {
+ // Propagate event.
+ uno::Reference< com::sun::star::ucb::XCommandInfoChangeListener >
+ xListener( aIter.next(), uno::UNO_QUERY );
+ if ( xListener.is() )
+ xListener->commandInfoChange( evt );
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::notifyContentEvent(
+ const com::sun::star::ucb::ContentEvent& evt ) const
+{
+ if ( !m_pImpl->m_pContentEventListeners )
+ return;
+
+ // Notify event listeners.
+ cppu::OInterfaceIteratorHelper aIter( *m_pImpl->m_pContentEventListeners );
+ while ( aIter.hasMoreElements() )
+ {
+ // Propagate event.
+ uno::Reference<
+ com::sun::star::ucb::XContentEventListener > xListener(
+ aIter.next(), uno::UNO_QUERY );
+ if ( xListener.is() )
+ xListener->contentEvent( evt );
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::inserted()
+{
+ // Content is not yet registered at provider.
+ m_xProvider->registerNewContent( this );
+
+ // If the parent content is currently not instanciated, there can be
+ // no listeners interested in changes ;-)
+
+ rtl::Reference< ContentImplHelper > xParent
+ = m_xProvider->queryExistingContent( getParentURL() );
+
+ if ( xParent.is() )
+ {
+ com::sun::star::ucb::ContentEvent aEvt(
+ static_cast< cppu::OWeakObject * >( xParent.get() ), // Source
+ com::sun::star::ucb::ContentAction::INSERTED, // Action
+ this, // Content
+ xParent->getIdentifier() ); // Id
+ xParent->notifyContentEvent( aEvt );
+ }
+}
+
+//=========================================================================
+void ContentImplHelper::deleted()
+{
+ uno::Reference< com::sun::star::ucb::XContent > xThis = this;
+
+ rtl::Reference< ContentImplHelper > xParent
+ = m_xProvider->queryExistingContent( getParentURL() );
+
+ if ( xParent.is() )
+ {
+ // Let parent notify "REMOVED" event.
+ com::sun::star::ucb::ContentEvent aEvt(
+ static_cast< cppu::OWeakObject * >( xParent.get() ),
+ com::sun::star::ucb::ContentAction::REMOVED,
+ this,
+ xParent->getIdentifier() );
+ xParent->notifyContentEvent( aEvt );
+ }
+
+ // Notify "DELETED" event.
+ com::sun::star::ucb::ContentEvent aEvt1(
+ static_cast< cppu::OWeakObject * >( this ),
+ com::sun::star::ucb::ContentAction::DELETED,
+ this,
+ getIdentifier() );
+ notifyContentEvent( aEvt1 );
+
+ m_xProvider->removeContent( this );
+}
+
+//=========================================================================
+sal_Bool ContentImplHelper::exchange(
+ const uno::Reference< com::sun::star::ucb::XContentIdentifier >& rNewId )
+{
+ uno::Reference< com::sun::star::ucb::XContent > xThis = this;
+
+ osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ rtl::Reference< ContentImplHelper > xContent
+ = m_xProvider->queryExistingContent( rNewId );
+ if ( xContent.is() )
+ {
+ // @@@
+ // Big trouble. Another object with the new identity exists.
+ // How shall I mutate to / merge with the other object?
+ return sal_False;
+ }
+
+ uno::Reference< com::sun::star::ucb::XContentIdentifier > xOldId
+ = getIdentifier();
+
+ // Re-insert at provider.
+ m_xProvider->removeContent( this );
+ m_xIdentifier = rNewId;
+ m_xProvider->registerNewContent( this );
+
+ aGuard.clear();
+
+ // Notify "EXCHANGED" event.
+ com::sun::star::ucb::ContentEvent aEvt(
+ static_cast< cppu::OWeakObject * >( this ),
+ com::sun::star::ucb::ContentAction::EXCHANGED,
+ this,
+ xOldId );
+ notifyContentEvent( aEvt );
+ return sal_True;
+}
+
+//=========================================================================
+uno::Reference< com::sun::star::ucb::XCommandInfo >
+ContentImplHelper::getCommandInfo(
+ const uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv,
+ sal_Bool bCache )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_xCommandsInfo.is() )
+ m_pImpl->m_xCommandsInfo
+ = new CommandProcessorInfo( m_xSMgr, xEnv, this );
+ else if ( !bCache )
+ m_pImpl->m_xCommandsInfo->reset();
+
+ return uno::Reference< com::sun::star::ucb::XCommandInfo >(
+ m_pImpl->m_xCommandsInfo.get() );
+}
+
+//=========================================================================
+uno::Reference< beans::XPropertySetInfo >
+ContentImplHelper::getPropertySetInfo(
+ const uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv,
+ sal_Bool bCache )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_xPropSetInfo.is() )
+ m_pImpl->m_xPropSetInfo
+ = new PropertySetInfo( m_xSMgr, xEnv, this );
+ else if ( !bCache )
+ m_pImpl->m_xPropSetInfo->reset();
+
+ return uno::Reference< beans::XPropertySetInfo >(
+ m_pImpl->m_xPropSetInfo.get() );
+}
+
+} // namespace ucbhelper
diff --git a/ucbhelper/source/provider/contentidentifier.cxx b/ucbhelper/source/provider/contentidentifier.cxx
new file mode 100644
index 000000000000..b3aa2a2f81ae
--- /dev/null
+++ b/ucbhelper/source/provider/contentidentifier.cxx
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: contentidentifier.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <ucbhelper/contentidentifier.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <osl/mutex.hxx>
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::ucb;
+
+namespace ucbhelper
+{
+
+//=========================================================================
+//=========================================================================
+//
+// struct ContentIdentifier_Impl.
+//
+//=========================================================================
+//=========================================================================
+
+struct ContentIdentifier_Impl
+{
+ Reference< XMultiServiceFactory > m_xSMgr;
+ OUString m_aContentId;
+ OUString m_aProviderScheme;
+ osl::Mutex m_aMutex;
+
+ ContentIdentifier_Impl( const Reference< XMultiServiceFactory >& rSMgr,
+ const OUString& rURL );
+};
+
+//=========================================================================
+//
+// ContentIdentifier_Impl Implementation.
+//
+//=========================================================================
+
+ContentIdentifier_Impl::ContentIdentifier_Impl(
+ const Reference< XMultiServiceFactory >& rSMgr,
+ const OUString& rURL )
+: m_xSMgr( rSMgr )
+{
+ // Normalize URL scheme ( it's case insensitive ).
+
+ // The content provider scheme is the part before the first ':'
+ // within the content id.
+ sal_Int32 nPos = rURL.indexOf( ':', 0 );
+ if ( nPos != -1 )
+ {
+ OUString aScheme( rURL.copy( 0, nPos ) );
+ m_aProviderScheme = aScheme.toAsciiLowerCase();
+ m_aContentId = rURL.replaceAt( 0, nPos, aScheme );
+ }
+}
+
+//=========================================================================
+//
+// ContentIdentifier Implementation.
+//
+//=========================================================================
+
+ContentIdentifier::ContentIdentifier(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const OUString& rURL )
+{
+ m_pImpl = new ContentIdentifier_Impl( rxSMgr, rURL );
+}
+
+//=========================================================================
+ContentIdentifier::ContentIdentifier( const OUString& rURL )
+{
+ m_pImpl = new ContentIdentifier_Impl(
+ Reference< XMultiServiceFactory >(), rURL );
+}
+
+//=========================================================================
+// virtual
+ContentIdentifier::~ContentIdentifier()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentIdentifier::acquire() throw()
+{
+ OWeakObject::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ContentIdentifier::release() throw()
+{
+ OWeakObject::release();
+}
+
+//=========================================================================
+// virtual
+Any SAL_CALL
+ContentIdentifier::queryInterface( const Type & rType )
+ throw ( RuntimeException )
+{
+ Any aRet = cppu::queryInterface( rType,
+ static_cast< XTypeProvider * >( this ),
+ static_cast< XContentIdentifier * >( this ) );
+
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// virtual
+Sequence< sal_Int8 > SAL_CALL
+ContentIdentifier::getImplementationId()
+ throw( RuntimeException )
+{
+ static cppu::OImplementationId* pId = NULL;
+ if ( !pId )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static cppu::OImplementationId id( sal_False );
+ pId = &id;
+ }
+ }
+ return (*pId).getImplementationId();
+}
+
+//=========================================================================
+// virtual
+Sequence< com::sun::star::uno::Type > SAL_CALL
+ContentIdentifier::getTypes()
+ throw( RuntimeException )
+{
+ static cppu::OTypeCollection* pCollection = NULL;
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static cppu::OTypeCollection collection(
+ getCppuType( static_cast<
+ Reference < XTypeProvider > * >( 0 ) ),
+ getCppuType( static_cast<
+ Reference< XContentIdentifier > * >( 0 ) ) );
+ pCollection = &collection;
+ }
+ }
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XContentIdentifier methods.
+//
+//=========================================================================
+
+// virtual
+OUString SAL_CALL ContentIdentifier::getContentIdentifier()
+ throw( RuntimeException )
+{
+ return m_pImpl->m_aContentId;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ContentIdentifier::getContentProviderScheme()
+ throw( RuntimeException )
+{
+ return m_pImpl->m_aProviderScheme;
+}
+
+} /* namespace ucbhelper */
+
diff --git a/ucbhelper/source/provider/contentinfo.cxx b/ucbhelper/source/provider/contentinfo.cxx
new file mode 100644
index 000000000000..9aef5081550b
--- /dev/null
+++ b/ucbhelper/source/provider/contentinfo.cxx
@@ -0,0 +1,426 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: contentinfo.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/ucb/XPropertySetRegistry.hpp>
+
+#include "osl/diagnose.h"
+#include "osl/mutex.hxx"
+#include <ucbhelper/contenthelper.hxx>
+#include <ucbhelper/contentinfo.hxx>
+
+using namespace com::sun::star;
+
+//=========================================================================
+//=========================================================================
+//
+// PropertySetInfo Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+namespace ucbhelper {
+
+PropertySetInfo::PropertySetInfo(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ const uno::Reference< com::sun::star::ucb::XCommandEnvironment >& rxEnv,
+ ContentImplHelper* pContent )
+: m_xSMgr( rxSMgr ),
+ m_xEnv( rxEnv ),
+ m_pProps( 0 ),
+ m_pContent( pContent )
+{
+}
+
+//=========================================================================
+// virtual
+PropertySetInfo::~PropertySetInfo()
+{
+ delete m_pProps;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( PropertySetInfo,
+ lang::XTypeProvider,
+ beans::XPropertySetInfo );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( PropertySetInfo,
+ lang::XTypeProvider,
+ beans::XPropertySetInfo );
+
+//=========================================================================
+//
+// XPropertySetInfo methods.
+//
+//=========================================================================
+
+// virtual
+uno::Sequence< beans::Property > SAL_CALL PropertySetInfo::getProperties()
+ throw( uno::RuntimeException )
+{
+ if ( !m_pProps )
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pProps )
+ {
+ //////////////////////////////////////////////////////////////
+ // Get info for core ( native) properties.
+ //////////////////////////////////////////////////////////////
+
+ try
+ {
+ uno::Sequence< beans::Property > aProps
+ = m_pContent->getProperties( m_xEnv );
+ m_pProps = new uno::Sequence< beans::Property >( aProps );
+ }
+ catch ( uno::RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( uno::Exception const & )
+ {
+ m_pProps = new uno::Sequence< beans::Property >( 0 );
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Get info for additional properties.
+ //////////////////////////////////////////////////////////////
+
+ uno::Reference< com::sun::star::ucb::XPersistentPropertySet >
+ xSet ( m_pContent->getAdditionalPropertySet( sal_False ) );
+
+ if ( xSet.is() )
+ {
+ // Get property set info.
+ uno::Reference< beans::XPropertySetInfo > xInfo(
+ xSet->getPropertySetInfo() );
+ if ( xInfo.is() )
+ {
+ const uno::Sequence< beans::Property >& rAddProps
+ = xInfo->getProperties();
+ sal_Int32 nAddProps = rAddProps.getLength();
+ if ( nAddProps > 0 )
+ {
+ sal_Int32 nPos = m_pProps->getLength();
+ m_pProps->realloc( nPos + nAddProps );
+
+ beans::Property* pProps = m_pProps->getArray();
+ const beans::Property* pAddProps
+ = rAddProps.getConstArray();
+
+ for ( sal_Int32 n = 0; n < nAddProps; ++n, ++nPos )
+ pProps[ nPos ] = pAddProps[ n ];
+ }
+ }
+ }
+ }
+ }
+ return *m_pProps;
+}
+
+//=========================================================================
+// virtual
+beans::Property SAL_CALL PropertySetInfo::getPropertyByName(
+ const rtl::OUString& aName )
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ beans::Property aProp;
+ if ( queryProperty( aName, aProp ) )
+ return aProp;
+
+ throw beans::UnknownPropertyException();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL PropertySetInfo::hasPropertyByName(
+ const rtl::OUString& Name )
+ throw( uno::RuntimeException )
+{
+ beans::Property aProp;
+ return queryProperty( Name, aProp );
+}
+
+//=========================================================================
+//
+// Non-Interface methods.
+//
+//=========================================================================
+
+void PropertySetInfo::reset()
+{
+ osl::MutexGuard aGuard( m_aMutex );
+ delete m_pProps;
+ m_pProps = 0;
+}
+
+//=========================================================================
+sal_Bool PropertySetInfo::queryProperty(
+ const rtl::OUString& rName, beans::Property& rProp )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ getProperties();
+
+ const beans::Property* pProps = m_pProps->getConstArray();
+ sal_Int32 nCount = m_pProps->getLength();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const beans::Property& rCurrProp = pProps[ n ];
+ if ( rCurrProp.Name == rName )
+ {
+ rProp = rCurrProp;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// CommandProcessorInfo Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+CommandProcessorInfo::CommandProcessorInfo(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ const uno::Reference< com::sun::star::ucb::XCommandEnvironment >& rxEnv,
+ ContentImplHelper* pContent )
+: m_xSMgr( rxSMgr ),
+ m_xEnv( rxEnv ),
+ m_pCommands( 0 ),
+ m_pContent( pContent )
+{
+}
+
+//=========================================================================
+// virtual
+CommandProcessorInfo::~CommandProcessorInfo()
+{
+ delete m_pCommands;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( CommandProcessorInfo,
+ lang::XTypeProvider,
+ com::sun::star::ucb::XCommandInfo );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( CommandProcessorInfo,
+ lang::XTypeProvider,
+ com::sun::star::ucb::XCommandInfo );
+
+//=========================================================================
+//
+// XCommandInfo methods.
+//
+//=========================================================================
+
+// virtual
+uno::Sequence< com::sun::star::ucb::CommandInfo > SAL_CALL
+CommandProcessorInfo::getCommands()
+ throw( uno::RuntimeException )
+{
+ if ( !m_pCommands )
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pCommands )
+ {
+ //////////////////////////////////////////////////////////////
+ // Get info for commands.
+ //////////////////////////////////////////////////////////////
+
+ try
+ {
+ uno::Sequence< com::sun::star::ucb::CommandInfo > aCmds
+ = m_pContent->getCommands( m_xEnv );
+ m_pCommands
+ = new uno::Sequence< com::sun::star::ucb::CommandInfo >(
+ aCmds );
+ }
+ catch ( uno::RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( uno::Exception const & )
+ {
+ m_pCommands
+ = new uno::Sequence< com::sun::star::ucb::CommandInfo >(
+ 0 );
+ }
+ }
+ }
+ return *m_pCommands;
+}
+
+//=========================================================================
+// virtual
+com::sun::star::ucb::CommandInfo SAL_CALL
+CommandProcessorInfo::getCommandInfoByName(
+ const rtl::OUString& Name )
+ throw( com::sun::star::ucb::UnsupportedCommandException,
+ uno::RuntimeException )
+{
+ com::sun::star::ucb::CommandInfo aInfo;
+ if ( queryCommand( Name, aInfo ) )
+ return aInfo;
+
+ throw com::sun::star::ucb::UnsupportedCommandException();
+}
+
+//=========================================================================
+// virtual
+com::sun::star::ucb::CommandInfo SAL_CALL
+CommandProcessorInfo::getCommandInfoByHandle( sal_Int32 Handle )
+ throw( com::sun::star::ucb::UnsupportedCommandException,
+ uno::RuntimeException )
+{
+ com::sun::star::ucb::CommandInfo aInfo;
+ if ( queryCommand( Handle, aInfo ) )
+ return aInfo;
+
+ throw com::sun::star::ucb::UnsupportedCommandException();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByName(
+ const rtl::OUString& Name )
+ throw( uno::RuntimeException )
+{
+ com::sun::star::ucb::CommandInfo aInfo;
+ return queryCommand( Name, aInfo );
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByHandle( sal_Int32 Handle )
+ throw( uno::RuntimeException )
+{
+ com::sun::star::ucb::CommandInfo aInfo;
+ return queryCommand( Handle, aInfo );
+}
+
+//=========================================================================
+//
+// Non-Interface methods.
+//
+//=========================================================================
+
+void CommandProcessorInfo::reset()
+{
+ osl::MutexGuard aGuard( m_aMutex );
+ delete m_pCommands;
+ m_pCommands = 0;
+}
+
+
+//=========================================================================
+sal_Bool CommandProcessorInfo::queryCommand(
+ const rtl::OUString& rName,
+ com::sun::star::ucb::CommandInfo& rCommand )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ getCommands();
+
+ const com::sun::star::ucb::CommandInfo* pCommands
+ = m_pCommands->getConstArray();
+ sal_Int32 nCount = m_pCommands->getLength();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const com::sun::star::ucb::CommandInfo& rCurrCommand = pCommands[ n ];
+ if ( rCurrCommand.Name == rName )
+ {
+ rCommand = rCurrCommand;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+//=========================================================================
+sal_Bool CommandProcessorInfo::queryCommand(
+ sal_Int32 nHandle,
+ com::sun::star::ucb::CommandInfo& rCommand )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ getCommands();
+
+ const com::sun::star::ucb::CommandInfo* pCommands
+ = m_pCommands->getConstArray();
+ sal_Int32 nCount = m_pCommands->getLength();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const com::sun::star::ucb::CommandInfo& rCurrCommand = pCommands[ n ];
+ if ( rCurrCommand.Handle == nHandle )
+ {
+ rCommand = rCurrCommand;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+} // namespace ucbhelper
diff --git a/ucbhelper/source/provider/handleinteractionrequest.cxx b/ucbhelper/source/provider/handleinteractionrequest.cxx
new file mode 100644
index 000000000000..2165e108d664
--- /dev/null
+++ b/ucbhelper/source/provider/handleinteractionrequest.cxx
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: handleinteractionrequest.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+#include "ucbhelper/handleinteractionrequest.hxx"
+#include "com/sun/star/task/XInteractionAbort.hpp"
+#include "com/sun/star/task/XInteractionHandler.hpp"
+#include "com/sun/star/task/XInteractionRetry.hpp"
+#include "com/sun/star/ucb/CommandFailedException.hpp"
+#include "com/sun/star/ucb/XCommandEnvironment.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "cppuhelper/exc_hlp.hxx"
+#include "osl/diagnose.h"
+#include "rtl/ustring.hxx"
+#ifndef _UCBHELPER_INTERACTIONREQUEST_HXX
+#include "ucbhelper/interactionrequest.hxx"
+#endif
+#include "ucbhelper/simpleauthenticationrequest.hxx"
+#include "ucbhelper/simpleinteractionrequest.hxx"
+#include "ucbhelper/simplecertificatevalidationrequest.hxx"
+#ifndef INCLUDED_UTILITY
+#include <utility>
+#define INCLUDED_UTILITY
+#endif
+
+using namespace com::sun::star;
+
+namespace {
+
+void
+handle(uno::Reference< task::XInteractionRequest > const & rRequest,
+ uno::Reference< ucb::XCommandEnvironment > const & rEnvironment)
+ SAL_THROW((uno::Exception))
+{
+ OSL_ENSURE(rRequest.is(), "specification violation");
+ uno::Reference< task::XInteractionHandler > xHandler;
+ if (rEnvironment.is())
+ xHandler = rEnvironment->getInteractionHandler();
+ if (!xHandler.is())
+ cppu::throwException(rRequest->getRequest());
+ xHandler->handle(rRequest.get());
+}
+
+}
+
+namespace ucbhelper {
+
+sal_Int32
+handleInteractionRequest(
+ rtl::Reference< ucbhelper::SimpleInteractionRequest > const & rRequest,
+ uno::Reference< ucb::XCommandEnvironment > const & rEnvironment,
+ bool bThrowOnAbort)
+ SAL_THROW((uno::Exception))
+{
+ handle(rRequest.get(), rEnvironment);
+ sal_Int32 nResponse = rRequest->getResponse();
+ switch (nResponse)
+ {
+ case ucbhelper::CONTINUATION_UNKNOWN:
+ cppu::throwException(rRequest->getRequest());
+ break;
+
+ case ucbhelper::CONTINUATION_ABORT:
+ if (bThrowOnAbort)
+ throw ucb::CommandFailedException(
+ rtl::OUString(), 0, rRequest->getRequest());
+ break;
+ }
+ return nResponse;
+}
+
+std::pair< sal_Int32,
+ rtl::Reference< ucbhelper::InteractionSupplyAuthentication > >
+handleInteractionRequest(
+ rtl::Reference< ucbhelper::SimpleAuthenticationRequest > const & rRequest,
+ uno::Reference< ucb::XCommandEnvironment > const & rEnvironment,
+ bool bThrowOnAbort)
+ SAL_THROW((uno::Exception))
+{
+ handle(rRequest.get(), rEnvironment);
+ rtl::Reference< ucbhelper::InteractionContinuation >
+ xContinuation(rRequest->getSelection());
+ if (uno::Reference< task::XInteractionAbort >(
+ xContinuation.get(), uno::UNO_QUERY).
+ is())
+ if (bThrowOnAbort)
+ throw ucb::CommandFailedException(
+ rtl::OUString(), 0, rRequest->getRequest());
+ else
+ return std::make_pair(
+ ucbhelper::CONTINUATION_ABORT,
+ rtl::Reference<
+ ucbhelper::InteractionSupplyAuthentication >());
+ else if (uno::Reference< task::XInteractionRetry >(
+ xContinuation.get(), uno::UNO_QUERY).
+ is())
+ return std::make_pair(
+ ucbhelper::CONTINUATION_ABORT,
+ rtl::Reference<
+ ucbhelper::InteractionSupplyAuthentication >());
+ else
+ return std::make_pair(
+ ucbhelper::CONTINUATION_UNKNOWN,
+ rtl::Reference<
+ ucbhelper::InteractionSupplyAuthentication >(
+ rRequest->getAuthenticationSupplier()));
+}
+
+}
+
+namespace ucbhelper {
+
+sal_Int32
+handleInteractionRequest(
+ rtl::Reference< ucbhelper::SimpleCertificateValidationRequest > const & rRequest,
+ uno::Reference< ucb::XCommandEnvironment > const & rEnvironment,
+ bool bThrowOnAbort)
+ SAL_THROW((uno::Exception))
+{
+ handle(rRequest.get(), rEnvironment);
+ sal_Int32 nResponse = rRequest->getResponse();
+ switch (nResponse)
+ {
+ case ucbhelper::CONTINUATION_UNKNOWN:
+ cppu::throwException(rRequest->getRequest());
+ break;
+
+ case ucbhelper::CONTINUATION_ABORT:
+ if (bThrowOnAbort)
+ throw ucb::CommandFailedException(
+ rtl::OUString(), 0, rRequest->getRequest());
+ break;
+ }
+ return nResponse;
+}
+
+}
+
diff --git a/ucbhelper/source/provider/interactionrequest.cxx b/ucbhelper/source/provider/interactionrequest.cxx
new file mode 100644
index 000000000000..8bfb4461d6f3
--- /dev/null
+++ b/ucbhelper/source/provider/interactionrequest.cxx
@@ -0,0 +1,1126 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: interactionrequest.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+#include <osl/mutex.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <ucbhelper/interactionrequest.hxx>
+
+using namespace com::sun::star;
+using namespace ucbhelper;
+
+//=========================================================================
+//=========================================================================
+//
+// InteractionRequest Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+namespace ucbhelper
+{
+
+struct InteractionRequest_Impl
+{
+ rtl::Reference< InteractionContinuation > m_xSelection;
+ com::sun::star::uno::Any m_aRequest;
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference<
+ com::sun::star::task::XInteractionContinuation > > m_aContinuations;
+
+ InteractionRequest_Impl() {}
+ InteractionRequest_Impl( const uno::Any & rRequest )
+ : m_aRequest( rRequest ) {}
+};
+
+}
+
+//=========================================================================
+InteractionRequest::InteractionRequest()
+: m_pImpl( new InteractionRequest_Impl )
+{
+}
+
+//=========================================================================
+InteractionRequest::InteractionRequest( const uno::Any & rRequest )
+: m_pImpl( new InteractionRequest_Impl( rRequest ) )
+{
+}
+
+//=========================================================================
+// virtual
+InteractionRequest::~InteractionRequest()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+void InteractionRequest::setRequest( const uno::Any & rRequest )
+{
+ m_pImpl->m_aRequest = rRequest;
+}
+
+//=========================================================================
+void InteractionRequest::setContinuations(
+ const uno::Sequence< uno::Reference<
+ task::XInteractionContinuation > > & rContinuations )
+{
+ m_pImpl->m_aContinuations = rContinuations;
+}
+
+//=========================================================================
+rtl::Reference< InteractionContinuation >
+InteractionRequest::getSelection() const
+{
+ return m_pImpl->m_xSelection;
+}
+
+//=========================================================================
+void InteractionRequest::setSelection(
+ const rtl::Reference< InteractionContinuation > & rxSelection )
+{
+ m_pImpl->m_xSelection = rxSelection;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionRequest::acquire()
+ throw()
+{
+ OWeakObject::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL InteractionRequest::release()
+ throw()
+{
+ OWeakObject::release();
+}
+
+//=========================================================================
+// virtual
+uno::Any SAL_CALL
+InteractionRequest::queryInterface( const uno::Type & rType )
+ throw ( uno::RuntimeException )
+{
+ uno::Any aRet = cppu::queryInterface( rType,
+ static_cast< lang::XTypeProvider * >( this ),
+ static_cast< task::XInteractionRequest * >( this ) );
+
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// virtual
+uno::Sequence< sal_Int8 > SAL_CALL InteractionRequest::getImplementationId()
+ throw( uno::RuntimeException )
+{
+ static cppu::OImplementationId* pId = NULL;
+ if ( !pId )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static cppu::OImplementationId id( sal_False );
+ pId = &id;
+ }
+ }
+ return (*pId).getImplementationId();
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< uno::Type > SAL_CALL InteractionRequest::getTypes()
+ throw( uno::RuntimeException )
+{
+ static cppu::OTypeCollection* pCollection = 0;
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static cppu::OTypeCollection collection(
+ getCppuType( static_cast<
+ uno::Reference< lang::XTypeProvider > * >( 0 ) ),
+ getCppuType( static_cast<
+ uno::Reference< task::XInteractionRequest > * >( 0 ) ) );
+ pCollection = &collection;
+ }
+ }
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XInteractionRequest methods.
+//
+//=========================================================================
+
+// virtual
+uno::Any SAL_CALL InteractionRequest::getRequest()
+ throw( uno::RuntimeException )
+{
+ return m_pImpl->m_aRequest;
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL
+InteractionRequest::getContinuations()
+ throw( uno::RuntimeException )
+{
+ return m_pImpl->m_aContinuations;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// InteractionContinuation Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+namespace ucbhelper
+{
+
+struct InteractionContinuation_Impl
+{
+ InteractionRequest * m_pRequest;
+
+ InteractionContinuation_Impl( InteractionRequest * pRequest )
+ : m_pRequest( pRequest ) {}
+};
+
+}
+
+//=========================================================================
+InteractionContinuation::InteractionContinuation(
+ InteractionRequest * pRequest )
+: m_pImpl( new InteractionContinuation_Impl( pRequest ) )
+{
+}
+
+//=========================================================================
+// virtual
+InteractionContinuation::~InteractionContinuation()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+void InteractionContinuation::recordSelection()
+{
+ m_pImpl->m_pRequest->setSelection( this );
+}
+
+//=========================================================================
+//=========================================================================
+//
+// InteractionAbort Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionAbort::acquire()
+ throw()
+{
+ OWeakObject::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL InteractionAbort::release()
+ throw()
+{
+ OWeakObject::release();
+}
+
+//=========================================================================
+// virtual
+uno::Any SAL_CALL
+InteractionAbort::queryInterface( const uno::Type & rType )
+ throw ( uno::RuntimeException )
+{
+ uno::Any aRet = cppu::queryInterface( rType,
+ static_cast< lang::XTypeProvider * >( this ),
+ static_cast< task::XInteractionContinuation * >( this ),
+ static_cast< task::XInteractionAbort * >( this ) );
+
+ return aRet.hasValue()
+ ? aRet : InteractionContinuation::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// virtual
+uno::Sequence< sal_Int8 > SAL_CALL InteractionAbort::getImplementationId()
+ throw( uno::RuntimeException )
+{
+ static cppu::OImplementationId* pId = NULL;
+ if ( !pId )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static cppu::OImplementationId id( sal_False );
+ pId = &id;
+ }
+ }
+ return (*pId).getImplementationId();
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< uno::Type > SAL_CALL InteractionAbort::getTypes()
+ throw( uno::RuntimeException )
+{
+ static cppu::OTypeCollection* pCollection = 0;
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static cppu::OTypeCollection collection(
+ getCppuType( static_cast<
+ uno::Reference< lang::XTypeProvider > * >( 0 ) ),
+ getCppuType( static_cast<
+ uno::Reference< task::XInteractionAbort > * >( 0 ) ) );
+ pCollection = &collection;
+ }
+ }
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XInteractionContinuation methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionAbort::select()
+ throw( uno::RuntimeException )
+{
+ recordSelection();
+}
+
+//=========================================================================
+//=========================================================================
+//
+// InteractionRetry Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionRetry::acquire()
+ throw()
+{
+ OWeakObject::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL InteractionRetry::release()
+ throw()
+{
+ OWeakObject::release();
+}
+
+//=========================================================================
+// virtual
+uno::Any SAL_CALL
+InteractionRetry::queryInterface( const uno::Type & rType )
+ throw ( uno::RuntimeException )
+{
+ uno::Any aRet = cppu::queryInterface( rType,
+ static_cast< lang::XTypeProvider * >( this ),
+ static_cast< task::XInteractionContinuation * >( this ),
+ static_cast< task::XInteractionRetry * >( this ) );
+
+ return aRet.hasValue()
+ ? aRet : InteractionContinuation::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// virtual
+uno::Sequence< sal_Int8 > SAL_CALL InteractionRetry::getImplementationId()
+ throw( uno::RuntimeException )
+{
+ static cppu::OImplementationId* pId = NULL;
+ if ( !pId )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static cppu::OImplementationId id( sal_False );
+ pId = &id;
+ }
+ }
+ return (*pId).getImplementationId();
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< uno::Type > SAL_CALL InteractionRetry::getTypes()
+ throw( uno::RuntimeException )
+{
+ static cppu::OTypeCollection* pCollection = 0;
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static cppu::OTypeCollection collection(
+ getCppuType( static_cast<
+ uno::Reference< lang::XTypeProvider > * >( 0 ) ),
+ getCppuType( static_cast<
+ uno::Reference< task::XInteractionRetry > * >( 0 ) ) );
+ pCollection = &collection;
+ }
+ }
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XInteractionContinuation methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionRetry::select()
+ throw( uno::RuntimeException )
+{
+ recordSelection();
+}
+
+//=========================================================================
+//=========================================================================
+//
+// InteractionApprove Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionApprove::acquire()
+ throw()
+{
+ OWeakObject::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL InteractionApprove::release()
+ throw()
+{
+ OWeakObject::release();
+}
+
+//=========================================================================
+// virtual
+uno::Any SAL_CALL
+InteractionApprove::queryInterface( const uno::Type & rType )
+ throw ( uno::RuntimeException )
+{
+ uno::Any aRet = cppu::queryInterface( rType,
+ static_cast< lang::XTypeProvider * >( this ),
+ static_cast< task::XInteractionContinuation * >( this ),
+ static_cast< task::XInteractionApprove * >( this ) );
+
+ return aRet.hasValue()
+ ? aRet : InteractionContinuation::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// virtual
+uno::Sequence< sal_Int8 > SAL_CALL InteractionApprove::getImplementationId()
+ throw( uno::RuntimeException )
+{
+ static cppu::OImplementationId* pId = NULL;
+ if ( !pId )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static cppu::OImplementationId id( sal_False );
+ pId = &id;
+ }
+ }
+ return (*pId).getImplementationId();
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< uno::Type > SAL_CALL InteractionApprove::getTypes()
+ throw( uno::RuntimeException )
+{
+ static cppu::OTypeCollection* pCollection = 0;
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static cppu::OTypeCollection collection(
+ getCppuType( static_cast<
+ uno::Reference< lang::XTypeProvider > * >( 0 ) ),
+ getCppuType( static_cast<
+ uno::Reference< task::XInteractionApprove > * >( 0 ) ) );
+ pCollection = &collection;
+ }
+ }
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XInteractionContinuation methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionApprove::select()
+ throw( uno::RuntimeException )
+{
+ recordSelection();
+}
+
+//=========================================================================
+//=========================================================================
+//
+// InteractionDisapprove Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionDisapprove::acquire()
+ throw()
+{
+ OWeakObject::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL InteractionDisapprove::release()
+ throw()
+{
+ OWeakObject::release();
+}
+
+//=========================================================================
+// virtual
+uno::Any SAL_CALL
+InteractionDisapprove::queryInterface( const uno::Type & rType )
+ throw ( uno::RuntimeException )
+{
+ uno::Any aRet = cppu::queryInterface( rType,
+ static_cast< lang::XTypeProvider * >( this ),
+ static_cast< task::XInteractionContinuation * >( this ),
+ static_cast< task::XInteractionDisapprove * >( this ) );
+
+ return aRet.hasValue()
+ ? aRet : InteractionContinuation::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// virtual
+uno::Sequence< sal_Int8 > SAL_CALL InteractionDisapprove::getImplementationId()
+ throw( uno::RuntimeException )
+{
+ static cppu::OImplementationId* pId = NULL;
+ if ( !pId )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static cppu::OImplementationId id( sal_False );
+ pId = &id;
+ }
+ }
+ return (*pId).getImplementationId();
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< uno::Type > SAL_CALL InteractionDisapprove::getTypes()
+ throw( uno::RuntimeException )
+{
+ static cppu::OTypeCollection* pCollection = 0;
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static cppu::OTypeCollection collection(
+ getCppuType( static_cast<
+ uno::Reference< lang::XTypeProvider > * >( 0 ) ),
+ getCppuType( static_cast<
+ uno::Reference< task::XInteractionDisapprove > * >( 0 ) ) );
+ pCollection = &collection;
+ }
+ }
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XInteractionContinuation methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionDisapprove::select()
+ throw( uno::RuntimeException )
+{
+ recordSelection();
+}
+
+//=========================================================================
+//=========================================================================
+//
+// InteractionSupplyAuthentication Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionSupplyAuthentication::acquire()
+ throw()
+{
+ OWeakObject::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL InteractionSupplyAuthentication::release()
+ throw()
+{
+ OWeakObject::release();
+}
+
+//=========================================================================
+// virtual
+uno::Any SAL_CALL
+InteractionSupplyAuthentication::queryInterface( const uno::Type & rType )
+ throw ( uno::RuntimeException )
+{
+ uno::Any aRet = cppu::queryInterface( rType,
+ static_cast< lang::XTypeProvider * >( this ),
+ static_cast< task::XInteractionContinuation * >( this ),
+ static_cast< ucb::XInteractionSupplyAuthentication * >( this ) );
+
+ return aRet.hasValue()
+ ? aRet : InteractionContinuation::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// virtual
+uno::Sequence< sal_Int8 > SAL_CALL
+InteractionSupplyAuthentication::getImplementationId()
+ throw( uno::RuntimeException )
+{
+ static cppu::OImplementationId* pId = NULL;
+ if ( !pId )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static cppu::OImplementationId id( sal_False );
+ pId = &id;
+ }
+ }
+ return (*pId).getImplementationId();
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< uno::Type > SAL_CALL InteractionSupplyAuthentication::getTypes()
+ throw( uno::RuntimeException )
+{
+ static cppu::OTypeCollection* pCollection = 0;
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static cppu::OTypeCollection collection(
+ getCppuType( static_cast<
+ uno::Reference< lang::XTypeProvider > * >( 0 ) ),
+ getCppuType( static_cast<
+ uno::Reference<
+ ucb::XInteractionSupplyAuthentication > * >( 0 ) ) );
+ pCollection = &collection;
+ }
+ }
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XInteractionContinuation methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionSupplyAuthentication::select()
+ throw( uno::RuntimeException )
+{
+ recordSelection();
+}
+
+//=========================================================================
+//
+// XInteractionSupplyAuthentication methods.
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL
+InteractionSupplyAuthentication::canSetRealm()
+ throw( uno::RuntimeException )
+{
+ return m_bCanSetRealm;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL
+InteractionSupplyAuthentication::setRealm( const rtl::OUString& Realm )
+ throw( uno::RuntimeException )
+{
+ OSL_ENSURE( m_bCanSetPassword,
+ "InteractionSupplyAuthentication::setRealm - Not supported!" );
+
+ if ( m_bCanSetRealm )
+ m_aRealm = Realm;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL
+InteractionSupplyAuthentication::canSetUserName()
+ throw( uno::RuntimeException )
+{
+ return m_bCanSetUserName;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL
+InteractionSupplyAuthentication::setUserName( const rtl::OUString& UserName )
+ throw( uno::RuntimeException )
+{
+ OSL_ENSURE( m_bCanSetUserName,
+ "InteractionSupplyAuthentication::setUserName - Not supported!" );
+
+ if ( m_bCanSetUserName )
+ m_aUserName = UserName;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL
+InteractionSupplyAuthentication::canSetPassword()
+ throw( uno::RuntimeException )
+{
+ return m_bCanSetPassword;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL
+InteractionSupplyAuthentication::setPassword( const rtl::OUString& Password )
+ throw( uno::RuntimeException )
+{
+ OSL_ENSURE( m_bCanSetPassword,
+ "InteractionSupplyAuthentication::setPassword - Not supported!" );
+
+ if ( m_bCanSetPassword )
+ m_aPassword = Password;
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< ucb::RememberAuthentication > SAL_CALL
+InteractionSupplyAuthentication::getRememberPasswordModes(
+ ucb::RememberAuthentication& Default )
+ throw( uno::RuntimeException )
+{
+ Default = m_eDefaultRememberPasswordMode;
+ return m_aRememberPasswordModes;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL
+InteractionSupplyAuthentication::setRememberPassword(
+ ucb::RememberAuthentication Remember )
+ throw( uno::RuntimeException )
+{
+ m_eRememberPasswordMode = Remember;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL
+InteractionSupplyAuthentication::canSetAccount()
+ throw( uno::RuntimeException )
+{
+ return m_bCanSetAccount;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL
+InteractionSupplyAuthentication::setAccount( const rtl::OUString& Account )
+ throw( uno::RuntimeException )
+{
+ OSL_ENSURE( m_bCanSetAccount,
+ "InteractionSupplyAuthentication::setAccount - Not supported!" );
+
+ if ( m_bCanSetAccount )
+ m_aAccount = Account;
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< ucb::RememberAuthentication > SAL_CALL
+InteractionSupplyAuthentication::getRememberAccountModes(
+ ucb::RememberAuthentication& Default )
+ throw( uno::RuntimeException )
+{
+ Default = m_eDefaultRememberAccountMode;
+ return m_aRememberAccountModes;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL InteractionSupplyAuthentication::setRememberAccount(
+ ucb::RememberAuthentication Remember )
+ throw( uno::RuntimeException )
+{
+ m_eRememberAccountMode = Remember;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// InteractionSupplyName Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionSupplyName::acquire()
+ throw()
+{
+ OWeakObject::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL InteractionSupplyName::release()
+ throw()
+{
+ OWeakObject::release();
+}
+
+//=========================================================================
+// virtual
+uno::Any SAL_CALL
+InteractionSupplyName::queryInterface( const uno::Type & rType )
+ throw ( uno::RuntimeException )
+{
+ uno::Any aRet = cppu::queryInterface( rType,
+ static_cast< lang::XTypeProvider * >( this ),
+ static_cast< task::XInteractionContinuation * >( this ),
+ static_cast< ucb::XInteractionSupplyName * >( this ) );
+
+ return aRet.hasValue()
+ ? aRet : InteractionContinuation::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// virtual
+uno::Sequence< sal_Int8 > SAL_CALL InteractionSupplyName::getImplementationId()
+ throw( uno::RuntimeException )
+{
+ static cppu::OImplementationId* pId = NULL;
+ if ( !pId )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static cppu::OImplementationId id( sal_False );
+ pId = &id;
+ }
+ }
+ return (*pId).getImplementationId();
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< uno::Type > SAL_CALL InteractionSupplyName::getTypes()
+ throw( uno::RuntimeException )
+{
+ static cppu::OTypeCollection* pCollection = 0;
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static cppu::OTypeCollection collection(
+ getCppuType( static_cast<
+ uno::Reference< lang::XTypeProvider > * >( 0 ) ),
+ getCppuType( static_cast<
+ uno::Reference< ucb::XInteractionSupplyName > * >( 0 ) ) );
+ pCollection = &collection;
+ }
+ }
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XInteractionContinuation methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionSupplyName::select()
+ throw( uno::RuntimeException )
+{
+ recordSelection();
+}
+
+//=========================================================================
+//
+// XInteractionSupplyName methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL
+InteractionSupplyName::setName( const rtl::OUString& Name )
+ throw( uno::RuntimeException )
+{
+ m_aName = Name;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// InteractionReplaceExistingData Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionReplaceExistingData::acquire()
+ throw()
+{
+ OWeakObject::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL InteractionReplaceExistingData::release()
+ throw()
+{
+ OWeakObject::release();
+}
+
+//=========================================================================
+// virtual
+uno::Any SAL_CALL
+InteractionReplaceExistingData::queryInterface( const uno::Type & rType )
+ throw ( uno::RuntimeException )
+{
+ uno::Any aRet = cppu::queryInterface( rType,
+ static_cast< lang::XTypeProvider * >( this ),
+ static_cast< task::XInteractionContinuation * >( this ),
+ static_cast< ucb::XInteractionReplaceExistingData * >( this ) );
+
+ return aRet.hasValue()
+ ? aRet : InteractionContinuation::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// virtual
+uno::Sequence< sal_Int8 > SAL_CALL
+InteractionReplaceExistingData::getImplementationId()
+ throw( uno::RuntimeException )
+{
+ static cppu::OImplementationId* pId = NULL;
+ if ( !pId )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static cppu::OImplementationId id( sal_False );
+ pId = &id;
+ }
+ }
+ return (*pId).getImplementationId();
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< uno::Type > SAL_CALL InteractionReplaceExistingData::getTypes()
+ throw( uno::RuntimeException )
+{
+ static cppu::OTypeCollection* pCollection = 0;
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static cppu::OTypeCollection collection(
+ getCppuType( static_cast<
+ uno::Reference< lang::XTypeProvider > * >( 0 ) ),
+ getCppuType( static_cast<
+ uno::Reference<
+ ucb::XInteractionReplaceExistingData > * >( 0 ) ) );
+ pCollection = &collection;
+ }
+ }
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XInteractionContinuation methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL InteractionReplaceExistingData::select()
+ throw( uno::RuntimeException )
+{
+ recordSelection();
+}
+
diff --git a/ucbhelper/source/provider/makefile.mk b/ucbhelper/source/provider/makefile.mk
new file mode 100644
index 000000000000..acb213ec201d
--- /dev/null
+++ b/ucbhelper/source/provider/makefile.mk
@@ -0,0 +1,76 @@
+#*************************************************************************
+#
+# 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
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.21 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME= ucbhelper
+TARGET= provider
+AUTOSEG= TRUE
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(header)" == ""
+
+SLOFILES=\
+ $(SLO)$/configureucb.obj \
+ $(SLO)$/contentidentifier.obj \
+ $(SLO)$/providerhelper.obj \
+ $(SLO)$/contenthelper.obj \
+ $(SLO)$/contentinfo.obj \
+ $(SLO)$/propertyvalueset.obj \
+ $(SLO)$/registerucb.obj \
+ $(SLO)$/resultsetmetadata.obj \
+ $(SLO)$/resultset.obj \
+ $(SLO)$/resultsethelper.obj \
+ $(SLO)$/provconf.obj \
+ $(SLO)$/commandenvironmentproxy.obj \
+ $(SLO)$/interactionrequest.obj \
+ $(SLO)$/simpleinteractionrequest.obj \
+ $(SLO)$/simpleauthenticationrequest.obj \
+ $(SLO)$/simplenameclashresolverequest.obj \
+ $(SLO)$/simpleioerrorrequest.obj \
+ $(SLO)$/cancelcommandexecution.obj \
+ $(SLO)$/handleinteractionrequest.obj \
+ $(SLO)$/simplecertificatevalidationrequest.obj
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/ucbhelper/source/provider/propertyvalueset.cxx b/ucbhelper/source/provider/propertyvalueset.cxx
new file mode 100644
index 000000000000..7ea542c5f4cd
--- /dev/null
+++ b/ucbhelper/source/provider/propertyvalueset.cxx
@@ -0,0 +1,926 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: propertyvalueset.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef __VECTOR__
+#include <vector>
+#endif
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/script/XTypeConverter.hpp>
+
+#include "osl/diagnose.h"
+#include "osl/mutex.hxx"
+#include <ucbhelper/propertyvalueset.hxx>
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::script;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace rtl;
+
+namespace ucbhelper_impl
+{
+
+//=========================================================================
+//
+// PropertyValue.
+//
+//=========================================================================
+
+const sal_uInt32 NO_VALUE_SET = 0x00000000;
+const sal_uInt32 STRING_VALUE_SET = 0x00000001;
+const sal_uInt32 BOOLEAN_VALUE_SET = 0x00000002;
+const sal_uInt32 BYTE_VALUE_SET = 0x00000004;
+const sal_uInt32 SHORT_VALUE_SET = 0x00000008;
+const sal_uInt32 INT_VALUE_SET = 0x00000010;
+const sal_uInt32 LONG_VALUE_SET = 0x00000020;
+const sal_uInt32 FLOAT_VALUE_SET = 0x00000040;
+const sal_uInt32 DOUBLE_VALUE_SET = 0x00000080;
+const sal_uInt32 BYTES_VALUE_SET = 0x00000100;
+const sal_uInt32 DATE_VALUE_SET = 0x00000200;
+const sal_uInt32 TIME_VALUE_SET = 0x00000400;
+const sal_uInt32 TIMESTAMP_VALUE_SET = 0x00000800;
+const sal_uInt32 BINARYSTREAM_VALUE_SET = 0x00001000;
+const sal_uInt32 CHARACTERSTREAM_VALUE_SET = 0x00002000;
+const sal_uInt32 REF_VALUE_SET = 0x00004000;
+const sal_uInt32 BLOB_VALUE_SET = 0x00008000;
+const sal_uInt32 CLOB_VALUE_SET = 0x00010000;
+const sal_uInt32 ARRAY_VALUE_SET = 0x00020000;
+const sal_uInt32 OBJECT_VALUE_SET = 0x00040000;
+
+struct PropertyValue
+{
+ Property aProperty;
+
+ sal_uInt32 nPropsSet;
+ sal_uInt32 nOrigValue;
+
+ OUString aString; // getString
+ sal_Bool bBoolean; // getBoolean
+ sal_Int8 nByte; // getByte
+ sal_Int16 nShort; // getShort
+ sal_Int32 nInt; // getInt
+ sal_Int64 nLong; // getLong
+ float nFloat; // getFloat
+ double nDouble; // getDouble
+
+ Sequence< sal_Int8 > aBytes; // getBytes
+ Date aDate; // getDate
+ Time aTime; // getTime
+ DateTime aTimestamp; // getTimestamp
+ Reference< XInputStream > xBinaryStream; // getBinaryStream
+ Reference< XInputStream > xCharacterStream; // getCharacterStream
+ Reference< XRef > xRef; // getRef
+ Reference< XBlob > xBlob; // getBlob
+ Reference< XClob > xClob; // getClob
+ Reference< XArray > xArray; // getArray
+ Any aObject; // getObject
+
+ inline PropertyValue()
+ : nPropsSet( NO_VALUE_SET ), nOrigValue( NO_VALUE_SET ),
+ bBoolean(false),
+ nByte(0),
+ nShort(0),
+ nInt(0),
+ nLong(0),
+ nFloat(0.0),
+ nDouble(0.0)
+ {}
+};
+} // namespace ucbhelper_impl
+
+using namespace ucbhelper_impl;
+
+namespace ucbhelper
+{
+
+//=========================================================================
+//
+// class PropertyValues.
+//
+//=========================================================================
+
+typedef std::vector< ucbhelper_impl::PropertyValue > PropertyValuesVector;
+
+class PropertyValues : public PropertyValuesVector {};
+
+} // namespace ucbhelper
+
+//=========================================================================
+//
+// Welcome to the macro hell...
+//
+//=========================================================================
+
+#define GETVALUE_IMPL_TYPE( _type_, _type_name_, _member_name_, _cppu_type_ ) \
+ \
+ osl::MutexGuard aGuard( m_aMutex ); \
+ \
+ _type_ aValue = _type_(); /* default ctor */ \
+ \
+ m_bWasNull = sal_True; \
+ \
+ if ( ( columnIndex < 1 ) \
+ || ( columnIndex > sal_Int32( m_pValues->size() ) ) ) \
+ { \
+ OSL_ENSURE( sal_False, "PropertyValueSet - index out of range!" ); \
+ } \
+ else \
+ { \
+ ucbhelper_impl::PropertyValue& rValue \
+ = (*m_pValues)[ columnIndex - 1 ]; \
+ \
+ if ( rValue.nOrigValue != NO_VALUE_SET ) \
+ { \
+ if ( rValue.nPropsSet & _type_name_ ) \
+ { \
+ /* Values is present natively... */ \
+ aValue = rValue._member_name_; \
+ m_bWasNull = sal_False; \
+ } \
+ else \
+ { \
+ if ( !(rValue.nPropsSet & OBJECT_VALUE_SET) ) \
+ { \
+ /* Value is not (yet) available as Any. Create it. */ \
+ getObject( columnIndex, Reference< XNameAccess >() ); \
+ } \
+ \
+ if ( rValue.nPropsSet & OBJECT_VALUE_SET ) \
+ { \
+ /* Value is available as Any. */ \
+ \
+ if ( rValue.aObject.hasValue() ) \
+ { \
+ /* Try to convert into native value. */ \
+ if ( rValue.aObject >>= aValue ) \
+ { \
+ rValue._member_name_ = aValue; \
+ rValue.nPropsSet |= _type_name_; \
+ m_bWasNull = sal_False; \
+ } \
+ else \
+ { \
+ /* Last chance. Try type converter service... */ \
+ \
+ Reference< XTypeConverter > xConverter \
+ = getTypeConverter(); \
+ if ( xConverter.is() ) \
+ { \
+ try \
+ { \
+ Any aConvAny = xConverter->convertTo( \
+ rValue.aObject, \
+ _cppu_type_ ); \
+ \
+ if ( aConvAny >>= aValue ) \
+ { \
+ rValue._member_name_ = aValue; \
+ rValue.nPropsSet |= _type_name_; \
+ m_bWasNull = sal_False; \
+ } \
+ } \
+ catch ( IllegalArgumentException ) \
+ { \
+ } \
+ catch ( CannotConvertException ) \
+ { \
+ } \
+ } \
+ } \
+ } \
+ } \
+ } \
+ } \
+ } \
+ return aValue;
+
+#define GETVALUE_IMPL( _type_, _type_name_, _member_name_ ) \
+ GETVALUE_IMPL_TYPE( _type_, \
+ _type_name_, \
+ _member_name_, \
+ getCppuType( static_cast< const _type_ * >( 0 ) ) )
+
+#define SETVALUE_IMPL( _property_, _type_name_, _member_name_, _value_ ) \
+ \
+ osl::MutexGuard aGuard( m_aMutex ); \
+ \
+ ucbhelper_impl::PropertyValue aNewValue; \
+ aNewValue.aProperty = _property_; \
+ aNewValue.nPropsSet = _type_name_; \
+ aNewValue.nOrigValue = _type_name_; \
+ aNewValue._member_name_ = _value_; \
+ \
+ m_pValues->push_back( aNewValue );
+
+namespace ucbhelper {
+
+//=========================================================================
+//=========================================================================
+//
+// PropertyValueSet Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+#define PROPERTYVALUESET_INIT() \
+ m_xSMgr( rxSMgr ), \
+ m_pValues( new PropertyValues ), \
+ m_bWasNull( sal_False ), \
+ m_bTriedToGetTypeConverter( sal_False )
+
+//=========================================================================
+PropertyValueSet::PropertyValueSet(
+ const Reference< XMultiServiceFactory >& rxSMgr )
+: PROPERTYVALUESET_INIT()
+{
+}
+
+//=========================================================================
+PropertyValueSet::PropertyValueSet(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const Sequence< com::sun::star::beans::PropertyValue >& rValues )
+: PROPERTYVALUESET_INIT()
+{
+ sal_Int32 nCount = rValues.getLength();
+ if ( nCount )
+ {
+ const com::sun::star::beans::PropertyValue* pValues
+ = rValues.getConstArray();
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const com::sun::star::beans::PropertyValue& rValue = pValues[ n ];
+ appendObject( Property( rValue.Name,
+ rValue.Handle,
+ rValue.Value.getValueType(),
+ 0 ),
+ rValue.Value );
+ }
+ }
+}
+
+//=========================================================================
+// virtual
+PropertyValueSet::~PropertyValueSet()
+{
+ delete m_pValues;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_3( PropertyValueSet,
+ XTypeProvider,
+ XRow,
+ XColumnLocate );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_3( PropertyValueSet,
+ XTypeProvider,
+ XRow,
+ XColumnLocate );
+
+//=========================================================================
+//
+// XRow methods.
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL PropertyValueSet::wasNull()
+ throw( SQLException, RuntimeException )
+{
+ // This method can not be implemented correctly!!! Imagine different
+ // threads doing a getXYZ - wasNull calling sequence on the same
+ // implementation object...
+ return m_bWasNull;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL PropertyValueSet::getString( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( OUString, STRING_VALUE_SET, aString );
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL PropertyValueSet::getBoolean( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL_TYPE(
+ sal_Bool, BOOLEAN_VALUE_SET, bBoolean, getCppuBooleanType() );
+}
+
+//=========================================================================
+// virtual
+sal_Int8 SAL_CALL PropertyValueSet::getByte( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( sal_Int8, BYTE_VALUE_SET, nByte );
+}
+
+//=========================================================================
+// virtual
+sal_Int16 SAL_CALL PropertyValueSet::getShort( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( sal_Int16, SHORT_VALUE_SET, nShort );
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL PropertyValueSet::getInt( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( sal_Int32, INT_VALUE_SET, nInt );
+}
+
+//=========================================================================
+// virtual
+sal_Int64 SAL_CALL PropertyValueSet::getLong( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( sal_Int64, LONG_VALUE_SET, nLong );
+}
+
+//=========================================================================
+// virtual
+float SAL_CALL PropertyValueSet::getFloat( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( float, FLOAT_VALUE_SET, nFloat );
+}
+
+//=========================================================================
+// virtual
+double SAL_CALL PropertyValueSet::getDouble( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( double, DOUBLE_VALUE_SET, nDouble );
+}
+
+//=========================================================================
+// virtual
+Sequence< sal_Int8 > SAL_CALL
+PropertyValueSet::getBytes( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Sequence< sal_Int8 >, BYTES_VALUE_SET, aBytes );
+}
+
+//=========================================================================
+// virtual
+Date SAL_CALL PropertyValueSet::getDate( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Date, DATE_VALUE_SET, aDate );
+}
+
+//=========================================================================
+// virtual
+Time SAL_CALL PropertyValueSet::getTime( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Time, TIME_VALUE_SET, aTime );
+}
+
+//=========================================================================
+// virtual
+DateTime SAL_CALL PropertyValueSet::getTimestamp( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( DateTime, TIMESTAMP_VALUE_SET, aTimestamp );
+}
+
+//=========================================================================
+// virtual
+Reference< XInputStream > SAL_CALL
+PropertyValueSet::getBinaryStream( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL(
+ Reference< XInputStream >, BINARYSTREAM_VALUE_SET, xBinaryStream );
+}
+
+//=========================================================================
+// virtual
+Reference< XInputStream > SAL_CALL
+PropertyValueSet::getCharacterStream( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL(
+ Reference< XInputStream >, CHARACTERSTREAM_VALUE_SET, xCharacterStream );
+}
+
+//=========================================================================
+// virtual
+Any SAL_CALL PropertyValueSet::getObject(
+ sal_Int32 columnIndex,
+ const Reference< XNameAccess >& )
+ throw( SQLException, RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ Any aValue;
+
+ m_bWasNull = sal_True;
+
+ if ( ( columnIndex < 1 )
+ || ( columnIndex > sal_Int32( m_pValues->size() ) ) )
+ {
+ OSL_ENSURE( sal_False, "PropertyValueSet - index out of range!" );
+ }
+ else
+ {
+ ucbhelper_impl::PropertyValue& rValue
+ = (*m_pValues)[ columnIndex - 1 ];
+
+ if ( rValue.nPropsSet & OBJECT_VALUE_SET )
+ {
+ // Values is present natively...
+ aValue = rValue.aObject;
+ m_bWasNull = sal_False;
+ }
+ else
+ {
+ // Make Any from original value.
+
+ switch ( rValue.nOrigValue )
+ {
+ case NO_VALUE_SET:
+ break;
+
+ case STRING_VALUE_SET:
+ aValue <<= rValue.aString;
+ break;
+
+ case BOOLEAN_VALUE_SET:
+ aValue <<= rValue.bBoolean;
+ break;
+
+ case BYTE_VALUE_SET:
+ aValue <<= rValue.nByte;
+ break;
+
+ case SHORT_VALUE_SET:
+ aValue <<= rValue.nShort;
+ break;
+
+ case INT_VALUE_SET:
+ aValue <<= rValue.nInt;
+ break;
+
+ case LONG_VALUE_SET:
+ aValue <<= rValue.nLong;
+ break;
+
+ case FLOAT_VALUE_SET:
+ aValue <<= rValue.nFloat;
+ break;
+
+ case DOUBLE_VALUE_SET:
+ aValue <<= rValue.nDouble;
+ break;
+
+ case BYTES_VALUE_SET:
+ aValue <<= rValue.aBytes;
+ break;
+
+ case DATE_VALUE_SET:
+ aValue <<= rValue.aDate;
+ break;
+
+ case TIME_VALUE_SET:
+ aValue <<= rValue.aTime;
+ break;
+
+ case TIMESTAMP_VALUE_SET:
+ aValue <<= rValue.aTimestamp;
+ break;
+
+ case BINARYSTREAM_VALUE_SET:
+ aValue <<= rValue.xBinaryStream;
+ break;
+
+ case CHARACTERSTREAM_VALUE_SET:
+ aValue <<= rValue.xCharacterStream;
+ break;
+
+ case REF_VALUE_SET:
+ aValue <<= rValue.xRef;
+ break;
+
+ case BLOB_VALUE_SET:
+ aValue <<= rValue.xBlob;
+ break;
+
+ case CLOB_VALUE_SET:
+ aValue <<= rValue.xClob;
+ break;
+
+ case ARRAY_VALUE_SET:
+ aValue <<= rValue.xArray;
+ break;
+
+ case OBJECT_VALUE_SET:
+ // Fall-through is intended!
+ default:
+ OSL_ENSURE( sal_False,
+ "PropertyValueSet::getObject - "
+ "Wrong original type" );
+ break;
+ }
+
+ if ( aValue.hasValue() )
+ {
+ rValue.aObject = aValue;
+ rValue.nPropsSet |= OBJECT_VALUE_SET;
+ m_bWasNull = sal_False;
+ }
+ }
+ }
+
+ return aValue;
+}
+
+//=========================================================================
+// virtual
+Reference< XRef > SAL_CALL PropertyValueSet::getRef( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Reference< XRef >, REF_VALUE_SET, xRef );
+}
+
+//=========================================================================
+// virtual
+Reference< XBlob > SAL_CALL PropertyValueSet::getBlob( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Reference< XBlob >, BLOB_VALUE_SET, xBlob );
+}
+
+//=========================================================================
+// virtual
+Reference< XClob > SAL_CALL PropertyValueSet::getClob( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Reference< XClob >, CLOB_VALUE_SET, xClob );
+}
+
+//=========================================================================
+// virtual
+Reference< XArray > SAL_CALL PropertyValueSet::getArray( sal_Int32 columnIndex )
+ throw( SQLException, RuntimeException )
+{
+ GETVALUE_IMPL( Reference< XArray >, ARRAY_VALUE_SET, xArray );
+}
+
+//=========================================================================
+//
+// XColumnLocate methods.
+//
+//=========================================================================
+
+// virtual
+sal_Int32 SAL_CALL PropertyValueSet::findColumn( const OUString& columnName )
+ throw( SQLException, RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( columnName.getLength() )
+ {
+ sal_Int32 nCount = m_pValues->size();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ if ( (*m_pValues)[ n ].aProperty.Name.equals( columnName ) )
+ return sal_Int32( n + 1 ); // Index is 1-based.
+ }
+ }
+ return 0;
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+const Reference< XTypeConverter >& PropertyValueSet::getTypeConverter()
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_bTriedToGetTypeConverter && !m_xTypeConverter.is() )
+ {
+ m_bTriedToGetTypeConverter = sal_True;
+ m_xTypeConverter = Reference< XTypeConverter >(
+ m_xSMgr->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.script.Converter" ) ),
+ UNO_QUERY );
+
+ OSL_ENSURE( m_xTypeConverter.is(),
+ "PropertyValueSet::getTypeConverter() - "
+ "Service 'com.sun.star.script.Converter' n/a!" );
+ }
+ return m_xTypeConverter;
+}
+
+//=========================================================================
+sal_Int32 PropertyValueSet::getLength() const
+{
+ return m_pValues->size();
+}
+
+//=========================================================================
+void PropertyValueSet::appendString( const Property& rProp,
+ const OUString& rValue )
+{
+ SETVALUE_IMPL( rProp, STRING_VALUE_SET, aString, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendBoolean( const Property& rProp,
+ sal_Bool bValue )
+{
+ SETVALUE_IMPL( rProp, BOOLEAN_VALUE_SET, bBoolean, bValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendByte( const Property& rProp,
+ sal_Int8 nValue )
+{
+ SETVALUE_IMPL( rProp, BYTE_VALUE_SET, nByte, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendShort( const Property& rProp,
+ sal_Int16 nValue )
+{
+ SETVALUE_IMPL( rProp, SHORT_VALUE_SET, nShort, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendInt( const Property& rProp,
+ sal_Int32 nValue )
+{
+ SETVALUE_IMPL( rProp, INT_VALUE_SET, nInt, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendLong( const Property& rProp,
+ sal_Int64 nValue )
+{
+ SETVALUE_IMPL( rProp, LONG_VALUE_SET, nLong, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendFloat( const Property& rProp,
+ float nValue )
+{
+ SETVALUE_IMPL( rProp, FLOAT_VALUE_SET, nFloat, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendDouble( const Property& rProp,
+ double nValue )
+{
+ SETVALUE_IMPL( rProp, DOUBLE_VALUE_SET, nDouble, nValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendBytes( const Property& rProp,
+ const Sequence< sal_Int8 >& rValue )
+{
+ SETVALUE_IMPL( rProp, BYTES_VALUE_SET, aBytes, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendDate( const Property& rProp,
+ const Date& rValue )
+{
+ SETVALUE_IMPL( rProp, DATE_VALUE_SET, aDate, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendTime( const Property& rProp,
+ const Time& rValue )
+{
+ SETVALUE_IMPL( rProp, TIME_VALUE_SET, aTime, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendTimestamp( const Property& rProp,
+ const DateTime& rValue )
+{
+ SETVALUE_IMPL( rProp, TIMESTAMP_VALUE_SET, aTimestamp, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendBinaryStream(
+ const Property& rProp,
+ const Reference< XInputStream >& rValue )
+{
+ SETVALUE_IMPL( rProp, BINARYSTREAM_VALUE_SET, xBinaryStream, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendCharacterStream(
+ const Property& rProp,
+ const Reference< XInputStream >& rValue )
+{
+ SETVALUE_IMPL( rProp, CHARACTERSTREAM_VALUE_SET, xCharacterStream, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendObject( const Property& rProp,
+ const Any& rValue )
+{
+ SETVALUE_IMPL( rProp, OBJECT_VALUE_SET, aObject, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendRef( const Property& rProp,
+ const Reference< XRef >& rValue )
+{
+ SETVALUE_IMPL( rProp, REF_VALUE_SET, xRef, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendBlob( const Property& rProp,
+ const Reference< XBlob >& rValue )
+{
+ SETVALUE_IMPL( rProp, BLOB_VALUE_SET, xBlob, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendClob( const Property& rProp,
+ const Reference< XClob >& rValue )
+{
+ SETVALUE_IMPL( rProp, CLOB_VALUE_SET, xClob, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendArray( const Property& rProp,
+ const Reference< XArray >& rValue )
+{
+ SETVALUE_IMPL( rProp, ARRAY_VALUE_SET, xArray, rValue );
+}
+
+//=========================================================================
+void PropertyValueSet::appendVoid( const Property& rProp )
+{
+ SETVALUE_IMPL( rProp, NO_VALUE_SET, aObject, Any() );
+}
+
+//=========================================================================
+void PropertyValueSet::appendPropertySet(
+ const Reference< XPropertySet >& rxSet )
+{
+ if ( rxSet.is() )
+ {
+ Reference< XPropertySetInfo > xInfo = rxSet->getPropertySetInfo();
+ if ( xInfo.is() )
+ {
+ Sequence< Property > aProps = xInfo->getProperties();
+ const Property* pProps = aProps.getConstArray();
+ sal_Int32 nPropsCount = aProps.getLength();
+
+ Reference< XPropertyAccess > xPropertyAccess( rxSet, UNO_QUERY );
+ if ( xPropertyAccess.is() )
+ {
+ // Efficient: Get all prop values with one ( remote) call.
+
+ Sequence< ::com::sun::star::beans::PropertyValue > aPropValues
+ = xPropertyAccess->getPropertyValues();
+
+ const ::com::sun::star::beans::PropertyValue* pPropValues
+ = aPropValues.getConstArray();
+
+ sal_Int32 nValuesCount = aPropValues.getLength();
+ for ( sal_Int32 n = 0; n < nValuesCount; ++n )
+ {
+ const ::com::sun::star::beans::PropertyValue& rPropValue
+ = pPropValues[ n ];
+
+ // Find info for current property value.
+ for ( sal_Int32 m = 0; m < nPropsCount; ++m )
+ {
+ const Property& rProp = pProps[ m ];
+ if ( rProp.Name == rPropValue.Name )
+ {
+ // Found!
+ appendObject( rProp, rPropValue.Value );
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ // Get every single prop value with one ( remote) call.
+
+ for ( sal_Int32 n = 0; n < nPropsCount; ++n )
+ {
+ const Property& rProp = pProps[ n ];
+
+ try
+ {
+ Any aValue = rxSet->getPropertyValue( rProp.Name );
+
+ if ( aValue.hasValue() )
+ appendObject( rProp, aValue );
+ }
+ catch ( UnknownPropertyException )
+ {
+ }
+ catch ( WrappedTargetException )
+ {
+ }
+ }
+ }
+ }
+ }
+}
+
+//=========================================================================
+sal_Bool PropertyValueSet::appendPropertySetValue(
+ const Reference< XPropertySet >& rxSet,
+ const Property& rProperty )
+{
+ if ( rxSet.is() )
+ {
+ try
+ {
+ Any aValue = rxSet->getPropertyValue( rProperty.Name );
+ if ( aValue.hasValue() )
+ {
+ appendObject( rProperty, aValue );
+ return sal_True;
+ }
+ }
+ catch ( UnknownPropertyException )
+ {
+ }
+ catch ( WrappedTargetException )
+ {
+ }
+ }
+
+ // Error.
+ return sal_False;
+}
+
+} // namespace ucbhelper
diff --git a/ucbhelper/source/provider/provconf.cxx b/ucbhelper/source/provider/provconf.cxx
new file mode 100644
index 000000000000..e2472a5d992b
--- /dev/null
+++ b/ucbhelper/source/provider/provconf.cxx
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: provconf.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#ifndef _UCBHELPER_PROVCONF_HXX_
+#include <provconf.hxx>
+#endif
+#include <osl/diagnose.h>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+using namespace com::sun::star;
+
+//=========================================================================
+
+#define CONFIG_CONTENTPROVIDERS_KEY \
+ "/org.openoffice.ucb.Configuration/ContentProviders"
+
+//=========================================================================
+
+namespace ucbhelper {
+
+void makeAndAppendXMLName(
+ rtl::OUStringBuffer & rBuffer, const rtl::OUString & rIn )
+{
+ sal_Int32 nCount = rIn.getLength();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const sal_Unicode c = rIn.getStr()[ n ];
+ switch ( c )
+ {
+ case '&':
+ rBuffer.appendAscii( "&amp;" );
+ break;
+
+ case '"':
+ rBuffer.appendAscii( "&quot;" );
+ break;
+
+ case '\'':
+ rBuffer.appendAscii( "&apos;" );
+ break;
+
+ case '<':
+ rBuffer.appendAscii( "&lt;" );
+ break;
+
+ case '>':
+ rBuffer.appendAscii( "&gt;" );
+ break;
+
+ default:
+ rBuffer.append( c );
+ break;
+ }
+ }
+}
+
+//=========================================================================
+bool getContentProviderData(
+ const uno::Reference< lang::XMultiServiceFactory > & rServiceMgr,
+ const rtl::OUString & rKey1,
+ const rtl::OUString & rKey2,
+ ContentProviderDataList & rListToFill )
+{
+ if ( !rServiceMgr.is() || !rKey1.getLength() || !rKey2.getLength() )
+ {
+ OSL_ENSURE( false,
+ "getContentProviderData - Invalid argument!" );
+ return false;
+ }
+
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xConfigProv(
+ rServiceMgr->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.configuration.ConfigurationProvider" ) ),
+ uno::UNO_QUERY );
+
+ if ( !xConfigProv.is() )
+ {
+ OSL_ENSURE( false,
+ "getContentProviderData - No config provider!" );
+ return false;
+ }
+
+ rtl::OUStringBuffer aFullPath;
+ aFullPath.appendAscii( CONFIG_CONTENTPROVIDERS_KEY "/['" );
+ makeAndAppendXMLName( aFullPath, rKey1 );
+ aFullPath.appendAscii( "']/SecondaryKeys/['" );
+ makeAndAppendXMLName( aFullPath, rKey2 );
+ aFullPath.appendAscii( "']/ProviderData" );
+
+ uno::Sequence< uno::Any > aArguments( 1 );
+ beans::PropertyValue aProperty;
+ aProperty.Name
+ = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
+ aProperty.Value <<= aFullPath.makeStringAndClear();
+ aArguments[ 0 ] <<= aProperty;
+
+ uno::Reference< uno::XInterface > xInterface(
+ xConfigProv->createInstanceWithArguments(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationAccess" ) ),
+ aArguments ) );
+
+ if ( !xInterface.is() )
+ {
+ OSL_ENSURE( false,
+ "getContentProviderData - No config access!" );
+ return false;
+ }
+
+ uno::Reference< container::XNameAccess > xNameAccess(
+ xInterface, uno::UNO_QUERY );
+
+ if ( !xNameAccess.is() )
+ {
+ OSL_ENSURE( false,
+ "getContentProviderData - No XNameAccess!" );
+ return false;
+ }
+
+ uno::Sequence< rtl::OUString > aElems = xNameAccess->getElementNames();
+ const rtl::OUString* pElems = aElems.getConstArray();
+ sal_Int32 nCount = aElems.getLength();
+
+ if ( nCount > 0 )
+ {
+ uno::Reference< container::XHierarchicalNameAccess >
+ xHierNameAccess( xInterface, uno::UNO_QUERY );
+
+ if ( !xHierNameAccess.is() )
+ {
+ OSL_ENSURE( false,
+ "getContentProviderData - "
+ "No XHierarchicalNameAccess!" );
+ return false;
+ }
+
+ // Iterate over children.
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ rtl::OUStringBuffer aElemBuffer;
+ aElemBuffer.appendAscii( "['" );
+ makeAndAppendXMLName( aElemBuffer, pElems[ n ] );
+
+ try
+ {
+ ContentProviderData aInfo;
+
+ // Obtain service name.
+ rtl::OUStringBuffer aKeyBuffer = aElemBuffer;
+ aKeyBuffer.appendAscii( "']/ServiceName" );
+
+ rtl::OUString aValue;
+ if ( !( xHierNameAccess->getByHierarchicalName(
+ aKeyBuffer.makeStringAndClear() ) >>= aValue ) )
+ {
+ OSL_ENSURE( false,
+ "getContentProviderData - "
+ "Error getting item value!" );
+ continue;
+ }
+
+ aInfo.ServiceName = aValue;
+
+ // Obtain URL Template.
+ aKeyBuffer = aElemBuffer;
+ aKeyBuffer.appendAscii( "']/URLTemplate" );
+
+ if ( !( xHierNameAccess->getByHierarchicalName(
+ aKeyBuffer.makeStringAndClear() ) >>= aValue ) )
+ {
+ OSL_ENSURE( false,
+ "getContentProviderData - "
+ "Error getting item value!" );
+ continue;
+ }
+
+ aInfo.URLTemplate = aValue;
+
+ // Obtain Arguments.
+ aKeyBuffer = aElemBuffer;
+ aKeyBuffer.appendAscii( "']/Arguments" );
+
+ if ( !( xHierNameAccess->getByHierarchicalName(
+ aKeyBuffer.makeStringAndClear() ) >>= aValue ) )
+ {
+ OSL_ENSURE( false,
+ "getContentProviderData - "
+ "Error getting item value!" );
+ continue;
+ }
+
+ aInfo.Arguments = aValue;
+
+ // Append info to list.
+ rListToFill.push_back( aInfo );
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ // getByHierarchicalName
+
+ OSL_ENSURE( false,
+ "getContentProviderData - "
+ "caught NoSuchElementException!" );
+ }
+ }
+ }
+ }
+ catch ( uno::RuntimeException& )
+ {
+ OSL_ENSURE( false,
+ "getContentProviderData - caught RuntimeException!" );
+ return false;
+ }
+ catch ( uno::Exception& )
+ {
+ // createInstance, createInstanceWithArguments
+
+ OSL_ENSURE( false,
+ "getContentProviderData - caught Exception!" );
+ return false;
+ }
+
+ return true;
+}
+
+}
diff --git a/ucbhelper/source/provider/provconf.hxx b/ucbhelper/source/provider/provconf.hxx
new file mode 100644
index 000000000000..a881a88883f4
--- /dev/null
+++ b/ucbhelper/source/provider/provconf.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: provconf.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_PROVCONF_HXX_
+#define _UCBHELPER_PROFCONF_HXX_
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <ucbhelper/configureucb.hxx>
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XMultiServiceFactory;
+} } } }
+
+//=========================================================================
+
+namespace ucbhelper {
+
+bool getContentProviderData( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >
+ & rServiceMgr,
+ const rtl::OUString & rKey1,
+ const rtl::OUString & rKey2,
+ ContentProviderDataList & rListToFill );
+
+}
+
+#endif /* !_UCBHELPER_PROVCONF_HXX_ */
diff --git a/ucbhelper/source/provider/providerhelper.cxx b/ucbhelper/source/provider/providerhelper.cxx
new file mode 100644
index 000000000000..ebbf47e5a422
--- /dev/null
+++ b/ucbhelper/source/provider/providerhelper.cxx
@@ -0,0 +1,675 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: providerhelper.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#include <hash_map>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp>
+#include <com/sun/star/ucb/XPropertySetRegistry.hpp>
+
+#include "osl/diagnose.h"
+#include "osl/mutex.hxx"
+#include "cppuhelper/weakref.hxx"
+#include <ucbhelper/contentidentifier.hxx>
+#include <ucbhelper/providerhelper.hxx>
+#include <ucbhelper/contenthelper.hxx>
+
+using namespace com::sun::star;
+
+namespace ucbhelper_impl
+{
+
+//=========================================================================
+//
+// Contents.
+//
+//=========================================================================
+
+struct equalString
+{
+ bool operator()(
+ const rtl::OUString& rKey11, const rtl::OUString& rKey22 ) const
+ {
+ return !!( rKey11 == rKey22 );
+ }
+};
+
+struct hashString
+{
+ size_t operator()( const rtl::OUString & rName ) const
+ {
+ return rName.hashCode();
+ }
+};
+
+typedef std::hash_map
+<
+ rtl::OUString,
+ uno::WeakReference< ucb::XContent >,
+ hashString,
+ equalString
+>
+Contents;
+
+//=========================================================================
+//
+// struct ContentProviderImplHelper_Impl.
+//
+//=========================================================================
+
+struct ContentProviderImplHelper_Impl
+{
+ uno::Reference< com::sun::star::ucb::XPropertySetRegistry >
+ m_xPropertySetRegistry;
+ Contents
+ m_aContents;
+};
+
+} // namespace ucbhelper_impl
+
+//=========================================================================
+//=========================================================================
+//
+// ContentProviderImplHelper Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+namespace ucbhelper {
+
+ContentProviderImplHelper::ContentProviderImplHelper(
+ const uno::Reference< lang::XMultiServiceFactory >& rXSMgr )
+: m_pImpl( new ucbhelper_impl::ContentProviderImplHelper_Impl ),
+ m_xSMgr( rXSMgr )
+{
+}
+
+//=========================================================================
+// virtual
+ContentProviderImplHelper::~ContentProviderImplHelper()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_3( ContentProviderImplHelper,
+ lang::XTypeProvider,
+ lang::XServiceInfo,
+ com::sun::star::ucb::XContentProvider );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_3( ContentProviderImplHelper,
+ lang::XTypeProvider,
+ lang::XServiceInfo,
+ com::sun::star::ucb::XContentProvider );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL ContentProviderImplHelper::supportsService(
+ const rtl::OUString& ServiceName )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aSNL = getSupportedServiceNames();
+ const rtl::OUString* pArray = aSNL.getConstArray();
+ for ( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ {
+ if ( pArray[ i ] == ServiceName )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+//=========================================================================
+//
+// XContentProvider methods.
+//
+//=========================================================================
+
+// virtual
+sal_Int32 SAL_CALL ContentProviderImplHelper::compareContentIds(
+ const uno::Reference< com::sun::star::ucb::XContentIdentifier >& Id1,
+ const uno::Reference< com::sun::star::ucb::XContentIdentifier >& Id2 )
+ throw( uno::RuntimeException )
+{
+ // Simply do a string compare.
+
+ rtl::OUString aURL1( Id1->getContentIdentifier() );
+ rtl::OUString aURL2( Id2->getContentIdentifier() );
+
+ return aURL1.compareTo( aURL2 );;
+}
+
+//=========================================================================
+//
+// Non-interface methods
+//
+//=========================================================================
+
+void ContentProviderImplHelper::cleanupRegisteredContents()
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ ucbhelper_impl::Contents::iterator it
+ = m_pImpl->m_aContents.begin();
+ while( it != m_pImpl->m_aContents.end() )
+ {
+ uno::Reference< ucb::XContent > xContent( (*it).second );
+ if ( !xContent.is() )
+ {
+ ucbhelper_impl::Contents::iterator tmp = it;
+ ++it;
+ m_pImpl->m_aContents.erase( tmp );
+ }
+ else
+ {
+ ++it;
+ }
+ }
+}
+
+//=========================================================================
+
+void ContentProviderImplHelper::removeContent( ContentImplHelper* pContent )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ cleanupRegisteredContents();
+
+ const rtl::OUString aURL(
+ pContent->getIdentifier()->getContentIdentifier() );
+
+ ucbhelper_impl::Contents::iterator it = m_pImpl->m_aContents.find( aURL );
+
+ if ( it != m_pImpl->m_aContents.end() )
+ m_pImpl->m_aContents.erase( it );
+}
+
+//=========================================================================
+rtl::Reference< ContentImplHelper >
+ContentProviderImplHelper::queryExistingContent(
+ const uno::Reference< com::sun::star::ucb::XContentIdentifier >&
+ Identifier )
+{
+ return queryExistingContent( Identifier->getContentIdentifier() );
+}
+
+//=========================================================================
+rtl::Reference< ContentImplHelper >
+ContentProviderImplHelper::queryExistingContent( const rtl::OUString& rURL )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ cleanupRegisteredContents();
+
+ // Check, if a content with given id already exists...
+
+ ucbhelper_impl::Contents::const_iterator it
+ = m_pImpl->m_aContents.find( rURL );
+ if ( it != m_pImpl->m_aContents.end() )
+ {
+ uno::Reference< ucb::XContent > xContent( (*it).second );
+ if ( xContent.is() )
+ {
+ return rtl::Reference< ContentImplHelper >(
+ static_cast< ContentImplHelper * >( xContent.get() ) );
+ }
+ }
+ return rtl::Reference< ContentImplHelper >();
+}
+
+//=========================================================================
+void ContentProviderImplHelper::queryExistingContents(
+ ContentRefList& rContents )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ cleanupRegisteredContents();
+
+ ucbhelper_impl::Contents::const_iterator it
+ = m_pImpl->m_aContents.begin();
+ ucbhelper_impl::Contents::const_iterator end
+ = m_pImpl->m_aContents.end();
+
+ while ( it != end )
+ {
+ uno::Reference< ucb::XContent > xContent( (*it).second );
+ if ( xContent.is() )
+ {
+ rContents.push_back(
+ rtl::Reference< ContentImplHelper >(
+ static_cast< ContentImplHelper * >( xContent.get() ) ) );
+ }
+ ++it;
+ }
+}
+
+//=========================================================================
+void ContentProviderImplHelper::registerNewContent(
+ const uno::Reference< ucb::XContent > & xContent )
+{
+ if ( xContent.is() )
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+
+ cleanupRegisteredContents();
+
+ const rtl::OUString aURL(
+ xContent->getIdentifier()->getContentIdentifier() );
+ ucbhelper_impl::Contents::const_iterator it
+ = m_pImpl->m_aContents.find( aURL );
+ if ( it == m_pImpl->m_aContents.end() )
+ m_pImpl->m_aContents[ aURL ] = xContent;
+ }
+}
+
+//=========================================================================
+uno::Reference< com::sun::star::ucb::XPropertySetRegistry >
+ContentProviderImplHelper::getAdditionalPropertySetRegistry()
+{
+ // Get propertyset registry.
+
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pImpl->m_xPropertySetRegistry.is() )
+ {
+ uno::Reference< com::sun::star::ucb::XPropertySetRegistryFactory >
+ xRegFac(
+ m_xSMgr->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.ucb.Store" ) ),
+ uno::UNO_QUERY );
+
+ OSL_ENSURE( xRegFac.is(),
+ "ContentProviderImplHelper::getAdditionalPropertySet - "
+ "No UCB-Store service!" );
+
+ if ( xRegFac.is() )
+ {
+ // Open/create a registry.
+ m_pImpl->m_xPropertySetRegistry
+ = xRegFac->createPropertySetRegistry( rtl::OUString() );
+
+ OSL_ENSURE( m_pImpl->m_xPropertySetRegistry.is(),
+ "ContentProviderImplHelper::getAdditionalPropertySet - "
+ "Error opening registry!" );
+ }
+ }
+
+ return m_pImpl->m_xPropertySetRegistry;
+}
+
+
+//=========================================================================
+uno::Reference< com::sun::star::ucb::XPersistentPropertySet >
+ContentProviderImplHelper::getAdditionalPropertySet(
+ const rtl::OUString& rKey, sal_Bool bCreate )
+{
+ // Get propertyset registry.
+ getAdditionalPropertySetRegistry();
+
+ if ( m_pImpl->m_xPropertySetRegistry.is() )
+ {
+ // Open/create persistent property set.
+ return uno::Reference< com::sun::star::ucb::XPersistentPropertySet >(
+ m_pImpl->m_xPropertySetRegistry->openPropertySet(
+ rKey, bCreate ) );
+ }
+
+ return uno::Reference< com::sun::star::ucb::XPersistentPropertySet >();
+}
+
+//=========================================================================
+sal_Bool ContentProviderImplHelper::renameAdditionalPropertySet(
+ const rtl::OUString& rOldKey,
+ const rtl::OUString& rNewKey,
+ sal_Bool bRecursive )
+{
+ if ( rOldKey == rNewKey )
+ return sal_True;
+
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( bRecursive )
+ {
+ // Get propertyset registry.
+ getAdditionalPropertySetRegistry();
+
+ if ( m_pImpl->m_xPropertySetRegistry.is() )
+ {
+ uno::Reference< container::XNameAccess > xNameAccess(
+ m_pImpl->m_xPropertySetRegistry, uno::UNO_QUERY );
+ if ( xNameAccess.is() )
+ {
+ uno::Sequence< rtl::OUString > aKeys
+ = xNameAccess->getElementNames();
+ sal_Int32 nCount = aKeys.getLength();
+ if ( nCount > 0 )
+ {
+ rtl::OUString aOldKeyWithSlash = rOldKey;
+ rtl::OUString aOldKeyWithoutSlash;
+ if ( aOldKeyWithSlash.lastIndexOf(
+ sal_Unicode('/')
+ != aOldKeyWithSlash.getLength() - 1 ) )
+ {
+ aOldKeyWithSlash += rtl::OUString( sal_Unicode('/') );
+ aOldKeyWithoutSlash = rOldKey;
+ }
+ else if ( rOldKey.getLength() )
+ aOldKeyWithoutSlash
+ = rOldKey.copy( 0, rOldKey.getLength() - 1 );
+
+ const rtl::OUString* pKeys = aKeys.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const rtl::OUString& rKey = pKeys[ n ];
+ if ( rKey.compareTo(
+ aOldKeyWithSlash,
+ aOldKeyWithSlash.getLength() ) == 0
+ || rKey.equals( aOldKeyWithoutSlash ) )
+ {
+ rtl::OUString aNewKey
+ = rKey.replaceAt(
+ 0, rOldKey.getLength(), rNewKey );
+ if ( !renameAdditionalPropertySet(
+ rKey, aNewKey, sal_False ) )
+ return sal_False;
+ }
+ }
+ }
+ }
+ else
+ return sal_False;
+ }
+ else
+ return sal_False;
+ }
+ else
+ {
+ // Get old property set, if exists.
+ uno::Reference< com::sun::star::ucb::XPersistentPropertySet > xOldSet
+ = getAdditionalPropertySet( rOldKey, sal_False );
+ if ( xOldSet.is() )
+ {
+ // Rename property set.
+ uno::Reference< container::XNamed > xNamed(
+ xOldSet, uno::UNO_QUERY );
+ if ( xNamed.is() )
+ {
+ // ??? throws no exceptions and has no return value ???
+ xNamed->setName( rNewKey );
+ }
+ else
+ return sal_False;
+ }
+ }
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool ContentProviderImplHelper::copyAdditionalPropertySet(
+ const rtl::OUString& rSourceKey,
+ const rtl::OUString& rTargetKey,
+ sal_Bool bRecursive )
+{
+ if ( rSourceKey == rTargetKey )
+ return sal_True;
+
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( bRecursive )
+ {
+ // Get propertyset registry.
+ getAdditionalPropertySetRegistry();
+
+ if ( m_pImpl->m_xPropertySetRegistry.is() )
+ {
+ uno::Reference< container::XNameAccess > xNameAccess(
+ m_pImpl->m_xPropertySetRegistry, uno::UNO_QUERY );
+ if ( xNameAccess.is() )
+ {
+ uno::Sequence< rtl::OUString > aKeys
+ = xNameAccess->getElementNames();
+ sal_Int32 nCount = aKeys.getLength();
+ if ( nCount > 0 )
+ {
+ rtl::OUString aSrcKeyWithSlash = rSourceKey;
+ rtl::OUString aSrcKeyWithoutSlash;
+ if ( aSrcKeyWithSlash.lastIndexOf(
+ sal_Unicode('/')
+ != aSrcKeyWithSlash.getLength() - 1 ) )
+ {
+ aSrcKeyWithSlash += rtl::OUString( sal_Unicode('/') );
+ aSrcKeyWithoutSlash = rSourceKey;
+ }
+ else if ( rSourceKey.getLength() )
+ aSrcKeyWithoutSlash = rSourceKey.copy(
+ 0, rSourceKey.getLength() - 1 );
+
+ const rtl::OUString* pKeys = aKeys.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const rtl::OUString& rKey = pKeys[ n ];
+ if ( rKey.compareTo(
+ aSrcKeyWithSlash,
+ aSrcKeyWithSlash.getLength() ) == 0
+ || rKey.equals( aSrcKeyWithoutSlash ) )
+ {
+ rtl::OUString aNewKey
+ = rKey.replaceAt(
+ 0, rSourceKey.getLength(), rTargetKey );
+ if ( !copyAdditionalPropertySet(
+ rKey, aNewKey, sal_False ) )
+ return sal_False;
+ }
+ }
+ }
+ }
+ else
+ return sal_False;
+ }
+ else
+ return sal_False;
+ }
+ else
+ {
+ // Get old property set, if exists.
+ uno::Reference< com::sun::star::ucb::XPersistentPropertySet >
+ xOldPropSet = getAdditionalPropertySet( rSourceKey, sal_False );
+ if ( !xOldPropSet.is() )
+ return sal_False;
+
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo
+ = xOldPropSet->getPropertySetInfo();
+ if ( !xPropSetInfo.is() )
+ return sal_False;
+
+ uno::Reference< beans::XPropertyAccess > xOldPropAccess(
+ xOldPropSet, uno::UNO_QUERY );
+ if ( !xOldPropAccess.is() )
+ return sal_False;
+
+ // Obtain all values from old set.
+ uno::Sequence< beans::PropertyValue > aValues
+ = xOldPropAccess->getPropertyValues();
+ sal_Int32 nCount = aValues.getLength();
+
+ uno::Sequence< beans::Property > aProps
+ = xPropSetInfo->getProperties();
+
+ if ( nCount )
+ {
+ // Fail, if property set with new key already exists.
+ uno::Reference< com::sun::star::ucb::XPersistentPropertySet >
+ xNewPropSet
+ = getAdditionalPropertySet( rTargetKey, sal_False );
+ if ( xNewPropSet.is() )
+ return sal_False;
+
+ // Create new, empty set.
+ xNewPropSet = getAdditionalPropertySet( rTargetKey, sal_True );
+ if ( !xNewPropSet.is() )
+ return sal_False;
+
+ uno::Reference< beans::XPropertyContainer > xNewPropContainer(
+ xNewPropSet, uno::UNO_QUERY );
+ if ( !xNewPropContainer.is() )
+ return sal_False;
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const beans::PropertyValue& rValue = aValues[ n ];
+
+ sal_Int16 nAttribs = 0;
+ for ( sal_Int32 m = 0; m < aProps.getLength(); ++m )
+ {
+ if ( aProps[ m ].Name == rValue.Name )
+ {
+ nAttribs = aProps[ m ].Attributes;
+ break;
+ }
+ }
+
+ try
+ {
+ xNewPropContainer->addProperty(
+ rValue.Name, nAttribs, rValue.Value );
+ }
+ catch ( beans::PropertyExistException & )
+ {
+ }
+ catch ( beans::IllegalTypeException & )
+ {
+ }
+ catch ( lang::IllegalArgumentException & )
+ {
+ }
+ }
+ }
+ }
+ return sal_True;
+}
+
+//=========================================================================
+sal_Bool ContentProviderImplHelper::removeAdditionalPropertySet(
+ const rtl::OUString& rKey, sal_Bool bRecursive )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( bRecursive )
+ {
+ // Get propertyset registry.
+ getAdditionalPropertySetRegistry();
+
+ if ( m_pImpl->m_xPropertySetRegistry.is() )
+ {
+ uno::Reference< container::XNameAccess > xNameAccess(
+ m_pImpl->m_xPropertySetRegistry, uno::UNO_QUERY );
+ if ( xNameAccess.is() )
+ {
+ uno::Sequence< rtl::OUString > aKeys
+ = xNameAccess->getElementNames();
+ sal_Int32 nCount = aKeys.getLength();
+ if ( nCount > 0 )
+ {
+ rtl::OUString aKeyWithSlash = rKey;
+ rtl::OUString aKeyWithoutSlash;
+ if ( aKeyWithSlash.lastIndexOf(
+ sal_Unicode('/')
+ != aKeyWithSlash.getLength() - 1 ) )
+ {
+ aKeyWithSlash += rtl::OUString( (sal_Unicode)'/' );
+ aKeyWithoutSlash = rKey;
+ }
+ else if ( rKey.getLength() )
+ aKeyWithoutSlash
+ = rKey.copy( 0, rKey.getLength() - 1 );
+
+ const rtl::OUString* pKeys = aKeys.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const rtl::OUString& rCurrKey = pKeys[ n ];
+ if ( rCurrKey.compareTo(
+ aKeyWithSlash,
+ aKeyWithSlash.getLength() ) == 0
+ || rCurrKey.equals( aKeyWithoutSlash ) )
+ {
+ if ( !removeAdditionalPropertySet(
+ rCurrKey, sal_False ) )
+ return sal_False;
+ }
+ }
+ }
+ }
+ else
+ return sal_False;
+ }
+ else
+ return sal_False;
+ }
+ else
+ {
+ // Get propertyset registry.
+ getAdditionalPropertySetRegistry();
+
+ if ( m_pImpl->m_xPropertySetRegistry.is() )
+ m_pImpl->m_xPropertySetRegistry->removePropertySet( rKey );
+ else
+ return sal_False;
+ }
+ return sal_True;
+}
+
+} // namespace ucbhelper
diff --git a/ucbhelper/source/provider/registerucb.cxx b/ucbhelper/source/provider/registerucb.cxx
new file mode 100644
index 000000000000..584aa21561e0
--- /dev/null
+++ b/ucbhelper/source/provider/registerucb.cxx
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: registerucb.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+#include <registerucb.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#include <com/sun/star/ucb/XParameterizedContentProvider.hpp>
+#include <com/sun/star/ucb/XContentProviderFactory.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+
+#include "osl/diagnose.h"
+#include <ucbhelper/configureucb.hxx>
+
+using namespace com::sun::star;
+
+namespace ucbhelper {
+
+//============================================================================
+//
+// registerAtUcb
+//
+//============================================================================
+
+bool
+registerAtUcb(
+ uno::Reference< ucb::XContentProviderManager > const & rManager,
+ uno::Reference< lang::XMultiServiceFactory > const & rServiceFactory,
+ rtl::OUString const & rName,
+ rtl::OUString const & rArguments,
+ rtl::OUString const & rTemplate,
+ ContentProviderRegistrationInfo * pInfo)
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(rServiceFactory.is(),
+ "ucb::registerAtUcb(): No service factory");
+
+ bool bNoProxy
+ = rArguments.compareToAscii(RTL_CONSTASCII_STRINGPARAM("{noproxy}"))
+ == 0;
+ rtl::OUString
+ aProviderArguments(bNoProxy ?
+ rArguments.
+ copy(RTL_CONSTASCII_LENGTH("{noproxy}")) :
+ rArguments);
+
+ // First, try to instantiate proxy for provider:
+ uno::Reference< ucb::XContentProvider > xProvider;
+ if (!bNoProxy)
+ {
+ uno::Reference< ucb::XContentProviderFactory > xProxyFactory;
+ try
+ {
+ xProxyFactory
+ = uno::Reference< ucb::XContentProviderFactory >(
+ rServiceFactory->
+ createInstance(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.ucb.ContentProviderProxyFactory"))),
+ uno::UNO_QUERY);
+ }
+ catch (uno::Exception const &) {}
+ OSL_ENSURE(xProxyFactory.is(), "No ContentProviderProxyFactory");
+ if (xProxyFactory.is())
+ xProvider = xProxyFactory->createContentProvider(rName);
+ }
+
+ // Then, try to instantiate provider directly:
+ if (!xProvider.is())
+ try
+ {
+ xProvider = uno::Reference< ucb::XContentProvider >(
+ rServiceFactory->createInstance(rName),
+ uno::UNO_QUERY);
+ }
+ catch (uno::RuntimeException const &) { throw; }
+ catch (uno::Exception const &) {}
+
+ uno::Reference< ucb::XContentProvider >
+ xOriginalProvider(xProvider);
+ uno::Reference< ucb::XParameterizedContentProvider >
+ xParameterized(xProvider, uno::UNO_QUERY);
+ if (xParameterized.is())
+ {
+ uno::Reference< ucb::XContentProvider > xInstance;
+ try
+ {
+ xInstance = xParameterized->registerInstance(rTemplate,
+ aProviderArguments,
+ true);
+ //@@@ if this call replaces an old instance, the commit-or-
+ // rollback code below will not work
+ }
+ catch (lang::IllegalArgumentException const &) {}
+
+ if (xInstance.is())
+ xProvider = xInstance;
+ }
+
+ bool bSuccess = false;
+ if (rManager.is() && xProvider.is())
+ try
+ {
+ rManager->registerContentProvider(xProvider, rTemplate, true);
+ bSuccess = true;
+ }
+ catch (ucb::DuplicateProviderException const &)
+ {
+ if (xParameterized.is())
+ try
+ {
+ xParameterized->deregisterInstance(rTemplate,
+ aProviderArguments);
+ }
+ catch (lang::IllegalArgumentException const &) {}
+ }
+ catch (...)
+ {
+ if (xParameterized.is())
+ try
+ {
+ xParameterized->deregisterInstance(rTemplate,
+ aProviderArguments);
+ }
+ catch (lang::IllegalArgumentException const &) {}
+ catch (uno::RuntimeException const &) {}
+ throw;
+ }
+
+ if (bSuccess && pInfo)
+ {
+ pInfo->m_xProvider = xOriginalProvider;
+ pInfo->m_aArguments = aProviderArguments;
+ pInfo->m_aTemplate = rTemplate;
+ }
+ return bSuccess;
+}
+
+//============================================================================
+//
+// deregisterFromUcb
+//
+//============================================================================
+
+void
+deregisterFromUcb(
+ uno::Reference< ucb::XContentProviderManager > const & rManager,
+ ContentProviderRegistrationInfo const & rInfo)
+ throw (uno::RuntimeException)
+{
+ uno::Reference< ucb::XContentProvider >
+ xProvider(rInfo.m_xProvider);
+ uno::Reference< ucb::XParameterizedContentProvider >
+ xParameterized(xProvider, uno::UNO_QUERY);
+ if (xParameterized.is())
+ {
+ uno::Reference< ucb::XContentProvider > xInstance;
+ try
+ {
+ xInstance
+ = xParameterized->deregisterInstance(rInfo.m_aTemplate,
+ rInfo.m_aArguments);
+ }
+ catch (lang::IllegalArgumentException const &) {}
+
+ if (xInstance.is())
+ xProvider = xInstance;
+ }
+
+ if (rManager.is())
+ rManager->deregisterContentProvider(xProvider, rInfo.m_aTemplate);
+ //@@@ if this fails, a roll-back of deregisterInstance() is
+ // missing
+}
+
+}
diff --git a/ucbhelper/source/provider/registerucb.hxx b/ucbhelper/source/provider/registerucb.hxx
new file mode 100644
index 000000000000..f345d774dcfd
--- /dev/null
+++ b/ucbhelper/source/provider/registerucb.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: registerucb.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UCBHELPER_REGISTERUCB_HXX_
+#define _UCBHELPER_REGISTERUCB_HXX_
+
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Reference.h>
+
+namespace com { namespace sun { namespace star {
+ namespace lang { class XMultiServiceFactory; }
+ namespace ucb { class XContentProviderManager; }
+} } }
+namespace rtl { class OUString; }
+
+namespace ucbhelper {
+
+struct ContentProviderRegistrationInfo;
+
+//============================================================================
+/** Register a content provider at a Universal Content Broker.
+
+ @param rManager A content provider manager (normally, this would be a
+ UCB). May be null, which is only useful if the content provider is an
+ <type>XParamterizedContentProvider</type>s.
+
+ @param rServiceFactory A factory through which to obtain the required
+ services.
+
+ @param rName The service name of the content provider.
+
+ @param rArguments Any arguments to instantiate the content provider with.
+
+ @param rTemplate The URL template to register the content provider on.
+
+ @param pInfo If not null, this output parameter is filled with
+ information about the (atemptively) registered provider.
+ */
+bool
+registerAtUcb(
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentProviderManager > const &
+ rManager,
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const &
+ rServiceFactory,
+ rtl::OUString const & rName,
+ rtl::OUString const & rArguments,
+ rtl::OUString const & rTemplate,
+ ContentProviderRegistrationInfo * pInfo)
+ throw (com::sun::star::uno::RuntimeException);
+
+//============================================================================
+/** Deregister a content provider from a Universal Content Broker.
+
+ @param rManager A content provider manager (normally, this would be a
+ UCB). May be null, which is only useful if the content provider is an
+ <type>XParamterizedContentProvider</type>s.
+
+ @param rInfo Information about the content provider to deregister.
+ */
+void
+deregisterFromUcb(
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentProviderManager > const &
+ rManager,
+ ContentProviderRegistrationInfo const & rInfo)
+ throw (com::sun::star::uno::RuntimeException);
+
+}
+
+#endif // _UCBHELPER_REGISTERUCB_HXX_
diff --git a/ucbhelper/source/provider/resultset.cxx b/ucbhelper/source/provider/resultset.cxx
new file mode 100644
index 000000000000..8b1a1d8b6d92
--- /dev/null
+++ b/ucbhelper/source/provider/resultset.cxx
@@ -0,0 +1,1698 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: resultset.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <ucbhelper/resultset.hxx>
+#include <ucbhelper/resultsetmetadata.hxx>
+
+using namespace com::sun::star;
+
+//=========================================================================
+
+namespace ucbhelper_impl
+{
+
+struct PropertyInfo
+{
+ const char* pName;
+ sal_Int32 nHandle;
+ sal_Int16 nAttributes;
+ const uno::Type& (*pGetCppuType)();
+};
+
+static const uno::Type& sal_Int32_getCppuType()
+{
+ return getCppuType( static_cast< const sal_Int32 * >( 0 ) );
+}
+
+static const uno::Type& sal_Bool_getCppuType()
+{
+ return getCppuBooleanType();
+}
+
+static const PropertyInfo aPropertyTable[] =
+{
+ { "IsRowCountFinal",
+ 1000,
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY,
+ &sal_Bool_getCppuType
+ },
+ { "RowCount",
+ 1001,
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY,
+ &sal_Int32_getCppuType
+ },
+ { 0,
+ 0,
+ 0,
+ 0
+ }
+};
+
+#define RESULTSET_PROPERTY_COUNT 2
+
+//=========================================================================
+//
+// class PropertySetInfo
+//
+//=========================================================================
+
+class PropertySetInfo :
+ public cppu::OWeakObject,
+ public lang::XTypeProvider,
+ public beans::XPropertySetInfo
+{
+ uno::Reference< lang::XMultiServiceFactory > m_xSMgr;
+ uno::Sequence< beans::Property >* m_pProps;
+
+private:
+ sal_Bool queryProperty(
+ const rtl::OUString& aName, beans::Property& rProp );
+
+public:
+ PropertySetInfo(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ const PropertyInfo* pProps,
+ sal_Int32 nProps );
+ virtual ~PropertySetInfo();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XPropertySetInfo
+ virtual uno::Sequence< beans::Property > SAL_CALL getProperties()
+ throw( uno::RuntimeException );
+ virtual beans::Property SAL_CALL getPropertyByName(
+ const rtl::OUString& aName )
+ throw( beans::UnknownPropertyException, uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasPropertyByName( const rtl::OUString& Name )
+ throw( uno::RuntimeException );
+};
+
+//=========================================================================
+//
+// PropertyChangeListenerContainer.
+//
+//=========================================================================
+
+struct equalStr_Impl
+{
+ bool operator()( const rtl::OUString& s1, const rtl::OUString& s2 ) const
+ {
+ return !!( s1 == s2 );
+ }
+};
+
+struct hashStr_Impl
+{
+ size_t operator()( const rtl::OUString& rName ) const
+ {
+ return rName.hashCode();
+ }
+};
+
+typedef cppu::OMultiTypeInterfaceContainerHelperVar
+<
+ rtl::OUString,
+ hashStr_Impl,
+ equalStr_Impl
+> PropertyChangeListenerContainer;
+
+//=========================================================================
+//
+// class PropertyChangeListeners.
+//
+//=========================================================================
+
+class PropertyChangeListeners : public PropertyChangeListenerContainer
+{
+public:
+ PropertyChangeListeners( osl::Mutex& rMtx )
+ : PropertyChangeListenerContainer( rMtx ) {}
+};
+
+} // namespace ucbhelper_impl
+
+using namespace ucbhelper_impl;
+
+namespace ucbhelper
+{
+
+//=========================================================================
+//
+// struct ResultSet_Impl.
+//
+//=========================================================================
+
+struct ResultSet_Impl
+{
+ uno::Reference< lang::XMultiServiceFactory > m_xSMgr;
+ uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xEnv;
+ uno::Reference< beans::XPropertySetInfo > m_xPropSetInfo;
+ uno::Reference< sdbc::XResultSetMetaData > m_xMetaData;
+ uno::Sequence< beans::Property > m_aProperties;
+ rtl::Reference< ResultSetDataSupplier > m_xDataSupplier;
+ osl::Mutex m_aMutex;
+ cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
+ PropertyChangeListeners* m_pPropertyChangeListeners;
+ sal_Int32 m_nPos;
+ sal_Bool m_bWasNull;
+ sal_Bool m_bAfterLast;
+
+ inline ResultSet_Impl(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ const uno::Sequence< beans::Property >& rProperties,
+ const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
+ const uno::Reference< com::sun::star::ucb::XCommandEnvironment >&
+ rxEnv );
+ inline ~ResultSet_Impl();
+};
+
+inline ResultSet_Impl::ResultSet_Impl(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ const uno::Sequence< beans::Property >& rProperties,
+ const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
+ const uno::Reference< com::sun::star::ucb::XCommandEnvironment >& rxEnv )
+: m_xSMgr( rxSMgr ),
+ m_xEnv( rxEnv ),
+ m_aProperties( rProperties ),
+ m_xDataSupplier( rDataSupplier ),
+ m_pDisposeEventListeners( 0 ),
+ m_pPropertyChangeListeners( 0 ),
+ m_nPos( 0 ), // Position is one-based. Zero means: before first element.
+ m_bWasNull( sal_False ),
+ m_bAfterLast( sal_False )
+{
+}
+
+//=========================================================================
+inline ResultSet_Impl::~ResultSet_Impl()
+{
+ delete m_pDisposeEventListeners;
+ delete m_pPropertyChangeListeners;
+}
+
+//=========================================================================
+//=========================================================================
+//
+// ResultSet Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ResultSet::ResultSet(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ const uno::Sequence< beans::Property >& rProperties,
+ const rtl::Reference< ResultSetDataSupplier >& rDataSupplier )
+: m_pImpl( new ResultSet_Impl(
+ rxSMgr,
+ rProperties,
+ rDataSupplier,
+ uno::Reference< com::sun::star::ucb::XCommandEnvironment >() ) )
+{
+ rDataSupplier->m_pResultSet = this;
+}
+
+//=========================================================================
+ResultSet::ResultSet(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ const uno::Sequence< beans::Property >& rProperties,
+ const rtl::Reference< ResultSetDataSupplier >& rDataSupplier,
+ const uno::Reference< com::sun::star::ucb::XCommandEnvironment >& rxEnv )
+: m_pImpl( new ResultSet_Impl( rxSMgr, rProperties, rDataSupplier, rxEnv ) )
+{
+ rDataSupplier->m_pResultSet = this;
+}
+
+//=========================================================================
+// virtual
+ResultSet::~ResultSet()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_9( ResultSet,
+ lang::XTypeProvider,
+ lang::XServiceInfo,
+ lang::XComponent,
+ com::sun::star::ucb::XContentAccess,
+ sdbc::XResultSet,
+ sdbc::XResultSetMetaDataSupplier,
+ sdbc::XRow,
+ sdbc::XCloseable,
+ beans::XPropertySet );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_9( ResultSet,
+ lang::XTypeProvider,
+ lang::XServiceInfo,
+ lang::XComponent,
+ com::sun::star::ucb::XContentAccess,
+ sdbc::XResultSet,
+ sdbc::XResultSetMetaDataSupplier,
+ sdbc::XRow,
+ sdbc::XCloseable,
+ beans::XPropertySet );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+XSERVICEINFO_NOFACTORY_IMPL_1( ResultSet,
+ rtl::OUString::createFromAscii( "ResultSet" ),
+ rtl::OUString::createFromAscii( RESULTSET_SERVICE_NAME ) );
+
+//=========================================================================
+//
+// XComponent methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ResultSet::dispose()
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_pDisposeEventListeners &&
+ m_pImpl->m_pDisposeEventListeners->getLength() )
+ {
+ lang::EventObject aEvt;
+ aEvt.Source = static_cast< lang::XComponent * >( this );
+ m_pImpl->m_pDisposeEventListeners->disposeAndClear( aEvt );
+ }
+
+ if ( m_pImpl->m_pPropertyChangeListeners )
+ {
+ lang::EventObject aEvt;
+ aEvt.Source = static_cast< beans::XPropertySet * >( this );
+ m_pImpl->m_pPropertyChangeListeners->disposeAndClear( aEvt );
+ }
+
+ m_pImpl->m_xDataSupplier->close();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::addEventListener(
+ const uno::Reference< lang::XEventListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_pDisposeEventListeners )
+ m_pImpl->m_pDisposeEventListeners =
+ new cppu::OInterfaceContainerHelper( m_pImpl->m_aMutex );
+
+ m_pImpl->m_pDisposeEventListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::removeEventListener(
+ const uno::Reference< lang::XEventListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_pDisposeEventListeners )
+ m_pImpl->m_pDisposeEventListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XResultSetMetaDataSupplier methods.
+//
+//=========================================================================
+
+// virtual
+uno::Reference< sdbc::XResultSetMetaData > SAL_CALL ResultSet::getMetaData()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_xMetaData.is() )
+ m_pImpl->m_xMetaData = new ResultSetMetaData( m_pImpl->m_xSMgr,
+ m_pImpl->m_aProperties );
+
+ return m_pImpl->m_xMetaData;
+}
+
+//=========================================================================
+//
+// XResultSet methods.
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL ResultSet::next()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ // Note: Cursor is initially positioned before the first row.
+ // First call to 'next()' moves it to first row.
+
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ // getResult works zero-based!
+ if ( !m_pImpl->m_xDataSupplier->getResult( m_pImpl->m_nPos ) )
+ {
+ m_pImpl->m_bAfterLast = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ m_pImpl->m_nPos++;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::isBeforeFirst()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ // getResult works zero-based!
+ if ( !m_pImpl->m_xDataSupplier->getResult( 0 ) )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return ( m_pImpl->m_nPos == 0 );
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::isAfterLast()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->validate();
+ return m_pImpl->m_bAfterLast;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::isFirst()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return ( m_pImpl->m_nPos == 1 );
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::isLast()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+ if ( !nCount )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return ( m_pImpl->m_nPos == nCount );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::beforeFirst()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = 0;
+ m_pImpl->m_xDataSupplier->validate();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::afterLast()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::first()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ // getResult works zero-based!
+ if ( m_pImpl->m_xDataSupplier->getResult( 0 ) )
+ {
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = 1;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::last()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+ if ( nCount )
+ {
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = nCount;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSet::getRow()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return m_pImpl->m_nPos;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::absolute( sal_Int32 row )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+/*
+ If the row number is positive, the cursor moves to the given row number
+ with respect to the beginning of the result set. The first row is row 1,
+ the second is row 2, and so on.
+
+ If the given row number is negative, the cursor moves to an absolute row
+ position with respect to the end of the result set. For example, calling
+ absolaute( -1 ) positions the cursor on the last row, absolaute( -2 )
+ indicates the next-to-last row, and so on.
+
+ An attempt to position the cursor beyond the first/last row in the result
+ set leaves the cursor before/after the first/last row, respectively.
+
+ Calling absolute( 1 ) is the same as calling first().
+
+ Calling absolute( -1 ) is the same as calling last().
+*/
+ if ( row < 0 )
+ {
+ sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+
+ if ( ( row * -1 ) > nCount )
+ {
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = 0;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+ else // |row| <= nCount
+ {
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = ( nCount + row + 1 );
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ }
+ else if ( row == 0 )
+ {
+ // @throws SQLException
+ // ... if row is 0 ...
+ throw sdbc::SQLException();
+ }
+ else // row > 0
+ {
+ sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+
+ if ( row <= nCount )
+ {
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = row;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ else // row > nCount
+ {
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+ }
+
+ // unreachable...
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::relative( sal_Int32 rows )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+/*
+ Attempting to move beyond the first/last row in the result set
+ positions the cursor before/after the the first/last row.
+
+ Calling relative( 0 ) is valid, but does not change the cursor position.
+
+ Calling relative( 1 ) is different from calling next() because it makes
+ sense to call next() when there is no current row, for example, when
+ the cursor is positioned before the first row or after the last row of
+ the result set.
+*/
+ if ( m_pImpl->m_bAfterLast || ( m_pImpl->m_nPos == 0 ) )
+ {
+ // "No current row".
+ throw sdbc::SQLException();
+ }
+
+ if ( rows < 0 )
+ {
+ if ( ( m_pImpl->m_nPos + rows ) > 0 )
+ {
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ else
+ {
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = 0;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+ }
+ else if ( rows == 0 )
+ {
+ // nop.
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ else // rows > 0
+ {
+ sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+ if ( ( m_pImpl->m_nPos + rows ) <= nCount )
+ {
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_False;
+ m_pImpl->m_nPos = ( m_pImpl->m_nPos + rows );
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+ else
+ {
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ m_pImpl->m_bAfterLast = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+ }
+ }
+
+ // unreachable...
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::previous()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+/*
+ previous() is not the same as relative( -1 ) because it makes sense
+ to call previous() when there is no current row.
+*/
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_bAfterLast )
+ {
+ m_pImpl->m_bAfterLast = sal_False;
+ sal_Int32 nCount = m_pImpl->m_xDataSupplier->totalCount();
+ m_pImpl->m_nPos = nCount;
+ }
+ else if ( m_pImpl->m_nPos )
+ m_pImpl->m_nPos--;
+
+ if ( m_pImpl->m_nPos )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_True;
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::refreshRow()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+ if ( m_pImpl->m_bAfterLast || ( m_pImpl->m_nPos == 0 ) )
+ return;
+
+ m_pImpl->m_xDataSupplier->releasePropertyValues( m_pImpl->m_nPos );
+ m_pImpl->m_xDataSupplier->validate();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::rowUpdated()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::rowInserted()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::rowDeleted()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+uno::Reference< uno::XInterface > SAL_CALL ResultSet::getStatement()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+/*
+ returns the Statement that produced this ResultSet object. If the
+ result set was generated some other way, ... this method returns null.
+*/
+ m_pImpl->m_xDataSupplier->validate();
+ return uno::Reference< uno::XInterface >();
+}
+
+//=========================================================================
+//
+// XRow methods.
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL ResultSet::wasNull()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ // This method can not be implemented correctly!!! Imagine different
+ // threads doing a getXYZ - wasNull calling sequence on the same
+ // implementation object...
+
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->wasNull();
+ }
+ }
+
+ m_pImpl->m_xDataSupplier->validate();
+ return m_pImpl->m_bWasNull;
+}
+
+//=========================================================================
+// virtual
+rtl::OUString SAL_CALL ResultSet::getString( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getString( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return rtl::OUString();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSet::getBoolean( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getBoolean( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+sal_Int8 SAL_CALL ResultSet::getByte( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getByte( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+sal_Int16 SAL_CALL ResultSet::getShort( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getShort( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSet::getInt( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getInt( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+sal_Int64 SAL_CALL ResultSet::getLong( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getLong( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+float SAL_CALL ResultSet::getFloat( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getFloat( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+double SAL_CALL ResultSet::getDouble( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getDouble( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return 0;
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< sal_Int8 > SAL_CALL
+ResultSet::getBytes( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getBytes( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return uno::Sequence< sal_Int8 >();
+}
+
+//=========================================================================
+// virtual
+util::Date SAL_CALL ResultSet::getDate( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getDate( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return util::Date();
+}
+
+//=========================================================================
+// virtual
+util::Time SAL_CALL ResultSet::getTime( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getTime( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return util::Time();
+}
+
+//=========================================================================
+// virtual
+util::DateTime SAL_CALL
+ResultSet::getTimestamp( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getTimestamp( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return util::DateTime();
+}
+
+//=========================================================================
+// virtual
+uno::Reference< io::XInputStream > SAL_CALL
+ResultSet::getBinaryStream( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getBinaryStream( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return uno::Reference< io::XInputStream >();
+}
+
+//=========================================================================
+// virtual
+uno::Reference< io::XInputStream > SAL_CALL
+ResultSet::getCharacterStream( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getCharacterStream( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return uno::Reference< io::XInputStream >();
+}
+
+//=========================================================================
+// virtual
+uno::Any SAL_CALL ResultSet::getObject(
+ sal_Int32 columnIndex,
+ const uno::Reference< container::XNameAccess >& typeMap )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getObject( columnIndex, typeMap );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return uno::Any();
+}
+
+//=========================================================================
+// virtual
+uno::Reference< sdbc::XRef > SAL_CALL
+ResultSet::getRef( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getRef( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return uno::Reference< sdbc::XRef >();
+}
+
+//=========================================================================
+// virtual
+uno::Reference< sdbc::XBlob > SAL_CALL
+ResultSet::getBlob( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getBlob( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return uno::Reference< sdbc::XBlob >();
+}
+
+//=========================================================================
+// virtual
+uno::Reference< sdbc::XClob > SAL_CALL
+ResultSet::getClob( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getClob( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return uno::Reference< sdbc::XClob >();
+}
+
+//=========================================================================
+// virtual
+uno::Reference< sdbc::XArray > SAL_CALL
+ResultSet::getArray( sal_Int32 columnIndex )
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ {
+ uno::Reference< sdbc::XRow > xValues
+ = m_pImpl->m_xDataSupplier->queryPropertyValues(
+ m_pImpl->m_nPos - 1 );
+ if ( xValues.is() )
+ {
+ m_pImpl->m_bWasNull = sal_False;
+ m_pImpl->m_xDataSupplier->validate();
+ return xValues->getArray( columnIndex );
+ }
+ }
+
+ m_pImpl->m_bWasNull = sal_True;
+ m_pImpl->m_xDataSupplier->validate();
+ return uno::Reference< sdbc::XArray >();
+}
+
+//=========================================================================
+//
+// XCloseable methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ResultSet::close()
+ throw( sdbc::SQLException, uno::RuntimeException )
+{
+ m_pImpl->m_xDataSupplier->close();
+ m_pImpl->m_xDataSupplier->validate();
+}
+
+//=========================================================================
+//
+// XContentAccess methods.
+//
+//=========================================================================
+
+// virtual
+rtl::OUString SAL_CALL ResultSet::queryContentIdentifierString()
+ throw( uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ return m_pImpl->m_xDataSupplier->queryContentIdentifierString(
+ m_pImpl->m_nPos - 1 );
+
+ return rtl::OUString();
+}
+
+//=========================================================================
+// virtual
+uno::Reference< com::sun::star::ucb::XContentIdentifier > SAL_CALL
+ResultSet::queryContentIdentifier()
+ throw( uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ return m_pImpl->m_xDataSupplier->queryContentIdentifier(
+ m_pImpl->m_nPos - 1 );
+
+ return uno::Reference< com::sun::star::ucb::XContentIdentifier >();
+}
+
+//=========================================================================
+// virtual
+uno::Reference< com::sun::star::ucb::XContent > SAL_CALL
+ResultSet::queryContent()
+ throw( uno::RuntimeException )
+{
+ if ( m_pImpl->m_nPos && !m_pImpl->m_bAfterLast )
+ return m_pImpl->m_xDataSupplier->queryContent( m_pImpl->m_nPos - 1 );
+
+ return uno::Reference< com::sun::star::ucb::XContent >();
+}
+
+//=========================================================================
+//
+// XPropertySet methods.
+//
+//=========================================================================
+
+// virtual
+uno::Reference< beans::XPropertySetInfo > SAL_CALL
+ResultSet::getPropertySetInfo()
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_xPropSetInfo.is() )
+ m_pImpl->m_xPropSetInfo
+ = new PropertySetInfo( m_pImpl->m_xSMgr,
+ aPropertyTable,
+ RESULTSET_PROPERTY_COUNT );
+ return m_pImpl->m_xPropSetInfo;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::setPropertyValue( const rtl::OUString& aPropertyName,
+ const uno::Any& )
+ throw( beans::UnknownPropertyException,
+ beans::PropertyVetoException,
+ lang::IllegalArgumentException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ if ( !aPropertyName.getLength() )
+ throw beans::UnknownPropertyException();
+
+ if ( aPropertyName.equals(
+ rtl::OUString::createFromAscii( "RowCount" ) ) )
+ {
+ // property is read-only.
+ throw lang::IllegalArgumentException();
+ }
+ else if ( aPropertyName.equals(
+ rtl::OUString::createFromAscii( "IsRowCountFinal" ) ) )
+ {
+ // property is read-only.
+ throw lang::IllegalArgumentException();
+ }
+ else
+ {
+ throw beans::UnknownPropertyException();
+ }
+}
+
+//=========================================================================
+// virtual
+uno::Any SAL_CALL ResultSet::getPropertyValue(
+ const rtl::OUString& PropertyName )
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ if ( !PropertyName.getLength() )
+ throw beans::UnknownPropertyException();
+
+ uno::Any aValue;
+
+ if ( PropertyName.equals(
+ rtl::OUString::createFromAscii( "RowCount" ) ) )
+ {
+ aValue <<= m_pImpl->m_xDataSupplier->currentCount();
+ }
+ else if ( PropertyName.equals(
+ rtl::OUString::createFromAscii( "IsRowCountFinal" ) ) )
+ {
+ aValue <<= m_pImpl->m_xDataSupplier->isCountFinal();
+ }
+ else
+ {
+ throw beans::UnknownPropertyException();
+ }
+
+ return aValue;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::addPropertyChangeListener(
+ const rtl::OUString& aPropertyName,
+ const uno::Reference< beans::XPropertyChangeListener >& xListener )
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ // Note: An empty property name means a listener for "all" properties.
+
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ if ( aPropertyName.getLength() &&
+ !aPropertyName.equals(
+ rtl::OUString::createFromAscii( "RowCount" ) ) &&
+ !aPropertyName.equals(
+ rtl::OUString::createFromAscii( "IsRowCountFinal" ) ) )
+ throw beans::UnknownPropertyException();
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ m_pImpl->m_pPropertyChangeListeners
+ = new PropertyChangeListeners( m_pImpl->m_aMutex );
+
+ m_pImpl->m_pPropertyChangeListeners->addInterface(
+ aPropertyName, xListener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::removePropertyChangeListener(
+ const rtl::OUString& aPropertyName,
+ const uno::Reference< beans::XPropertyChangeListener >& xListener )
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ if ( aPropertyName.getLength() &&
+ !aPropertyName.equals(
+ rtl::OUString::createFromAscii( "RowCount" ) ) &&
+ !aPropertyName.equals(
+ rtl::OUString::createFromAscii( "IsRowCountFinal" ) ) )
+ throw beans::UnknownPropertyException();
+
+ if ( m_pImpl->m_pPropertyChangeListeners )
+ m_pImpl->m_pPropertyChangeListeners->removeInterface(
+ aPropertyName, xListener );
+
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::addVetoableChangeListener(
+ const rtl::OUString&,
+ const uno::Reference< beans::XVetoableChangeListener >& )
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ // No constrained props, at the moment.
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSet::removeVetoableChangeListener(
+ const rtl::OUString&,
+ const uno::Reference< beans::XVetoableChangeListener >& )
+ throw( beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ // No constrained props, at the moment.
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+void ResultSet::propertyChanged( const beans::PropertyChangeEvent& rEvt )
+{
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ // Notify listeners interested especially in the changed property.
+ cppu::OInterfaceContainerHelper* pPropsContainer
+ = m_pImpl->m_pPropertyChangeListeners->getContainer(
+ rEvt.PropertyName );
+ if ( pPropsContainer )
+ {
+ cppu::OInterfaceIteratorHelper aIter( *pPropsContainer );
+ while ( aIter.hasMoreElements() )
+ {
+ uno::Reference< beans::XPropertyChangeListener > xListener(
+ aIter.next(), uno::UNO_QUERY );
+ if ( xListener.is() )
+ xListener->propertyChange( rEvt );
+ }
+ }
+
+ // Notify listeners interested in all properties.
+ pPropsContainer
+ = m_pImpl->m_pPropertyChangeListeners->getContainer( rtl::OUString() );
+ if ( pPropsContainer )
+ {
+ cppu::OInterfaceIteratorHelper aIter( *pPropsContainer );
+ while ( aIter.hasMoreElements() )
+ {
+ uno::Reference< beans::XPropertyChangeListener > xListener(
+ aIter.next(), uno::UNO_QUERY );
+ if ( xListener.is() )
+ xListener->propertyChange( rEvt );
+ }
+ }
+}
+
+//=========================================================================
+void ResultSet::rowCountChanged( sal_uInt32 nOld, sal_uInt32 nNew )
+{
+ OSL_ENSURE( nOld < nNew, "ResultSet::rowCountChanged - nOld >= nNew!" );
+
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ propertyChanged(
+ beans::PropertyChangeEvent(
+ static_cast< cppu::OWeakObject * >( this ),
+ rtl::OUString::createFromAscii( "RowCount" ),
+ sal_False,
+ 1001,
+ uno::makeAny( nOld ), // old value
+ uno::makeAny( nNew ) ) ); // new value
+}
+
+//=========================================================================
+void ResultSet::rowCountFinal()
+{
+ if ( !m_pImpl->m_pPropertyChangeListeners )
+ return;
+
+ propertyChanged(
+ beans::PropertyChangeEvent(
+ static_cast< cppu::OWeakObject * >( this ),
+ rtl::OUString::createFromAscii( "IsRowCountFinal" ),
+ sal_False,
+ 1000,
+ uno:: makeAny( sal_False ), // old value
+ uno::makeAny( sal_True ) ) ); // new value
+}
+
+//=========================================================================
+const uno::Sequence< beans::Property >& ResultSet::getProperties()
+{
+ return m_pImpl->m_aProperties;
+}
+
+//=========================================================================
+const uno::Reference< com::sun::star::ucb::XCommandEnvironment >&
+ResultSet::getEnvironment()
+{
+ return m_pImpl->m_xEnv;
+}
+
+} // namespace ucbhelper
+
+namespace ucbhelper_impl {
+
+//=========================================================================
+//=========================================================================
+//
+// PropertySetInfo Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+PropertySetInfo::PropertySetInfo(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ const PropertyInfo* pProps,
+ sal_Int32 nProps )
+: m_xSMgr( rxSMgr )
+{
+ m_pProps = new uno::Sequence< beans::Property >( nProps );
+
+ if ( nProps )
+ {
+ const PropertyInfo* pEntry = pProps;
+ beans::Property* pProperties = m_pProps->getArray();
+
+ for ( sal_Int32 n = 0; n < nProps; ++n )
+ {
+ beans::Property& rProp = pProperties[ n ];
+
+ rProp.Name = rtl::OUString::createFromAscii( pEntry->pName );
+ rProp.Handle = pEntry->nHandle;
+ rProp.Type = pEntry->pGetCppuType();
+ rProp.Attributes = pEntry->nAttributes;
+
+ pEntry++;
+ }
+ }
+}
+
+//=========================================================================
+// virtual
+PropertySetInfo::~PropertySetInfo()
+{
+ delete m_pProps;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( PropertySetInfo,
+ lang::XTypeProvider,
+ beans::XPropertySetInfo );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( PropertySetInfo,
+ lang::XTypeProvider,
+ beans::XPropertySetInfo );
+
+//=========================================================================
+//
+// XPropertySetInfo methods.
+//
+//=========================================================================
+
+// virtual
+uno::Sequence< beans::Property > SAL_CALL PropertySetInfo::getProperties()
+ throw( uno::RuntimeException )
+{
+ return uno::Sequence< beans::Property >( *m_pProps );
+}
+
+//=========================================================================
+// virtual
+beans::Property SAL_CALL PropertySetInfo::getPropertyByName(
+ const rtl::OUString& aName )
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ beans::Property aProp;
+ if ( queryProperty( aName, aProp ) )
+ return aProp;
+
+ throw beans::UnknownPropertyException();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL PropertySetInfo::hasPropertyByName(
+ const rtl::OUString& Name )
+ throw( uno::RuntimeException )
+{
+ beans::Property aProp;
+ return queryProperty( Name, aProp );
+}
+
+//=========================================================================
+sal_Bool PropertySetInfo::queryProperty(
+ const rtl::OUString& aName, beans::Property& rProp )
+{
+ sal_Int32 nCount = m_pProps->getLength();
+ const beans::Property* pProps = m_pProps->getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const beans::Property& rCurr = pProps[ n ];
+ if ( rCurr.Name == aName )
+ {
+ rProp = rCurr;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+} // namespace ucbhelper_impl
diff --git a/ucbhelper/source/provider/resultsethelper.cxx b/ucbhelper/source/provider/resultsethelper.cxx
new file mode 100644
index 000000000000..50ccc9ae86bd
--- /dev/null
+++ b/ucbhelper/source/provider/resultsethelper.cxx
@@ -0,0 +1,332 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: resultsethelper.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ - This implementation is far away from completion. It has no interface
+ for changes notifications etc.
+
+ *************************************************************************/
+#include <com/sun/star/ucb/ListActionType.hpp>
+#include <com/sun/star/ucb/WelcomeDynamicResultSetStruct.hpp>
+#include <com/sun/star/ucb/XCachedDynamicResultSetStubFactory.hpp>
+#include <com/sun/star/ucb/XSourceInitialization.hpp>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <ucbhelper/resultsethelper.hxx>
+
+#include "osl/diagnose.h"
+
+using namespace com::sun::star;
+
+//=========================================================================
+//=========================================================================
+//
+// ResultSetImplHelper Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+namespace ucbhelper {
+
+//=========================================================================
+ResultSetImplHelper::ResultSetImplHelper(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr )
+: m_pDisposeEventListeners( 0 ),
+ m_bStatic( sal_False ),
+ m_bInitDone( sal_False ),
+ m_xSMgr( rxSMgr )
+{
+}
+
+//=========================================================================
+ResultSetImplHelper::ResultSetImplHelper(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ const com::sun::star::ucb::OpenCommandArgument2& rCommand )
+: m_pDisposeEventListeners( 0 ),
+ m_bStatic( sal_False ),
+ m_bInitDone( sal_False ),
+ m_aCommand( rCommand ),
+ m_xSMgr( rxSMgr )
+{
+}
+
+//=========================================================================
+// virtual
+ResultSetImplHelper::~ResultSetImplHelper()
+{
+ delete m_pDisposeEventListeners;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_4( ResultSetImplHelper,
+ lang::XTypeProvider,
+ lang::XServiceInfo,
+ lang::XComponent, /* base of XDynamicResultSet */
+ com::sun::star::ucb::XDynamicResultSet );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_3( ResultSetImplHelper,
+ lang::XTypeProvider,
+ lang::XServiceInfo,
+ com::sun::star::ucb::XDynamicResultSet );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+XSERVICEINFO_NOFACTORY_IMPL_1( ResultSetImplHelper,
+ rtl::OUString::createFromAscii(
+ "ResultSetImplHelper" ),
+ rtl::OUString::createFromAscii(
+ DYNAMICRESULTSET_SERVICE_NAME ) );
+
+//=========================================================================
+//
+// XComponent methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL ResultSetImplHelper::dispose()
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pDisposeEventListeners && m_pDisposeEventListeners->getLength() )
+ {
+ lang::EventObject aEvt;
+ aEvt.Source = static_cast< lang::XComponent * >( this );
+ m_pDisposeEventListeners->disposeAndClear( aEvt );
+ }
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSetImplHelper::addEventListener(
+ const uno::Reference< lang::XEventListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_pDisposeEventListeners )
+ m_pDisposeEventListeners
+ = new cppu::OInterfaceContainerHelper( m_aMutex );
+
+ m_pDisposeEventListeners->addInterface( Listener );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSetImplHelper::removeEventListener(
+ const uno::Reference< lang::XEventListener >& Listener )
+ throw( uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pDisposeEventListeners )
+ m_pDisposeEventListeners->removeInterface( Listener );
+}
+
+//=========================================================================
+//
+// XDynamicResultSet methods.
+//
+//=========================================================================
+
+// virtual
+uno::Reference< sdbc::XResultSet > SAL_CALL
+ResultSetImplHelper::getStaticResultSet()
+ throw( com::sun::star::ucb::ListenerAlreadySetException,
+ uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_xListener.is() )
+ throw com::sun::star::ucb::ListenerAlreadySetException();
+
+ init( sal_True );
+ return m_xResultSet1;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSetImplHelper::setListener(
+ const uno::Reference< com::sun::star::ucb::XDynamicResultSetListener >&
+ Listener )
+ throw( com::sun::star::ucb::ListenerAlreadySetException,
+ uno::RuntimeException )
+{
+ osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ if ( m_bStatic || m_xListener.is() )
+ throw com::sun::star::ucb::ListenerAlreadySetException();
+
+ m_xListener = Listener;
+
+ //////////////////////////////////////////////////////////////////////
+ // Create "welcome event" and send it to listener.
+ //////////////////////////////////////////////////////////////////////
+
+ // Note: We only have the implementation for a static result set at the
+ // moment (src590). The dynamic result sets passed to the listener
+ // are a fake. This implementation will never call "notify" at the
+ // listener to propagate any changes!!!
+
+ init( sal_False );
+
+ uno::Any aInfo;
+ aInfo <<= com::sun::star::ucb::WelcomeDynamicResultSetStruct(
+ m_xResultSet1 /* "old" */,
+ m_xResultSet2 /* "new" */ );
+
+ uno::Sequence< com::sun::star::ucb::ListAction > aActions( 1 );
+ aActions.getArray()[ 0 ]
+ = com::sun::star::ucb::ListAction(
+ 0, // Position; not used
+ 0, // Count; not used
+ com::sun::star::ucb::ListActionType::WELCOME,
+ aInfo );
+ aGuard.clear();
+
+ Listener->notify(
+ com::sun::star::ucb::ListEvent(
+ static_cast< cppu::OWeakObject * >( this ), aActions ) );
+}
+
+//=========================================================================
+// virtual
+sal_Int16 SAL_CALL ResultSetImplHelper::getCapabilities()
+ throw( uno::RuntimeException )
+{
+ // ! com::sun::star::ucb::ContentResultSetCapability::SORTED
+ return 0;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL ResultSetImplHelper::connectToCache(
+ const uno::Reference< com::sun::star::ucb::XDynamicResultSet > &
+ xCache )
+ throw( com::sun::star::ucb::ListenerAlreadySetException,
+ com::sun::star::ucb::AlreadyInitializedException,
+ com::sun::star::ucb::ServiceNotFoundException,
+ uno::RuntimeException )
+{
+ if ( m_xListener.is() )
+ throw com::sun::star::ucb::ListenerAlreadySetException();
+
+ if ( m_bStatic )
+ throw com::sun::star::ucb::ListenerAlreadySetException();
+
+ uno::Reference< com::sun::star::ucb::XSourceInitialization >
+ xTarget( xCache, uno::UNO_QUERY );
+ if ( xTarget.is() )
+ {
+ uno::Reference<
+ com::sun::star::ucb::XCachedDynamicResultSetStubFactory >
+ xStubFactory;
+ try
+ {
+ xStubFactory
+ = uno::Reference<
+ com::sun::star::ucb::XCachedDynamicResultSetStubFactory >(
+ m_xSMgr->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.ucb.CachedDynamicResultSetStubFactory" ) ),
+ uno::UNO_QUERY );
+ }
+ catch ( uno::Exception const & )
+ {
+ }
+
+ if ( xStubFactory.is() )
+ {
+ xStubFactory->connectToCache(
+ this, xCache, m_aCommand.SortingInfo, 0 );
+ return;
+ }
+ }
+ throw com::sun::star::ucb::ServiceNotFoundException();
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+void ResultSetImplHelper::init( sal_Bool bStatic )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !m_bInitDone )
+ {
+ if ( bStatic )
+ {
+ // virtual... derived class fills m_xResultSet1
+ initStatic();
+
+ OSL_ENSURE( m_xResultSet1.is(),
+ "ResultSetImplHelper::init - No 1st result set!" );
+ m_bStatic = sal_True;
+ }
+ else
+ {
+ // virtual... derived class fills m_xResultSet1 and m_xResultSet2
+ initDynamic();
+
+ OSL_ENSURE( m_xResultSet1.is(),
+ "ResultSetImplHelper::init - No 1st result set!" );
+ OSL_ENSURE( m_xResultSet2.is(),
+ "ResultSetImplHelper::init - No 2nd result set!" );
+ m_bStatic = sal_False;
+ }
+ m_bInitDone = sal_True;
+ }
+}
+
+} // namespace ucbhelper
diff --git a/ucbhelper/source/provider/resultsetmetadata.cxx b/ucbhelper/source/provider/resultsetmetadata.cxx
new file mode 100644
index 000000000000..c9a6cf8b25e2
--- /dev/null
+++ b/ucbhelper/source/provider/resultsetmetadata.cxx
@@ -0,0 +1,605 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: resultsetmetadata.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#include "osl/diagnose.h"
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/XArray.hpp>
+#include <com/sun/star/sdbc/XBlob.hpp>
+#include <com/sun/star/sdbc/XClob.hpp>
+#include <com/sun/star/sdbc/XRef.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <ucbhelper/resultsetmetadata.hxx>
+
+using namespace com::sun::star::beans;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::util;
+using namespace rtl;
+
+namespace ucbhelper_impl {
+
+struct ResultSetMetaData_Impl
+{
+ osl::Mutex m_aMutex;
+ std::vector< ::ucbhelper::ResultSetColumnData > m_aColumnData;
+ sal_Bool m_bObtainedTypes;
+ sal_Bool m_bGlobalReadOnlyValue;
+
+ ResultSetMetaData_Impl( sal_Int32 nSize )
+ : m_aColumnData( nSize ), m_bObtainedTypes( sal_False ),
+ m_bGlobalReadOnlyValue( sal_True ) {}
+
+ ResultSetMetaData_Impl(
+ const std::vector< ::ucbhelper::ResultSetColumnData >& rColumnData )
+ : m_aColumnData( rColumnData ), m_bObtainedTypes( sal_False ),
+ m_bGlobalReadOnlyValue( sal_False ) {}
+};
+
+}
+
+using namespace ucbhelper_impl;
+
+namespace ucbhelper {
+
+//=========================================================================
+//=========================================================================
+//
+// ResultSetMetaData Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ResultSetMetaData::ResultSetMetaData(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const Sequence< Property >& rProps,
+ sal_Bool bReadOnly )
+: m_pImpl( new ResultSetMetaData_Impl( rProps.getLength() ) ),
+ m_xSMgr( rxSMgr ),
+ m_aProps( rProps ),
+ m_bReadOnly( bReadOnly )
+{
+}
+
+//=========================================================================
+ResultSetMetaData::ResultSetMetaData(
+ const Reference< XMultiServiceFactory >& rxSMgr,
+ const Sequence< Property >& rProps,
+ const std::vector< ResultSetColumnData >& rColumnData )
+: m_pImpl( new ResultSetMetaData_Impl( rColumnData ) ),
+ m_xSMgr( rxSMgr ),
+ m_aProps( rProps ),
+ m_bReadOnly( sal_True )
+{
+ OSL_ENSURE( rColumnData.size() == sal_uInt32( rProps.getLength() ),
+ "ResultSetMetaData ctor - different array sizes!" );
+}
+
+//=========================================================================
+// virtual
+ResultSetMetaData::~ResultSetMetaData()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+XINTERFACE_IMPL_2( ResultSetMetaData,
+ XTypeProvider,
+ XResultSetMetaData );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_IMPL_2( ResultSetMetaData,
+ XTypeProvider,
+ XResultSetMetaData );
+
+//=========================================================================
+//
+// XResultSetMetaData methods.
+//
+//=========================================================================
+
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getColumnCount()
+ throw( SQLException, RuntimeException )
+{
+ return m_aProps.getLength();
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isAutoIncrement( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether column is automatically numbered, which makes it
+ read-only.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return sal_False;
+
+ return m_pImpl->m_aColumnData[ column - 1 ].isAutoIncrement;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isCaseSensitive( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return sal_False;
+
+ return m_pImpl->m_aColumnData[ column - 1 ].isCaseSensitive;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isSearchable( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether the value stored in column can be used in a
+ WHERE clause.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return sal_False;
+
+ return m_pImpl->m_aColumnData[ column - 1 ].isSearchable;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isCurrency( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether column is a cash value.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return sal_False;
+
+ return m_pImpl->m_aColumnData[ column - 1 ].isCurrency;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::isNullable( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether a NULL can be stored in column.
+ Possible values: see com/sun/star/sdbc/ColumnValue.idl
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return ColumnValue::NULLABLE;
+
+ return m_pImpl->m_aColumnData[ column - 1 ].isNullable;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isSigned( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Checks whether the value stored in column is a signed number.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return sal_False;
+
+ return m_pImpl->m_aColumnData[ column - 1 ].isSigned;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getColumnDisplaySize( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the normal maximum width in characters for column.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return 16;
+
+ return m_pImpl->m_aColumnData[ column - 1 ].columnDisplaySize;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getColumnLabel( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the suggested column title for column, to be used in print-
+ outs and displays.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return OUString();
+
+ OUString aLabel = m_pImpl->m_aColumnData[ column - 1 ].columnLabel;
+ if ( aLabel.getLength() )
+ return aLabel;
+
+ return m_aProps.getConstArray()[ column - 1 ].Name;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getColumnName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the name of column.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return OUString();
+
+ return m_aProps.getConstArray()[ column - 1 ].Name;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getSchemaName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the schema name for the table from which column of this
+ result set was derived.
+ Because this feature is not widely supported, the return value
+ for many DBMSs will be an empty string.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return OUString();
+
+ return m_pImpl->m_aColumnData[ column - 1 ].schemaName;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getPrecision( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ For number types, getprecision gets the number of decimal digits
+ in column.
+ For character types, it gets the maximum length in characters for
+ column.
+ For binary types, it gets the maximum length in bytes for column.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return -1;
+
+ return m_pImpl->m_aColumnData[ column - 1 ].precision;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getScale( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the number of digits to the right of the decimal point for
+ values in column.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return 0;
+
+ return m_pImpl->m_aColumnData[ column - 1 ].scale;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getTableName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the name of the table from which column of this result set
+ was derived or "" if there is none (for example, for a join).
+ Because this feature is not widely supported, the return value
+ for many DBMSs will be an empty string.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return OUString();
+
+ return m_pImpl->m_aColumnData[ column - 1 ].tableName;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getCatalogName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the catalog name for the table from which column of this
+ result set was derived.
+ Because this feature is not widely supported, the return value
+ for many DBMSs will be an empty string.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return OUString();
+
+ return m_pImpl->m_aColumnData[ column - 1 ].catalogName;
+}
+
+//=========================================================================
+// virtual
+sal_Int32 SAL_CALL ResultSetMetaData::getColumnType( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the JDBC type for the value stored in column. ... The STRUCT
+ and DISTINCT type codes are always returned for structured and
+ distinct types, regardless of whether the value will be mapped
+ according to the standard mapping or be a custom mapping.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return DataType::SQLNULL;
+
+ if ( m_aProps.getConstArray()[ column - 1 ].Type
+ == getCppuVoidType() )
+ {
+ // No type given. Try UCB's Properties Manager...
+
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( !m_pImpl->m_bObtainedTypes )
+ {
+ try
+ {
+ Reference< XPropertySetInfo > xInfo(
+ m_xSMgr->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.ucb.PropertiesManager" ) ),
+ UNO_QUERY );
+ if ( xInfo.is() )
+ {
+#if 0
+ // Convenient...
+
+ sal_Int32 nCount = m_pImpl->m_aProps.getLength();
+ Property* pProps = m_pImpl->m_aProps.getArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+
+ try
+ {
+ Property aProp
+ = xInfo->getPropertyByName( rProp.Name );
+ rProp.Type = aProp.Type;
+ }
+ catch ( UnknownPropertyException& )
+ {
+ // getPropertyByName
+ }
+ }
+#else
+ // Less (remote) calls...
+
+ Sequence< Property > aProps = xInfo->getProperties();
+ const Property* pProps1 = aProps.getConstArray();
+ sal_Int32 nCount1 = aProps.getLength();
+
+ sal_Int32 nCount = m_aProps.getLength();
+ Property* pProps = m_aProps.getArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ Property& rProp = pProps[ n ];
+
+ for ( sal_Int32 m = 0; m < nCount1; ++m )
+ {
+ const Property& rProp1 = pProps1[ m ];
+ if ( rProp.Name == rProp1.Name )
+ {
+ // Found...
+ rProp.Type = rProp1.Type;
+ break;
+ }
+ }
+ }
+#endif
+ }
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ // createInstance
+ }
+
+ m_pImpl->m_bObtainedTypes = sal_True;
+ }
+ }
+
+ const Type& rType = m_aProps.getConstArray()[ column - 1 ].Type;
+ sal_Int32 nType = DataType::OTHER;
+
+ if ( rType == getCppuType( static_cast< const rtl::OUString * >( 0 ) ) )
+ nType = DataType::VARCHAR; // XRow::getString
+ else if ( rType == getCppuBooleanType() )
+ nType = DataType::BIT; // XRow::getBoolean
+ else if ( rType == getCppuType( static_cast< const sal_Int32 * >( 0 ) ) )
+ nType = DataType::INTEGER; // XRow::getInt
+ else if ( rType == getCppuType( static_cast< const sal_Int64 * >( 0 ) ) )
+ nType = DataType::BIGINT; // XRow::getLong
+ else if ( rType == getCppuType( static_cast< const sal_Int16 * >( 0 ) ) )
+ nType = DataType::SMALLINT; // XRow::getShort
+ else if ( rType == getCppuType( static_cast< const sal_Int8 * >( 0 ) ) )
+ nType = DataType::TINYINT; // XRow::getByte
+ else if ( rType == getCppuType( static_cast< const float * >( 0 ) ) )
+ nType = DataType::REAL; // XRow::getFloat
+ else if ( rType == getCppuType( static_cast< const double * >( 0 ) ) )
+ nType = DataType::DOUBLE; // XRow::getDouble
+ else if ( rType == getCppuType( static_cast< const Sequence< sal_Int8 > * >( 0 ) ) )
+ nType = DataType::VARBINARY;// XRow::getBytes
+ else if ( rType == getCppuType( static_cast< const Date * >( 0 ) ) )
+ nType = DataType::DATE; // XRow::getDate
+ else if ( rType == getCppuType( static_cast< const Time * >( 0 ) ) )
+ nType = DataType::TIME; // XRow::getTime
+ else if ( rType == getCppuType( static_cast< const DateTime * >( 0 ) ) )
+ nType = DataType::TIMESTAMP;// XRow::getTimestamp
+ else if ( rType == getCppuType( static_cast< Reference< XInputStream > * >( 0 ) ) )
+ nType = DataType::LONGVARBINARY; // XRow::getBinaryStream
+// nType = DataType::LONGVARCHAR; // XRow::getCharacterStream
+ else if ( rType == getCppuType( static_cast< Reference< XClob > * >( 0 ) ) )
+ nType = DataType::CLOB; // XRow::getClob
+ else if ( rType == getCppuType( static_cast< Reference< XBlob > * >( 0 ) ) )
+ nType = DataType::BLOB; // XRow::getBlob
+ else if ( rType == getCppuType( static_cast< Reference< XArray > * >( 0 ) ) )
+ nType = DataType::ARRAY;// XRow::getArray
+ else if ( rType == getCppuType( static_cast< Reference< XRef > * >( 0 ) ) )
+ nType = DataType::REF;// XRow::getRef
+ else
+ nType = DataType::OBJECT;// XRow::getObject
+
+ return nType;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getColumnTypeName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Gets the type name used by this particular data source for the
+ values stored in column. If the type code for the type of value
+ stored in column is STRUCT, DISTINCT or JAVA_OBJECT, this method
+ returns a fully-qualified SQL type name.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return OUString();
+
+ return m_pImpl->m_aColumnData[ column - 1 ].columnTypeName;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isReadOnly( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_bGlobalReadOnlyValue )
+ return m_bReadOnly;
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return sal_True;
+
+ // autoincrement==true => readonly
+ return m_pImpl->m_aColumnData[ column - 1 ].isAutoIncrement ||
+ m_pImpl->m_aColumnData[ column - 1 ].isReadOnly;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isWritable( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_bGlobalReadOnlyValue )
+ return !m_bReadOnly;
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return sal_False;
+
+ return m_pImpl->m_aColumnData[ column - 1 ].isWritable;
+}
+
+//=========================================================================
+// virtual
+sal_Bool SAL_CALL ResultSetMetaData::isDefinitelyWritable( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ if ( m_pImpl->m_bGlobalReadOnlyValue )
+ return !m_bReadOnly;
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return sal_False;
+
+ return m_pImpl->m_aColumnData[ column - 1 ].isDefinitelyWritable;
+}
+
+//=========================================================================
+// virtual
+OUString SAL_CALL ResultSetMetaData::getColumnServiceName( sal_Int32 column )
+ throw( SQLException, RuntimeException )
+{
+ /*
+ Returns the fully-qualified name of the service whose instances
+ are manufactured if XResultSet::getObject is called to retrieve
+ a value from the column.
+ */
+
+ if ( ( column < 1 ) || ( column > m_aProps.getLength() ) )
+ return OUString();
+
+ return m_pImpl->m_aColumnData[ column - 1 ].columnServiceName;
+}
+
+} // namespace ucbhelper
diff --git a/ucbhelper/source/provider/simpleauthenticationrequest.cxx b/ucbhelper/source/provider/simpleauthenticationrequest.cxx
new file mode 100644
index 000000000000..c70dc40db2f7
--- /dev/null
+++ b/ucbhelper/source/provider/simpleauthenticationrequest.cxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: simpleauthenticationrequest.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+#include <com/sun/star/ucb/AuthenticationRequest.hpp>
+#include <ucbhelper/simpleauthenticationrequest.hxx>
+
+using namespace com::sun::star;
+using namespace ucbhelper;
+
+//=========================================================================
+SimpleAuthenticationRequest::SimpleAuthenticationRequest(
+ const rtl::OUString & rServerName,
+ const rtl::OUString & rRealm,
+ const rtl::OUString & rUserName,
+ const rtl::OUString & rPassword,
+ const rtl::OUString & rAccount )
+{
+ // Fill request...
+ ucb::AuthenticationRequest aRequest;
+// aRequest.Message = // OUString
+// aRequest.Context = // XInterface
+ aRequest.Classification = task::InteractionClassification_ERROR;
+ aRequest.ServerName = rServerName;
+// aRequest.Diagnostic = // OUString
+ aRequest.HasRealm = ( rRealm.getLength() > 0 );
+ if ( aRequest.HasRealm )
+ aRequest.Realm = rRealm;
+ aRequest.HasUserName = sal_True;
+ aRequest.UserName = rUserName;
+ aRequest.HasPassword = sal_True;
+ aRequest.Password = rPassword;
+ aRequest.HasAccount = ( rAccount.getLength() > 0 );
+ if ( aRequest.HasAccount )
+ aRequest.Account = rAccount;
+
+ setRequest( uno::makeAny( aRequest ) );
+
+ // Fill continuations...
+ uno::Sequence< ucb::RememberAuthentication > aRememberModes( 2 );
+ aRememberModes[ 0 ] = ucb::RememberAuthentication_NO;
+ aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION;
+
+ m_xAuthSupplier
+ = new InteractionSupplyAuthentication(
+ this,
+ sal_False, // bCanSetRealm
+ sal_True, // bCanSetUserName
+ sal_True, // bCanSetPassword
+ aRequest.HasAccount, // bCanSetAccount
+ aRememberModes, // rRememberPasswordModes
+ ucb::RememberAuthentication_SESSION, // eDefaultRememberPasswordMode
+ aRememberModes, // rRememberAccountModes
+ ucb::RememberAuthentication_SESSION // eDefaultRememberAccountMode
+ );
+
+ uno::Sequence<
+ uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
+ aContinuations[ 0 ] = new InteractionAbort( this );
+ aContinuations[ 1 ] = new InteractionRetry( this );
+ aContinuations[ 2 ] = m_xAuthSupplier.get();
+
+ setContinuations( aContinuations );
+}
+
+//=========================================================================
+SimpleAuthenticationRequest::SimpleAuthenticationRequest(
+ const rtl::OUString & rServerName,
+ EntityType eRealmType,
+ const rtl::OUString & rRealm,
+ EntityType eUserNameType,
+ const rtl::OUString & rUserName,
+ EntityType ePasswordType,
+ const rtl::OUString & rPassword,
+ EntityType eAccountType,
+ const rtl::OUString & rAccount )
+{
+ // Fill request...
+ ucb::AuthenticationRequest aRequest;
+// aRequest.Message = // OUString
+// aRequest.Context = // XInterface
+ aRequest.Classification = task::InteractionClassification_ERROR;
+ aRequest.ServerName = rServerName;
+// aRequest.Diagnostic = // OUString
+ aRequest.HasRealm = eRealmType != ENTITY_NA;
+ if ( aRequest.HasRealm )
+ aRequest.Realm = rRealm;
+ aRequest.HasUserName = eUserNameType != ENTITY_NA;
+ if ( aRequest.HasUserName )
+ aRequest.UserName = rUserName;
+ aRequest.HasPassword = ePasswordType != ENTITY_NA;
+ if ( aRequest.HasPassword )
+ aRequest.Password = rPassword;
+ aRequest.HasAccount = eAccountType != ENTITY_NA;
+ if ( aRequest.HasAccount )
+ aRequest.Account = rAccount;
+
+ setRequest( uno::makeAny( aRequest ) );
+
+ // Fill continuations...
+ uno::Sequence< ucb::RememberAuthentication > aRememberModes( 2 );
+ aRememberModes[ 0 ] = ucb::RememberAuthentication_NO;
+ aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION;
+
+ m_xAuthSupplier
+ = new InteractionSupplyAuthentication(
+ this,
+ eRealmType == ENTITY_MODIFY, // bCanSetRealm
+ eUserNameType == ENTITY_MODIFY, // bCanSetUserName
+ ePasswordType == ENTITY_MODIFY, // bCanSetPassword
+ eAccountType == ENTITY_MODIFY, // bCanSetAccount
+ aRememberModes, // rRememberPasswordModes
+ ucb::RememberAuthentication_SESSION, // eDefaultRememberPasswordMode
+ aRememberModes, // rRememberAccountModes
+ ucb::RememberAuthentication_SESSION // eDefaultRememberAccountMode
+ );
+
+ uno::Sequence<
+ uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
+ aContinuations[ 0 ] = new InteractionAbort( this );
+ aContinuations[ 1 ] = new InteractionRetry( this );
+ aContinuations[ 2 ] = m_xAuthSupplier.get();
+
+ setContinuations( aContinuations );
+}
diff --git a/ucbhelper/source/provider/simplecertificatevalidationrequest.cxx b/ucbhelper/source/provider/simplecertificatevalidationrequest.cxx
new file mode 100755
index 000000000000..975547031621
--- /dev/null
+++ b/ucbhelper/source/provider/simplecertificatevalidationrequest.cxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: simplecertificatevalidationrequest.cxx,v $
+ * $Revision: 1.3.20.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+#include <com/sun/star/ucb/CertificateValidationRequest.hpp>
+#include <ucbhelper/simplecertificatevalidationrequest.hxx>
+
+using namespace com::sun::star;
+using namespace ucbhelper;
+
+//=========================================================================
+SimpleCertificateValidationRequest::SimpleCertificateValidationRequest( const sal_Int32 & lCertificateValidity,
+ const com::sun::star::uno::Reference<com::sun::star::security::XCertificate> pCertificate,
+ const rtl::OUString & hostname)
+{
+ // Fill request...
+ ucb::CertificateValidationRequest aRequest;
+ aRequest.CertificateValidity = lCertificateValidity;
+ aRequest.Certificate = pCertificate;
+ aRequest.HostName = hostname;
+
+ setRequest( uno::makeAny( aRequest ) );
+
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 2 );
+ aContinuations[ 0 ] = new InteractionAbort( this );
+ aContinuations[ 1 ] = new InteractionApprove( this );
+
+ setContinuations( aContinuations );
+ pCertificate.get();
+}
+
+//=========================================================================
+sal_Int32 SimpleCertificateValidationRequest::getResponse() const
+{
+ rtl::Reference< InteractionContinuation > xSelection = getSelection();
+ if ( xSelection.is() )
+ {
+ InteractionContinuation * pSelection = xSelection.get();
+
+ uno::Reference< task::XInteractionAbort > xAbort(
+ pSelection, uno::UNO_QUERY );
+ if ( xAbort.is() )
+ return 1;
+
+ uno::Reference< task::XInteractionRetry > xRetry(
+ pSelection, uno::UNO_QUERY );
+ if ( xRetry.is() )
+ return 2;
+
+ uno::Reference< task::XInteractionApprove > xApprove(
+ pSelection, uno::UNO_QUERY );
+ if ( xApprove.is() )
+ return 4;
+
+ uno::Reference< task::XInteractionDisapprove > xDisapprove(
+ pSelection, uno::UNO_QUERY );
+ if ( xDisapprove.is() )
+ return 8;
+
+ OSL_ENSURE( sal_False, "CertificateValidationRequest - Unknown continuation!" );
+ }
+ return 0;
+}
diff --git a/ucbhelper/source/provider/simpleinteractionrequest.cxx b/ucbhelper/source/provider/simpleinteractionrequest.cxx
new file mode 100644
index 000000000000..93fd33cc991f
--- /dev/null
+++ b/ucbhelper/source/provider/simpleinteractionrequest.cxx
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: simpleinteractionrequest.cxx,v $
+ * $Revision: 1.6.20.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+#include <ucbhelper/simpleinteractionrequest.hxx>
+
+using namespace com::sun::star;
+using namespace ucbhelper;
+
+//=========================================================================
+SimpleInteractionRequest::SimpleInteractionRequest(
+ const uno::Any & rRequest,
+ const sal_Int32 nContinuations )
+: InteractionRequest( rRequest )
+{
+ // Set continuations.
+ OSL_ENSURE( nContinuations != CONTINUATION_UNKNOWN,
+ "SimpleInteractionRequest - No continuation!" );
+
+ sal_Int32 nLength = 0;
+
+ uno::Reference< task::XInteractionContinuation > xAbort;
+ uno::Reference< task::XInteractionContinuation > xRetry;
+ uno::Reference< task::XInteractionContinuation > xApprove;
+ uno::Reference< task::XInteractionContinuation > xDisapprove;
+
+ if ( nContinuations & CONTINUATION_ABORT )
+ {
+ ++nLength;
+ xAbort = new InteractionAbort( this );
+ }
+
+ if ( nContinuations & CONTINUATION_RETRY )
+ {
+ ++nLength;
+ xRetry = new InteractionRetry( this );
+ }
+
+ if ( nContinuations & CONTINUATION_APPROVE )
+ {
+ ++nLength;
+ xApprove = new InteractionApprove( this );
+ }
+
+ if ( nContinuations & CONTINUATION_DISAPPROVE )
+ {
+ ++nLength;
+ xDisapprove = new InteractionDisapprove( this );
+ }
+
+ OSL_ENSURE( nLength > 0,
+ "SimpleInteractionRequest - No continuation!" );
+
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > >
+ aContinuations( nLength );
+
+ nLength = 0;
+
+ if ( xAbort.is() )
+ aContinuations[ nLength++ ] = xAbort;
+
+ if ( xRetry.is() )
+ aContinuations[ nLength++ ] = xRetry;
+
+ if ( xApprove.is() )
+ aContinuations[ nLength++ ] = xApprove;
+
+ if ( xDisapprove.is() )
+ aContinuations[ nLength++ ] = xDisapprove;
+
+ setContinuations( aContinuations );
+}
+
+//=========================================================================
+sal_Int32 SimpleInteractionRequest::getResponse() const
+{
+ rtl::Reference< InteractionContinuation > xSelection = getSelection();
+ if ( xSelection.is() )
+ {
+ InteractionContinuation * pSelection = xSelection.get();
+
+ uno::Reference< task::XInteractionAbort > xAbort(
+ pSelection, uno::UNO_QUERY );
+ if ( xAbort.is() )
+ return CONTINUATION_ABORT;
+
+ uno::Reference< task::XInteractionRetry > xRetry(
+ pSelection, uno::UNO_QUERY );
+ if ( xRetry.is() )
+ return CONTINUATION_RETRY;
+
+ uno::Reference< task::XInteractionApprove > xApprove(
+ pSelection, uno::UNO_QUERY );
+ if ( xApprove.is() )
+ return CONTINUATION_APPROVE;
+
+ uno::Reference< task::XInteractionDisapprove > xDisapprove(
+ pSelection, uno::UNO_QUERY );
+ if ( xDisapprove.is() )
+ return CONTINUATION_DISAPPROVE;
+
+ OSL_ENSURE( sal_False,
+ "SimpleInteractionRequest::getResponse - Unknown continuation!" );
+ }
+ return CONTINUATION_UNKNOWN;
+}
+
diff --git a/ucbhelper/source/provider/simpleioerrorrequest.cxx b/ucbhelper/source/provider/simpleioerrorrequest.cxx
new file mode 100644
index 000000000000..290256c55ddf
--- /dev/null
+++ b/ucbhelper/source/provider/simpleioerrorrequest.cxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: simpleioerrorrequest.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#include <ucbhelper/simpleioerrorrequest.hxx>
+
+using namespace com::sun::star;
+using namespace ucbhelper;
+
+//=========================================================================
+SimpleIOErrorRequest::SimpleIOErrorRequest(
+ const ucb::IOErrorCode eError,
+ const uno::Sequence< uno::Any > & rArgs,
+ const rtl::OUString & rMessage,
+ const uno::Reference< ucb::XCommandProcessor > & xContext )
+{
+ // Fill request...
+ ucb::InteractiveAugmentedIOException aRequest;
+ aRequest.Message = rMessage;
+ aRequest.Context = xContext;
+ aRequest.Classification = task::InteractionClassification_ERROR;
+ aRequest.Code = eError;
+ aRequest.Arguments = rArgs;
+
+ setRequest( uno::makeAny( aRequest ) );
+
+ // Fill continuations...
+ uno::Sequence< uno::Reference<
+ task::XInteractionContinuation > > aContinuations( 1 );
+ aContinuations[ 0 ] = new InteractionAbort( this );
+
+ setContinuations( aContinuations );
+}
+
diff --git a/ucbhelper/source/provider/simplenameclashresolverequest.cxx b/ucbhelper/source/provider/simplenameclashresolverequest.cxx
new file mode 100644
index 000000000000..13d0705e000d
--- /dev/null
+++ b/ucbhelper/source/provider/simplenameclashresolverequest.cxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: simplenameclashresolverequest.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+#include <com/sun/star/ucb/NameClashResolveRequest.hpp>
+#include <ucbhelper/simplenameclashresolverequest.hxx>
+
+using namespace com::sun::star;
+using namespace ucbhelper;
+
+//=========================================================================
+SimpleNameClashResolveRequest::SimpleNameClashResolveRequest(
+ const rtl::OUString & rTargetFolderURL,
+ const rtl::OUString & rClashingName,
+ const rtl::OUString & rProposedNewName,
+ sal_Bool bSupportsOverwriteData )
+{
+ // Fill request...
+ ucb::NameClashResolveRequest aRequest;
+// aRequest.Message = // OUString
+// aRequest.Context = // XInterface
+ aRequest.Classification = task::InteractionClassification_QUERY;
+ aRequest.TargetFolderURL = rTargetFolderURL;
+ aRequest.ClashingName = rClashingName;
+ aRequest.ProposedNewName = rProposedNewName;
+
+ setRequest( uno::makeAny( aRequest ) );
+
+ // Fill continuations...
+ m_xNameSupplier = new InteractionSupplyName( this );
+
+ uno::Sequence< uno::Reference< task::XInteractionContinuation > >
+ aContinuations( bSupportsOverwriteData ? 3 : 2 );
+ aContinuations[ 0 ] = new InteractionAbort( this );
+ aContinuations[ 1 ] = m_xNameSupplier.get();
+
+ if ( bSupportsOverwriteData )
+ aContinuations[ 2 ] = new InteractionReplaceExistingData( this );
+
+ setContinuations( aContinuations );
+}
+
diff --git a/ucbhelper/util/makefile.mk b/ucbhelper/util/makefile.mk
new file mode 100644
index 000000000000..159d023a64fe
--- /dev/null
+++ b/ucbhelper/util/makefile.mk
@@ -0,0 +1,79 @@
+#*************************************************************************
+#
+# 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
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.17 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME= ucbhelper
+TARGET= ucbhelper
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : ..$/version.mk
+
+# --- Files --------------------------------------------------------
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1FILES= $(SLB)$/client.lib \
+ $(SLB)$/provider.lib
+
+SHL1TARGET= $(TARGET)$(UCBHELPER_MAJOR)$(COMID)
+.IF "$(GUI)" == "OS2"
+SHL1TARGET= ucbh$(UCBHELPER_MAJOR)
+.ENDIF
+SHL1STDLIBS = \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALHELPERLIB) \
+ $(SALLIB)
+
+SHL1DEPN=
+SHL1IMPLIB= i$(TARGET)
+SHL1USE_EXPORTS=name
+SHL1LIBS= $(LIB1TARGET)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt
+DEFLIB1NAME= $(TARGET)
+DEF1DES= Universal Content Broker - Helpers
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+# --- Filter -----------------------------------------------------------
+
+$(MISC)$/$(SHL1TARGET).flt : ucbhelper.flt
+ @echo ------------------------------
+ @echo Making: $@
+ @$(TYPE) ucbhelper.flt > $@
+
diff --git a/ucbhelper/util/makefile.pmk b/ucbhelper/util/makefile.pmk
new file mode 100644
index 000000000000..23f38aa614e5
--- /dev/null
+++ b/ucbhelper/util/makefile.pmk
@@ -0,0 +1,35 @@
+#*************************************************************************
+#
+# 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
+#
+# $RCSfile: makefile.pmk,v $
+#
+# $Revision: 1.4 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+# define UCBHELPER_DLLIMPLEMENTATION (see @ ucbhelperdllapi.h)
+CDEFS += -DUCBHELPER_DLLIMPLEMENTATION
+
+VISIBILITY_HIDDEN=TRUE
diff --git a/ucbhelper/util/ucbhelper.flt b/ucbhelper/util/ucbhelper.flt
new file mode 100644
index 000000000000..a36cd4f87e65
--- /dev/null
+++ b/ucbhelper/util/ucbhelper.flt
@@ -0,0 +1,181 @@
+_Impl
+_impl
+IMP
+Dbg
+DLL
+getCppuType
+cpp_queryInterface
+cpp_acquire
+cpp_release
+_aType
+unnamed
+__CT
+??_5
+??_7
+??_8
+??_9
+??_C
+??_E
+??_F
+??_G
+??_H
+??_I
+.cxx
+??_R0?AV
+??3@YAXPAX0@Z
+?_M_allocate_and_copy@?$vector@
+?_M_insert_overflow@?$vector@
+?_M_fill_insert@?$vector@
+?_M_create_node@?$list@
+?_M_list@?$_Stl_prime@_N@_STL@@
+?__lower_bound@_STL@@
+?__uninitialized_copy_aux@_STL@@
+?__uninitialized_fill_n_aux@_STL@@
+??1?$_Vector_base@
+??0?$_Vector_base@
+??1?$_STL_alloc_proxy@
+??0?$_STL_alloc_proxy@
+??1?$allocator@
+??1?$pair@
+??0?$pair@
+??1?$vector@
+??1?$hash_map@
+??A?$hash_map@
+?get_allocator@
+?copy@_STL@@
+??1?$map@
+?erase@?$map@
+?make_pair@_STL@@
+??0?$_List_iterator@
+?__copy@_STL@@
+?__copy_backward@_STL@@
+?end@?$list@
+?insert@?$list@
+?deallocate@?$allocator@
+??0?$_Rb_tree_iterator@
+??1?$_Rb_tree_base@
+?_M_create_node@?$_Rb_tree@
+?_M_decrement@?$_Rb_global@
+?_M_empty_initialize@?$_Rb_tree@
+?_M_erase@?$_Rb_tree@
+?_Rebalance@?$_Rb_global@
+?_Rebalance_for_erase@?$_Rb_global@
+?destroy_node@?$_Rb_tree@
+?erase@?$_Rb_tree@
+?find@?$_Rb_tree@
+?insert_unique@?$_Rb_tree@
+?reserve@?$vector@
+??1?$Guard@VMutex@osl@@@osl@@
+??1?$ClearableGuard@VMutex@osl@@@osl@@
+??1Mutex@osl@@
+??1OUString@rtl@@
+??0OUString@rtl@@
+??8@YAEABVOUString@rtl@@
+?createFromAscii@OUString@rtl@@
+?copy@OUString@rtl@@
+?replaceAt@OUString@rtl@@
+?compareTo@OUString@rtl@@
+?toAsciiLowerCase@OUString@rtl@@
+??1OUStringBuffer@rtl@@
+?makeStringAndClear@OUStringBuffer@rtl@@
+?appendAscii@OUStringBuffer@rtl@@
+??1?$ORef@
+?s_pType@?$Sequence@
+??0?$Reference@
+??1?$Reference@
+??C?$Reference@
+?__query@?$Reference@
+?set@?$Reference@
+??0?$Sequence@
+??1?$Sequence@
+??A?$Sequence@V?$Reference@
+??1OTypeCollection@cppu@@
+?getTypes@OTypeCollection@cppu@@
+?queryInterface@cppu@@
+??0OWeakObject@cppu@@
+??3OWeakObject@cppu@@
+?makeAny@uno@star@sun@com@@
+??0Any@uno@star@sun@com@@
+??1Any@uno@star@sun@com@@
+??4Any@uno@star@sun@com@@
+??0Type@uno@star@sun@com@@
+??0Exception@uno@star@sun@com@@
+??1Exception@uno@star@sun@com@@
+??0RuntimeException@uno@star@sun@com@@
+??1RuntimeException@uno@star@sun@com@@
+??8BaseReference@uno@star@sun@com@@
+??1?$WeakImplHelper1@
+?acquire@?$WeakImplHelper1@
+?release@?$WeakImplHelper1@
+?getImplementationId@?$WeakImplHelper1@
+?getTypes@?$WeakImplHelper1@
+?queryInterface@?$WeakImplHelper1@
+?s_cd@?$WeakImplHelper1@
+??0OpenCommandArgument@ucb@star@sun@com@@
+??1Command@ucb@star@sun@com@@
+??1CommandInfo@ucb@star@sun@com@@
+??1ContentInfo@ucb@star@sun@com@@
+??1InsertCommandArgument@ucb@star@sun@com@@
+??1OpenCommandArgument2@ucb@star@sun@com@@
+??1OpenCommandArgument@ucb@star@sun@com@@
+??0EventObject@lang@star@sun@com@@
+??1EventObject@lang@star@sun@com@@
+??0IllegalArgumentException@lang@star@sun@com@@
+??1IllegalArgumentException@lang@star@sun@com@@
+??0IllegalTypeException@beans@star@sun@com@@
+??1IllegalTypeException@beans@star@sun@com@@
+??0NoSupportException@lang@star@sun@com@@
+??1NoSupportException@lang@star@sun@com@@
+??0NotRemoveableException@beans@star@sun@com@@
+??1NotRemoveableException@beans@star@sun@com@@
+??0PropertyExistException@beans@star@sun@com@@
+??1PropertyExistException@beans@star@sun@com@@
+??0UnknownPropertyException@beans@star@sun@com@@
+??1UnknownPropertyException@beans@star@sun@com@@
+??0UnsupportedCommandException@ucb@star@sun@com@@
+??1UnsupportedCommandException@ucb@star@sun@com@@
+??0ListenerAlreadySetException@ucb@star@sun@com@@
+??1ListenerAlreadySetException@ucb@star@sun@com@@
+??0ContentCreationException@ucb@star@sun@com@@
+??1ContentCreationException@ucb@star@sun@com@@
+??0ServiceNotFoundException@ucb@star@sun@com@@
+??1ServiceNotFoundException@ucb@star@sun@com@@
+??0SQLException@sdbc@star@sun@com@@
+??1SQLException@sdbc@star@sun@com@@
+??1InteractiveAugmentedIOException@ucb@star@sun@com@@
+??0CommandFailedException@ucb@star@sun@com@@
+??1CommandFailedException@ucb@star@sun@com@@
+??1ContentEvent@ucb@star@sun@com@@
+??1Property@beans@star@sun@com@@
+??0Property@beans@star@sun@com@@
+??1PropertyValue@beans@star@sun@com@@
+??1PropertySetInfoChangeEvent@beans@star@sun@com@@
+??1PropertyChangeEvent@beans@star@sun@com@@
+??4PropertyChangeEvent@beans@star@sun@com@@
+??1ListEvent@ucb@star@sun@com@@
+??1GlobalTransferCommandArgument@ucb@star@sun@com@@
+?m_pTheBroker@ContentBroker@ucb@@
+?getArray@?$Sequence@UPropertyChangeEvent@beans@star@sun@com@@
+??0Date@util@star@sun@com@@
+??0Time@util@star@sun@com@@
+??0DateTime@util@star@sun@com@@
+??0ClassifiedInteractionRequest@task@star@sun@com@@
+??1AuthenticationRequest@ucb@star@sun@com@@
+??1NameClashResolveRequest@ucb@star@sun@com@@
+_TI2?AVIllegalArgumentException@lang@star@sun@com@@
+_TI2?AVIllegalTypeException@beans@star@sun@com@@
+_TI2?AVNoSupportException@lang@star@sun@com@@
+_TI2?AVNotRemoveableException@beans@star@sun@com@@
+_TI2?AVPropertyExistException@beans@star@sun@com@@
+_TI2?AVUnknownPropertyException@beans@star@sun@com@@
+_TI2?AVUnsupportedCommandException@ucb@star@sun@com@@
+_TI2?AVSQLException@sdbc@star@sun@com@@
+_TI2?AVContentCreationException@ucb@star@sun@com@@
+_TI2?AVListenerAlreadySetException@ucb@star@sun@com@@
+_TI2?AVServiceNotFoundException@ucb@star@sun@com@@
+_TI2?AVCommandFailedException@ucb@star@sun@com@@
+_TI2?AVRuntimeException@uno@star@sun@com@@
+_real@4@00000000000000000000
+_real@8@00000000000000000000
+?makeAndAppendXMLName@ucb@@
+?CreateType@
diff --git a/ucbhelper/util/ucbhelper.xml b/ucbhelper/util/ucbhelper.xml
new file mode 100644
index 000000000000..8e13b5f7bc0c
--- /dev/null
+++ b/ucbhelper/util/ucbhelper.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
+
+ <module-name> ucbhelper </module-name>
+
+ <project-build-dependency> sal </project-build-dependency>
+ <project-build-dependency> salhelper </project-build-dependency>
+ <project-build-dependency> cppu </project-build-dependency>
+ <project-build-dependency> cppuhelper </project-build-dependency>
+
+ <runtime-module-dependency> sal3 </runtime-module-dependency>
+ <runtime-module-dependency> salhelper3$(COM) </runtime-module-dependency>
+ <runtime-module-dependency> cppu3 </runtime-module-dependency>
+ <runtime-module-dependency> cppuhelper3$(COM) </runtime-module-dependency>
+
+ <service-dependency>
+ com.sun.star.configuration.ConfigurationAccess
+ </service-dependency>
+ <service-dependency>
+ com.sun.star.configuration.ConfigurationProvider
+ </service-dependency>
+ <service-dependency>
+ com.sun.star.script.Converter
+ </service-dependency>
+ <service-dependency>
+ com.sun.star.ucb.CachedDynamicResultSetStubFactory
+ </service-dependency>
+ <service-dependency>
+ com.sun.star.ucb.ContentProviderProxyFactory
+ </service-dependency>
+ <service-dependency>
+ com.sun.star.ucb.PropertiesManager
+ </service-dependency>
+ <service-dependency>
+ com.sun.star.ucb.Store
+ </service-dependency>
+ <service-dependency>
+ com.sun.star.ucb.UniversalContentBroker
+ </service-dependency>
+
+ <type> com.sun.star.beans.PropertyAttribute </type>
+ <type> com.sun.star.beans.PropertySetInfoChange </type>
+ <type> com.sun.star.beans.PropertyValue </type>
+ <type> com.sun.star.beans.XPropertiesChangeNotifier </type>
+ <type> com.sun.star.beans.XPropertyAccess </type>
+ <type> com.sun.star.beans.XPropertyContainer </type>
+ <type> com.sun.star.beans.XPropertySetInfo </type>
+ <type> com.sun.star.beans.XPropertySetInfoChangeNotifier </type>
+ <type> com.sun.star.container.XChild </type>
+ <type> com.sun.star.container.XHierarchicalNameAccess </type>
+ <type> com.sun.star.container.XNameAccess </type>
+ <type> com.sun.star.container.XNamed </type>
+ <type> com.sun.star.io.XActiveDataSink </type>
+ <type> com.sun.star.lang.XMultiServiceFactory </type>
+ <type> com.sun.star.lang.XSingleServiceFactory </type>
+ <type> com.sun.star.lang.XServiceInfo </type>
+ <type> com.sun.star.lang.XTypeProvider </type>
+ <type> com.sun.star.registry.XRegistryKey </type>
+ <type> com.sun.star.script.XTypeConverter </type>
+ <type> com.sun.star.sdbc.ColumnValue </type>
+ <type> com.sun.star.sdbc.DataType </type>
+ <type> com.sun.star.sdbc.XCloseable </type>
+ <type> com.sun.star.sdbc.XColumnLocate </type>
+ <type> com.sun.star.sdbc.XResultSetMetaData </type>
+ <type> com.sun.star.sdbc.XResultSetMetaDataSupplier </type>
+ <type> com.sun.star.sdbc.XRow </type>
+ <type> com.sun.star.task.XInteractionAbort </type>
+ <type> com.sun.star.task.XInteractionApprove </type>
+ <type> com.sun.star.task.XInteractionDisapprove </type>
+ <type> com.sun.star.task.XInteractionHandler </type>
+ <type> com.sun.star.task.XInteractionRequest </type>
+ <type> com.sun.star.task.XInteractionRetry </type>
+ <type> com.sun.star.ucb.AuthenticationRequest </type>
+ <type> com.sun.star.ucb.CommandFailedException </type>
+ <type> com.sun.star.ucb.CommandInfoChange </type>
+ <type> com.sun.star.ucb.ContentAction </type>
+ <type> com.sun.star.ucb.ContentCreationError </type>
+ <type> com.sun.star.ucb.ContentCreationException </type>
+ <type> com.sun.star.ucb.GlobalTransferCommandArgument </type>
+ <type> com.sun.star.ucb.InsertCommandArgument </type>
+ <type> com.sun.star.ucb.InteractiveAugmentedIOException </type>
+ <type> com.sun.star.ucb.InteractiveIOException </type>
+ <type> com.sun.star.ucb.ListActionType </type>
+ <type> com.sun.star.ucb.NameClash </type>
+ <type> com.sun.star.ucb.NameClashResolveRequest </type>
+ <type> com.sun.star.ucb.OpenCommandArgument2 </type>
+ <type> com.sun.star.ucb.OpenMode </type>
+ <type> com.sun.star.ucb.ResultSetException </type>
+ <type> com.sun.star.ucb.WelcomeDynamicResultSetStruct </type>
+ <type> com.sun.star.ucb.XCachedDynamicResultSetStubFactory </type>
+ <type> com.sun.star.ucb.XCommandEnvironment </type>
+ <type> com.sun.star.ucb.XCommandInfo </type>
+ <type> com.sun.star.ucb.XCommandInfoChangeNotifier </type>
+ <type> com.sun.star.ucb.XCommandProcessor </type>
+ <type> com.sun.star.ucb.XContentAccess </type>
+ <type> com.sun.star.ucb.XContentCreator </type>
+ <type> com.sun.star.ucb.XContentIdentifierFactory </type>
+ <type> com.sun.star.ucb.XContentProvider </type>
+ <type> com.sun.star.ucb.XContentProviderFactory </type>
+ <type> com.sun.star.ucb.XContentProviderManager </type>
+ <type> com.sun.star.ucb.XDynamicResultSet </type>
+ <type> com.sun.star.ucb.XFileIdentifierConverter </type>
+ <type> com.sun.star.ucb.XInteractionReplaceExistingData </type>
+ <type> com.sun.star.ucb.XInteractionSupplyAuthentication </type>
+ <type> com.sun.star.ucb.XInteractionSupplyName </type>
+ <type> com.sun.star.ucb.XParameterizedContentProvider </type>
+ <type> com.sun.star.ucb.XPropertySetRegistryFactory </type>
+ <type> com.sun.star.ucb.XSourceInitialization </type>
+ <type> com.sun.star.uno.RuntimeException </type>
+ <type> com.sun.star.uno.XWeak </type>
+ <type> com.sun.star.util.XChangesListener </type>
+ <type> com.sun.star.util.XChangesNotifier </type>
+</module-description>
diff --git a/ucbhelper/version.mk b/ucbhelper/version.mk
new file mode 100644
index 000000000000..65623567d819
--- /dev/null
+++ b/ucbhelper/version.mk
@@ -0,0 +1,46 @@
+#*************************************************************************
+#
+# 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
+#
+# $RCSfile: version.mk,v $
+#
+# $Revision: 1.6 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+UCBHELPER_TARGET=ucbhelper
+
+# the major
+UCBHELPER_MAJOR=4
+# the minor
+UCBHELPER_MINOR=0
+# the micro
+UCBHELPER_MICRO=0
+
+# this is a c++ compatible library
+UCBHELPER_CPP=1
+
+UCBHELPER=$(UCBHELPER_TARGET)_$(CMPEXT)
+
+LIBUCBHELPER_UNX=lib$(UCBHELPER).a.$(UCBHELPER_MAJOR)
+LIBUCBHELPER_WIN=$(UCBHELPER_TARGET)$(UCBHELPER_MAJOR)$(CMPEXT).dll
diff --git a/ucbhelper/workben/myucp/exports.map b/ucbhelper/workben/myucp/exports.map
new file mode 100644
index 000000000000..f4ed78b9e970
--- /dev/null
+++ b/ucbhelper/workben/myucp/exports.map
@@ -0,0 +1,8 @@
+UDK_3_0_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ local:
+ *;
+};
diff --git a/ucbhelper/workben/myucp/makefile.mk b/ucbhelper/workben/myucp/makefile.mk
new file mode 100644
index 000000000000..ca6b3f941b0e
--- /dev/null
+++ b/ucbhelper/workben/myucp/makefile.mk
@@ -0,0 +1,93 @@
+#*************************************************************************
+#
+# 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
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.5 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+# @@@ UCP Version - Increase, if your UCP libraray becomes incompatible.
+UCP_VERSION=1
+
+# @@@ Name for your UCP. Will become part of the library name (See below).
+UCP_NAME=myucp
+
+# @@@ Relative path to project root.
+PRJ=..$/..
+
+# @@@ Name of the project your UCP code recides it.
+PRJNAME=ucbhelper
+
+TARGET=ucp$(UCP_NAME)$(UCP_VERSION).uno
+
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+NO_BSYMBOLIC=TRUE
+
+# --- Settings ---------------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# --- General -----------------------------------------------------
+
+# no "lib" prefix
+DLLPRE =
+
+# @@@ Adjust template file names. Add own files here.
+SLOFILES=\
+ $(SLO)$/myucp_services.obj \
+ $(SLO)$/myucp_provider.obj \
+ $(SLO)$/myucp_content.obj \
+ $(SLO)$/myucp_contentcaps.obj \
+ $(SLO)$/myucp_resultset.obj \
+ $(SLO)$/myucp_datasupplier.obj
+
+LIB1TARGET=$(SLB)$/_$(TARGET).lib
+LIB1OBJFILES=$(SLOFILES)
+
+# --- Shared-Library ---------------------------------------------------
+
+SHL1TARGET=$(TARGET)
+SHL1IMPLIB=i$(TARGET)
+SHL1VERSIONMAP=exports.map
+
+# @@@ Add additional libs here.
+SHL1STDLIBS=\
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(SALHELPERLIB) \
+ $(UCBHELPERLIB)
+
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+SHL1LIBS=$(LIB1TARGET)
+
+DEF1NAME=$(SHL1TARGET)
+
+# --- Targets ----------------------------------------------------------
+
+.INCLUDE: target.mk
+
diff --git a/ucbhelper/workben/myucp/myucp_content.cxx b/ucbhelper/workben/myucp/myucp_content.cxx
new file mode 100644
index 000000000000..2be1c0e8b844
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_content.cxx
@@ -0,0 +1,986 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: myucp_content.cxx,v $
+ * $Revision: 1.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#include "osl/diagnose.h"
+
+#include "com/sun/star/beans/PropertyAttribute.hpp"
+#include "com/sun/star/beans/XPropertyAccess.hpp"
+#include "com/sun/star/lang/IllegalAccessException.hpp"
+#include "com/sun/star/sdbc/XRow.hpp"
+#include "com/sun/star/ucb/XCommandInfo.hpp"
+#include "com/sun/star/ucb/XPersistentPropertySet.hpp"
+#include "ucbhelper/contentidentifier.hxx"
+#include "ucbhelper/propertyvalueset.hxx"
+#include "ucbhelper/cancelcommandexecution.hxx"
+
+#include "myucp_content.hxx"
+#include "myucp_provider.hxx"
+
+#ifdef IMPLEMENT_COMMAND_INSERT
+#include "com/sun/star/ucb/InsertCommandArgument.hpp"
+#include "com/sun/star/ucb/MissingInputStreamException.hpp"
+#include "com/sun/star/ucb/MissingPropertiesException.hpp"
+#endif
+#ifdef IMPLEMENT_COMMAND_OPEN
+#include "com/sun/star/io/XOutputStream.hpp"
+#include "com/sun/star/io/XActiveDataSink.hpp"
+#include "com/sun/star/ucb/OpenCommandArgument2.hpp"
+#include "com/sun/star/ucb/OpenMode.hpp"
+#include "com/sun/star/ucb/UnsupportedDataSinkException.hpp"
+#include "com/sun/star/ucb/UnsupportedOpenModeException.hpp"
+#include "myucp_resultset.hxx"
+#endif
+
+using namespace com::sun::star;
+
+// @@@ Adjust namespace name.
+using namespace myucp;
+
+//=========================================================================
+//=========================================================================
+//
+// Content Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+Content::Content( const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ ::ucbhelper::ContentProviderImplHelper* pProvider,
+ const uno::Reference< ucb::XContentIdentifier >& Identifier )
+: ContentImplHelper( rxSMgr, pProvider, Identifier )
+{
+ // @@@ Fill m_aProps here or implement lazy evaluation logic for this.
+ // m_aProps.aTitle =
+ // m_aprops.aContentType =
+ // m_aProps.bIsDocument =
+ // m_aProps.bIsFolder =
+}
+
+//=========================================================================
+// virtual
+Content::~Content()
+{
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL Content::acquire()
+ throw()
+{
+ ContentImplHelper::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL Content::release()
+ throw()
+{
+ ContentImplHelper::release();
+}
+
+//=========================================================================
+// virtual
+uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType )
+ throw ( uno::RuntimeException )
+{
+ uno::Any aRet;
+
+ // @@@ Add support for additional interfaces.
+#if 0
+ aRet = cppu::queryInterface( rType,
+ static_cast< yyy::Xxxxxxxxx * >( this ) );
+#endif
+
+ return aRet.hasValue() ? aRet : ContentImplHelper::queryInterface( rType );
+}
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+XTYPEPROVIDER_COMMON_IMPL( Content );
+
+//=========================================================================
+// virtual
+uno::Sequence< uno::Type > SAL_CALL Content::getTypes()
+ throw( uno::RuntimeException )
+{
+ // @@@ Add own interfaces.
+
+ static cppu::OTypeCollection* pCollection = 0;
+
+ if ( !pCollection )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pCollection )
+ {
+ static cppu::OTypeCollection aCollection(
+ CPPU_TYPE_REF( lang::XTypeProvider ),
+ CPPU_TYPE_REF( lang::XServiceInfo ),
+ CPPU_TYPE_REF( lang::XComponent ),
+ CPPU_TYPE_REF( ucb::XContent ),
+ CPPU_TYPE_REF( ucb::XCommandProcessor ),
+ CPPU_TYPE_REF( beans::XPropertiesChangeNotifier ),
+ CPPU_TYPE_REF( ucb::XCommandInfoChangeNotifier ),
+ CPPU_TYPE_REF( beans::XPropertyContainer ),
+ CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ),
+ CPPU_TYPE_REF( container::XChild ) );
+ pCollection = &aCollection;
+ }
+ }
+
+ return (*pCollection).getTypes();
+}
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+// virtual
+rtl::OUString SAL_CALL Content::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ // @@@ Adjust implementation name.
+ // Prefix with reversed company domain name.
+ return rtl::OUString::createFromAscii( "com.sun.star.comp.myucp.Content" );
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< rtl::OUString > SAL_CALL Content::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ // @@@ Adjust macro name.
+ uno::Sequence< rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[ 0 ]
+ = rtl::OUString::createFromAscii( MYUCP_CONTENT_SERVICE_NAME );
+ return aSNS;
+}
+
+//=========================================================================
+//
+// XContent methods.
+//
+//=========================================================================
+
+// virtual
+rtl::OUString SAL_CALL Content::getContentType()
+ throw( uno::RuntimeException )
+{
+ // @@@ Adjust macro name ( def in myucp_provider.hxx ).
+ return rtl::OUString::createFromAscii( MYUCP_CONTENT_TYPE );
+}
+
+//=========================================================================
+//
+// XCommandProcessor methods.
+//
+//=========================================================================
+
+// virtual
+uno::Any SAL_CALL Content::execute(
+ const ucb::Command& aCommand,
+ sal_Int32 /* CommandId */,
+ const uno::Reference< ucb::XCommandEnvironment >& Environment )
+ throw( uno::Exception,
+ ucb::CommandAbortedException,
+ uno::RuntimeException )
+{
+ uno::Any aRet;
+
+ if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "getPropertyValues" ) ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getPropertyValues
+ //////////////////////////////////////////////////////////////////
+
+ uno::Sequence< beans::Property > Properties;
+ if ( !( aCommand.Argument >>= Properties ) )
+ {
+ OSL_ENSURE( sal_False, "Wrong argument type!" );
+ ::ucbhelper::cancelCommandExecution(
+ uno::makeAny( lang::IllegalArgumentException(
+ rtl::OUString(),
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ // Unreachable
+ }
+
+ aRet <<= getPropertyValues( Properties, Environment );
+ }
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "setPropertyValues" ) ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // setPropertyValues
+ //////////////////////////////////////////////////////////////////
+
+ uno::Sequence< beans::PropertyValue > aProperties;
+ if ( !( aCommand.Argument >>= aProperties ) )
+ {
+ OSL_ENSURE( sal_False, "Wrong argument type!" );
+ ::ucbhelper::cancelCommandExecution(
+ uno::makeAny( lang::IllegalArgumentException(
+ rtl::OUString(),
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ // Unreachable
+ }
+
+ if ( !aProperties.getLength() )
+ {
+ OSL_ENSURE( sal_False, "No properties!" );
+ ::ucbhelper::cancelCommandExecution(
+ uno::makeAny( lang::IllegalArgumentException(
+ rtl::OUString(),
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ // Unreachable
+ }
+
+ aRet <<= setPropertyValues( aProperties, Environment );
+ }
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "getPropertySetInfo" ) ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getPropertySetInfo
+ //////////////////////////////////////////////////////////////////
+
+ // Note: Implemented by base class.
+ aRet <<= getPropertySetInfo( Environment );
+ }
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "getCommandInfo" ) ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // getCommandInfo
+ //////////////////////////////////////////////////////////////////
+
+ // Note: Implemented by base class.
+ aRet <<= getCommandInfo( Environment );
+ }
+#ifdef IMPLEMENT_COMMAND_OPEN
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "open" ) ) )
+ {
+ ucb::OpenCommandArgument2 aOpenCommand;
+ if ( !( aCommand.Argument >>= aOpenCommand ) )
+ {
+ OSL_ENSURE( sal_False, "Wrong argument type!" );
+ ::ucbhelper::cancelCommandExecution(
+ uno::makeAny( lang::IllegalArgumentException(
+ rtl::OUString(),
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ // Unreachable
+ }
+
+ sal_Bool bOpenFolder =
+ ( ( aOpenCommand.Mode == ucb::OpenMode::ALL ) ||
+ ( aOpenCommand.Mode == ucb::OpenMode::FOLDERS ) ||
+ ( aOpenCommand.Mode == ucb::OpenMode::DOCUMENTS ) );
+
+ if ( bOpenFolder /*&& isFolder( Environment )*/ )
+ {
+ // open as folder - return result set
+
+ uno::Reference< ucb::XDynamicResultSet > xSet
+ = new DynamicResultSet( m_xSMgr,
+ this,
+ aOpenCommand,
+ Environment );
+ aRet <<= xSet;
+ }
+
+ if ( aOpenCommand.Sink.is() )
+ {
+ // Open document - supply document data stream.
+
+ // Check open mode
+ if ( ( aOpenCommand.Mode
+ == ucb::OpenMode::DOCUMENT_SHARE_DENY_NONE ) ||
+ ( aOpenCommand.Mode
+ == ucb::OpenMode::DOCUMENT_SHARE_DENY_WRITE ) )
+ {
+ // Unsupported.
+ ::ucbhelper::cancelCommandExecution(
+ uno::makeAny( ucb::UnsupportedOpenModeException(
+ rtl::OUString(),
+ static_cast< cppu::OWeakObject * >( this ),
+ sal_Int16( aOpenCommand.Mode ) ) ),
+ Environment );
+ // Unreachable
+ }
+
+
+ rtl::OUString aURL = m_xIdentifier->getContentIdentifier();
+ uno::Reference< io::XOutputStream > xOut
+ = uno::Reference< io::XOutputStream >(
+ aOpenCommand.Sink, uno::UNO_QUERY );
+ if ( xOut.is() )
+ {
+ // @@@ write data into xOut
+ }
+ else
+ {
+ uno::Reference< io::XActiveDataSink > xDataSink(
+ aOpenCommand.Sink, uno::UNO_QUERY );
+ if ( xDataSink.is() )
+ {
+ uno::Reference< io::XInputStream > xIn
+ /* @@@ your XInputStream + XSeekable impl. object */;
+ xDataSink->setInputStream( xIn );
+ }
+ else
+ {
+ // Note: aOpenCommand.Sink may contain an XStream
+ // implementation. Support for this type of
+ // sink is optional...
+ ::ucbhelper::cancelCommandExecution(
+ uno::makeAny( ucb::UnsupportedDataSinkException(
+ rtl::OUString(),
+ static_cast< cppu::OWeakObject * >( this ),
+ aOpenCommand.Sink ) ),
+ Environment );
+ // Unreachable
+ }
+ }
+ }
+ }
+#endif // IMPLEMENT_COMMAND_OPEN
+
+#ifdef IMPLEMENT_COMMAND_INSERT
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "insert" ) ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // insert
+ //////////////////////////////////////////////////////////////////
+
+ ucb::InsertCommandArgument arg;
+ if ( !( aCommand.Argument >>= arg ) )
+ {
+ OSL_ENSURE( sal_False, "Wrong argument type!" );
+ ::ucbhelper::cancelCommandExecution(
+ uno::makeAny( lang::IllegalArgumentException(
+ rtl::OUString(),
+ static_cast< cppu::OWeakObject * >( this ),
+ -1 ) ),
+ Environment );
+ // Unreachable
+ }
+
+ insert( arg.Data, arg.ReplaceExisting, Environment );
+ }
+#endif // IMPLEMENT_COMMAND_INSERT
+
+#ifdef IMPLEMENT_COMMAND_DELETE
+ else if ( aCommand.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "delete" ) ) )
+ {
+ //////////////////////////////////////////////////////////////////
+ // delete
+ //////////////////////////////////////////////////////////////////
+
+ sal_Bool bDeletePhysical = sal_False;
+ aCommand.Argument >>= bDeletePhysical;
+ destroy( bDeletePhysical );
+
+ // Remove own and all children's Additional Core Properties.
+ removeAdditionalPropertySet( sal_True );
+
+ // Remove own and all childrens(!) persistent data.
+// removeData();
+ }
+#endif // IMPLEMENT_COMMAND_DELETE
+ else
+ {
+ //////////////////////////////////////////////////////////////////
+ // Unsupported command
+ //////////////////////////////////////////////////////////////////
+
+ OSL_ENSURE( sal_False, "Content::execute - unsupported command!" );
+
+ ::ucbhelper::cancelCommandExecution(
+ uno::makeAny( ucb::UnsupportedCommandException(
+ rtl::OUString(),
+ static_cast< cppu::OWeakObject * >( this ) ) ),
+ Environment );
+ // Unreachable
+ }
+
+ return aRet;
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL Content::abort( sal_Int32 )
+ throw( uno::RuntimeException )
+{
+ // @@@ Implement logic to abort running commands, if this makes
+ // sense for your content.
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+// virtual
+rtl::OUString Content::getParentURL()
+{
+ rtl::OUString aURL = m_xIdentifier->getContentIdentifier();
+
+ // @@@ Extract URL of parent from aURL and return it...
+
+ return rtl::OUString();
+}
+
+//=========================================================================
+// static
+uno::Reference< sdbc::XRow > Content::getPropertyValues(
+ const uno::Reference< lang::XMultiServiceFactory >& rSMgr,
+ const uno::Sequence< beans::Property >& rProperties,
+ const ContentProperties& rData,
+ const rtl::Reference<
+ ::ucbhelper::ContentProviderImplHelper >& rProvider,
+ const rtl::OUString& rContentId )
+{
+ // Note: Empty sequence means "get values of all supported properties".
+
+ rtl::Reference< ::ucbhelper::PropertyValueSet > xRow
+ = new ::ucbhelper::PropertyValueSet( rSMgr );
+
+ sal_Int32 nCount = rProperties.getLength();
+ if ( nCount )
+ {
+ uno::Reference< beans::XPropertySet > xAdditionalPropSet;
+ sal_Bool bTriedToGetAdditonalPropSet = sal_False;
+
+ const beans::Property* pProps = rProperties.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const beans::Property& rProp = pProps[ n ];
+
+ // Process Core properties.
+
+ if ( rProp.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "ContentType" ) ) )
+ {
+ xRow->appendString ( rProp, rData.aContentType );
+ }
+ else if ( rProp.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
+ {
+ xRow->appendString ( rProp, rData.aTitle );
+ }
+ else if ( rProp.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) )
+ {
+ xRow->appendBoolean( rProp, rData.bIsDocument );
+ }
+ else if ( rProp.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) )
+ {
+ xRow->appendBoolean( rProp, rData.bIsFolder );
+ }
+
+ // @@@ Process other properties supported directly.
+#if 0
+ else if ( rProp.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "xxxxxx" ) ) )
+ {
+ }
+#endif
+ else
+ {
+ // @@@ Note: If your data source supports adding/removing
+ // properties, you should implement the interface
+ // XPropertyContainer by yourself and supply your own
+ // logic here. The base class uses the service
+ // "com.sun.star.ucb.Store" to maintain Additional Core
+ // properties. But using server functionality is preferred!
+
+ // Not a Core Property! Maybe it's an Additional Core Property?!
+
+ if ( !bTriedToGetAdditonalPropSet && !xAdditionalPropSet.is() )
+ {
+ xAdditionalPropSet
+ = uno::Reference< beans::XPropertySet >(
+ rProvider->getAdditionalPropertySet( rContentId,
+ sal_False ),
+ uno::UNO_QUERY );
+ bTriedToGetAdditonalPropSet = sal_True;
+ }
+
+ if ( xAdditionalPropSet.is() )
+ {
+ if ( !xRow->appendPropertySetValue(
+ xAdditionalPropSet,
+ rProp ) )
+ {
+ // Append empty entry.
+ xRow->appendVoid( rProp );
+ }
+ }
+ else
+ {
+ // Append empty entry.
+ xRow->appendVoid( rProp );
+ }
+ }
+ }
+ }
+ else
+ {
+ // Append all Core Properties.
+ xRow->appendString (
+ beans::Property( rtl::OUString::createFromAscii( "ContentType" ),
+ -1,
+ getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY ),
+ rData.aContentType );
+ xRow->appendString (
+ beans::Property( rtl::OUString::createFromAscii( "Title" ),
+ -1,
+ getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
+ beans::PropertyAttribute::BOUND ),
+ rData.aTitle );
+ xRow->appendBoolean(
+ beans::Property( rtl::OUString::createFromAscii( "IsDocument" ),
+ -1,
+ getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY ),
+ rData.bIsDocument );
+ xRow->appendBoolean(
+ beans::Property( rtl::OUString::createFromAscii( "IsFolder" ),
+ -1,
+ getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY ),
+ rData.bIsFolder );
+
+ // @@@ Append other properties supported directly.
+
+ // @@@ Note: If your data source supports adding/removing
+ // properties, you should implement the interface
+ // XPropertyContainer by yourself and supply your own
+ // logic here. The base class uses the service
+ // "com.sun.star.ucb.Store" to maintain Additional Core
+ // properties. But using server functionality is preferred!
+
+ // Append all Additional Core Properties.
+
+ uno::Reference< beans::XPropertySet > xSet(
+ rProvider->getAdditionalPropertySet( rContentId, sal_False ),
+ uno::UNO_QUERY );
+ xRow->appendPropertySet( xSet );
+ }
+
+ return uno::Reference< sdbc::XRow >( xRow.get() );
+}
+
+//=========================================================================
+uno::Reference< sdbc::XRow > Content::getPropertyValues(
+ const uno::Sequence< beans::Property >& rProperties,
+ const uno::Reference< ucb::XCommandEnvironment >& /* xEnv */)
+{
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+ return getPropertyValues( m_xSMgr,
+ rProperties,
+ m_aProps,
+ rtl::Reference<
+ ::ucbhelper::ContentProviderImplHelper >(
+ m_xProvider.get() ),
+ m_xIdentifier->getContentIdentifier() );
+}
+
+//=========================================================================
+uno::Sequence< uno::Any > Content::setPropertyValues(
+ const uno::Sequence< beans::PropertyValue >& rValues,
+ const uno::Reference< ucb::XCommandEnvironment >& /* xEnv */)
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+
+ uno::Sequence< uno::Any > aRet( rValues.getLength() );
+ uno::Sequence< beans::PropertyChangeEvent > aChanges( rValues.getLength() );
+ sal_Int32 nChanged = 0;
+
+ beans::PropertyChangeEvent aEvent;
+ aEvent.Source = static_cast< cppu::OWeakObject * >( this );
+ aEvent.Further = sal_False;
+// aEvent.PropertyName =
+ aEvent.PropertyHandle = -1;
+// aEvent.OldValue =
+// aEvent.NewValue =
+
+ const beans::PropertyValue* pValues = rValues.getConstArray();
+ sal_Int32 nCount = rValues.getLength();
+
+ uno::Reference< ucb::XPersistentPropertySet > xAdditionalPropSet;
+ sal_Bool bTriedToGetAdditonalPropSet = sal_False;
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const beans::PropertyValue& rValue = pValues[ n ];
+
+ if ( rValue.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "ContentType" ) ) )
+ {
+ // Read-only property!
+ aRet[ n ] <<= lang::IllegalAccessException(
+ rtl::OUString::createFromAscii(
+ "Property is read-only!" ),
+ static_cast< cppu::OWeakObject * >( this ) );
+ }
+ else if ( rValue.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) )
+ {
+ // Read-only property!
+ aRet[ n ] <<= lang::IllegalAccessException(
+ rtl::OUString::createFromAscii(
+ "Property is read-only!" ),
+ static_cast< cppu::OWeakObject * >( this ) );
+ }
+ else if ( rValue.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) )
+ {
+ // Read-only property!
+ aRet[ n ] <<= lang::IllegalAccessException(
+ rtl::OUString::createFromAscii(
+ "Property is read-only!" ),
+ static_cast< cppu::OWeakObject * >( this ) );
+ }
+ else if ( rValue.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "Title" ) ) )
+ {
+ rtl::OUString aNewValue;
+ if ( rValue.Value >>= aNewValue )
+ {
+ if ( aNewValue != m_aProps.aTitle )
+ {
+ aEvent.PropertyName = rValue.Name;
+ aEvent.OldValue = uno::makeAny( m_aProps.aTitle );
+ aEvent.NewValue = uno::makeAny( aNewValue );
+
+ aChanges.getArray()[ nChanged ] = aEvent;
+
+ m_aProps.aTitle = aNewValue;
+ nChanged++;
+ }
+ else
+ {
+ // Old value equals new value. No error!
+ }
+ }
+ else
+ {
+ aRet[ n ] <<= beans::IllegalTypeException(
+ rtl::OUString::createFromAscii(
+ "Property value has wrong type!" ),
+ static_cast< cppu::OWeakObject * >( this ) );
+ }
+ }
+
+ // @@@ Process other properties supported directly.
+#if 0
+ else if ( rValue.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM( "xxxxxx" ) ) )
+ {
+ }
+#endif
+ else
+ {
+ // @@@ Note: If your data source supports adding/removing
+ // properties, you should implement the interface
+ // XPropertyContainer by yourself and supply your own
+ // logic here. The base class uses the service
+ // "com.sun.star.ucb.Store" to maintain Additional Core
+ // properties. But using server functionality is preferred!
+
+ // Not a Core Property! Maybe it's an Additional Core Property?!
+
+ if ( !bTriedToGetAdditonalPropSet && !xAdditionalPropSet.is() )
+ {
+ xAdditionalPropSet = getAdditionalPropertySet( sal_False );
+ bTriedToGetAdditonalPropSet = sal_True;
+ }
+
+ if ( xAdditionalPropSet.is() )
+ {
+ try
+ {
+ uno::Any aOldValue
+ = xAdditionalPropSet->getPropertyValue( rValue.Name );
+ if ( aOldValue != rValue.Value )
+ {
+ xAdditionalPropSet->setPropertyValue(
+ rValue.Name, rValue.Value );
+
+ aEvent.PropertyName = rValue.Name;
+ aEvent.OldValue = aOldValue;
+ aEvent.NewValue = rValue.Value;
+
+ aChanges.getArray()[ nChanged ] = aEvent;
+ nChanged++;
+ }
+ else
+ {
+ // Old value equals new value. No error!
+ }
+ }
+ catch ( beans::UnknownPropertyException const & e )
+ {
+ aRet[ n ] <<= e;
+ }
+ catch ( lang::WrappedTargetException const & e )
+ {
+ aRet[ n ] <<= e;
+ }
+ catch ( beans::PropertyVetoException const & e )
+ {
+ aRet[ n ] <<= e;
+ }
+ catch ( lang::IllegalArgumentException const & e )
+ {
+ aRet[ n ] <<= e;
+ }
+ }
+ else
+ {
+ aRet[ n ] <<= uno::Exception(
+ rtl::OUString::createFromAscii(
+ "No property set for storing the value!" ),
+ static_cast< cppu::OWeakObject * >( this ) );
+ }
+ }
+ }
+
+ if ( nChanged > 0 )
+ {
+ // @@@ Save changes.
+// storeData();
+
+ aGuard.clear();
+ aChanges.realloc( nChanged );
+ notifyPropertiesChange( aChanges );
+ }
+
+ return aRet;
+}
+
+#ifdef IMPLEMENT_COMMAND_INSERT
+
+//=========================================================================
+void Content::queryChildren( ContentRefList& rChildren )
+{
+ // @@@ Adapt method to your URL scheme...
+
+ // Obtain a list with a snapshot of all currently instanciated contents
+ // from provider and extract the contents which are direct children
+ // of this content.
+
+ ::ucbhelper::ContentRefList aAllContents;
+ m_xProvider->queryExistingContents( aAllContents );
+
+ ::rtl::OUString aURL = m_xIdentifier->getContentIdentifier();
+ sal_Int32 nPos = aURL.lastIndexOf( '/' );
+
+ if ( nPos != ( aURL.getLength() - 1 ) )
+ {
+ // No trailing slash found. Append.
+ aURL += ::rtl::OUString::createFromAscii( "/" );
+ }
+
+ sal_Int32 nLen = aURL.getLength();
+
+ ::ucbhelper::ContentRefList::const_iterator it = aAllContents.begin();
+ ::ucbhelper::ContentRefList::const_iterator end = aAllContents.end();
+
+ while ( it != end )
+ {
+ ::ucbhelper::ContentImplHelperRef xChild = (*it);
+ ::rtl::OUString aChildURL
+ = xChild->getIdentifier()->getContentIdentifier();
+
+ // Is aURL a prefix of aChildURL?
+ if ( ( aChildURL.getLength() > nLen ) &&
+ ( aChildURL.compareTo( aURL, nLen ) == 0 ) )
+ {
+ nPos = aChildURL.indexOf( '/', nLen );
+
+ if ( ( nPos == -1 ) ||
+ ( nPos == ( aChildURL.getLength() - 1 ) ) )
+ {
+ // No further slashes / only a final slash. It's a child!
+ rChildren.push_back(
+ ContentRef(
+ static_cast< Content * >( xChild.get() ) ) );
+ }
+ }
+ ++it;
+ }
+}
+
+//=========================================================================
+void Content::insert(
+ const uno::Reference< io::XInputStream > & xInputStream,
+ sal_Bool bReplaceExisting,
+ const uno::Reference< ucb::XCommandEnvironment >& Environment )
+ throw( uno::Exception )
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
+
+ // Check, if all required properties were set.
+
+#if 0
+ // @@@ add checks for property presence
+ if ( m_aProps.xxxx == yyyyy )
+ {
+ OSL_ENSURE( sal_False, "Content::insert - property value missing!" );
+
+ uno::Sequence< rtl::OUString > aProps( 1 );
+ aProps[ 0 ] = rtl::OUString::createFromAscii( "zzzz" );
+ ::ucbhelper::cancelCommandExecution(
+ uno::makeAny( ucb::MissingPropertiesException(
+ rtl::OUString(),
+ static_cast< cppu::OWeakObject * >( this ),
+ aProps ) ),
+ Environment );
+ // Unreachable
+ }
+#endif
+
+ bool bNeedInputStream = true; // @@@ adjust to real requirements
+ if ( bNeedInputStream && !xInputStream.is() )
+ {
+ OSL_ENSURE( sal_False, "Content::insert - No data stream!" );
+
+ ::ucbhelper::cancelCommandExecution(
+ uno::makeAny( ucb::MissingInputStreamException(
+ rtl::OUString(),
+ static_cast< cppu::OWeakObject * >( this ) ) ),
+ Environment );
+ // Unreachable
+ }
+
+ // Assemble new content identifier...
+
+ uno::Reference< ucb::XContentIdentifier > xId /* @@@ create content identifier */;
+
+ // Fail, if a resource with given id already exists.
+ if ( !bReplaceExisting /*&& hasData( xId ) @@@ impl for hasData() */ )
+ {
+ uno::Any aProps
+ = uno::makeAny( beans::PropertyValue(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "Uri" ) ),
+ -1,
+ uno::makeAny( xId->getContentIdentifier() ),
+ beans::PropertyState_DIRECT_VALUE ) );
+ ucbhelper::cancelCommandExecution(
+ ucb::IOErrorCode_ALREADY_EXISTING,
+ uno::Sequence< uno::Any >(&aProps, 1),
+ Environment,
+ rtl::OUString::createFromAscii( "content already existing!!" ),
+ this );
+ // Unreachable
+ }
+
+ m_xIdentifier = xId;
+
+// @@@
+// storeData();
+
+ aGuard.clear();
+ inserted();
+}
+
+#endif // IMPLEMENT_COMMAND_INSERT
+
+#ifdef IMPLEMENT_COMMAND_DELETE
+
+//=========================================================================
+void Content::destroy( sal_Bool bDeletePhysical )
+ throw( uno::Exception )
+{
+ // @@@ take care about bDeletePhysical -> trashcan support
+
+ uno::Reference< ucb::XContent > xThis = this;
+
+ deleted();
+
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ // Process instanciated children...
+
+ ContentRefList aChildren;
+ queryChildren( aChildren );
+
+ ContentRefList::const_iterator it = aChildren.begin();
+ ContentRefList::const_iterator end = aChildren.end();
+
+ while ( it != end )
+ {
+ (*it)->destroy( bDeletePhysical );
+ ++it;
+ }
+}
+
+#endif // IMPLEMENT_COMMAND_DELETE
+
+
diff --git a/ucbhelper/workben/myucp/myucp_content.hxx b/ucbhelper/workben/myucp/myucp_content.hxx
new file mode 100644
index 000000000000..a570533c2519
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_content.hxx
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: myucp_content.hxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef.
+#ifndef _MYUCP_CONTENT_HXX
+#define _MYUCP_CONTENT_HXX
+
+#include <list>
+
+#include "rtl/ref.hxx"
+#include "ucbhelper/contenthelper.hxx"
+
+namespace com { namespace sun { namespace star { namespace beans {
+ struct Property;
+ struct PropertyValue;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace sdbc {
+ class XRow;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace io {
+ class XInputStream;
+} } } }
+
+// @@@ Adjust namespace name.
+namespace myucp
+{
+
+//=========================================================================
+
+// @@@ Adjust service name.
+
+// UNO service name for the content. Prefix with reversed company domain main.
+#define MYUCP_CONTENT_SERVICE_NAME "com.sun.star.ucb.MyContent"
+
+//=========================================================================
+
+struct ContentProperties
+{
+ ::rtl::OUString aTitle; // Title
+ ::rtl::OUString aContentType; // ContentType
+ sal_Bool bIsDocument; // IsDocument
+ sal_Bool bIsFolder; // IsFolder
+
+ // @@@ Add other properties supported by your content.
+
+ ContentProperties()
+ : bIsDocument( sal_True ), bIsFolder( sal_False ) {}
+};
+
+//=========================================================================
+
+class Content : public ::ucbhelper::ContentImplHelper
+{
+ ContentProperties m_aProps;
+
+private:
+ virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property >
+ getProperties( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv );
+ virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >
+ getCommands( const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > & xEnv );
+ virtual ::rtl::OUString getParentURL();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
+ getPropertyValues( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::Property >& rProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ setPropertyValues( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& rValues,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XCommandEnvironment >& xEnv );
+
+#define IMPLEMENT_COMMAND_OPEN
+#define IMPLEMENT_COMMAND_INSERT
+#define IMPLEMENT_COMMAND_DELETE
+
+#ifdef IMPLEMENT_COMMAND_INSERT
+ typedef rtl::Reference< Content > ContentRef;
+ typedef std::list< ContentRef > ContentRefList;
+ void queryChildren( ContentRefList& rChildren );
+
+ // Command "insert"
+ void insert( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream > & xInputStream,
+ sal_Bool bReplaceExisting,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
+ throw( ::com::sun::star::uno::Exception );
+#endif
+
+#ifdef IMPLEMENT_COMMAND_DELETE
+
+ // Command "delete"
+ void destroy( sal_Bool bDeletePhysical )
+ throw( ::com::sun::star::uno::Exception );
+#endif
+
+public:
+ Content( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ ::ucbhelper::ContentProviderImplHelper* pProvider,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Identifier );
+ virtual ~Content();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // XContent
+ virtual rtl::OUString SAL_CALL
+ getContentType()
+ throw( com::sun::star::uno::RuntimeException );
+
+ // XCommandProcessor
+ virtual com::sun::star::uno::Any SAL_CALL
+ execute( const com::sun::star::ucb::Command& aCommand,
+ sal_Int32 CommandId,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& Environment )
+ throw( com::sun::star::uno::Exception,
+ com::sun::star::ucb::CommandAbortedException,
+ com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL
+ abort( sal_Int32 CommandId )
+ throw( com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Additional interfaces
+ //////////////////////////////////////////////////////////////////////
+
+ // @@@ Add additional interfaces ( like com::sun::star::ucb::XContentCreator ).
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+
+ // Called from resultset data supplier.
+ static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
+ getPropertyValues( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rSMgr,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::Property >& rProperties,
+ const ContentProperties& rData,
+ const rtl::Reference<
+ ::ucbhelper::ContentProviderImplHelper >& rProvider,
+ const ::rtl::OUString& rContentId );
+};
+
+}
+
+#endif
diff --git a/ucbhelper/workben/myucp/myucp_contentcaps.cxx b/ucbhelper/workben/myucp/myucp_contentcaps.cxx
new file mode 100644
index 000000000000..1c1d02fe33ae
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_contentcaps.cxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: myucp_contentcaps.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#include "com/sun/star/beans/Property.hpp"
+#include "com/sun/star/beans/PropertyAttribute.hpp"
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/ucb/CommandInfo.hpp"
+#include "com/sun/star/uno/Sequence.hxx"
+
+#include "myucp_content.hxx"
+
+#ifdef IMPLEMENT_COMMAND_INSERT
+#include "com/sun/star/ucb/InsertCommandArgument.hpp"
+#endif
+
+#ifdef IMPLEMENT_COMMAND_OPEN
+#include "com/sun/star/ucb/OpenCommandArgument2.hpp"
+#endif
+
+using namespace com::sun::star;
+
+// @@@ Adjust namespace name.
+using namespace myucp;
+
+//=========================================================================
+//
+// Content implementation.
+//
+//=========================================================================
+
+//=========================================================================
+//
+// IMPORTENT: If any property data ( name / type / ... ) are changed, then
+// Content::getPropertyValues(...) must be adapted too!
+//
+//=========================================================================
+
+// virtual
+uno::Sequence< beans::Property > Content::getProperties(
+ const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
+{
+ // @@@ Add additional properties...
+
+ // @@@ Note: If your data source supports adding/removing properties,
+ // you should implement the interface XPropertyContainer
+ // by yourself and supply your own logic here. The base class
+ // uses the service "com.sun.star.ucb.Store" to maintain
+ // Additional Core properties. But using server functionality
+ // is preferred! In fact you should return a table conatining
+ // even that dynamicly added properties.
+
+// osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ //=================================================================
+ //
+ // Supported properties
+ //
+ //=================================================================
+
+ #define PROPERTY_COUNT 4
+
+ static beans::Property aPropertyInfoTable[] =
+ {
+ ///////////////////////////////////////////////////////////////
+ // Mandatory properties
+ ///////////////////////////////////////////////////////////////
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ContentType" ) ),
+ -1,
+ getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY
+ ),
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ),
+ -1,
+ getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY
+ ),
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ),
+ -1,
+ getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY
+ ),
+ beans::Property(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
+ -1,
+ getCppuType( static_cast< const rtl::OUString * >( 0 ) ),
+ beans::PropertyAttribute::BOUND
+ )
+ ///////////////////////////////////////////////////////////////
+ // Optional standard properties
+ ///////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////
+ // New properties
+ ///////////////////////////////////////////////////////////////
+ };
+ return uno::Sequence<
+ beans::Property >( aPropertyInfoTable, PROPERTY_COUNT );
+}
+
+//=========================================================================
+// virtual
+uno::Sequence< ucb::CommandInfo > Content::getCommands(
+ const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ )
+{
+ // @@@ Add additional commands...
+
+// osl::Guard< osl::Mutex > aGuard( m_aMutex );
+
+ //=================================================================
+ //
+ // Supported commands
+ //
+ //=================================================================
+
+ sal_uInt32 nCommandCount = 4;
+#ifdef IMPLEMENT_COMMAND_DELETE
+ nCommandCount++;
+#endif
+#ifdef IMPLEMENT_COMMAND_INSERT
+ nCommandCount++;
+#endif
+#ifdef IMPLEMENT_COMMAND_OPEN
+ nCommandCount++;
+#endif
+
+ static const ucb::CommandInfo aCommandInfoTable[] =
+ {
+ ///////////////////////////////////////////////////////////////
+ // Mandatory commands
+ ///////////////////////////////////////////////////////////////
+ ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ),
+ -1,
+ getCppuVoidType()
+ ),
+ ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ),
+ -1,
+ getCppuVoidType()
+ ),
+ ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ),
+ -1,
+ getCppuType(
+ static_cast< uno::Sequence< beans::Property > * >( 0 ) )
+ ),
+ ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ),
+ -1,
+ getCppuType(
+ static_cast< uno::Sequence< beans::PropertyValue > * >( 0 ) )
+ )
+ ///////////////////////////////////////////////////////////////
+ // Optional standard commands
+ ///////////////////////////////////////////////////////////////
+
+#ifdef IMPLEMENT_COMMAND_DELETE
+ , ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ),
+ -1,
+ getCppuBooleanType()
+ )
+#endif
+#ifdef IMPLEMENT_COMMAND_INSERT
+ , ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ),
+ -1,
+ getCppuType(
+ static_cast< ucb::InsertCommandArgument * >( 0 ) )
+ )
+#endif
+#ifdef IMPLEMENT_COMMAND_OPEN
+ , ucb::CommandInfo(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ),
+ -1,
+ getCppuType( static_cast< ucb::OpenCommandArgument2 * >( 0 ) )
+ )
+#endif
+ ///////////////////////////////////////////////////////////////
+ // New commands
+ ///////////////////////////////////////////////////////////////
+ };
+
+ return uno::Sequence<
+ ucb::CommandInfo >( aCommandInfoTable, nCommandCount );
+}
+
diff --git a/ucbhelper/workben/myucp/myucp_datasupplier.cxx b/ucbhelper/workben/myucp/myucp_datasupplier.cxx
new file mode 100644
index 000000000000..23154df31439
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_datasupplier.cxx
@@ -0,0 +1,401 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: myucp_datasupplier.cxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#include <vector>
+
+#include "ucbhelper/contentidentifier.hxx"
+#include "ucbhelper/providerhelper.hxx"
+
+#include "myucp_datasupplier.hxx"
+#include "myucp_content.hxx"
+
+using namespace com::sun::star;
+
+// @@@ Adjust namespace name.
+namespace myucp
+{
+
+//=========================================================================
+//
+// struct ResultListEntry.
+//
+//=========================================================================
+
+struct ResultListEntry
+{
+ rtl::OUString aId;
+ uno::Reference< ucb::XContentIdentifier > xId;
+ uno::Reference< ucb::XContent > xContent;
+ uno::Reference< sdbc::XRow > xRow;
+ const ContentProperties& rData;
+
+ ResultListEntry( const ContentProperties& rEntry ) : rData( rEntry ) {}
+};
+
+//=========================================================================
+//
+// ResultList.
+//
+//=========================================================================
+
+typedef std::vector< ResultListEntry* > ResultList;
+
+//=========================================================================
+//
+// struct DataSupplier_Impl.
+//
+//=========================================================================
+
+struct DataSupplier_Impl
+{
+ osl::Mutex m_aMutex;
+ ResultList m_aResults;
+ rtl::Reference< Content > m_xContent;
+ uno::Reference< lang::XMultiServiceFactory > m_xSMgr;
+// @@@ The data source and an iterator for it
+// Entry m_aFolder;
+// Entry::iterator m_aIterator;
+ sal_Int32 m_nOpenMode;
+ sal_Bool m_bCountFinal;
+
+ DataSupplier_Impl( const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ const rtl::Reference< Content >& rContent,
+ sal_Int32 nOpenMode )
+ : m_xContent( rContent ), m_xSMgr( rxSMgr ),
+// m_aFolder( rxSMgr, rContent->getIdentifier()->getContentIdentifier() ),
+ m_nOpenMode( nOpenMode ), m_bCountFinal( sal_False ) {}
+ ~DataSupplier_Impl();
+};
+
+//=========================================================================
+DataSupplier_Impl::~DataSupplier_Impl()
+{
+ ResultList::const_iterator it = m_aResults.begin();
+ ResultList::const_iterator end = m_aResults.end();
+
+ while ( it != end )
+ {
+ delete (*it);
+ it++;
+ }
+}
+
+//=========================================================================
+//=========================================================================
+//
+// DataSupplier Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+DataSupplier::DataSupplier( const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ const rtl::Reference< Content >& rContent,
+ sal_Int32 nOpenMode )
+: m_pImpl( new DataSupplier_Impl( rxSMgr, rContent, nOpenMode ) )
+{
+}
+
+//=========================================================================
+// virtual
+DataSupplier::~DataSupplier()
+{
+ delete m_pImpl;
+}
+
+//=========================================================================
+// virtual
+rtl::OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ {
+ rtl::OUString aId = m_pImpl->m_aResults[ nIndex ]->aId;
+ if ( aId.getLength() )
+ {
+ // Already cached.
+ return aId;
+ }
+ }
+
+ if ( getResult( nIndex ) )
+ {
+ rtl::OUString aId
+ = m_pImpl->m_xContent->getIdentifier()->getContentIdentifier();
+
+ aId += m_pImpl->m_aResults[ nIndex ]->rData.aTitle;
+
+ m_pImpl->m_aResults[ nIndex ]->aId = aId;
+ return aId;
+ }
+ return rtl::OUString();
+}
+
+//=========================================================================
+// virtual
+uno::Reference< ucb::XContentIdentifier >
+DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ {
+ uno::Reference< ucb::XContentIdentifier > xId
+ = m_pImpl->m_aResults[ nIndex ]->xId;
+ if ( xId.is() )
+ {
+ // Already cached.
+ return xId;
+ }
+ }
+
+ rtl::OUString aId = queryContentIdentifierString( nIndex );
+ if ( aId.getLength() )
+ {
+ uno::Reference< ucb::XContentIdentifier > xId
+ = new ::ucbhelper::ContentIdentifier( aId );
+ m_pImpl->m_aResults[ nIndex ]->xId = xId;
+ return xId;
+ }
+ return uno::Reference< ucb::XContentIdentifier >();
+}
+
+//=========================================================================
+// virtual
+uno::Reference< ucb::XContent >
+DataSupplier::queryContent( sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ {
+ uno::Reference< ucb::XContent > xContent
+ = m_pImpl->m_aResults[ nIndex ]->xContent;
+ if ( xContent.is() )
+ {
+ // Already cached.
+ return xContent;
+ }
+ }
+
+ uno::Reference< ucb::XContentIdentifier > xId
+ = queryContentIdentifier( nIndex );
+ if ( xId.is() )
+ {
+ try
+ {
+ uno::Reference< ucb::XContent > xContent
+ = m_pImpl->m_xContent->getProvider()->queryContent( xId );
+ m_pImpl->m_aResults[ nIndex ]->xContent = xContent;
+ return xContent;
+
+ }
+ catch ( ucb::IllegalIdentifierException& )
+ {
+ }
+ }
+ return uno::Reference< ucb::XContent >();
+}
+
+//=========================================================================
+// virtual
+sal_Bool DataSupplier::getResult( sal_uInt32 nIndex )
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_aResults.size() > nIndex )
+ {
+ // Result already present.
+ return sal_True;
+ }
+
+ // Result not (yet) present.
+
+ if ( m_pImpl->m_bCountFinal )
+ return sal_False;
+
+ // Try to obtain result...
+
+ sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
+ sal_Bool bFound = sal_False;
+
+ // @@@ Obtain data and put it into result list...
+/*
+ sal_uInt32 nPos = nOldCount;
+ while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) )
+ {
+ m_pImpl->m_aResults.push_back(
+ new ResultListEntry( *m_pImpl->m_aIterator ) );
+
+ if ( nPos == nIndex )
+ {
+ // Result obtained.
+ bFound = sal_True;
+ break;
+ }
+
+ nPos++;
+ }
+*/
+
+ if ( !bFound )
+ m_pImpl->m_bCountFinal = sal_True;
+
+ rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet().get();
+ if ( xResultSet.is() )
+ {
+ // Callbacks follow!
+ aGuard.clear();
+
+ if ( nOldCount < m_pImpl->m_aResults.size() )
+ xResultSet->rowCountChanged(
+ nOldCount, m_pImpl->m_aResults.size() );
+
+ if ( m_pImpl->m_bCountFinal )
+ xResultSet->rowCountFinal();
+ }
+
+ return bFound;
+}
+
+//=========================================================================
+// virtual
+sal_uInt32 DataSupplier::totalCount()
+{
+ osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( m_pImpl->m_bCountFinal )
+ return m_pImpl->m_aResults.size();
+
+ sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
+
+ // @@@ Obtain data and put it into result list...
+/*
+ while ( m_pImpl->m_aFolder.next( m_pImpl->m_aIterator ) )
+ m_pImpl->m_aResults.push_back(
+ new ResultListEntry( *m_pImpl->m_aIterator ) );
+*/
+ m_pImpl->m_bCountFinal = sal_True;
+
+ rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet().get();
+ if ( xResultSet.is() )
+ {
+ // Callbacks follow!
+ aGuard.clear();
+
+ if ( nOldCount < m_pImpl->m_aResults.size() )
+ xResultSet->rowCountChanged(
+ nOldCount, m_pImpl->m_aResults.size() );
+
+ xResultSet->rowCountFinal();
+ }
+
+ return m_pImpl->m_aResults.size();
+}
+
+//=========================================================================
+// virtual
+sal_uInt32 DataSupplier::currentCount()
+{
+ return m_pImpl->m_aResults.size();
+}
+
+//=========================================================================
+// virtual
+sal_Bool DataSupplier::isCountFinal()
+{
+ return m_pImpl->m_bCountFinal;
+}
+
+//=========================================================================
+// virtual
+uno::Reference< sdbc::XRow >
+DataSupplier::queryPropertyValues( sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ {
+ uno::Reference< sdbc::XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xRow;
+ if ( xRow.is() )
+ {
+ // Already cached.
+ return xRow;
+ }
+ }
+
+ if ( getResult( nIndex ) )
+ {
+ uno::Reference< sdbc::XRow > xRow = Content::getPropertyValues(
+ m_pImpl->m_xSMgr,
+ getResultSet()->getProperties(),
+ m_pImpl->m_aResults[ nIndex ]->rData,
+ m_pImpl->m_xContent->getProvider().get(),
+ queryContentIdentifierString( nIndex ) );
+ m_pImpl->m_aResults[ nIndex ]->xRow = xRow;
+ return xRow;
+ }
+
+ return uno::Reference< sdbc::XRow >();
+}
+
+//=========================================================================
+// virtual
+void DataSupplier::releasePropertyValues( sal_uInt32 nIndex )
+{
+ osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+
+ if ( nIndex < m_pImpl->m_aResults.size() )
+ m_pImpl->m_aResults[ nIndex ]->xRow = uno::Reference< sdbc::XRow >();
+}
+
+//=========================================================================
+// virtual
+void DataSupplier::close()
+{
+}
+
+//=========================================================================
+// virtual
+void DataSupplier::validate()
+ throw( ucb::ResultSetException )
+{
+}
+
+} // namespace
diff --git a/ucbhelper/workben/myucp/myucp_datasupplier.hxx b/ucbhelper/workben/myucp/myucp_datasupplier.hxx
new file mode 100644
index 000000000000..244ecd5d5340
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_datasupplier.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: myucp_datasupplier.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef.
+#ifndef _MYUCP_DATASUPPLIER_HXX
+#define _MYUCP_DATASUPPLIER_HXX
+
+#include "rtl/ref.hxx"
+#include "ucbhelper/resultset.hxx"
+
+// @@@ Adjust namespace name.
+namespace myucp {
+
+struct DataSupplier_Impl;
+class Content;
+
+class DataSupplier : public ucbhelper::ResultSetDataSupplier
+{
+ DataSupplier_Impl* m_pImpl;
+
+public:
+ DataSupplier( const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const rtl::Reference< Content >& rContent,
+ sal_Int32 nOpenMode );
+ virtual ~DataSupplier();
+
+ virtual rtl::OUString queryContentIdentifierString( sal_uInt32 nIndex );
+ virtual com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentIdentifier >
+ queryContentIdentifier( sal_uInt32 nIndex );
+ virtual com::sun::star::uno::Reference< com::sun::star::ucb::XContent >
+ queryContent( sal_uInt32 nIndex );
+
+ virtual sal_Bool getResult( sal_uInt32 nIndex );
+
+ virtual sal_uInt32 totalCount();
+ virtual sal_uInt32 currentCount();
+ virtual sal_Bool isCountFinal();
+
+ virtual com::sun::star::uno::Reference< com::sun::star::sdbc::XRow >
+ queryPropertyValues( sal_uInt32 nIndex );
+ virtual void releasePropertyValues( sal_uInt32 nIndex );
+
+ virtual void close();
+
+ virtual void validate()
+ throw( com::sun::star::ucb::ResultSetException );
+};
+
+}
+
+#endif
diff --git a/ucbhelper/workben/myucp/myucp_provider.cxx b/ucbhelper/workben/myucp/myucp_provider.cxx
new file mode 100644
index 000000000000..268a33c6a19a
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_provider.cxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: myucp_provider.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ *************************************************************************/
+
+#include "osl/diagnose.h"
+#include "osl/mutex.hxx"
+
+#include "ucbhelper/contentidentifier.hxx"
+
+#include "myucp_provider.hxx"
+#include "myucp_content.hxx"
+
+using namespace com::sun::star;
+
+// @@@ Adjust namespace name.
+namespace myucp {
+
+//=========================================================================
+//=========================================================================
+//
+// ContentProvider Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+ContentProvider::ContentProvider(
+ const uno::Reference< lang::XMultiServiceFactory >& rSMgr )
+: ::ucbhelper::ContentProviderImplHelper( rSMgr )
+{
+}
+
+//=========================================================================
+// virtual
+ContentProvider::~ContentProvider()
+{
+}
+
+//=========================================================================
+//
+// XInterface methods.
+//
+//=========================================================================
+
+// @@@ Add own interfaces.
+XINTERFACE_IMPL_3( ContentProvider,
+ lang::XTypeProvider,
+ lang::XServiceInfo,
+ ucb::XContentProvider );
+
+//=========================================================================
+//
+// XTypeProvider methods.
+//
+//=========================================================================
+
+// @@@ Add own interfaces.
+XTYPEPROVIDER_IMPL_3( ContentProvider,
+ lang::XTypeProvider,
+ lang::XServiceInfo,
+ ucb::XContentProvider );
+
+//=========================================================================
+//
+// XServiceInfo methods.
+//
+//=========================================================================
+
+// @@@ Adjust implementation name. Keep the prefix "com.sun.star.comp."!
+// @@@ Adjust service name.
+XSERVICEINFO_IMPL_1( ContentProvider,
+ rtl::OUString::createFromAscii(
+ "com.sun.star.comp.myucp.ContentProvider" ),
+ rtl::OUString::createFromAscii(
+ MYUCP_CONTENT_PROVIDER_SERVICE_NAME ) );
+
+//=========================================================================
+//
+// Service factory implementation.
+//
+//=========================================================================
+
+ONE_INSTANCE_SERVICE_FACTORY_IMPL( ContentProvider );
+
+//=========================================================================
+//
+// XContentProvider methods.
+//
+//=========================================================================
+
+// virtual
+uno::Reference< ucb::XContent > SAL_CALL ContentProvider::queryContent(
+ const uno::Reference< ucb::XContentIdentifier >& Identifier )
+ throw( ucb::IllegalIdentifierException, uno::RuntimeException )
+{
+ // Check URL scheme...
+
+ rtl::OUString aScheme( rtl::OUString::createFromAscii( MYUCP_URL_SCHEME ) );
+ if ( !Identifier->getContentProviderScheme().equalsIgnoreAsciiCase( aScheme ) )
+ throw ucb::IllegalIdentifierException();
+
+ // @@@ Further id checks may go here...
+#if 0
+ if ( id-check-failes )
+ throw ucb::IllegalIdentifierException();
+#endif
+
+ // @@@ Id normalization may go here...
+#if 0
+ // Normalize URL and create new Id.
+ rtl::OUString aCanonicURL = xxxxx( Identifier->getContentIdentifier() );
+ uno::Reference< ucb::XContentIdentifier > xCanonicId
+ = new ::ucbhelper::ContentIdentifier( m_xSMgr, aCanonicURL );
+#else
+ uno::Reference< ucb::XContentIdentifier > xCanonicId = Identifier;
+#endif
+
+ osl::MutexGuard aGuard( m_aMutex );
+
+ // Check, if a content with given id already exists...
+ uno::Reference< ucb::XContent > xContent
+ = queryExistingContent( xCanonicId ).get();
+ if ( xContent.is() )
+ return xContent;
+
+ // @@@ Decision, which content implementation to instanciate may be
+ // made here ( in case you have different content classes ).
+
+ // Create a new content.
+
+ xContent = new Content( m_xSMgr, this, xCanonicId );
+ registerNewContent( xContent );
+
+ if ( !xContent->getIdentifier().is() )
+ throw ucb::IllegalIdentifierException();
+
+ return xContent;
+}
+
+} // namespace
diff --git a/ucbhelper/workben/myucp/myucp_provider.hxx b/ucbhelper/workben/myucp/myucp_provider.hxx
new file mode 100644
index 000000000000..505bf16c8e4a
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_provider.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: myucp_provider.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef.
+#ifndef _MYUCP_PROVIDER_HXX
+#define _MYUCP_PROVIDER_HXX
+
+#include "ucbhelper/providerhelper.hxx"
+
+// @@@ Adjust namespace name.
+namespace myucp {
+
+//=========================================================================
+
+// @@@ Adjust defines.
+
+// UNO service name for the provider. This name will be used by the UCB to
+// create instances of the provider. Prefix with reversed company domain name.
+#define MYUCP_CONTENT_PROVIDER_SERVICE_NAME \
+ "com.sun.star.ucb.MyContentProvider"
+#define MYUCP_CONTENT_PROVIDER_SERVICE_NAME_LENGTH 34
+
+// URL scheme. This is the scheme the provider will be able to create
+// contents for. The UCB will select the provider ( i.e. in order to create
+// contents ) according to this scheme.
+#define MYUCP_URL_SCHEME \
+ "vnd.sun.star.myucp"
+#define MYUCP_URL_SCHEME_LENGTH 18
+
+// UCB Content Type.
+#define MYUCP_CONTENT_TYPE \
+ "application/" MYUCP_URL_SCHEME "-content"
+
+//=========================================================================
+
+class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
+{
+public:
+ ContentProvider( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& rSMgr );
+ virtual ~ContentProvider();
+
+ // XInterface
+ XINTERFACE_DECL()
+
+ // XTypeProvider
+ XTYPEPROVIDER_DECL()
+
+ // XServiceInfo
+ XSERVICEINFO_DECL()
+
+ // XContentProvider
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContent > SAL_CALL
+ queryContent( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::ucb::XContentIdentifier >& Identifier )
+ throw( ::com::sun::star::ucb::IllegalIdentifierException,
+ ::com::sun::star::uno::RuntimeException );
+
+ //////////////////////////////////////////////////////////////////////
+ // Additional interfaces
+ //////////////////////////////////////////////////////////////////////
+
+ //////////////////////////////////////////////////////////////////////
+ // Non-interface methods.
+ //////////////////////////////////////////////////////////////////////
+};
+
+}
+
+#endif
diff --git a/ucbhelper/workben/myucp/myucp_resultset.cxx b/ucbhelper/workben/myucp/myucp_resultset.cxx
new file mode 100644
index 000000000000..3a96041f6b6e
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_resultset.cxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: myucp_resultset.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+/**************************************************************************
+ TODO
+ **************************************************************************
+
+ - This implementation is not a dynamic result set!!! It only implements
+ the necessary interfaces, but never recognizes/notifies changes!!!
+
+ *************************************************************************/
+
+#include "myucp_datasupplier.hxx"
+#include "myucp_resultset.hxx"
+
+using namespace com::sun::star;
+
+// @@@ Adjust namespace name.
+namespace myucp {
+
+//=========================================================================
+//=========================================================================
+//
+// DynamicResultSet Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+DynamicResultSet::DynamicResultSet(
+ const uno::Reference< lang::XMultiServiceFactory >& rxSMgr,
+ const rtl::Reference< Content >& rxContent,
+ const ucb::OpenCommandArgument2& rCommand,
+ const uno::Reference< ucb::XCommandEnvironment >& rxEnv )
+: ResultSetImplHelper( rxSMgr, rCommand ),
+ m_xContent( rxContent ),
+ m_xEnv( rxEnv )
+{
+}
+
+//=========================================================================
+//
+// Non-interface methods.
+//
+//=========================================================================
+
+void DynamicResultSet::initStatic()
+{
+ m_xResultSet1
+ = new ::ucbhelper::ResultSet( m_xSMgr,
+ m_aCommand.Properties,
+ new DataSupplier( m_xSMgr,
+ m_xContent,
+ m_aCommand.Mode ),
+ m_xEnv );
+}
+
+//=========================================================================
+void DynamicResultSet::initDynamic()
+{
+ m_xResultSet1
+ = new ::ucbhelper::ResultSet( m_xSMgr,
+ m_aCommand.Properties,
+ new DataSupplier( m_xSMgr,
+ m_xContent,
+ m_aCommand.Mode ),
+ m_xEnv );
+ m_xResultSet2 = m_xResultSet1;
+}
+
+}
diff --git a/ucbhelper/workben/myucp/myucp_resultset.hxx b/ucbhelper/workben/myucp/myucp_resultset.hxx
new file mode 100644
index 000000000000..703c2ded4907
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_resultset.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: myucp_resultset.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// @@@ Adjust multi-include-protection-ifdef.
+#ifndef _MYUCP_RESULTSET_HXX
+#define _MYUCP_RESULTSET_HXX
+
+#include "rtl/ref.hxx"
+#include "ucbhelper/resultsethelper.hxx"
+
+#include "myucp_content.hxx"
+
+// @@@ Adjust namespace name.
+namespace myucp {
+
+class DynamicResultSet : public ::ucbhelper::ResultSetImplHelper
+{
+ rtl::Reference< Content > m_xContent;
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment > m_xEnv;
+
+private:
+ virtual void initStatic();
+ virtual void initDynamic();
+
+public:
+ DynamicResultSet(
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
+ const rtl::Reference< Content >& rxContent,
+ const com::sun::star::ucb::OpenCommandArgument2& rCommand,
+ const com::sun::star::uno::Reference<
+ com::sun::star::ucb::XCommandEnvironment >& rxEnv );
+};
+
+}
+
+#endif
diff --git a/ucbhelper/workben/myucp/myucp_services.cxx b/ucbhelper/workben/myucp/myucp_services.cxx
new file mode 100644
index 000000000000..f5692706c43f
--- /dev/null
+++ b/ucbhelper/workben/myucp/myucp_services.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: myucp_services.cxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/registry/XRegistryKey.hpp"
+
+#include "myucp_provider.hxx"
+
+using namespace com::sun::star;
+
+namespace {
+
+//=========================================================================
+sal_Bool writeInfo( void * pRegistryKey,
+ const rtl::OUString & rImplementationName,
+ uno::Sequence< rtl::OUString > const & rServiceNames )
+{
+ rtl::OUString aKeyName( rtl::OUString::createFromAscii( "/" ) );
+ aKeyName += rImplementationName;
+ aKeyName += rtl::OUString::createFromAscii( "/UNO/SERVICES" );
+
+ uno::Reference< registry::XRegistryKey > xKey;
+ try
+ {
+ xKey = static_cast< registry::XRegistryKey * >(
+ pRegistryKey )->createKey( aKeyName );
+ }
+ catch ( registry::InvalidRegistryException const & )
+ {
+ }
+
+ if ( !xKey.is() )
+ return sal_False;
+
+ sal_Bool bSuccess = sal_True;
+
+ for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n )
+ {
+ try
+ {
+ xKey->createKey( rServiceNames[ n ] );
+ }
+ catch ( registry::InvalidRegistryException const & )
+ {
+ bSuccess = sal_False;
+ break;
+ }
+ }
+ return bSuccess;
+}
+
+}
+
+//=========================================================================
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+//=========================================================================
+extern "C" sal_Bool SAL_CALL component_writeInfo(
+ void * /*pServiceManager*/, void * pRegistryKey )
+{
+ return pRegistryKey &&
+
+ //////////////////////////////////////////////////////////////////////
+ // Write info into registry.
+ //////////////////////////////////////////////////////////////////////
+
+ // @@@ Adjust namespace names.
+ writeInfo( pRegistryKey,
+ ::myucp::ContentProvider::getImplementationName_Static(),
+ ::myucp::ContentProvider::getSupportedServiceNames_Static() );
+}
+
+//=========================================================================
+extern "C" void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
+{
+ void * pRet = 0;
+
+ uno::Reference< lang::XMultiServiceFactory > xSMgr(
+ reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
+
+ //////////////////////////////////////////////////////////////////////
+ // Create factory, if implementation name matches.
+ //////////////////////////////////////////////////////////////////////
+
+ // @@@ Adjust namespace names.
+ if ( ::myucp::ContentProvider::getImplementationName_Static().
+ compareToAscii( pImplName ) == 0 )
+ {
+ xFactory = ::myucp::ContentProvider::createServiceFactory( xSMgr );
+ }
+
+ //////////////////////////////////////////////////////////////////////
+
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+}
+
diff --git a/ucbhelper/workben/ucbexplorer/bmp/document.bmp b/ucbhelper/workben/ucbexplorer/bmp/document.bmp
new file mode 100644
index 000000000000..63baf47eca46
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/bmp/document.bmp
Binary files differ
diff --git a/ucbhelper/workben/ucbexplorer/bmp/fldclose.bmp b/ucbhelper/workben/ucbexplorer/bmp/fldclose.bmp
new file mode 100644
index 000000000000..c0f26b337f7a
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/bmp/fldclose.bmp
Binary files differ
diff --git a/ucbhelper/workben/ucbexplorer/bmp/fldopen.bmp b/ucbhelper/workben/ucbexplorer/bmp/fldopen.bmp
new file mode 100644
index 000000000000..f38643510e78
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/bmp/fldopen.bmp
Binary files differ
diff --git a/ucbhelper/workben/ucbexplorer/bmp/link.bmp b/ucbhelper/workben/ucbexplorer/bmp/link.bmp
new file mode 100644
index 000000000000..0269a76d98d0
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/bmp/link.bmp
Binary files differ
diff --git a/ucbhelper/workben/ucbexplorer/makefile.mk b/ucbhelper/workben/ucbexplorer/makefile.mk
new file mode 100644
index 000000000000..eb3007349281
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/makefile.mk
@@ -0,0 +1,75 @@
+#*************************************************************************
+#
+# 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
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.8 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=ucbhelper
+TARGET=ucbexplorer
+TARGETTYPE=GUI
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings ---
+
+.INCLUDE : settings.mk
+
+# --- Files ---
+
+OBJFILES=$(OBJ)$/$(TARGET).obj
+
+SRS1NAME=$(TARGET)
+SRC1FILES=$(TARGET).src
+
+#
+# UCBEXPLORER
+#
+
+APP1TARGET=$(TARGET)
+
+RESLIB1NAME=$(TARGET)
+RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
+
+APP1OBJS=$(OBJ)$/$(TARGET).obj
+APP1RES=$(RES)$/$(TARGET).res
+
+APP1STDLIBS=$(SALLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(TOOLSLIB) \
+ $(SVTOOLLIB) \
+ $(COMPHELPERLIB) \
+ $(UCBHELPERLIB) \
+ $(VCLLIB)
+
+# --- Targets ---
+
+.INCLUDE : target.mk
+
diff --git a/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx b/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx
new file mode 100644
index 000000000000..51490ed40296
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/ucbexplorer.cxx
@@ -0,0 +1,1199 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: ucbexplorer.cxx,v $
+ * $Revision: 1.18 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_ucbhelper.hxx"
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/bootstrap.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#ifndef _COM_SUN_STAR_UCB_XCOMMMANDINFO_HPP_
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#endif
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#include <com/sun/star/ucb/XContentCreator.hpp>
+#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
+
+#include "rtl/ref.hxx"
+#include <ucbhelper/content.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <ucbhelper/commandenvironment.hxx>
+#include <svtools/svtreebx.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/msgbox.hxx>
+#include <ucbhelper/macros.hxx>
+#include <ucbhelper/configurationkeys.hxx>
+
+#ifndef _UCBEXPLORER_HRC
+#include "ucbexplorer.hrc"
+#endif
+
+using namespace com::sun::star;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::io;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::sdbc;
+using namespace com::sun::star::task;
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+//=========================================================================
+//
+// class TestDataSink.
+//
+//=========================================================================
+
+class TestDataSink : public cppu::OWeakObject, public XActiveDataSink
+{
+ uno::Reference< XInputStream > m_xStream;
+
+public:
+// TestDataSink() {}
+// virtual ~TestDataSink();
+
+ // XInterface methods
+ virtual Any SAL_CALL queryInterface( const Type & rType )
+ throw( RuntimeException );
+ virtual void SAL_CALL acquire()
+ throw ();
+ virtual void SAL_CALL release()
+ throw ();
+
+ // XActiveDataSink methods.
+ virtual void SAL_CALL setInputStream(
+ const uno::Reference< XInputStream >& aStream )
+ throw( RuntimeException );
+ virtual uno::Reference< XInputStream > SAL_CALL getInputStream()
+ throw( RuntimeException );
+};
+
+//=========================================================================
+//
+// class StringInputDialog.
+//
+//=========================================================================
+
+class StringInputDialog : public ModalDialog
+{
+private:
+ FixedText m_aNameText;
+ Edit m_aNameEdit;
+ GroupBox m_aNameGroup;
+ OKButton m_aOKBtn;
+ CancelButton m_aCancelBtn;
+ HelpButton m_aHelpBtn;
+
+ DECL_LINK( OKHdl, Button * );
+ DECL_LINK( NameHdl, Edit * );
+
+public:
+ StringInputDialog( const String& rTitle,
+ const String& rDefaultText,
+ String* pGroupName = 0 );
+ String GetValue() const { return m_aNameEdit.GetText(); }
+ void SetValue( const String& rNewName ) { m_aNameEdit.SetText( rNewName ); }
+};
+
+//=========================================================================
+//
+// class UcbExplorerListBoxEntry.
+//
+//=========================================================================
+
+class UcbExplorerListBoxEntry : public SvLBoxEntry
+{
+ friend class UcbExplorerTreeListBox;
+
+ enum EntryType { FOLDER, DOCUMENT, LINK };
+
+ ::ucb::Content m_aContent;
+ EntryType m_eType;
+
+public:
+ UcbExplorerListBoxEntry();
+ virtual ~UcbExplorerListBoxEntry();
+
+ BOOL createNewContent( const ContentInfo& rInfo,
+ ::ucb::Content& rNewContent );
+};
+
+//=========================================================================
+//
+// class UcbExplorerTreeListBox.
+//
+//=========================================================================
+
+class UcbExplorerTreeListBox : public SvTreeListBox
+{
+ Bitmap m_aFolderClosed;
+ Bitmap m_aFolderOpened;
+ Bitmap m_aDocument;
+ Bitmap m_aLink;
+
+private:
+ virtual SvLBoxEntry* CreateEntry() const;
+ virtual void RequestingChilds( SvLBoxEntry* pParent );
+
+public:
+ UcbExplorerTreeListBox( Window* pParent, WinBits nWinStyle = 0 );
+ virtual ~UcbExplorerTreeListBox();
+
+ virtual void Command( const CommandEvent& rCEvt );
+
+ UcbExplorerListBoxEntry*
+ InsertEntry( ::ucb::Content& rContent, SvLBoxEntry* pParent );
+ UcbExplorerListBoxEntry*
+ InsertEntry( const String& rURL, SvLBoxEntry* pParent = 0 );
+};
+
+//=========================================================================
+//
+// class UcbExplorerWindow.
+//
+//=========================================================================
+
+class UcbExplorerWindow : public WorkWindow
+{
+ friend class MyApp;
+
+ UcbExplorerTreeListBox m_aTree;
+
+public:
+ UcbExplorerWindow( Window *pParent, WinBits nWinStyle );
+ virtual ~UcbExplorerWindow();
+
+ virtual void Resize();
+};
+
+//=========================================================================
+//
+// class MyApp.
+//
+//=========================================================================
+
+class MyApp : public Application
+{
+public:
+ virtual void Main();
+};
+
+//=========================================================================
+//
+// TestDataSink implementation.
+//
+//=========================================================================
+
+// virtual
+Any SAL_CALL TestDataSink::queryInterface( const Type & rType )
+ throw( RuntimeException )
+{
+ Any aRet = cppu::queryInterface(
+ rType,
+ static_cast< XActiveDataSink * >( this ) );
+ return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL TestDataSink::acquire()
+ throw()
+{
+ OWeakObject::acquire();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL TestDataSink::release()
+ throw()
+{
+ OWeakObject::release();
+}
+
+//=========================================================================
+// virtual
+void SAL_CALL TestDataSink::setInputStream(
+ const uno::Reference< XInputStream >& aStream )
+ throw( RuntimeException )
+{
+ m_xStream = aStream;
+}
+
+//=========================================================================
+// virtual
+uno::Reference< XInputStream > SAL_CALL TestDataSink::getInputStream()
+ throw( RuntimeException )
+{
+ return m_xStream;
+}
+
+//=========================================================================
+//
+// StringInputDialog implementation.
+//
+//=========================================================================
+
+StringInputDialog::StringInputDialog( const String& rTitle,
+ const String& rDefaultText,
+ String* pGroupName )
+: ModalDialog( 0, ResId( DLG_STRINGINPUT ) ),
+ m_aNameText ( this, ResId( FT_STRINGINPUT_DLG_NAME ) ),
+ m_aNameEdit ( this, ResId( ED_STRINGINPUT_DLG_NAME ) ),
+ m_aNameGroup( this, ResId( GB_STRINGINPUT_DLG_NAME ) ),
+ m_aOKBtn ( this, ResId( BT_STRINGINPUT_DLG_OK ) ),
+ m_aCancelBtn( this, ResId( BT_STRINGINPUT_DLG_CANCEL ) ),
+ m_aHelpBtn ( this, ResId( BT_STRINGINPUT_DLG_HELP ) )
+{
+ FreeResource();
+ SetText( rTitle );
+ m_aNameEdit.SetText( rDefaultText );
+ m_aOKBtn.SetClickHdl( LINK( this, StringInputDialog, OKHdl ) );
+ m_aNameEdit.SetModifyHdl( LINK( this, StringInputDialog, NameHdl ) );
+
+ if ( pGroupName )
+ m_aNameGroup.SetText( *pGroupName );
+};
+
+//=========================================================================
+IMPL_LINK( StringInputDialog, OKHdl, Button *, EMPTYARG )
+{
+ // trim the strings
+ m_aNameEdit.SetText(
+ m_aNameEdit.GetText().EraseLeadingChars().EraseTrailingChars() );
+ EndDialog( RET_OK );
+ return 1;
+}
+
+//=========================================================================
+IMPL_LINK( StringInputDialog, NameHdl, Edit *, EMPTYARG )
+{
+/*
+ // trim the strings
+ String aName = m_aNameEdit.GetText();
+ aName.EraseLeadingChars().EraseTrailingChars();
+ if ( aName.Len() )
+ {
+ if ( !m_aOKBtn.IsEnabled() )
+ m_aOKBtn.Enable( TRUE );
+ }
+ else
+ {
+ if ( m_aOKBtn.IsEnabled() )
+ m_aOKBtn.Enable( FALSE );
+ }
+*/
+ return 0;
+}
+
+//=========================================================================
+//
+// UcbExplorerListBoxEntry implementation.
+//
+//=========================================================================
+
+UcbExplorerListBoxEntry::UcbExplorerListBoxEntry()
+{
+}
+
+//=========================================================================
+// virtual
+UcbExplorerListBoxEntry::~UcbExplorerListBoxEntry()
+{
+}
+
+//=========================================================================
+BOOL UcbExplorerListBoxEntry::createNewContent( const ContentInfo& rInfo,
+ ::ucb::Content& rNewContent )
+{
+ sal_Int32 nCount = rInfo.Properties.getLength();
+ Sequence< Any > aPropValues( nCount );
+ Sequence< OUString > aPropNames( nCount );
+
+ if ( nCount > 0 )
+ {
+ // Collect property values.
+
+ Any* pValues = aPropValues.getArray();
+ const Property* pProps = rInfo.Properties.getConstArray();
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const OUString& rName = pProps[ n ].Name;
+ StringInputDialog* pDlg = new StringInputDialog( rName, rName );
+ USHORT nRet = pDlg->Execute();
+ if ( nRet == RET_OK )
+ {
+ OUString aValue( pDlg->GetValue() );
+
+ // Convert value according to supplied type info...
+
+ const Type& rType = pProps[ n ].Type;
+
+ if ( rType == getCppuType(
+ static_cast< const OUString * >( 0 ) ) )
+ {
+ // string
+ pValues[ n ] <<= aValue;
+ }
+ else if ( rType == getCppuType(
+ static_cast< const sal_Int32 * >( 0 ) ) )
+ {
+ // long
+ pValues[ n ] <<= aValue.toInt32();
+ }
+ else if ( rType == getCppuType(
+ static_cast< const sal_Int16 * >( 0 ) ) )
+ {
+ // short
+ pValues[ n ] <<= sal_Int16( aValue.toInt32() ) ;
+ }
+ else if ( rType == getCppuBooleanType() )
+ {
+ // boolean
+ pValues[ n ] <<= sal_Bool( aValue.toChar() ) ;
+ }
+ else if ( rType == getCppuCharType() )
+ {
+ // char
+ pValues[ n ] <<= aValue.toChar();
+ }
+ else if ( rType == getCppuType(
+ static_cast< const sal_Int8 * >( 0 ) ) )
+ {
+ // byte
+ pValues[ n ] <<= sal_Int8( aValue.toChar() ) ;
+ }
+ else if ( rType == getCppuType(
+ static_cast< const sal_Int64 * >( 0 ) ) )
+ {
+ // hyper
+ pValues[ n ] <<= aValue.toInt64();
+ }
+ else if ( rType == getCppuType(
+ static_cast< const float * >( 0 ) ) )
+ {
+ // float
+ pValues[ n ] <<= aValue.toFloat();
+ }
+ else if ( rType == getCppuType(
+ static_cast< const double * >( 0 ) ) )
+ {
+ // double
+ pValues[ n ] <<= aValue.toDouble();
+ }
+ else
+ {
+ // See com/sun/star/ucb/ContentInfo.idl
+ DBG_ERROR( "UcbExplorerListBoxEntry::createNewContent - "
+ "Invlid type for bootstrap property!" );
+ }
+ }
+
+ delete pDlg;
+
+ if ( nRet != RET_OK )
+ return FALSE;
+
+ aPropNames[ n ] = rName;
+ }
+ }
+
+ uno::Reference< XInputStream > xData;
+
+ if ( rInfo.Attributes & ContentInfoAttribute::INSERT_WITH_INPUTSTREAM )
+ {
+ // Let the user specify the URL of a content containing the
+ // data to supply to the new content.
+
+ StringInputDialog* pDlg = new StringInputDialog(
+ OUString::createFromAscii(
+ "Document Data Source URL" ),
+ OUString() );
+ USHORT nRet = pDlg->Execute();
+ if ( nRet == RET_OK )
+ {
+ // Create a content object for the given URL.
+
+ OUString aSourceURL( pDlg->GetValue() );
+ if ( aSourceURL.getLength() == 0 )
+ {
+ DBG_ERROR( "UcbExplorerListBoxEntry::createNewContent - "
+ "No document data URL!" );
+ return FALSE;
+ }
+
+ try
+ {
+ uno::Reference< XCommandEnvironment > xEnv;
+
+ ::ucb::ContentBroker* pBroker = ::ucb::ContentBroker::get();
+ if ( pBroker )
+ {
+ uno::Reference< XInteractionHandler > xInteractionHandler(
+ pBroker->getServiceManager()->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.task.InteractionHandler" ) ),
+ UNO_QUERY );
+
+ uno::Reference< XProgressHandler > xProgressHandler
+ /* = new ProgressHandler( *pBroker ) */ ;
+
+ xEnv = new ::ucb::CommandEnvironment( xInteractionHandler,
+ xProgressHandler );
+ }
+
+ ::ucb::Content aSourceContent( aSourceURL, xEnv );
+
+ // Get source data.
+ rtl::Reference< TestDataSink > xSourceData = new TestDataSink;
+ aSourceContent.openStream( xSourceData.getBodyPtr() );
+ xData = xSourceData->getInputStream();
+ }
+ catch ( ContentCreationException const & )
+ {
+ DBG_ERROR( "UcbExplorerListBoxEntry::createNewContent - "
+ "No content for document data!" );
+ return FALSE;
+ }
+ catch ( CommandAbortedException const & )
+ {
+ return FALSE;
+ }
+ catch ( RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( Exception const & )
+ {
+ return FALSE;
+ }
+ }
+
+ delete pDlg;
+
+ if ( nRet != RET_OK )
+ return FALSE;
+ }
+
+ // Create new content.
+
+ ULONG n = Application::ReleaseSolarMutex();
+ BOOL bRet = sal_False;
+
+ try
+ {
+ bRet = m_aContent.insertNewContent(
+ rInfo.Type, aPropNames, aPropValues, xData, rNewContent );
+ }
+ catch ( CommandAbortedException const & )
+ {
+ }
+ catch ( RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( Exception const & )
+ {
+ }
+
+ Application::AcquireSolarMutex( n );
+ return bRet;
+}
+
+//=========================================================================
+//
+// UcbExplorerTreeListBox implementation.
+//
+//=========================================================================
+
+UcbExplorerTreeListBox::UcbExplorerTreeListBox(
+ Window* pParent, WinBits nWinStyle )
+: SvTreeListBox( pParent, nWinStyle ),
+ m_aFolderClosed( ResId( BMP_FOLDER_CLOSED ) ),
+ m_aFolderOpened( ResId( BMP_FOLDER_OPENED ) ),
+ m_aDocument( ResId( BMP_DOCUMENT ) ),
+ m_aLink( ResId( BMP_LINK ) )
+{
+}
+
+//=========================================================================
+// virtual
+UcbExplorerTreeListBox::~UcbExplorerTreeListBox()
+{
+}
+
+//=========================================================================
+// virtual
+SvLBoxEntry* UcbExplorerTreeListBox::CreateEntry() const
+{
+ return new UcbExplorerListBoxEntry();
+}
+
+//=========================================================================
+// virtual
+void UcbExplorerTreeListBox::RequestingChilds( SvLBoxEntry* pParent )
+{
+ UcbExplorerListBoxEntry* pEntry
+ = static_cast< UcbExplorerListBoxEntry * >( pParent );
+ if ( !pEntry->HasChilds() )
+ {
+ switch ( pEntry->m_eType )
+ {
+ case UcbExplorerListBoxEntry::FOLDER:
+ {
+ ULONG n = Application::ReleaseSolarMutex();
+
+ try
+ {
+ Sequence< OUString > aPropertyNames( 0 );
+// OUString* pNames = aPropertyNames.getArray();
+// pNames[ 0 ] = OUString::createFromAscii( "Title" );
+
+ uno::Reference< XResultSet > xResultSet
+ = pEntry->m_aContent.createCursor(
+ aPropertyNames,
+ ::ucb::INCLUDE_FOLDERS_AND_DOCUMENTS );
+ uno::Reference< XContentAccess > xContentAccess(
+ xResultSet, UNO_QUERY );
+
+ if ( xResultSet.is() && xContentAccess.is() )
+ {
+ while ( xResultSet->next() )
+ {
+ Application::AcquireSolarMutex( n );
+
+ InsertEntry(
+ xContentAccess->queryContentIdentifierString(),
+ pParent );
+
+ n = Application::ReleaseSolarMutex();
+ }
+ }
+ }
+ catch ( CommandAbortedException const & )
+ {
+ }
+ catch ( RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( Exception const & )
+ {
+ }
+
+ Application::AcquireSolarMutex( n );
+ break;
+ }
+
+ case UcbExplorerListBoxEntry::DOCUMENT:
+ break;
+
+ case UcbExplorerListBoxEntry::LINK:
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+//=========================================================================
+// virtual
+void UcbExplorerTreeListBox::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ const Point& rPos = rCEvt.GetMousePosPixel();
+ UcbExplorerListBoxEntry* pEntry
+ = static_cast< UcbExplorerListBoxEntry * >(
+ GetEntry( rPos, TRUE ) );
+ if ( pEntry )
+ {
+ PopupMenu* pMenu = new PopupMenu( ResId( MENU_POPUP ) );
+ PopupMenu* pNewMenu = 0;
+
+// pMenu->SetSelectHdl( LINK( this,
+// SfxCommonTemplateDialog_Impl,
+// MenuSelectHdl ) );
+
+ //////////////////////////////////////////////////////////////
+ // Configure "New"
+ //////////////////////////////////////////////////////////////
+
+ uno::Reference< XContentCreator > xCreator(
+ pEntry->m_aContent.get(), UNO_QUERY );
+ Sequence< ContentInfo > aInfo;
+ BOOL bCanCreate = xCreator.is();
+ if ( bCanCreate )
+ {
+ aInfo = xCreator->queryCreatableContentsInfo();
+ const ContentInfo* pInfo = aInfo.getConstArray();
+ sal_Int32 nCount = aInfo.getLength();
+ bCanCreate = ( nCount > 0 );
+
+ pNewMenu = new PopupMenu;
+ pMenu->SetPopupMenu( MENU_NEW, pNewMenu );
+
+ for ( sal_Int32 n = 0; n < nCount; ++n )
+ {
+ const ContentInfo& rInfo = pInfo[ n ];
+ pNewMenu->InsertItem( 20000 + n + 1, rInfo.Type );
+ }
+ }
+
+ pMenu->EnableItem( MENU_NEW, bCanCreate );
+
+ //////////////////////////////////////////////////////////////
+ // Configure "Rename"
+ //////////////////////////////////////////////////////////////
+
+ sal_Bool bEnable = sal_False;
+
+ try
+ {
+ Property aProp =
+ pEntry->m_aContent.getProperties()->getPropertyByName(
+ OUString::createFromAscii( "Title" ) );
+ bEnable = !( aProp.Attributes & PropertyAttribute::READONLY );
+ }
+ catch( UnknownPropertyException const & )
+ {
+ // getPropertyByName
+ bEnable = sal_False;
+ }
+ catch ( CommandAbortedException const & )
+ {
+ }
+ catch ( RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( Exception const & )
+ {
+ }
+
+ pMenu->EnableItem( MENU_RENAME, bEnable );
+
+ //////////////////////////////////////////////////////////////
+ // Configure "Delete"
+ //////////////////////////////////////////////////////////////
+
+ try
+ {
+ pMenu->EnableItem( MENU_DELETE,
+ pEntry->m_aContent
+ .getCommands()->hasCommandByName(
+ OUString::createFromAscii(
+ "delete" ) ) );
+ }
+ catch ( CommandAbortedException const & )
+ {
+ }
+ catch ( RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( Exception const & )
+ {
+ }
+
+ //////////////////////////////////////////////////////////////
+ // Execute menu.
+ //////////////////////////////////////////////////////////////
+
+ USHORT nSelected = pMenu->Execute( this, rPos );
+ switch ( nSelected )
+ {
+// case MENU_NEW:
+// break;
+
+ case MENU_RENAME:
+ {
+ OUString aNewTitle;
+
+ try
+ {
+ pEntry->m_aContent.getPropertyValue(
+ OUString::createFromAscii( "Title" ) )
+ >>= aNewTitle;
+ }
+ catch ( CommandAbortedException const & )
+ {
+ }
+ catch ( RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( Exception const & )
+ {
+ }
+
+ StringInputDialog* pDlg
+ = new StringInputDialog(
+ OUString::createFromAscii( "Title" ),
+ aNewTitle );
+
+ USHORT nRet = pDlg->Execute();
+
+ Any aValue;
+
+ if ( nRet == RET_OK )
+ {
+ aNewTitle = pDlg->GetValue();
+ aValue <<= aNewTitle;
+ }
+
+ delete pDlg;
+
+ if ( nRet != RET_OK )
+ break;
+
+ sal_Bool bOK = sal_False;
+
+ ULONG n = Application::ReleaseSolarMutex();
+
+ try
+ {
+ pEntry->m_aContent.setPropertyValue(
+ OUString::createFromAscii( "Title" ),
+ aValue );
+ bOK = sal_True;
+ }
+ catch ( CommandAbortedException const & )
+ {
+ }
+ catch ( RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( Exception const & )
+ {
+ }
+
+ Application::AcquireSolarMutex( n );
+
+ if ( bOK )
+ {
+ OUString aText( aNewTitle );
+ OUString aTargetURL;
+ try
+ {
+ pEntry->m_aContent.getPropertyValue(
+ OUString::createFromAscii( "TargetURL" ) )
+ >>= aTargetURL;
+ }
+ catch ( CommandAbortedException const & )
+ {
+ }
+ catch ( RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( Exception const & )
+ {
+ // The property is optional!
+ }
+
+ if ( aTargetURL.getLength() > 0 )
+ {
+ // Insert link.
+ aText += OUString::createFromAscii( " --> " );
+ aText += aTargetURL;
+ }
+
+ SetEntryText( pEntry, aText );
+ }
+ break;
+ }
+
+ case MENU_DELETE:
+ {
+ ULONG n = Application::ReleaseSolarMutex();
+ sal_Bool bOK = sal_True;
+
+ try
+ {
+ pEntry->m_aContent.executeCommand(
+ OUString::createFromAscii( "delete" ),
+ makeAny( sal_True ) );
+ }
+ catch ( CommandAbortedException const & )
+ {
+ bOK = sal_False;
+ }
+ catch ( RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( Exception const & )
+ {
+ bOK = sal_False;
+ }
+
+ Application::AcquireSolarMutex( n );
+
+ if ( bOK )
+ RemoveSelection();
+
+ break;
+ }
+
+ default:
+ {
+ if ( ( nSelected > 20000 ) &&
+ ( ( nSelected - 20000 ) <= aInfo.getLength() ) )
+ {
+ // New-menu entry selected.
+
+ ::ucb::Content aNewContent;
+ if ( pEntry->createNewContent(
+ aInfo.getConstArray()[ nSelected - 20001 ],
+ aNewContent ) )
+ {
+ if ( !IsExpanded( pEntry ) )
+ Expand( pEntry );
+ else
+ InsertEntry( aNewContent, pEntry );
+ }
+ }
+ break;
+ }
+ }
+
+ delete pNewMenu;
+ delete pMenu;
+ return;
+ }
+ }
+
+ SvTreeListBox::Command( rCEvt );
+}
+
+//=========================================================================
+UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
+ ::ucb::Content& rContent,
+ SvLBoxEntry* pParent )
+{
+ try
+ {
+ OUString aTitle;
+ rContent.getPropertyValue(
+ OUString::createFromAscii( "Title" ) ) >>= aTitle;
+ if ( !aTitle.getLength() )
+ aTitle = OUString::createFromAscii( "/" );
+
+ UcbExplorerListBoxEntry* pEntry = 0;
+
+ if ( rContent.isFolder() )
+ {
+ // Insert folder.
+ pEntry = static_cast< UcbExplorerListBoxEntry * >(
+ SvTreeListBox::InsertEntry( aTitle,
+ m_aFolderOpened,
+ m_aFolderClosed,
+ pParent,
+ TRUE ) );
+ pEntry->m_eType = UcbExplorerListBoxEntry::FOLDER;
+ }
+ else
+ {
+ OUString aTargetURL;
+ try
+ {
+ rContent.getPropertyValue(
+ OUString::createFromAscii( "TargetURL" ) ) >>= aTargetURL;
+ }
+ catch ( CommandAbortedException const & )
+ {
+ }
+ catch ( RuntimeException const & )
+ {
+ throw;
+ }
+ catch ( Exception const & )
+ {
+ // The property is optional!
+ }
+
+ if ( aTargetURL.getLength() > 0 )
+ {
+ // Insert link.
+ aTitle += OUString::createFromAscii( " --> " );
+ aTitle += aTargetURL;
+ pEntry = static_cast< UcbExplorerListBoxEntry * >(
+ SvTreeListBox::InsertEntry( aTitle,
+ m_aLink,
+ m_aLink,
+ pParent,
+ TRUE ) );
+ pEntry->m_eType = UcbExplorerListBoxEntry::LINK;
+ }
+ else
+ {
+ // Insert Document
+ pEntry = static_cast< UcbExplorerListBoxEntry * >(
+ SvTreeListBox::InsertEntry( aTitle,
+ m_aDocument,
+ m_aDocument,
+ pParent,
+ TRUE ) );
+ pEntry->m_eType = UcbExplorerListBoxEntry::DOCUMENT;
+ }
+ }
+
+ pEntry->m_aContent = rContent;
+ return pEntry;
+ }
+ catch ( CommandAbortedException const & )
+ {
+ }
+ catch ( Exception const & )
+ {
+ }
+
+ return 0;
+}
+
+//=========================================================================
+UcbExplorerListBoxEntry* UcbExplorerTreeListBox::InsertEntry(
+ const String& rURL,
+ SvLBoxEntry* pParent )
+{
+ try
+ {
+ uno::Reference< XCommandEnvironment > xEnv;
+
+ ::ucb::ContentBroker* pBroker = ::ucb::ContentBroker::get();
+ if ( pBroker )
+ {
+ uno::Reference< XInteractionHandler > xInteractionHandler(
+ pBroker->getServiceManager()->createInstance(
+ OUString::createFromAscii(
+ "com.sun.star.task.InteractionHandler" ) ),
+ UNO_QUERY );
+
+ uno::Reference< XProgressHandler > xProgressHandler
+ /* = new ProgressHandler( *pBroker ) */ ;
+
+ xEnv = new ::ucb::CommandEnvironment( xInteractionHandler,
+ xProgressHandler );
+ }
+
+ ::ucb::Content aContent( rURL, xEnv );
+ return InsertEntry( aContent, pParent );
+ }
+ catch ( ContentCreationException const & )
+ {
+ }
+
+ return 0;
+}
+
+//=========================================================================
+//
+// UcbExplorerWindow implementation.
+//
+//=========================================================================
+
+UcbExplorerWindow::UcbExplorerWindow( Window *pParent, WinBits nWinStyle )
+: WorkWindow( pParent, nWinStyle ),
+ m_aTree( this, WB_HSCROLL )
+{
+ Font aTreeFont( m_aTree.GetFont() );
+ aTreeFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM("Courier") ) );
+ aTreeFont.SetFamily( FAMILY_MODERN );
+ aTreeFont.SetPitch( PITCH_FIXED );
+ aTreeFont.SetSize( Size( 0, 12 ) );
+
+ m_aTree.SetFont( aTreeFont );
+ m_aTree.SetIndent( 20 );
+ m_aTree.SetPosPixel( Point( 0, 0 ) );
+
+ m_aTree.Show();
+}
+
+//-------------------------------------------------------------------------
+// virtual
+UcbExplorerWindow::~UcbExplorerWindow()
+{
+}
+
+//-------------------------------------------------------------------------
+// virtual
+void UcbExplorerWindow::Resize()
+{
+ m_aTree.SetSizePixel( GetOutputSizePixel() );
+}
+
+//=========================================================================
+//
+// MyApp implementation.
+//
+//=========================================================================
+
+// virtual
+void MyApp::Main()
+{
+ //////////////////////////////////////////////////////////////////////
+ // Initialize local Service Manager and basic services.
+ //////////////////////////////////////////////////////////////////////
+
+ uno::Reference< XMultiServiceFactory > xFac;
+ try
+ {
+ uno::Reference< XComponentContext > xCtx(
+ cppu::defaultBootstrap_InitialComponentContext() );
+ if ( !xCtx.is() )
+ {
+ DBG_ERROR( "Error creating initial component context!" );
+ return;
+ }
+
+ xFac = uno::Reference< XMultiServiceFactory >(
+ xCtx->getServiceManager(), UNO_QUERY );
+
+ if ( !xFac.is() )
+ {
+ DBG_ERROR( "No service manager!" );
+ return;
+ }
+ }
+ catch ( com::sun::star::uno::Exception const & )
+ {
+ DBG_ERROR( "Exception during creation of initial component context!" );
+ return;
+ }
+
+ comphelper::setProcessServiceFactory( xFac );
+
+ unO::Reference< XComponent > xComponent( xFac, UNO_QUERY );
+
+ //////////////////////////////////////////////////////////////////////
+ // Create UCB.
+ //////////////////////////////////////////////////////////////////////
+
+#if 1
+ // Init UCB (Read configuration from registry)
+ Sequence< Any > aArgs( 2 );
+ aArgs[ 0 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL );
+ aArgs[ 1 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE );
+ sal_Bool bSuccess = ::ucb::ContentBroker::initialize( xFac, aArgs );
+#else
+ // Init UCB (Use provided configuration data)
+ ::ucb::ContentProviderDataList aProviders;
+ aProviders.push_back(
+ ::ucb::ContentProviderData(
+ OUString::createFromAscii( "com.sun.star.ucb.FileContentProvider" ),
+ OUString::createFromAscii( "file" ),
+ OUString() ) );
+ sal_Bool bSuccess = ::ucb::ContentBroker::initialize( xFac, aProviders );
+#endif
+
+ if ( !bSuccess )
+ {
+ DBG_ERROR( "Error creating UCB!" );
+ return;
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Create/init/show app window.
+ //////////////////////////////////////////////////////////////////////
+
+ ResMgr* pMgr = ResMgr::CreateResMgr( CREATEVERSIONRESMGR( ucbexplorer ) );
+ Resource::SetResManager( pMgr );
+
+ UcbExplorerWindow aAppWin( 0, WB_APP | WB_STDWORK );
+
+ MenuBar aMBMain( ResId( MENU_MAIN ) );
+
+ // Check for command line params
+#if 0
+ for ( int i = 0; i < GetCommandLineParamCount(); ++i )
+ {
+ String aPara = GetCommandLineParam( i );
+ }
+#endif
+
+ String aRootURL = GetCommandLineParam( 0 );
+ if ( aRootURL.Len() == 0 )
+ aRootURL = UniString::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.hier:/" ) );
+
+ String aTitle( ResId( TEXT_TITLEBAR ) );
+ aTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " ) );
+ aTitle += aRootURL;
+
+ aAppWin.SetText( aTitle );
+
+ aAppWin.SetPosSizePixel( 0, 0, 500, 750 );
+
+ aAppWin.Show();
+
+ aAppWin.m_aTree.InsertEntry( aRootURL );
+
+ //////////////////////////////////////////////////////////////////////
+ // Execute app.
+ //////////////////////////////////////////////////////////////////////
+
+ Execute();
+
+ //////////////////////////////////////////////////////////////////////
+ // Cleanup.
+ //////////////////////////////////////////////////////////////////////
+
+ // m_aTree holds UCB contents!
+ aAppWin.m_aTree.Clear();
+
+ ::ucb::ContentBroker::deinitialize();
+
+ if ( xComponent.is() )
+ xComponent->dispose();
+}
+
+//=========================================================================
+//
+// The Application.
+//
+//=========================================================================
+
+MyApp aMyApp;
+
diff --git a/ucbhelper/workben/ucbexplorer/ucbexplorer.hrc b/ucbhelper/workben/ucbexplorer/ucbexplorer.hrc
new file mode 100644
index 000000000000..42ef0732c0e5
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/ucbexplorer.hrc
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: ucbexplorer.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+//=========================================================================
+//
+// UCB Explorer ( resource identifiers )
+//
+// (C) 2000 StarOffice Entwicklungs GmbH, Hamburg, Germany
+//
+// $Author: rt $ $Date: 2008-04-10 16:19:47 $Revision$
+//
+//=========================================================================
+
+#ifndef _UCBEXPLORER_HRC
+#define _UCBEXPLORER_HRC
+
+#define MENU_MAIN 1000
+#define MENU_FILE 100
+#define MENU_EXIT 10
+
+#define MENU_POPUP 1001
+#define MENU_NEW 10
+#define MENU_RENAME 11
+#define MENU_DELETE 12
+
+#define TEXT_TITLEBAR 5000
+
+#define BMP_FOLDER_CLOSED 6001
+#define BMP_FOLDER_OPENED 6002
+#define BMP_DOCUMENT 6003
+#define BMP_LINK 6004
+
+#define DLG_STRINGINPUT 7000
+#define FT_STRINGINPUT_DLG_NAME 10
+#define ED_STRINGINPUT_DLG_NAME 11
+#define GB_STRINGINPUT_DLG_NAME 12
+#define BT_STRINGINPUT_DLG_OK 13
+#define BT_STRINGINPUT_DLG_CANCEL 14
+#define BT_STRINGINPUT_DLG_HELP 15
+
+
+#endif /* !_UCBEXPLORER_HRC */
diff --git a/ucbhelper/workben/ucbexplorer/ucbexplorer.src b/ucbhelper/workben/ucbexplorer/ucbexplorer.src
new file mode 100644
index 000000000000..14d4b8ee8770
--- /dev/null
+++ b/ucbhelper/workben/ucbexplorer/ucbexplorer.src
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * 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
+ *
+ * $RCSfile: ucbexplorer.src,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+//=========================================================================
+//
+// UCB Explorer ( resources )
+//
+// (C) 2000 StarOffice Entwicklungs GmbH, Hamburg, Germany
+//
+// $Author: rt $ $Date: 2008-04-10 16:20:05 $Revision$
+//
+//=========================================================================
+
+#include "ucbexplorer.hrc"
+
+Menu MENU_MAIN
+{
+ ItemList =
+
+ {
+ MenuItem
+ {
+ Identifier = MENU_FILE ;
+ Text [ en-US ] = "~File" ;
+ SubMenu = Menu
+ {
+ ItemList =
+
+ {
+ MenuItem
+ {
+ Identifier = MENU_EXIT ;
+ Text [ en-US ] = "~Exit" ;
+ AccelKey = KeyCode
+ {
+ Function = KEYFUNC_QUIT ;
+ };
+ };
+ };
+ };
+ };
+ };
+};
+
+Menu MENU_POPUP
+{
+ ItemList =
+
+ {
+ MenuItem
+ {
+ Identifier = MENU_NEW ;
+ Text [ en-US ] = "~New" ;
+ };
+ MenuItem
+ {
+ Identifier = MENU_RENAME ;
+ Text [ en-US ] = "~Rename" ;
+ };
+ MenuItem
+ {
+ Identifier = MENU_DELETE ;
+ Text [ en-US ] = "~Delete" ;
+ };
+ };
+};
+
+Bitmap BMP_FOLDER_CLOSED
+{
+ File = "bmp/fldclose.bmp" ;
+};
+Bitmap BMP_FOLDER_OPENED
+{
+ File = "bmp/fldopen.bmp" ;
+};
+Bitmap BMP_DOCUMENT
+{
+ File = "bmp/document.bmp" ;
+};
+Bitmap BMP_LINK
+{
+ File = "bmp/link.bmp" ;
+};
+
+ModalDialog DLG_STRINGINPUT
+{
+ Border = TRUE ;
+ Moveable = TRUE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 218 , 44 ) ;
+ FixedText FT_STRINGINPUT_DLG_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 18 ) ;
+ Size = MAP_APPFONT ( 28 , 10 ) ;
+ Text [ en-US ] = "~Value" ;
+ };
+ Edit ED_STRINGINPUT_DLG_NAME
+ {
+ Pos = MAP_APPFONT ( 40 , 16 ) ;
+ Size = MAP_APPFONT ( 110 , 12 ) ;
+ Border = TRUE ;
+ Left = TRUE ;
+ };
+ GroupBox GB_STRINGINPUT_DLG_NAME
+ {
+ Group = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 150 , 36 ) ;
+ };
+ OKButton BT_STRINGINPUT_DLG_OK
+ {
+ Pos = MAP_APPFONT ( 162 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_STRINGINPUT_DLG_CANCEL
+ {
+ Pos = MAP_APPFONT ( 162 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BT_STRINGINPUT_DLG_HELP
+ {
+ Pos = MAP_APPFONT ( 162 , 200 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+String TEXT_TITLEBAR
+{
+ Text [ en-US ] = "UCB Explorer" ;
+};
+