summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 15:18:56 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 15:18:56 +0000
commitfb25499be77b4b8d84d55bf18effe89012f39e07 (patch)
treeea38938af6dcdf95e45bf508f086b4a53c1aafbe
initial import
-rw-r--r--UnoControls/inc/basecontainercontrol.hxx637
-rw-r--r--UnoControls/inc/basecontrol.hxx1427
-rw-r--r--UnoControls/inc/definesunocontrols.hxx169
-rw-r--r--UnoControls/inc/multiplexer.hxx855
-rw-r--r--UnoControls/prj/d.lst6
-rw-r--r--UnoControls/source/base/basecontainercontrol.cxx683
-rw-r--r--UnoControls/source/base/basecontrol.cxx1008
-rw-r--r--UnoControls/source/base/makefile.mk104
-rw-r--r--UnoControls/source/base/multiplexer.cxx610
-rw-r--r--UnoControls/source/base/registercontrols.cxx393
-rw-r--r--UnoControls/source/controls/OConnectionPointContainerHelper.cxx226
-rw-r--r--UnoControls/source/controls/OConnectionPointHelper.cxx310
-rw-r--r--UnoControls/source/controls/framecontrol.cxx663
-rw-r--r--UnoControls/source/controls/makefile.mk80
-rw-r--r--UnoControls/source/controls/progressbar.cxx600
-rw-r--r--UnoControls/source/controls/progressmonitor.cxx1129
-rw-r--r--UnoControls/source/inc/OConnectionPointContainerHelper.hxx307
-rw-r--r--UnoControls/source/inc/OConnectionPointHelper.hxx354
-rw-r--r--UnoControls/source/inc/framecontrol.hxx690
-rw-r--r--UnoControls/source/inc/progressbar.hxx487
-rw-r--r--UnoControls/source/inc/progressmonitor.hxx918
-rw-r--r--UnoControls/util/makefile.mk99
-rw-r--r--UnoControls/util/makefile.pmk64
-rw-r--r--UnoControls/util/target.pmk70
-rw-r--r--automation/prj/d.lst8
-rw-r--r--automation/util/makefile.mk231
-rw-r--r--extensions/inc/appsettings.hxx79
-rw-r--r--extensions/inc/extensio.hrc110
-rw-r--r--extensions/inc/ucbhelper/ext_content.hxx401
-rw-r--r--extensions/prj/d.lst7
-rw-r--r--extensions/source/bibliography/bib.hrc114
-rw-r--r--extensions/source/bibliography/bib.src187
-rw-r--r--extensions/source/bibliography/bibbeam.cxx309
-rw-r--r--extensions/source/bibliography/bibbeam.hxx169
-rw-r--r--extensions/source/bibliography/bibcont.cxx372
-rw-r--r--extensions/source/bibliography/bibcont.hxx158
-rw-r--r--extensions/source/bibliography/bibload.cxx881
-rw-r--r--extensions/source/bibliography/bibmod.cxx409
-rw-r--r--extensions/source/bibliography/bibmod.hxx113
-rw-r--r--extensions/source/bibliography/bibprop.hrc211
-rw-r--r--extensions/source/bibliography/bibresid.hxx80
-rw-r--r--extensions/source/bibliography/bibview.cxx193
-rw-r--r--extensions/source/bibliography/bibview.hxx112
-rw-r--r--extensions/source/bibliography/datman.cxx2127
-rw-r--r--extensions/source/bibliography/datman.hrc137
-rw-r--r--extensions/source/bibliography/datman.hxx253
-rw-r--r--extensions/source/bibliography/datman.src1276
-rw-r--r--extensions/source/bibliography/framectr.cxx629
-rw-r--r--extensions/source/bibliography/framectr.hxx198
-rw-r--r--extensions/source/bibliography/general.cxx803
-rw-r--r--extensions/source/bibliography/general.hxx225
-rw-r--r--extensions/source/bibliography/hidother.src95
-rw-r--r--extensions/source/bibliography/makefile.mk225
-rw-r--r--extensions/source/bibliography/menu.src594
-rw-r--r--extensions/source/bibliography/sections.hrc159
-rw-r--r--extensions/source/bibliography/sections.src1538
-rw-r--r--extensions/source/bibliography/toolbar.cxx566
-rw-r--r--extensions/source/bibliography/toolbar.hrc77
-rw-r--r--extensions/source/bibliography/toolbar.hxx234
-rw-r--r--extensions/source/bibliography/toolbar.src421
-rw-r--r--extensions/source/ole/comifaces.hxx90
-rw-r--r--extensions/source/ole/jscriptclasses.cxx350
-rw-r--r--extensions/source/ole/jscriptclasses.hxx177
-rw-r--r--extensions/source/ole/makefile.mk188
-rw-r--r--extensions/source/ole/ole2uno.hxx408
-rw-r--r--extensions/source/ole/oledll.cxx85
-rw-r--r--extensions/source/ole/oleobjw.cxx1581
-rw-r--r--extensions/source/ole/oleobjw.hxx241
-rw-r--r--extensions/source/ole/olethread.cxx109
-rw-r--r--extensions/source/ole/servprov.cxx898
-rw-r--r--extensions/source/ole/servprov.hxx308
-rw-r--r--extensions/source/ole/servreg.cxx154
-rw-r--r--extensions/source/ole/unoconversionutilities.hxx1574
-rw-r--r--extensions/source/ole/unoobjw.cxx2414
-rw-r--r--extensions/source/ole/unoobjw.hxx505
-rw-r--r--extensions/source/plugin/base/context.cxx364
-rw-r--r--extensions/source/plugin/base/evtlstnr.cxx95
-rw-r--r--extensions/source/plugin/base/makefile.mk159
-rw-r--r--extensions/source/plugin/base/manager.cxx316
-rw-r--r--extensions/source/plugin/base/multiplx.cxx391
-rw-r--r--extensions/source/plugin/base/nfuncs.cxx576
-rw-r--r--extensions/source/plugin/base/plcom.cxx90
-rw-r--r--extensions/source/plugin/base/plctrl.cxx373
-rw-r--r--extensions/source/plugin/base/plmodel.cxx243
-rw-r--r--extensions/source/plugin/base/service.cxx206
-rw-r--r--extensions/source/plugin/base/xplugin.cxx888
-rw-r--r--extensions/source/plugin/inc/plugin/impl.hxx478
-rw-r--r--extensions/source/plugin/inc/plugin/model.hxx187
-rw-r--r--extensions/source/plugin/inc/plugin/multiplx.hxx249
-rw-r--r--extensions/source/plugin/inc/plugin/plcom.hxx114
-rw-r--r--extensions/source/plugin/inc/plugin/plctrl.hxx276
-rw-r--r--extensions/source/plugin/inc/plugin/unx/sysplug.hxx111
-rw-r--r--extensions/source/plugin/inc/plugin/win/sysplug.hxx139
-rw-r--r--extensions/source/plugin/unx/makefile.mk84
-rw-r--r--extensions/source/plugin/unx/sysplug.cxx269
-rw-r--r--extensions/source/plugin/unx/unxmgr.cxx197
-rw-r--r--extensions/source/plugin/util/makefile.mk125
-rw-r--r--extensions/source/plugin/util/makefile.pmk69
-rw-r--r--extensions/source/plugin/win/makefile.mk96
-rw-r--r--extensions/source/plugin/win/sysplug.cxx300
-rw-r--r--extensions/source/plugin/win/winmgr.cxx392
-rw-r--r--extensions/source/resource/exports.dxp3
-rw-r--r--extensions/source/resource/makefile.mk133
-rw-r--r--extensions/source/resource/resource.cxx583
-rw-r--r--extensions/source/scanner/exports.dxp3
-rw-r--r--extensions/source/scanner/grid.cxx642
-rw-r--r--extensions/source/scanner/grid.hrc76
-rw-r--r--extensions/source/scanner/grid.hxx163
-rw-r--r--extensions/source/scanner/grid.src211
-rw-r--r--extensions/source/scanner/makefile.mk147
-rw-r--r--extensions/source/scanner/sane.cxx979
-rw-r--r--extensions/source/scanner/sane.hxx232
-rw-r--r--extensions/source/scanner/sanedlg.cxx1364
-rw-r--r--extensions/source/scanner/sanedlg.hrc116
-rw-r--r--extensions/source/scanner/sanedlg.hxx199
-rw-r--r--extensions/source/scanner/sanedlg.src700
-rw-r--r--extensions/source/scanner/scanner.cxx162
-rw-r--r--extensions/source/scanner/scanner.hxx172
-rw-r--r--extensions/source/scanner/scanunx.cxx305
-rw-r--r--extensions/source/scanner/scanwin.cxx852
-rw-r--r--extensions/source/scanner/scnserv.cxx138
-rw-r--r--extensions/source/scanner/twain.cxx563
-rw-r--r--extensions/source/scanner/twain.hxx132
-rw-r--r--extensions/source/svg/makefile.mk134
-rw-r--r--extensions/source/svg/svgaction.cxx1412
-rw-r--r--extensions/source/svg/svgaction.hxx196
-rw-r--r--extensions/source/svg/svgcom.hxx144
-rw-r--r--extensions/source/svg/svgprinter.cxx364
-rw-r--r--extensions/source/svg/svgprinter.hxx101
-rw-r--r--extensions/source/svg/svguno.cxx167
-rw-r--r--extensions/source/svg/svgwriter.cxx214
-rw-r--r--extensions/source/svg/svgwriter.hxx94
-rw-r--r--extensions/source/xmlextract/makefile.mk125
-rw-r--r--extensions/source/xmlextract/xmxcom.hxx111
-rw-r--r--extensions/source/xmlextract/xmxtrct.cxx221
-rw-r--r--extensions/source/xmlextract/xmxtrct.hxx88
-rw-r--r--extensions/source/xmlextract/xmxuno.cxx131
-rw-r--r--extensions/stardiv/fontest/fontest.idl145
-rw-r--r--extensions/stardiv/fontest/makefile.mk83
-rw-r--r--extensions/stardiv/oinstchk/makefile.mk82
-rw-r--r--extensions/stardiv/oinstchk/oinstchk.idl142
-rw-r--r--extensions/stardiv/pgp/makefile.mk88
-rw-r--r--extensions/test/ole/AxTestComponents/AxTestComponents.cpp131
-rw-r--r--extensions/test/ole/AxTestComponents/AxTestComponents.def9
-rw-r--r--extensions/test/ole/AxTestComponents/AxTestComponents.dsp323
-rw-r--r--extensions/test/ole/AxTestComponents/AxTestComponents.idl158
-rw-r--r--extensions/test/ole/AxTestComponents/AxTestComponents.rc198
-rw-r--r--extensions/test/ole/AxTestComponents/Basic.cpp523
-rw-r--r--extensions/test/ole/AxTestComponents/Basic.h160
-rw-r--r--extensions/test/ole/AxTestComponents/Basic.rgs26
-rw-r--r--extensions/test/ole/AxTestComponents/StdAfx.cpp69
-rw-r--r--extensions/test/ole/AxTestComponents/StdAfx.h87
-rw-r--r--extensions/test/ole/AxTestComponents/resource.h77
-rw-r--r--extensions/test/ole/JScriptNewStyle.htm1039
-rw-r--r--extensions/test/ole/OleClient/clientTest.cxx536
-rw-r--r--extensions/test/ole/OleClient/makefile.mk128
-rw-r--r--extensions/test/ole/OleClient/readme.txt7
-rw-r--r--extensions/test/ole/OleConverterVar1/convTest.cxx678
-rw-r--r--extensions/test/ole/OleConverterVar1/makefile.mk136
-rw-r--r--extensions/test/ole/OleConverterVar1/readme.txt2
-rw-r--r--extensions/test/ole/OleConverterVar1/smartarray.h267
-rw-r--r--extensions/test/ole/OleTest.htm943
-rw-r--r--extensions/test/ole/callUnoToJava.htm516
-rw-r--r--extensions/test/ole/cpnt/cpnt.cxx1545
-rw-r--r--extensions/test/ole/cpnt/exports.dxp3
-rw-r--r--extensions/test/ole/cpnt/makefile.mk146
-rw-r--r--extensions/test/ole/cpnt/readme.txt5
-rw-r--r--extensions/test/ole/cpptest/StdAfx.cpp68
-rw-r--r--extensions/test/ole/cpptest/StdAfx.h85
-rw-r--r--extensions/test/ole/cpptest/cpptest.cpp113
-rw-r--r--extensions/test/ole/cpptest/cpptest.dsp113
-rw-r--r--extensions/test/ole/cpptest/cpptest.dsw29
-rw-r--r--extensions/test/ole/idl/oletest.idl309
-rw-r--r--extensions/test/ole/unoTocomCalls/Test/StdAfx.cpp68
-rw-r--r--extensions/test/ole/unoTocomCalls/Test/StdAfx.h89
-rw-r--r--extensions/test/ole/unoTocomCalls/Test/Test.cpp277
-rw-r--r--extensions/test/ole/unoTocomCalls/Test/Test.dsp113
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/Basic.rgs26
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/BasicTest.rgs26
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.cpp517
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h167
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.rgs26
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.cpp113
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h98
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.rgs26
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.cpp72
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.h89
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp134
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.dsp335
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.idl181
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.rc197
-rw-r--r--extensions/test/ole/unoTocomCalls/XCallback_Impl/resource.h79
-rw-r--r--extensions/test/ole/unoTocomCalls/readme.txt6
-rw-r--r--extensions/test/pgp/TestPGP.java180
-rw-r--r--extensions/test/pgp/makefile.mk161
-rw-r--r--extensions/test/pgp/readme.txt34
-rw-r--r--extensions/test/sax/exports.dxp2
-rw-r--r--extensions/test/sax/factory.hxx65
-rw-r--r--extensions/test/sax/makefile.mk102
-rw-r--r--extensions/test/sax/testsax.cxx951
-rw-r--r--extensions/test/sax/testwriter.cxx811
-rw-r--r--extensions/test/stm/datatest.cxx1108
-rw-r--r--extensions/test/stm/exports.dxp2
-rw-r--r--extensions/test/stm/makefile.mk99
-rw-r--r--extensions/test/stm/marktest.cxx718
-rw-r--r--extensions/test/stm/pipetest.cxx483
-rw-r--r--extensions/test/stm/testfactreg.cxx203
-rw-r--r--extensions/test/stm/testfactreg.hxx144
-rw-r--r--extensions/util/makefile.pmk85
-rw-r--r--extensions/util/target.pmk70
-rw-r--r--extensions/workben/makefile.mk247
-rw-r--r--extensions/workben/pythonautotest.cxx657
-rw-r--r--extensions/workben/pythontest.cxx591
-rw-r--r--extensions/workben/testcomponent.cxx261
-rw-r--r--extensions/workben/testframecontrol.cxx355
-rw-r--r--extensions/workben/testpgp.cxx918
-rw-r--r--extensions/workben/testresource.cxx125
-rw-r--r--extensions/workben/testresource.src64
218 files changed, 72880 insertions, 0 deletions
diff --git a/UnoControls/inc/basecontainercontrol.hxx b/UnoControls/inc/basecontainercontrol.hxx
new file mode 100644
index 000000000..2aea53b8b
--- /dev/null
+++ b/UnoControls/inc/basecontainercontrol.hxx
@@ -0,0 +1,637 @@
+/*************************************************************************
+ *
+ * $RCSfile: basecontainercontrol.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
+#define _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
+
+//____________________________________________________________________________________________________________
+// includes of other projects
+//____________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
+#include <com/sun/star/lang/XServiceName.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
+#include <com/sun/star/container/XContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXCONTAINER_HPP_
+#include <com/sun/star/container/XIndexContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEREPLACE_HPP_
+#include <com/sun/star/container/XNameReplace.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_
+#include <com/sun/star/container/XContainerListener.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
+#include <com/sun/star/container/XSet.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_CONTAINEREVENT_HPP_
+#include <com/sun/star/container/ContainerEvent.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXREPLACE_HPP_
+#include <com/sun/star/container/XIndexReplace.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+
+//____________________________________________________________________________________________________________
+// includes of my own project
+//____________________________________________________________________________________________________________
+
+#ifndef _UNOCONTROLS_BASECONTROL_CTRL_HXX
+#include "basecontrol.hxx"
+#endif
+
+//____________________________________________________________________________________________________________
+// "namespaces"
+//____________________________________________________________________________________________________________
+
+namespace unocontrols{
+
+#define UNO3_REFERENCE ::com::sun::star::uno::Reference
+#define UNO3_XCONTROL ::com::sun::star::awt::XControl
+#define UNO3_OUSTRING ::rtl::OUString
+#define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel
+#define UNO3_XCONTROLCONTAINER ::com::sun::star::awt::XControlContainer
+#define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
+#define UNO3_TYPE ::com::sun::star::uno::Type
+#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
+#define UNO3_XTOOLKIT ::com::sun::star::awt::XToolkit
+#define UNO3_XWINDOWPEER ::com::sun::star::awt::XWindowPeer
+#define UNO3_EVENTOBJECT ::com::sun::star::lang::EventObject
+#define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
+#define UNO3_XCONTAINERLISTENER ::com::sun::star::container::XContainerListener
+#define UNO3_ANY ::com::sun::star::uno::Any
+#define UNO3_XTABCONTROLLER ::com::sun::star::awt::XTabController
+#define UNO3_WINDOWDESCRIPTOR ::com::sun::star::awt::WindowDescriptor
+#define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics
+#define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
+#define UNO3_ILLEGALARGUMENTEXCEPTION ::com::sun::star::lang::IllegalArgumentException
+
+//____________________________________________________________________________________________________________
+// structs, types, forwards
+//____________________________________________________________________________________________________________
+
+struct IMPL_ControlInfo
+{
+ UNO3_REFERENCE< UNO3_XCONTROL > xControl ;
+ UNO3_OUSTRING sName ;
+};
+
+// makro define a list-class for struct IMPL_ControlInfo!
+class IMPL_ControlInfoList ;
+DECLARE_LIST( IMPL_ControlInfoList, IMPL_ControlInfo* )
+
+//____________________________________________________________________________________________________________
+// classes
+//____________________________________________________________________________________________________________
+
+class BaseContainerControl : public UNO3_XCONTROLMODEL
+ , public UNO3_XCONTROLCONTAINER
+ , public BaseControl
+{
+
+//____________________________________________________________________________________________________________
+// public methods
+//____________________________________________________________________________________________________________
+
+public:
+
+ //________________________________________________________________________________________________________
+ // construct/destruct
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ BaseContainerControl( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual ~BaseContainerControl();
+
+ //________________________________________________________________________________________________________
+ // XInterface
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short give answer, if interface is supported
+ @descr The interfaces are searched by type.
+
+ @seealso XInterface
+
+ @param "rType" is the type of searched interface.
+
+ @return Any information about found interface
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XTypeProvider
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short get information about supported interfaces
+ @descr -
+
+ @seealso XTypeProvider
+
+ @param -
+
+ @return Sequence of types of all supported interfaces
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XAggregation
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XControl
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL createPeer( const UNO3_REFERENCE< UNO3_XTOOLKIT >& xToolkit ,
+ const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParent ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XComponent
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL dispose() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XEventListener
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL disposing( const UNO3_EVENTOBJECT& rEvent ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XControlContainer
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addControl( const UNO3_OUSTRING& sName ,
+ const UNO3_REFERENCE< UNO3_XCONTROL >& xControl ) throw( UNO3_ILLEGALARGUMENTEXCEPTION ,
+ UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addContainerListener( const UNO3_REFERENCE< UNO3_XCONTAINERLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeControl( const UNO3_REFERENCE< UNO3_XCONTROL >& xControl ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeContainerListener( const UNO3_REFERENCE< UNO3_XCONTAINERLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setStatusText( const UNO3_OUSTRING& sStatusText ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XCONTROL > SAL_CALL getControl( const UNO3_OUSTRING& sName) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XCONTROL > > SAL_CALL getControls() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XUnoControlContainer
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addTabController( const UNO3_REFERENCE< UNO3_XTABCONTROLLER >& xTabController ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeTabController( const UNO3_REFERENCE< UNO3_XTABCONTROLLER >& xTabController ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setTabControllers( const UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XTABCONTROLLER > >& xTabControllers ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XTABCONTROLLER > > SAL_CALL getTabControllers() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XWindow
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( UNO3_RUNTIMEEXCEPTION );
+
+//____________________________________________________________________________________________________________
+// protected methods
+//____________________________________________________________________________________________________________
+
+protected:
+
+ /**_______________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_WINDOWDESCRIPTOR* impl_getWindowDescriptor( const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParentPeer );
+
+ /**_______________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void impl_paint( sal_Int32 nX ,
+ sal_Int32 nY ,
+ const UNO3_REFERENCE< UNO3_XGRAPHICS >& xGraphics );
+
+//____________________________________________________________________________________________________________
+// private methods
+//____________________________________________________________________________________________________________
+
+private:
+
+ /**_______________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ void impl_activateTabControllers();
+
+ /**_______________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ void impl_cleanMemory();
+
+//____________________________________________________________________________________________________________
+// private variables
+//____________________________________________________________________________________________________________
+
+private:
+
+ IMPL_ControlInfoList* m_pControlInfoList ; /// list of pointer of "struct IMPL_ControlInfo" to hold child-controls
+ UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XTABCONTROLLER > > m_xTabControllerList ; /// list of references of XTabController to hold tab-order in this container
+ UNO3_OMULTITYPEINTERFACECONTAINERHELPER m_aListeners ;
+
+}; // class BaseContainerControl
+
+} // namespace unocontrols
+
+#endif // ifndef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
diff --git a/UnoControls/inc/basecontrol.hxx b/UnoControls/inc/basecontrol.hxx
new file mode 100644
index 000000000..ba0ec0ef2
--- /dev/null
+++ b/UnoControls/inc/basecontrol.hxx
@@ -0,0 +1,1427 @@
+/*************************************************************************
+ *
+ * $RCSfile: basecontrol.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOCONTROLS_BASECONTROL_CTRL_HXX
+#define _UNOCONTROLS_BASECONTROL_CTRL_HXX
+
+//____________________________________________________________________________________________________________
+// includes of other projects
+//____________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_AWT_XKEYLISTENER_HPP_
+#include <com/sun/star/awt/XKeyListener.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XPAINTLISTENER_HPP_
+#include <com/sun/star/awt/XPaintListener.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_KEYEVENT_HPP_
+#include <com/sun/star/awt/KeyEvent.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_KEYMODIFIER_HPP_
+#include <com/sun/star/awt/KeyModifier.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XMOUSEMOTIONLISTENER_HPP_
+#include <com/sun/star/awt/XMouseMotionListener.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_FOCUSEVENT_HPP_
+#include <com/sun/star/awt/FocusEvent.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XWINDOWLISTENER_HPP_
+#include <com/sun/star/awt/XWindowListener.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XACTIVATELISTENER_HPP_
+#include <com/sun/star/awt/XActivateListener.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_MOUSEEVENT_HPP_
+#include <com/sun/star/awt/MouseEvent.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XTOPWINDOWLISTENER_HPP_
+#include <com/sun/star/awt/XTopWindowListener.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_PAINTEVENT_HPP_
+#include <com/sun/star/awt/PaintEvent.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_INPUTEVENT_HPP_
+#include <com/sun/star/awt/InputEvent.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_KEYGROUP_HPP_
+#include <com/sun/star/awt/KeyGroup.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_KEY_HPP_
+#include <com/sun/star/awt/Key.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_WINDOWEVENT_HPP_
+#include <com/sun/star/awt/WindowEvent.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XMOUSELISTENER_HPP_
+#include <com/sun/star/awt/XMouseListener.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_KEYFUNCTION_HPP_
+#include <com/sun/star/awt/KeyFunction.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_FOCUSCHANGEREASON_HPP_
+#include <com/sun/star/awt/FocusChangeReason.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_MOUSEBUTTON_HPP_
+#include <com/sun/star/awt/MouseButton.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XFOCUSLISTENER_HPP_
+#include <com/sun/star/awt/XFocusListener.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XFILEDIALOG_HPP_
+#include <com/sun/star/awt/XFileDialog.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XTEXTCOMPONENT_HPP_
+#include <com/sun/star/awt/XTextComponent.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XLISTBOX_HPP_
+#include <com/sun/star/awt/XListBox.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XPROGRESSMONITOR_HPP_
+#include <com/sun/star/awt/XProgressMonitor.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_
+#include <com/sun/star/awt/TextAlign.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XSCROLLBAR_HPP_
+#include <com/sun/star/awt/XScrollBar.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLERMODEL_HPP_
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XMESSAGEBOX_HPP_
+#include <com/sun/star/awt/XMessageBox.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XTEXTEDITFIELD_HPP_
+#include <com/sun/star/awt/XTextEditField.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_STYLE_HPP_
+#include <com/sun/star/awt/Style.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XTIMEFIELD_HPP_
+#include <com/sun/star/awt/XTimeField.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
+#include <com/sun/star/awt/XControlModel.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XSPINFIELD_HPP_
+#include <com/sun/star/awt/XSpinField.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XUNOCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XUnoControlContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XTEXTLAYOUTCONSTRAINS_HPP_
+#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XNUMERICFIELD_HPP_
+#include <com/sun/star/awt/XNumericField.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XBUTTON_HPP_
+#include <com/sun/star/awt/XButton.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XTEXTAREA_HPP_
+#include <com/sun/star/awt/XTextArea.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XIMAGEBUTTON_HPP_
+#include <com/sun/star/awt/XImageButton.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XFIXEDTEXT_HPP_
+#include <com/sun/star/awt/XFixedText.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XControlContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XDIALOG_HPP_
+#include <com/sun/star/awt/XDialog.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_SCROLLBARORIENTATION_HPP_
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XRADIOBUTTON_HPP_
+#include <com/sun/star/awt/XRadioButton.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XCURRENCYFIELD_HPP_
+#include <com/sun/star/awt/XCurrencyField.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XPATTERNFIELD_HPP_
+#include <com/sun/star/awt/XPatternField.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_VCLWINDOWPEERATTRIBUTE_HPP_
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLER_HPP_
+#include <com/sun/star/awt/XTabController.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINER_HPP_
+#include <com/sun/star/awt/XVclContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XDATEFIELD_HPP_
+#include <com/sun/star/awt/XDateField.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XCOMBOBOX_HPP_
+#include <com/sun/star/awt/XComboBox.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
+#include <com/sun/star/awt/XControl.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XCHECKBOX_HPP_
+#include <com/sun/star/awt/XCheckBox.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_MESSAGEBOXCOMMAND_HPP_
+#include <com/sun/star/awt/MessageBoxCommand.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XLAYOUTCONSTRAINS_HPP_
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XPROGRESSBAR_HPP_
+#include <com/sun/star/awt/XProgressBar.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
+#include <com/sun/star/awt/XTopWindow.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
+#include <com/sun/star/awt/PosSize.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XVIEW_HPP_
+#include <com/sun/star/awt/XView.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _CPPUHELPER_COMPONENT_HXX_
+#include <cppuhelper/component.hxx>
+#endif
+
+//____________________________________________________________________________________________________________
+// includes of my project
+//____________________________________________________________________________________________________________
+
+#ifndef _UNOCONTROLS_MULTIPLEXER_HXX
+#include "multiplexer.hxx"
+#endif
+
+//____________________________________________________________________________________________________________
+// "namespaces"
+//____________________________________________________________________________________________________________
+
+namespace unocontrols{
+
+#define UNO3_ANY ::com::sun::star::uno::Any
+#define UNO3_EVENTOBJECT ::com::sun::star::lang::EventObject
+#define UNO3_MUTEX ::osl::Mutex
+#define UNO3_OCOMPONENTHELPER ::cppu::OComponentHelper
+#define UNO3_OUSTRING ::rtl::OUString
+#define UNO3_PAINTEVENT ::com::sun::star::awt::PaintEvent
+#define UNO3_RECTANGLE ::com::sun::star::awt::Rectangle
+#define UNO3_REFERENCE ::com::sun::star::uno::Reference
+#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
+#define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
+#define UNO3_SIZE ::com::sun::star::awt::Size
+#define UNO3_TYPE ::com::sun::star::uno::Type
+#define UNO3_WINDOWDESCRIPTOR ::com::sun::star::awt::WindowDescriptor
+#define UNO3_XCONTROL ::com::sun::star::awt::XControl
+#define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel
+#define UNO3_XEVENTLISTENER ::com::sun::star::lang::XEventListener
+#define UNO3_XFOCUSLISTENER ::com::sun::star::awt::XFocusListener
+#define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics
+#define UNO3_XKEYLISTENER ::com::sun::star::awt::XKeyListener
+#define UNO3_XMOUSELISTENER ::com::sun::star::awt::XMouseListener
+#define UNO3_XMOUSEMOTIONLISTENER ::com::sun::star::awt::XMouseMotionListener
+#define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
+#define UNO3_XPAINTLISTENER ::com::sun::star::awt::XPaintListener
+#define UNO3_XSERVICEINFO ::com::sun::star::lang::XServiceInfo
+#define UNO3_XTOOLKIT ::com::sun::star::awt::XToolkit
+#define UNO3_XVIEW ::com::sun::star::awt::XView
+#define UNO3_XWINDOW ::com::sun::star::awt::XWindow
+#define UNO3_XWINDOWLISTENER ::com::sun::star::awt::XWindowListener
+#define UNO3_XWINDOWPEER ::com::sun::star::awt::XWindowPeer
+#define UNO3_XINTERFACE ::com::sun::star::uno::XInterface
+
+//____________________________________________________________________________________________________________
+// macros
+//____________________________________________________________________________________________________________
+
+#define TRGB_COLORDATA(TRANSPARENCE,RED,GREEN,BLUE) \
+ ((sal_Int32)(((sal_uInt32)((sal_uInt8)(BLUE##))))|(((sal_uInt32)((sal_uInt8)(GREEN##)))<<8)|(((sal_uInt32)((sal_uInt8)(RED##)))<<16)|(((sal_uInt32)((sal_uInt8)(TRANSPARENCE##)))<<24))
+
+//____________________________________________________________________________________________________________
+// structs
+//____________________________________________________________________________________________________________
+
+struct IMPL_MutexContainer
+{
+ // Is necassery to initialize "BaseControl" and make this class thread-safe.
+ UNO3_MUTEX m_aMutex ;
+};
+
+//____________________________________________________________________________________________________________
+// classes
+//____________________________________________________________________________________________________________
+
+class BaseControl : public UNO3_XSERVICEINFO
+ , public UNO3_XPAINTLISTENER
+ , public UNO3_XVIEW
+ , public UNO3_XWINDOW
+ , public UNO3_XCONTROL
+ , public IMPL_MutexContainer
+ , public UNO3_OCOMPONENTHELPER
+{
+
+//____________________________________________________________________________________________________________
+// public methods
+//____________________________________________________________________________________________________________
+
+public:
+
+ //________________________________________________________________________________________________________
+ // construct/destruct
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ BaseControl( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual ~BaseControl();
+
+ //________________________________________________________________________________________________________
+ // XInterface
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short give answer, if interface is supported
+ @descr The interfaces are searched by type.
+
+ @seealso XInterface
+
+ @param "rType" is the type of searched interface.
+
+ @return Any information about found interface
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short increment refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso release()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL acquire() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short decrement refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso acquire()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL release() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XTypeProvider
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short get information about supported interfaces
+ @descr -
+
+ @seealso XTypeProvider
+
+ @param -
+
+ @return Sequence of types of all supported interfaces
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short get implementation id
+ @descr This ID is neccessary for UNO-caching. If there no ID, cache is disabled.
+ Another way, cache is enabled.
+
+ @seealso XTypeProvider
+
+ @param -
+
+ @return ID as Sequence of byte
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual UNO3_SEQUENCE< sal_Int8 > SAL_CALL getImplementationId() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XAggregation
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setDelegator( const UNO3_REFERENCE< UNO3_XINTERFACE >& xDelegator ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XServiceInfo
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL supportsService( const UNO3_OUSTRING& sServiceName ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_OUSTRING SAL_CALL getImplementationName() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_SEQUENCE< UNO3_OUSTRING > SAL_CALL getSupportedServiceNames() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XComponent
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL dispose() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addEventListener( const UNO3_REFERENCE< UNO3_XEVENTLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeEventListener( const UNO3_REFERENCE< UNO3_XEVENTLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XControl
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL createPeer( const UNO3_REFERENCE< UNO3_XTOOLKIT >& xToolkit, const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParent ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setContext( const UNO3_REFERENCE< UNO3_XINTERFACE >& xContext ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION ) = 0 ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setDesignMode( sal_Bool bOn ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XINTERFACE > SAL_CALL getContext() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION ) = 0;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XWINDOWPEER > SAL_CALL getPeer() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XVIEW > SAL_CALL getView() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL isDesignMode() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL isTransparent() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XWindow
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setPosSize( sal_Int32 nX ,
+ sal_Int32 nY ,
+ sal_Int32 nWidth ,
+ sal_Int32 nHeight ,
+ sal_Int16 nFlags ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setEnable( sal_Bool bEnable ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setFocus() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_RECTANGLE SAL_CALL getPosSize() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addWindowListener( const UNO3_REFERENCE< UNO3_XWINDOWLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addFocusListener( const UNO3_REFERENCE< UNO3_XFOCUSLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addKeyListener( const UNO3_REFERENCE< UNO3_XKEYLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addMouseListener( const UNO3_REFERENCE< UNO3_XMOUSELISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addMouseMotionListener( const UNO3_REFERENCE< UNO3_XMOUSEMOTIONLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addPaintListener( const UNO3_REFERENCE< UNO3_XPAINTLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeWindowListener( const UNO3_REFERENCE< UNO3_XWINDOWLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeFocusListener( const UNO3_REFERENCE< UNO3_XFOCUSLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeKeyListener( const UNO3_REFERENCE< UNO3_XKEYLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeMouseListener( const UNO3_REFERENCE< UNO3_XMOUSELISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeMouseMotionListener( const UNO3_REFERENCE< UNO3_XMOUSEMOTIONLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removePaintListener( const UNO3_REFERENCE< UNO3_XPAINTLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XView
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL draw( sal_Int32 nX ,
+ sal_Int32 nY ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL setGraphics( const UNO3_REFERENCE< UNO3_XGRAPHICS >& xDevice ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setZoom( float fZoomX ,
+ float fZoomY ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XGRAPHICS > SAL_CALL getGraphics() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_SIZE SAL_CALL getSize() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // UNO3_XEVENTLISTENER
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL disposing( const UNO3_EVENTOBJECT& rSource ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XPaintListener
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL windowPaint( const UNO3_PAINTEVENT& rEvent ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // impl but public method to register service
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ static const UNO3_SEQUENCE< UNO3_OUSTRING > impl_getStaticSupportedServiceNames();
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ static const UNO3_OUSTRING impl_getStaticImplementationName();
+
+//____________________________________________________________________________________________________________
+// protected methods
+//____________________________________________________________________________________________________________
+
+protected:
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY > impl_getMultiServiceFactory();
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ const UNO3_REFERENCE< UNO3_XWINDOW > impl_getPeerWindow();
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ const UNO3_REFERENCE< UNO3_XGRAPHICS > impl_getGraphicsPeer();
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ const sal_Int32& impl_getWidth();
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ const sal_Int32& impl_getHeight();
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_WINDOWDESCRIPTOR* impl_getWindowDescriptor( const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParentPeer );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void impl_paint( sal_Int32 nX ,
+ sal_Int32 nY ,
+ const UNO3_REFERENCE< UNO3_XGRAPHICS >& xGraphics );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ UNO3_REFERENCE< UNO3_XINTERFACE > impl_getDelegator();
+
+//____________________________________________________________________________________________________________
+// private methods
+//____________________________________________________________________________________________________________
+
+private:
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ void impl_releasePeer();
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ OMRCListenerMultiplexerHelper* impl_getMultiplexer();
+
+//____________________________________________________________________________________________________________
+// private variables
+//____________________________________________________________________________________________________________
+
+private:
+
+ UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY > m_xFactory ;
+ UNO3_REFERENCE< UNO3_XINTERFACE > m_xDelegator ;
+ OMRCListenerMultiplexerHelper* m_pMultiplexer ; // multiplex events
+ UNO3_REFERENCE< UNO3_XINTERFACE > m_xMultiplexer ;
+ UNO3_REFERENCE< UNO3_XINTERFACE > m_xContext ;
+ UNO3_REFERENCE< UNO3_XWINDOWPEER > m_xPeer ;
+ UNO3_REFERENCE< UNO3_XWINDOW > m_xPeerWindow ;
+ UNO3_REFERENCE< UNO3_XGRAPHICS > m_xGraphicsView ; // graphics for ::com::sun::star::awt::XView-operations
+ UNO3_REFERENCE< UNO3_XGRAPHICS > m_xGraphicsPeer ; // graphics for painting on a peer
+ sal_Int32 m_nX ; // Position ...
+ sal_Int32 m_nY ;
+ sal_Int32 m_nWidth ; // ... and size of window
+ sal_Int32 m_nHeight ;
+ sal_Bool m_bVisible ; // Some state flags
+ sal_Bool m_bInDesignMode ;
+ sal_Bool m_bEnable ;
+
+}; // class BaseControl
+
+} // namespace unocontrols
+
+#endif // ifndef _UNOCONTROLS_BASECONTROL_CTRL_HXX
diff --git a/UnoControls/inc/definesunocontrols.hxx b/UnoControls/inc/definesunocontrols.hxx
new file mode 100644
index 000000000..57a6e34e7
--- /dev/null
+++ b/UnoControls/inc/definesunocontrols.hxx
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * $RCSfile: definesunocontrols.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOCONTROLS_DEFINES_CTRL_HXX
+#define _UNOCONTROLS_DEFINES_CTRL_HXX
+
+//-------------------------------------------------------------------------------------------------------------------
+// includes
+#include <limits.h> // defines for min/max of INT
+
+namespace unocontrols{
+
+//-------------------------------------------------------------------------------------------------------------------
+// global defines for all UnoControls
+//-------------------------------------------------------------------------------------------------------------------
+#define UNOCONTROLS_TRGB_COLORDATA( t,r,g,b ) ((INT32)(((UINT32)((UINT8)(b))))|(((UINT32)((UINT8)(g)))<<8)|(((UINT32)((UINT8)(r)))<<16)|(((UINT32)((UINT8)(t)))<<24))
+//-------------------------------------------------------------------------------------------------------------------
+
+// defines for BaseControl
+#ifdef _UNOCONTROLS_BASECONTROL_CTRL_HXX
+ #define BASECONTROL_IDLCLASSNAME "BaseControl"
+ #define BASECONTROL_DEFAULT_PMULTIPLEXER NULL
+ #define BASECONTROL_DEFAULT_X 0
+ #define BASECONTROL_DEFAULT_Y 0
+ #define BASECONTROL_DEFAULT_WIDTH 100
+ #define BASECONTROL_DEFAULT_HEIGHT 100
+ #define BASECONTROL_DEFAULT_VISIBLE FALSE
+ #define BASECONTROL_DEFAULT_INDESIGNMODE FALSE
+ #define BASECONTROL_DEFAULT_ENABLE TRUE
+ #define BASECONTROL_SERVICE_VCLTOOLKIT "com.sun.star.awt.VclToolkit"
+#endif
+//-------------------------------------------------------------------------------------------------------------------
+
+//-------------------------------------------------------------------------------------------------------------------
+// defines for BaseContainerControl
+#ifdef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
+ #define BASECONTAINERCONTROL_IDLCLASSNAME "BaseContainerControl"
+#endif
+//-------------------------------------------------------------------------------------------------------------------
+
+//-------------------------------------------------------------------------------------------------------------------
+// defines for ProgressBar
+#ifdef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
+ #define PROGRESSBAR_IDLCLASSNAME "XProgressbar"
+ #define PROGRESSBAR_SERVICENAME "com.sun.star.awt.XProgressBar"
+ #define PROGRESSBAR_IMPLEMENTATIONNAME "stardiv.UnoControls.ProgressBar"
+ #define PROGRESSBAR_FREEBORDER 2
+ #define PROGRESSBAR_DEFAULT_HORIZONTAL TRUE
+ #define PROGRESSBAR_DEFAULT_BLOCKDIMENSION Size(1,1)
+ #define PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR UNOCONTROLS_TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lightgray
+ #define PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR UNOCONTROLS_TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x80 ) // blue
+ #define PROGRESSBAR_DEFAULT_MINRANGE INT_MIN
+ #define PROGRESSBAR_DEFAULT_MAXRANGE INT_MAX
+ #define PROGRESSBAR_DEFAULT_BLOCKVALUE 1
+ #define PROGRESSBAR_DEFAULT_VALUE PROGRESSBAR_DEFAULT_MINRANGE
+ #define PROGRESSBAR_LINECOLOR_BRIGHT UNOCONTROLS_TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
+ #define PROGRESSBAR_LINECOLOR_SHADOW UNOCONTROLS_TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
+#endif
+//-------------------------------------------------------------------------------------------------------------------
+
+//-------------------------------------------------------------------------------------------------------------------
+// defines for FrameControl
+#ifdef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
+ #define FRAMECONTROL_IDLCLASSNAME "FrameControl"
+ #define FRAMECONTROL_SERVICENAME "com.sun.star.frame.FrameControl"
+ #define FRAMECONTROL_IMPLEMENTATIONNAME "stardiv.UnoControls.FrameControl"
+ #define FRAMECONTROL_DEFAULT_COMPONENTURL "private:factory/swriter"
+ #define FRAMECONTROL_PROPERTYNAME_LOADERARGUMENTS "LoaderArguments"
+ #define FRAMECONTROL_PROPERTYNAME_COMPONENTURL "ComponentURL"
+ #define FRAMECONTROL_PROPERTYNAME_FRAME "Frame"
+ #define FRAMECONTROL_PROPERTYNAME_IDLCLASSES "IDLClasses"
+ #define FRAMECONTROL_ERRORTEXT_VOSENSHURE "This is an invalid property handle."
+ #define FRAMECONTROL_PROPERTY_COUNT 4 // you must count the propertys
+ #define FRAMECONTROL_PROPERTY_COMPONENTURL 0 // Id must be the index into the array
+ #define FRAMECONTROL_PROPERTY_FRAME 1
+ #define FRAMECONTROL_PROPERTY_IDLCLASSES 2
+ #define FRAMECONTROL_PROPERTY_LOADERARGUMENTS 3
+#endif
+//-------------------------------------------------------------------------------------------------------------------
+
+//-------------------------------------------------------------------------------------------------------------------
+// defines for ProgressMonitor
+#ifdef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
+ #define PROGRESSMONITOR_IDLCLASSNAME "XProgressMonitor"
+ #define PROGRESSMONITOR_SERVICENAME "com.sun.star.awt.XProgressMonitor"
+ #define PROGRESSMONITOR_IMPLEMENTATIONNAME "stardiv.UnoControls.ProgressMonitor"
+ #define PROGRESSMONITOR_FREEBORDER 10 // border around and between the controls
+ #define PROGRESSMONITOR_WIDTH_RELATION 4 // reserve 1/4 for button width and rest for progressbar width
+ #define PROGRESSMONITOR_HEIGHT_RELATION 5 // reserve 1/5 for button and progressbar heigth and rest for text height
+ #define PROGRESSMONITOR_FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText"
+ #define PROGRESSMONITOR_BUTTON_SERVICENAME "com.sun.star.awt.UnoControlButton"
+ #define PROGRESSMONITOR_FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel"
+ #define PROGRESSMONITOR_BUTTON_MODELNAME "com.sun.star.awt.UnoControlButtonModel"
+ #define PROGRESSMONITOR_CONTROLNAME_TEXT "Text" // identifier the control in container
+ #define PROGRESSMONITOR_CONTROLNAME_BUTTON "Button" // -||-
+ #define PROGRESSMONITOR_CONTROLNAME_PROGRESSBAR "ProgressBar" // -||-
+ #define PROGRESSMONITOR_DEFAULT_BUTTONLABEL "Abbrechen"
+ #define PROGRESSMONITOR_DEFAULT_TOPIC "\0"
+ #define PROGRESSMONITOR_DEFAULT_TEXT "\0"
+ #define PROGRESSMONITOR_BACKGROUNDCOLOR UNOCONTROLS_TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lighgray
+ #define PROGRESSMONITOR_LINECOLOR_BRIGHT UNOCONTROLS_TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
+ #define PROGRESSMONITOR_LINECOLOR_SHADOW UNOCONTROLS_TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
+ #define PROGRESSMONITOR_HEIGHT_PROGRESSBAR 15
+ #define PROGRESSMONITOR_DEFAULT_WIDTH 350
+ #define PROGRESSMONITOR_DEFAULT_HEIGHT 100
+#endif
+//-------------------------------------------------------------------------------------------------------------------
+
+} // namespace unocontrols
+
+#endif // #ifndef _UNOCONTROLS_DEFINES_CTRL_HXX
diff --git a/UnoControls/inc/multiplexer.hxx b/UnoControls/inc/multiplexer.hxx
new file mode 100644
index 000000000..a0f1e4325
--- /dev/null
+++ b/UnoControls/inc/multiplexer.hxx
@@ -0,0 +1,855 @@
+/*************************************************************************
+ *
+ * $RCSfile: multiplexer.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOCONTROLS_MULTIPLEXER_HXX
+#define _UNOCONTROLS_MULTIPLEXER_HXX
+
+//____________________________________________________________________________________________________________
+// includes of other projects
+//____________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_AWT_XKEYLISTENER_HPP_
+#include <com/sun/star/awt/XKeyListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPAINTLISTENER_HPP_
+#include <com/sun/star/awt/XPaintListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYEVENT_HPP_
+#include <com/sun/star/awt/KeyEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYMODIFIER_HPP_
+#include <com/sun/star/awt/KeyModifier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMOUSEMOTIONLISTENER_HPP_
+#include <com/sun/star/awt/XMouseMotionListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FOCUSEVENT_HPP_
+#include <com/sun/star/awt/FocusEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOWLISTENER_HPP_
+#include <com/sun/star/awt/XWindowListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XACTIVATELISTENER_HPP_
+#include <com/sun/star/awt/XActivateListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_MOUSEEVENT_HPP_
+#include <com/sun/star/awt/MouseEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTOPWINDOWLISTENER_HPP_
+#include <com/sun/star/awt/XTopWindowListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_PAINTEVENT_HPP_
+#include <com/sun/star/awt/PaintEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_INPUTEVENT_HPP_
+#include <com/sun/star/awt/InputEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYGROUP_HPP_
+#include <com/sun/star/awt/KeyGroup.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEY_HPP_
+#include <com/sun/star/awt/Key.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_WINDOWEVENT_HPP_
+#include <com/sun/star/awt/WindowEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMOUSELISTENER_HPP_
+#include <com/sun/star/awt/XMouseListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYFUNCTION_HPP_
+#include <com/sun/star/awt/KeyFunction.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FOCUSCHANGEREASON_HPP_
+#include <com/sun/star/awt/FocusChangeReason.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_MOUSEBUTTON_HPP_
+#include <com/sun/star/awt/MouseButton.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XFOCUSLISTENER_HPP_
+#include <com/sun/star/awt/XFocusListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
+#include <com/sun/star/awt/XTopWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
+#include <com/sun/star/awt/PosSize.hpp>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+//____________________________________________________________________________________________________________
+// includes of my own project
+//____________________________________________________________________________________________________________
+
+//____________________________________________________________________________________________________________
+// "namespaces"
+//____________________________________________________________________________________________________________
+
+namespace unocontrols{
+
+#define UNO3_OWEAKOBJECT ::cppu::OWeakObject
+#define UNO3_XWINDOW ::com::sun::star::awt::XWindow
+#define UNO3_REFERENCE ::com::sun::star::uno::Reference
+#define UNO3_WEAKREFERENCE ::com::sun::star::uno::WeakReference
+#define UNO3_MUTEX ::osl::Mutex
+#define UNO3_XWINDOWLISTENER ::com::sun::star::awt::XWindowListener
+#define UNO3_XKEYLISTENER ::com::sun::star::awt::XKeyListener
+#define UNO3_XMOUSELISTENER ::com::sun::star::awt::XMouseListener
+#define UNO3_XMOUSEMOTIONLISTENER ::com::sun::star::awt::XMouseMotionListener
+#define UNO3_XPAINTLISTENER ::com::sun::star::awt::XPaintListener
+#define UNO3_XTOPWINDOWLISTENER ::com::sun::star::awt::XTopWindowListener
+#define UNO3_XFOCUSLISTENER ::com::sun::star::awt::XFocusListener
+#define UNO3_ANY ::com::sun::star::uno::Any
+#define UNO3_TYPE ::com::sun::star::uno::Type
+#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
+#define UNO3_XINTERFACE ::com::sun::star::uno::XInterface
+#define UNO3_EVENTOBJECT ::com::sun::star::lang::EventObject
+#define UNO3_FOCUSEVENT ::com::sun::star::awt::FocusEvent
+#define UNO3_WINDOWEVENT ::com::sun::star::awt::WindowEvent
+#define UNO3_KEYEVENT ::com::sun::star::awt::KeyEvent
+#define UNO3_MOUSEEVENT ::com::sun::star::awt::MouseEvent
+#define UNO3_PAINTEVENT ::com::sun::star::awt::PaintEvent
+#define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
+
+//____________________________________________________________________________________________________________
+// class
+//____________________________________________________________________________________________________________
+
+class OMRCListenerMultiplexerHelper : public UNO3_XFOCUSLISTENER
+ , public UNO3_XWINDOWLISTENER
+ , public UNO3_XKEYLISTENER
+ , public UNO3_XMOUSELISTENER
+ , public UNO3_XMOUSEMOTIONLISTENER
+ , public UNO3_XPAINTLISTENER
+ , public UNO3_XTOPWINDOWLISTENER
+ , public UNO3_OWEAKOBJECT
+{
+
+//____________________________________________________________________________________________________________
+// public methods
+//____________________________________________________________________________________________________________
+
+public:
+
+ //________________________________________________________________________________________________________
+ // construct/destruct
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short constructor
+ @descr Create a Multiplexer of XWindowEvents.
+
+ @seealso -
+
+ @param rControl The control. All listeners think that this is the original broadcaster.
+ @param rPeer The peer from which the original events are dispatched. Null is allowed.
+
+ @return -
+
+ @onerror -
+ */
+
+ OMRCListenerMultiplexerHelper( const UNO3_REFERENCE< UNO3_XWINDOW >& xControl ,
+ const UNO3_REFERENCE< UNO3_XWINDOW >& xPeer );
+
+ /**_______________________________________________________________________________________________________
+ @short copy-constructor
+ @descr
+
+ @seealso -
+
+ @param rCopyInstance C++-Reference to instance to make copy from.
+
+ @return -
+
+ @onerror -
+ */
+
+ OMRCListenerMultiplexerHelper( const OMRCListenerMultiplexerHelper& aCopyInstance );
+
+ /**_______________________________________________________________________________________________________
+ @short destructor
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ ~OMRCListenerMultiplexerHelper();
+
+ //________________________________________________________________________________________________________
+ // XInterface
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short give answer, if interface is supported
+ @descr The interfaces are searched by type.
+
+ @seealso XInterface
+
+ @param "rType" is the type of searched interface.
+
+ @return Any information about found interface
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short increment refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso release()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL acquire() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short decrement refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso acquire()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL release() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // operator
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ operator UNO3_REFERENCE< UNO3_XINTERFACE >() const;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ OMRCListenerMultiplexerHelper& operator= ( const OMRCListenerMultiplexerHelper& aCopyInstance );
+
+ //________________________________________________________________________________________________________
+ // container methods
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short Remove all listeners from the previous set peer and add the needed listeners to rPeer.
+ @descr -
+
+ @seealso -
+
+ @param rPeer The peer from which the original events are dispatched. Null is allowed.
+
+ @return -
+
+ @onerror -
+ */
+
+ void setPeer( const UNO3_REFERENCE< UNO3_XWINDOW >& xPeer );
+
+ /**_______________________________________________________________________________________________________
+ @short Remove all listeners and send a disposing message.
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ void disposeAndClear();
+
+ /**_______________________________________________________________________________________________________
+ @short Add the specified listener to the source.
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ void advise( const UNO3_TYPE& aType ,
+ const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener );
+
+ /**_______________________________________________________________________________________________________
+ @short Remove the specified listener from the source.
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ void unadvise( const UNO3_TYPE& aType ,
+ const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener );
+
+ //________________________________________________________________________________________________________
+ // XEventListener
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL disposing(const UNO3_EVENTOBJECT& aSource) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ //________________________________________________________________________________________________________
+ // XFocusListener
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL focusGained(const UNO3_FOCUSEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL focusLost(const UNO3_FOCUSEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ //________________________________________________________________________________________________________
+ // XWindowListener
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL windowResized(const UNO3_WINDOWEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL windowMoved(const UNO3_WINDOWEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL windowShown(const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL windowHidden(const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ //________________________________________________________________________________________________________
+ // XKeyListener
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL keyPressed( const UNO3_KEYEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL keyReleased( const UNO3_KEYEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ //________________________________________________________________________________________________________
+ // XMouseListener
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL mousePressed(const UNO3_MOUSEEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL mouseReleased(const UNO3_MOUSEEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL mouseEntered(const UNO3_MOUSEEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL mouseExited(const UNO3_MOUSEEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ //________________________________________________________________________________________________________
+ // XMouseMotionListener
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL mouseDragged(const UNO3_MOUSEEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL mouseMoved(const UNO3_MOUSEEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ //________________________________________________________________________________________________________
+ // XPaintListener
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL windowPaint(const UNO3_PAINTEVENT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ //________________________________________________________________________________________________________
+ // XTopWindowListener
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL windowOpened( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL windowClosing( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL windowClosed( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL windowMinimized( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL windowNormalized( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL windowActivated( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL windowDeactivated( const UNO3_EVENTOBJECT& aEvent ) throw( UNO3_RUNTIMEEXCEPTION ) ;
+
+//____________________________________________________________________________________________________________
+// protected methods
+//____________________________________________________________________________________________________________
+
+protected:
+
+ /**_______________________________________________________________________________________________________
+ @short Remove the listener from the peer.
+ @descr -
+
+ @seealso -
+
+ @param xPeer The peer from which the listener is removed.
+ @param rType The listener type, which specify the type of the listener.
+
+ @return -
+
+ @onerror -
+ */
+
+ void impl_adviseToPeer( const UNO3_REFERENCE< UNO3_XWINDOW >& xPeer ,
+ const UNO3_TYPE& aType );
+
+ /**_______________________________________________________________________________________________________
+ @short Add the listener to the peer.
+ @descr -
+
+ @seealso -
+
+ @param xPeer The peer to which the listener is added.
+ @param rType The listener type, which specify the type of the listener.
+
+ @return -
+
+ @onerror -
+ */
+
+ void impl_unadviseFromPeer( const UNO3_REFERENCE< UNO3_XWINDOW >& xPeer ,
+ const UNO3_TYPE& aType );
+
+//____________________________________________________________________________________________________________
+// private variables
+//____________________________________________________________________________________________________________
+
+private:
+
+ UNO3_MUTEX m_aMutex ;
+ UNO3_REFERENCE< UNO3_XWINDOW > m_xPeer ; /// The source of the events. Normally this is the peer object.
+ UNO3_WEAKREFERENCE< UNO3_XWINDOW > m_xControl ;
+ UNO3_OMULTITYPEINTERFACECONTAINERHELPER m_aListenerHolder ;
+
+}; // class OMRCListenerMultiplexerHelper
+
+} // namespace unocontrols
+
+#endif // ifndef _UNOCONTROLS_MULTIPLEXER_HXX
diff --git a/UnoControls/prj/d.lst b/UnoControls/prj/d.lst
new file mode 100644
index 000000000..5422546ec
--- /dev/null
+++ b/UnoControls/prj/d.lst
@@ -0,0 +1,6 @@
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
+..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so
+..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl
+..\%__SRC%\bin\*.bin %_DEST%\bin%_EXT%\*.bin
+..\%__SRC%\misc\*.hid %_DEST%\bin%_EXT%\*.hid
+..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
diff --git a/UnoControls/source/base/basecontainercontrol.cxx b/UnoControls/source/base/basecontainercontrol.cxx
new file mode 100644
index 000000000..5d73e6203
--- /dev/null
+++ b/UnoControls/source/base/basecontainercontrol.cxx
@@ -0,0 +1,683 @@
+/*************************************************************************
+ *
+ * $RCSfile: basecontainercontrol.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//____________________________________________________________________________________________________________
+// my own includes
+//____________________________________________________________________________________________________________
+
+#ifndef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
+#include "basecontainercontrol.hxx"
+#endif
+
+//____________________________________________________________________________________________________________
+// includes of other projects
+//____________________________________________________________________________________________________________
+
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+
+//____________________________________________________________________________________________________________
+// includes of my own project
+//____________________________________________________________________________________________________________
+
+//____________________________________________________________________________________________________________
+// namespaces
+//____________________________________________________________________________________________________________
+
+using namespace ::cppu ;
+using namespace ::osl ;
+using namespace ::rtl ;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::lang ;
+using namespace ::com::sun::star::awt ;
+using namespace ::com::sun::star::container ;
+
+namespace unocontrols{
+
+//____________________________________________________________________________________________________________
+// construct/destruct
+//____________________________________________________________________________________________________________
+
+BaseContainerControl::BaseContainerControl( const Reference< XMultiServiceFactory >& xFactory )
+ : BaseControl ( xFactory )
+ , m_aListeners ( m_aMutex )
+{
+ // initialize info list for controls
+ m_pControlInfoList = new IMPL_ControlInfoList ;
+}
+
+BaseContainerControl::~BaseContainerControl()
+{
+ impl_cleanMemory();
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+Any SAL_CALL BaseContainerControl::queryInterface( const Type& rType ) throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+ Any aReturn ;
+ Reference< XInterface > xDelegator = BaseControl::impl_getDelegator();
+ if ( xDelegator.is() == sal_True )
+ {
+ // If an delegator exist, forward question to his queryInterface.
+ // Delegator will ask his own queryAggregation!
+ aReturn = xDelegator->queryInterface( rType );
+ }
+ else
+ {
+ // If an delegator unknown, forward question to own queryAggregation.
+ aReturn = queryAggregation( rType );
+ }
+
+ return aReturn ;
+}
+
+//____________________________________________________________________________________________________________
+// XTypeProvider
+//____________________________________________________________________________________________________________
+
+Sequence< Type > SAL_CALL BaseContainerControl::getTypes() throw( RuntimeException )
+{
+ // Optimize this method !
+ // We initialize a static variable only one time. And we don't must use a mutex at every call!
+ // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
+ static OTypeCollection* pTypeCollection = NULL ;
+
+ if ( pTypeCollection == NULL )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if ( pTypeCollection == NULL )
+ {
+ // Create a static typecollection ...
+ static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XControlModel >*)NULL ) ,
+ ::getCppuType(( const Reference< XControlContainer >*)NULL ) ,
+ BaseControl::getTypes()
+ );
+ // ... and set his address to static pointer!
+ pTypeCollection = &aTypeCollection ;
+ }
+ }
+
+ return pTypeCollection->getTypes();
+}
+
+//____________________________________________________________________________________________________________
+// XAggregation
+//____________________________________________________________________________________________________________
+
+Any SAL_CALL BaseContainerControl::queryAggregation( const Type& aType ) throw( RuntimeException )
+{
+ // Ask for my own supported interfaces ...
+ // Attention: XTypeProvider and XInterface are supported by OComponentHelper!
+ Any aReturn ( ::cppu::queryInterface( aType ,
+ static_cast< XControlModel* > ( this ) ,
+ static_cast< XControlContainer* > ( this )
+ )
+ );
+
+ // If searched interface supported by this class ...
+ if ( aReturn.hasValue() == sal_True )
+ {
+ // ... return this information.
+ return aReturn ;
+ }
+ else
+ {
+ // Else; ... ask baseclass for interfaces!
+ return BaseControl::queryAggregation( aType );
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseContainerControl::createPeer( const Reference< XToolkit >& xToolkit ,
+ const Reference< XWindowPeer >& xParent ) throw( RuntimeException )
+{
+ if ( getPeer().is() == sal_False )
+ {
+ // create own peer
+ BaseControl::createPeer( xToolkit, xParent );
+
+ // create peers at all childs
+ Sequence< Reference< XControl > > seqControlList = getControls();
+ sal_uInt32 nControls = seqControlList.getLength();
+
+ for ( sal_uInt32 n=0; n<nControls; n++ )
+ {
+ seqControlList.getArray()[n]->createPeer( xToolkit, getPeer() );
+ }
+
+ // activate new tab order
+ impl_activateTabControllers();
+
+/*
+ Reference< XVclContainerPeer > xC;
+ mxPeer->queryInterface( ::getCppuType((const Reference< XVclContainerPeer >*)0), xC );
+ xC->enableDialogControl( sal_True );
+*/
+
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+sal_Bool SAL_CALL BaseContainerControl::setModel( const Reference< XControlModel >& xModel ) throw( RuntimeException )
+{
+ // This object has NO model.
+ return sal_False ;
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+Reference< XControlModel > SAL_CALL BaseContainerControl::getModel() throw( RuntimeException )
+{
+ // This object has NO model.
+ // return (XControlModel*)this ;
+ return Reference< XControlModel >();
+}
+
+//____________________________________________________________________________________________________________
+// XComponent
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseContainerControl::dispose() throw( RuntimeException )
+{
+ // Zuerst der Welt mitteilen, daß der Container wegfliegt. Dieses ist um einiges
+ // schneller wenn die Welt sowohl an den Controls als auch am Container horcht
+
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+
+ // remove listeners
+ EventObject aObject ;
+
+ aObject.Source = Reference< XComponent > ( (XControlContainer*)this, UNO_QUERY );
+ m_aListeners.disposeAndClear( aObject );
+
+ // remove controls
+ Sequence< Reference< XControl > > seqCtrls = getControls();
+ Reference< XControl > * pCtrls = seqCtrls.getArray();
+ sal_uInt32 nCtrls = seqCtrls.getLength();
+ sal_uInt32 nMaxCount = m_pControlInfoList->Count();
+ sal_uInt32 nCount = 0;
+
+ for ( nCount = 0; nCount < nMaxCount; ++nCount )
+ {
+ delete m_pControlInfoList->GetObject( 0 );
+ }
+ m_pControlInfoList->Clear();
+
+ for ( nCount = 0; nCount < nCtrls; ++nCount )
+ {
+ pCtrls [ nCount ] -> removeEventListener ( this ) ;
+ pCtrls [ nCount ] -> dispose ( ) ;
+ }
+
+ // call baseclass
+ BaseControl::dispose();
+}
+
+//____________________________________________________________________________________________________________
+// XEventListener
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseContainerControl::disposing( const EventObject& rEvent ) throw( RuntimeException )
+{
+ Reference< XControl > xControl( rEvent.Source, UNO_QUERY );
+
+ // "removeControl" remove only, when control is an active control
+ removeControl( xControl );
+}
+
+//____________________________________________________________________________________________________________
+// XControlContainer
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseContainerControl::addControl ( const OUString& rName, const Reference< XControl > & rControl ) throw( IllegalArgumentException, RuntimeException )
+{
+ // only correct references can add to list!!!
+ if ( !rControl.is () )
+ {
+ throw IllegalArgumentException ();
+ }
+
+ // take memory for new item
+ IMPL_ControlInfo* pNewControl = new IMPL_ControlInfo ;
+
+ if (pNewControl!=(IMPL_ControlInfo*)0)
+ {
+ // Ready for multithreading
+ MutexGuard aGuard (m_aMutex) ;
+
+ // set control
+ pNewControl->sName = rName ;
+ pNewControl->xControl = rControl ;
+
+ // and insert in list
+ m_pControlInfoList->Insert ( pNewControl, LIST_APPEND ) ;
+
+ // initialize new control
+ pNewControl->xControl->setContext ( (OWeakObject*)this ) ;
+ pNewControl->xControl->addEventListener ( this ) ;
+
+ // when container has a peer ...
+ if (getPeer().is())
+ {
+ // .. then create a peer on child
+ pNewControl->xControl->createPeer ( getPeer()->getToolkit(), getPeer() ) ;
+ impl_activateTabControllers () ;
+ }
+
+ // Send message to all listener
+ OInterfaceContainerHelper* pInterfaceContainer = m_aListeners.getContainer( ::getCppuType((const Reference< XContainerListener >*)0) ) ;
+
+ if (pInterfaceContainer)
+ {
+ // Build event
+ ContainerEvent aEvent ;
+
+ aEvent.Source = *this ;
+ aEvent.Element <<= rControl ;
+
+ // Get all listener
+ OInterfaceIteratorHelper aIterator (*pInterfaceContainer) ;
+
+ // Send event
+ while ( aIterator.hasMoreElements() )
+ {
+ ((XContainerListener*)aIterator.next())->elementInserted (aEvent) ;
+ }
+ }
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XControlContainer
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseContainerControl::addContainerListener ( const Reference< XContainerListener > & rListener ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ m_aListeners.addInterface ( ::getCppuType((const Reference< XContainerListener >*)0), rListener ) ;
+}
+
+//____________________________________________________________________________________________________________
+// XControlContainer
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseContainerControl::removeControl ( const Reference< XControl > & rControl ) throw( RuntimeException )
+{
+ if ( rControl.is() )
+ {
+ // Ready for multithreading
+ MutexGuard aGuard (m_aMutex) ;
+
+ sal_uInt32 nControls = m_pControlInfoList->Count () ;
+
+ for ( sal_uInt32 n=0; n<nControls; n++ )
+ {
+ // Search for right control
+ IMPL_ControlInfo* pControl = m_pControlInfoList->GetObject (n) ;
+ if ( rControl == pControl->xControl )
+ {
+ //.is it found ... remove listener from control
+ pControl->xControl->removeEventListener ( this ) ;
+ pControl->xControl->setContext ( Reference< XInterface > () ) ;
+
+ // ... free memory
+ delete pControl ;
+ m_pControlInfoList->Remove (n) ;
+
+ // Send message to all other listener
+ OInterfaceContainerHelper * pInterfaceContainer = m_aListeners.getContainer( ::getCppuType((const Reference< XContainerListener >*)0) ) ;
+
+ if (pInterfaceContainer)
+ {
+ ContainerEvent aEvent ;
+
+ aEvent.Source = *this ;
+ aEvent.Element <<= rControl ;
+
+ OInterfaceIteratorHelper aIterator (*pInterfaceContainer) ;
+
+ while ( aIterator.hasMoreElements() )
+ {
+ ((XContainerListener*)aIterator.next())->elementRemoved (aEvent) ;
+ }
+ }
+ // Break "for" !
+ break ;
+ }
+ }
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XControlContainer
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseContainerControl::removeContainerListener ( const Reference< XContainerListener > & rListener ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ m_aListeners.removeInterface ( ::getCppuType((const Reference< XContainerListener >*)0), rListener ) ;
+}
+
+//____________________________________________________________________________________________________________
+// XControlContainer
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseContainerControl::setStatusText ( const OUString& rStatusText ) throw( RuntimeException )
+{
+ // go down to each parent
+ Reference< XControlContainer > xContainer ( getContext(), UNO_QUERY ) ;
+
+ if ( xContainer.is () )
+ {
+ xContainer->setStatusText ( rStatusText ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XControlContainer
+//____________________________________________________________________________________________________________
+
+Reference< XControl > SAL_CALL BaseContainerControl::getControl ( const OUString& rName ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( Mutex::getGlobalMutex() ) ;
+
+ Reference< XControl > xRetControl = Reference< XControl > () ;
+ sal_uInt32 nControls = m_pControlInfoList->Count () ;
+
+ // Search for right control
+ for( sal_uInt32 nCount = 0; nCount < nControls; ++nCount )
+ {
+ IMPL_ControlInfo* pSearchControl = m_pControlInfoList->GetObject ( nCount ) ;
+
+ if ( pSearchControl->sName == rName )
+ {
+ // We have found it ...
+ // Break operation and return.
+ return pSearchControl->xControl ;
+ }
+ }
+
+ // We have not found it ... return NULL.
+ return Reference< XControl > () ;
+}
+
+//____________________________________________________________________________________________________________
+// XControlContainer
+//____________________________________________________________________________________________________________
+
+Sequence< Reference< XControl > > SAL_CALL BaseContainerControl::getControls () throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( Mutex::getGlobalMutex() ) ;
+
+ sal_uInt32 nControls = m_pControlInfoList->Count () ;
+ Sequence< Reference< XControl > > aDescriptor ( nControls ) ;
+ Reference< XControl > * pDestination = aDescriptor.getArray () ;
+ sal_uInt32 nCount = 0 ;
+
+ // Copy controls to sequence
+ for( nCount = 0; nCount < nControls; ++nCount )
+ {
+ IMPL_ControlInfo* pCopyControl = m_pControlInfoList->GetObject ( nCount ) ;
+ pDestination [ nCount ] = pCopyControl->xControl ;
+ }
+
+ // Return sequence
+ return aDescriptor ;
+}
+
+//____________________________________________________________________________________________________________
+// XUnoControlContainer
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseContainerControl::addTabController ( const Reference< XTabController > & rTabController ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard (m_aMutex) ;
+
+ sal_uInt32 nOldCount = m_xTabControllerList.getLength () ;
+ Sequence< Reference< XTabController > > aNewList ( nOldCount + 1 ) ;
+ sal_uInt32 nCount = 0 ;
+
+ // Copy old elements of sequence to new list.
+ for ( nCount = 0; nCount < nOldCount; ++nCount )
+ {
+ aNewList.getArray () [nCount] = m_xTabControllerList.getConstArray () [nCount] ;
+ }
+
+ // Add new controller
+ aNewList.getArray () [nOldCount] = rTabController ;
+
+ // change old and new list
+ m_xTabControllerList = aNewList ;
+}
+
+//____________________________________________________________________________________________________________
+// XUnoControlContainer
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseContainerControl::removeTabController ( const Reference< XTabController > & rTabController ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard (m_aMutex) ;
+
+ sal_uInt32 nMaxCount = m_xTabControllerList.getLength () ;
+ sal_uInt32 nCount = 0 ;
+
+ // Search right tabcontroller ...
+ for ( nCount = 0; nCount < nMaxCount; ++nCount )
+ {
+ if ( m_xTabControllerList.getConstArray () [nCount] == rTabController )
+ {
+ // ... if is it found ... remove it from list.
+ m_xTabControllerList.getArray()[ nCount ] = Reference< XTabController >() ;
+ break ;
+ }
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XUnoControlContainer
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseContainerControl::setTabControllers ( const Sequence< Reference< XTabController > >& rTabControllers ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard (m_aMutex) ;
+
+ m_xTabControllerList = rTabControllers ;
+}
+
+Sequence<Reference< XTabController > > SAL_CALL BaseContainerControl::getTabControllers () throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard (m_aMutex) ;
+
+ return m_xTabControllerList ;
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseContainerControl::setVisible ( sal_Bool bVisible ) throw( RuntimeException )
+{
+ // override baseclass definition
+ BaseControl::setVisible ( bVisible ) ;
+
+ // is it a top window ?
+ if ( !getContext().is() && bVisible )
+ {
+ // then show it automaticly
+ createPeer ( Reference< XToolkit > (), Reference< XWindowPeer > () ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+WindowDescriptor* BaseContainerControl::impl_getWindowDescriptor ( const Reference< XWindowPeer > & rParentPeer )
+{
+ // - used from "createPeer()" to set the values of an WindowDescriptor !!!
+ // - if you will change the descriptor-values, you must override thid virtuell function
+ // - the caller must release the memory for this dynamical descriptor !!!
+
+ WindowDescriptor * aDescriptor = new WindowDescriptor ;
+
+ aDescriptor->Type = WindowClass_CONTAINER ;
+ aDescriptor->WindowServiceName = OUString(RTL_CONSTASCII_USTRINGPARAM("window")) ;
+ aDescriptor->ParentIndex = -1 ;
+ aDescriptor->Parent = rParentPeer ;
+ aDescriptor->Bounds = getPosSize () ;
+ aDescriptor->WindowAttributes = 0 ;
+
+ return aDescriptor ;
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+void BaseContainerControl::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGraphics > & rGraphics )
+{
+/*
+ if (rGraphics.is())
+ {
+ for ( sal_uInt32 n=m_pControlInfoList->Count(); n; )
+ {
+ ControlInfo* pSearchControl = m_pControlInfoList->GetObject (--n) ;
+
+ pSearchControl->xControl->paint ( nX, nY, rGraphics ) ;
+ }
+ }
+*/
+}
+
+//____________________________________________________________________________________________________________
+// private method
+//____________________________________________________________________________________________________________
+
+void BaseContainerControl::impl_activateTabControllers ()
+{
+ // Ready for multithreading
+ MutexGuard aGuard (m_aMutex) ;
+
+ sal_uInt32 nMaxCount = m_xTabControllerList.getLength () ;
+ sal_uInt32 nCount = 0 ;
+
+ for ( nCount = 0; nCount < nMaxCount; ++nCount )
+ {
+ m_xTabControllerList.getArray () [nCount]->setContainer ( this ) ;
+ m_xTabControllerList.getArray () [nCount]->activateTabOrder ( ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// private method
+//____________________________________________________________________________________________________________
+
+void BaseContainerControl::impl_cleanMemory ()
+{
+ // Get count of listitems.
+ sal_uInt32 nMaxCount = m_pControlInfoList->Count () ;
+ sal_uInt32 nCount = 0 ;
+
+ // Delete all items.
+ for ( nCount = 0; nCount < nMaxCount; ++nCount )
+ {
+ // Delete everytime first element of list!
+ // We count from 0 to MAX, where "MAX=count of items" BEFORE we delete some elements!
+ // If we use "GetObject ( nCount )" ... it can be, that we have an index greater then count of current elements!
+
+ IMPL_ControlInfo* pSearchControl = m_pControlInfoList->GetObject ( 0 ) ;
+ delete pSearchControl ;
+ }
+
+ // Delete list himself.
+ m_pControlInfoList->Clear () ;
+ delete m_pControlInfoList ;
+}
+
+} // namespace unocontrols
diff --git a/UnoControls/source/base/basecontrol.cxx b/UnoControls/source/base/basecontrol.cxx
new file mode 100644
index 000000000..6f2edd9c2
--- /dev/null
+++ b/UnoControls/source/base/basecontrol.cxx
@@ -0,0 +1,1008 @@
+/*************************************************************************
+ *
+ * $RCSfile: basecontrol.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//____________________________________________________________________________________________________________
+// my own include
+//____________________________________________________________________________________________________________
+
+#ifndef _UNOCONTROLS_BASECONTROL_CTRL_HXX
+#include "basecontrol.hxx"
+#endif
+
+//____________________________________________________________________________________________________________
+// includes of other projects
+//____________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_AWT_XDEVICE_HPP_
+#include <com/sun/star/awt/XDevice.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XDISPLAYBITMAP_HPP_
+#include <com/sun/star/awt/XDisplayBitmap.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_DEVICEINFO_HPP_
+#include <com/sun/star/awt/DeviceInfo.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_WINDOWATTRIBUTE_HPP_
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
+#include <com/sun/star/awt/PosSize.hpp>
+#endif
+
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+
+//____________________________________________________________________________________________________________
+// includes of my own project
+//____________________________________________________________________________________________________________
+
+//____________________________________________________________________________________________________________
+// namespaces
+//____________________________________________________________________________________________________________
+
+using namespace ::cppu ;
+using namespace ::osl ;
+using namespace ::rtl ;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::lang ;
+using namespace ::com::sun::star::awt ;
+
+namespace unocontrols{
+
+//____________________________________________________________________________________________________________
+// defines
+//____________________________________________________________________________________________________________
+
+#define DEFAULT_PMULTIPLEXER NULL
+#define DEFAULT_X 0
+#define DEFAULT_Y 0
+#define DEFAULT_WIDTH 100
+#define DEFAULT_HEIGHT 100
+#define DEFAULT_VISIBLE sal_False
+#define DEFAULT_INDESIGNMODE sal_False
+#define DEFAULT_ENABLE sal_True
+#define SERVICE_VCLTOOLKIT "com.sun.star.awt.Toolkit"
+
+//____________________________________________________________________________________________________________
+// construct/destruct
+//____________________________________________________________________________________________________________
+
+BaseControl::BaseControl( const Reference< XMultiServiceFactory >& xFactory )
+ : IMPL_MutexContainer ( )
+ , OComponentHelper ( m_aMutex )
+ , m_xFactory ( xFactory )
+ , m_pMultiplexer ( DEFAULT_PMULTIPLEXER )
+ , m_nX ( DEFAULT_X )
+ , m_nY ( DEFAULT_Y )
+ , m_nWidth ( DEFAULT_WIDTH )
+ , m_nHeight ( DEFAULT_HEIGHT )
+ , m_bVisible ( DEFAULT_VISIBLE )
+ , m_bInDesignMode ( DEFAULT_INDESIGNMODE )
+ , m_bEnable ( DEFAULT_ENABLE )
+{
+}
+
+BaseControl::~BaseControl()
+{
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+Any SAL_CALL BaseControl::queryInterface( const Type& rType ) throw( RuntimeException )
+{
+ Any aReturn ;
+ if ( m_xDelegator.is() == sal_True )
+ {
+ // If an delegator exist, forward question to his queryInterface.
+ // Delegator will ask his own queryAggregation!
+ aReturn = m_xDelegator->queryInterface( rType );
+ }
+ else
+ {
+ // If an delegator unknown, forward question to own queryAggregation.
+ aReturn = queryAggregation( rType );
+ }
+
+ return aReturn ;
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::acquire() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ OComponentHelper::acquire();
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::release() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ OComponentHelper::release();
+}
+
+//____________________________________________________________________________________________________________
+// XTypeProvider
+//____________________________________________________________________________________________________________
+
+Sequence< Type > SAL_CALL BaseControl::getTypes() throw( RuntimeException )
+{
+ // Optimize this method !
+ // We initialize a static variable only one time. And we don't must use a mutex at every call!
+ // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
+ static OTypeCollection* pTypeCollection = NULL ;
+
+ if ( pTypeCollection == NULL )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if ( pTypeCollection == NULL )
+ {
+ // Create a static typecollection ...
+ static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XPaintListener >*)NULL ) ,
+ ::getCppuType(( const Reference< XView >*)NULL ) ,
+ ::getCppuType(( const Reference< XWindow >*)NULL ) ,
+ ::getCppuType(( const Reference< XServiceInfo >*)NULL ) ,
+ ::getCppuType(( const Reference< XControl >*)NULL ) ,
+ OComponentHelper::getTypes()
+ );
+
+ // ... and set his address to static pointer!
+ pTypeCollection = &aTypeCollection ;
+ }
+ }
+
+ return pTypeCollection->getTypes();
+}
+
+//____________________________________________________________________________________________________________
+// XTypeProvider
+//____________________________________________________________________________________________________________
+
+Sequence< sal_Int8 > SAL_CALL BaseControl::getImplementationId() throw( RuntimeException )
+{
+ // Create one Id for all instances of this class.
+ // Use ethernet address to do this! (sal_True)
+
+ // Optimize this method
+ // We initialize a static variable only one time. And we don't must use a mutex at every call!
+ // For the first call; pID is NULL - for the second call pID is different from NULL!
+ static OImplementationId* pID = NULL ;
+
+ if ( pID == NULL )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if ( pID == NULL )
+ {
+ // Create a new static ID ...
+ static OImplementationId aID( sal_False );
+ // ... and set his address to static pointer!
+ pID = &aID ;
+ }
+ }
+
+ return pID->getImplementationId();
+}
+
+//____________________________________________________________________________________________________________
+// XAggregation
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::setDelegator( const Reference< XInterface >& xDelegator ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+ m_xDelegator = xDelegator ;
+}
+
+//____________________________________________________________________________________________________________
+// XAggregation
+//____________________________________________________________________________________________________________
+
+Any SAL_CALL BaseControl::queryAggregation( const Type& aType ) throw( RuntimeException )
+{
+ // Ask for my own supported interfaces ...
+ // Attention: XTypeProvider and XInterface are supported by OComponentHelper!
+ Any aReturn ( ::cppu::queryInterface( aType ,
+ static_cast< XPaintListener*> ( this ) ,
+ static_cast< XView* > ( this ) ,
+ static_cast< XWindow* > ( this ) ,
+ static_cast< XServiceInfo* > ( this ) ,
+ static_cast< XControl* > ( this )
+ )
+ );
+
+ // If searched interface supported by this class ...
+ if ( aReturn.hasValue() == sal_True )
+ {
+ // ... return this information.
+ return aReturn ;
+ }
+ else
+ {
+ // Else; ... ask baseclass for interfaces!
+ return OComponentHelper::queryAggregation( aType );
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XServiceInfo
+//____________________________________________________________________________________________________________
+
+OUString SAL_CALL BaseControl::getImplementationName() throw( RuntimeException )
+{
+ return impl_getStaticImplementationName();
+}
+
+//____________________________________________________________________________________________________________
+// XServiceInfo
+//____________________________________________________________________________________________________________
+
+sal_Bool SAL_CALL BaseControl::supportsService( const OUString& sServiceName ) throw( RuntimeException )
+{
+ Sequence< OUString > seqServiceNames = getSupportedServiceNames();
+ const OUString* pArray = seqServiceNames.getConstArray();
+ for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ )
+ {
+ if ( pArray[nCounter] == sServiceName )
+ {
+ return sal_True ;
+ }
+ }
+ return sal_False ;
+}
+
+//____________________________________________________________________________________________________________
+// XServiceInfo
+//____________________________________________________________________________________________________________
+
+Sequence< OUString > SAL_CALL BaseControl::getSupportedServiceNames() throw( RuntimeException )
+{
+ return impl_getStaticSupportedServiceNames();
+}
+
+//____________________________________________________________________________________________________________
+// XComponent
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::dispose() throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+
+ if ( m_pMultiplexer != NULL )
+ {
+ // to all other paint, focus, etc.
+ m_pMultiplexer->disposeAndClear();
+ }
+
+ // set the service manager to disposed
+ OComponentHelper::dispose();
+
+ // release context and peer
+ m_xContext = Reference< XInterface >();
+ impl_releasePeer();
+
+ // release view
+ if ( m_xGraphicsView.is() == sal_True )
+ {
+ m_xGraphicsView = Reference< XGraphics >();
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XComponent
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::addEventListener( const Reference< XEventListener >& xListener ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+ OComponentHelper::addEventListener( xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XComponent
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::removeEventListener( const Reference< XEventListener >& xListener ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+ OComponentHelper::removeEventListener( xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::createPeer( const Reference< XToolkit >& xToolkit ,
+ const Reference< XWindowPeer >& xParentPeer ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+
+ if ( m_xPeer.is() == sal_False )
+ {
+ // use method "BaseControl::getWindowDescriptor()" fot change window attributes !!!
+ WindowDescriptor* pDescriptor = impl_getWindowDescriptor( xParentPeer );
+
+ if ( m_bVisible == sal_True )
+ {
+ pDescriptor->WindowAttributes |= WindowAttribute::SHOW ;
+ }
+
+ // very slow under remote conditions!
+ // create the window on the server
+ Reference< XToolkit > xLocalToolkit = xToolkit ;
+ if ( xLocalToolkit.is() == sal_False )
+ {
+ // but first create wellknown toolkit, if it not exist
+ xLocalToolkit = Reference< XToolkit > ( m_xFactory->createInstance( OUString::createFromAscii( SERVICE_VCLTOOLKIT ) ), UNO_QUERY );
+ }
+ m_xPeer = xLocalToolkit->createWindow( *pDescriptor );
+ m_xPeerWindow = Reference< XWindow >( m_xPeer, UNO_QUERY );
+
+ // don't forget to release the memory!
+ delete pDescriptor ;
+
+ if ( m_xPeerWindow.is() == sal_True )
+ {
+ if ( m_pMultiplexer != NULL )
+ {
+ m_pMultiplexer->setPeer( m_xPeerWindow );
+ }
+
+ // create new referenz to xgraphics for painting on a peer
+ // and add a paint listener
+ Reference< XDevice > xDevice( m_xPeerWindow, UNO_QUERY );
+
+ if ( xDevice.is() == sal_True )
+ {
+ m_xGraphicsPeer = xDevice->createGraphics();
+ }
+
+ if ( m_xGraphicsPeer.is() == sal_True )
+ {
+ addPaintListener( this );
+ }
+
+ // PosSize_POSSIZE defined in <stardiv/uno/awt/window.hxx>
+ m_xPeerWindow->setPosSize( m_nX, m_nY, m_nWidth, m_nHeight, PosSize::POSSIZE );
+ m_xPeerWindow->setEnable( m_bEnable );
+ m_xPeerWindow->setVisible( m_bVisible && !m_bInDesignMode );
+ }
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::setContext( const Reference< XInterface >& xContext ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+ m_xContext = xContext ;
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::setDesignMode( sal_Bool bOn ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+ m_bInDesignMode = bOn ;
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+Reference< XInterface > SAL_CALL BaseControl::getContext() throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+ return m_xContext ;
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+Reference< XWindowPeer > SAL_CALL BaseControl::getPeer() throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+ return m_xPeer ;
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+Reference< XView > SAL_CALL BaseControl::getView() throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+ return Reference< XView >( (OWeakObject*)this, UNO_QUERY );
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+sal_Bool SAL_CALL BaseControl::isDesignMode() throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+ return m_bInDesignMode ;
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+sal_Bool SAL_CALL BaseControl::isTransparent() throw( RuntimeException )
+{
+ return sal_False ;
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::setPosSize( sal_Int32 nX ,
+ sal_Int32 nY ,
+ sal_Int32 nWidth ,
+ sal_Int32 nHeight ,
+ sal_Int16 nFlags ) throw( RuntimeException )
+{
+ // - change size and position of window and save the values
+ // - "nFlags" declared in <stardiv/uno/awt/window.hxx> ("#define PosSize_X .....")
+
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+
+ sal_Bool bChanged = sal_False ;
+
+ if ( nFlags & PosSize::X )
+ {
+ bChanged |= m_nX != nX, m_nX = nX ;
+ }
+
+ if ( nFlags & PosSize::Y )
+ {
+ bChanged |= m_nY != nY, m_nY = nY ;
+ }
+
+ if ( nFlags & PosSize::WIDTH )
+ {
+ bChanged |= m_nWidth != nWidth, m_nWidth = nWidth ;
+ }
+
+ if ( nFlags & PosSize::HEIGHT )
+ {
+ bChanged |= m_nHeight != nHeight, m_nHeight = nHeight ;
+ }
+
+ if ( bChanged && m_xPeerWindow.is() )
+ {
+ m_xPeerWindow->setPosSize( m_nX, m_nY, m_nWidth, m_nHeight, nFlags );
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::setVisible( sal_Bool bVisible ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+
+ // Set new state of flag
+ m_bVisible = bVisible ;
+
+ if ( m_xPeerWindow.is() == sal_True )
+ {
+ // Set it also on peerwindow
+ m_xPeerWindow->setVisible( m_bVisible );
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::setEnable( sal_Bool bEnable ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+
+ // Set new state of flag
+ m_bEnable = bEnable ;
+
+ if ( m_xPeerWindow.is() == sal_True )
+ {
+ // Set it also on peerwindow
+ m_xPeerWindow->setEnable( m_bEnable );
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::setFocus() throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+
+ if ( m_xPeerWindow.is() == sal_True )
+ {
+ m_xPeerWindow->setFocus();
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+Rectangle SAL_CALL BaseControl::getPosSize() throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+ return Rectangle( m_nX, m_nY , m_nWidth, m_nHeight );
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::addWindowListener( const Reference< XWindowListener >& xListener ) throw( RuntimeException )
+{
+ impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XWindowListener >*)0), xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::addFocusListener( const Reference< XFocusListener >& xListener ) throw( RuntimeException )
+{
+ impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XFocusListener >*)0), xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::addKeyListener( const Reference< XKeyListener >& xListener ) throw( RuntimeException )
+{
+ impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XKeyListener >*)0), xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::addMouseListener( const Reference< XMouseListener >& xListener ) throw( RuntimeException )
+{
+ impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XMouseListener >*)0), xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::addMouseMotionListener( const Reference< XMouseMotionListener >& xListener ) throw( RuntimeException )
+{
+ impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XMouseMotionListener >*)0), xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::addPaintListener( const Reference< XPaintListener >& xListener ) throw( RuntimeException )
+{
+ impl_getMultiplexer()->advise( ::getCppuType(( const Reference< XPaintListener >*)0), xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::removeWindowListener( const Reference< XWindowListener >& xListener ) throw( RuntimeException )
+{
+ impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XWindowListener >*)0), xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::removeFocusListener( const Reference< XFocusListener >& xListener ) throw( RuntimeException )
+{
+ impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XFocusListener >*)0), xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::removeKeyListener( const Reference< XKeyListener >& xListener ) throw( RuntimeException )
+{
+ impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XKeyListener >*)0), xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::removeMouseListener( const Reference< XMouseListener >& xListener ) throw( RuntimeException )
+{
+ impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XMouseListener >*)0), xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::removeMouseMotionListener( const Reference< XMouseMotionListener >& xListener ) throw( RuntimeException )
+{
+ impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XMouseMotionListener >*)0), xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::removePaintListener( const Reference< XPaintListener >& xListener ) throw( RuntimeException )
+{
+ impl_getMultiplexer()->unadvise( ::getCppuType(( const Reference< XPaintListener >*)0), xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XView
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::draw( sal_Int32 nX ,
+ sal_Int32 nY ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+
+ // - paint to an view
+ // - use the method "paint()"
+ // - see also "windowPaint()"
+ impl_paint( nX, nY, m_xGraphicsView );
+}
+
+//____________________________________________________________________________________________________________
+// XView
+//____________________________________________________________________________________________________________
+
+sal_Bool SAL_CALL BaseControl::setGraphics( const Reference< XGraphics >& xDevice ) throw( RuntimeException )
+{
+ // - set the graphics for an view
+ // - in this class exist 2 graphics-member ... one for peer[_xGraphicsPeer] and one for view[_xGraphicsView]
+ // - they are used by "windowPaint() and draw()", forwarded to "paint ()"
+ sal_Bool bReturn = sal_False ;
+ if ( xDevice.is() == sal_True )
+ {
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+
+ m_xGraphicsView = xDevice ;
+ bReturn = sal_True ;
+ }
+
+ return bReturn ;
+}
+
+//____________________________________________________________________________________________________________
+// XView
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::setZoom( float fZoomX ,
+ float fZoomY ) throw( RuntimeException )
+{
+ // Not implemented yet
+}
+
+//____________________________________________________________________________________________________________
+// XView
+//____________________________________________________________________________________________________________
+
+Reference< XGraphics > SAL_CALL BaseControl::getGraphics() throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+ return m_xGraphicsView ;
+}
+
+//____________________________________________________________________________________________________________
+// XView
+//____________________________________________________________________________________________________________
+
+Size SAL_CALL BaseControl::getSize() throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+ return Size( m_nWidth, m_nHeight );
+}
+
+//____________________________________________________________________________________________________________
+// XEventListener
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::disposing( const EventObject& aSource ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+
+ // - release ALL references
+ // - it must be !!!
+ if ( m_xGraphicsPeer.is() == sal_True )
+ {
+ removePaintListener( this );
+ m_xGraphicsPeer = Reference< XGraphics >();
+ }
+
+ if ( m_xGraphicsView.is() == sal_True )
+ {
+ m_xGraphicsView = Reference< XGraphics >();
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XPaintListener
+//____________________________________________________________________________________________________________
+
+void SAL_CALL BaseControl::windowPaint( const PaintEvent& aEvent ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aMutex );
+
+ // - repaint the peer
+ // - use the method "paint ()" for painting on a peer and a print device !!!
+ // - see also "draw ()"
+ impl_paint( 0, 0, m_xGraphicsPeer );
+}
+
+//____________________________________________________________________________________________________________
+// impl but public method to register service in DLL
+// (In this BASE-implementation not implemented! Overwrite it in derived classes.)
+//____________________________________________________________________________________________________________
+
+const Sequence< OUString > BaseControl::impl_getStaticSupportedServiceNames()
+{
+ return Sequence< OUString >();
+}
+
+//____________________________________________________________________________________________________________
+// impl but public method to register service in DLL
+// (In this BASE-implementation not implemented! Overwrite it in derived classes.)
+//____________________________________________________________________________________________________________
+
+const OUString BaseControl::impl_getStaticImplementationName()
+{
+ return OUString();
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+const Reference< XMultiServiceFactory > BaseControl::impl_getMultiServiceFactory()
+{
+ return m_xFactory ;
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+const Reference< XWindow > BaseControl::impl_getPeerWindow()
+{
+ return m_xPeerWindow ;
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+const Reference< XGraphics > BaseControl::impl_getGraphicsPeer()
+{
+ return m_xGraphicsPeer ;
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+const sal_Int32& BaseControl::impl_getWidth()
+{
+ return m_nWidth ;
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+const sal_Int32& BaseControl::impl_getHeight()
+{
+ return m_nHeight ;
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+WindowDescriptor* BaseControl::impl_getWindowDescriptor( const Reference< XWindowPeer >& xParentPeer )
+{
+ // - used from "createPeer()" to set the values of an ::com::sun::star::awt::WindowDescriptor !!!
+ // - if you will change the descriptor-values, you must override thid virtuell function
+ // - the caller must release the memory for this dynamical descriptor !!!
+
+ WindowDescriptor* pDescriptor = new WindowDescriptor ;
+
+ pDescriptor->Type = WindowClass_SIMPLE ;
+ pDescriptor->WindowServiceName = OUString::createFromAscii( "window" ) ;
+ pDescriptor->ParentIndex = -1 ;
+ pDescriptor->Parent = xParentPeer ;
+ pDescriptor->Bounds = getPosSize () ;
+ pDescriptor->WindowAttributes = 0 ;
+
+ return pDescriptor ;
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+void BaseControl::impl_paint( sal_Int32 nX ,
+ sal_Int32 nY ,
+ const Reference< XGraphics >& xGraphics )
+{
+ // - one paint method for peer AND view !!!
+ // (see also => "windowPaint()" and "draw()")
+ // - not used in this implementation, but its not necessary to make it pure virtual !!!
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+Reference< XInterface > BaseControl::impl_getDelegator()
+{
+ return m_xDelegator ;
+}
+
+//____________________________________________________________________________________________________________
+// private method
+//____________________________________________________________________________________________________________
+
+void BaseControl::impl_releasePeer()
+{
+ if ( m_xPeer.is() == sal_True )
+ {
+ if ( m_xGraphicsPeer.is() == sal_True )
+ {
+ removePaintListener( this );
+ m_xGraphicsPeer = Reference< XGraphics >();
+ }
+
+ m_xPeer->dispose();
+ m_xPeerWindow = Reference< XWindow >();
+ m_xPeer = Reference< XWindowPeer >();
+
+ if ( m_pMultiplexer != NULL )
+ {
+ // take changes on multiplexer
+ m_pMultiplexer->setPeer( Reference< XWindow >() );
+ }
+ }
+}
+
+//____________________________________________________________________________________________________________
+// private method
+//____________________________________________________________________________________________________________
+
+OMRCListenerMultiplexerHelper* BaseControl::impl_getMultiplexer()
+{
+ if ( m_pMultiplexer == NULL )
+ {
+ m_pMultiplexer = new OMRCListenerMultiplexerHelper( (XWindow*)this, m_xPeerWindow );
+ m_xMultiplexer = Reference< XInterface >( (OWeakObject*)m_pMultiplexer, UNO_QUERY );
+ }
+
+ return m_pMultiplexer ;
+}
+
+} // namespace unocontrols
diff --git a/UnoControls/source/base/makefile.mk b/UnoControls/source/base/makefile.mk
new file mode 100644
index 000000000..584aefb81
--- /dev/null
+++ b/UnoControls/source/base/makefile.mk
@@ -0,0 +1,104 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=UnoControls
+TARGET=base
+ENABLE_EXCEPTIONS=TRUE
+#LIBTARGET=NO
+#USE_LDUMP2=TRUE
+#USE_DEFFILE=TRUE
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+
+# --- Files --------------------------------------------------------
+SLOFILES= $(SLO)$/multiplexer.obj \
+ $(SLO)$/basecontrol.obj \
+ $(SLO)$/basecontainercontrol.obj \
+ $(SLO)$/registercontrols.obj
+
+#LIB1TARGET= $(SLB)$/$(TARGET).lib
+#LIB1OBJFILES= $(SLOFILES)
+
+#SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
+
+#SHL1STDLIBS=\
+# $(ONELIB) \
+# $(USRLIB) \
+# $(UNOLIB) \
+# $(VOSLIB) \
+# $(OSLLIB) \
+# $(TOOLSLIB) \
+# $(RTLLIB)
+
+#SHL1DEPN= makefile.mk
+#SHL1LIBS= $(LIB1TARGET)
+#SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+#DEF1NAME= $(SHL1TARGET)
+#DEF1EXPORTFILE= exports.dxp
+
+# --- Targets ------------------------------------------------------
+.INCLUDE : target.mk
+#.INCLUDE : $(PRJ)$/util$/target.pmk
diff --git a/UnoControls/source/base/multiplexer.cxx b/UnoControls/source/base/multiplexer.cxx
new file mode 100644
index 000000000..1a47b4605
--- /dev/null
+++ b/UnoControls/source/base/multiplexer.cxx
@@ -0,0 +1,610 @@
+/*************************************************************************
+ *
+ * $RCSfile: multiplexer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//____________________________________________________________________________________________________________
+// my own include
+//____________________________________________________________________________________________________________
+
+#ifndef _UNOCONTROLS_MULTIPLEXER_HXX
+#include "multiplexer.hxx"
+#endif
+
+//____________________________________________________________________________________________________________
+// includes of other projects
+//____________________________________________________________________________________________________________
+
+#ifndef _VOS_DIAGNOSE_H_
+#include <vos/diagnose.hxx>
+#endif
+
+//____________________________________________________________________________________________________________
+// includes of my own project
+//____________________________________________________________________________________________________________
+
+//____________________________________________________________________________________________________________
+// namespaces
+//____________________________________________________________________________________________________________
+
+using namespace ::cppu ;
+using namespace ::osl ;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::awt ;
+using namespace ::com::sun::star::lang ;
+
+namespace unocontrols{
+
+//____________________________________________________________________________________________________________
+// macros
+//____________________________________________________________________________________________________________
+
+#define MULTIPLEX( INTERFACE, METHOD, EVENTTYP, EVENT ) \
+ \
+ /* First get all interfaces from container with right type.*/ \
+ OInterfaceContainerHelper* pContainer = m_aListenerHolder.getContainer( ::getCppuType((const Reference< INTERFACE## >*)0) ); \
+ /* Do the follow only, if elements in container exist.*/ \
+ if( pContainer != NULL ) \
+ { \
+ OInterfaceIteratorHelper aIterator( *pContainer ); \
+ EVENTTYP aLocalEvent = EVENT##; \
+ /* Remark: The control is the event source not the peer.*/ \
+ /* We must change the source of the event. */ \
+ aLocalEvent.Source = m_xControl ; \
+ /* Is the control not destroyed? */ \
+ if( aLocalEvent.Source.is() == sal_True ) \
+ { \
+ if( aIterator.hasMoreElements() ) \
+ { \
+ INTERFACE## * pListener = (INTERFACE## *)aIterator.next(); \
+ try \
+ { \
+ pListener->METHOD##( aLocalEvent ); \
+ } \
+ catch( RuntimeException& ) \
+ { \
+ /* Ignore all system exceptions from the listener! */ \
+ } \
+ } \
+ } \
+ }
+
+//____________________________________________________________________________________________________________
+// construct/destruct
+//____________________________________________________________________________________________________________
+
+OMRCListenerMultiplexerHelper::OMRCListenerMultiplexerHelper( const Reference< XWindow >& xControl ,
+ const Reference< XWindow >& xPeer )
+ : m_aListenerHolder ( m_aMutex )
+ , m_xControl ( xControl )
+ , m_xPeer ( xPeer )
+{
+}
+
+OMRCListenerMultiplexerHelper::OMRCListenerMultiplexerHelper( const OMRCListenerMultiplexerHelper& aCopyInstance )
+ : m_aListenerHolder ( m_aMutex )
+{
+}
+
+OMRCListenerMultiplexerHelper::~OMRCListenerMultiplexerHelper()
+{
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+Any SAL_CALL OMRCListenerMultiplexerHelper::queryInterface( const Type& rType ) throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Ask for my own supported interfaces ...
+ // Attention: XTypeProvider and XInterface are supported by OComponentHelper!
+ Any aReturn ( ::cppu::queryInterface( rType ,
+ static_cast< XWindowListener* > ( this ) ,
+ static_cast< XKeyListener* > ( this ) ,
+ static_cast< XFocusListener* > ( this ) ,
+ static_cast< XMouseListener* > ( this ) ,
+ static_cast< XMouseMotionListener* > ( this ) ,
+ static_cast< XPaintListener* > ( this ) ,
+ static_cast< XTopWindowListener* > ( this ) ,
+ static_cast< XTopWindowListener* > ( this )
+ )
+ );
+
+ // If searched interface supported by this class ...
+ if ( aReturn.hasValue() == sal_True )
+ {
+ // ... return this information.
+ return aReturn ;
+ }
+ else
+ {
+ // Else; ... ask baseclass for interfaces!
+ return OWeakObject::queryInterface( rType );
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL OMRCListenerMultiplexerHelper::acquire() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ OWeakObject::acquire();
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL OMRCListenerMultiplexerHelper::release() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ OWeakObject::release();
+}
+
+//____________________________________________________________________________________________________________
+// operator
+//____________________________________________________________________________________________________________
+
+OMRCListenerMultiplexerHelper::operator Reference< XInterface >() const
+{
+ return ((OWeakObject*)this) ;
+}
+
+//____________________________________________________________________________________________________________
+// operator
+//____________________________________________________________________________________________________________
+
+//OMRCListenerMultiplexerHelper& OMRCListenerMultiplexerHelper::operator= ( const OMRCListenerMultiplexerHelper& aCopyInstance )
+//{
+// return this ;
+//}
+
+//____________________________________________________________________________________________________________
+// container method
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer )
+{
+ MutexGuard aGuard( m_aMutex );
+ if( m_xPeer != xPeer )
+ {
+ if( m_xPeer.is() )
+ {
+ // get all types from the listener added to the peer
+ Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes();
+ const Type* pArray = aContainedTypes.getConstArray();
+ sal_Int32 nCount = aContainedTypes.getLength();
+ // loop over all listener types and remove the listeners from the peer
+ for( sal_Int32 i=0; i<nCount; i++ )
+ impl_unadviseFromPeer( m_xPeer, pArray[i] );
+ }
+ m_xPeer = xPeer;
+ if( m_xPeer.is() )
+ {
+ // get all types from the listener added to the peer
+ Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes();
+ const Type* pArray = aContainedTypes.getConstArray();
+ sal_Int32 nCount = aContainedTypes.getLength();
+ // loop over all listener types and add the listeners to the peer
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ impl_adviseToPeer( m_xPeer, pArray[i] );
+ }
+ }
+}
+
+//____________________________________________________________________________________________________________
+// container method
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::disposeAndClear()
+{
+ EventObject aEvent ;
+ aEvent.Source = m_xControl ;
+ m_aListenerHolder.disposeAndClear( aEvent );
+}
+
+//____________________________________________________________________________________________________________
+// container method
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::advise( const Type& aType ,
+ const Reference< XInterface >& xListener )
+{
+ MutexGuard aGuard( m_aMutex );
+ if( m_aListenerHolder.addInterface( aType, xListener ) == 1 )
+ {
+ // the first listener is added
+ if( m_xPeer.is() )
+ {
+ impl_adviseToPeer( m_xPeer, aType );
+ }
+ }
+}
+
+//____________________________________________________________________________________________________________
+// container method
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::unadvise( const Type& aType ,
+ const Reference< XInterface >& xListener )
+{
+ MutexGuard aGuard( m_aMutex );
+ if( m_aListenerHolder.removeInterface( aType, xListener ) == 0 )
+ {
+ // the last listener is removed
+ if ( m_xPeer.is() )
+ {
+ impl_unadviseFromPeer( m_xPeer, aType );
+ }
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XEventListener
+//____________________________________________________________________________________________________________
+
+void SAL_CALL OMRCListenerMultiplexerHelper::disposing( const EventObject& aSource ) throw( RuntimeException )
+{
+ MutexGuard aGuard( m_aMutex );
+ // peer is disposed, clear the reference
+ m_xPeer = Reference< XWindow >();
+}
+
+//____________________________________________________________________________________________________________
+// XFcousListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::focusGained(const FocusEvent& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
+{
+/*
+ OInterfaceContainerHelper * pCont = aListenerHolder.getContainer( ::getCppuType((const Reference< XFocusListener >*)0) );
+ if( pCont )
+ {
+ OInterfaceIteratorHelper aIt( *pCont );
+ FocusEvent aEvt = e;
+ // Reamark: The control is the event source not the peer. We must change
+ // the source of the event
+ xControl.queryHardRef( ((XInterface*)NULL)->getSmartUik(), aEvt.Source );
+ //.is the control not destroyed
+ if( aEvt.Source.is() )
+ {
+ if( aIt.hasMoreElements() )
+ {
+ XFocusListener * pListener = (XFocusListener *)aIt.next();
+ TRY
+ {
+ pListener->focusGained( aEvt );
+ }
+ CATCH( RuntimeException, e )
+ {
+ // ignore all usr system exceptions from the listener
+ }
+ END_CATCH;
+ }
+ }
+ }
+*/
+ MULTIPLEX( XFocusListener, focusGained, FocusEvent, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XFcousListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::focusLost(const FocusEvent& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XFocusListener, focusLost, FocusEvent, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XWindowListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::windowResized(const WindowEvent& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XWindowListener, windowResized, WindowEvent, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XWindowListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::windowMoved(const WindowEvent& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XWindowListener, windowMoved, WindowEvent, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XWindowListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::windowShown(const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XWindowListener, windowShown, EventObject, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XWindowListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::windowHidden(const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XWindowListener, windowHidden, EventObject, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XKeyListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::keyPressed(const KeyEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XKeyListener, keyPressed, KeyEvent, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XKeyListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::keyReleased(const KeyEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XKeyListener, keyReleased, KeyEvent, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XMouseListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::mousePressed(const MouseEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XMouseListener, mousePressed, MouseEvent, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XMouseListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::mouseReleased(const MouseEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XMouseListener, mouseReleased, MouseEvent, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XMouseListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::mouseEntered(const MouseEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XMouseListener, mouseEntered, MouseEvent, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XMouseListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::mouseExited(const MouseEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XMouseListener, mouseExited, MouseEvent, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XMouseMotionListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::mouseDragged(const MouseEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XMouseMotionListener, mouseDragged, MouseEvent, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XMouseMotionListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::mouseMoved(const MouseEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XMouseMotionListener, mouseMoved, MouseEvent, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XPaintListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::windowPaint(const PaintEvent& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XPaintListener, windowPaint, PaintEvent, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XTopWindowListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::windowOpened(const EventObject& aEvent) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XTopWindowListener, windowOpened, EventObject, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XTopWindowListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::windowClosing( const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XTopWindowListener, windowClosing, EventObject, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XTopWindowListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::windowClosed( const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XTopWindowListener, windowClosed, EventObject, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XTopWindowListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::windowMinimized( const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XTopWindowListener, windowMinimized, EventObject, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XTopWindowListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::windowNormalized( const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XTopWindowListener, windowNormalized, EventObject, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XTopWindowListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::windowActivated( const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XTopWindowListener, windowActivated, EventObject, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// XTopWindowListener
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::windowDeactivated( const EventObject& aEvent ) throw( UNO3_RUNTIMEEXCEPTION )
+{
+ MULTIPLEX( XTopWindowListener, windowDeactivated, EventObject, aEvent )
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::impl_adviseToPeer( const Reference< XWindow >& xPeer ,
+ const Type& aType )
+{
+ // add a listener to the source (peer)
+ if( aType == ::getCppuType((const Reference< XWindowListener >*)0) )
+ xPeer->addWindowListener( this );
+ else if( aType == ::getCppuType((const Reference< XKeyListener >*)0) )
+ xPeer->addKeyListener( this );
+ else if( aType == ::getCppuType((const Reference< XFocusListener >*)0) )
+ xPeer->addFocusListener( this );
+ else if( aType == ::getCppuType((const Reference< XMouseListener >*)0) )
+ xPeer->addMouseListener( this );
+ else if( aType == ::getCppuType((const Reference< XMouseMotionListener >*)0) )
+ xPeer->addMouseMotionListener( this );
+ else if( aType == ::getCppuType((const Reference< XPaintListener >*)0) )
+ xPeer->addPaintListener( this );
+ else if( aType == ::getCppuType((const Reference< XTopWindowListener >*)0) )
+ {
+ Reference< XTopWindow > xTop( xPeer, UNO_QUERY );
+ if( xTop.is() )
+ xTop->addTopWindowListener( this );
+ }
+ else
+ {
+ VOS_ENSHURE( sal_False, "unknown listener" );
+ }
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+void OMRCListenerMultiplexerHelper::impl_unadviseFromPeer( const Reference< XWindow >& xPeer ,
+ const Type& aType )
+{
+ // the last listener is removed, remove the listener from the source (peer)
+ if( aType == ::getCppuType((const Reference< XWindowListener >*)0) )
+ xPeer->removeWindowListener( this );
+ else if( aType == ::getCppuType((const Reference< XKeyListener >*)0) )
+ xPeer->removeKeyListener( this );
+ else if( aType == ::getCppuType((const Reference< XFocusListener >*)0) )
+ xPeer->removeFocusListener( this );
+ else if( aType == ::getCppuType((const Reference< XMouseListener >*)0) )
+ xPeer->removeMouseListener( this );
+ else if( aType == ::getCppuType((const Reference< XMouseMotionListener >*)0) )
+ xPeer->removeMouseMotionListener( this );
+ else if( aType == ::getCppuType((const Reference< XPaintListener >*)0) )
+ xPeer->removePaintListener( this );
+ else if( aType == ::getCppuType((const Reference< XTopWindowListener >*)0) )
+ {
+ Reference< XTopWindow > xTop( xPeer, UNO_QUERY );
+ if( xTop.is() )
+ xTop->removeTopWindowListener( this );
+ }
+ else
+ {
+ VOS_ENSHURE( sal_False, "unknown listener" );
+ }
+}
+
+} // namespace unocontrols
diff --git a/UnoControls/source/base/registercontrols.cxx b/UnoControls/source/base/registercontrols.cxx
new file mode 100644
index 000000000..72f2c431f
--- /dev/null
+++ b/UnoControls/source/base/registercontrols.cxx
@@ -0,0 +1,393 @@
+/*************************************************************************
+ *
+ * $RCSfile: registercontrols.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//______________________________________________________________________________________________________________
+// includes of other projects
+//______________________________________________________________________________________________________________
+
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
+#include <com/sun/star/container/XSet.hpp>
+#endif
+
+#include <stdio.h>
+
+//______________________________________________________________________________________________________________
+// includes of my own project
+//______________________________________________________________________________________________________________
+
+//=============================================================================
+// Add new include line to use new services.
+//=============================================================================
+#ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
+#include "framecontrol.hxx"
+#endif
+
+#ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
+#include "progressbar.hxx"
+#endif
+
+#ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
+#include "progressmonitor.hxx"
+#endif
+//=============================================================================
+
+//______________________________________________________________________________________________________________
+// defines
+//______________________________________________________________________________________________________________
+
+// If you will debug macros of this file ... you must define follow constant!
+// Ths switch on another macro AS_DBG_OUT(...), which will print text to "stdout".
+
+//#define AS_DBG_SWITCH
+
+//______________________________________________________________________________________________________________
+// namespaces
+//______________________________________________________________________________________________________________
+
+using namespace ::rtl ;
+using namespace ::cppu ;
+using namespace ::unocontrols ;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::container ;
+using namespace ::com::sun::star::lang ;
+using namespace ::com::sun::star::registry ;
+
+//______________________________________________________________________________________________________________
+// macros
+//______________________________________________________________________________________________________________
+
+//******************************************************************************************************************************
+// See AS_DBG_SWITCH below !!!
+#ifdef AS_DBG_SWITCH
+ #define AS_DBG_OUT(OUTPUT) printf( OUTPUT );
+#else
+ #define AS_DBG_OUT(OUTPUT)
+#endif
+
+//******************************************************************************************************************************
+#define CREATEINSTANCE(CLASS) \
+ \
+ static Reference< XInterface > SAL_CALL CLASS##_createInstance ( const Reference< XMultiServiceFactory >& rServiceManager ) throw ( Exception ) \
+ { \
+ AS_DBG_OUT ( "\tCREATEINSTANCE():\tOK\n" ) \
+ return Reference< XInterface >( *(OWeakObject*)(new CLASS##( rServiceManager )) ); \
+ }
+
+//******************************************************************************************************************************
+#define COMPONENT_INFO(CLASS) \
+ \
+ AS_DBG_OUT ( "\tCOMPONENT_INFO():\t[start]\n" ) \
+ try \
+ { \
+ /* Set default result of follow operations !!! */ \
+ bReturn = sal_False ; \
+ \
+ /* Do the follow only, if given key is valid ! */ \
+ if ( xKey.is () ) \
+ { \
+ AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\txkey is valid ...\n" ) \
+ /* Build new keyname */ \
+ sKeyName = OUString::createFromAscii( "/" ) ; \
+ sKeyName += CLASS##::impl_getStaticImplementationName() ; \
+ sKeyName += OUString::createFromAscii( "/UNO/SERVICES" ); \
+ \
+ /* Create new key with new name. */ \
+ xNewKey = xKey->createKey( sKeyName ); \
+ \
+ /* If this new key valid ... */ \
+ if ( xNewKey.is () ) \
+ { \
+ AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\txNewkey is valid ...\n" ) \
+ /* Get information about supported services. */ \
+ seqServiceNames = CLASS##::impl_getStaticSupportedServiceNames() ; \
+ pArray = seqServiceNames.getArray() ; \
+ nLength = seqServiceNames.getLength() ; \
+ nCounter = 0 ; \
+ \
+ AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\tloop ..." ) \
+ /* Then set this information on this key. */ \
+ for ( nCounter = 0; nCounter < nLength; ++nCounter ) \
+ { \
+ xNewKey->createKey( pArray [nCounter] ); \
+ } \
+ AS_DBG_OUT ( " OK\n" ) \
+ \
+ /* Result of this operations = OK. */ \
+ bReturn = sal_True ; \
+ } \
+ AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\t... leave xNewKey\n" ) \
+ } \
+ AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\t... leave xKey\n" ) \
+ } \
+ catch( InvalidRegistryException& ) \
+ { \
+ AS_DBG_OUT ( "\tCOMPONENT_INFO():\t\tInvalidRegistryException detected!!!\n" ) \
+ bReturn = sal_False ; \
+ } \
+ AS_DBG_OUT ( "\tCOMPONENT_INFO():\t[end]\n" )
+
+//******************************************************************************************************************************
+#define CREATEFACTORY_ONEINSTANCE(CLASS) \
+ \
+ AS_DBG_OUT ( "\tCREATEFACTORY_ONEINSTANCE():\t[start]\n" ) \
+ /* Create right factory ... */ \
+ xFactory = Reference< XSingleServiceFactory > \
+ ( \
+ cppu::createOneInstanceFactory ( xServiceManager , \
+ CLASS##::impl_getStaticImplementationName () , \
+ CLASS##_createInstance , \
+ CLASS##::impl_getStaticSupportedServiceNames () ) \
+ ) ; \
+ AS_DBG_OUT ( "\tCREATEFACTORY_ONEINSTANCE():\t[end]\n" )
+
+//******************************************************************************************************************************
+#define CREATEFACTORY_SINGLE(CLASS) \
+ \
+ AS_DBG_OUT ( "\tCREATEFACTORY_SINGLE():\t[start]\n" ) \
+ /* Create right factory ... */ \
+ xFactory = Reference< XSingleServiceFactory > \
+ ( \
+ cppu::createSingleFactory ( xServiceManager , \
+ CLASS##::impl_getStaticImplementationName () , \
+ CLASS##_createInstance , \
+ CLASS##::impl_getStaticSupportedServiceNames () ) \
+ ) ; \
+ AS_DBG_OUT ( "\tCREATEFACTORY_SINGLE():\t[end]\n" )
+
+//******************************************************************************************************************************
+#ifdef MACOSX
+#define IF_NAME_CREATECOMPONENTFACTORY_ONEINSTANCE(CLASS) \
+ \
+ if ( CLASS##::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \
+ { \
+ AS_DBG_OUT ( "\tIF_NAME_CREATECOMPONENTFACTORY_ONEINSTANCE():\timplementationname found\n" ) \
+ CREATEFACTORY_ONEINSTANCE ( CLASS ) \
+ }
+#else /* MACOSX */
+#define IF_NAME_CREATECOMPONENTFACTORY_ONEINSTANCE(CLASS) \
+ \
+ if ( CLASS##::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \
+ { \
+ AS_DBG_OUT ( "\tIF_NAME_CREATECOMPONENTFACTORY_ONEINSTANCE():\timplementationname found\n" ) \
+ CREATEFACTORY_ONEINSTANCE ( CLASS## ) \
+ }
+#endif /* MACOSX */
+
+//******************************************************************************************************************************
+#ifdef MACOSX
+#define IF_NAME_CREATECOMPONENTFACTORY_SINGLE(CLASS) \
+ \
+ if ( CLASS##::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \
+ { \
+ AS_DBG_OUT ( "\tIF_NAME_CREATECOMPONENTFACTORY_SINGLE():\timplementationname found\n" ) \
+ CREATEFACTORY_SINGLE ( CLASS ) \
+ }
+#else /* MACOSX */
+#define IF_NAME_CREATECOMPONENTFACTORY_SINGLE(CLASS) \
+ \
+ if ( CLASS##::impl_getStaticImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) \
+ { \
+ AS_DBG_OUT ( "\tIF_NAME_CREATECOMPONENTFACTORY_SINGLE():\timplementationname found\n" ) \
+ CREATEFACTORY_SINGLE ( CLASS## ) \
+ }
+#endif /* MACOSX */
+
+//______________________________________________________________________________________________________________
+// declare functions to create a new instance of service
+//______________________________________________________________________________________________________________
+
+//=============================================================================
+// Add new macro line to use new services.
+//
+// !!! ATTENTION !!!
+// Write no ";" at end of line! (see macro)
+//=============================================================================
+CREATEINSTANCE ( FrameControl )
+CREATEINSTANCE ( ProgressBar )
+CREATEINSTANCE ( ProgressMonitor )
+//=============================================================================
+
+//______________________________________________________________________________________________________________
+// return environment
+//______________________________________________________________________________________________________________
+
+extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvironmentTypeName ,
+ uno_Environment** ppEnvironment )
+{
+ *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
+}
+
+//______________________________________________________________________________________________________________
+// write component info to registry
+//______________________________________________________________________________________________________________
+
+extern "C" sal_Bool SAL_CALL component_writeInfo( void* pServiceManager ,
+ void* pRegistryKey )
+{
+ AS_DBG_OUT ( "component_writeInfo():\t[start]\n" )
+
+ // Set default return value for this operation - if it failed.
+ sal_Bool bReturn = sal_False ;
+
+ if ( pRegistryKey != NULL )
+ {
+ AS_DBG_OUT ( "component_writeInfo():\t\tpRegistryKey is valid ... enter scope\n" )
+
+ // Define variables for following macros!
+ // bReturn is set automaticly.
+ Reference< XRegistryKey > xKey( reinterpret_cast< XRegistryKey* >( pRegistryKey ) ) ;
+ Reference< XRegistryKey > xNewKey ;
+ Sequence< OUString > seqServiceNames ;
+ const OUString* pArray ;
+ sal_Int32 nLength ;
+ sal_Int32 nCounter ;
+ OUString sKeyName ;
+
+ //=============================================================================
+ // Add new macro line to register new services.
+ //
+ // !!! ATTENTION !!!
+ // Write no ";" at end of line! (see macro)
+ //=============================================================================
+ COMPONENT_INFO ( FrameControl )
+ COMPONENT_INFO ( ProgressBar )
+ COMPONENT_INFO ( ProgressMonitor )
+ //=============================================================================
+
+ AS_DBG_OUT ( "component_writeInfo():\t\t... leave pRegistryKey scope\n" )
+ }
+
+ AS_DBG_OUT ( "component_writeInfo():\t[end]\n" )
+
+ // Return with result of this operation.
+ return bReturn ;
+}
+
+//______________________________________________________________________________________________________________
+// create right component factory
+//______________________________________________________________________________________________________________
+
+extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplementationName ,
+ void* pServiceManager ,
+ void* pRegistryKey )
+{
+ AS_DBG_OUT( "component_getFactory():\t[start]\n" )
+
+ // Set default return value for this operation - if it failed.
+ void* pReturn = NULL ;
+
+ if (
+ ( pImplementationName != NULL ) &&
+ ( pServiceManager != NULL )
+ )
+ {
+ AS_DBG_OUT( "component_getFactory():\t\t... enter scope - pointer are valid\n" )
+
+ // Define variables which are used in following macros.
+ Reference< XSingleServiceFactory > xFactory ;
+ Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
+
+ //=============================================================================
+ // Add new macro line to handle new service.
+ //
+ // !!! ATTENTION !!!
+ // Write no ";" at end of line and dont forget "else" ! (see macro)
+ //=============================================================================
+ IF_NAME_CREATECOMPONENTFACTORY_SINGLE( FrameControl )
+ else
+ IF_NAME_CREATECOMPONENTFACTORY_SINGLE( ProgressBar )
+ else
+ IF_NAME_CREATECOMPONENTFACTORY_SINGLE( ProgressMonitor )
+ //=============================================================================
+
+ // Factory is valid - service was found.
+ if ( xFactory.is() )
+ {
+ AS_DBG_OUT( "component_getFactory():\t\t\t... xFactory valid - service was found\n" )
+
+ xFactory->acquire();
+ pReturn = xFactory.get();
+ }
+
+ AS_DBG_OUT( "component_getFactory():\t\t... leave scope\n" )
+ }
+
+ AS_DBG_OUT ( "component_getFactory():\t[end]\n" )
+
+ // Return with result of this operation.
+ return pReturn ;
+}
diff --git a/UnoControls/source/controls/OConnectionPointContainerHelper.cxx b/UnoControls/source/controls/OConnectionPointContainerHelper.cxx
new file mode 100644
index 000000000..8bfcd40e4
--- /dev/null
+++ b/UnoControls/source/controls/OConnectionPointContainerHelper.cxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * $RCSfile: OConnectionPointContainerHelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//______________________________________________________________________________________________________________
+// my own include
+//______________________________________________________________________________________________________________
+
+#ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX
+#include "OConnectionPointContainerHelper.hxx"
+#endif
+
+//______________________________________________________________________________________________________________
+// includes of other projects
+//______________________________________________________________________________________________________________
+
+//______________________________________________________________________________________________________________
+// include of my own project
+//______________________________________________________________________________________________________________
+
+#ifndef _OCONNECTIONPOINTHELPER_HXX
+#include "OConnectionPointHelper.hxx"
+#endif
+
+//______________________________________________________________________________________________________________
+// namespaces
+//______________________________________________________________________________________________________________
+
+using namespace ::rtl ;
+using namespace ::osl ;
+using namespace ::cppu ;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::lang ;
+
+namespace unocontrols{
+
+//______________________________________________________________________________________________________________
+// construct/destruct
+//______________________________________________________________________________________________________________
+
+OConnectionPointContainerHelper::OConnectionPointContainerHelper( Mutex& aMutex )
+ : m_aSharedMutex ( aMutex )
+ , m_aMultiTypeContainer ( aMutex )
+{
+}
+
+OConnectionPointContainerHelper::~OConnectionPointContainerHelper()
+{
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+Any SAL_CALL OConnectionPointContainerHelper::queryInterface( const Type& aType ) throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Ask for my own supported interfaces ...
+ Any aReturn ( ::cppu::queryInterface( aType ,
+ static_cast< XConnectionPointContainer* > ( this )
+ )
+ );
+
+ // If searched interface not supported by this class ...
+ if ( aReturn.hasValue() == sal_False )
+ {
+ // ... ask baseclasses.
+ aReturn = OWeakObject::queryInterface( aType );
+ }
+
+ return aReturn ;
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL OConnectionPointContainerHelper::acquire() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ OWeakObject::acquire();
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL OConnectionPointContainerHelper::release() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ OWeakObject::release();
+}
+
+//______________________________________________________________________________________________________________
+// XConnectionPointContainer
+//______________________________________________________________________________________________________________
+
+Sequence< Type > SAL_CALL OConnectionPointContainerHelper::getConnectionPointTypes() throw( RuntimeException )
+{
+ // Container is threadsafe himself !
+ return m_aMultiTypeContainer.getContainedTypes();
+}
+
+//______________________________________________________________________________________________________________
+// XConnectionPointContainer
+//______________________________________________________________________________________________________________
+
+Reference< XConnectionPoint > SAL_CALL OConnectionPointContainerHelper::queryConnectionPoint( const Type& aType ) throw( RuntimeException )
+{
+ // Set default return value, if method failed.
+ Reference< XConnectionPoint > xConnectionPoint = Reference< XConnectionPoint >();
+
+ // Get all elements of the container, which have the searched type.
+ OInterfaceContainerHelper* pSpecialContainer = m_aMultiTypeContainer.getContainer( aType );
+ if ( pSpecialContainer->getLength() > 0 )
+ {
+ // Ready for multithreading
+ MutexGuard aGuard( m_aSharedMutex );
+ // If this container contains elements, build a connectionpoint-instance.
+ OConnectionPointHelper* pNewConnectionPoint = new OConnectionPointHelper( m_aSharedMutex, this, aType );
+ xConnectionPoint = Reference< XConnectionPoint >( (OWeakObject*)pNewConnectionPoint, UNO_QUERY );
+ }
+
+ return xConnectionPoint ;
+}
+
+//______________________________________________________________________________________________________________
+// XConnectionPointContainer
+//______________________________________________________________________________________________________________
+
+void SAL_CALL OConnectionPointContainerHelper::advise( const Type& aType ,
+ const Reference< XInterface >& xListener ) throw( RuntimeException )
+{
+ // Container is threadsafe himself !
+ m_aMultiTypeContainer.addInterface( aType, xListener );
+}
+
+//______________________________________________________________________________________________________________
+// XConnectionPointContainer
+//______________________________________________________________________________________________________________
+
+void SAL_CALL OConnectionPointContainerHelper::unadvise( const Type& aType ,
+ const Reference< XInterface >& xListener ) throw( RuntimeException )
+{
+ // Container is threadsafe himself !
+ m_aMultiTypeContainer.removeInterface( aType, xListener );
+}
+
+//______________________________________________________________________________________________________________
+// public but impl method!
+// Is neccessary to get container member at OConnectionPoint-instance.
+//______________________________________________________________________________________________________________
+
+OMultiTypeInterfaceContainerHelper& OConnectionPointContainerHelper::impl_getMultiTypeContainer()
+{
+ // Impl methods are not threadsafe!
+ // "Parent" function must do this.
+ return m_aMultiTypeContainer;
+}
+
+} // namespace unocontrols
diff --git a/UnoControls/source/controls/OConnectionPointHelper.cxx b/UnoControls/source/controls/OConnectionPointHelper.cxx
new file mode 100644
index 000000000..f0c2e9c52
--- /dev/null
+++ b/UnoControls/source/controls/OConnectionPointHelper.cxx
@@ -0,0 +1,310 @@
+/*************************************************************************
+ *
+ * $RCSfile: OConnectionPointHelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//______________________________________________________________________________________________________________
+// my own include
+//______________________________________________________________________________________________________________
+
+#ifndef _OCONNECTIONPOINTHELPER_HXX
+#include "OConnectionPointHelper.hxx"
+#endif
+
+//______________________________________________________________________________________________________________
+// includes of other projects
+//______________________________________________________________________________________________________________
+
+//______________________________________________________________________________________________________________
+// include of my own project
+//______________________________________________________________________________________________________________
+
+#ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX
+#include "OConnectionPointContainerHelper.hxx"
+#endif
+
+//______________________________________________________________________________________________________________
+// namespaces
+//______________________________________________________________________________________________________________
+
+using namespace ::rtl ;
+using namespace ::osl ;
+using namespace ::cppu ;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::lang ;
+
+namespace unocontrols{
+
+//______________________________________________________________________________________________________________
+// construct/destruct
+//______________________________________________________________________________________________________________
+
+OConnectionPointHelper::OConnectionPointHelper( Mutex& aMutex ,
+ OConnectionPointContainerHelper* pContainerImplementation ,
+ UNO3_TYPE aType )
+ : m_aSharedMutex ( aMutex )
+ , m_oContainerWeakReference ( pContainerImplementation )
+ , m_pContainerImplementation ( pContainerImplementation )
+ , m_aInterfaceType ( aType )
+{
+}
+
+OConnectionPointHelper::~OConnectionPointHelper()
+{
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+Any SAL_CALL OConnectionPointHelper::queryInterface( const Type& aType ) throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Ask for my own supported interfaces ...
+ Any aReturn ( ::cppu::queryInterface( aType ,
+ static_cast< XConnectionPoint* > ( this )
+ )
+ );
+
+ // If searched interface not supported by this class ...
+ if ( aReturn.hasValue() == sal_False )
+ {
+ // ... ask baseclasses.
+ aReturn = OWeakObject::queryInterface( aType );
+ }
+
+ return aReturn ;
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL OConnectionPointHelper::acquire() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ OWeakObject::acquire();
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL OConnectionPointHelper::release() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ OWeakObject::release();
+}
+
+//______________________________________________________________________________________________________________
+// XConnectionPoint
+//______________________________________________________________________________________________________________
+
+Type SAL_CALL OConnectionPointHelper::getConnectionType() throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aSharedMutex );
+
+ // Set default return value, if method failed.
+ if ( impl_LockContainer() == sal_False )
+ {
+ // Container not exist! Its an runtime error.
+ throw RuntimeException();
+ }
+
+ // If container reference valid, return right type of supported interfaces of THIS connectionpoint.
+ Type aReturnType = m_aInterfaceType ;
+ // Don't forget this!
+ impl_UnlockContainer();
+
+ return aReturnType;
+}
+
+//______________________________________________________________________________________________________________
+// XConnectionPoint
+//______________________________________________________________________________________________________________
+
+Reference< XConnectionPointContainer > SAL_CALL OConnectionPointHelper::getConnectionPointContainer() throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aSharedMutex );
+ // Convert weakreference to correct uno3-reference and return value. It can be NULL, if container destroyed!
+ return Reference< XConnectionPointContainer >( m_oContainerWeakReference.get(), UNO_QUERY );
+}
+
+//______________________________________________________________________________________________________________
+// XConnectionPoint
+//______________________________________________________________________________________________________________
+
+void SAL_CALL OConnectionPointHelper::advise( const Reference< XInterface >& xListener ) throw( ListenerExistException ,
+ InvalidListenerException ,
+ RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aSharedMutex );
+
+ // If type of listener not the same for this special container ...
+ Any aCheckType = xListener->queryInterface( m_aInterfaceType );
+ if ( aCheckType.hasValue() )
+ {
+ // ... throw an exception.
+ throw InvalidListenerException();
+ }
+
+ // ListenerExistException is obsolete!?
+ // Its the same container for XConnectionPointContainer and XConnectionPoint. But only here we must control, if a listener already exist!?
+ // You can add a listener more then one time at XConnectionPointContainer, but here only one ...
+
+ // Operation is permitted only, if reference to container is valid!
+ if ( impl_LockContainer() == sal_False )
+ {
+ // Container not exist! Its an runtime error.
+ throw RuntimeException();
+ }
+ // Forward it to OConnectionPointHelperContainer!
+ m_pContainerImplementation->advise( m_aInterfaceType, xListener );
+ // Don't forget this!
+ impl_UnlockContainer();
+}
+
+//______________________________________________________________________________________________________________
+// XConnectionPoint
+//______________________________________________________________________________________________________________
+
+void SAL_CALL OConnectionPointHelper::unadvise( const Reference< XInterface >& xListener ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aSharedMutex );
+ // Operation is permitted only, if reference to container is valid!
+ if ( impl_LockContainer() == sal_False )
+ {
+ // Container not exist! Its an runtime error.
+ throw RuntimeException();
+
+ }
+ // Forward it to OConnectionPointHelperContainer!
+ m_pContainerImplementation->unadvise( m_aInterfaceType, xListener );
+ // Don't forget this!
+ impl_UnlockContainer();
+}
+
+//______________________________________________________________________________________________________________
+// XConnectionPoint
+//______________________________________________________________________________________________________________
+
+Sequence< Reference< XInterface > > SAL_CALL OConnectionPointHelper::getConnections() throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard( m_aSharedMutex );
+ // Operation is permitted only, if reference to container is valid!
+ if ( impl_LockContainer() == sal_False )
+ {
+ // Container not exist! Its an runtime error.
+ throw RuntimeException();
+ }
+ // Set default return value, if method failed.
+ Sequence< Reference< XInterface > > seqReturnConnections = Sequence< Reference< XInterface > >();
+ // Get reference to private member of OConnectionPointHelperContainer!
+ OMultiTypeInterfaceContainerHelper& aSharedContainer = m_pContainerImplementation->impl_getMultiTypeContainer();
+ // Get pointer to specialized container which hold all interfaces of searched type.
+ OInterfaceContainerHelper* pSpecialContainer = aSharedContainer.getContainer( m_aInterfaceType );
+ // Get elements of searched type, if somelse exist.
+ if ( pSpecialContainer != NULL )
+ {
+ seqReturnConnections = pSpecialContainer->getElements();
+ }
+ // Don't forget this!
+ impl_UnlockContainer();
+
+ return seqReturnConnections;
+}
+
+//______________________________________________________________________________________________________________
+// private method
+//______________________________________________________________________________________________________________
+
+sal_Bool OConnectionPointHelper::impl_LockContainer()
+{
+ // Convert weakreference to hard uno3-reference and return state.
+ // If this reference different from NULL, there exist a hard reference to container. Container-instance can't be destroyed.
+ // Don't forget to "unlock" this reference!
+ m_xLock = m_oContainerWeakReference.get();
+ return m_xLock.is();
+}
+
+//______________________________________________________________________________________________________________
+// private method
+//______________________________________________________________________________________________________________
+
+void OConnectionPointHelper::impl_UnlockContainer()
+{
+ // Free hard uno3-reference to container.
+ // see also "impl_LockContainer()"
+ m_xLock = Reference< XInterface >();
+}
+
+} // namespace unocontrols
diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx
new file mode 100644
index 000000000..3893e5032
--- /dev/null
+++ b/UnoControls/source/controls/framecontrol.cxx
@@ -0,0 +1,663 @@
+/*************************************************************************
+ *
+ * $RCSfile: framecontrol.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+//______________________________________________________________________________________________________________
+// my own include
+//______________________________________________________________________________________________________________
+
+#ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
+#include "framecontrol.hxx"
+#endif
+
+//______________________________________________________________________________________________________________
+// includes of other projects
+//______________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
+#include <com/sun/star/util/XURLTransformer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_
+#include <com/sun/star/frame/XDispatch.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+
+#ifndef _VOS_DIAGNOSE_H_
+#include <vos/diagnose.hxx>
+#endif
+
+//______________________________________________________________________________________________________________
+// include of my own project
+//______________________________________________________________________________________________________________
+
+//______________________________________________________________________________________________________________
+// namespaces
+//______________________________________________________________________________________________________________
+
+using namespace ::rtl ;
+using namespace ::osl ;
+using namespace ::cppu ;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::lang ;
+using namespace ::com::sun::star::beans ;
+using namespace ::com::sun::star::awt ;
+using namespace ::com::sun::star::frame ;
+using namespace ::com::sun::star::util ;
+
+namespace unocontrols{
+
+//______________________________________________________________________________________________________________
+// construct/destruct
+//______________________________________________________________________________________________________________
+
+FrameControl::FrameControl( const Reference< XMultiServiceFactory >& xFactory )
+ : BaseControl ( xFactory )
+ , OBroadcastHelper ( m_aMutex )
+ , OPropertySetHelper ( *SAL_STATIC_CAST( OBroadcastHelperVar< OMultiTypeInterfaceContainerHelper >*, this ) )
+ , m_aInterfaceContainer ( m_aMutex )
+ , m_aConnectionPointContainer ( m_aMutex )
+{
+}
+
+FrameControl::~FrameControl()
+{
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+Any SAL_CALL FrameControl::queryInterface( const Type& rType ) throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+ Any aReturn ;
+ Reference< XInterface > xDelegator = BaseControl::impl_getDelegator();
+ if ( xDelegator.is() == sal_True )
+ {
+ // If an delegator exist, forward question to his queryInterface.
+ // Delegator will ask his own queryAggregation!
+ aReturn = xDelegator->queryInterface( rType );
+ }
+ else
+ {
+ // If an delegator unknown, forward question to own queryAggregation.
+ aReturn = queryAggregation( rType );
+ }
+
+ return aReturn ;
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL FrameControl::acquire() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ BaseControl::acquire();
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL FrameControl::release() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ BaseControl::release();
+}
+
+//____________________________________________________________________________________________________________
+// XTypeProvider
+//____________________________________________________________________________________________________________
+
+Sequence< Type > SAL_CALL FrameControl::getTypes() throw( RuntimeException )
+{
+ // Optimize this method !
+ // We initialize a static variable only one time. And we don't must use a mutex at every call!
+ // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
+ static OTypeCollection* pTypeCollection = NULL ;
+
+ if ( pTypeCollection == NULL )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if ( pTypeCollection == NULL )
+ {
+ // Create a static typecollection ...
+ static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XControlModel >*)NULL ) ,
+ ::getCppuType(( const Reference< XControlContainer >*)NULL ) ,
+ ::getCppuType(( const Reference< XConnectionPointContainer >*)NULL ) ,
+ BaseControl::getTypes()
+ );
+ // ... and set his address to static pointer!
+ pTypeCollection = &aTypeCollection ;
+ }
+ }
+
+ return pTypeCollection->getTypes();
+}
+
+//____________________________________________________________________________________________________________
+// XAggregation
+//____________________________________________________________________________________________________________
+
+Any SAL_CALL FrameControl::queryAggregation( const Type& aType ) throw( RuntimeException )
+{
+ // Ask for my own supported interfaces ...
+ // Attention: XTypeProvider and XInterface are supported by OComponentHelper!
+ Any aReturn ( ::cppu::queryInterface( aType ,
+ static_cast< XControlModel* > ( this ) ,
+ static_cast< XConnectionPointContainer* > ( this )
+ )
+ );
+
+ // If searched interface not supported by this class ...
+ if ( aReturn.hasValue() == sal_False )
+ {
+ // ... ask baseclasses.
+ aReturn = OPropertySetHelper::queryInterface( aType );
+ if ( aReturn.hasValue() == sal_False )
+ {
+ aReturn = BaseControl::queryAggregation( aType );
+ }
+ }
+
+ return aReturn ;
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+void SAL_CALL FrameControl::createPeer( const Reference< XToolkit >& xToolkit ,
+ const Reference< XWindowPeer >& xParentPeer ) throw( RuntimeException )
+{
+ BaseControl::createPeer( xToolkit, xParentPeer );
+ if ( impl_getPeerWindow().is() )
+ {
+ if( m_sComponentURL.getLength() > 0 )
+ {
+ impl_createFrame( getPeer(), m_sComponentURL, m_seqLoaderArguments );
+ }
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+sal_Bool SAL_CALL FrameControl::setModel( const Reference< XControlModel >& xModel ) throw( RuntimeException )
+{
+ // We have no model.
+ return sal_False ;
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+Reference< XControlModel > SAL_CALL FrameControl::getModel() throw( RuntimeException )
+{
+ // We have no model.
+ return Reference< XControlModel >();
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+void SAL_CALL FrameControl::dispose() throw( RuntimeException )
+{
+ impl_deleteFrame();
+ BaseControl::dispose();
+}
+
+//____________________________________________________________________________________________________________
+// XView
+//____________________________________________________________________________________________________________
+
+sal_Bool SAL_CALL FrameControl::setGraphics( const Reference< XGraphics >& xDevice ) throw( RuntimeException )
+{
+ // it is not possible to print this control
+ return sal_False ;
+}
+
+//____________________________________________________________________________________________________________
+// XView
+//____________________________________________________________________________________________________________
+
+Reference< XGraphics > SAL_CALL FrameControl::getGraphics() throw( RuntimeException )
+{
+ // when its not posible to set graphics ! then its possible to return null
+ return Reference< XGraphics >();
+}
+
+//____________________________________________________________________________________________________________
+// XConnectionPointContainer
+//____________________________________________________________________________________________________________
+
+Sequence< Type > SAL_CALL FrameControl::getConnectionPointTypes() throw( RuntimeException )
+{
+ // Forwarded to helper class
+ return m_aConnectionPointContainer.getConnectionPointTypes();
+}
+
+//____________________________________________________________________________________________________________
+// XConnectionPointContainer
+//____________________________________________________________________________________________________________
+
+Reference< XConnectionPoint > SAL_CALL FrameControl::queryConnectionPoint( const Type& aType ) throw( RuntimeException )
+{
+ // Forwarded to helper class
+ return m_aConnectionPointContainer.queryConnectionPoint( aType );
+}
+
+//____________________________________________________________________________________________________________
+// XConnectionPointContainer
+//____________________________________________________________________________________________________________
+
+void SAL_CALL FrameControl::advise( const Type& aType ,
+ const Reference< XInterface >& xListener ) throw( RuntimeException )
+{
+ // Forwarded to helper class
+ m_aConnectionPointContainer.advise( aType, xListener );
+}
+
+//____________________________________________________________________________________________________________
+// XConnectionPointContainer
+//____________________________________________________________________________________________________________
+
+void SAL_CALL FrameControl::unadvise( const Type& aType ,
+ const Reference< XInterface >& xListener ) throw( RuntimeException )
+{
+ // Forwarded to helper class
+ m_aConnectionPointContainer.unadvise( aType, xListener );
+}
+
+//____________________________________________________________________________________________________________
+// impl but public method to register service
+//____________________________________________________________________________________________________________
+
+const Sequence< OUString > FrameControl::impl_getStaticSupportedServiceNames()
+{
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ Sequence< OUString > seqServiceNames( 1 );
+ seqServiceNames.getArray() [0] = OUString::createFromAscii( SERVICENAME_FRAMECONTROL );
+ return seqServiceNames ;
+}
+
+//____________________________________________________________________________________________________________
+// impl but public method to register service
+//____________________________________________________________________________________________________________
+
+const OUString FrameControl::impl_getStaticImplementationName()
+{
+ return OUString::createFromAscii( IMPLEMENTATIONNAME_FRAMECONTROL );
+}
+
+//____________________________________________________________________________________________________________
+// OPropertySetHelper
+//____________________________________________________________________________________________________________
+
+sal_Bool FrameControl::convertFastPropertyValue( Any& rConvertedValue ,
+ Any& rOldValue ,
+ sal_Int32 nHandle ,
+ const Any& rValue ) throw( IllegalArgumentException )
+{
+ sal_Bool bReturn = sal_False ;
+ switch (nHandle)
+ {
+ case PROPERTYHANDLE_COMPONENTURL : rConvertedValue = rValue ;
+ rOldValue <<= m_sComponentURL ;
+ bReturn = sal_True ;
+ break ;
+
+ case PROPERTYHANDLE_LOADERARGUMENTS : rConvertedValue = rValue ;
+ rOldValue <<= m_seqLoaderArguments ;
+ bReturn = sal_True ;
+ break ;
+ }
+
+ if ( bReturn == sal_False )
+ {
+ throw IllegalArgumentException();
+ }
+
+ return bReturn ;
+}
+
+//____________________________________________________________________________________________________________
+// OPropertySetHelper
+//____________________________________________________________________________________________________________
+
+void FrameControl::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
+ const Any& rValue )
+{
+ // this method only set the value
+ MutexGuard aGuard (m_aMutex) ;
+ switch (nHandle)
+ {
+ case PROPERTYHANDLE_COMPONENTURL : rValue >>= m_sComponentURL ;
+ if (getPeer().is())
+ {
+ impl_createFrame ( getPeer(), m_sComponentURL, m_seqLoaderArguments ) ;
+ }
+ break ;
+
+ case PROPERTYHANDLE_LOADERARGUMENTS : rValue >>= m_seqLoaderArguments ;
+ break ;
+
+ default : VOS_ENSHURE ( nHandle == -1, ERRORTEXT_VOSENSHURE ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// OPropertySetHelper
+//____________________________________________________________________________________________________________
+
+void FrameControl::getFastPropertyValue( Any& rRet ,
+ sal_Int32 nHandle ) const
+{
+ MutexGuard aGuard ( Mutex::getGlobalMutex() ) ;
+
+ switch (nHandle)
+ {
+ case PROPERTYHANDLE_COMPONENTURL : rRet <<= m_sComponentURL ;
+ break ;
+
+ case PROPERTYHANDLE_LOADERARGUMENTS : rRet <<= m_seqLoaderArguments ;
+ break ;
+
+ case PROPERTYHANDLE_FRAME : rRet <<= m_xFrame ;
+ break ;
+
+ default : VOS_ENSHURE ( nHandle == -1, ERRORTEXT_VOSENSHURE ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// OPropertySetHelper
+//____________________________________________________________________________________________________________
+
+IPropertyArrayHelper& FrameControl::getInfoHelper()
+{
+ // Create a table that map names to index values.
+ static OPropertyArrayHelper* pInfo ;
+
+ if (!pInfo)
+ {
+ // global method must be guarded
+ MutexGuard aGuard ( Mutex::getGlobalMutex() ) ;
+
+ if (!pInfo)
+ {
+ pInfo = new OPropertyArrayHelper( impl_getStaticPropertyDescriptor(), sal_True );
+ }
+ }
+
+ return *pInfo ;
+}
+/*
+//--------------------------------------------------------------------------------------------------
+// start OConnectionPointContainerHelper
+//--------------------------------------------------------------------------------------------------
+Uik* FrameControl::getConnectionPointUiks ( sal_Int32* pCount ) const
+{
+ static Uik szUiks[] =
+ {
+ ((XEventListener*)NULL)->getSmartUik (),
+ ::getCppuType((const Reference< XPropertyChangeListener >*)0),
+ ::getCppuType((const Reference< XVetoableChangeListener >*)0),
+ ::getCppuType((const Reference< XPropertiesChangeListener >*)0)
+ } ;
+
+ *pCount = 4 ;
+
+ return szUiks ;
+}
+//--------------------------------------------------------------------------------------------------
+// end OConnectionPointContainerHelper
+//--------------------------------------------------------------------------------------------------
+*/
+
+//____________________________________________________________________________________________________________
+// OPropertySetHelper
+//____________________________________________________________________________________________________________
+
+Reference< XPropertySetInfo > SAL_CALL FrameControl::getPropertySetInfo() throw( RuntimeException )
+{
+ // Optimize this method !
+ // We initialize a static variable only one time. And we don't must use a mutex at every call!
+ // For the first call; pInfo is NULL - for the second call pInfo is different from NULL!
+ static Reference< XPropertySetInfo >* pInfo = (Reference< XPropertySetInfo >*)0 ;
+ if ( pInfo == (Reference< XPropertySetInfo >*)0 )
+ {
+ // Ready for multithreading
+ MutexGuard aGuard ( Mutex::getGlobalMutex () ) ;
+ // Control this pointer again, another instance can be faster then these!
+ if ( pInfo == (Reference< XPropertySetInfo >*)0 )
+ {
+ // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
+ // (Use method "getInfoHelper()".)
+ static Reference< XPropertySetInfo > xInfo ( createPropertySetInfo ( getInfoHelper () ) ) ;
+ pInfo = &xInfo ;
+ }
+ }
+ return ( *pInfo ) ;
+}
+
+//____________________________________________________________________________________________________________
+// BaseControl
+//____________________________________________________________________________________________________________
+
+WindowDescriptor* FrameControl::impl_getWindowDescriptor( const Reference< XWindowPeer >& xParentPeer )
+{
+ WindowDescriptor* pDescriptor = new WindowDescriptor ;
+
+ pDescriptor->Type = WindowClass_CONTAINER ;
+ pDescriptor->ParentIndex = -1 ;
+ pDescriptor->Parent = xParentPeer ;
+ pDescriptor->Bounds = getPosSize () ;
+ pDescriptor->WindowAttributes = 0 ;
+
+ return pDescriptor ;
+}
+
+//____________________________________________________________________________________________________________
+// private method
+//____________________________________________________________________________________________________________
+
+void FrameControl::impl_createFrame( const Reference< XWindowPeer >& xPeer ,
+ const OUString& rURL ,
+ const Sequence< PropertyValue >& rArguments )
+{
+ Reference< XFrame > xOldFrame ;
+ Reference< XFrame > xNewFrame ;
+
+ {
+ MutexGuard aGuard ( m_aMutex ) ;
+ xOldFrame = m_xFrame ;
+ }
+
+ xNewFrame = Reference< XFrame > ( impl_getMultiServiceFactory()->createInstance ( OUString::createFromAscii( "com.sun.star.frame.Frame" ) ), UNO_QUERY ) ;
+ Reference< XDispatchProvider > xDSP ( xNewFrame, UNO_QUERY ) ;
+
+ if (xDSP.is())
+ {
+ Reference< XWindow > xWP ( xPeer, UNO_QUERY ) ;
+ xNewFrame->initialize ( xWP ) ;
+
+ // option
+ //xFrame->setName( "WhatYouWant" );
+
+ Reference< XURLTransformer > xTrans ( impl_getMultiServiceFactory()->createInstance ( OUString::createFromAscii( "com.sun.star.util.URLTransformer" ) ), UNO_QUERY ) ;
+ if(xTrans.is())
+ {
+ // load file
+ URL aURL ;
+
+ aURL.Complete = rURL ;
+ xTrans->parseStrict( aURL ) ;
+
+ Reference< XDispatch > xDisp = xDSP->queryDispatch ( aURL, OUString (), FrameSearchFlag::SELF ) ;
+ if (xDisp.is())
+ {
+ xDisp->dispatch ( aURL, rArguments ) ;
+ }
+ }
+ }
+
+ // set the frame
+ {
+ MutexGuard aGuard ( m_aMutex ) ;
+ m_xFrame = xNewFrame ;
+ }
+
+ // notify the listeners
+ sal_Int32 nFrameId = PROPERTYHANDLE_FRAME ;
+ Any aNewFrame ( &xNewFrame, ::getCppuType((const Reference< XFrame >*)0) ) ;
+ Any aOldFrame ( &xOldFrame, ::getCppuType((const Reference< XFrame >*)0) ) ;
+
+ fire ( &nFrameId, &aNewFrame, &aOldFrame, 1, sal_False ) ;
+
+ if (xOldFrame.is())
+ {
+ xOldFrame->dispose () ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// private method
+//____________________________________________________________________________________________________________
+
+void FrameControl::impl_deleteFrame()
+{
+ Reference< XFrame > xOldFrame;
+ Reference< XFrame > xNullFrame;
+
+ {
+ // do not dispose the frame in this guarded section (deadlock?)
+ MutexGuard aGuard( m_aMutex );
+ xOldFrame = m_xFrame;
+ m_xFrame = Reference< XFrame > ();
+ }
+
+ // notify the listeners
+ sal_Int32 nFrameId = PROPERTYHANDLE_FRAME;
+ Any aNewFrame( &xNullFrame, ::getCppuType((const Reference< XFrame >*)0) );
+ Any aOldFrame( &xOldFrame, ::getCppuType((const Reference< XFrame >*)0) );
+ fire( &nFrameId, &aNewFrame, &aOldFrame, 1, sal_False );
+
+ // dispose the frame
+ if( xOldFrame.is() )
+ xOldFrame->dispose();
+}
+
+//____________________________________________________________________________________________________________
+// private method
+//____________________________________________________________________________________________________________
+
+const Sequence< Property > FrameControl::impl_getStaticPropertyDescriptor()
+{
+ // All Properties of this implementation. The array must be sorted!
+ static const Property pPropertys[PROPERTY_COUNT] =
+ {
+ Property( OUString::createFromAscii( PROPERTYNAME_COMPONENTURL ), PROPERTYHANDLE_COMPONENTURL , ::getCppuType((const OUString*)0) , PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED ),
+ Property( OUString::createFromAscii( PROPERTYNAME_FRAME ), PROPERTYHANDLE_FRAME , ::getCppuType((const Reference< XFrame >*)0) , PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT ),
+ Property( OUString::createFromAscii( PROPERTYNAME_LOADERARGUMENTS ), PROPERTYHANDLE_LOADERARGUMENTS , ::getCppuType((const Sequence< PropertyValue >*)0), PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED )
+ };
+
+ static const Sequence< Property > seqPropertys( pPropertys, PROPERTY_COUNT );
+
+ return seqPropertys ;
+}
+
+} // namespace unocontrols
diff --git a/UnoControls/source/controls/makefile.mk b/UnoControls/source/controls/makefile.mk
new file mode 100644
index 000000000..2de3bb05b
--- /dev/null
+++ b/UnoControls/source/controls/makefile.mk
@@ -0,0 +1,80 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=UnoControls
+TARGET=controls
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+SLOFILES=\
+ $(SLO)$/progressbar.obj \
+ $(SLO)$/framecontrol.obj \
+ $(SLO)$/progressmonitor.obj \
+ $(SLO)$/OConnectionPointHelper.obj \
+ $(SLO)$/OConnectionPointContainerHelper.obj
+
+# --- Targets ------------------------------------------------------
+.INCLUDE : target.mk
diff --git a/UnoControls/source/controls/progressbar.cxx b/UnoControls/source/controls/progressbar.cxx
new file mode 100644
index 000000000..3ce666dc1
--- /dev/null
+++ b/UnoControls/source/controls/progressbar.cxx
@@ -0,0 +1,600 @@
+/*************************************************************************
+ *
+ * $RCSfile: progressbar.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//____________________________________________________________________________________________________________
+// my own includes
+//____________________________________________________________________________________________________________
+
+#ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
+#include "progressbar.hxx"
+#endif
+
+//____________________________________________________________________________________________________________
+// includes of other projects
+//____________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_AWT_GRADIENTSTYLE_HPP_
+#include <com/sun/star/awt/GradientStyle.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_RASTEROPERATION_HPP_
+#include <com/sun/star/awt/RasterOperation.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_GRADIENT_HPP_
+#include <com/sun/star/awt/Gradient.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XGRAPHICS_HPP_
+#include <com/sun/star/awt/XGraphics.hpp>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+
+#include <math.h>
+
+//____________________________________________________________________________________________________________
+// includes of my project
+//____________________________________________________________________________________________________________
+
+//____________________________________________________________________________________________________________
+// namespace
+//____________________________________________________________________________________________________________
+
+using namespace ::cppu ;
+using namespace ::osl ;
+using namespace ::rtl ;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::lang ;
+using namespace ::com::sun::star::awt ;
+
+namespace unocontrols{
+
+//____________________________________________________________________________________________________________
+// construct/destruct
+//____________________________________________________________________________________________________________
+
+ProgressBar::ProgressBar( const Reference< XMultiServiceFactory >& xFactory )
+ : BaseControl ( xFactory )
+ , m_bHorizontal ( DEFAULT_HORIZONTAL )
+ , m_aBlockSize ( DEFAULT_BLOCKDIMENSION )
+ , m_nBackgroundColor ( DEFAULT_BACKGROUNDCOLOR )
+ , m_nForegroundColor ( DEFAULT_FOREGROUNDCOLOR )
+ , m_nMinRange ( DEFAULT_MINRANGE )
+ , m_nMaxRange ( DEFAULT_MAXRANGE )
+ , m_nBlockValue ( DEFAULT_BLOCKVALUE )
+ , m_nValue ( DEFAULT_VALUE )
+{
+}
+
+ProgressBar::~ProgressBar()
+{
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+Any SAL_CALL ProgressBar::queryInterface( const Type& rType ) throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+ Any aReturn ;
+ Reference< XInterface > xDelegator = BaseControl::impl_getDelegator();
+ if ( xDelegator.is() == sal_True )
+ {
+ // If an delegator exist, forward question to his queryInterface.
+ // Delegator will ask his own queryAggregation!
+ aReturn = xDelegator->queryInterface( rType );
+ }
+ else
+ {
+ // If an delegator unknown, forward question to own queryAggregation.
+ aReturn = queryAggregation( rType );
+ }
+
+ return aReturn ;
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressBar::acquire() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ BaseControl::acquire();
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressBar::release() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ BaseControl::release();
+}
+
+//____________________________________________________________________________________________________________
+// XTypeProvider
+//____________________________________________________________________________________________________________
+
+Sequence< Type > SAL_CALL ProgressBar::getTypes() throw( RuntimeException )
+{
+ // Optimize this method !
+ // We initialize a static variable only one time. And we don't must use a mutex at every call!
+ // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
+ static OTypeCollection* pTypeCollection = NULL ;
+
+ if ( pTypeCollection == NULL )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if ( pTypeCollection == NULL )
+ {
+ // Create a static typecollection ...
+ static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XControlModel >*)NULL ) ,
+ ::getCppuType(( const Reference< XProgressBar >*)NULL ) ,
+ BaseControl::getTypes()
+ );
+ // ... and set his address to static pointer!
+ pTypeCollection = &aTypeCollection ;
+ }
+ }
+
+ return pTypeCollection->getTypes();
+}
+
+//____________________________________________________________________________________________________________
+// XAggregation
+//____________________________________________________________________________________________________________
+
+Any SAL_CALL ProgressBar::queryAggregation( const Type& aType ) throw( RuntimeException )
+{
+ // Ask for my own supported interfaces ...
+ // Attention: XTypeProvider and XInterface are supported by OComponentHelper!
+ Any aReturn ( ::cppu::queryInterface( aType ,
+ static_cast< XControlModel* > ( this ) ,
+ static_cast< XProgressBar* > ( this )
+ )
+ );
+
+ // If searched interface not supported by this class ...
+ if ( aReturn.hasValue() == sal_False )
+ {
+ // ... ask baseclasses.
+ aReturn = BaseControl::queryAggregation( aType );
+ }
+
+ return aReturn ;
+}
+
+//____________________________________________________________________________________________________________
+// XProgressBar
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressBar::setForegroundColor( sal_Int32 nColor ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard (m_aMutex) ;
+
+ // Safe color for later use.
+ m_nForegroundColor = nColor ;
+
+ // Repaint control
+ impl_paint ( 0, 0, impl_getGraphicsPeer() ) ;
+}
+
+//____________________________________________________________________________________________________________
+// XProgressBar
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressBar::setBackgroundColor ( sal_Int32 nColor ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard (m_aMutex) ;
+
+ // Safe color for later use.
+ m_nBackgroundColor = nColor ;
+
+ // Repaint control
+ impl_paint ( 0, 0, impl_getGraphicsPeer() ) ;
+}
+
+//____________________________________________________________________________________________________________
+// XProgressBar
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressBar::setValue ( sal_Int32 nValue ) throw( RuntimeException )
+{
+ // This method is defined for follow things:
+ // 1) Values >= _nMinRange
+ // 2) Values <= _nMaxRange
+
+ // Ready for multithreading
+ MutexGuard aGuard (m_aMutex) ;
+
+ // save impossible cases
+ // This method is only defined for valid values
+ DBG_ASSERT ( (( nValue >= m_nMinRange ) && ( nValue <= m_nMaxRange )), "ProgressBar::setValue()\nNot valid value.\n" ) ;
+
+ // If new value not valid ... do nothing in release version!
+ if (
+ ( nValue >= m_nMinRange ) &&
+ ( nValue <= m_nMaxRange )
+ )
+ {
+ // New value is ok => save this
+ m_nValue = nValue ;
+
+ // Repaint to display changes
+ impl_paint ( 0, 0, impl_getGraphicsPeer() ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XProgressBar
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressBar::setRange ( sal_Int32 nMin, sal_Int32 nMax ) throw( RuntimeException )
+{
+ // This method is defined for follow things:
+ // 1) All values of sal_Int32
+ // 2) Min < Max
+ // 3) Min > Max
+
+ // save impossible cases
+ // This method is only defined for valid values
+ // If you ignore this, the release version wil produce an error "division by zero" in "ProgressBar::setValue()"!
+ DBG_ASSERT ( ( nMin != nMax ) , "ProgressBar::setRange()\nValues for MIN and MAX are the same. This is not allowed!\n" ) ;
+
+ // Ready for multithreading
+ MutexGuard aGuard (m_aMutex) ;
+
+ // control the values for min and max
+ if ( nMin < nMax )
+ {
+ // Take correct Min and Max
+ m_nMinRange = nMin ;
+ m_nMaxRange = nMax ;
+ }
+ else
+ {
+ // Change Min and Max automaticly
+ m_nMinRange = nMax ;
+ m_nMaxRange = nMin ;
+ }
+
+ impl_recalcRange () ;
+
+ // Do not repaint the control at this place!!!
+ // An old "m_nValue" is set and can not be correct for this new range.
+ // Next call of "ProgressBar::setValue()" do this.
+}
+
+//____________________________________________________________________________________________________________
+// XProgressBar
+//____________________________________________________________________________________________________________
+
+sal_Int32 SAL_CALL ProgressBar::getValue () throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard (m_aMutex) ;
+
+ return ( m_nValue ) ;
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressBar::setPosSize ( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags ) throw( RuntimeException )
+{
+ // Take old size BEFORE you set the new values at baseclass!
+ // You will control changes. At the other way, the values are the same!
+ Rectangle aBasePosSize = getPosSize () ;
+ BaseControl::setPosSize (nX, nY, nWidth, nHeight, nFlags) ;
+
+ // Do only, if size has changed.
+ if (
+ ( nWidth != aBasePosSize.Width ) ||
+ ( nHeight != aBasePosSize.Height )
+ )
+ {
+ impl_recalcRange ( ) ;
+ impl_paint ( 0, 0, impl_getGraphicsPeer () ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+sal_Bool SAL_CALL ProgressBar::setModel( const Reference< XControlModel >& xModel ) throw( RuntimeException )
+{
+ // A model is not possible for this control.
+ return sal_False ;
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+Reference< XControlModel > SAL_CALL ProgressBar::getModel() throw( RuntimeException )
+{
+ // A model is not possible for this control.
+ return Reference< XControlModel >();
+}
+
+//____________________________________________________________________________________________________________
+// impl but public method to register service
+//____________________________________________________________________________________________________________
+
+const Sequence< OUString > ProgressBar::impl_getStaticSupportedServiceNames()
+{
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ Sequence< OUString > seqServiceNames( 1 );
+ seqServiceNames.getArray() [0] = OUString::createFromAscii( SERVICENAME_PROGRESSBAR );
+ return seqServiceNames ;
+}
+
+//____________________________________________________________________________________________________________
+// impl but public method to register service
+//____________________________________________________________________________________________________________
+
+const OUString ProgressBar::impl_getStaticImplementationName()
+{
+ return OUString::createFromAscii( IMPLEMENTATIONNAME_PROGRESSBAR );
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+void ProgressBar::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGraphics > & rGraphics )
+{
+ // save impossible cases
+ DBG_ASSERT ( rGraphics.is(), "ProgressBar::paint()\nCalled with invalid Reference< XGraphics > ." ) ;
+
+ // This paint method ist not buffered !!
+ // Every request paint the completely control. ( but only, if peer exist )
+ if ( rGraphics.is () )
+ {
+ MutexGuard aGuard (m_aMutex) ;
+
+ // Clear background
+ // (same color for line and fill)
+ rGraphics->setFillColor ( m_nBackgroundColor ) ;
+ rGraphics->setLineColor ( m_nBackgroundColor ) ;
+ rGraphics->drawRect ( nX, nY, impl_getWidth(), impl_getHeight() ) ;
+
+ sal_Int32 nBlockStart = 0 ; // = left site of new block
+ sal_Int32 nBlockCount = 0 ; // = number of next block
+
+ // same color for line and fill for blocks
+ rGraphics->setFillColor ( m_nForegroundColor ) ;
+ rGraphics->setLineColor ( m_nForegroundColor ) ;
+
+ sal_Int32 nDifference = labs ( m_nValue - m_nMinRange ) ;
+
+ if ( m_nBlockValue == 0 )
+ {
+ // Prevent "division by zero"
+ m_nBlockValue = 1 ;
+ }
+ // number of blocks for current value
+ nBlockCount = nDifference / m_nBlockValue ;
+
+ // Round to next valid block number
+ if ( fmod ( (float)nDifference, (float)m_nBlockValue ) != 0 )
+ {
+ ++nBlockCount ;
+ }
+
+ // Draw horizontal progressbar
+ // decision in "recalcRange()"
+ if (m_bHorizontal)
+ {
+ // Step to left side of window
+ nBlockStart = nX ;
+
+ for ( sal_Int16 i=1; i<=nBlockCount; ++i )
+ {
+ // step free field
+ nBlockStart += FREESPACE ;
+ // paint block
+ rGraphics->drawRect (nBlockStart, nY+FREESPACE, m_aBlockSize.Width, m_aBlockSize.Height) ;
+ // step next free field
+ nBlockStart += m_aBlockSize.Width ;
+ }
+ }
+ // draw vertikal progressbar
+ // decision in "recalcRange()"
+ else
+ {
+ // step to bottom side of window
+ nBlockStart = nY+impl_getHeight() ;
+ nBlockStart -= m_aBlockSize.Height ;
+
+ for ( sal_Int16 i=1; i<=nBlockCount; ++i )
+ {
+ // step free field
+ nBlockStart -= FREESPACE ;
+ // paint block
+ rGraphics->drawRect (nX+FREESPACE, nBlockStart, m_aBlockSize.Width, m_aBlockSize.Height) ;
+ // step next free field
+ nBlockStart -= m_aBlockSize.Height;
+ }
+ }
+
+ // Paint shadow border around the progressbar
+ rGraphics->setLineColor ( LINECOLOR_SHADOW ) ;
+ rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ) ;
+ rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ) ;
+
+ rGraphics->setLineColor ( LINECOLOR_BRIGHT ) ;
+ rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ) ;
+ rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+void ProgressBar::impl_recalcRange ()
+{
+ MutexGuard aGuard (m_aMutex) ;
+
+ // Calculate size of block in progressbar
+ // and switch the orientation of the control
+ sal_Int32 nMaxBlock = 0 ;
+ sal_Int32 nWidth = impl_getWidth () ; // it's better for debug !
+ sal_Int32 nHeight = impl_getHeight () ; // it's better for debug !
+
+ // Default = horizontal progressbar ...
+ m_bHorizontal = sal_True ;
+
+ // ... but, if programmer say "NO IT's VERTICAL ..."
+ if ( nWidth > nHeight )
+ {
+ // Don't forget to save this state! Used in "ProgressBar::paint()"
+ m_bHorizontal = sal_True ;
+
+ // Calculate count of blocks for actual size
+ // (prevent error "division by zero")
+ if ( nHeight == 0 )
+ {
+ nHeight = 1 ;
+ }
+
+ nMaxBlock = nWidth / nHeight ;
+ nMaxBlock *= 2 ;
+
+ // prevent error "division by zero"
+ if ( nMaxBlock == 0 )
+ {
+ nMaxBlock = 1 ;
+ }
+
+ // Calculate new value and new size for ONE block.
+
+ // Do not a calculation like this: "m_nBlockValue=(m_nMaxRange-m_nMinRange)/nMaxBlock" !
+ // If difference between m_nMaxRange and m_nMinRange to large, it give an overflow and a
+ // following error "division by zero" in method "paint() ... nBlockCount=nDifference/m_nBlockValue ..."
+
+ // Overflow ? => example: _I32_MAX - _I32_MIN = -1 and not _UI32_MAX !!!
+
+ m_nBlockValue = ( m_nMaxRange / nMaxBlock ) - ( m_nMinRange / nMaxBlock ) ;
+ m_aBlockSize.Height = ( nHeight - ( FREESPACE * 2 ) ) ;
+ m_aBlockSize.Width = ( ( nWidth / nMaxBlock ) - FREESPACE ) ;
+ }
+ else
+ {
+ // Don't forget to save this state! Used in "ProgressBar::paint()"
+ m_bHorizontal = sal_False ;
+
+ // Calculate count of blocks for actual size
+ // (prevent error "division by zero")
+ if ( nWidth == 0 )
+ {
+ nWidth = 1 ;
+ }
+
+ nMaxBlock = nHeight / nWidth ;
+ nMaxBlock *= 2 ;
+
+ // prevent error "division by zero"
+ if ( nMaxBlock == 0 )
+ {
+ nMaxBlock = 1 ;
+ }
+
+ // Calculate new value and new size for ONE block.
+
+ // Do not a calculation like this: "m_nBlockValue=(m_nMaxRange-m_nMinRange)/nMaxBlock" !
+ // If difference between m_nMaxRange and m_nMinRange to large, it give an overflow and a
+ // following error "division by zero" in method "paint() ... nBlockCount=nDifference/m_nBlockValue ..."
+
+ // Overflow ? => example: _I32_MAX - _I32_MIN = -1 and not _UI32_MAX !!!
+
+ m_nBlockValue = ( m_nMaxRange / nMaxBlock ) - ( m_nMinRange / nMaxBlock ) ;
+ m_aBlockSize.Height = ( ( nHeight / nMaxBlock ) - FREESPACE ) ;
+ m_aBlockSize.Width = ( nWidth - ( FREESPACE * 2 ) ) ;
+ }
+}
+
+} // namespace unocontrols
diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx
new file mode 100644
index 000000000..28a37b2c2
--- /dev/null
+++ b/UnoControls/source/controls/progressmonitor.cxx
@@ -0,0 +1,1129 @@
+/*************************************************************************
+ *
+ * $RCSfile: progressmonitor.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:18 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//____________________________________________________________________________________________________________
+// my own includes
+//____________________________________________________________________________________________________________
+
+#ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
+#include "progressmonitor.hxx"
+#endif
+
+//____________________________________________________________________________________________________________
+// includes of other projects
+//____________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_AWT_GRADIENTSTYLE_HPP_
+#include <com/sun/star/awt/GradientStyle.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_RASTEROPERATION_HPP_
+#include <com/sun/star/awt/RasterOperation.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_GRADIENT_HPP_
+#include <com/sun/star/awt/Gradient.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XGRAPHICS_HPP_
+#include <com/sun/star/awt/XGraphics.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
+#include <com/sun/star/awt/PosSize.hpp>
+#endif
+
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+
+//____________________________________________________________________________________________________________
+// includes of my project
+//____________________________________________________________________________________________________________
+
+#ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
+#include "progressbar.hxx"
+#endif
+
+//____________________________________________________________________________________________________________
+// namespace
+//____________________________________________________________________________________________________________
+
+using namespace ::cppu ;
+using namespace ::osl ;
+using namespace ::rtl ;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::lang ;
+using namespace ::com::sun::star::awt ;
+
+namespace unocontrols{
+
+//____________________________________________________________________________________________________________
+// construct/destruct
+//____________________________________________________________________________________________________________
+
+ProgressMonitor::ProgressMonitor( const Reference< XMultiServiceFactory >& xFactory )
+ : BaseContainerControl ( xFactory )
+{
+ // Its not allowed to work with member in this method (refcounter !!!)
+ // But with a HACK (++refcount) its "OK" :-(
+ ++m_refCount ;
+
+ // Create instances for fixedtext, button and progress ...
+ m_xTopic_Top = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ;
+ m_xText_Top = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ;
+ m_xTopic_Bottom = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ;
+ m_xText_Bottom = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ;
+ m_xButton = Reference< XButton > ( xFactory->createInstance ( OUString::createFromAscii( BUTTON_SERVICENAME ) ), UNO_QUERY ) ;
+ m_xProgressBar = Reference< XProgressBar > ( xFactory->createInstance ( OUString::createFromAscii( SERVICENAME_PROGRESSBAR ) ), UNO_QUERY ) ;
+
+ // ... cast controls to Reference< XControl > (for "setModel"!) ...
+ Reference< XControl > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ;
+ Reference< XControl > xRef_Text_Top ( m_xText_Top , UNO_QUERY ) ;
+ Reference< XControl > xRef_Topic_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ;
+ Reference< XControl > xRef_Text_Bottom ( m_xText_Bottom , UNO_QUERY ) ;
+ Reference< XControl > xRef_Button ( m_xButton , UNO_QUERY ) ;
+ Reference< XControl > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ;
+
+ // ... set models ...
+ xRef_Topic_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ;
+ xRef_Text_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ;
+ xRef_Topic_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ;
+ xRef_Text_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ;
+ xRef_Button->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( BUTTON_MODELNAME ) ), UNO_QUERY ) ) ;
+ // ProgressBar has no model !!!
+
+ // ... and add controls to basecontainercontrol!
+ addControl ( OUString::createFromAscii( CONTROLNAME_TEXT ) , xRef_Topic_Top ) ;
+ addControl ( OUString::createFromAscii( CONTROLNAME_TEXT ) , xRef_Text_Top ) ;
+ addControl ( OUString::createFromAscii( CONTROLNAME_TEXT ) , xRef_Topic_Bottom ) ;
+ addControl ( OUString::createFromAscii( CONTROLNAME_TEXT ) , xRef_Text_Bottom ) ;
+ addControl ( OUString::createFromAscii( CONTROLNAME_BUTTON ) , xRef_Button ) ;
+ addControl ( OUString::createFromAscii( CONTROLNAME_PROGRESSBAR ) , xRef_ProgressBar ) ;
+
+ // FixedText make it automaticly visible by himself ... but not the progressbar !!!
+ // it must be set explicitly
+ Reference< XWindow > xWindowRef_ProgressBar( m_xProgressBar, UNO_QUERY );
+ xWindowRef_ProgressBar->setVisible( sal_True );
+
+ // Reset to defaults !!!
+ // (progressbar take automaticly its own defaults)
+ m_xButton->setLabel ( OUString::createFromAscii( DEFAULT_BUTTONLABEL ) ) ;
+ m_xTopic_Top->setText ( OUString::createFromAscii( DEFAULT_TOPIC ) ) ;
+ m_xText_Top->setText ( OUString::createFromAscii( DEFAULT_TEXT ) ) ;
+ m_xTopic_Bottom->setText ( OUString::createFromAscii( DEFAULT_TOPIC ) ) ;
+ m_xText_Bottom->setText ( OUString::createFromAscii( DEFAULT_TEXT ) ) ;
+
+ --m_refCount ;
+
+ // Initialize info lists for fixedtext's
+ m_pTextlist_Top = new IMPL_Textlist ;
+ m_pTextlist_Bottom = new IMPL_Textlist ;
+}
+
+ProgressMonitor::~ProgressMonitor()
+{
+ impl_cleanMemory () ;
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+Any SAL_CALL ProgressMonitor::queryInterface( const Type& rType ) throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+ Any aReturn ;
+ Reference< XInterface > xDelegator = BaseContainerControl::impl_getDelegator();
+ if ( xDelegator.is() == sal_True )
+ {
+ // If an delegator exist, forward question to his queryInterface.
+ // Delegator will ask his own queryAggregation!
+ aReturn = xDelegator->queryInterface( rType );
+ }
+ else
+ {
+ // If an delegator unknown, forward question to own queryAggregation.
+ aReturn = queryAggregation( rType );
+ }
+
+ return aReturn ;
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::acquire() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ BaseControl::acquire();
+}
+
+//____________________________________________________________________________________________________________
+// XInterface
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::release() throw( RuntimeException )
+{
+ // Attention:
+ // Don't use mutex or guard in this method!!! Is a method of XInterface.
+
+ // Forward to baseclass
+ BaseControl::release();
+}
+
+//____________________________________________________________________________________________________________
+// XTypeProvider
+//____________________________________________________________________________________________________________
+
+Sequence< Type > SAL_CALL ProgressMonitor::getTypes() throw( RuntimeException )
+{
+ // Optimize this method !
+ // We initialize a static variable only one time. And we don't must use a mutex at every call!
+ // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
+ static OTypeCollection* pTypeCollection = NULL ;
+
+ if ( pTypeCollection == NULL )
+ {
+ // Ready for multithreading; get global mutex for first call of this method only! see before
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+
+ // Control these pointer again ... it can be, that another instance will be faster then these!
+ if ( pTypeCollection == NULL )
+ {
+ // Create a static typecollection ...
+ static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XLayoutConstrains >*)NULL ) ,
+ ::getCppuType(( const Reference< XButton >*)NULL ) ,
+ ::getCppuType(( const Reference< XProgressMonitor >*)NULL ) ,
+ BaseContainerControl::getTypes()
+ );
+ // ... and set his address to static pointer!
+ pTypeCollection = &aTypeCollection ;
+ }
+ }
+
+ return pTypeCollection->getTypes();
+}
+
+//____________________________________________________________________________________________________________
+// XAggregation
+//____________________________________________________________________________________________________________
+
+Any SAL_CALL ProgressMonitor::queryAggregation( const Type& aType ) throw( RuntimeException )
+{
+ // Ask for my own supported interfaces ...
+ // Attention: XTypeProvider and XInterface are supported by OComponentHelper!
+ Any aReturn ( ::cppu::queryInterface( aType ,
+ static_cast< XLayoutConstrains* > ( this ) ,
+ static_cast< XButton* > ( this ) ,
+ static_cast< XProgressMonitor* > ( this )
+ )
+ );
+
+ // If searched interface not supported by this class ...
+ if ( aReturn.hasValue() == sal_False )
+ {
+ // ... ask baseclasses.
+ aReturn = BaseControl::queryAggregation( aType );
+ }
+
+ return aReturn ;
+}
+
+//____________________________________________________________________________________________________________
+// XProgressMonitor
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::addText( const OUString& rTopic, const OUString& rText, sal_Bool bbeforeProgress ) throw( RuntimeException )
+{
+ // Safe impossible cases
+ // Check valid call of this method.
+ DBG_ASSERT ( impl_debug_checkParameter ( rTopic, rText, bbeforeProgress ) , "ProgressMonitor::addText()\nCall without valid parameters!\n") ;
+ DBG_ASSERT ( !(impl_searchTopic ( rTopic, bbeforeProgress ) != NULL ) , "ProgresMonitor::addText()\nThe text already exist.\n" ) ;
+
+ // Do nothing (in Release), if topic already exist.
+ if ( impl_searchTopic ( rTopic, bbeforeProgress ) != NULL )
+ {
+ return ;
+ }
+
+ // Else ... take memory for new item ...
+ IMPL_TextlistItem* pTextItem = new IMPL_TextlistItem ;
+
+ if ( pTextItem != NULL )
+ {
+ // Set values ...
+ pTextItem->sTopic = rTopic ;
+ pTextItem->sText = rText ;
+
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ // ... and insert it in right list.
+ if ( bbeforeProgress == sal_True )
+ {
+ m_pTextlist_Top->Insert ( pTextItem, LIST_APPEND ) ;
+ }
+ else
+ {
+ m_pTextlist_Bottom->Insert ( pTextItem, LIST_APPEND ) ;
+ }
+ }
+
+ // ... update window
+ impl_rebuildFixedText () ;
+ impl_recalcLayout () ;
+}
+
+//____________________________________________________________________________________________________________
+// XProgressMonitor
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::removeText ( const OUString& rTopic, sal_Bool bbeforeProgress ) throw( RuntimeException )
+{
+ // Safe impossible cases
+ // Check valid call of this method.
+ DBG_ASSERT ( impl_debug_checkParameter ( rTopic, bbeforeProgress ), "ProgressMonitor::removeText()\nCall without valid parameters!\n" ) ;
+
+ // Search the topic ...
+ IMPL_TextlistItem* pSearchItem = impl_searchTopic ( rTopic, bbeforeProgress ) ;
+
+ if ( pSearchItem != NULL )
+ {
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ // ... delete item from right list ...
+ if ( bbeforeProgress == sal_True )
+ {
+ m_pTextlist_Top->Remove ( pSearchItem ) ;
+ }
+ else
+ {
+ m_pTextlist_Bottom->Remove ( pSearchItem ) ;
+ }
+
+ delete pSearchItem ;
+
+ // ... and update window.
+ impl_rebuildFixedText () ;
+ impl_recalcLayout () ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XProgressMonitor
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::updateText ( const OUString& rTopic, const OUString& rText, sal_Bool bbeforeProgress ) throw( RuntimeException )
+{
+ // Safe impossible cases
+ // Check valid call of this method.
+ DBG_ASSERT ( impl_debug_checkParameter ( rTopic, rText, bbeforeProgress ), "ProgressMonitor::updateText()\nCall without valid parameters!\n" ) ;
+
+ // Search topic ...
+ IMPL_TextlistItem* pSearchItem = impl_searchTopic ( rTopic, bbeforeProgress ) ;
+
+ if ( pSearchItem != NULL )
+ {
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ // ... update text ...
+ pSearchItem->sText = rText ;
+
+ // ... and update window.
+ impl_rebuildFixedText () ;
+ impl_recalcLayout () ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XProgressBar
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::setForegroundColor ( sal_Int32 nColor ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ if ( m_xProgressBar.is () )
+ {
+ m_xProgressBar->setForegroundColor ( nColor ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XProgressBar
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::setBackgroundColor ( sal_Int32 nColor ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ if ( m_xProgressBar.is () )
+ {
+ m_xProgressBar->setBackgroundColor ( nColor ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XProgressBar
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::setValue ( sal_Int32 nValue ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ if ( m_xProgressBar.is () )
+ {
+ m_xProgressBar->setValue ( nValue ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XProgressBar
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::setRange ( sal_Int32 nMin, sal_Int32 nMax ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ if ( m_xProgressBar.is () )
+ {
+ m_xProgressBar->setRange ( nMin, nMax ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XProgressBar
+//____________________________________________________________________________________________________________
+
+sal_Int32 SAL_CALL ProgressMonitor::getValue () throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ if (m_xProgressBar.is())
+ {
+ return m_xProgressBar->getValue () ;
+ }
+
+ return 0 ;
+}
+
+//____________________________________________________________________________________________________________
+// XButton
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::addActionListener ( const Reference< XActionListener > & rListener ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ if ( m_xButton.is () )
+ {
+ m_xButton->addActionListener ( rListener ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XButton
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::removeActionListener ( const Reference< XActionListener > & rListener ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ if ( m_xButton.is () )
+ {
+ m_xButton->removeActionListener ( rListener ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XButton
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::setLabel ( const OUString& rLabel ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ if ( m_xButton.is () )
+ {
+ m_xButton->setLabel ( rLabel ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XButton
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::setActionCommand ( const OUString& rCommand ) throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ if ( m_xButton.is () )
+ {
+ m_xButton->setActionCommand ( rCommand ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XLayoutConstrains
+//____________________________________________________________________________________________________________
+
+Size SAL_CALL ProgressMonitor::getMinimumSize () throw( RuntimeException )
+{
+ return Size (DEFAULT_WIDTH, DEFAULT_HEIGHT) ;
+}
+
+//____________________________________________________________________________________________________________
+// XLayoutConstrains
+//____________________________________________________________________________________________________________
+
+Size SAL_CALL ProgressMonitor::getPreferredSize () throw( RuntimeException )
+{
+ // Ready for multithreading
+ ClearableMutexGuard aGuard ( m_aMutex ) ;
+
+ // get information about required place of child controls
+ Reference< XLayoutConstrains > xTopicLayout_Top ( m_xTopic_Top , UNO_QUERY ) ;
+ Reference< XLayoutConstrains > xTopicLayout_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ;
+ Reference< XLayoutConstrains > xButtonLayout ( m_xButton , UNO_QUERY ) ;
+ Reference< XWindow > xProgressBarWindow ( m_xProgressBar , UNO_QUERY ) ;
+
+ Size aTopicSize_Top = xTopicLayout_Top->getPreferredSize ();
+ Size aTopicSize_Bottom = xTopicLayout_Bottom->getPreferredSize ();
+ Size aButtonSize = xButtonLayout->getPreferredSize ();
+ Rectangle aTempRectangle = xProgressBarWindow->getPosSize ();
+ Size aProgressBarSize = Size( aTempRectangle.Width, aTempRectangle.Height );
+
+ aGuard.clear () ;
+
+ // calc preferred size of progressmonitor
+ sal_Int32 nWidth = 0 ;
+ sal_Int32 nHeight = 0 ;
+
+ nWidth = 3 * FREEBORDER ;
+ nWidth += aProgressBarSize.Width ;
+
+ nHeight = 6 * FREEBORDER ;
+ nHeight += aTopicSize_Top.Height ;
+ nHeight += aProgressBarSize.Height ;
+ nHeight += aTopicSize_Bottom.Height;
+ nHeight += 2 ; // 1 for black line, 1 for white line = 3D-Line!
+ nHeight += aButtonSize.Height ;
+
+ // norm to minimum
+ if ( nWidth<DEFAULT_WIDTH )
+ {
+ nWidth = DEFAULT_WIDTH ;
+ }
+ if ( nHeight<DEFAULT_HEIGHT )
+ {
+ nHeight = DEFAULT_HEIGHT ;
+ }
+
+ // return to caller
+ return Size ( nWidth, nHeight ) ;
+}
+
+//____________________________________________________________________________________________________________
+// XLayoutConstrains
+//____________________________________________________________________________________________________________
+
+Size SAL_CALL ProgressMonitor::calcAdjustedSize ( const Size& rNewSize ) throw( RuntimeException )
+{
+ return getPreferredSize () ;
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::createPeer ( const Reference< XToolkit > & rToolkit, const Reference< XWindowPeer > & rParent ) throw( RuntimeException )
+{
+ if (!getPeer().is())
+ {
+ BaseContainerControl::createPeer ( rToolkit, rParent ) ;
+
+ // If user forget to call "setPosSize()", we have still a correct size.
+ // And a "MinimumSize" IS A "MinimumSize"!
+ // We change not the position of control at this point.
+ Size aDefaultSize = getMinimumSize () ;
+ setPosSize ( 0, 0, aDefaultSize.Width, aDefaultSize.Height, PosSize::SIZE ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+sal_Bool SAL_CALL ProgressMonitor::setModel ( const Reference< XControlModel > & rModel ) throw( RuntimeException )
+{
+ // We have no model.
+ return sal_False ;
+}
+
+//____________________________________________________________________________________________________________
+// XControl
+//____________________________________________________________________________________________________________
+
+Reference< XControlModel > SAL_CALL ProgressMonitor::getModel () throw( RuntimeException )
+{
+ // We have no model.
+ // return (XControlModel*)this ;
+ return Reference< XControlModel > () ;
+}
+
+//____________________________________________________________________________________________________________
+// XComponent
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::dispose () throw( RuntimeException )
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ // "removeControl()" control the state of a reference
+ Reference< XControl > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ;
+ Reference< XControl > xRef_Text_Top ( m_xText_Top , UNO_QUERY ) ;
+ Reference< XControl > xRef_Topic_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ;
+ Reference< XControl > xRef_Text_Bottom ( m_xText_Bottom , UNO_QUERY ) ;
+ Reference< XControl > xRef_Button ( m_xButton , UNO_QUERY ) ;
+ Reference< XControl > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ;
+
+ removeControl ( xRef_Topic_Top ) ;
+ removeControl ( xRef_Text_Top ) ;
+ removeControl ( xRef_Topic_Bottom ) ;
+ removeControl ( xRef_Text_Bottom ) ;
+ removeControl ( xRef_Button ) ;
+ removeControl ( xRef_ProgressBar ) ;
+
+ // do'nt use "...->clear ()" or "... = XFixedText ()"
+ // when other hold a reference at this object !!!
+ xRef_Topic_Top->dispose () ;
+ xRef_Text_Top->dispose () ;
+ xRef_Topic_Bottom->dispose () ;
+ xRef_Text_Bottom->dispose () ;
+ xRef_Button->dispose () ;
+ xRef_ProgressBar->dispose () ;
+
+ BaseContainerControl::dispose () ;
+}
+
+//____________________________________________________________________________________________________________
+// XWindow
+//____________________________________________________________________________________________________________
+
+void SAL_CALL ProgressMonitor::setPosSize ( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags ) throw( RuntimeException )
+{
+ Rectangle aBasePosSize = getPosSize () ;
+ BaseContainerControl::setPosSize (nX, nY, nWidth, nHeight, nFlags) ;
+
+ // if position or size changed
+ if (
+ ( nWidth != aBasePosSize.Width ) ||
+ ( nHeight != aBasePosSize.Height)
+ )
+ {
+ // calc new layout for controls
+ impl_recalcLayout () ;
+ // clear background (!)
+ // [Childs was repainted in "recalcLayout" by setPosSize() automaticly!]
+ getPeer()->invalidate(2);
+ // and repaint the control
+ impl_paint ( 0, 0, impl_getGraphicsPeer() ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// impl but public method to register service
+//____________________________________________________________________________________________________________
+
+const Sequence< OUString > ProgressMonitor::impl_getStaticSupportedServiceNames()
+{
+ MutexGuard aGuard( Mutex::getGlobalMutex() );
+ Sequence< OUString > seqServiceNames( 1 );
+ seqServiceNames.getArray() [0] = OUString::createFromAscii( SERVICENAME_PROGRESSMONITOR );
+ return seqServiceNames ;
+}
+
+//____________________________________________________________________________________________________________
+// impl but public method to register service
+//____________________________________________________________________________________________________________
+
+const OUString ProgressMonitor::impl_getStaticImplementationName()
+{
+ return OUString::createFromAscii( IMPLEMENTATIONNAME_PROGRESSMONITOR );
+}
+
+//____________________________________________________________________________________________________________
+// protected method
+//____________________________________________________________________________________________________________
+
+void ProgressMonitor::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGraphics > & rGraphics )
+{
+ if (rGraphics.is())
+ {
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ // paint shadowed border around the progressmonitor
+ rGraphics->setLineColor ( LINECOLOR_SHADOW ) ;
+ rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ) ;
+ rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ) ;
+
+ rGraphics->setLineColor ( LINECOLOR_BRIGHT ) ;
+ rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ) ;
+ rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ) ;
+
+ // Paint 3D-line
+ rGraphics->setLineColor ( LINECOLOR_SHADOW ) ;
+ rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ) ;
+
+ rGraphics->setLineColor ( LINECOLOR_BRIGHT ) ;
+ rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// private method
+//____________________________________________________________________________________________________________
+
+void ProgressMonitor::impl_recalcLayout ()
+{
+ sal_Int32 nX_Button ;
+ sal_Int32 nY_Button ;
+ sal_Int32 nWidth_Button ;
+ sal_Int32 nHeight_Button ;
+
+ sal_Int32 nX_ProgressBar ;
+ sal_Int32 nY_ProgressBar ;
+ sal_Int32 nWidth_ProgressBar ;
+ sal_Int32 nHeight_ProgressBar ;
+
+ sal_Int32 nX_3DLine ;
+ sal_Int32 nY_3DLine ;
+ sal_Int32 nWidth_3DLine ;
+ sal_Int32 nHeight_3DLine ;
+
+ sal_Int32 nX_Text_Top ;
+ sal_Int32 nY_Text_Top ;
+ sal_Int32 nWidth_Text_Top ;
+ sal_Int32 nHeight_Text_Top ;
+
+ sal_Int32 nX_Topic_Top ;
+ sal_Int32 nY_Topic_Top ;
+ sal_Int32 nWidth_Topic_Top ;
+ sal_Int32 nHeight_Topic_Top ;
+
+ sal_Int32 nX_Text_Bottom ;
+ sal_Int32 nY_Text_Bottom ;
+ sal_Int32 nWidth_Text_Bottom ;
+ sal_Int32 nHeight_Text_Bottom ;
+
+ sal_Int32 nX_Topic_Bottom ;
+ sal_Int32 nY_Topic_Bottom ;
+ sal_Int32 nWidth_Topic_Bottom ;
+ sal_Int32 nHeight_Topic_Bottom ;
+
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ // get information about required place of child controls
+ Reference< XLayoutConstrains > xTopicLayout_Top ( m_xTopic_Top , UNO_QUERY ) ;
+ Reference< XLayoutConstrains > xTextLayout_Top ( m_xText_Top , UNO_QUERY ) ;
+ Reference< XLayoutConstrains > xTopicLayout_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ;
+ Reference< XLayoutConstrains > xTextLayout_Bottom ( m_xText_Bottom , UNO_QUERY ) ;
+ Reference< XLayoutConstrains > xButtonLayout ( m_xButton , UNO_QUERY ) ;
+
+ Size aTopicSize_Top = xTopicLayout_Top->getPreferredSize () ;
+ Size aTextSize_Top = xTextLayout_Top->getPreferredSize () ;
+ Size aTopicSize_Bottom = xTopicLayout_Bottom->getPreferredSize () ;
+ Size aTextSize_Bottom = xTextLayout_Bottom->getPreferredSize () ;
+ Size aButtonSize = xButtonLayout->getPreferredSize () ;
+
+ // calc position and size of child controls
+ // Button has preferred size!
+ nWidth_Button = aButtonSize.Width ;
+ nHeight_Button = aButtonSize.Height ;
+
+ // Left column before progressbar has preferred size and fixed position.
+ // But "Width" is oriented on left column below progressbar to!!! "max(...)"
+ nX_Topic_Top = FREEBORDER ;
+ nY_Topic_Top = FREEBORDER ;
+ nWidth_Topic_Top = Max ( aTopicSize_Top.Width, aTopicSize_Bottom.Width ) ;
+ nHeight_Topic_Top = aTopicSize_Top.Height ;
+
+ // Right column before progressbar has relativ position to left column ...
+ // ... and a size as rest of dialog size!
+ nX_Text_Top = nX_Topic_Top+nWidth_Topic_Top+FREEBORDER ;
+ nY_Text_Top = nY_Topic_Top ;
+ nWidth_Text_Top = Max ( aTextSize_Top.Width, aTextSize_Bottom.Width ) ;
+ // Fix size of this column to minimum!
+ sal_Int32 nSummaryWidth = nWidth_Text_Top+nWidth_Topic_Top+(3*FREEBORDER) ;
+ if ( nSummaryWidth < DEFAULT_WIDTH )
+ nWidth_Text_Top = DEFAULT_WIDTH-nWidth_Topic_Top-(3*FREEBORDER);
+ // Fix size of column to maximum!
+ if ( nSummaryWidth > impl_getWidth() )
+ nWidth_Text_Top = impl_getWidth()-nWidth_Topic_Top-(3*FREEBORDER) ;
+ nHeight_Text_Top = nHeight_Topic_Top ;
+
+ // Position of progressbar is relativ to columns before.
+ // Progressbar.Width = Dialog.Width !!!
+ // Progressbar.Height = Button.Height
+ nX_ProgressBar = nX_Topic_Top ;
+ nY_ProgressBar = nY_Topic_Top+nHeight_Topic_Top+FREEBORDER ;
+ nWidth_ProgressBar = FREEBORDER+nWidth_Topic_Top+nWidth_Text_Top ;
+ nHeight_ProgressBar = nHeight_Button ;
+
+ // Oriented by left column before progressbar.
+ nX_Topic_Bottom = nX_Topic_Top ;
+ nY_Topic_Bottom = nY_ProgressBar+nHeight_ProgressBar+FREEBORDER ;
+ nWidth_Topic_Bottom = nWidth_Topic_Top ;
+ nHeight_Topic_Bottom = aTopicSize_Bottom.Height ;
+
+ // Oriented by right column before progressbar.
+ nX_Text_Bottom = nX_Topic_Bottom+nWidth_Topic_Bottom+FREEBORDER ;
+ nY_Text_Bottom = nY_Topic_Bottom ;
+ nWidth_Text_Bottom = nWidth_Text_Top ;
+ nHeight_Text_Bottom = nHeight_Topic_Bottom ;
+
+ // Oriented by progressbar.
+ nX_3DLine = nX_Topic_Top ;
+ nY_3DLine = nY_Topic_Bottom+nHeight_Topic_Bottom+(FREEBORDER/2) ;
+ nWidth_3DLine = nWidth_ProgressBar ;
+ nHeight_3DLine = 1 ; // Height for ONE line ! (But we paint two lines!)
+
+ // Oriented by progressbar.
+ nX_Button = nX_ProgressBar+nWidth_ProgressBar-nWidth_Button ;
+ nY_Button = nY_Topic_Bottom+nHeight_Topic_Bottom+FREEBORDER ;
+
+ // Calc offsets to center controls
+ sal_Int32 nDx ;
+ sal_Int32 nDy ;
+
+ nDx = ( (2*FREEBORDER)+nWidth_ProgressBar ) ;
+ nDy = ( (6*FREEBORDER)+nHeight_Topic_Top+nHeight_ProgressBar+nHeight_Topic_Bottom+2+nHeight_Button ) ;
+
+ // At this point use original dialog size to center controls!
+ nDx = (impl_getWidth ()/2)-(nDx/2) ;
+ nDy = (impl_getHeight()/2)-(nDy/2) ;
+
+ if ( nDx<0 )
+ {
+ nDx=0 ;
+ }
+ if ( nDy<0 )
+ {
+ nDy=0 ;
+ }
+
+ // Set new position and size on all controls
+ Reference< XWindow > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ;
+ Reference< XWindow > xRef_Text_Top ( m_xText_Top , UNO_QUERY ) ;
+ Reference< XWindow > xRef_Topic_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ;
+ Reference< XWindow > xRef_Text_Bottom ( m_xText_Bottom , UNO_QUERY ) ;
+ Reference< XWindow > xRef_Button ( m_xButton , UNO_QUERY ) ;
+ Reference< XWindow > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ;
+
+ xRef_Topic_Top->setPosSize ( nDx+nX_Topic_Top , nDy+nY_Topic_Top , nWidth_Topic_Top , nHeight_Topic_Top , 15 ) ;
+ xRef_Text_Top->setPosSize ( nDx+nX_Text_Top , nDy+nY_Text_Top , nWidth_Text_Top , nHeight_Text_Top , 15 ) ;
+ xRef_Topic_Bottom->setPosSize ( nDx+nX_Topic_Bottom , nDy+nY_Topic_Bottom , nWidth_Topic_Bottom , nHeight_Topic_Bottom , 15 ) ;
+ xRef_Text_Bottom->setPosSize ( nDx+nX_Text_Bottom , nDy+nY_Text_Bottom , nWidth_Text_Bottom , nHeight_Text_Bottom , 15 ) ;
+ xRef_Button->setPosSize ( nDx+nX_Button , nDy+nY_Button , nWidth_Button , nHeight_Button , 15 ) ;
+ xRef_ProgressBar->setPosSize ( nDx+nX_ProgressBar , nDy+nY_ProgressBar , nWidth_ProgressBar , nHeight_ProgressBar , 15 ) ;
+
+ m_a3DLine.X = nDx+nX_Topic_Top ;
+ m_a3DLine.Y = nDy+nY_Topic_Bottom+nHeight_Topic_Bottom+(FREEBORDER/2) ;
+ m_a3DLine.Width = nWidth_ProgressBar ;
+ m_a3DLine.Height = nHeight_ProgressBar ;
+
+ // All childcontrols make an implicit repaint in setPosSize()!
+ // Make it also for this 3D-line ...
+ Reference< XGraphics > xGraphics = impl_getGraphicsPeer () ;
+
+ xGraphics->setLineColor ( LINECOLOR_SHADOW ) ;
+ xGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ) ;
+
+ xGraphics->setLineColor ( LINECOLOR_BRIGHT ) ;
+ xGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ) ;
+}
+
+//____________________________________________________________________________________________________________
+// private method
+//____________________________________________________________________________________________________________
+
+void ProgressMonitor::impl_rebuildFixedText ()
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ // Rebuild fixedtext before progress
+
+ // Rebuild left site of text
+ if (m_xTopic_Top.is())
+ {
+ OUString aCollectString ;
+
+ // Collect all topics from list and format text.
+ // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!!
+ for ( sal_uInt32 n=0; n<m_pTextlist_Top->Count(); ++n )
+ {
+ IMPL_TextlistItem* pSearchItem = m_pTextlist_Top->GetObject (n) ;
+ aCollectString += pSearchItem->sTopic ;
+ aCollectString += OUString::createFromAscii("\n") ;
+ }
+ aCollectString += OUString::createFromAscii("\0") ; // It's better :-)
+
+ m_xTopic_Top->setText ( aCollectString ) ;
+ }
+
+ // Rebuild right site of text
+ if (m_xText_Top.is())
+ {
+ OUString aCollectString ;
+
+ // Collect all topics from list and format text.
+ // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!!
+ for ( sal_uInt32 n=0; n<m_pTextlist_Top->Count(); ++n )
+ {
+ IMPL_TextlistItem* pSearchItem = m_pTextlist_Top->GetObject (n) ;
+ aCollectString += pSearchItem->sText ;
+ aCollectString += OUString::createFromAscii("\n") ;
+ }
+ aCollectString += OUString::createFromAscii("\0") ; // It's better :-)
+
+ m_xText_Top->setText ( aCollectString ) ;
+ }
+
+ // Rebuild fixedtext below progress
+
+ // Rebuild left site of text
+ if (m_xTopic_Bottom.is())
+ {
+ OUString aCollectString ;
+
+ // Collect all topics from list and format text.
+ // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!!
+ for ( sal_uInt32 n=0; n<m_pTextlist_Bottom->Count(); ++n )
+ {
+ IMPL_TextlistItem* pSearchItem = m_pTextlist_Bottom->GetObject (n) ;
+ aCollectString += pSearchItem->sTopic ;
+ aCollectString += OUString::createFromAscii("\n") ;
+ }
+ aCollectString += OUString::createFromAscii("\0") ; // It's better :-)
+
+ m_xTopic_Bottom->setText ( aCollectString ) ;
+ }
+
+ // Rebuild right site of text
+ if (m_xText_Bottom.is())
+ {
+ OUString aCollectString ;
+
+ // Collect all topics from list and format text.
+ // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!!
+ for ( sal_uInt32 n=0; n<m_pTextlist_Bottom->Count(); ++n )
+ {
+ IMPL_TextlistItem* pSearchItem = m_pTextlist_Bottom->GetObject (n) ;
+ aCollectString += pSearchItem->sText ;
+ aCollectString += OUString::createFromAscii("\n") ;
+ }
+ aCollectString += OUString::createFromAscii("\0") ; // It's better :-)
+
+ m_xText_Bottom->setText ( aCollectString ) ;
+ }
+}
+
+//____________________________________________________________________________________________________________
+// private method
+//____________________________________________________________________________________________________________
+
+void ProgressMonitor::impl_cleanMemory ()
+{
+ // Ready for multithreading
+ MutexGuard aGuard ( m_aMutex ) ;
+
+ // Delete all of lists.
+
+ sal_uInt32 nPosition ;
+
+ for ( nPosition = 0; nPosition < m_pTextlist_Top->Count () ; ++nPosition )
+ {
+ IMPL_TextlistItem* pSearchItem = m_pTextlist_Top->GetObject ( nPosition ) ;
+ delete pSearchItem ;
+ }
+ m_pTextlist_Top->Clear () ;
+ delete m_pTextlist_Top ;
+
+ for ( nPosition = 0; nPosition < m_pTextlist_Bottom->Count () ; ++nPosition )
+ {
+ IMPL_TextlistItem* pSearchItem = m_pTextlist_Bottom->GetObject ( nPosition ) ;
+ delete pSearchItem ;
+ }
+ m_pTextlist_Bottom->Clear () ;
+ delete m_pTextlist_Bottom ;
+}
+
+//____________________________________________________________________________________________________________
+// private method
+//____________________________________________________________________________________________________________
+
+IMPL_TextlistItem* ProgressMonitor::impl_searchTopic ( const OUString& rTopic, sal_Bool bbeforeProgress )
+{
+ // Get right textlist for following operations.
+ IMPL_Textlist* pTextList ;
+
+ // Ready for multithreading
+ ClearableMutexGuard aGuard ( m_aMutex ) ;
+
+ if ( bbeforeProgress == sal_True )
+ {
+ pTextList = m_pTextlist_Top ;
+ }
+ else
+ {
+ pTextList = m_pTextlist_Bottom ;
+ }
+
+ // Switch off guard.
+ aGuard.clear () ;
+
+ // Search the topic in textlist.
+ sal_uInt32 nPosition = 0 ;
+ sal_uInt32 nCount = pTextList->Count () ;
+
+ for ( nPosition = 0; nPosition < nCount ; ++nPosition )
+ {
+ IMPL_TextlistItem* pSearchItem = pTextList->GetObject ( nPosition ) ;
+
+ if ( pSearchItem->sTopic == rTopic )
+ {
+ // We have found this topic ... return a valid pointer.
+ return pSearchItem ;
+ }
+ }
+
+ // We have'nt found this topic ... return a nonvalid pointer.
+ return NULL ;
+}
+
+//____________________________________________________________________________________________________________
+// debug methods
+//____________________________________________________________________________________________________________
+
+#ifdef DBG_UTIL
+
+// addText, updateText
+sal_Bool ProgressMonitor::impl_debug_checkParameter ( const OUString& rTopic, const OUString& rText, sal_Bool bbeforeProgress )
+{
+ // Check "rTopic"
+ if ( &rTopic == NULL ) return sal_False ; // NULL-pointer for reference ???!!!
+ if ( rTopic.len () < 1 ) return sal_False ; // ""
+
+ // Check "rText"
+ if ( &rText == NULL ) return sal_False ; // NULL-pointer for reference ???!!!
+ if ( rText.len () < 1 ) return sal_False ; // ""
+
+ // "bbeforeProgress" is valid in everyway!
+
+ // Parameter OK ... return sal_True.
+ return sal_True ;
+}
+
+// removeText
+sal_Bool ProgressMonitor::impl_debug_checkParameter ( const OUString& rTopic, sal_Bool bbeforeProgress )
+{
+ // Check "rTopic"
+ if ( &rTopic == NULL ) return sal_False ; // NULL-pointer for reference ???!!!
+ if ( rTopic.len () < 1 ) return sal_False ; // ""
+
+ // "bbeforeProgress" is valid in everyway!
+
+ // Parameter OK ... return sal_True.
+ return sal_True ;
+}
+
+#endif // #ifdef DBG_UTIL
+
+} // namespace unocontrols
diff --git a/UnoControls/source/inc/OConnectionPointContainerHelper.hxx b/UnoControls/source/inc/OConnectionPointContainerHelper.hxx
new file mode 100644
index 000000000..1d32097bd
--- /dev/null
+++ b/UnoControls/source/inc/OConnectionPointContainerHelper.hxx
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * $RCSfile: OConnectionPointContainerHelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX
+#define _OCONNECTIONPOINTCONTAINERHELPER_HXX
+
+//______________________________________________________________________________________________________________
+// includes of other projects
+//______________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_LANG_XCONNECTIONPOINTCONTAINER_HPP_
+#include <com/sun/star/lang/XConnectionPointContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XCONNECTIONPOINT_HPP_
+#include <com/sun/star/lang/XConnectionPoint.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _CPPUHELPER_PROPSHLP_HXX
+#include <cppuhelper/propshlp.hxx>
+#endif
+
+//______________________________________________________________________________________________________________
+// includes of my own project
+//______________________________________________________________________________________________________________
+
+//______________________________________________________________________________________________________________
+// namespaces
+//______________________________________________________________________________________________________________
+
+namespace unocontrols{
+
+#define UNO3_ANY ::com::sun::star::uno::Any
+#define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
+#define UNO3_TYPE ::com::sun::star::uno::Type
+#define UNO3_REFERENCE ::com::sun::star::uno::Reference
+#define UNO3_XCONNECTIONPOINTCONTAINER ::com::sun::star::lang::XConnectionPointContainer
+#define UNO3_XCONNECTIONPOINT ::com::sun::star::lang::XConnectionPoint
+#define UNO3_MUTEX ::osl::Mutex
+#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
+#define UNO3_XINTERFACE ::com::sun::star::uno::XInterface
+#define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
+#define UNO3_LISTENEREXISTEXCEPTION ::com::sun::star::lang::ListenerExistException
+#define UNO3_INVALIDLISTENEREXCEPTION ::com::sun::star::lang::InvalidListenerException
+#define UNO3_WEAKREFERENCE ::com::sun::star::uno::WeakReference
+#define UNO3_OWEAKOBJECT ::cppu::OWeakObject
+
+//______________________________________________________________________________________________________________
+// defines
+//______________________________________________________________________________________________________________
+
+//______________________________________________________________________________________________________________
+// class declaration OConnectionPointContainerHelper
+//______________________________________________________________________________________________________________
+
+class OConnectionPointContainerHelper : public UNO3_XCONNECTIONPOINTCONTAINER
+ , public UNO3_OWEAKOBJECT
+{
+
+//______________________________________________________________________________________________________________
+// public methods
+//______________________________________________________________________________________________________________
+
+public:
+
+ //__________________________________________________________________________________________________________
+ // construct/destruct
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ OConnectionPointContainerHelper( UNO3_MUTEX& aMutex );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual ~OConnectionPointContainerHelper();
+
+ //________________________________________________________________________________________________________
+ // XInterface
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short give answer, if interface is supported
+ @descr The interfaces are searched by type.
+
+ @seealso XInterface
+
+ @param "rType" is the type of searched interface.
+
+ @return Any information about found interface
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short increment refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso release()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL acquire() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short decrement refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso acquire()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL release() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // XConnectionPointContainer
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getConnectionPointTypes() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XCONNECTIONPOINT > SAL_CALL queryConnectionPoint( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL advise( const UNO3_TYPE& aType ,
+ const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL unadvise( const UNO3_TYPE& aType ,
+ const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ UNO3_OMULTITYPEINTERFACECONTAINERHELPER& impl_getMultiTypeContainer();
+
+//______________________________________________________________________________________________________________
+// private variables
+//______________________________________________________________________________________________________________
+
+private:
+
+ UNO3_MUTEX& m_aSharedMutex ;
+ UNO3_OMULTITYPEINTERFACECONTAINERHELPER m_aMultiTypeContainer ; // Container to hold listener
+
+}; // class OConnectionPointContainerHelper
+
+} // namespace unocontrols
+
+#endif // #ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX
diff --git a/UnoControls/source/inc/OConnectionPointHelper.hxx b/UnoControls/source/inc/OConnectionPointHelper.hxx
new file mode 100644
index 000000000..fba95b641
--- /dev/null
+++ b/UnoControls/source/inc/OConnectionPointHelper.hxx
@@ -0,0 +1,354 @@
+/*************************************************************************
+ *
+ * $RCSfile: OConnectionPointHelper.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OCONNECTIONPOINTHELPER_HXX
+#define _OCONNECTIONPOINTHELPER_HXX
+
+//______________________________________________________________________________________________________________
+// includes of other projects
+//______________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_LANG_XCONNECTIONPOINTCONTAINER_HPP_
+#include <com/sun/star/lang/XConnectionPointContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XCONNECTIONPOINT_HPP_
+#include <com/sun/star/lang/XConnectionPoint.hpp>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#ifndef _CPPUHELPER_PROPSHLP_HXX
+#include <cppuhelper/propshlp.hxx>
+#endif
+
+//______________________________________________________________________________________________________________
+// includes of my own project
+//______________________________________________________________________________________________________________
+
+#ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX
+#include "OConnectionPointContainerHelper.hxx"
+#endif
+
+//______________________________________________________________________________________________________________
+// namespaces
+//______________________________________________________________________________________________________________
+
+namespace unocontrols{
+
+#define UNO3_ANY ::com::sun::star::uno::Any
+#define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
+#define UNO3_TYPE ::com::sun::star::uno::Type
+#define UNO3_REFERENCE ::com::sun::star::uno::Reference
+#define UNO3_XCONNECTIONPOINTCONTAINER ::com::sun::star::lang::XConnectionPointContainer
+#define UNO3_XCONNECTIONPOINT ::com::sun::star::lang::XConnectionPoint
+#define UNO3_MUTEX ::osl::Mutex
+#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
+#define UNO3_XINTERFACE ::com::sun::star::uno::XInterface
+#define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
+#define UNO3_LISTENEREXISTEXCEPTION ::com::sun::star::lang::ListenerExistException
+#define UNO3_INVALIDLISTENEREXCEPTION ::com::sun::star::lang::InvalidListenerException
+#define UNO3_WEAKREFERENCE ::com::sun::star::uno::WeakReference
+#define UNO3_OWEAKOBJECT ::cppu::OWeakObject
+#define UNO3_OCONNECTIONPOINTCONTAINERHELPER OConnectionPointContainerHelper
+
+//______________________________________________________________________________________________________________
+// defines
+//______________________________________________________________________________________________________________
+
+//______________________________________________________________________________________________________________
+// class declaration OConnectionPointHelper
+//______________________________________________________________________________________________________________
+
+class OConnectionPointHelper : public UNO3_XCONNECTIONPOINT
+ , public UNO3_OWEAKOBJECT
+{
+
+//______________________________________________________________________________________________________________
+// public methods
+//______________________________________________________________________________________________________________
+
+public:
+
+ //__________________________________________________________________________________________________________
+ // construct/destruct
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ OConnectionPointHelper( UNO3_MUTEX& aMutex ,
+ UNO3_OCONNECTIONPOINTCONTAINERHELPER* pContainerImplementation ,
+ UNO3_TYPE aType );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual ~OConnectionPointHelper();
+
+ //________________________________________________________________________________________________________
+ // XInterface
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short give answer, if interface is supported
+ @descr The interfaces are searched by type.
+
+ @seealso XInterface
+
+ @param "rType" is the type of searched interface.
+
+ @return Any information about found interface
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short increment refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso release()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL acquire() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short decrement refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso acquire()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL release() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // XConnectionPoint
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_TYPE SAL_CALL getConnectionType() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XCONNECTIONPOINTCONTAINER > SAL_CALL getConnectionPointContainer() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL advise( const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener ) throw( UNO3_LISTENEREXISTEXCEPTION ,
+ UNO3_INVALIDLISTENEREXCEPTION ,
+ UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL unadvise( const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_SEQUENCE< UNO3_REFERENCE< UNO3_XINTERFACE > > SAL_CALL getConnections() throw( UNO3_RUNTIMEEXCEPTION );
+
+//______________________________________________________________________________________________________________
+// private methods
+//______________________________________________________________________________________________________________
+
+private:
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ sal_Bool impl_LockContainer();
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ void impl_UnlockContainer();
+
+//______________________________________________________________________________________________________________
+// private variables
+//______________________________________________________________________________________________________________
+
+private:
+
+ UNO3_MUTEX& m_aSharedMutex ;
+ UNO3_WEAKREFERENCE< UNO3_XCONNECTIONPOINTCONTAINER > m_oContainerWeakReference ; // Reference to container-class!. Don't use Reference<...>
+ // It is a ring-reference => and must be a wekreference!
+ UNO3_OCONNECTIONPOINTCONTAINERHELPER* m_pContainerImplementation ;
+ UNO3_TYPE m_aInterfaceType ;
+ UNO3_REFERENCE< UNO3_XINTERFACE > m_xLock ;
+
+}; // class OConnectionPointHelper
+
+} // namespace unocontrols
+
+#endif // #ifndef _OCONNECTIONPOINTHELPER_HXX
diff --git a/UnoControls/source/inc/framecontrol.hxx b/UnoControls/source/inc/framecontrol.hxx
new file mode 100644
index 000000000..d85b9d95a
--- /dev/null
+++ b/UnoControls/source/inc/framecontrol.hxx
@@ -0,0 +1,690 @@
+/*************************************************************************
+ *
+ * $RCSfile: framecontrol.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
+#define _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
+
+//______________________________________________________________________________________________________________
+// includes of other projects
+//______________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_FRAME_XFRAMEACTIONLISTENER_HPP_
+#include <com/sun/star/frame/XFrameActionListener.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
+#include <com/sun/star/frame/XFrame.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_FRAME_FRAMEACTIONEVENT_HPP_
+#include <com/sun/star/frame/FrameActionEvent.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_FRAME_FRAMEACTION_HPP_
+#include <com/sun/star/frame/FrameAction.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
+#include <com/sun/star/lang/XServiceName.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XCONNECTIONPOINTCONTAINER_HPP_
+#include <com/sun/star/lang/XConnectionPointContainer.hpp>
+#endif
+
+#ifndef _CPPUHELPER_PROPSHLP_HXX
+#include <cppuhelper/propshlp.hxx>
+#endif
+
+//______________________________________________________________________________________________________________
+// includes of my own project
+//______________________________________________________________________________________________________________
+
+#ifndef _UNOCONTROLS_BASECONTROL_CTRL_HXX
+#include "basecontrol.hxx"
+#endif
+
+#ifndef _OCONNECTIONPOINTCONTAINERHELPER_HXX
+#include "OConnectionPointContainerHelper.hxx"
+#endif
+
+//______________________________________________________________________________________________________________
+// namespaces
+//______________________________________________________________________________________________________________
+
+namespace unocontrols{
+
+#define UNO3_ANY ::com::sun::star::uno::Any
+#define UNO3_ILLEGALARGUMENTEXCEPTION ::com::sun::star::lang::IllegalArgumentException
+#define UNO3_IPROPERTYARRAYHELPER ::cppu::IPropertyArrayHelper
+#define UNO3_OBROADCASTHELPER ::cppu::OBroadcastHelper
+#define UNO3_OCONNECTIONPOINTCONTAINERHELPER OConnectionPointContainerHelper
+#define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
+#define UNO3_OPROPERTYSETHELPER ::cppu::OPropertySetHelper
+#define UNO3_OUSTRING ::rtl::OUString
+#define UNO3_PROPERTY ::com::sun::star::beans::Property
+#define UNO3_PROPERTYVALUE ::com::sun::star::beans::PropertyValue
+#define UNO3_REFERENCE ::com::sun::star::uno::Reference
+#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
+#define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
+#define UNO3_TYPE ::com::sun::star::uno::Type
+#define UNO3_WINDOWDESCRIPTOR ::com::sun::star::awt::WindowDescriptor
+#define UNO3_XCONNECTIONPOINT ::com::sun::star::lang::XConnectionPoint
+#define UNO3_XCONNECTIONPOINTCONTAINER ::com::sun::star::lang::XConnectionPointContainer
+#define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel
+#define UNO3_XFRAME ::com::sun::star::frame::XFrame
+#define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics
+#define UNO3_XINTERFACE ::com::sun::star::uno::XInterface
+#define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
+#define UNO3_XPROPERTYSETINFO ::com::sun::star::beans::XPropertySetInfo
+#define UNO3_XTOOLKIT ::com::sun::star::awt::XToolkit
+#define UNO3_XWINDOWPEER ::com::sun::star::awt::XWindowPeer
+
+//______________________________________________________________________________________________________________
+// defines
+//______________________________________________________________________________________________________________
+
+#define SERVICENAME_FRAMECONTROL "com.sun.star.frame.FrameControl"
+#define IMPLEMENTATIONNAME_FRAMECONTROL "stardiv.UnoControls.FrameControl"
+#define PROPERTYNAME_LOADERARGUMENTS "LoaderArguments"
+#define PROPERTYNAME_COMPONENTURL "ComponentURL"
+#define PROPERTYNAME_FRAME "Frame"
+#define ERRORTEXT_VOSENSHURE "This is an invalid property handle."
+#define PROPERTY_COUNT 3 // you must count the propertys
+#define PROPERTYHANDLE_COMPONENTURL 0 // Id must be the index into the array
+#define PROPERTYHANDLE_FRAME 1
+#define PROPERTYHANDLE_LOADERARGUMENTS 2
+
+//______________________________________________________________________________________________________________
+// class
+//______________________________________________________________________________________________________________
+
+class FrameControl : public UNO3_XCONTROLMODEL
+ , public UNO3_XCONNECTIONPOINTCONTAINER
+ , public BaseControl // This order is neccessary for right initialization of m_aMutex!
+ , public UNO3_OBROADCASTHELPER
+ , public UNO3_OPROPERTYSETHELPER
+{
+
+//______________________________________________________________________________________________________________
+// public methods
+//______________________________________________________________________________________________________________
+
+public:
+
+ //__________________________________________________________________________________________________________
+ // construct/destruct
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ FrameControl( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual ~FrameControl();
+
+ //__________________________________________________________________________________________________________
+ // XInterface
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short increment refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso release()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL acquire() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short decrement refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso acquire()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL release() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // XTypeProvider
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // XAggregation
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // XControl
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL createPeer( const UNO3_REFERENCE< UNO3_XTOOLKIT >& xToolkit ,
+ const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParent ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // XComponent
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL dispose() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // XView
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual sal_Bool SAL_CALL setGraphics( const UNO3_REFERENCE< UNO3_XGRAPHICS >& xDevice ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XGRAPHICS > SAL_CALL getGraphics() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // XConnectionPointContainer
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getConnectionPointTypes() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XCONNECTIONPOINT > SAL_CALL queryConnectionPoint( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL advise( const UNO3_TYPE& aType ,
+ const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL unadvise( const UNO3_TYPE& aType ,
+ const UNO3_REFERENCE< UNO3_XINTERFACE >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // impl but public methods to register service!
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ static const UNO3_SEQUENCE< UNO3_OUSTRING > impl_getStaticSupportedServiceNames();
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ static const UNO3_OUSTRING impl_getStaticImplementationName();
+
+//______________________________________________________________________________________________________________
+// protected methods
+//______________________________________________________________________________________________________________
+
+protected:
+
+ //__________________________________________________________________________________________________________
+ // OPropertySetHelper
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( UNO3_ANY& rConvertedValue ,
+ UNO3_ANY& rOldValue ,
+ sal_Int32 nHandle ,
+ const UNO3_ANY& rValue ) throw( UNO3_ILLEGALARGUMENTEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
+ const UNO3_ANY& rValue );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL getFastPropertyValue( UNO3_ANY& rValue ,
+ sal_Int32 nHandle ) const ;
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_IPROPERTYARRAYHELPER& SAL_CALL getInfoHelper();
+
+ //__________________________________________________________________________________________________________
+ // XPropertySet
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ UNO3_REFERENCE< UNO3_XPROPERTYSETINFO > SAL_CALL getPropertySetInfo() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // BaseControl
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_WINDOWDESCRIPTOR* impl_getWindowDescriptor( const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParentPeer );
+
+//______________________________________________________________________________________________________________
+// private methods
+//______________________________________________________________________________________________________________
+
+private:
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ void impl_createFrame( const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xPeer ,
+ const UNO3_OUSTRING& sURL ,
+ const UNO3_SEQUENCE< UNO3_PROPERTYVALUE >& seqArguments );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ void impl_deleteFrame();
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ static const UNO3_SEQUENCE< UNO3_PROPERTY > impl_getStaticPropertyDescriptor();
+
+
+//______________________________________________________________________________________________________________
+// private variables
+//______________________________________________________________________________________________________________
+
+private:
+
+ UNO3_REFERENCE< UNO3_XFRAME > m_xFrame ;
+ UNO3_OUSTRING m_sComponentURL ;
+ UNO3_SEQUENCE< UNO3_PROPERTYVALUE > m_seqLoaderArguments ;
+ UNO3_OMULTITYPEINTERFACECONTAINERHELPER m_aInterfaceContainer ;
+ UNO3_OCONNECTIONPOINTCONTAINERHELPER m_aConnectionPointContainer ;
+
+}; // class FrameControl
+
+} // namespace unocontrols
+
+#endif // #ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
diff --git a/UnoControls/source/inc/progressbar.hxx b/UnoControls/source/inc/progressbar.hxx
new file mode 100644
index 000000000..c7cc70d4d
--- /dev/null
+++ b/UnoControls/source/inc/progressbar.hxx
@@ -0,0 +1,487 @@
+/*************************************************************************
+ *
+ * $RCSfile: progressbar.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
+#define _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
+
+//____________________________________________________________________________________________________________
+// includes of other projects
+//____________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
+#include <com/sun/star/lang/XServiceName.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+
+//____________________________________________________________________________________________________________
+// includes of my own project
+//____________________________________________________________________________________________________________
+
+#ifndef _UNOCONTROLS_BASECONTROL_CTRL_HXX
+#include "basecontrol.hxx"
+#endif
+
+//____________________________________________________________________________________________________________
+// namespaces
+//____________________________________________________________________________________________________________
+
+namespace unocontrols{
+
+#define UNO3_REFERENCE ::com::sun::star::uno::Reference
+#define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
+#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
+#define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel
+#define UNO3_XPROGRESSBAR ::com::sun::star::awt::XProgressBar
+#define UNO3_ANY ::com::sun::star::uno::Any
+#define UNO3_TYPE ::com::sun::star::uno::Type
+#define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
+#define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics
+#define UNO3_OUSTRING ::rtl::OUString
+#define UNO3_SIZE ::com::sun::star::awt::Size
+
+//____________________________________________________________________________________________________________
+// defines
+//____________________________________________________________________________________________________________
+
+#define SERVICENAME_PROGRESSBAR "com.sun.star.awt.XProgressBar"
+#define IMPLEMENTATIONNAME_PROGRESSBAR "stardiv.UnoControls.ProgressBar"
+#define FREESPACE 2
+#define DEFAULT_HORIZONTAL sal_True
+#define DEFAULT_BLOCKDIMENSION Size(1,1)
+#define DEFAULT_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lightgray
+#define DEFAULT_FOREGROUNDCOLOR TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x80 ) // blue
+#define DEFAULT_MINRANGE INT_MIN
+#define DEFAULT_MAXRANGE INT_MAX
+#define DEFAULT_BLOCKVALUE 1
+#define DEFAULT_VALUE DEFAULT_MINRANGE
+#define LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
+#define LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
+
+//____________________________________________________________________________________________________________
+// classes
+//____________________________________________________________________________________________________________
+
+class ProgressBar : public UNO3_XCONTROLMODEL
+ , public UNO3_XPROGRESSBAR
+ , public BaseControl
+{
+
+//____________________________________________________________________________________________________________
+// public methods
+//____________________________________________________________________________________________________________
+
+public:
+
+ //________________________________________________________________________________________________________
+ // construct/destruct
+ //________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ ProgressBar( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual ~ProgressBar();
+
+ //__________________________________________________________________________________________________________
+ // XInterface
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short increment refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso release()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL acquire() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short decrement refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso acquire()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL release() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // XTypeProvider
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // XAggregation
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XProgressBar
+ //________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL setRange( sal_Int32 nMin ,
+ sal_Int32 nMax ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual sal_Int32 SAL_CALL getValue() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // XWindow
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void SAL_CALL setPosSize( sal_Int32 nX ,
+ sal_Int32 nY ,
+ sal_Int32 nWidth ,
+ sal_Int32 nHeight ,
+ sal_Int16 nFlags ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // XControl
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //__________________________________________________________________________________________________________
+ // BaseControl
+ //__________________________________________________________________________________________________________
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ static const UNO3_SEQUENCE< UNO3_OUSTRING > impl_getStaticSupportedServiceNames();
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ static const UNO3_OUSTRING impl_getStaticImplementationName();
+
+//____________________________________________________________________________________________________________
+// protected methods
+//____________________________________________________________________________________________________________
+
+protected:
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual void impl_paint( sal_Int32 nX ,
+ sal_Int32 nY ,
+ const UNO3_REFERENCE< UNO3_XGRAPHICS >& xGraphics );
+
+ /**_________________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ void impl_recalcRange();
+
+//____________________________________________________________________________________________________________
+// private variables
+//____________________________________________________________________________________________________________
+
+private:
+
+ sal_Bool m_bHorizontal ; // orientation for steps [true=horizontal/false=vertikal]
+ UNO3_SIZE m_aBlockSize ; // width and height of a block [>=0,0]
+ sal_Int32 m_nForegroundColor ; // (alpha,r,g,b)
+ sal_Int32 m_nBackgroundColor ; // (alpha,r,g,b)
+ sal_Int32 m_nMinRange ; // lowest value = 0% [long, <_nMaxRange]
+ sal_Int32 m_nMaxRange ; // highest value = 100% [long, >_nMinRange]
+ sal_Int32 m_nBlockValue ; // value for one block [long, >0]
+ sal_Int32 m_nValue ; // value for progress [long]
+
+}; // class ProgressBar
+
+} // namespace unocontrols
+
+#endif // #ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
diff --git a/UnoControls/source/inc/progressmonitor.hxx b/UnoControls/source/inc/progressmonitor.hxx
new file mode 100644
index 000000000..a1053dc9b
--- /dev/null
+++ b/UnoControls/source/inc/progressmonitor.hxx
@@ -0,0 +1,918 @@
+/*************************************************************************
+ *
+ * $RCSfile: progressmonitor.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:11:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
+#define _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
+
+//____________________________________________________________________________________________________________
+// includes of other projects
+//____________________________________________________________________________________________________________
+
+#ifndef _COM_SUN_STAR_AWT_XFILEDIALOG_HPP_
+#include <com/sun/star/awt/XFileDialog.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTCOMPONENT_HPP_
+#include <com/sun/star/awt/XTextComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XLISTBOX_HPP_
+#include <com/sun/star/awt/XListBox.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPROGRESSMONITOR_HPP_
+#include <com/sun/star/awt/XProgressMonitor.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_
+#include <com/sun/star/awt/TextAlign.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XSCROLLBAR_HPP_
+#include <com/sun/star/awt/XScrollBar.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLERMODEL_HPP_
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMESSAGEBOX_HPP_
+#include <com/sun/star/awt/XMessageBox.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTEDITFIELD_HPP_
+#include <com/sun/star/awt/XTextEditField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_STYLE_HPP_
+#include <com/sun/star/awt/Style.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTIMEFIELD_HPP_
+#include <com/sun/star/awt/XTimeField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
+#include <com/sun/star/awt/XControlModel.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XSPINFIELD_HPP_
+#include <com/sun/star/awt/XSpinField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XUNOCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XUnoControlContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTLAYOUTCONSTRAINS_HPP_
+#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XNUMERICFIELD_HPP_
+#include <com/sun/star/awt/XNumericField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XBUTTON_HPP_
+#include <com/sun/star/awt/XButton.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTAREA_HPP_
+#include <com/sun/star/awt/XTextArea.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XIMAGEBUTTON_HPP_
+#include <com/sun/star/awt/XImageButton.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XFIXEDTEXT_HPP_
+#include <com/sun/star/awt/XFixedText.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XControlContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XDIALOG_HPP_
+#include <com/sun/star/awt/XDialog.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_SCROLLBARORIENTATION_HPP_
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XRADIOBUTTON_HPP_
+#include <com/sun/star/awt/XRadioButton.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCURRENCYFIELD_HPP_
+#include <com/sun/star/awt/XCurrencyField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPATTERNFIELD_HPP_
+#include <com/sun/star/awt/XPatternField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_VCLWINDOWPEERATTRIBUTE_HPP_
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLER_HPP_
+#include <com/sun/star/awt/XTabController.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINER_HPP_
+#include <com/sun/star/awt/XVclContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XDATEFIELD_HPP_
+#include <com/sun/star/awt/XDateField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCOMBOBOX_HPP_
+#include <com/sun/star/awt/XComboBox.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
+#include <com/sun/star/awt/XControl.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCHECKBOX_HPP_
+#include <com/sun/star/awt/XCheckBox.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_MESSAGEBOXCOMMAND_HPP_
+#include <com/sun/star/awt/MessageBoxCommand.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XLAYOUTCONSTRAINS_HPP_
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPROGRESSBAR_HPP_
+#include <com/sun/star/awt/XProgressBar.hpp>
+#endif
+
+//____________________________________________________________________________________________________________
+// includes of my own project
+//____________________________________________________________________________________________________________
+
+#ifndef _UNOCONTROLS_BASECONTAINERCONTROL_CTRL_HXX
+#include "basecontainercontrol.hxx"
+#endif
+
+//____________________________________________________________________________________________________________
+// namespace
+//____________________________________________________________________________________________________________
+
+namespace unocontrols{
+
+#define UNO3_ANY ::com::sun::star::uno::Any
+#define UNO3_OUSTRING ::rtl::OUString
+#define UNO3_RECTANGLE ::com::sun::star::awt::Rectangle
+#define UNO3_REFERENCE ::com::sun::star::uno::Reference
+#define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
+#define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
+#define UNO3_SIZE ::com::sun::star::awt::Size
+#define UNO3_TYPE ::com::sun::star::uno::Type
+#define UNO3_XACTIONLISTENER ::com::sun::star::awt::XActionListener
+#define UNO3_XBUTTON ::com::sun::star::awt::XButton
+#define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel
+#define UNO3_XFIXEDTEXT ::com::sun::star::awt::XFixedText
+#define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics
+#define UNO3_XLAYOUTCONSTRAINS ::com::sun::star::awt::XLayoutConstrains
+#define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
+#define UNO3_XPROGRESSBAR ::com::sun::star::awt::XProgressBar
+#define UNO3_XPROGRESSMONITOR ::com::sun::star::awt::XProgressMonitor
+#define UNO3_XTOOLKIT ::com::sun::star::awt::XToolkit
+#define UNO3_XWINDOWPEER ::com::sun::star::awt::XWindowPeer
+
+//____________________________________________________________________________________________________________
+// defines
+//____________________________________________________________________________________________________________
+
+#define SERVICENAME_PROGRESSMONITOR "com.sun.star.awt.XProgressMonitor"
+#define IMPLEMENTATIONNAME_PROGRESSMONITOR "stardiv.UnoControls.ProgressMonitor"
+#define FREEBORDER 10 // border around and between the controls
+#define WIDTH_RELATION 4 // reserve 1/4 for button width and rest for progressbar width
+#define HEIGHT_RELATION 5 // reserve 1/5 for button and progressbar heigth and rest for text height
+#define FIXEDTEXT_SERVICENAME "com.sun.star.awt.UnoControlFixedText"
+#define BUTTON_SERVICENAME "com.sun.star.awt.UnoControlButton"
+#define FIXEDTEXT_MODELNAME "com.sun.star.awt.UnoControlFixedTextModel"
+#define BUTTON_MODELNAME "com.sun.star.awt.UnoControlButtonModel"
+#define CONTROLNAME_TEXT "Text" // identifier the control in container
+#define CONTROLNAME_BUTTON "Button" // -||-
+#define CONTROLNAME_PROGRESSBAR "ProgressBar" // -||-
+#define DEFAULT_BUTTONLABEL "Abbrechen"
+#define DEFAULT_TOPIC "\0"
+#define DEFAULT_TEXT "\0"
+#define BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lighgray
+#define LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
+#define LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
+#define HEIGHT_PROGRESSBAR 15
+// Overwrite defines from basecontrol.hxx!!!
+#undef DEFAULT_WIDTH
+#undef DEFAULT_HEIGHT
+#define DEFAULT_WIDTH 350
+#define DEFAULT_HEIGHT 100
+
+//____________________________________________________________________________________________________________
+// structs, types
+//____________________________________________________________________________________________________________
+
+/// Item of TextList
+struct IMPL_TextlistItem
+{
+ UNO3_OUSTRING sTopic ; /// Left site of textline in dialog
+ UNO3_OUSTRING sText ; /// Right site of textline in dialog
+};
+
+/// Define a list-class for struct IMPL_TextlistItem
+class IMPL_Textlist ;
+DECLARE_LIST( IMPL_Textlist, IMPL_TextlistItem* )
+
+//____________________________________________________________________________________________________________
+// class declaration
+//____________________________________________________________________________________________________________
+
+class ProgressMonitor : public UNO3_XLAYOUTCONSTRAINS
+ , public UNO3_XBUTTON
+ , public UNO3_XPROGRESSMONITOR
+ , public BaseContainerControl
+{
+
+//____________________________________________________________________________________________________________
+// public methods
+//____________________________________________________________________________________________________________
+
+public:
+
+ //________________________________________________________________________________________________________
+ // construct/destruct
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ ProgressMonitor( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory );
+
+ /**_______________________________________________________________________________________________________
+ @short
+ @descr
+
+ @seealso
+
+ @param
+
+ @return
+
+ @onerror
+ */
+
+ virtual ~ProgressMonitor();
+
+ //________________________________________________________________________________________________________
+ // XInterface
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short give answer, if interface is supported
+ @descr The interfaces are searched by type.
+
+ @seealso XInterface
+
+ @param "rType" is the type of searched interface.
+
+ @return Any information about found interface
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short increment refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso release()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL acquire() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short decrement refcount
+ @descr -
+
+ @seealso XInterface
+ @seealso acquire()
+
+ @param -
+
+ @return -
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual void SAL_CALL release() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XTypeProvider
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short get information about supported interfaces
+ @descr -
+
+ @seealso XTypeProvider
+
+ @param -
+
+ @return Sequence of types of all supported interfaces
+
+ @onerror A RuntimeException is thrown.
+ */
+
+ virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XAggregation
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XProgressMonitor
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short add topic to dialog
+ @descr Add a topic with a text in right textlist (used for FixedText-member).<BR>
+ ( "beforeProgress" fix the right list ). The dialog metric is recalculated.
+
+ @seealso removeText(), updateText()
+
+ @param sTopic Name of topic<BR>
+ [sTopic != "" && sTopic != NULL]
+ @param sText Value of topic<BR>
+ [sText != "" && sText != NULL]
+ @param bbeforeProgress Position of topic<BR>
+ [True => before progressbar / False => below progressbar]
+
+ @return -
+
+ @onerror DEBUG = Assertion<BR>
+ RELEASE = nothing
+ */
+
+ virtual void SAL_CALL addText( const UNO3_OUSTRING& sTopic ,
+ const UNO3_OUSTRING& sText ,
+ sal_Bool bbeforeProgress ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeText( const UNO3_OUSTRING& sTopic ,
+ sal_Bool bbeforeProgress ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL updateText( const UNO3_OUSTRING& sTopic ,
+ const UNO3_OUSTRING& sText ,
+ sal_Bool bbeforeProgress ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XProgressBar
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setRange( sal_Int32 nMin ,
+ sal_Int32 nMax ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Int32 SAL_CALL getValue() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XButton
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL addActionListener( const UNO3_REFERENCE< UNO3_XACTIONLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL removeActionListener( const UNO3_REFERENCE< UNO3_XACTIONLISTENER >& xListener ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setLabel( const UNO3_OUSTRING& sLabel ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setActionCommand( const UNO3_OUSTRING& sCommand ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XLayoutConstrains
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_SIZE SAL_CALL getMinimumSize() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_SIZE SAL_CALL getPreferredSize() throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_SIZE SAL_CALL calcAdjustedSize( const UNO3_SIZE& aNewSize ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XControl
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL createPeer( const UNO3_REFERENCE< UNO3_XTOOLKIT >& xToolkit ,
+ const UNO3_REFERENCE< UNO3_XWINDOWPEER >& xParent ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XComponent
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL dispose() throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // XWindow
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void SAL_CALL setPosSize( sal_Int32 nX ,
+ sal_Int32 nY ,
+ sal_Int32 nWidth ,
+ sal_Int32 nHeight ,
+ sal_Int16 nFlags ) throw( UNO3_RUNTIMEEXCEPTION );
+
+ //________________________________________________________________________________________________________
+ // BaseControl
+ //________________________________________________________________________________________________________
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ static const UNO3_SEQUENCE< UNO3_OUSTRING > impl_getStaticSupportedServiceNames();
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ static const UNO3_OUSTRING impl_getStaticImplementationName();
+
+//____________________________________________________________________________________________________________
+// protected methods
+//____________________________________________________________________________________________________________
+
+protected:
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ virtual void impl_paint( sal_Int32 nX ,
+ sal_Int32 nY ,
+ const UNO3_REFERENCE< UNO3_XGRAPHICS >& xGraphics );
+
+//____________________________________________________________________________________________________________
+// private methods
+//____________________________________________________________________________________________________________
+
+private:
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ void impl_recalcLayout();
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ void impl_rebuildFixedText();
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ void impl_cleanMemory();
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ IMPL_TextlistItem* impl_searchTopic( const UNO3_OUSTRING& sTopic ,
+ sal_Bool bbeforeProgress );
+
+//____________________________________________________________________________________________________________
+// debug methods
+//____________________________________________________________________________________________________________
+
+private:
+
+ /**_______________________________________________________________________________________________________
+ @short -
+ @descr -
+
+ @seealso -
+
+ @param -
+
+ @return -
+
+ @onerror -
+ */
+
+ #ifdef DBG_UTIL
+
+ sal_Bool impl_debug_checkParameter( const UNO3_OUSTRING& sTopic, const UNO3_OUSTRING& sText, sal_Bool bbeforeProgress ); // addText, updateText
+ sal_Bool impl_debug_checkParameter( const UNO3_OUSTRING& rTopic, sal_Bool bbeforeProgress ); // removeText
+
+ #endif
+//____________________________________________________________________________________________________________
+// private variables
+//____________________________________________________________________________________________________________
+
+private:
+
+ IMPL_Textlist* m_pTextlist_Top ; // Elements before progress
+ UNO3_REFERENCE< UNO3_XFIXEDTEXT > m_xTopic_Top ; // (used, if parameter "beforeProgress"=sal_True in "addText, updateText, removeText")
+ UNO3_REFERENCE< UNO3_XFIXEDTEXT > m_xText_Top ;
+
+ IMPL_Textlist* m_pTextlist_Bottom ; // Elements below of progress
+ UNO3_REFERENCE< UNO3_XFIXEDTEXT > m_xTopic_Bottom ; // (used, if parameter "beforeProgress"=sal_False in "addText, updateText, removeText")
+ UNO3_REFERENCE< UNO3_XFIXEDTEXT > m_xText_Bottom ;
+
+ UNO3_REFERENCE< UNO3_XPROGRESSBAR > m_xProgressBar ;
+ UNO3_REFERENCE< UNO3_XBUTTON > m_xButton ;
+ UNO3_RECTANGLE m_a3DLine ;
+
+}; // class ProgressMonitor
+
+} // namespace unocontrols
+
+#endif // #ifndef _UNOCONTROLS_PROGRESSMONITOR_CTRL_HXX
diff --git a/UnoControls/util/makefile.mk b/UnoControls/util/makefile.mk
new file mode 100644
index 000000000..e892c7811
--- /dev/null
+++ b/UnoControls/util/makefile.mk
@@ -0,0 +1,99 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:11:18 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=UnoControls
+TARGET=ctl
+LIBTARGET=NO
+USE_LDUMP2=TRUE
+USE_DEFFILE=TRUE
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+
+# --- Files --------------------------------------------------------
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+#LIB1OBJFILES= $(SLOFILES)
+LIB1FILES= $(SLB)$/base.lib \
+ $(SLB)$/controls.lib
+
+SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= i$(TARGET)
+
+SHL1STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(TOOLSLIB)
+
+SHL1DEPN= makefile.mk
+SHL1LIBS= $(LIB1TARGET)
+#SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1EXPORTFILE= exports.dxp
+
+# --- Targets ------------------------------------------------------
+.INCLUDE : target.mk
diff --git a/UnoControls/util/makefile.pmk b/UnoControls/util/makefile.pmk
new file mode 100644
index 000000000..81bb5a88e
--- /dev/null
+++ b/UnoControls/util/makefile.pmk
@@ -0,0 +1,64 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.pmk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:11:18 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
diff --git a/UnoControls/util/target.pmk b/UnoControls/util/target.pmk
new file mode 100644
index 000000000..a0b7f8adb
--- /dev/null
+++ b/UnoControls/util/target.pmk
@@ -0,0 +1,70 @@
+#*************************************************************************
+#
+# $RCSfile: target.pmk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:11:18 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+ALLSLO: $(SLOFILES)
+
+SOSHL: $(SHL1TARGETN)
+
+WHOLEPRJ:
+ cd $(PRJ)$/prj
+ make debug linkinc prjpch compinc
+ @echo "READY"
+
diff --git a/automation/prj/d.lst b/automation/prj/d.lst
new file mode 100644
index 000000000..15414c356
--- /dev/null
+++ b/automation/prj/d.lst
@@ -0,0 +1,8 @@
+mkdir: %_DEST%\inc%_EXT%\automation
+
+..\%__SRC%\bin\sts%UPD%*.dll %_DEST%\bin%_EXT%\sts%UPD%*.dll
+..\%__SRC%\lib\libsts* %_DEST%\lib%_EXT%\*
+..\%__SRC%\lib\automation.lib %_DEST%\lib%_EXT%\automation.lib
+
+hedabu: ..\inc\automation.hxx %_DEST%\inc%_EXT%\automation\automation.hxx
+
diff --git a/automation/util/makefile.mk b/automation/util/makefile.mk
new file mode 100644
index 000000000..006eceec4
--- /dev/null
+++ b/automation/util/makefile.mk
@@ -0,0 +1,231 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:11:22 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=automation
+TARGET=automation
+#basic.hid generieren
+GEN_HID=TRUE
+
+# --- Settings ---------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.IF "$(GUI)"=="WIN"
+.IF "$(product)" != ""
+LINKFLAGS=$(LINKFLAGS) /NOPACKC
+.ENDIF
+.ENDIF
+
+.IF "$(depend)" == ""
+
+# --- Allgemein ---------------------------------------------------
+
+USE_LDUMP2=TRUE
+
+.IF "$(header)" == ""
+
+LIB1TARGET=$(SLB)$/$(TARGET).lib
+LIB1FILES= \
+ $(SLB)$/server.lib
+
+SHL1TARGET= sts$(UPD)$(DLLPOSTFIX)
+SHL1IMPLIB= $(TARGET)
+
+#SHL1STDLIBS= \
+# $(TOOLSLIB) \
+# $(SVTOOLLIB) \
+# $(SVLLIB) \
+# $(SVLIB) \
+# $(VOSLIB) \
+# $(SALLIB) \
+ $(SVMEMLIB) \
+
+
+# $(SJLIB) \
+# $(UNOTOOLSLIB)
+
+#.IF "$(GUI)"=="WNT"
+#SHL1STDLIBS+=$(LIBCIMT) \
+# $(LIBPRE) advapi32.lib \
+# $(LIBPRE) gdi32.lib
+#.ENDIF
+
+#.IF "$(SO3)" != ""
+#SHL1STDLIBS+=\
+# $(SOTLIB) \
+# $(VOSLIB)
+#.ENDIF
+
+#SHL1DEPN= $(L)$/itools.lib $(SVLIBDEPEND) $(L)$/so2.lib $(L)$/svtool.lib
+
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+
+DEF1NAME =$(SHL1TARGET)
+DEF1DEPN = \
+ $(MISC)$/$(SHL1TARGET).flt
+
+DEFLIB1NAME =$(TARGET)
+DEF1DES =TestToolServer
+
+# --- Targets -----------------------------------------------------------
+
+ALL: $(LIB1TARGET) \
+ ALLTAR
+
+
+#-------------------------------------------------------------------------
+# Windows 3.x
+#-------------------------------------------------------------------------
+
+
+.IF "$(GUI)" == "WIN"
+
+LINKFLAGS+=/NOCV /IG
+LINK=$(DEVROOT)$/bin\optlinks\optlinks
+
+$(MISC)$/$(PRJNAME).def: makefile.mk
+ echo NAME BASIC >$@
+ echo DESCRIPTION 'StarBASIC DevSystem (C)1994 STAR DIVISION GmbH'>>$@
+ echo EXETYPE WINDOWS >>$@
+ echo PROTMODE >>$@
+ echo STUB 'winSTUB.EXE' >>$@
+ echo CODE LOADONCALL MOVEABLE >>$@
+ echo DATA PRELOAD MULTIPLE MOVEABLE >>$@
+ echo HEAPSIZE 4096 >>$@
+ echo STACKSIZE 30000 >>$@
+.ENDIF # GUI == WIN
+
+#-------------------------------------------------------------------------
+# MAC
+#-------------------------------------------------------------------------
+
+.IF "$(GUI)" == "MAC"
+
+$(MISC)$/$(PRJNAME).def: makefile.mk
+ echo Kein def-File fuer Applikationen auf Mac
+.ENDIF # GUI == MAC
+
+#-------------------------------------------------------------------------
+# OS/2
+#-------------------------------------------------------------------------
+
+.IF "$(GUI)" == "OS2"
+
+$(MISC)$/$(PRJNAME).def: makefile.mk
+.IF "$(COM)"!="WTC"
+ echo NAME BASIC WINDOWAPI >$@
+ echo DESCRIPTION 'StarBASIC DevSystem (C)1993 STAR DIVISION GmbH' >>$@
+ echo EXETYPE OS2 >>$@
+ echo PROTMODE >>$@
+ echo STUB 'OS2STUB.EXE' >>$@
+ echo CODE LOADONCALL >>$@
+ echo DATA PRELOAD MULTIPLE >>$@
+ echo HEAPSIZE 4096 >>$@
+ echo STACKSIZE 30000 >>$@
+.ELSE
+ @echo option DESCRIPTION 'StarBasic DLL' >$@
+ @echo name $(BIN)$/$(SHL1TARGET).dll >>$@
+# @ldump -E1 -A -F$(MISC)$/$(SHL1TARGET).flt $(SLB)$/sb.lib >>temp.def
+ @ldump -E1 -A -F$(MISC)$/$(SHL1TARGET).flt $(LIB1TARGET) >>temp.def
+ @awk -f s:\util\exp.awk temp.def
+ del temp.def
+.ENDIF
+
+.ENDIF # GUI == OS2
+
+#-------------------------------------------------------------------------
+# Windows NT
+#-------------------------------------------------------------------------
+#
+# default targets aus target.mk
+#
+
+# --- Basic-Filter-Datei ---
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP > $@
+ @echo LIBMAIN >> $@
+ @echo LibMain >> $@
+ @echo Sbi >> $@
+ @echo exception >> $@
+ @echo bad_alloc >> $@
+ @echo __CT >> $@
+.IF "$(GUI)"=="OS2"
+ @echo __alloc >> $@
+ @echo __malloc >> $@
+.ENDIF
+
+.ENDIF
+
+# ------------------------------------------------------------------------
+.ENDIF
+
+.INCLUDE : target.mk
+
diff --git a/extensions/inc/appsettings.hxx b/extensions/inc/appsettings.hxx
new file mode 100644
index 000000000..66c421327
--- /dev/null
+++ b/extensions/inc/appsettings.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * $RCSfile: appsettings.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _APPSETTINGS_HXX
+#define _APPSETTINGS_HXX
+
+#ifndef __STARDIV_UNO_UTIL_CONTAINR_HXX__
+#include <stardiv/uno/util/containr.hxx>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+XNameContainer* getApplicationSettings();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/extensions/inc/extensio.hrc b/extensions/inc/extensio.hrc
new file mode 100644
index 000000000..6a124b87c
--- /dev/null
+++ b/extensions/inc/extensio.hrc
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * $RCSfile: extensio.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __EXTENSIONS_INC_EXTENSIO_HRC__
+#define __EXTENSIONS_INC_EXTENSIO_HRC__
+
+#include <svtools/solar.hrc>
+
+#define HID_PROTOCOLS HID_EXTENSIONS_START
+
+#define HID_BIB_CHANGESOURCE (HID_EXTENSIONS_START + 1)
+#define HID_BIB_MAPPINGDLG (HID_EXTENSIONS_START + 2)
+#define HID_BIB_TBX_TABLE (HID_EXTENSIONS_START + 3)
+#define HID_BIB_TBX_SEARCH (HID_EXTENSIONS_START + 4)
+#define HID_BIB_TBX_AUTOFILTER (HID_EXTENSIONS_START + 5)
+
+#define HID_BIB_IDENTIFIER_POS (HID_EXTENSIONS_START + 6)
+#define HID_BIB_AUTHORITYTYPE_POS (HID_EXTENSIONS_START + 7)
+#define HID_BIB_AUTHOR_POS (HID_EXTENSIONS_START + 8)
+#define HID_BIB_TITLE_POS (HID_EXTENSIONS_START + 9)
+#define HID_BIB_YEAR_POS (HID_EXTENSIONS_START + 10)
+#define HID_BIB_ISBN_POS (HID_EXTENSIONS_START + 11)
+#define HID_BIB_BOOKTITLE_POS (HID_EXTENSIONS_START + 12)
+#define HID_BIB_CHAPTER_POS (HID_EXTENSIONS_START + 13)
+#define HID_BIB_EDITION_POS (HID_EXTENSIONS_START + 14)
+#define HID_BIB_EDITOR_POS (HID_EXTENSIONS_START + 15)
+#define HID_BIB_HOWPUBLISHED_POS (HID_EXTENSIONS_START + 16)
+#define HID_BIB_INSTITUTION_POS (HID_EXTENSIONS_START + 17)
+#define HID_BIB_JOURNAL_POS (HID_EXTENSIONS_START + 18)
+#define HID_BIB_MONTH_POS (HID_EXTENSIONS_START + 19)
+#define HID_BIB_NOTE_POS (HID_EXTENSIONS_START + 20)
+#define HID_BIB_ANNOTE_POS (HID_EXTENSIONS_START + 21)
+#define HID_BIB_NUMBER_POS (HID_EXTENSIONS_START + 22)
+#define HID_BIB_ORGANIZATIONS_POS (HID_EXTENSIONS_START + 23)
+#define HID_BIB_PAGES_POS (HID_EXTENSIONS_START + 24)
+#define HID_BIB_PUBLISHER_POS (HID_EXTENSIONS_START + 25)
+#define HID_BIB_ADDRESS_POS (HID_EXTENSIONS_START + 26)
+#define HID_BIB_SCHOOL_POS (HID_EXTENSIONS_START + 27)
+#define HID_BIB_SERIES_POS (HID_EXTENSIONS_START + 28)
+#define HID_BIB_REPORTTYPE_POS (HID_EXTENSIONS_START + 29)
+#define HID_BIB_VOLUME_POS (HID_EXTENSIONS_START + 30)
+#define HID_BIB_URL_POS (HID_EXTENSIONS_START + 31)
+#define HID_BIB_CUSTOM1_POS (HID_EXTENSIONS_START + 32)
+#define HID_BIB_CUSTOM2_POS (HID_EXTENSIONS_START + 33)
+#define HID_BIB_CUSTOM3_POS (HID_EXTENSIONS_START + 34)
+#define HID_BIB_CUSTOM4_POS (HID_EXTENSIONS_START + 35)
+#define HID_BIB_CUSTOM5_POS (HID_EXTENSIONS_START + 36)
+
+#define HID_BIB_DB_TBX (HID_EXTENSIONS_START + 37)
+#define HID_BIB_DB_GRIDCTRL (HID_EXTENSIONS_START + 38)
+
+
+#endif
diff --git a/extensions/inc/ucbhelper/ext_content.hxx b/extensions/inc/ucbhelper/ext_content.hxx
new file mode 100644
index 000000000..41318f5d8
--- /dev/null
+++ b/extensions/inc/ucbhelper/ext_content.hxx
@@ -0,0 +1,401 @@
+/*************************************************************************
+ *
+ * $RCSfile: ext_content.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _UCBHELPER_CONTENT_HXX_
+#define _UCBHELPER_CONTENT_HXX_
+
+#include <rtl/string.hxx>
+#include <rtl/ustring>
+#include <osl/mutex.hxx>
+#include <osl/thread.h>
+
+#include <cppuhelper/weak.hxx>
+
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDTASKPROCESSOR_HPP_
+#include <com/sun/star/ucb/XCommandTaskProcessor.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDINFO_HPP_
+#include <com/sun/star/ucb/XCommandInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_
+#include <com/sun/star/ucb/XContent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XPROPERTYTASKPROCESSOR_HPP_
+#include <com/sun/star/ucb/XPropertyTaskProcessor.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTIDENTIFIER_HPP_
+#include <com/sun/star/ucb/XContentIdentifier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTIESCHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+
+#include <list>
+#include <hash_map>
+
+#if defined(TF_TYPE) || (SUPD >= 564)
+using namespace cppu;
+#endif
+using namespace com::sun::star::ucb;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::lang;
+using namespace std;
+using namespace rtl;
+using namespace osl;
+
+
+
+template <class Type> class safe_list : public osl::Mutex, public std::list< Type > {};
+
+class OSimpleContentIdentifier : public OWeakObject,
+ public XContentIdentifier
+{
+private:
+ OUString Identifier;
+ OUString ProviderScheme;
+
+public:
+ OSimpleContentIdentifier( const OUString& rIdentifier, const OUString& rProviderScheme );
+
+ // XInterface
+#if defined(TF_TYPE) || (SUPD >= 564)
+ virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
+#else
+ virtual sal_Bool SAL_CALL queryInterface( const Uik& type, Any& ifc ) throw( RuntimeException );
+#endif
+ virtual void SAL_CALL acquire() throw(RuntimeException);
+ virtual void SAL_CALL release() throw(RuntimeException);
+
+ // XContentIdentifier
+ virtual OUString SAL_CALL getContentIdentifier() throw(RuntimeException);
+ virtual OUString SAL_CALL getContentProviderScheme() throw(RuntimeException);
+};
+
+
+//---------------------------------------------------------------------------
+//
+// FileSystemContent
+//
+//---------------------------------------------------------------------------
+
+class OContent :
+public OWeakObject,
+public XContent,
+public XCommandTaskProcessor,
+public XPropertyTaskProcessor,
+public XCommandInfo,
+public XPropertySetInfo,
+public XComponent
+{
+public:
+ struct PropertyChangeEventInfo
+ {
+ OUString Name;
+ long Handle;
+
+ PropertyChangeEventInfo() : Handle( -1 ) {}
+
+ inline int operator ==( const PropertyChangeEventInfo& crInfo ) const
+ { return Handle == crInfo.Handle && Handle > 0 || Name == crInfo.Name; }
+ #ifdef __SUNPRO_CC
+ inline int operator <( const PropertyChangeEventInfo& crInfo ) const
+ { return Handle != crInfo.Handle ? Handle < crInfo.Handle : Name < crInfo.Name; }
+ #endif
+ };
+
+ struct PropertyChangeListenerInfo
+ {
+ Reference< XPropertiesChangeListener > xListener;
+ list< PropertyChangeEventInfo > aEventInfos;
+
+ inline int operator ==( const PropertyChangeListenerInfo& crInfo ) const
+ { return xListener == crInfo.xListener; }
+ #ifdef __SUNPRO_CC
+ inline int operator <( const PropertyChangeListenerInfo& crInfo ) const
+ { return xListener < crInfo.xListener; }
+ #endif
+ };
+
+protected:
+ Sequence< PropertyChangeEvent > matchListenerEvents( const Sequence< PropertyChangeEvent >& crEvents, const PropertyChangeListenerInfo & crInfo );
+
+ safe_list< Reference< XContentEventListener > > m_aContentListeners;
+ safe_list< Reference< XEventListener > > m_aComponentListeners;
+ safe_list< PropertyChangeListenerInfo > m_aPropertyChangeListeners;
+public:
+ virtual ~OContent() {}
+
+ virtual void broadcastContentEvent( const ContentEvent & crEvent );
+ virtual void broadcastPropertiesChangeEvents( const Sequence< PropertyChangeEvent >& crEvents );
+
+ // To be implemented by inheritents
+ virtual Any doCommand( const Command & crCommand ) = 0;
+
+ // XInterface
+#if defined(TF_TYPE) || (SUPD >= 564)
+ virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
+#else
+ virtual sal_Bool SAL_CALL queryInterface( const Uik& type, Any& ifc ) throw( RuntimeException );
+#endif
+
+ virtual void SAL_CALL acquire() throw(RuntimeException);
+ virtual void SAL_CALL release() throw(RuntimeException);
+
+ // XContent
+ virtual void SAL_CALL addContentEventListener( const Reference< XContentEventListener >& rListener ) throw();
+ virtual void SAL_CALL removeContentEventListener( const Reference< XContentEventListener >& rListener ) throw();
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw();
+ virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw();
+ virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& xListener ) throw();
+
+ // XCommmandTaskProcessor
+ virtual Reference< XCommandInfo > SAL_CALL getCommandsInfo() throw();
+
+ // XCommandInfo
+ virtual CommandInfo SAL_CALL getCommandInfoByName( const OUString& rName ) throw( UnsupportedCommandException );
+ virtual CommandInfo SAL_CALL getCommandInfoByHandle( long nHandle ) throw( UnsupportedCommandException );
+ virtual sal_Bool SAL_CALL hasCommandByName( const OUString& rName ) throw();
+ virtual sal_Bool SAL_CALL hasCommandByHandle( long nHandle ) throw();
+
+ // XPropertyTaskProcessor
+ virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() throw();
+
+ // XPropertySetInfo
+ virtual Property SAL_CALL getPropertyByName( const OUString& Name ) throw( UnknownPropertyException );
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw();
+ virtual void SAL_CALL addPropertiesChangeListener( const Sequence< OUString >& Names, const Reference< XPropertiesChangeListener >& xListener ) throw();
+ virtual void SAL_CALL removePropertiesChangeListener( const Sequence< OUString >& Names, const Reference< XPropertiesChangeListener >& xListener ) throw();
+};
+
+//---------------------------------------------------------------------------
+//
+// FolderContent
+//
+//---------------------------------------------------------------------------
+
+// supported Commands
+static const sal_Int32 OPEN = 0;
+static const sal_Int32 CLOSE = 1;
+
+class OFolderContent : public OContent
+{
+protected:
+ // Already provided children
+ safe_list< XContent > m_aChildList;
+
+ // OContent
+ virtual Any doCommand( const Command & crCommand );
+
+ // new methods, can be overloaded
+ virtual Any doOpenCommand();
+ virtual Any doCloseCommand();
+
+ // To be implemented by inheritants
+ virtual Sequence< XContent > getAllChildren() = 0;
+
+public:
+
+ // XCommmandTaskProcessor
+ virtual Reference< XCommandTask > SAL_CALL createCommandTask(const Command& rCommand, const Reference< XContentTaskEnvironment >& rEnvironment ) throw();
+
+ // XCommandInfo
+ virtual Sequence< CommandInfo > SAL_CALL getCommands() throw();
+};
+
+//---------------------------------------------------------------------------
+//
+// OContentTask
+//
+//---------------------------------------------------------------------------
+
+class OContentTask :
+public OWeakObject,
+public XContentTask
+{
+ Guard< OContent > m_aContentGuard;
+protected:
+ OContent *m_pContent;
+ Reference< XContentTaskEnvironment > m_xEnvironment;
+ ContentTaskStatus m_eStatus;
+ oslThread m_aThread;
+
+ static void executeWorker( void * );
+ virtual ContentTaskStatus setStatus( ContentTaskStatus eStatus );
+
+ // To be implemented by inheritants
+ virtual void doExecute() = 0;
+public:
+ OContentTask( const Reference< XContentTaskEnvironment >& xEnv, OContent *pContent );
+ virtual ~OContentTask();
+
+ // XInterface
+#if defined(TF_TYPE) || (SUPD >= 564)
+ virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
+#else
+ virtual sal_Bool SAL_CALL queryInterface( const Uik& type, Any& ifc ) throw( RuntimeException );
+#endif
+
+ virtual void SAL_CALL acquire() throw(RuntimeException);
+ virtual void SAL_CALL release() throw(RuntimeException);
+
+ // XContentTask
+ virtual void SAL_CALL start() throw();
+ virtual void SAL_CALL execute() throw( Exception );
+ virtual void SAL_CALL abort() throw();
+ virtual ContentTaskStatus SAL_CALL getStatus() throw();
+ virtual Reference< XContentTaskEnvironment > SAL_CALL getEnvironment() throw();
+};
+
+//---------------------------------------------------------------------------
+//
+// OCommandTask
+//
+//---------------------------------------------------------------------------
+
+class OCommandTask :
+public OContentTask,
+public XCommandTask
+{
+protected:
+ Command m_aCommand;
+ Any m_aResult;
+
+public:
+ OCommandTask( const Reference< XContentTaskEnvironment >& xEnv, OContent *pContent, const Command& rCommand );
+ virtual ~OCommandTask();
+
+ virtual void doExecute();
+
+ // XInterface
+#if defined(TF_TYPE) || (SUPD >= 564)
+ virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
+#else
+ virtual sal_Bool SAL_CALL queryInterface( const Uik& type, Any& ifc ) throw( RuntimeException );
+#endif
+ virtual void SAL_CALL acquire() throw(RuntimeException);
+ virtual void SAL_CALL release() throw(RuntimeException);
+
+ // XContentTask
+ virtual void SAL_CALL start() throw();
+ virtual void SAL_CALL execute() throw( Exception );
+ virtual void SAL_CALL abort() throw();
+ virtual ContentTaskStatus SAL_CALL getStatus() throw();
+ virtual Reference< XContentTaskEnvironment > SAL_CALL getEnvironment() throw();
+
+ // XCommandTask
+ virtual Command SAL_CALL getCommand() throw();
+ virtual Any SAL_CALL getResult() throw();
+};
+
+//---------------------------------------------------------------------------
+//
+// OPropertyTask
+//
+//---------------------------------------------------------------------------
+
+class OPropertyTask :
+public OContentTask,
+public XPropertyTask
+{
+protected:
+ Sequence< PropertyValueInfo > m_aProperties;
+ PropertyTaskType m_eType;
+public:
+ OPropertyTask(const Reference< XContentTaskEnvironment >& Environment, OContent *pContent, const Sequence< PropertyValue >& Properties, PropertyTaskType Type );
+ virtual ~OPropertyTask();
+
+ virtual void doExecute();
+
+ // To be implemented by inheritants
+ virtual Any setPropertyValue( PropertyValueInfo & rProperty ) = 0;
+ virtual void getPropertyValue( PropertyValueInfo & rProperty ) = 0;
+
+ // XInterface
+#if defined(TF_TYPE) || (SUPD >= 564)
+ virtual Any SAL_CALL queryInterface( const Type &type ) throw( RuntimeException );
+#else
+ virtual sal_Bool SAL_CALL queryInterface( const Uik& type, Any& ifc ) throw( RuntimeException );
+#endif
+ virtual void SAL_CALL acquire() throw(RuntimeException);
+ virtual void SAL_CALL release() throw(RuntimeException);
+
+ // XContentTask
+ virtual void SAL_CALL start() throw();
+ virtual void SAL_CALL execute() throw( Exception );
+ virtual void SAL_CALL abort() throw();
+ virtual ContentTaskStatus SAL_CALL getStatus() throw();
+ virtual Reference< XContentTaskEnvironment > SAL_CALL getEnvironment() throw();
+
+ // XPropertyTask
+ PropertyTaskType SAL_CALL getType() throw();
+ Sequence< PropertyValueInfo > SAL_CALL getProperties() throw();
+};
+
+#endif // _UCBHELPER_CONTENT_HXX_
+
+
diff --git a/extensions/prj/d.lst b/extensions/prj/d.lst
new file mode 100644
index 000000000..23be9a44a
--- /dev/null
+++ b/extensions/prj/d.lst
@@ -0,0 +1,7 @@
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
+..\%__SRC%\class\*.jar %_DEST%\bin%_EXT%\*.jar
+..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so
+..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl
+..\%__SRC%\bin\*.bin %_DEST%\bin%_EXT%\*.bin
+..\%__SRC%\misc\*.hid %_DEST%\bin%_EXT%\*.hid
+..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
diff --git a/extensions/source/bibliography/bib.hrc b/extensions/source/bibliography/bib.hrc
new file mode 100644
index 000000000..d9e0352fd
--- /dev/null
+++ b/extensions/source/bibliography/bib.hrc
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * $RCSfile: bib.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef BIB_HRC
+#define BIB_HRC
+
+#include <svtools/solar.hrc>
+
+#ifndef RID_BIB_START
+#define RID_BIB_START RID_EXTENSIONS_START
+#endif
+
+// ResIDs
+
+//Dialogs (100)
+#define RID_BIB_DIALOG (RID_BIB_START)
+#define RID_TP_GENERAL (RID_BIB_DIALOG)
+#define RID_DLG_MAPPING (RID_BIB_DIALOG + 1)
+#define RID_DLG_DBCHANGE (RID_BIB_DIALOG + 2)
+
+//Controls(100)
+#define RID_BIB_CONTROLS (RID_BIB_START + 100)
+#define RID_BIB_BMPEXPANDER (RID_BIB_CONTROLS)
+#define RID_BIB_TOOLBAR (RID_BIB_CONTROLS+ 1)
+
+//Menu(100)
+#define RID_BIB_MENU (RID_BIB_CONTROLS + 100)
+#define RID_MAIN_MENU (RID_BIB_MENU +1)
+//#define RID_MAIN_ME_HIERARCHICAL (RID_BIB_MENU +2)
+#define RID_MAIN_ME_NEWENTRY (RID_BIB_MENU +3)
+#define RID_MAIN_ME_CHANGEENTRY (RID_BIB_MENU +4)
+#define RID_MAIN_ME_REMOVEENTRY (RID_BIB_MENU +5)
+#define RID_MAIN_ME_SEARCH (RID_BIB_MENU +6)
+#define RID_MAIN_ME_FIELDDLG (RID_BIB_MENU +7)
+//#define RID_MAIN_ME_LAYOUT (RID_BIB_MENU +8)
+#define RID_MAIN_ME_MAPPING (RID_BIB_MENU +9)
+#define RID_MAIN_ME_DBSOURCE (RID_BIB_MENU +10)
+
+#define RID_POPUP_ME_VIEW (RID_BIB_MENU +50)
+
+// Strings (500)
+#define RID_BIB_STRING (RID_BIB_START + 200)
+#define RID_BIB_STR_SECTION (RID_BIB_STRING + 1)
+#define RID_BIB_STR_FIELDSELECTION (RID_BIB_STRING + 2)
+#define RID_BIB_STR_TABWIN_PREFIX (RID_BIB_STRING + 3)
+#define RID_BIB_STR_FRAME_TITLE (RID_BIB_STRING + 4)
+#define RID_MAP_QUESTION (RID_BIB_STRING + 5)
+
+// HelpIDs *** nicht bestaetigt ***
+#ifndef HID_BIB_START
+#define HID_BIB_START 5000
+#define HID_DLG_MAPPING (HID_BIB_START + 1)
+#define HID_DLG_DBCHANGE (HID_BIB_START + 2)
+#define HID_SELECTION_TLB (HID_BIB_START + 3)
+#endif
+
+#endif
diff --git a/extensions/source/bibliography/bib.src b/extensions/source/bibliography/bib.src
new file mode 100644
index 000000000..4c60d72fe
--- /dev/null
+++ b/extensions/source/bibliography/bib.src
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * $RCSfile: bib.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "bib.hrc"
+
+ImageList RID_BIB_BMPEXPANDER
+{
+ ImageBitmap = Bitmap { File = "expander.bmp" ; };
+ IdList = { 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 ; 8 ; 9 ; };
+ IdCount = { 9 ; };
+};
+
+String RID_BIB_STR_SECTION
+{
+ Text = "Abschnitt";
+ Text [ ENGLISH ] = "Section" ;
+ Text[ english_us ] = "Section";
+ Text[ portuguese ] = "Secção";
+ Text[ russian ] = "Ðàçäåë";
+ Text[ greek ] = "ÔïìÝáò";
+ Text[ dutch ] = "Sectie";
+ Text[ french ] = "Section";
+ Text[ spanish ] = "Sección";
+ Text[ italian ] = "Sezione";
+ Text[ danish ] = "Sektion";
+ Text[ swedish ] = "Avsnitt";
+ Text[ polish ] = "Sekcja";
+ Text[ portuguese_brazilian ] = "Section";
+ Text[ japanese ] = "¾¸¼®Ý";
+ Text[ korean ] = "±¸¿ª";
+ Text[ chinese_simplified ] = "¶ÎÂä";
+ Text[ chinese_traditional ] = "°Ï¬q";
+ Text[ arabic ] = "äØÇÞ";
+ Text[ turkish ] = "Bölüm";
+};
+
+String RID_BIB_STR_FIELDSELECTION
+{
+ Text = "Feldauswahl:" ;
+ Text [ English ] = "Fieldselection:" ;
+ Text[ english_us ] = "Field selection:";
+ Text[ portuguese ] = "Selecção de campo:";
+ Text[ russian ] = "Âûáîð ïîëÿ:";
+ Text[ greek ] = "ÅðéëïãÞ ðåäßïõ:";
+ Text[ dutch ] = "Veldselectie:";
+ Text[ french ] = "Sélection de champ :";
+ Text[ spanish ] = "Selección de campo:";
+ Text[ italian ] = "Selezione campo:";
+ Text[ danish ] = "Feltudvalg:";
+ Text[ swedish ] = "Fälturval:";
+ Text[ polish ] = "Wybór pola:";
+ Text[ portuguese_brazilian ] = "Fieldselection:";
+ Text[ japanese ] = "̨°ÙÄÞ‘I‘ð:";
+ Text[ korean ] = "ÇÊµå ¼±ÅÃ:";
+ Text[ chinese_simplified ] = "ÇøÓòÑ¡Ôñ£º";
+ Text[ chinese_traditional ] = "¿ï¾ÜÄæ¦ì¡G";
+ Text[ arabic ] = "ÇÎÊíÇÑ ÇáÍÞá:";
+ Text[ turkish ] = "Alan seçimi:";
+ Text[ language_user1 ] = " ";
+};
+
+String RID_BIB_STR_TABWIN_PREFIX
+{
+ Text = "Tabelle;Abfrage;Sql;Sql [Native]" ;
+ Text [ English ] = "Table;Query;Sql;Sql [Native]" ;
+ Text[ english_us ] = "Table;Query;Sql;Sql [Native]";
+ Text[ portuguese ] = "Tabela; Consulta; Sql;Sql [Native]";
+ Text[ russian ] = "Òàáëèöà;Çàïðîñ;Sql;Sql [Native]";
+ Text[ greek ] = "Ðßíáêáò;Åñþôçìá;Sql;Sql [Native]";
+ Text[ dutch ] = "Tabel;Query;Sql;Sql [Native]";
+ Text[ french ] = "Table;Requête;Sql;Sql [Natif]";
+ Text[ spanish ] = "Tabla;Consulta;Sql;Sql [Native]";
+ Text[ italian ] = "Tabella;Ricerca;Sql;Sql [native]";
+ Text[ danish ] = "Tabel;Forespørgsel;Sql;Sql [native]";
+ Text[ swedish ] = "Tabell;Sökning;Sql;Sql [Native]";
+ Text[ polish ] = "Tabela;Kwerenda;Sql;Sql [Native]";
+ Text[ portuguese_brazilian ] = "Table;Query;Sql;Sql [Native]";
+ Text[ japanese ] = "ðÌÞÙ;¸´Ø°;Sql;Sql [Native]";
+ Text[ korean ] = "Å×À̺í;ÁúÀÇ;Sql;Sql [Native]";
+ Text[ chinese_simplified ] = "±í¸ñ;²éѯ;Sql;Sql [Native]";
+ Text[ chinese_traditional ] = "ªí®æ;¬d¸ß;Sql;Sql [Native]";
+ Text[ arabic ] = "ÌÏæá;ÇÓÊÝÓÇÑ;Sql;Sql [Native]";
+ Text[ turkish ] = "Tablo;Sorgu;Sql;Sql [Native]";
+};
+String RID_BIB_STR_FRAME_TITLE
+{
+ Text = "Literaturdatenbank" ;
+ Text [ English ] = "Bibliography database" ;
+ Text[ english_us ] = "Bibliography Database";
+ Text[ portuguese ] = "Base de dados bibliográfica";
+ Text[ russian ] = "Áàçà äàííûõ áèáëèîãðàôèè";
+ Text[ greek ] = "ÂÜóç äåäïìÝíùí âéâëéïãñáößáò";
+ Text[ dutch ] = "Literatuurdatabase";
+ Text[ french ] = "Base de données bibliographique";
+ Text[ spanish ] = "Base de datos bibliográfica";
+ Text[ italian ] = "Database bibliografico";
+ Text[ danish ] = "Litteraturdatabase";
+ Text[ swedish ] = "Litteraturdatabas";
+ Text[ polish ] = "Bibliograficzna baza danych";
+ Text[ portuguese_brazilian ] = "Bibliography database";
+ Text[ japanese ] = "‘ ‘ŠÇ—ÃÞ°ÀÍÞ°½";
+ Text[ korean ] = "Âü°í¹®Çå µ¥ÀÌÅͺ£À̽º";
+ Text[ chinese_simplified ] = "ÎÄÏ×Êý¾Ý¿â";
+ Text[ chinese_traditional ] = "¤åÄm¸ê®Æ®w";
+ Text[ arabic ] = "ÞÇÚÏÉ ÈíÇäÇÊ ÇáãÑÇÌÚ";
+ Text[ turkish ] = "Kaynakça veritabaný";
+};
+String RID_MAP_QUESTION
+{
+ Text = "Möchten Sie die Spaltenzuordnung bearbeiten?" ;
+ Text [ English ] = "Dow you want to edit the column arrangement" ;
+ Text[ english_us ] = "Do you want to edit the column arrangement?";
+ Text[ portuguese ] = "Editar disposição de colunas?";
+ Text[ russian ] = "Âû õîòèòå èçìåíèòü ðàçìåùåíèå êîëîíîê?";
+ Text[ greek ] = "ÈÝëåôå íá ãßíåé åðåîåñãáóßá ôçò áíôéóôïß÷éóçò óôçëþí;";
+ Text[ dutch ] = "Wilt u de kolomindeling veranderen?";
+ Text[ french ] = "Souhaitez-vous éditer l'assignation des colonnes ?";
+ Text[ spanish ] = "¿Desea modificar el orden de las columnas?";
+ Text[ italian ] = "Volete modificare l'ordine delle colonne?";
+ Text[ danish ] = "Vil du redigere kolonnetildelingen?";
+ Text[ swedish ] = "Vill Du redigera kolumntilldelningen?";
+ Text[ polish ] = "Chcesz edytowaæ przyporz¹dkowanie kolumn?";
+ Text[ portuguese_brazilian ] = "Dow you want to edit the column arrangement";
+ Text[ japanese ] = "—ñ‚Ì•ª—Þ‚ð•ÒW‚µ‚Ü‚·‚©?";
+ Text[ korean ] = "¿­ ¹è¿­À» ÆíÁýÇϽðڽÀ´Ï±î?";
+ Text[ chinese_simplified ] = "ÄúÒª±à¼­ÁеÄÅÅÁÐ˳Ðò£¿";
+ Text[ chinese_traditional ] = "±z­n½s±ÆÄæ¡H";
+ Text[ arabic ] = "åá ÊÑíÏ ÊÍÑíÑ ÊÚííä ÇáÚãæÏ¿";
+ Text[ turkish ] = "Sütunlarý düzenlemek istiyor musunuz?";
+};
diff --git a/extensions/source/bibliography/bibbeam.cxx b/extensions/source/bibliography/bibbeam.cxx
new file mode 100644
index 000000000..af3862519
--- /dev/null
+++ b/extensions/source/bibliography/bibbeam.cxx
@@ -0,0 +1,309 @@
+/*************************************************************************
+ *
+ * $RCSfile: bibbeam.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+#ifndef _TOOLKIT_UNOHLP_HXX
+#include <toolkit/helper/vclunohelper.hxx>
+#endif
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
+#include <com/sun/star/awt/PosSize.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_
+#include <com/sun/star/frame/XDispatch.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
+#include <com/sun/star/util/XURLTransformer.hpp>
+#endif
+
+#include <svtools/iniprop.hxx>
+#include <svtools/iniman.hxx>
+#include <extensio.hrc>
+
+#ifndef _SV_LSTBOX_HXX //autogen wg. form::component::ListBox
+#include <vcl/lstbox.hxx>
+#endif
+
+#ifndef _SV_EDIT_HXX //autogen wg. Edit
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX //autogen wg. DBG_ASSERT
+#include <tools/debug.hxx>
+#endif
+
+#include "bibbeam.hxx"
+#include "toolbar.hrc"
+#include "bibresid.hxx"
+#include "datman.hxx"
+
+using namespace rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+
+#define PROPERTY_FRAME 1
+#define ID_TOOLBAR 1
+#define ID_GRIDWIN 2
+#define ID_ALPHAWIN 3
+
+rtl::OUString gGridModelCommand( OUString::createFromAscii(".uno:Bib/newGridModel"));
+
+BibGridwin::BibGridwin(Window* pParent, WinBits nStyle):
+ DockingWindow(pParent,nStyle)
+{
+ aCtrContainer = VCLUnoHelper::CreateControlContainer(this);
+}
+
+BibGridwin::~BibGridwin()
+{
+}
+
+void BibGridwin::Resize()
+{
+ if(xGridWinRef.is())
+ {
+ ::Size aSize = GetOutputSizePixel();
+ xGridWinRef->setPosSize(0, 0, aSize.Width(),aSize.Height(), PosSize::SIZE);
+ }
+}
+void BibGridwin::createGridWin(const uno::Reference< XControlModel > & xGModel)
+{
+ xGridModel=xGModel;
+
+ if( aCtrContainer.is())
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+
+ if ( xGridModel.is() && xMgr.is())
+ {
+ uno::Reference< XPropertySet > xPropSet( xGridModel, UNO_QUERY );
+
+ if ( xPropSet.is() && xGridModel.is() )
+ {
+ uno::Any aAny = xPropSet->getPropertyValue( C2U("DefaultControl") );
+ rtl::OUString aControlName;
+ aAny >>= aControlName;
+
+ xControl=uno::Reference< XControl > (xMgr->createInstance( aControlName ), UNO_QUERY );
+ if ( xControl.is() )
+ {
+ xControl->setModel( xGridModel);
+ }
+ }
+
+ if ( xControl.is() )
+ {
+ // Peer als Child zu dem FrameWindow
+ aCtrContainer->addControl(C2U("Bla"), xControl);
+ xGridWinRef=uno::Reference< XWindow > (xControl, UNO_QUERY );
+ xGridWinRef->setVisible( sal_True );
+ xControl->setDesignMode(sal_False);
+ ::Size aSize = GetOutputSizePixel();
+ xGridWinRef->setPosSize(0, 0, aSize.Width(),aSize.Height(), PosSize::POSSIZE);
+// Window* pWindow = ::GetWindow( xGridWinRef );
+// pWindow->SetHelpId(HID_BIB_DB_GRIDCTRL);
+
+ }
+ }
+ }
+}
+
+void BibGridwin::disposeGridWin()
+{
+ if ( xControl.is() )
+ {
+ aCtrContainer->removeControl(xControl);
+ xControl->dispose();
+ }
+}
+
+void BibGridwin::changeGridModel(const uno::Reference< XControlModel > & xGModel)
+{
+ xGridModel=xGModel;
+
+ if ( xControl.is() )
+ {
+ xControl->setModel( xGridModel);
+ }
+}
+
+
+void BibGridwin::statusChanged(const frame::FeatureStateEvent& rEvt)throw( uno::RuntimeException )
+{
+ if(rEvt.FeatureURL.Complete == gGridModelCommand)
+ {
+ if(IsEnabled() != rEvt.IsEnabled) Enable(rEvt.IsEnabled);
+
+ uno::Any aModel=rEvt.State;
+ if(aModel.getValueType()==::getCppuType((Reference< XControlModel>*)0))
+ {
+ uno::Reference< XControlModel > xGModel=*(uno::Reference< XControlModel > *) aModel.getValue();
+ changeGridModel(xGModel);
+ }
+ }
+};
+
+
+
+
+BibBeamer::BibBeamer(Window* pParent,BibDataManager* pDM, WinBits nStyle):
+ SplitWindow(pParent,nStyle|WB_NOSPLITDRAW),
+ pDatMan(pDM),
+ pToolBar (NULL),
+ pGridWin (NULL),
+ pAlphaWin(NULL)
+{
+ createToolBar();
+ createGridWin();
+ createAlphaWin();
+ pDatMan->SetToolbar(pToolBar);
+ pDatMan->SetGridWin(pGridWin);
+}
+
+BibBeamer::~BibBeamer()
+{
+ if ( xToolBarRef.is() ) xToolBarRef->dispose();
+ if ( xGridRef.is() ) xGridRef->dispose();
+ if ( xAlphaRef.is() ) xAlphaRef->dispose();
+
+
+ if(pToolBar)
+ {
+ if(pDatMan)
+ {
+ pDatMan->SetToolbar(0);
+ pDatMan->SetGridWin(0);
+ }
+
+ delete pToolBar;
+ }
+
+ if(pGridWin)
+ {
+ pGridWin->disposeGridWin();
+// delete pGridWin;
+ xpGridWin = 0;
+ }
+
+ if(pAlphaWin) delete pAlphaWin;
+}
+
+void BibBeamer::createToolBar()
+{
+ pToolBar= new BibToolBar(this);
+ ::Size aSize=pToolBar->GetSizePixel();
+ InsertItem(ID_TOOLBAR, pToolBar, aSize.Height(), 0, 0, SWIB_FIXED );
+ if(xController.is()) pToolBar->SetXController(xController);
+}
+void BibBeamer::createGridWin()
+{
+ xpGridWin = pGridWin= new BibGridwin(this,0);
+
+ InsertItem(ID_GRIDWIN, pGridWin, 40, 1, 0, SWIB_RELATIVESIZE );
+
+
+ pGridWin->createGridWin(pDatMan->createGridModel());
+}
+
+void BibBeamer::createAlphaWin()
+{
+}
+
+void BibBeamer::SetXController(const uno::Reference< frame::XController > & xCtr)
+{
+ xController=xCtr;
+
+ if(xController.is())
+ {
+ uno::Reference< frame::XDispatch > xDisp(xController, UNO_QUERY);
+ uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+ uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY );
+ if( xTrans.is() && xDisp.is())
+ {
+ util::URL aURL;
+ aURL.Complete =gGridModelCommand;
+
+ xTrans->parseStrict( aURL );
+ xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pGridWin),aURL);
+ }
+ }
+
+ if(pToolBar)
+ {
+ pToolBar->SetXController(xController);
+ }
+
+}
+
+
diff --git a/extensions/source/bibliography/bibbeam.hxx b/extensions/source/bibliography/bibbeam.hxx
new file mode 100644
index 000000000..0e1c3962b
--- /dev/null
+++ b/extensions/source/bibliography/bibbeam.hxx
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * $RCSfile: bibbeam.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef ADRBEAM_HXX
+#define ADRBEAM_HXX
+
+#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XControlContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
+#include <com/sun/star/awt/XControl.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
+#include <com/sun/star/awt/XControlModel.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_
+#include <com/sun/star/form/XForm.hpp>
+#endif
+
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#endif
+
+#ifndef _SV_SPLITWIN_HXX
+#include <vcl/splitwin.hxx>
+#endif
+
+
+#ifndef _BIB_TOOLBAR_HXX
+#include "toolbar.hxx"
+#endif
+
+extern rtl::OUString gGridModelCommand;
+
+class BibDataManager;
+
+class BibGridwin: public DockingWindow,
+ public cppu::WeakImplHelper1 < ::com::sun::star::frame::XStatusListener>
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xGridWinRef;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xForm;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xGridModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > xControl;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > aCtrContainer;
+
+protected:
+
+ void Resize();
+
+public:
+
+ BibGridwin(Window* pParent, WinBits nStyle = 0 );
+ ~BibGridwin();
+
+ void createGridWin(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & xDbForm);
+ void changeGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & xGModel);
+ void disposeGridWin();
+
+ // ::com::sun::star::lang::XEventListener
+ // we do not hold References to dispatches, so there is nothing to do on disposal
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source)
+ throw( ::com::sun::star::uno::RuntimeException ){};
+
+ // ::com::sun::star::frame::XStatusListener
+ virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+};
+
+
+class BibBeamer: public SplitWindow
+{
+ private:
+
+ BibDataManager* pDatMan;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > xController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xForm;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xToolBarRef;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xGridRef;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xAlphaRef;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xToolBarWinRef;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xGridWinRef;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xAlphaWinRef;
+
+ BibToolBar* pToolBar;
+ BibGridwin* pGridWin;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener> xpGridWin;
+ DockingWindow* pAlphaWin;
+
+ protected:
+
+ void createToolBar();
+ void createGridWin();
+ void createAlphaWin();
+
+ public:
+
+ BibBeamer(Window* pParent,BibDataManager* pDatMan, WinBits nStyle = 0 );
+ ~BibBeamer();
+
+ void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &);
+};
+
+
+
+
+#endif
diff --git a/extensions/source/bibliography/bibcont.cxx b/extensions/source/bibliography/bibcont.cxx
new file mode 100644
index 000000000..59f697ae1
--- /dev/null
+++ b/extensions/source/bibliography/bibcont.cxx
@@ -0,0 +1,372 @@
+/*************************************************************************
+ *
+ * $RCSfile: bibcont.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <osl/mutex.hxx>
+#include <tools/urlobj.hxx>
+#include <cppuhelper/weak.hxx>
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+#include <toolkit/helper/vclunohelper.hxx>
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOWPEER_HPP_
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
+#include <com/sun/star/util/XURLTransformer.hpp>
+#endif
+
+
+#include <svtools/iniprop.hxx>
+#include <svtools/iniman.hxx>
+
+#include "datman.hxx"
+#include "bibcont.hxx"
+
+using namespace vos;
+using namespace osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+using namespace ::rtl;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+#define PROPERTY_FRAME 1
+
+
+BibWindowContainer::BibWindowContainer( Window* pParent,WinBits nStyle):
+ DockingWindow(pParent,nStyle),
+ pChild(NULL)
+{
+}
+
+BibWindowContainer::BibWindowContainer( Window* pParent,Window* pWin, WinBits nStyle):
+ DockingWindow(pParent,nStyle),
+ pChild(pWin)
+{
+ if(pChild!=NULL)
+ {
+ pChild->SetParent(this);
+ pChild->Show();
+ pChild->SetPosPixel(Point(0,0));
+ }
+}
+
+BibWindowContainer::~BibWindowContainer()
+{
+ if(pChild!=NULL) delete pChild;
+}
+
+void BibWindowContainer::Resize()
+{
+ ::Size aSize=GetOutputSizePixel();
+ if(pChild!=NULL) pChild->SetSizePixel(aSize);
+}
+
+void BibWindowContainer::SetChild(Window* pWin)
+{
+ pChild=pWin;
+ if(pChild!=NULL)
+ {
+ pChild->SetParent(this);
+ pChild->Show();
+ pChild->SetPosPixel(Point(0,0));
+ }
+}
+
+
+
+BibBookContainer::BibBookContainer(Window* pParent,BibDataManager* pDtMn, WinBits nStyle):
+ SplitWindow(pParent,nStyle),
+ pDatMan(pDtMn),
+ pTopWin(NULL),
+ pBottomWin(NULL),
+ bFirstTime(sal_True)
+{
+ pBibMod = OpenBibModul();
+ aTimer.SetTimeoutHdl(LINK( this, BibBookContainer, SplitHdl));
+ aTimer.SetTimeout(400);
+}
+
+BibBookContainer::~BibBookContainer()
+{
+ if ( xTopFrameRef.is() )
+ xTopFrameRef->dispose();
+ if ( xBottomFrameRef.is() )
+ xBottomFrameRef->dispose();
+
+ if(pTopWin)
+ delete pTopWin;
+ if(pBottomWin)
+ delete pBottomWin;
+ CloseBibModul(pBibMod);
+}
+
+void BibBookContainer::Split()
+{
+ aTimer.Start();
+}
+IMPL_LINK( BibBookContainer, SplitHdl, Timer*,pT)
+{
+ long nSize= GetItemSize( TOP_WINDOW);
+ pDatMan->setBeamerSize(nSize);
+ nSize= GetItemSize( BOTTOM_WINDOW);
+ pDatMan->setViewSize(nSize);
+ return 0;
+}
+
+
+uno::Reference < awt::XWindowPeer> BibBookContainer::GetTopComponentInterface( sal_Bool bCreate)
+{
+ return pTopWin->GetComponentInterface(bCreate);
+}
+void BibBookContainer::SetTopComponentInterface( awt::XWindowPeer* pIFace )
+{
+ pTopWin->SetComponentInterface(pIFace);
+}
+
+uno::Reference < awt::XWindowPeer > BibBookContainer::GetBottomComponentInterface( sal_Bool bCreate)
+{
+ return pBottomWin->GetComponentInterface(bCreate);
+}
+void BibBookContainer::SetBottomComponentInterface( awt::XWindowPeer* pIFace )
+{
+ pBottomWin->SetComponentInterface(pIFace);
+}
+
+/*VCLXWindow* BibBookContainer::GetTopWindowPeer()
+{
+ return pTopWin->GetWindowPeer();
+}
+*//*void BibBookContainer::SetTopWindowPeer( VCLXWindow* pPeer )
+{
+ pTopWin->SetWindowPeer(pPeer );
+}
+*/
+/*VCLXWindow* BibBookContainer::GetBottomWindowPeer()
+{
+ return pBottomWin->GetWindowPeer();
+}
+*//*void BibBookContainer::SetBottomWindowPeer( VCLXWindow* pPeer )
+{
+ pBottomWin->SetWindowPeer(pPeer );
+}
+*/
+
+void BibBookContainer::CreateTopWin()
+{
+ if ( xTopFrameRef.is() ) xTopFrameRef->dispose();
+
+ if(pTopWin)
+ {
+ RemoveItem(TOP_WINDOW);
+ delete pTopWin;
+ }
+
+ pTopWin= new DockingWindow(this,0);
+
+ long nSize=pDatMan->getBeamerSize();
+ InsertItem(TOP_WINDOW, pTopWin, nSize, 0, 0, SWIB_PERCENTSIZE );
+
+}
+
+void BibBookContainer::CreateBottomWin()
+{
+
+ if ( xBottomFrameRef.is() ) xBottomFrameRef->dispose();
+
+ if(pBottomWin)
+ {
+ RemoveItem(BOTTOM_WINDOW);
+ delete pBottomWin;
+ }
+
+ pBottomWin= new DockingWindow(this,0);
+ long nSize=pDatMan->getViewSize();
+ InsertItem(BOTTOM_WINDOW, pBottomWin, nSize, 1, 0, SWIB_PERCENTSIZE );
+
+}
+
+void BibBookContainer::createTopFrame(const ::rtl::OUString & rURL )
+{
+ uno::Reference< frame::XFrame > xNewFrame;
+
+ CreateTopWin();
+
+ xTopPeerRef=uno::Reference< awt::XWindow > (GetTopComponentInterface(), UNO_QUERY );
+
+ uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+
+ xNewFrame = uno::Reference< frame::XFrame > ( xMgr->createInstance( C2U("com.sun.star.frame.Frame") ), UNO_QUERY );
+ uno::Reference< frame::XDispatchProvider > xDSP( xNewFrame, UNO_QUERY );
+ if( xDSP.is() )
+ {
+ xNewFrame->initialize( xTopPeerRef);
+
+ // optional:
+ //xFrame->setName( C2U("WhatYouWant") );
+
+ uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY );
+ if( xTrans.is() )
+ {
+ // Datei laden
+ util::URL aURL;
+ aURL.Complete = rURL;
+
+ xTrans->parseStrict( aURL );
+
+ uno::Reference< frame::XDispatch > xDisp = xDSP->queryDispatch( aURL, C2U("_self"), FrameSearchFlag::SELF );
+ if ( xDisp.is() )
+ xDisp->dispatch( aURL, uno::Sequence<beans::PropertyValue>() );
+ }
+ }
+
+ // set the frame
+ {
+ MutexGuard aGuard(Mutex::getGlobalMutex());
+ xTopFrameRef = xNewFrame;
+ }
+
+}
+
+void BibBookContainer::createBottomFrame(const ::rtl::OUString & rURL )
+{
+ uno::Reference< frame::XFrame > xNewFrame;
+
+ CreateBottomWin();
+
+ xBottomPeerRef=uno::Reference< awt::XWindow > (GetBottomComponentInterface(), UNO_QUERY );
+
+ uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+
+ xNewFrame = uno::Reference< frame::XFrame > ( xMgr->createInstance( C2U("com.sun.star.frame.Frame") ), UNO_QUERY );
+ uno::Reference< frame::XDispatchProvider > xDSP( xNewFrame, UNO_QUERY );
+ if( xDSP.is() )
+ {
+ xNewFrame->initialize( xBottomPeerRef);
+
+ // optional:
+ //xFrame->setName( C2U("WhatYouWant") );
+
+ uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY );
+ if( xTrans.is() )
+ {
+ // Datei laden
+ util::URL aURL;
+ aURL.Complete = rURL;
+
+ xTrans->parseStrict( aURL );
+
+ uno::Reference< frame::XDispatch > xDisp = xDSP->queryDispatch( aURL, ::rtl::OUString(), FrameSearchFlag::SELF );
+ if ( xDisp.is() )
+ xDisp->dispatch( aURL, uno::Sequence<beans::PropertyValue>() );
+ }
+ }
+
+ // set the frame
+ {
+ MutexGuard aGuard(Mutex::getGlobalMutex());
+ xBottomFrameRef = xNewFrame;
+ }
+
+}
+
+void BibBookContainer::createTopFrame(Window* pWin)
+{
+ if ( xTopFrameRef.is() ) xTopFrameRef->dispose();
+
+ if(pTopWin)
+ {
+ RemoveItem(TOP_WINDOW);
+ delete pTopWin;
+ }
+ pTopWin=new BibWindowContainer(this,pWin);
+
+ long nSize=pDatMan->getBeamerSize();
+ InsertItem(TOP_WINDOW, pTopWin, nSize, 1, 0, SWIB_PERCENTSIZE );
+
+}
+
+void BibBookContainer::createBottomFrame(Window* pWin)
+{
+ if ( xBottomFrameRef.is() ) xBottomFrameRef->dispose();
+
+ if(pBottomWin)
+ {
+ RemoveItem(BOTTOM_WINDOW);
+ delete pBottomWin;
+ }
+
+ pBottomWin=new BibWindowContainer(this,pWin);
+
+ long nSize=pDatMan->getViewSize();
+ InsertItem(BOTTOM_WINDOW, pBottomWin, nSize, 1, 0, SWIB_PERCENTSIZE );
+
+}
+
diff --git a/extensions/source/bibliography/bibcont.hxx b/extensions/source/bibliography/bibcont.hxx
new file mode 100644
index 000000000..ded9d64bc
--- /dev/null
+++ b/extensions/source/bibliography/bibcont.hxx
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * $RCSfile: bibcont.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef ADDRCONT_HXX
+#define ADDRCONT_HXX
+
+#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
+#include <com/sun/star/frame/XFrame.hpp>
+#endif
+
+#ifndef _SV_SPLITWIN_HXX
+#include <vcl/splitwin.hxx>
+#endif
+
+#ifndef _SV_TIMER_HXX //autogen wg. Timer
+#include <vcl/timer.hxx>
+#endif
+#include "bibmod.hxx"
+
+#define TOP_WINDOW 1
+#define BOTTOM_WINDOW 2
+
+class BibDataManager;
+
+class BibWindowContainer: public DockingWindow
+{
+ private:
+ Window* pChild;
+
+ protected:
+ virtual void Resize();
+
+ public:
+ BibWindowContainer( Window* pParent,WinBits nStyle = 0);
+ BibWindowContainer( Window* pParent,Window* pChild, WinBits nStyle = 0 );
+ ~BibWindowContainer();
+
+ Window* GetChild(){return pChild;}
+ void SetChild(Window* pWin);
+};
+
+
+class BibBookContainer: public SplitWindow
+{
+ private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xTopFrameRef;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xBottomFrameRef;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xTopPeerRef;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xBottomPeerRef;
+ sal_Bool bFirstTime;
+
+ DockingWindow* pTopWin;
+ DockingWindow* pBottomWin;
+ BibDataManager* pDatMan;
+ HdlBibModul pBibMod;
+ Timer aTimer;
+
+ DECL_LINK( SplitHdl, Timer*);
+
+ protected:
+
+ virtual void Split();
+
+ void CreateTopWin();
+ void CreateBottomWin();
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetTopComponentInterface( sal_Bool bCreate = sal_True );
+ void SetTopComponentInterface( ::com::sun::star::awt::XWindowPeer* pIFace );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetBottomComponentInterface( sal_Bool bCreate = sal_True );
+ void SetBottomComponentInterface( ::com::sun::star::awt::XWindowPeer* pIFace );
+
+// VCLXWindow* GetTopWindowPeer();
+// void SetTopWindowPeer( VCLXWindow* pPeer );
+
+// VCLXWindow* GetBottomWindowPeer();
+// void SetBottomWindowPeer( VCLXWindow* pPeer );
+
+ public:
+
+ BibBookContainer(Window* pParent,BibDataManager*, WinBits nStyle = 0 );
+ ~BibBookContainer();
+
+ DockingWindow* GetTopWin() {return pTopWin;}
+ DockingWindow* GetBottomWin() {return pBottomWin;}
+
+
+ void createTopFrame(const rtl::OUString & rURL );
+
+ void createBottomFrame(const rtl::OUString & rURL );
+
+ void createTopFrame(Window* pWin);
+
+ void createBottomFrame(Window* pWin);
+
+};
+
+
+#endif
diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx
new file mode 100644
index 000000000..ade366cf4
--- /dev/null
+++ b/extensions/source/bibliography/bibload.cxx
@@ -0,0 +1,881 @@
+/*************************************************************************
+ *
+ * $RCSfile: bibload.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _SFX_ITEMPROP_HXX
+#include <svtools/itemprop.hxx>
+#endif
+#ifndef _UNO_ENVIRONMENT_H_
+#include <uno/environment.h>
+#endif
+#ifndef SVTOOLS_URIHELPER_HXX
+#include <svtools/urihelper.hxx>
+#endif
+#ifndef _TOOLKIT_UNOHLP_HXX
+#include <toolkit/helper/vclunohelper.hxx>
+#endif
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx> // helper for factories
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDB_XCOLUMN_HPP_
+#include <com/sun/star/sdb/XColumn.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
+#include <com/sun/star/util/XURLTransformer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
+#include <com/sun/star/sdb/CommandType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XFRAMELOADER_HPP_
+#include <com/sun/star/frame/XFrameLoader.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_TEXT_BIBLIOGRAPHYDATAFIELD_HPP_
+#include <com/sun/star/text/BibliographyDataField.hpp>
+#endif
+
+#ifndef _SV_WINDOW_HXX
+#include <vcl/window.hxx>
+#endif
+#ifndef _SV_EDIT_HXX
+#include <vcl/edit.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+#ifndef _SV_GROUP_HXX //autogen wg. form
+#include <vcl/group.hxx>
+#endif
+
+#ifndef _SFXINIPROP_HXX
+#include <svtools/iniprop.hxx>
+#endif
+#ifndef _SFXINIMGR_HXX
+#include <svtools/iniman.hxx>
+#endif
+#ifndef _SVEDIT_HXX
+#include <svtools/svmedit.hxx>
+#endif
+
+#ifndef BIB_HRC
+#include "bib.hrc"
+#endif
+#ifndef ADDRCONT_HXX
+#include "bibcont.hxx"
+#endif
+#ifndef ADRBEAM_HXX
+#include "bibbeam.hxx"
+#endif
+#ifndef ADDRMOD_HXX
+#include "bibmod.hxx"
+#endif
+#ifndef _BIB_VIEW_HXX
+#include "bibview.hxx"
+#endif
+#ifndef _BIB_FRAMECTR_HXX
+#include "framectr.hxx"
+#endif
+#ifndef _BIB_DATMAN_HXX
+#include "datman.hxx"
+#endif
+
+#ifndef _CPPUHELPER_IMPLBASE4_HXX_
+#include <cppuhelper/implbase4.hxx> // helper for implementations
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+
+
+//-----------------------------------------------------------------------------
+
+#define PROPERTY_FRAME 1
+
+class BibliographyLoader : public cppu::WeakImplHelper4
+<
+ XServiceInfo,
+ container::XNameAccess,
+ XPropertySet,
+ frame::XFrameLoader
+>
+{
+ HdlBibModul pBibMod;
+ Reference< XPropertyChangeListener > xDatMan;
+ BibDataManager* pDatMan;
+ Reference< container::XNameAccess > xColumns;
+ Reference< XResultSet > xCursor;
+
+private:
+
+ void loadView(const Reference< frame::XFrame > & aFrame, const rtl::OUString& aURL,
+ const Sequence< PropertyValue >& aArgs,
+ const Reference< frame::XLoadEventListener > & aListener);
+
+ BibDataManager* GetDataManager()const;
+ Reference< container::XNameAccess > GetDataColumns() const;
+ Reference< XResultSet > GetDataCursor() const;
+ Reference< sdb::XColumn > GetIdentifierColumn() const;
+
+public:
+ BibliographyLoader();
+ ~BibliographyLoader();
+
+ // XServiceInfo
+ rtl::OUString SAL_CALL getImplementationName() throw( );
+ sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( );
+ Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( );
+ static rtl::OUString getImplementationName_Static() throw( )
+
+ {
+ //!
+ return C2U("com.sun.star.extensions.Bibliography");
+ //!
+ }
+
+ //XNameAccess
+ virtual Any SAL_CALL getByName(const rtl::OUString& aName) throw ( container::NoSuchElementException, WrappedTargetException, RuntimeException );
+ virtual Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw ( RuntimeException );
+ virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& aName) throw ( RuntimeException );
+
+ //XElementAccess
+ virtual Type SAL_CALL getElementType(void) throw ( RuntimeException );
+ virtual sal_Bool SAL_CALL hasElements(void) throw ( RuntimeException );
+
+ //XPropertySet
+ virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo(void) throw ( RuntimeException );
+ virtual void SAL_CALL setPropertyValue(const rtl::OUString& PropertyName, const Any& aValue) throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException );
+ virtual Any SAL_CALL getPropertyValue(const rtl::OUString& PropertyName) throw ( UnknownPropertyException, WrappedTargetException, RuntimeException );
+ virtual void SAL_CALL addPropertyChangeListener(const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
+ virtual void SAL_CALL removePropertyChangeListener(const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
+ virtual void SAL_CALL addVetoableChangeListener(const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
+ virtual void SAL_CALL removeVetoableChangeListener(const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
+
+ static Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames_Static(void) throw( );
+
+ friend Reference< XInterface > SAL_CALL BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw( Exception );
+
+ // XLoader
+ virtual void SAL_CALL load(const Reference< frame::XFrame > & aFrame, const rtl::OUString& aURL,
+ const Sequence< PropertyValue >& aArgs,
+ const Reference< frame::XLoadEventListener > & aListener);
+ virtual void SAL_CALL cancel(void);
+};
+
+BibliographyLoader::BibliographyLoader() :
+ pBibMod(0),
+ pDatMan(0)
+{
+}
+
+BibliographyLoader::~BibliographyLoader()
+{
+ if(pBibMod)
+ CloseBibModul(pBibMod);
+}
+
+
+Reference< XInterface > SAL_CALL BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw( Exception )
+{
+ return *(new BibliographyLoader);
+}
+
+
+// XServiceInfo
+rtl::OUString BibliographyLoader::getImplementationName() throw( )
+
+{
+ return getImplementationName_Static();
+}
+
+// XServiceInfo
+sal_Bool BibliographyLoader::supportsService(const rtl::OUString& ServiceName) throw( )
+{
+ 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;
+}
+
+// XServiceInfo
+Sequence< rtl::OUString > BibliographyLoader::getSupportedServiceNames(void) throw( )
+{
+ return getSupportedServiceNames_Static();
+}
+
+// ORegistryServiceManager_Static
+Sequence< rtl::OUString > BibliographyLoader::getSupportedServiceNames_Static(void) throw( )
+{
+ Sequence< rtl::OUString > aSNS( 2 );
+ aSNS.getArray()[0] = C2U("com.sun.star.frame.FrameLoader");
+ //!
+ aSNS.getArray()[1] = C2U("com.sun.star.frame.Bibliography");
+ //!
+ return aSNS;
+}
+
+extern "C"
+{
+ void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+ {
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+ }
+
+ sal_Bool SAL_CALL component_writeInfo( void * //pServiceManager
+ , registry::XRegistryKey * pRegistryKey )
+ {
+ try
+ {
+ rtl::OUString sKey = rtl::OUString::createFromAscii("/");
+ sKey += BibliographyLoader::getImplementationName_Static();
+ //creates the impl key: /com.sun.star.extensions.Bibliography
+ Reference< registry::XRegistryKey > xImplKey = pRegistryKey->createKey(sKey);
+
+
+ //sKey += rtl::OUString::createFromAscii("/UNO/SERVICES");
+ Reference< registry::XRegistryKey > xNewKey = xImplKey->createKey( C2U("/UNO/SERVICES") );
+ Sequence< rtl::OUString > aServices = BibliographyLoader::getSupportedServiceNames_Static();
+ for( INT32 i = 0; i < aServices.getLength(); i++ )
+ xNewKey->createKey( aServices.getConstArray()[i]);
+ xNewKey = xImplKey->createKey( C2U("/UNO/Loader"));
+
+ Reference< registry::XRegistryKey > xPatternKey = xImplKey->createKey( C2U("/Loader/Pattern" ));
+ xPatternKey->setAsciiValue( C2U( ".component:Bibliography/*" ) );
+
+ return sal_True;
+ }
+ catch (Exception &)
+ {
+ return sal_False;
+ }
+ }
+
+
+ void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, void * /*pRegistryKey*/ )
+ {
+ void * pRet = 0;
+ if (!BibliographyLoader::getImplementationName_Static().compareToAscii( pImplName ) )
+ {
+ // create the factory
+ Reference< XSingleServiceFactory > xFactory =
+ cppu::createSingleFactory(
+ pServiceManager,
+ BibliographyLoader::getImplementationName_Static(),
+ BibliographyLoader_CreateInstance,
+ BibliographyLoader::getSupportedServiceNames_Static() );
+ // acquire, because we return an interface pointer instead of a reference
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ return pRet;
+ }
+
+}
+// -----------------------------------------------------------------------
+void BibliographyLoader::cancel(void)
+{
+ //!
+ //!
+}
+// -----------------------------------------------------------------------
+void BibliographyLoader::load(const Reference< frame::XFrame > & rFrame, const rtl::OUString& rURL,
+ const Sequence< PropertyValue >& rArgs,
+ const Reference< frame::XLoadEventListener > & rListener)
+{
+ //!
+
+ pBibMod = OpenBibModul();
+
+ String aURLStr( rURL );
+ String aPartName = aURLStr.GetToken( 1, '/' );
+
+ if(aPartName.EqualsAscii("View") || aPartName.EqualsAscii("View1"))
+ {
+ loadView(rFrame, rURL, rArgs, rListener);
+ }
+}
+
+// -----------------------------------------------------------------------
+void BibliographyLoader::loadView(const Reference< frame::XFrame > & rFrame, const rtl::OUString& rURL,
+ const Sequence< PropertyValue >& rArgs,
+ const Reference< frame::XLoadEventListener > & rListener)
+{
+ //!
+ if(!pBibMod)
+ pBibMod = OpenBibModul();
+
+ BibDataManager* pDatMan=(*pBibMod)->createDataManager();
+ xDatMan = pDatMan;
+ String sTableName;
+ rtl::OUString aBibUrl=BibModul::GetBibliographyURL(&sTableName);
+
+ Reference< form::XForm > xForm = pDatMan->createDatabaseForm(aBibUrl, OUString(sTableName));
+
+ if(xForm.is())
+ {
+ Reference< awt::XWindow > aWindow = rFrame->getContainerWindow();
+
+ Window* pParent = VCLUnoHelper::GetWindow( aWindow );
+
+ BibBookContainer *pMyWindow = new BibBookContainer( pParent, pDatMan );
+
+ BibView* pView = new BibView(pMyWindow,pDatMan,WB_SECTION_STYLE);
+ pDatMan->SetView(pView);
+
+ BibBeamer* pBeamer=new BibBeamer( pMyWindow,pDatMan);
+ pMyWindow->createTopFrame(pBeamer);
+
+ pMyWindow->createBottomFrame(pView);
+
+ Reference< awt::XWindow > xWin ( pMyWindow->GetComponentInterface(), UNO_QUERY );
+
+ Reference< frame::XController > xCtrRef(new BibFrameController_Impl( xWin,pDatMan));
+
+ xCtrRef->attachFrame(rFrame);
+ rFrame->setComponent( xWin, xCtrRef);
+ pBeamer->SetXController(xCtrRef);
+ //!
+
+ long nBeamerSize = pDatMan->getBeamerSize();
+
+ pDatMan->loadDatabase();
+
+ ResMgr* pResMgr = (*pBibMod)->GetResMgr();
+ INetURLObject aEntry( URIHelper::SmartRelToAbs(pResMgr->GetFileName()) );
+ String aResFile = String::CreateFromAscii(".component:");
+ ( aResFile += aEntry.GetName() ) += '/';
+ String aMenuRes = aResFile;
+ aMenuRes+=String::CreateFromInt32(RID_MAIN_MENU);
+
+ util::URL aURL;
+ aURL.Complete = aMenuRes;
+
+ Reference< XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+ Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY );
+ if( xTrans.is() )
+ {
+ // Datei laden
+ xTrans->parseStrict( aURL );
+
+ Reference< frame::XDispatchProvider > xProv( rFrame, UNO_QUERY );
+ if ( xProv.is() )
+ {
+ Reference< frame::XDispatch > aDisp = xProv->queryDispatch( aURL, C2U("_tool:_menubar"), 0 );
+ if ( aDisp.is() )
+ aDisp->dispatch( aURL, Sequence<PropertyValue>() );
+ }
+ }
+ if ( rListener.is() )
+ rListener->loadFinished( this );
+ }
+ else
+ {
+ if ( rListener.is() )
+ rListener->loadCancelled( this );
+ }
+}
+/* -----------------06.12.99 14:37-------------------
+
+ --------------------------------------------------*/
+BibDataManager* BibliographyLoader::GetDataManager()const
+{
+ if(!pDatMan)
+ {
+ if(!pBibMod)
+ ((BibliographyLoader*)this)->pBibMod = OpenBibModul();
+ ((BibliographyLoader*)this)->pDatMan = (*pBibMod)->createDataManager();
+ ((BibliographyLoader*)this)->xDatMan = pDatMan;
+ }
+ return pDatMan;
+}
+/* -----------------06.12.99 14:39-------------------
+
+ --------------------------------------------------*/
+Reference< container::XNameAccess > BibliographyLoader::GetDataColumns() const
+{
+ if (!xColumns.is())
+ {
+ Reference< XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+ Reference< XRowSet > xRowSet(xMgr->createInstance(C2U("com.sun.star.sdb.RowSet")), UNO_QUERY);
+ Reference< XPropertySet > xResultSetProps(xRowSet, UNO_QUERY);
+ DBG_ASSERT(xResultSetProps.is() , "BibliographyLoader::GetDataCursor : invalid row set (no XResultSet or no XPropertySet) !");
+
+ String sTableName;
+ rtl::OUString aBibUrl = BibModul::GetBibliographyURL(&sTableName);
+
+ Any aBibUrlAny; aBibUrlAny <<= aBibUrl;
+ xResultSetProps->setPropertyValue(C2U("DataSourceName"), aBibUrlAny);
+ Any aCommandType; aCommandType <<= (sal_Int32)(CommandType::TABLE);
+ xResultSetProps->setPropertyValue(C2U("CommandType"), aCommandType);
+ Any aTableName; aTableName <<= OUString(sTableName);
+ xResultSetProps->setPropertyValue(C2U("Command"), aTableName);
+ Any aResultSetType; aResultSetType <<= (sal_Int32)(ResultSetType::SCROLL_INSENSITIVE);
+ xResultSetProps->setPropertyValue(C2U("ResultSetType"), aResultSetType);
+ Any aResultSetCurrency; aResultSetCurrency <<= (sal_Int32)(ResultSetConcurrency::UPDATABLE);
+ xResultSetProps->setPropertyValue(C2U("ResultSetConcurrency"), aResultSetCurrency);
+
+ sal_Bool bSuccess = sal_False;
+ try
+ {
+ xRowSet->execute();
+ bSuccess = sal_True;
+ }
+ catch(SQLException& e)
+ {
+#ifdef DBG_UTIL
+ // TODO : show a real error message
+ String sMsg(String::CreateFromAscii("BibliographyLoader::GetDataCursor : could not execute the result set (catched an SQL-exception"));
+ sMsg += String(e.Message);
+ sMsg.AppendAscii(") !");
+ DBG_ERROR( ByteString(sMsg, RTL_TEXTENCODING_ASCII_US ).GetBuffer());
+#endif
+ }
+ catch(...)
+ {
+ DBG_ERROR("BibliographyLoader::GetDataCursor : could not execute the result set !");
+ bSuccess = sal_False;
+ }
+
+ if (!bSuccess)
+ {
+ Reference< XComponent > xSetComp(xRowSet, UNO_QUERY);
+ if (xSetComp.is())
+ xSetComp->dispose();
+ xRowSet = NULL;
+ }
+ else
+ ((BibliographyLoader*)this)->xCursor = xRowSet.get();
+
+ Reference< sdbcx::XColumnsSupplier > xSupplyCols(xCursor, UNO_QUERY);
+ if (xSupplyCols.is())
+ ((BibliographyLoader*)this)->xColumns = xSupplyCols->getColumns();
+ }
+
+ return xColumns;
+}
+/* -----------------17.12.99 12:29-------------------
+
+ --------------------------------------------------*/
+Reference< sdb::XColumn > BibliographyLoader::GetIdentifierColumn() const
+{
+ BibDataManager* pDatMan = GetDataManager();
+ Reference< container::XNameAccess > xColumns = GetDataColumns();
+ rtl::OUString sIdentifierColumnName = pDatMan->GetIdentifierMapping();
+
+ Reference< sdb::XColumn > xReturn;
+ if (xColumns.is() && xColumns->hasByName(sIdentifierColumnName))
+ {
+ xReturn = Reference< XColumn > (*(Reference< XInterface > *)
+ xColumns->getByName(sIdentifierColumnName).getValue(), UNO_QUERY);
+ }
+ return xReturn;
+}
+
+/* -----------------06.12.99 15:05-------------------
+
+ --------------------------------------------------*/
+Reference< XResultSet > BibliographyLoader::GetDataCursor() const
+{
+ if (!xCursor.is())
+ GetDataColumns();
+ if (xCursor.is())
+ xCursor->first();
+ return xCursor;
+}
+
+/*-- 17.11.99 12:51:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+rtl::OUString lcl_AddProperty(Reference< container::XNameAccess > xColumns,
+ const Mapping* pMapping, const String& rColumnName)
+{
+ String sColumnName(rColumnName);
+ if(pMapping)
+ {
+ for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
+ {
+ if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == rColumnName)
+ {
+ sColumnName = pMapping->aColumnPairs[nEntry].sRealColumnName;
+ break;
+ }
+ }
+ }
+ rtl::OUString uColumnName(sColumnName);
+ rtl::OUString uRet;
+ Reference< sdb::XColumn > xCol;
+ if (xColumns->hasByName(uColumnName))
+ xCol = Reference< sdb::XColumn > (*(Reference< XInterface > *)xColumns->getByName(uColumnName).getValue(), UNO_QUERY);
+ if (xCol.is())
+ uRet = xCol->getString();
+ return uRet;
+}
+//-----------------------------------------------------------------------------
+Any BibliographyLoader::getByName(const rtl::OUString& rName) throw
+ ( container::NoSuchElementException, WrappedTargetException, RuntimeException )
+{
+ Any aRet;
+ try
+ {
+ BibDataManager* pDatMan = ((BibliographyLoader*)this)->GetDataManager();
+ Reference< XResultSet > xCursor = GetDataCursor();
+ Reference< sdbcx::XColumnsSupplier > xSupplyCols(xCursor, UNO_QUERY);
+ Reference< container::XNameAccess > xColumns;
+ if (!xSupplyCols.is())
+ return aRet;
+ xColumns = xSupplyCols->getColumns();
+ DBG_ASSERT(xSupplyCols.is(), "BibliographyLoader::getByName : invalid columns returned by the data cursor (may be the result set is not alive ?) !");
+ if (!xColumns.is())
+ return aRet;
+
+ String sIdentifierMapping = pDatMan->GetIdentifierMapping();
+ rtl::OUString sId = sIdentifierMapping;
+ Reference< sdb::XColumn > xColumn;
+ if (xColumns->hasByName(sId))
+ xColumn = Reference< sdb::XColumn > (*(Reference< XInterface > *)xColumns->getByName(sId).getValue(), UNO_QUERY);
+ if (xColumn.is())
+ {
+ do
+ {
+ if ((rName == xColumn->getString()) && !xColumn->wasNull())
+ {
+ Sequence<PropertyValue> aPropSequ(COLUMN_COUNT);
+ PropertyValue* pValues = aPropSequ.getArray();
+ String sTableName;
+ rtl::OUString aBibUrl = BibModul::GetBibliographyURL(&sTableName);
+ const Mapping* pMapping = pDatMan->GetMapping(sTableName, &aBibUrl);
+ for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
+ {
+ const String sColName = pDatMan->GetDefColumnName(
+ nEntry);
+ pValues[nEntry].Name = sColName;
+ pValues[nEntry].Value <<= lcl_AddProperty(xColumns, pMapping, sColName);
+ }
+ aRet.setValue(&aPropSequ, ::getCppuType((Sequence<PropertyValue>*)0));
+
+ break;
+ }
+ }
+ while(xCursor->next());
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("Exception in BibliographyLoader::getByName")
+ }
+ return aRet;
+}
+/*-- 17.11.99 12:51:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< rtl::OUString > BibliographyLoader::getElementNames(void) throw ( RuntimeException )
+{
+ Sequence< rtl::OUString > aRet(10);
+ int nRealNameCount = 0;
+ try
+ {
+ BibDataManager* pDatMan = ((BibliographyLoader*)this)->GetDataManager();
+
+ Reference< XResultSet > xCursor(GetDataCursor());
+ Reference< sdb::XColumn > xIdColumn(GetIdentifierColumn());
+ if (xIdColumn.is()) // implies xCursor.is()
+ {
+ do
+ {
+ rtl::OUString sTemp = xIdColumn->getString();
+ if (sTemp.len() && !xIdColumn->wasNull())
+ {
+ int nLen = aRet.getLength();
+ if (nLen = nRealNameCount)
+ aRet.realloc(nLen + 10);
+ rtl::OUString* pArray = aRet.getArray();
+ pArray[nRealNameCount] = sTemp;
+ nRealNameCount++;
+ }
+ }
+ while (xCursor->next());
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("Exception in BibliographyLoader::getElementNames")
+ }
+
+ aRet.realloc(nRealNameCount);
+ return aRet;
+}
+/*-- 17.11.99 12:51:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool BibliographyLoader::hasByName(const rtl::OUString& rName) throw ( RuntimeException )
+{
+ sal_Bool bRet = sal_False;
+ try
+ {
+ BibDataManager* pDatMan = GetDataManager();
+ Reference< XResultSet > xCursor = GetDataCursor();
+ Reference< sdb::XColumn > xIdColumn = GetIdentifierColumn();
+
+ if (xIdColumn.is()) // implies xCursor.is()
+ {
+ do
+ {
+ rtl::OUString sCurrentId = xIdColumn->getString();
+ if (!xIdColumn->wasNull() && (rName.compareTo(sCurrentId) == COMPARE_EQUAL))
+ {
+ bRet = sal_True;
+ break;
+ }
+ }
+ while(xCursor->next());
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("Exception in BibliographyLoader::getElementNames")
+ }
+ return bRet;
+}
+/*-- 17.11.99 12:51:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Type BibliographyLoader::getElementType(void) throw ( RuntimeException )
+{
+ return ::getCppuType((Sequence<PropertyValue>*)0);
+}
+/*-- 17.11.99 12:51:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool BibliographyLoader::hasElements(void) throw ( RuntimeException )
+{
+ Reference< XResultSet > xCursor = GetDataCursor();
+ Reference< container::XNameAccess > xColumns = GetDataColumns();
+ return xColumns.is() && (xColumns->getElementNames().getLength() != 0);
+}
+
+/*-- 07.12.99 14:28:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySetInfo > BibliographyLoader::getPropertySetInfo(void) throw
+ ( RuntimeException )
+{
+ static SfxItemPropertyMap aBibProps_Impl[] =
+ {
+ { MAP_CHAR_LEN("BibliographyDataFieldNames"), 0, &::getCppuType((Sequence<PropertyValue>*)0), PropertyAttribute::READONLY, 0},
+ {0,0,0,0}
+ };
+ static Reference< XPropertySetInfo > xRet =
+ SfxItemPropertySet(aBibProps_Impl).getPropertySetInfo();
+ return xRet;
+}
+/*-- 07.12.99 14:28:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void BibliographyLoader::setPropertyValue(const rtl::OUString& PropertyName,
+ const Any& aValue)
+ throw( UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ throw UnknownPropertyException();
+ //no changeable properties
+}
+/*-- 07.12.99 14:28:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any BibliographyLoader::getPropertyValue(const rtl::OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ Any aRet;
+ static const sal_uInt16 aInternalMapping[] =
+ {
+ IDENTIFIER_POS , // BibliographyDataField_IDENTIFIER
+ AUTHORITYTYPE_POS , // BibliographyDataField_BIBILIOGRAPHIC_TYPE
+ ADDRESS_POS , // BibliographyDataField_ADDRESS
+ ANNOTE_POS , // BibliographyDataField_ANNOTE
+ AUTHOR_POS , // BibliographyDataField_AUTHOR
+ BOOKTITLE_POS , // BibliographyDataField_BOOKTITLE
+ CHAPTER_POS , // BibliographyDataField_CHAPTER
+ EDITION_POS , // BibliographyDataField_EDITION
+ EDITOR_POS , // BibliographyDataField_EDITOR
+ HOWPUBLISHED_POS , // BibliographyDataField_HOWPUBLISHED
+ INSTITUTION_POS , // BibliographyDataField_INSTITUTION
+ JOURNAL_POS , // BibliographyDataField_JOURNAL
+ MONTH_POS , // BibliographyDataField_MONTH
+ NOTE_POS , // BibliographyDataField_NOTE
+ NUMBER_POS , // BibliographyDataField_NUMBER
+ ORGANIZATIONS_POS , // BibliographyDataField_ORGANIZATIONS
+ PAGES_POS , // BibliographyDataField_PAGES
+ PUBLISHER_POS , // BibliographyDataField_PUBLISHER
+ SCHOOL_POS , // BibliographyDataField_SCHOOL
+ SERIES_POS , // BibliographyDataField_SERIES
+ TITLE_POS , // BibliographyDataField_TITLE
+ REPORTTYPE_POS , // BibliographyDataField_REPORT_TYPE
+ VOLUME_POS , // BibliographyDataField_VOLUME
+ YEAR_POS , // BibliographyDataField_YEAR
+ URL_POS , // BibliographyDataField_URL
+ CUSTOM1_POS , // BibliographyDataField_CUSTOM1
+ CUSTOM2_POS , // BibliographyDataField_CUSTOM2
+ CUSTOM3_POS , // BibliographyDataField_CUSTOM3
+ CUSTOM4_POS , // BibliographyDataField_CUSTOM4
+ CUSTOM5_POS , // BibliographyDataField_CUSTOM5
+ ISBN_POS //BibliographyDataField_ISBN
+ };
+ if(C2U("BibliographyDataFieldNames") == rPropertyName)
+ {
+ Sequence<PropertyValue> aSeq(COLUMN_COUNT);
+ PropertyValue* pArray = aSeq.getArray();
+ BibDataManager* pDatMan = GetDataManager();
+ for(sal_uInt16 i = 0; i <= text::BibliographyDataField::ISBN ; i++)
+ {
+ pArray[i].Name = pDatMan->GetDefColumnName(aInternalMapping[i]);
+ pArray[i].Value <<= (sal_Int16) i;
+ }
+ aRet.setValue(&aSeq, ::getCppuType((Sequence<PropertyValue>*)0));
+ }
+ else
+ throw UnknownPropertyException();
+ return aRet;
+}
+/*-- 07.12.99 14:28:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void BibliographyLoader::addPropertyChangeListener(
+ const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ //no bound properties
+}
+/*-- 07.12.99 14:28:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void BibliographyLoader::removePropertyChangeListener(
+ const rtl::OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ //no bound properties
+}
+/*-- 07.12.99 14:28:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void BibliographyLoader::addVetoableChangeListener(
+ const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ //no vetoable properties
+}
+/*-- 07.12.99 14:28:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void BibliographyLoader::removeVetoableChangeListener(
+ const rtl::OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ //no vetoable properties
+}
+
+
+
diff --git a/extensions/source/bibliography/bibmod.cxx b/extensions/source/bibliography/bibmod.cxx
new file mode 100644
index 000000000..d0055ff2f
--- /dev/null
+++ b/extensions/source/bibliography/bibmod.cxx
@@ -0,0 +1,409 @@
+/*************************************************************************
+ *
+ * $RCSfile: bibmod.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#include <tools/resmgr.hxx>
+#include <svtools/iniprop.hxx>
+#include <svtools/iniman.hxx>
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+#ifndef SVTOOLS_URIHELPER_HXX
+#include <svtools/urihelper.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XLOCALIZEDALIASES_HPP_
+#include <com/sun/star/util/XLocalizedAliases.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XLOCALIZABLE_HPP_
+#include <com/sun/star/lang/XLocalizable.hpp>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+#include "bibmod.hxx"
+#include "bibresid.hxx"
+#include "registry.hxx"
+#include "datman.hxx"
+static PtrBibModul pBibModul=NULL;
+static nBibModulCount=0;
+
+#ifndef _UCBHELPER_CONTENT_HXX
+#include <ucbhelper/content.hxx>
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ucb;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+#define C2S(cChar) String::CreateFromAscii(cChar)
+
+HdlBibModul OpenBibModul()
+{
+ if(pBibModul==NULL)
+ {
+ pBibModul=new BibModul();
+ }
+ nBibModulCount++;
+ return &pBibModul;
+}
+
+void CloseBibModul(HdlBibModul ppBibModul)
+{
+ nBibModulCount--;
+ if(nBibModulCount==0 && ppBibModul!=NULL)
+ {
+ delete pBibModul;
+ pBibModul=NULL;
+ }
+}
+
+/*PtrBibModul GetBibModul()
+{
+ return pBibModul;
+} */
+
+BibResId::BibResId( sal_uInt16 nId ) :
+ ResId( nId, pBibModul->GetResMgr() )
+{
+}
+
+BibModul::BibModul()
+{
+ pResMgr = ResMgr::CreateResMgr( "bib" MAKE_NUMSTR(SUPD) );
+ pRegistry = new BibRegistry();
+ xRegistry = pRegistry;
+}
+
+BibModul::~BibModul()
+{
+ delete pResMgr;
+ xRegistry = 0;
+ //delete pRegistry;
+}
+
+BibDataManager* BibModul::createDataManager()
+{
+ return new BibDataManager(pRegistry);
+}
+//-----------------------------------------------------------------------------
+String BibModul::GetBibliographyURL(String* pTableName)
+{
+ String aURL;
+ SfxAppIniManagerProperty aProp;
+ GetpApp()->Property( aProp );
+ SfxIniManager* pIniMan = aProp.GetIniManager();
+ if( !pIniMan )
+ return String();
+
+ String aBib = pIniMan->Get( C2S(BIBLIOGRAPHY_INI_GROUP),
+ sal_False, sal_False,
+ C2S(BIBLIOGRAPHY_INI_CUR_NAME));
+ sal_Bool bCorrect = sal_False;
+ if(aBib.Len())
+ {
+ aURL = aBib.GetToken( 0, ';' );
+ aURL = pIniMan->SubstPathVars( aURL );
+ aURL = URIHelper::SmartRelToAbs(aURL);
+
+ INetURLObject aTmpURL(aURL);
+ BOOL bExist = FALSE;
+ if(aTmpURL.GetProtocol() == INET_PROT_FILE)
+ try
+ {
+ bExist = ::ucb::Content(
+ aTmpURL.GetMainURL(), uno::Reference< XCommandEnvironment >()).isDocument();
+ }
+ catch(...){}
+
+ if(bExist)
+ {
+ bCorrect = sal_True;
+ if(pTableName)
+ *pTableName = aBib.GetToken( 1, ';' );
+ }
+ }
+ if(!bCorrect)
+ {
+ //if there's no entry defined take the first *.sdb from the database favorites
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+ uno::Reference< container::XNameAccess > xDatabaseContext(xMgr->createInstance(
+ C2U("com.sun.star.sdb.DatabaseAccessContext") ), UNO_QUERY );
+// uno::Sequence<rtl::OUString> aFavorites;
+// if (xDatabaseContext.is())
+// aFavorites = xDatabaseContext->getElementNames();
+// if (aFavorites.getLength())
+// aURL = INetURLObject::SmartRelToAbs(U2S(aFavorites.getConstArray()[0]));
+ Reference<XLocalizedAliases> xAlias(xDatabaseContext, UNO_QUERY);
+ Reference<XLocalizable> xLocal(xDatabaseContext, UNO_QUERY);
+ Sequence< AliasProgrammaticPair > aAliasPairs =
+ xAlias->listAliases(xLocal->getLocale());
+ const AliasProgrammaticPair* pPairs = aAliasPairs.getConstArray();
+ for(INT32 nFav = 0; nFav < aAliasPairs.getLength(); nFav++)
+ {
+ String sURL = pPairs[nFav].ProgrammaticName;
+ aURL = URIHelper::SmartRelToAbs(sURL);
+ INetURLObject aTmpURL(aURL);
+ BOOL bExist = FALSE;
+ if(aTmpURL.GetProtocol() == INET_PROT_FILE)
+ try
+ {
+ bExist = ::ucb::Content(
+ aTmpURL.GetMainURL(), uno::Reference< XCommandEnvironment >()).isDocument();
+ }
+ catch(...){}
+
+ if(bExist)
+ break;
+ else
+ aURL.Erase();
+ }
+
+ }
+ catch(...)
+ {
+ DBG_ERROR("Exception in BibDataManager::DBChangeDialog_Impl::DBChangeDialog_Impl")
+ }
+
+ }
+ return aURL;
+}
+//-----------------------------------------------------------------------------
+void BibModul::SetBibliographyURL(const String& rURL, const String& rTable)
+{
+ SfxAppIniManagerProperty aProp;
+ GetpApp()->Property( aProp );
+ SfxIniManager* pIniMan = aProp.GetIniManager();
+ if( !pIniMan )
+ return;
+
+ String sEntry(rURL);
+ sEntry = pIniMan->UsePathVars( sEntry );
+
+ sEntry += ';';
+ sEntry += rTable;
+
+ pIniMan->WriteKey( C2S(BIBLIOGRAPHY_INI_GROUP),
+ C2S(BIBLIOGRAPHY_INI_CUR_NAME), sEntry);
+}
+
+// PropertyNames
+#define STATIC_USTRING(a,b) rtl::OUString a(b)
+STATIC_USTRING(FM_PROP_LABEL,C2U("Label"));
+STATIC_USTRING(FM_PROP_CONTROLSOURCE,C2U("DataField"));
+STATIC_USTRING(FM_PROP_NAME,C2U("Name"));
+STATIC_USTRING(FM_PROP_FORMATKEY,C2U("FormatKey"));
+#ifdef TF_SDBAPI
+#else // !TF_SDBAPI
+STATIC_USTRING(FM_PROP_EDITMODE,C2U("RecordMode"));
+STATIC_USTRING(FM_PROP_CURSORSOURCETYPE,C2U("DataSelectionType"));
+STATIC_USTRING(FM_PROP_CURSORSOURCE,C2U("DataSelection"));
+STATIC_USTRING(FM_PROP_DATASOURCE, C2U("DataSource"));
+#endif // !TF_SDBAPI
+STATIC_USTRING(FM_PROP_VALUE,C2U("Value"));
+STATIC_USTRING(FM_PROP_TEXT,C2U("Text"));
+/*
+
+STATIC_USTRING(FM_PROP_TABINDEX,C2U("TabIndex"));
+STATIC_USTRING(FM_PROP_TAG,C2U("Tag"));
+STATIC_USTRING(FM_PROP_CLASSID,C2U("ClassId"));
+STATIC_USTRING(FM_PROP_RECORDCOUNT,C2U("RecordCount"));
+STATIC_USTRING(FM_PROP_RECORDSTATUS,C2U("RecordStatus"));
+STATIC_USTRING(FM_PROP_RECORDCOUNTFINAL,C2U("IsRecordCountFinal"));
+STATIC_USTRING(FM_PROP_CANINSERT,C2U("CanInsert"));
+STATIC_USTRING(FM_PROP_CANUPDATE,C2U("CanUpdate"));
+STATIC_USTRING(FM_PROP_CANDELETE,C2U("CanDelete"));
+STATIC_USTRING(FM_PROP_NAVIGATION,C2U("NavigationBarMode"));
+STATIC_USTRING(FM_PROP_HASNAVIGATION,C2U("HasNavigationBar"));
+STATIC_USTRING(FM_PROP_CYCLE,C2U("Cycle"));
+STATIC_USTRING(FM_PROP_ENABLED,C2U("Enabled"));
+STATIC_USTRING(FM_PROP_READONLY,C2U("ReadOnly"));
+STATIC_USTRING(FM_PROP_ISREADONLY,C2U("IsReadOnly"));
+STATIC_USTRING(FM_PROP_FILTER_CRITERIA,C2U("Filter"));
+STATIC_USTRING(FM_PROP_SORT_CRITERIA,C2U("SortOrder"));
+STATIC_USTRING(FM_PROP_ISREQUIRED,C2U("IsRequired"));
+STATIC_USTRING(FM_PROP_AUTOINCREMENT,C2U("IsAutoIncrement"));
+STATIC_USTRING(FM_PROP_CACHESIZE,C2U("CacheSize"));
+STATIC_USTRING(FM_PROP_DATAENTRY,C2U("DataEntry"));
+STATIC_USTRING(FM_PROP_LASTDIRTY,C2U("LastUpdated"));
+STATIC_USTRING(FM_PROP_STATEMENT,C2U("Statement"));
+STATIC_USTRING(FM_PROP_WIDTH,C2U("Width"));
+STATIC_USTRING(FM_PROP_SEARCHINFO,C2U("SearchInfo"));
+STATIC_USTRING(FM_PROP_MULTILINE,C2U("MultiLine"));
+STATIC_USTRING(FM_PROP_TARGET_URL,C2U("TargetURL"));
+STATIC_USTRING(FM_PROP_TARGET_FRAME,C2U("TargetFrame"));
+STATIC_USTRING(FM_PROP_DEFAULTCONTROL,C2U("DefaultControl"));
+STATIC_USTRING(FM_PROP_MAXTEXTLEN,C2U("MaxTextLen"));
+STATIC_USTRING(FM_PROP_EDITMASK,C2U("EditMask"));
+STATIC_USTRING(FM_PROP_SIZE,C2U("Size"));
+STATIC_USTRING(FM_PROP_SPIN,C2U("Spin"));
+STATIC_USTRING(FM_PROP_DATE,C2U("Date"));
+STATIC_USTRING(FM_PROP_TIME,C2U("Time"));
+STATIC_USTRING(FM_PROP_STATE,C2U("State"));
+STATIC_USTRING(FM_PROP_TRISTATE,C2U("TriState"));
+STATIC_USTRING(FM_PROP_HIDDEN_VALUE, C2U("HiddenValue"));
+STATIC_USTRING(FM_PROP_BUTTONTYPE,C2U("ButtonType"));
+STATIC_USTRING(FM_PROP_STRINGITEMLIST,C2U("StringItemList"));
+STATIC_USTRING(FM_PROP_DEFAULT_TEXT,C2U("DefaultText"));
+STATIC_USTRING(FM_PROP_DEFAULTCHECKED,C2U("DefaultState"));
+STATIC_USTRING(FM_PROP_FORMATSSUPPLIER,C2U("FormatsSupplier"));
+STATIC_USTRING(FM_PROP_SUBMIT_ACTION,C2U("SubmitAction"));
+STATIC_USTRING(FM_PROP_SUBMIT_TARGET,C2U("SubmitTarget"));
+STATIC_USTRING(FM_PROP_SUBMIT_METHOD,C2U("SubmitMethod"));
+STATIC_USTRING(FM_PROP_SUBMIT_ENCODING,C2U("SubmitEncoding"));
+STATIC_USTRING(FM_PROP_IMAGE_URL,C2U("ImageURL"));
+STATIC_USTRING(FM_PROP_EMPTY_IS_NULL,C2U("ConvertEmptyToNull"));
+STATIC_USTRING(FM_PROP_LISTSOURCETYPE,C2U("ListSourceType"));
+STATIC_USTRING(FM_PROP_LISTSOURCE,C2U("ListSource"));
+STATIC_USTRING(FM_PROP_SELECT_SEQ,C2U("SelectedItems"));
+STATIC_USTRING(FM_PROP_VALUE_SEQ,C2U("SelectedValues"));
+STATIC_USTRING(FM_PROP_DEFAULT_SELECT_SEQ,C2U("DefaultSelection"));
+STATIC_USTRING(FM_PROP_MULTISELECTION,C2U("MultiSelection"));
+STATIC_USTRING(FM_PROP_ALIGN,C2U("Align"));
+STATIC_USTRING(FM_PROP_DEFAULT_DATE,C2U("DefaultDate"));
+STATIC_USTRING(FM_PROP_DEFAULT_TIME,C2U("DefaultTime"));
+STATIC_USTRING(FM_PROP_DEFAULT_VALUE,C2U("DefaultValue"));
+STATIC_USTRING(FM_PROP_DECIMAL_ACCURACY,C2U("DecimalAccuracy"));
+STATIC_USTRING(FM_PROP_FIELDTYPE,C2U("Type"));
+STATIC_USTRING(FM_PROP_DECIMALS,C2U("Decimals"));
+STATIC_USTRING(FM_PROP_REFVALUE,C2U("RefValue"));
+STATIC_USTRING(FM_PROP_VALUEMIN,C2U("ValueMin"));
+STATIC_USTRING(FM_PROP_VALUEMAX,C2U("ValueMax"));
+STATIC_USTRING(FM_PROP_STRICTFORMAT,C2U("StrictFormat"));
+STATIC_USTRING(FM_PROP_ALLOWADDITIONS,C2U("AllowInserts"));
+STATIC_USTRING(FM_PROP_ALLOWEDITS,C2U("AllowUpdates"));
+STATIC_USTRING(FM_PROP_ALLOWDELETIONS,C2U("AllowDeletes"));
+STATIC_USTRING(FM_PROP_MASTERFIELDS,C2U("MasterFields"));
+STATIC_USTRING(FM_PROP_SLAVEFIELDS,C2U("SlaveFields"));
+STATIC_USTRING(FM_PROP_ISPASSTHROUGH,C2U("IsPassThrough"));
+STATIC_USTRING(FM_PROP_QUERY,C2U("Query"));
+STATIC_USTRING(FM_PROP_LITERALMASK,C2U("LiteralMask"));
+STATIC_USTRING(FM_PROP_VALUESTEP,C2U("ValueStep"));
+STATIC_USTRING(FM_PROP_SHOWTHOUSANDSEP,C2U("ShowThousandsSeparator"));
+STATIC_USTRING(FM_PROP_CURRENCYSYMBOL,C2U("CurrencySymbol"));
+STATIC_USTRING(FM_PROP_DATEFORMAT,C2U("DateFormat"));
+STATIC_USTRING(FM_PROP_DATEMIN,C2U("DateMin"));
+STATIC_USTRING(FM_PROP_DATEMAX,C2U("DateMax"));
+STATIC_USTRING(FM_PROP_DATE_SHOW_CENTURY,C2U("DateShowCentury"));
+STATIC_USTRING(FM_PROP_TIMEFORMAT, C2U("TimeFormat"));
+STATIC_USTRING(FM_PROP_TIMEMIN, C2U("TimeMin"));
+STATIC_USTRING(FM_PROP_TIMEMAX,C2U("TimeMax"));
+STATIC_USTRING(FM_PROP_LINECOUNT,C2U("LineCount"));
+STATIC_USTRING(FM_PROP_BOUNDCOLUMN, C2U("BoundColumn"));
+STATIC_USTRING(FM_PROP_FONT,C2U("FontDescriptor"));
+STATIC_USTRING(FM_PROP_BACKGROUNDCOLOR,C2U("BackgroundColor"));
+STATIC_USTRING(FM_PROP_FILLCOLOR,C2U("FillColor"));
+STATIC_USTRING(FM_PROP_TEXTCOLOR,C2U("TextColor"));
+STATIC_USTRING(FM_PROP_LINECOLOR,C2U("LineColor"));
+STATIC_USTRING(FM_PROP_BORDER,C2U("Border"));
+STATIC_USTRING(FM_PROP_DROPDOWN,C2U("Dropdown"));
+STATIC_USTRING(FM_PROP_MULTI,C2U("Multi"));
+STATIC_USTRING(FM_PROP_HSCROLL,C2U("HScroll"));
+STATIC_USTRING(FM_PROP_VSCROLL,C2U("VScroll"));
+STATIC_USTRING(FM_PROP_TABSTOP,C2U("Tabstop"));
+STATIC_USTRING(FM_PROP_AUTOCOMPLETE,C2U("Autocomplete"));
+STATIC_USTRING(FM_PROP_HARDLINEBREAKS,C2U("HardLineBreaks"));
+STATIC_USTRING(FM_PROP_PRINTABLE,C2U("Printable"));
+STATIC_USTRING(FM_PROP_ECHO_CHAR,C2U("EchoChar"));
+STATIC_USTRING(FM_PROP_ROWHEIGHT,C2U("RowHeight"));
+STATIC_USTRING(FM_PROP_HELPTEXT, C2U("HelpText"));
+STATIC_USTRING(FM_PROP_FONT_NAME, C2U("FontName"));
+STATIC_USTRING(FM_PROP_FONT_STYLENAME, C2U("FontStyleName"));
+STATIC_USTRING(FM_PROP_FONT_FAMILY, C2U("FontFamily"));
+STATIC_USTRING(FM_PROP_FONT_CHARSET, C2U("FontCharset"));
+STATIC_USTRING(FM_PROP_FONT_HEIGHT, C2U("FontHeight"));
+STATIC_USTRING(FM_PROP_FONT_WEIGHT, C2U("FontWeight"));
+STATIC_USTRING(FM_PROP_FONT_SLANT, C2U("FontSlant"));
+STATIC_USTRING(FM_PROP_FONT_UNDERLINE, C2U("FontUnderline"));
+STATIC_USTRING(FM_PROP_FONT_STRIKEOUT, C2U("FontStrikeout"));
+STATIC_USTRING(FM_PROP_HELPURL, C2U("HelpURL"));
+STATIC_USTRING(FM_PROP_RECORDMARKER, C2U("HasRecordMarker"));
+STATIC_USTRING(FM_PROP_BOUNDFIELD, C2U("BoundField"));
+STATIC_USTRING(FM_PROP_TREATASNUMERIC, C2U("TreatAsNumber"));
+STATIC_USTRING(FM_PROP_EFFECTIVE_VALUE, C2U("EffectiveValue"));
+STATIC_USTRING(FM_PROP_EFFECTIVE_DEFAULT, C2U("EffectiveDefault"));
+STATIC_USTRING(FM_PROP_EFFECTIVE_MIN, C2U("EffectiveMin"));
+STATIC_USTRING(FM_PROP_EFFECTIVE_MAX, C2U("EffectiveMax"));
+STATIC_USTRING(FM_PROP_HIDDEN, C2U("Hidden"));
+STATIC_USTRING(FM_PROP_FILTERPROPOSAL, C2U("useFilterValueProposal"));
+STATIC_USTRING(FM_PROP_FIELDSOURCE, C2U("FieldSource"));
+STATIC_USTRING(FM_PROP_TABLENAME, C2U("TableName"));
+STATIC_USTRING(FM_PROP_FILTERSUPPLIER, C2U("FilterSupplier"));
+STATIC_USTRING(FM_PROP_CURRENTFILTER, C2U("CurrentFilter"));
+STATIC_USTRING(FM_PROP_SELECTED_FIELDS, C2U("SelectedFields"));
+STATIC_USTRING(FM_PROP_SELECTED_TABLES, C2U("SelectedTables"));
+STATIC_USTRING(FM_PROP_THREADSAFE, C2U("ThreadSafe"));
+*/
+
diff --git a/extensions/source/bibliography/bibmod.hxx b/extensions/source/bibliography/bibmod.hxx
new file mode 100644
index 000000000..9cdd0b9dc
--- /dev/null
+++ b/extensions/source/bibliography/bibmod.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * $RCSfile: bibmod.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef ADDRMOD_HXX
+#define ADDRMOD_HXX
+
+
+#ifndef _COM_SUN_STAR_REGISTRY_MERGECONFLICTEXCEPTION_HPP_
+#include <com/sun/star/registry/MergeConflictException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REGISTRY_XSIMPLEREGISTRY_HPP_
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#endif
+
+class ResMgr;
+class BibDataManager;
+class BibRegistry;
+
+#define BIBLIOGRAPHY_INI_GROUP "Bibliography"
+#define BIBLIOGRAPHY_INI_CUR_NAME "BibliographyCurrent"
+#define BIBLIOGRAPHY_INI_DB_ENTRY "Bibliography"
+#define BIBLIOGRAPHY_INI_MAPPING "BibliographyFields"
+#define BIBLIOGRAPHY_TYPE_NAMES "BibliographyTypeNames"
+
+class BibModul
+{
+ private:
+ ResMgr* pResMgr;
+ BibRegistry* pRegistry;
+ ::com::sun::star::uno::Reference< ::com::sun::star::registry::XSimpleRegistry > xRegistry;
+
+ public:
+ BibModul();
+ ~BibModul();
+
+ ResMgr* GetResMgr(){return pResMgr;}
+
+ static String GetBibliographyURL(String* pTableName);
+ static void SetBibliographyURL(const String& rURL, const String& rTable);
+
+ BibDataManager* createDataManager();
+
+};
+
+typedef BibModul* PtrBibModul;
+typedef PtrBibModul* HdlBibModul;
+
+HdlBibModul OpenBibModul();
+void CloseBibModul(HdlBibModul ppBibModul);
+
+//PtrBibModul GetBibModul();
+
+
+
+#endif
diff --git a/extensions/source/bibliography/bibprop.hrc b/extensions/source/bibliography/bibprop.hrc
new file mode 100644
index 000000000..8d6919bd5
--- /dev/null
+++ b/extensions/source/bibliography/bibprop.hrc
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * $RCSfile: bibprop.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _BIB_FMPROP_HRC
+#define _BIB_FMPROP_HRC
+
+extern rtl::OUString FM_PROP_LABEL;
+extern rtl::OUString FM_PROP_NAME;
+extern rtl::OUString FM_PROP_CONTROLSOURCE;
+extern rtl::OUString FM_PROP_FORMATKEY;
+extern rtl::OUString FM_PROP_VALUE;
+#ifdef TF_SDBAPI
+#else // !TF_SDBAPI
+extern rtl::OUString FM_PROP_EDITMODE;
+extern rtl::OUString FM_PROP_DATASOURCE;
+extern rtl::OUString FM_PROP_CURSORSOURCE;
+extern rtl::OUString FM_PROP_CURSORSOURCETYPE;
+#endif // !TF_SDBAPI
+extern rtl::OUString FM_PROP_TEXT;
+/*
+extern rtl::OUString FM_PROP_TAG;
+extern rtl::OUString FM_PROP_TABINDEX;
+extern rtl::OUString FM_PROP_CLASSID;
+extern rtl::OUString FM_PROP_ALIGN;
+extern rtl::OUString FM_PROP_RECORDCOUNT;
+extern rtl::OUString FM_PROP_RECORDSTATUS;
+extern rtl::OUString FM_PROP_RECORDCOUNTFINAL;
+extern rtl::OUString FM_PROP_VALUEMIN;
+extern rtl::OUString FM_PROP_VALUEMAX;
+extern rtl::OUString FM_PROP_VALUESTEP;
+extern rtl::OUString FM_PROP_CANINSERT;
+extern rtl::OUString FM_PROP_CANUPDATE;
+extern rtl::OUString FM_PROP_CANDELETE;
+extern rtl::OUString FM_PROP_NAVIGATION;
+extern rtl::OUString FM_PROP_CYCLE;
+extern rtl::OUString FM_PROP_ENABLED;
+extern rtl::OUString FM_PROP_SPIN;
+extern rtl::OUString FM_PROP_READONLY;
+extern rtl::OUString FM_PROP_FILTER_CRITERIA;
+extern rtl::OUString FM_PROP_SORT_CRITERIA;
+extern rtl::OUString FM_PROP_AUTOINCREMENT;
+extern rtl::OUString FM_PROP_CACHESIZE;
+extern rtl::OUString FM_PROP_DATAENTRY;
+extern rtl::OUString FM_PROP_LASTDIRTY;
+extern rtl::OUString FM_PROP_STATEMENT;
+extern rtl::OUString FM_PROP_WIDTH;
+extern rtl::OUString FM_PROP_SEARCHINFO;
+extern rtl::OUString FM_PROP_MULTILINE;
+extern rtl::OUString FM_PROP_TARGET_URL;
+extern rtl::OUString FM_PROP_DEFAULTCONTROL;
+extern rtl::OUString FM_PROP_MAXTEXTLEN;
+extern rtl::OUString FM_PROP_SIZE;
+extern rtl::OUString FM_PROP_DATE;
+extern rtl::OUString FM_PROP_TIME;
+extern rtl::OUString FM_PROP_STATE;
+extern rtl::OUString FM_PROP_TRISTATE;
+extern rtl::OUString FM_PROP_HIDDEN_VALUE;
+extern rtl::OUString FM_PROP_TARGET_FRAME;
+extern rtl::OUString FM_PROP_BUTTONTYPE;
+extern rtl::OUString FM_PROP_STRINGITEMLIST;
+extern rtl::OUString FM_PROP_DEFAULT_TEXT;
+extern rtl::OUString FM_PROP_DEFAULTCHECKED;
+extern rtl::OUString FM_PROP_DEFAULT_DATE;
+extern rtl::OUString FM_PROP_DEFAULT_TIME;
+extern rtl::OUString FM_PROP_DEFAULT_VALUE;
+extern rtl::OUString FM_PROP_FORMATSSUPPLIER;
+extern rtl::OUString FM_PROP_SUBMIT_ACTION;
+extern rtl::OUString FM_PROP_SUBMIT_TARGET;
+extern rtl::OUString FM_PROP_SUBMIT_METHOD;
+extern rtl::OUString FM_PROP_SUBMIT_ENCODING;
+extern rtl::OUString FM_PROP_IMAGE_URL;
+extern rtl::OUString FM_PROP_EMPTY_IS_NULL;
+extern rtl::OUString FM_PROP_LISTSOURCETYPE;
+extern rtl::OUString FM_PROP_LISTSOURCE;
+extern rtl::OUString FM_PROP_SELECT_SEQ;
+extern rtl::OUString FM_PROP_VALUE_SEQ;
+extern rtl::OUString FM_PROP_DEFAULT_SELECT_SEQ;
+extern rtl::OUString FM_PROP_MULTISELECTION;
+extern rtl::OUString FM_PROP_DECIMAL_ACCURACY;
+extern rtl::OUString FM_PROP_EDITMASK;
+extern rtl::OUString FM_PROP_ISREADONLY;
+extern rtl::OUString FM_PROP_ISREQUIRED;
+extern rtl::OUString FM_PROP_FIELDTYPE;
+extern rtl::OUString FM_PROP_DECIMALS;
+extern rtl::OUString FM_PROP_REFVALUE;
+extern rtl::OUString FM_PROP_STRICTFORMAT;
+extern rtl::OUString FM_PROP_ALLOWADDITIONS;
+extern rtl::OUString FM_PROP_ALLOWEDITS;
+extern rtl::OUString FM_PROP_ALLOWDELETIONS;
+extern rtl::OUString FM_PROP_MASTERFIELDS;
+extern rtl::OUString FM_PROP_SLAVEFIELDS;
+extern rtl::OUString FM_PROP_ISPASSTHROUGH;
+extern rtl::OUString FM_PROP_QUERY;
+extern rtl::OUString FM_PROP_LITERALMASK;
+extern rtl::OUString FM_PROP_SHOWTHOUSANDSEP;
+extern rtl::OUString FM_PROP_CURRENCYSYMBOL;
+extern rtl::OUString FM_PROP_DATEFORMAT;
+extern rtl::OUString FM_PROP_DATEMIN;
+extern rtl::OUString FM_PROP_DATEMAX;
+extern rtl::OUString FM_PROP_DATE_SHOW_CENTURY;
+extern rtl::OUString FM_PROP_TIMEFORMAT;
+extern rtl::OUString FM_PROP_TIMEMIN;
+extern rtl::OUString FM_PROP_TIMEMAX;
+extern rtl::OUString FM_PROP_LINECOUNT;
+extern rtl::OUString FM_PROP_BOUNDCOLUMN;
+extern rtl::OUString FM_PROP_HASNAVIGATION;
+extern rtl::OUString FM_PROP_FONT;
+extern rtl::OUString FM_PROP_BACKGROUNDCOLOR;
+extern rtl::OUString FM_PROP_FILLCOLOR;
+extern rtl::OUString FM_PROP_TEXTCOLOR;
+extern rtl::OUString FM_PROP_LINECOLOR;
+extern rtl::OUString FM_PROP_BORDER;
+extern rtl::OUString FM_PROP_DROPDOWN;
+extern rtl::OUString FM_PROP_MULTI;
+extern rtl::OUString FM_PROP_HSCROLL;
+extern rtl::OUString FM_PROP_VSCROLL;
+extern rtl::OUString FM_PROP_TABSTOP;
+extern rtl::OUString FM_PROP_AUTOCOMPLETE;
+extern rtl::OUString FM_PROP_HARDLINEBREAKS;
+extern rtl::OUString FM_PROP_PRINTABLE;
+extern rtl::OUString FM_PROP_ECHO_CHAR;
+extern rtl::OUString FM_PROP_ROWHEIGHT;
+extern rtl::OUString FM_PROP_HELPTEXT;
+extern rtl::OUString FM_PROP_FONT_NAME;
+extern rtl::OUString FM_PROP_FONT_STYLENAME;
+extern rtl::OUString FM_PROP_FONT_FAMILY;
+extern rtl::OUString FM_PROP_FONT_CHARSET;
+extern rtl::OUString FM_PROP_FONT_HEIGHT;
+extern rtl::OUString FM_PROP_FONT_WEIGHT;
+extern rtl::OUString FM_PROP_FONT_SLANT;
+extern rtl::OUString FM_PROP_FONT_UNDERLINE;
+extern rtl::OUString FM_PROP_FONT_STRIKEOUT;
+extern rtl::OUString FM_PROP_HELPURL;
+extern rtl::OUString FM_PROP_RECORDMARKER;
+extern rtl::OUString FM_PROP_BOUNDFIELD;
+extern rtl::OUString FM_PROP_TREATASNUMERIC;
+extern rtl::OUString FM_PROP_EFFECTIVE_VALUE;
+extern rtl::OUString FM_PROP_EFFECTIVE_DEFAULT;
+extern rtl::OUString FM_PROP_EFFECTIVE_MIN;
+extern rtl::OUString FM_PROP_EFFECTIVE_MAX;
+extern rtl::OUString FM_PROP_HIDDEN;
+extern rtl::OUString FM_PROP_FILTERPROPOSAL;
+extern rtl::OUString FM_PROP_FIELDSOURCE;
+extern rtl::OUString FM_PROP_TABLENAME;
+extern rtl::OUString FM_PROP_FILTERSUPPLIER;
+extern rtl::OUString FM_PROP_CURRENTFILTER;
+extern rtl::OUString FM_PROP_SELECTED_FIELDS;
+extern rtl::OUString FM_PROP_SELECTED_TABLES;
+extern rtl::OUString FM_PROP_THREADSAFE;
+*/
+
+
+#endif // _SVX_FMPROP_HRC
+
diff --git a/extensions/source/bibliography/bibresid.hxx b/extensions/source/bibliography/bibresid.hxx
new file mode 100644
index 000000000..53bd3756f
--- /dev/null
+++ b/extensions/source/bibliography/bibresid.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * $RCSfile: bibresid.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef ADRRESID_HXX
+#define ADRRESID_HXX
+
+#ifndef _TOOLS_RESID_HXX //autogen
+#include <tools/resid.hxx>
+#endif
+
+//===================================================================
+
+class BibResId : public ResId
+{
+ public:
+ BibResId( USHORT nId );
+};
+
+
+
+#endif // ADRRESID_HXX
+
diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx
new file mode 100644
index 000000000..a45fde85e
--- /dev/null
+++ b/extensions/source/bibliography/bibview.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * $RCSfile: bibview.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "bib.hrc"
+#include "bibcont.hxx"
+#include "bibbeam.hxx"
+#include "bibmod.hxx"
+#include "general.hxx"
+#include "bibview.hxx"
+#include "datman.hxx"
+#include "bibresid.hxx"
+#include "bibmod.hxx"
+#include "sections.hrc"
+#include "viewsect.hxx"
+
+
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_
+#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
+#endif
+#ifndef _SV_MSGBOX_HXX
+#include <vcl/msgbox.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX //autogen wg. DBG_ASSERT
+#include <tools/debug.hxx>
+#endif
+
+#define DEFAULT_SIZE 500
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+using namespace ::rtl;
+#define C2U(cChar) OUString::createFromAscii(cChar)
+
+rtl::OUString gSectionSizes(C2U("TheSectionSizes"));
+rtl::OUString gSectionNames(C2U("TheSectionNames"));
+rtl::OUString gSectionExpander(C2U("TheSectionExpander"));
+rtl::OUString gSectionPos(C2U("TheSectionPosition"));
+// -----------------------------------------------------------------------
+BibView::BibView(Window* pParent, BibDataManager* pDM, WinBits nStyle):
+ Window(pParent,nStyle),
+ pDatMan(pDM),
+ xDatMan(pDM),
+ pGeneralPage(NULL),
+ nDefNameCount(0)
+{
+ String aDefName(BibResId(RID_BIB_STR_SECTION));
+ aDefaultName=aDefName;
+ UpdatePages();
+}
+
+BibView::~BibView()
+{
+ pGeneralPage->CommitActiveControl();
+ uno::Reference< XForm > xForm = pDatMan->getDatabaseForm();
+ uno::Reference< XPropertySet > xPrSet(xForm, UNO_QUERY);
+ if(xPrSet.is())
+ {
+ uno::Any aProp = xPrSet->getPropertyValue(C2U("IsModified"));
+ if(*(sal_Bool*)aProp.getValue())
+ {
+ uno::Any aNew = xPrSet->getPropertyValue(C2U("IsNew"));
+ uno::Reference< sdbc::XResultSetUpdate > xResUpd(xForm, UNO_QUERY);
+ if(*(sal_Bool*)aNew.getValue())
+ xResUpd->insertRow();
+ else
+ xResUpd->updateRow();
+ }
+ }
+ //delete pGeneralPage;
+ pGeneralPage->RemoveListeners();
+ xGeneralPage = 0;
+
+}
+/* -----------------16.11.99 13:13-------------------
+
+ --------------------------------------------------*/
+void BibView::UpdatePages()
+{
+ BOOL bResize = FALSE;
+ if(pGeneralPage)
+ {
+ bResize = TRUE;
+ pGeneralPage->Hide();
+// delete pGeneralPage;
+ pGeneralPage->RemoveListeners();
+ xGeneralPage = 0;
+ }
+// pGeneralPage = new BibGeneralPage(this, pDatMan);
+ xGeneralPage = pGeneralPage = new BibGeneralPage(this, pDatMan);
+ if(bResize)
+ Resize();
+ String sErrorString(pGeneralPage->GetErrorString());
+ if(sErrorString.Len())
+ {
+ sErrorString += '\n';
+ sErrorString += String(BibResId(RID_MAP_QUESTION));
+ QueryBox aQuery( this, WB_YES_NO, sErrorString );
+ if(RET_YES == aQuery.Execute())
+ {
+ Application::PostUserEvent( STATIC_LINK(
+ this, BibView, CallMappingHdl ) );
+
+ }
+ }
+
+}
+/* -----------------------------02.02.00 16:49--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_STATIC_LINK(BibView, CallMappingHdl, BibView*, EMPTYARG)
+{
+ pThis->pDatMan->CreateMappingDialog(pThis);
+ return 0;
+}
+/* -----------------------------13.04.00 16:12--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void BibView::Resize()
+{
+ if(pGeneralPage)
+ {
+ Size aSz(GetOutputSizePixel());
+ pGeneralPage->SetSizePixel(aSz);
+ }
+ Window::Resize();
+}
+
+
+
+
diff --git a/extensions/source/bibliography/bibview.hxx b/extensions/source/bibliography/bibview.hxx
new file mode 100644
index 000000000..67b336415
--- /dev/null
+++ b/extensions/source/bibliography/bibview.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * $RCSfile: bibview.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _BIB_VIEW_HXX
+#define _BIB_VIEW_HXX
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+#ifndef _SV_SECTION_HXX
+#include <svtools/section.hxx>
+#endif
+
+#ifndef _SV_SECTCTR_HXX
+#include <svtools/sectctr.hxx>
+#endif
+
+class BibGeneralPage;
+class BibBusinessAddress;
+class BibBusinessPhone;
+class BibDataManager;
+
+namespace com{ namespace sun{ namespace star{ namespace awt{ class XFocusListener;}}}}
+// -----------------------------------------------------------------------
+class BibView: public Window//SvSectionControl
+{
+private:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xViewSet;
+ BibDataManager* pDatMan;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > xDatMan;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener> xGeneralPage;
+ BibGeneralPage* pGeneralPage;
+ rtl::OUString aDefaultName;
+ sal_Int32 nDefNameCount;
+
+protected:
+
+// void InitPages();
+protected:
+ virtual void Resize();
+
+ DECL_STATIC_LINK(BibView, CallMappingHdl, BibView*);
+
+public:
+ BibView(Window* pParent,BibDataManager* pDatMan,WinBits nStyle=0);
+ ~BibView();
+
+ void UpdatePages();
+};
+
+#endif
+
+
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
new file mode 100644
index 000000000..049892ed9
--- /dev/null
+++ b/extensions/source/bibliography/datman.cxx
@@ -0,0 +1,2127 @@
+/*************************************************************************
+ *
+ * $RCSfile: datman.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_
+#include <com/sun/star/io/XPersistObject.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_
+#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_
+#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XROWLOCATE_HPP_
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
+#include <com/sun/star/sdbc/DataType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDB_XSQLQUERYCOMPOSERFACTORY_HPP_
+#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDB_XDATABASEENVIRONMENT_HPP_
+#include <com/sun/star/sdb/XDatabaseEnvironment.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_XNAMINGSERVICE_HPP_
+#include <com/sun/star/uno/XNamingService.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
+#include <com/sun/star/sdb/CommandType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
+#include <com/sun/star/sdbc/XConnection.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DATA_XDATABASEFAVORITES_HPP_
+#include <com/sun/star/data/XDatabaseFavorites.hpp> // TODO : this is obsolete ....
+#endif
+#ifndef _COM_SUN_STAR_FORM_XLOADABLE_HPP_
+#include <com/sun/star/form/XLoadable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_XGRIDCOLUMNFACTORY_HPP_
+#include <com/sun/star/form/XGridColumnFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XDATAINPUTSTREAM_HPP_
+#include <com/sun/star/io/XDataInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UCB_XCONTENTPROVIDER_HPP_
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_XCONTENTACCESS_HPP_
+#include <com/sun/star/ucb/XContentAccess.hpp>
+#endif
+#ifndef _UCBHELPER_CONTENTBROKER_HXX
+#include <ucbhelper/contentbroker.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENT_HXX
+#include <ucbhelper/content.hxx>
+#endif
+#ifndef _UCBHELPER_CONTENTIDENTIFIER_HXX
+#include <ucbhelper/contentidentifier.hxx>
+#endif
+
+#ifndef SVTOOLS_URIHELPER_HXX
+#include <svtools/urihelper.hxx>
+#endif
+#include <svtools/iniprop.hxx>
+#include <svtools/iniman.hxx>
+#ifndef _SVTABBX_HXX
+#include <svtools/svtabbx.hxx>
+#endif
+#ifndef _HEADBAR_HXX
+#include <svtools/headbar.hxx>
+#endif
+#ifndef _SVARRAY_HXX
+#include <svtools/svarray.hxx>
+#endif
+#ifndef _SV_DIALOG_HXX
+#include <vcl/dialog.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#ifndef _SV_LSTBOX_HXX
+#include <vcl/lstbox.hxx>
+#endif
+#ifndef _SV_FIXED_HXX
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _SV_GROUP_HXX
+#include <vcl/group.hxx>
+#endif
+#ifndef _SV_LSTBOX_HXX //autogen wg. form::component::ListBox
+#include <vcl/lstbox.hxx>
+#endif
+#ifndef _SV_EDIT_HXX //autogen wg. Edit
+#include <vcl/edit.hxx>
+#endif
+#ifndef _SV_MSGBOX_HXX
+#include <vcl/msgbox.hxx>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX //autogen wg. DBG_ASSERT
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _BIB_DATMAN_HXX
+#include "datman.hxx"
+#endif
+#ifndef ADRRESID_HXX
+#include "bibresid.hxx"
+#endif
+#ifndef ADDRMOD_HXX
+#include "bibmod.hxx"
+#endif
+#ifndef _BIB_VIEW_HXX
+#include "bibview.hxx"
+#endif
+#ifndef _BIB_REGISTRY_HXX
+#include "registry.hxx"
+#endif
+#ifndef _BIB_FMPROP_HRC
+#include "bibprop.hrc"
+#endif
+#ifndef _BIB_TOOLBAR_HXX
+#include "toolbar.hxx"
+#endif
+#ifndef ADRBEAM_HXX
+#include "bibbeam.hxx"
+#endif
+#ifndef BIB_HRC
+#include "bib.hrc"
+#endif
+#include "datman.hrc"
+#ifndef __EXTENSIONS_INC_EXTENSIO_HRC__
+#include "extensio.hrc"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::ucb;
+using namespace ::rtl;
+using namespace ::ucb;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+#define C2S(cChar) String::CreateFromAscii(cChar)
+#define MAP_TOKEN ';'
+#define PAIR_TOKEN ':'
+
+/* -----------------11.11.99 14:34-------------------
+
+ --------------------------------------------------*/
+typedef Mapping* MappingPtr;
+SV_DECL_PTRARR_DEL(MappingArray, MappingPtr, 2, 2);
+SV_IMPL_PTRARR(MappingArray, MappingPtr);
+
+/* -----------------------------15.06.00 16:12--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL lcl_IsCaseSensitive(const String& rPathURL)
+{
+ BOOL bCaseSensitive = FALSE;
+#ifdef DBG_UTIL
+ static BOOL bFirstCall = TRUE;
+ if(bFirstCall)
+ {
+ DBG_ERROR("No case checking due to #76253#")
+ bFirstCall = FALSE;
+ }
+#endif
+/* Reference< lang::XMultiServiceFactory > xMSF = utl::getProcessServiceFactory();
+ INetURLObject aTempObj(rPathURL);
+ try
+ {
+ aTempObj.SetBase(aTempObj.GetBase().ToLowerAscii());
+ Reference<XContentIdentifier> xRef1 = new ::ucb::ContentIdentifier( xMSF, aTempObj.GetMainURL());
+ aTempObj.SetBase(aTempObj.GetBase().ToUpperAscii());
+ Reference<XContentIdentifier> xRef2 = new ::ucb::ContentIdentifier( xMSF, aTempObj.GetMainURL());
+
+ ContentBroker& rBroker = *ContentBroker::get();
+ Reference<XContentProvider > xProv = rBroker.getContentProviderInterface();
+ sal_Int32 nCompare = xProv->compareContentIds( xRef1, xRef2 );
+ bCaseSensitive = nCompare != 0;
+ }
+ catch(...){}
+*/ return bCaseSensitive;
+}
+/* -----------------17.01.00 14:38-------------------
+
+ --------------------------------------------------*/
+uno::Reference< sdbc::XConnection > getConnection(const rtl::OUString& _rURL)
+{
+ // first get the sdb::DataSource corresponding to the url
+ uno::Reference< sdbc::XDataSource > xDataSource;
+ // is it a favorite title ?
+ uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+ uno::Reference< XNameAccess > xNamingContext(xMgr->createInstance(C2U("com.sun.star.sdb.DatabaseAccessContext")), UNO_QUERY);
+ if (xNamingContext.is() && xNamingContext->hasByName(_rURL))
+ {
+ DBG_ASSERT(uno::Reference< XNamingService > (xNamingContext, UNO_QUERY).is(), "::getDataSource : no uno::NamingService interface on the sdb::DatabaseAccessContext !");
+ xDataSource = uno::Reference< sdbc::XDataSource > (uno::Reference< XNamingService > (xNamingContext, UNO_QUERY)->getRegisteredObject(_rURL), UNO_QUERY);
+ }
+ if (!xDataSource.is())
+ {
+ // is it a file url ?
+ uno::Reference< XDatabaseEnvironment > xEnvironment(xMgr->createInstance(C2U("com.sun.star.sdb.DatabaseEnvironment")), UNO_QUERY);
+ if (xEnvironment.is())
+ {
+ try
+ {
+ xDataSource = uno::Reference< sdbc::XDataSource > (xEnvironment->getDatabaseAccess(_rURL), UNO_QUERY);
+ }
+ catch(sdbc::SQLException&)
+ {
+ xDataSource = NULL;
+ // TODO : a real error handling
+ }
+ catch(...)
+ {
+ xDataSource = NULL;
+ }
+ }
+ }
+
+ // build the connection from the data source
+ uno::Reference< sdbc::XConnection > xConn;
+ if (xDataSource.is())
+ {
+ // need user/pwd for this
+ rtl::OUString sUser, sPwd;
+ uno::Reference< XPropertySet > xDataSourceProps(xDataSource, UNO_QUERY);
+ uno::Reference< XPropertySetInfo > xInfo = xDataSourceProps.is() ? xDataSourceProps->getPropertySetInfo() : uno::Reference< XPropertySetInfo > ();
+ if (xInfo.is() && xInfo->hasPropertyByName(C2U("User")))
+ xDataSourceProps->getPropertyValue(C2U("User")) >>= sUser;
+ if (xInfo.is() && xInfo->hasPropertyByName(C2U("Password")))
+ xDataSourceProps->getPropertyValue(C2U("Password"))>>= sPwd;
+
+ try
+ {
+ xConn = xDataSource->getConnection(sUser, sPwd);
+ }
+ catch(sdbc::SQLException&)
+ {
+ // TODO : a real error handling
+ }
+ catch(...)
+ {
+ }
+
+ }
+ return xConn;
+}
+
+/* -----------------17.01.00 14:46-------------------
+
+ --------------------------------------------------*/
+uno::Reference< sdbc::XConnection > getConnection(const uno::Reference< XInterface > & xRowSet)
+{
+ uno::Reference< sdbc::XConnection > xConn;
+ try
+ {
+ uno::Reference< XPropertySet > xFormProps(xRowSet, UNO_QUERY);
+ if (!xFormProps.is())
+ return xConn;
+
+ xConn = uno::Reference< sdbc::XConnection > (*(uno::Reference< XInterface > *)xFormProps->getPropertyValue(C2U("ActiveConnection")).getValue(), UNO_QUERY);
+ if (!xConn.is())
+ {
+ OUString uTmp;
+ xFormProps->getPropertyValue(C2U("DataSourceName")) >>= uTmp;
+ xConn = getConnection(uTmp);
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("exception in getConnection");
+ }
+
+ return xConn;
+}
+/* -----------------17.01.00 16:07-------------------
+
+ --------------------------------------------------*/
+uno::Reference< XNameAccess > getColumns(const uno::Reference< XForm > & xForm)
+{
+ uno::Reference< XNameAccess > xReturn;
+ // check if the form is alive
+ uno::Reference< sdbcx::XColumnsSupplier > xSupplyCols(xForm, UNO_QUERY);
+ if (xSupplyCols.is())
+ xReturn = xSupplyCols->getColumns();
+
+ if (!xReturn.is() || (xReturn->getElementNames().getLength() == 0))
+ { // no ....
+ xReturn = NULL;
+ // -> get the table the form is bound to and ask it for their columns
+ uno::Reference< sdbcx::XTablesSupplier > xSupplyTables(getConnection(xForm), UNO_QUERY);
+ uno::Reference< XPropertySet > xFormProps(xForm, UNO_QUERY);
+ if (xFormProps.is() && xSupplyTables.is())
+ {
+ try
+ {
+ DBG_ASSERT((*(sal_Int32*)xFormProps->getPropertyValue(C2U("CommandType")).getValue()) == CommandType::TABLE,
+ "::getColumns : invalid form (has no table as data source) !");
+ rtl::OUString sTable;
+ xFormProps->getPropertyValue(C2U("Command")) >>= sTable;
+ uno::Reference< XNameAccess > xTables = xSupplyTables->getTables();
+ if (xTables.is() && xTables->hasByName(sTable))
+ xSupplyCols = uno::Reference< sdbcx::XColumnsSupplier > (
+ *(uno::Reference< XInterface > *)xTables->getByName(sTable).getValue(), UNO_QUERY);
+ if (xSupplyCols.is())
+ xReturn = xSupplyCols->getColumns();
+ }
+#ifdef DBG_UTIL
+ catch(Exception& e )
+#else
+ catch(Exception&)
+#endif
+ {
+#ifdef DBG_UTIL
+ String sMsg(String::CreateFromAscii("::getColumns : catched an exception ("));
+ sMsg += String(e.Message);
+ sMsg.AppendAscii(") ...");
+ DBG_ERROR( ByteString(sMsg, RTL_TEXTENCODING_ASCII_US ).GetBuffer());
+#endif
+ }
+ catch(...)
+ {
+ DBG_ERROR("::getColumns : catched a strange exception (no uno::Exception) ...");
+ }
+
+ }
+ }
+ return xReturn;
+}
+
+/* -----------------11.11.99 15:54-------------------
+
+ --------------------------------------------------*/
+class MappingDialog_Impl : public ModalDialog
+{
+ OKButton aOKBT;
+ CancelButton aCancelBT;
+ HelpButton aHelpBT;
+
+ GroupBox aMapGB;
+ FixedText aIdentifierFT;
+ ListBox aIdentifierLB;
+ FixedText aAuthorityTypeFT;
+ ListBox aAuthorityTypeLB;
+ FixedText aAuthorFT;
+ ListBox aAuthorLB;
+ FixedText aTitleFT;
+ ListBox aTitleLB;
+ FixedText aMonthFT;
+ ListBox aMonthLB;
+ FixedText aYearFT;
+ ListBox aYearLB;
+ FixedText aISBNFT;
+ ListBox aISBNLB;
+ FixedText aBooktitleFT;
+ ListBox aBooktitleLB;
+ FixedText aChapterFT;
+ ListBox aChapterLB;
+ FixedText aEditionFT;
+ ListBox aEditionLB;
+ FixedText aEditorFT;
+ ListBox aEditorLB;
+ FixedText aHowpublishedFT;
+ ListBox aHowpublishedLB;
+ FixedText aInstitutionFT;
+ ListBox aInstitutionLB;
+ FixedText aJournalFT;
+ ListBox aJournalLB;
+ FixedText aNoteFT;
+ ListBox aNoteLB;
+ FixedText aAnnoteFT;
+ ListBox aAnnoteLB;
+ FixedText aNumberFT;
+ ListBox aNumberLB;
+ FixedText aOrganizationsFT;
+ ListBox aOrganizationsLB;
+ FixedText aPagesFT;
+ ListBox aPagesLB;
+ FixedText aPublisherFT;
+ ListBox aPublisherLB;
+ FixedText aAddressFT;
+ ListBox aAddressLB;
+ FixedText aSchoolFT;
+ ListBox aSchoolLB;
+ FixedText aSeriesFT;
+ ListBox aSeriesLB;
+ FixedText aReportTypeFT;
+ ListBox aReportTypeLB;
+ FixedText aVolumeFT;
+ ListBox aVolumeLB;
+ FixedText aURLFT;
+ ListBox aURLLB;
+ FixedText aCustom1FT;
+ ListBox aCustom1LB;
+ FixedText aCustom2FT;
+ ListBox aCustom2LB;
+ FixedText aCustom3FT;
+ ListBox aCustom3LB;
+ FixedText aCustom4FT;
+ ListBox aCustom4LB;
+ FixedText aCustom5FT;
+ ListBox aCustom5LB;
+
+ ListBox* aListBoxes[COLUMN_COUNT];
+ String sNone;
+
+ BibDataManager* pDatMan;
+
+ DECL_LINK(OkHdl, OKButton*);
+ DECL_LINK(ListBoxSelectHdl, ListBox*);
+
+public:
+ MappingDialog_Impl(Window* pParent, BibDataManager* pDatMan);
+ ~MappingDialog_Impl();
+
+};
+/* -----------------11.11.99 16:42-------------------
+
+ --------------------------------------------------*/
+sal_uInt16 lcl_FindLogicalName(BibDataManager* pDatMan,
+ const String& rLogicalColumnName)
+{
+ for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++)
+ {
+ if(rLogicalColumnName == pDatMan->GetDefColumnName(i))
+ return i;
+ }
+ return USHRT_MAX;
+}
+//-----------------------------------------------------------------------------
+MappingDialog_Impl::MappingDialog_Impl(Window* pParent, BibDataManager* pMan) :
+ ModalDialog(pParent, BibResId(RID_DLG_MAPPING) ),
+ pDatMan(pMan),
+ aOKBT(this, ResId( BT_OK )),
+ aCancelBT(this, ResId( BT_CANCEL )),
+ aHelpBT(this, ResId( BT_HELP )),
+
+ aMapGB(this, ResId( GB_MAPPING )),
+
+ aIdentifierFT(this, ResId( FT_IDENTIFIER )),
+ aIdentifierLB(this, ResId( LB_IDENTIFIER )),
+ aAuthorityTypeFT(this, ResId( FT_AUTHORITYTYPE )),
+ aAuthorityTypeLB(this, ResId( LB_AUTHORITYTYPE )),
+ aAuthorFT(this, ResId( FT_AUTHOR )),
+ aAuthorLB(this, ResId( LB_AUTHOR )),
+ aTitleFT(this, ResId( FT_TITLE )),
+ aTitleLB(this, ResId( LB_TITLE )),
+ aMonthFT(this, ResId( FT_MONTH )),
+ aMonthLB(this, ResId( LB_MONTH )),
+ aYearFT(this, ResId( FT_YEAR )),
+ aYearLB(this, ResId( LB_YEAR )),
+ aISBNFT(this, ResId( FT_ISBN )),
+ aISBNLB(this, ResId( LB_ISBN )),
+ aBooktitleFT(this, ResId( FT_BOOKTITLE )),
+ aBooktitleLB(this, ResId( LB_BOOKTITLE )),
+ aChapterFT(this, ResId( FT_CHAPTER )),
+ aChapterLB(this, ResId( LB_CHAPTER )),
+ aEditionFT(this, ResId( FT_EDITION )),
+ aEditionLB(this, ResId( LB_EDITION )),
+ aEditorFT(this, ResId( FT_EDITOR )),
+ aEditorLB(this, ResId( LB_EDITOR )),
+ aHowpublishedFT(this, ResId( FT_HOWPUBLISHED )),
+ aHowpublishedLB(this, ResId( LB_HOWPUBLISHED )),
+ aInstitutionFT(this, ResId( FT_INSTITUTION )),
+ aInstitutionLB(this, ResId( LB_INSTITUTION )),
+ aJournalFT(this, ResId( FT_JOURNAL )),
+ aJournalLB(this, ResId( LB_JOURNAL )),
+ aNoteFT(this, ResId( FT_NOTE )),
+ aNoteLB(this, ResId( LB_NOTE )),
+ aAnnoteFT(this, ResId( FT_ANNOTE )),
+ aAnnoteLB(this, ResId( LB_ANNOTE )),
+ aNumberFT(this, ResId( FT_NUMBER )),
+ aNumberLB(this, ResId( LB_NUMBER )),
+ aOrganizationsFT(this, ResId( FT_ORGANIZATIONS )),
+ aOrganizationsLB(this, ResId( LB_ORGANIZATIONS )),
+ aPagesFT(this, ResId( FT_PAGES )),
+ aPagesLB(this, ResId( LB_PAGES )),
+ aPublisherFT(this, ResId( FT_PUBLISHER )),
+ aPublisherLB(this, ResId( LB_PUBLISHER )),
+ aAddressFT(this, ResId( FT_ADDRESS )),
+ aAddressLB(this, ResId( LB_ADDRESS )),
+ aSchoolFT(this, ResId( FT_SCHOOL )),
+ aSchoolLB(this, ResId( LB_SCHOOL )),
+ aSeriesFT(this, ResId( FT_SERIES )),
+ aSeriesLB(this, ResId( LB_SERIES )),
+ aReportTypeFT(this, ResId( FT_REPORTTYPE )),
+ aReportTypeLB(this, ResId( LB_REPORTTYPE )),
+ aVolumeFT(this, ResId( FT_VOLUME )),
+ aVolumeLB(this, ResId( LB_VOLUME )),
+ aURLFT(this, ResId( FT_URL )),
+ aURLLB(this, ResId( LB_URL )),
+ aCustom1FT(this, ResId( FT_CUSTOM1 )),
+ aCustom1LB(this, ResId( LB_CUSTOM1 )),
+ aCustom2FT(this, ResId( FT_CUSTOM2 )),
+ aCustom2LB(this, ResId( LB_CUSTOM2 )),
+ aCustom3FT(this, ResId( FT_CUSTOM3 )),
+ aCustom3LB(this, ResId( LB_CUSTOM3 )),
+ aCustom4FT(this, ResId( FT_CUSTOM4 )),
+ aCustom4LB(this, ResId( LB_CUSTOM4 )),
+ aCustom5FT(this, ResId( FT_CUSTOM5 )),
+ aCustom5LB(this, ResId( LB_CUSTOM5 )),
+ sNone(ResId(ST_NONE))
+{
+ FreeResource();
+
+ aOKBT.SetClickHdl(LINK(this, MappingDialog_Impl, OkHdl));
+ String sTitle = GetText();
+ sTitle.SearchAndReplace(C2S("%1"), pDatMan->getActiveDataTable(), 0);
+ SetText(sTitle);
+
+ aListBoxes[0] = &aIdentifierLB;
+ aListBoxes[1] = &aAuthorityTypeLB;
+ aListBoxes[2] = &aAuthorLB;
+ aListBoxes[3] = &aTitleLB;
+ aListBoxes[4] = &aYearLB;
+ aListBoxes[5] = &aISBNLB;
+ aListBoxes[6] = &aBooktitleLB;
+ aListBoxes[7] = &aChapterLB;
+ aListBoxes[8] = &aEditionLB;
+ aListBoxes[9] = &aEditorLB;
+ aListBoxes[10] = &aHowpublishedLB;
+ aListBoxes[11] = &aInstitutionLB;
+ aListBoxes[12] = &aJournalLB;
+ aListBoxes[13] = &aMonthLB;
+ aListBoxes[14] = &aNoteLB;
+ aListBoxes[15] = &aAnnoteLB;
+ aListBoxes[16] = &aNumberLB;
+ aListBoxes[17] = &aOrganizationsLB;
+ aListBoxes[18] = &aPagesLB;
+ aListBoxes[19] = &aPublisherLB;
+ aListBoxes[20] = &aAddressLB;
+ aListBoxes[21] = &aSchoolLB;
+ aListBoxes[22] = &aSeriesLB;
+ aListBoxes[23] = &aReportTypeLB;
+ aListBoxes[24] = &aVolumeLB;
+ aListBoxes[25] = &aURLLB;
+ aListBoxes[26] = &aCustom1LB;
+ aListBoxes[27] = &aCustom2LB;
+ aListBoxes[28] = &aCustom3LB;
+ aListBoxes[29] = &aCustom4LB;
+ aListBoxes[30] = &aCustom5LB;
+
+ aListBoxes[0]->InsertEntry(sNone);
+ uno::Reference< XNameAccess > xFields = getColumns(pDatMan->getDatabaseForm());
+ DBG_ASSERT(xFields.is(), "MappingDialog_Impl::MappingDialog_Impl : gave me an invalid form !");
+ uno::Sequence<rtl::OUString> aNames = xFields->getElementNames();
+ sal_Int32 nFieldsCount = aNames.getLength();
+ const rtl::OUString* pNames = aNames.getConstArray();
+
+ for(sal_Int32 nField = 0; nField < nFieldsCount; nField++)
+ aListBoxes[0]->InsertEntry(pNames[nField]);
+
+ Link aLnk = LINK(this, MappingDialog_Impl, ListBoxSelectHdl);
+
+ aListBoxes[0]->SelectEntryPos(0);
+ aListBoxes[0]->SetSelectHdl(aLnk);
+ for(sal_uInt16 i = 1; i < COLUMN_COUNT; i++)
+ {
+ for(sal_uInt16 j = 0; j < aListBoxes[0]->GetEntryCount();j++)
+ aListBoxes[i]->InsertEntry(aListBoxes[0]->GetEntry(j));
+ aListBoxes[i]->SelectEntryPos(0);
+ aListBoxes[i]->SetSelectHdl(aLnk);
+ }
+ const Mapping* pMapping = pDatMan->GetMapping(pDatMan->getActiveDataTable());
+ if(pMapping)
+ {
+ for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
+ {
+ sal_uInt16 nListBoxIndex = lcl_FindLogicalName(pDatMan,
+ pMapping->aColumnPairs[nEntry].sLogicalColumnName);
+ if(nListBoxIndex < COLUMN_COUNT)
+ {
+ aListBoxes[nListBoxIndex]->SelectEntry(pMapping->aColumnPairs[nEntry].sRealColumnName);
+ }
+ }
+ }
+}
+/* -----------------11.11.99 16:44-------------------
+
+ --------------------------------------------------*/
+MappingDialog_Impl::~MappingDialog_Impl()
+{}
+/* -----------------15.11.99 10:38-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(MappingDialog_Impl, ListBoxSelectHdl, ListBox*, pListBox)
+{
+ sal_uInt16 nEntryPos = pListBox->GetSelectEntryPos();
+ if(0 < nEntryPos)
+ {
+ for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++)
+ {
+ if(pListBox != aListBoxes[i] && aListBoxes[i]->GetSelectEntryPos() == nEntryPos)
+ aListBoxes[i]->SelectEntryPos(0);
+ }
+ }
+ return 0;
+}
+/* -----------------12.11.99 14:50-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(MappingDialog_Impl, OkHdl, OKButton*, EMPTYARG)
+{
+ Mapping aNew;
+ aNew.sTableName = String(pDatMan->getActiveDataTable());
+ aNew.sURL = String(pDatMan->getActiveDataSource());
+
+ sal_uInt16 nWriteIndex = 0;
+ for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
+ {
+
+ String sSel = aListBoxes[nEntry]->GetSelectEntry();
+ if(sSel != sNone)
+ {
+ aNew.aColumnPairs[nWriteIndex].sRealColumnName = sSel;
+ aNew.aColumnPairs[nWriteIndex].sLogicalColumnName = pDatMan->GetDefColumnName(nEntry);
+ nWriteIndex++;
+ }
+ }
+ pDatMan->SetMapping(pDatMan->getActiveDataTable(), &aNew);
+ EndDialog(RET_OK);
+ return 0;
+}
+/* -----------------18.11.99 10:23-------------------
+
+ --------------------------------------------------*/
+class DBChangeDialog_Impl : public ModalDialog
+{
+ OKButton aOKBT;
+ CancelButton aCancelBT;
+ HelpButton aHelpBT;
+
+ GroupBox aSelectionGB;
+ SvTabListBox aSelectionLB;
+ HeaderBar aSelectionHB;
+
+ String aEntryST;
+ String aURLST;
+
+ BibDataManager* pDatMan;
+
+ DECL_LINK(EndDragHdl, HeaderBar*);
+ DECL_LINK(DoubleClickHdl, SvTabListBox*);
+public:
+ DBChangeDialog_Impl(Window* pParent, BibDataManager* pMan );
+ ~DBChangeDialog_Impl();
+
+ String GetCurrentURL()const;
+};
+
+/*-- 18.11.99 10:35:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+DBChangeDialog_Impl::DBChangeDialog_Impl(Window* pParent, BibDataManager* pMan ) :
+ ModalDialog(pParent, BibResId(RID_DLG_DBCHANGE) ),
+ aOKBT(this, ResId( BT_OK )),
+ aCancelBT(this, ResId( BT_CANCEL )),
+ aHelpBT(this, ResId( BT_HELP )),
+ aSelectionGB(this, ResId( GB_SELECTION )),
+ aSelectionLB(this, ResId( LB_SELECTION )),
+ aSelectionHB(this, ResId( HB_SELECTION )),
+ aEntryST(ResId(ST_ENTRY)),
+ aURLST( ResId(ST_URL)),
+ pDatMan(pMan)
+{
+ FreeResource();
+ aSelectionHB.SetEndDragHdl( LINK(this, DBChangeDialog_Impl, EndDragHdl));
+ aSelectionLB.SetDoubleClickHdl( LINK(this, DBChangeDialog_Impl, DoubleClickHdl));
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+ uno::Reference< data::XDatabaseFavorites > xFav(xMgr->createInstance( C2U("com.sun.star.data.DatabaseEngine") ), UNO_QUERY );
+ // TODO : XDatabaseFavorites is an obsolete interface, the whole dialog has to be based on
+ // the sdb::DatabaseAccessContext service
+
+ uno::Sequence< beans::PropertyValue > aFavs = xFav->getFavorites();
+ const beans::PropertyValue* pValues = aFavs.getConstArray();
+
+ Size aSize = aSelectionHB.GetSizePixel();
+ long nTabs[3];
+ nTabs[0] = 2;// Number of Tabs
+ nTabs[1] = 0;
+ nTabs[2] = aSize.Width() / 4;
+
+ aSelectionHB.SetStyle(aSelectionHB.GetStyle()|WB_STDHEADERBAR);
+ aSelectionHB.InsertItem( 1, aEntryST, nTabs[2]);
+ aSelectionHB.InsertItem( 2, aURLST, aSize.Width() - nTabs[2]);
+ aSelectionHB.SetSizePixel(aSelectionHB.CalcWindowSizePixel());
+ aSelectionHB.Show();
+
+ aSelectionLB.SetHelpId(HID_SELECTION_TLB);
+ aSelectionLB.SetTabs( &nTabs[0], MAP_PIXEL );
+ aSelectionLB.SetWindowBits(WB_CLIPCHILDREN|WB_SORT);
+ //aSelectionLB.SetSelectHdl(LINK(this, SwGlossaryGroupDlg, SelectHdl));
+ aSelectionLB.GetModel()->SetSortMode(SortAscending);
+
+ String sActiveURL = pDatMan->getActiveDataSource();
+ sActiveURL = URIHelper::SmartRelToAbs(sActiveURL);
+ for(int i = 0; i < aFavs.getLength(); i++)
+ {
+ String sTemp(pValues[i].Name);
+ sTemp += '\t';
+ String sSource = *(OUString*)pValues[i].Value.getValue();
+ sTemp += sSource;
+ SvLBoxEntry* pEntry = aSelectionLB.InsertEntry(sTemp);
+// String sTempPath = INetURLObject(sSource).PathToFileName();
+ sal_Bool bCaseSensitive = lcl_IsCaseSensitive(sSource);
+// sal_Bool bCaseSensitive = DirEntry(sTempPath).IsCaseSensitive();
+ if((bCaseSensitive && sActiveURL == sSource)||
+ !bCaseSensitive && COMPARE_EQUAL == sActiveURL.CompareTo(sSource))
+ {
+ aSelectionLB.Select(pEntry);
+ }
+ }
+ aSelectionLB.GetModel()->Resort();
+
+ }
+ catch(...)
+ {
+ DBG_ERROR("Exception in BibDataManager::DBChangeDialog_Impl::DBChangeDialog_Impl")
+ }
+
+
+}
+/* -----------------06.12.99 12:09-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(DBChangeDialog_Impl, DoubleClickHdl, SvTabListBox*, pLB)
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+/* -----------------18.11.99 11:17-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(DBChangeDialog_Impl, EndDragHdl, HeaderBar*, pHB)
+{
+ long nTabs[3];
+ nTabs[0] = 2;// Number of Tabs
+ nTabs[1] = 0;
+ nTabs[2] = pHB->GetItemSize( 1 );
+ aSelectionLB.SetTabs( &nTabs[0], MAP_PIXEL );
+ return 0;
+};
+
+/*-- 18.11.99 10:35:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+DBChangeDialog_Impl::~DBChangeDialog_Impl()
+{
+}
+/* -----------------18.11.99 12:36-------------------
+
+ --------------------------------------------------*/
+String DBChangeDialog_Impl::GetCurrentURL()const
+{
+ String sRet;
+ SvLBoxEntry* pEntry = aSelectionLB.FirstSelected();
+ if(pEntry)
+ {
+ sRet = aSelectionLB.GetEntryText(pEntry, 1);
+ }
+ return sRet;
+}
+
+//-----------------------------------------------------------------------------
+#define STR_UID "uid"
+rtl::OUString gGridName(C2U("theGrid"));
+rtl::OUString gViewName(C2U("theView"));
+rtl::OUString gGlobalName(C2U("theGlobals"));
+rtl::OUString gBeamerSize(C2U("theBeamerSize"));
+rtl::OUString gViewSize(C2U("theViewSize"));
+
+BibDataManager::BibDataManager(BibRegistry * pRegistry) :
+ pMappingsArr(new MappingArray),
+ pToolbar(0),
+ pGridWin(0)
+{
+ //Names of the default columns
+ aColumnDefaults[0] = C2S("Identifier");
+ aColumnDefaults[1] = C2S("BibliographyType");
+ aColumnDefaults[2] = C2S("Author");
+ aColumnDefaults[3] = C2S("Title");
+ aColumnDefaults[4] = C2S("Year");
+ aColumnDefaults[5] = C2S("ISBN");
+ aColumnDefaults[6] = C2S("Booktitle");
+ aColumnDefaults[7] = C2S("Chapter");
+ aColumnDefaults[8] = C2S("Edition");
+ aColumnDefaults[9] = C2S("Editor");
+ aColumnDefaults[10] = C2S("Howpublished");
+ aColumnDefaults[11] = C2S("Institution");
+ aColumnDefaults[12] = C2S("Journal");
+ aColumnDefaults[13] = C2S("Month");
+ aColumnDefaults[14] = C2S("Note");
+ aColumnDefaults[15] = C2S("Annote");
+ aColumnDefaults[16] = C2S("Number");
+ aColumnDefaults[17] = C2S("Organizations");
+ aColumnDefaults[18] = C2S("Pages");
+ aColumnDefaults[19] = C2S("Publisher");
+ aColumnDefaults[20] = C2S("Address");
+ aColumnDefaults[21] = C2S("School");
+ aColumnDefaults[22] = C2S("Series");
+ aColumnDefaults[23] = C2S("ReportType");
+ aColumnDefaults[24] = C2S("Volume");
+ aColumnDefaults[25] = C2S("URL");
+ aColumnDefaults[26] = C2S("Custom1");
+ aColumnDefaults[27] = C2S("Custom2");
+ aColumnDefaults[28] = C2S("Custom3");
+ aColumnDefaults[29] = C2S("Custom4");
+ aColumnDefaults[30] = C2S("Custom5");
+
+// nEditMode = DatabaseRecordMode_STANDARD;
+ xRegistry = pRegistry;
+ xGlobalProps=createGlobalProperties();
+
+ SfxAppIniManagerProperty aProp;
+ GetpApp()->Property( aProp );
+
+ SfxIniManager* pIniMan = aProp.GetIniManager();
+ if(pIniMan)
+ {
+ String sBibMapping;
+ sal_uInt16 nIdx = USHRT_MAX;
+ String sEntry;
+ do
+ {
+ String sKey(C2S(BIBLIOGRAPHY_INI_DB_ENTRY));
+ String sMapKey = C2S(BIBLIOGRAPHY_INI_MAPPING);
+ if(USHRT_MAX != nIdx)
+ {
+ sKey += nIdx;
+ sMapKey += nIdx;
+ }
+
+ sEntry = pIniMan->ReadKey( C2S(BIBLIOGRAPHY_INI_GROUP),
+ sKey );
+ String sURL = sEntry.GetToken(0, ';');
+ sURL = pIniMan->SubstPathVars( sURL );
+
+ sURL = URIHelper::SmartRelToAbs(sURL);
+
+
+ String sTableName = sEntry.GetToken(1, ';');
+
+ sBibMapping = pIniMan->ReadKey( C2S(BIBLIOGRAPHY_INI_GROUP),
+ sMapKey );
+ if(sTableName.Len())
+ {
+ Mapping* pNew = new Mapping;
+ pNew->sTableName = sTableName;
+ pNew->sURL = sURL;
+ sal_uInt16 nMapTokens = sBibMapping.GetTokenCount(MAP_TOKEN);
+ for(sal_uInt16 i = 0; i < nMapTokens && i < COLUMN_COUNT; i++)
+ {
+ String sPair = sBibMapping.GetToken(i, MAP_TOKEN);
+ pNew->aColumnPairs[i].sLogicalColumnName = sPair.GetToken(0, PAIR_TOKEN);
+ pNew->aColumnPairs[i].sRealColumnName = sPair.GetToken(1, PAIR_TOKEN);
+ }
+ pMappingsArr->Insert(pNew, pMappingsArr->Count());
+ }
+ nIdx = USHRT_MAX == nIdx ? 0 : nIdx + 1;
+ }
+ while(sEntry.Len());
+ }
+}
+/* --------------------------------------------------
+
+ --------------------------------------------------*/
+BibDataManager::~BibDataManager()
+{
+ uno::Reference< XLoadable > xLoad(xForm, UNO_QUERY);
+ uno::Reference< lang::XComponent > xComp(xForm, UNO_QUERY);
+ if (xForm.is())
+ {
+ RemoveMeAsUidListener();
+ if (xLoad.is())
+ xLoad->unload();
+ if (xComp.is())
+ xComp->dispose();
+ xForm = NULL;
+ }
+ delete pMappingsArr;
+}
+//------------------------------------------------------------------------
+void BibDataManager::InsertFields(const uno::Reference< XFormComponent > & xGrid)
+{
+ if (!xGrid.is())
+ return;
+try
+{
+ uno::Reference< XNameAccess > xFields = getColumns(xForm);
+ if (!xFields.is())
+ return;
+
+ uno::Reference< XGridColumnFactory > xColFactory(xGrid, UNO_QUERY);
+ uno::Reference< XNameContainer > xColContainer(xGrid, UNO_QUERY);
+
+ uno::Reference< XPropertySet > xField;
+
+ uno::Sequence<rtl::OUString> aFields(xFields->getElementNames());
+ const rtl::OUString* pFields = aFields.getConstArray();
+ sal_Int32 nCount=aFields.getLength();
+ uno::Any aElement;
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ rtl::OUString aCurrentColName= pFields[i];
+
+ aElement = xFields->getByName(aCurrentColName);
+ xField = *(uno::Reference< XPropertySet > *)aElement.getValue();
+
+ sal_Int32 nFormatKey = *(sal_Int32*)xField->getPropertyValue(FM_PROP_FORMATKEY).getValue();
+
+ uno::Reference< XPropertySet > xCurrentCol = xColFactory->createColumn(getControlName(nFormatKey));
+
+ Any aColName; aColName <<= aCurrentColName;
+ xCurrentCol->setPropertyValue(FM_PROP_CONTROLSOURCE, aColName);
+ xCurrentCol->setPropertyValue(FM_PROP_LABEL, aColName);
+
+ xColContainer->insertByName(aCurrentColName, uno::Any(&xCurrentCol, ::getCppuType((Reference<XPropertySet>*)0)));
+ }
+}
+catch(...)
+{
+ DBG_ERROR("Exception in BibDataManager::InsertFields")
+}
+
+
+}
+/* --------------------------------------------------
+
+ --------------------------------------------------*/
+uno::Reference< awt::XControlModel > BibDataManager::createGridModel()
+{
+ return createGridModel(xForm);
+}
+/* --------------------------------------------------
+
+ --------------------------------------------------*/
+uno::Reference< awt::XControlModel > BibDataManager::createGridModel(const uno::Reference< XForm > & xDbForm)
+{
+ try
+ {
+ uno::Reference< XPropertySet > aFormPropSet( xDbForm, UNO_QUERY );
+ uno::Any aDbSource=aFormPropSet->getPropertyValue(C2U("Command"));
+ rtl::OUString aName=*(OUString*)aDbSource.getValue();
+
+ //xGridModel=loadGridModel(aName);
+ xGridModel=loadGridModel(gGridName);
+
+ uno::Reference< XNameContainer > xNameCont(xDbForm, UNO_QUERY);
+
+ if(xNameCont->hasByName(aName))
+ {
+ xNameCont->removeByName(aName);
+ }
+
+ xNameCont->insertByName(aName, uno::Any(&xGridModel, ::getCppuType((Reference<XFormComponent>*)0)));
+
+ }
+ catch(...)
+ {
+ DBG_ERROR("::createGridModel: something went wrong !");
+ }
+
+
+ return xGridModel;
+}
+/* --------------------------------------------------
+
+ --------------------------------------------------*/
+uno::Reference< XForm > BibDataManager::getDatabaseForm()
+{
+ return xForm;
+}
+/* --------------------------------------------------
+
+ --------------------------------------------------*/
+uno::Reference< XForm > BibDataManager::createDatabaseForm(const rtl::OUString& rURL, rtl::OUString& rTable)
+{
+ uno::Reference< XForm > xResult;
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+ xForm = uno::Reference< XForm > (xMgr->createInstance( C2U("com.sun.star.form.component.Form") ),
+ UNO_QUERY );
+
+ uno::Reference< XPropertySet > aPropertySet(xForm, UNO_QUERY );
+
+ aDataSourceURL = rURL;
+ if(aPropertySet.is())
+ {
+ Any aVal; aVal <<= rURL;
+ aPropertySet->setPropertyValue(C2U("DataSourceName"), aVal);
+ aVal <<= (sal_Int32)sdbc::ResultSetType::SCROLL_INSENSITIVE;
+ aPropertySet->setPropertyValue(C2U("ResultSetType"),aVal );
+ aVal <<= (sal_Int32)sdbc::ResultSetConcurrency::READ_ONLY;
+ aPropertySet->setPropertyValue(C2U("ResultSetConcurrency"), aVal);
+
+ //Caching for Performance
+ aVal <<= (sal_Int32)50;
+ aPropertySet->setPropertyValue(C2U("FetchSize"), aVal);
+
+ uno::Reference< sdbc::XConnection > xConnection = getConnection(rURL);
+ uno::Reference< sdbcx::XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY);
+ uno::Reference< XNameAccess > xTables = xSupplyTables.is() ?
+ xSupplyTables->getTables() : uno::Reference< XNameAccess > ();
+
+ uno::Sequence<rtl::OUString> aTableNameSeq;
+ if (xTables.is())
+ aTableNameSeq = xTables->getElementNames();
+
+ if(aTableNameSeq.getLength() > 0)
+ {
+ const rtl::OUString* pTableNames = aTableNameSeq.getConstArray();
+ if(rTable.getLength())
+ aActiveDataTable = rTable;
+ else
+ rTable = aActiveDataTable = pTableNames[0];
+
+ uno::Reference< registry::XRegistryKey > xRoot = xRegistry->getRootKey();
+ uno::Reference< registry::XRegistryKey > xKey = xRoot->openKey(aActiveDataTable);
+ if(!xKey.is())
+ xKey = xRoot->createKey(aActiveDataTable);
+
+ xSourceProps=uno::Reference< XPropertySet > (xKey, UNO_QUERY);
+
+ aVal <<= aActiveDataTable;
+ aPropertySet->setPropertyValue(C2U("Command"), aVal);
+ aVal <<= (sal_Int32)CommandType::TABLE;
+ aPropertySet->setPropertyValue(C2U("CommandType"), aVal);
+
+
+ uno::Reference< sdbc::XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ aQuoteChar = xMetaData->getIdentifierQuoteString();
+
+ uno::Reference< sdb::XSQLQueryComposerFactory > xFactory(xConnection, UNO_QUERY);
+ xParser = xFactory->createQueryComposer();
+
+ rtl::OUString aString(C2U("SELECT * FROM "));
+ aString += aQuoteChar;
+ aString += aActiveDataTable;
+ aString += aQuoteChar;
+ xParser->setQuery(aString);
+ setQueryField(getQueryField());
+ startQueryWith(getQueryString());
+
+ xResult = xForm;
+ }
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("::createDatabaseForm: something went wrong !");
+ }
+
+
+ return xResult;
+}
+//------------------------------------------------------------------------
+uno::Sequence<rtl::OUString> BibDataManager::getDataSources()
+{
+ uno::Sequence<rtl::OUString> aTableNameSeq;
+
+ try
+ {
+ uno::Reference< sdbcx::XTablesSupplier > xSupplyTables(getConnection(xForm), UNO_QUERY);
+ uno::Reference< XNameAccess > xTables;
+ if (xSupplyTables.is())
+ xTables = xSupplyTables->getTables();
+ if (xTables.is())
+ aTableNameSeq = xTables->getElementNames();
+ }
+ catch(...)
+ {
+ DBG_ERROR("::getDataSources: something went wrong !");
+ }
+
+
+ return aTableNameSeq;
+}
+//------------------------------------------------------------------------
+rtl::OUString BibDataManager::getActiveDataTable()
+{
+ return aActiveDataTable;
+}
+//------------------------------------------------------------------------
+uno::Reference< XSQLQueryComposer > BibDataManager::getParser()
+{
+ return xParser;
+}
+//------------------------------------------------------------------------
+void BibDataManager::setFilter(const rtl::OUString& rQuery)
+{
+ try
+ {
+ xParser->setFilter(rQuery);
+ rtl::OUString aQuery=xParser->getFilter();
+ uno::Reference< XPropertySet > aPropertySet(xForm, UNO_QUERY );
+ Any aVal; aVal <<= aQuery;
+ aPropertySet->setPropertyValue(C2U("Filter"), aVal);
+ BOOL bVal = sal_True;
+ aVal.setValue(&bVal, ::getBooleanCppuType());
+ aPropertySet->setPropertyValue(C2U("ApplyFilter"), aVal);
+ uno::Reference< XLoadable > xLoadable(xForm, UNO_QUERY );
+ xLoadable->reload();
+ }
+ catch(...)
+ {
+ DBG_ERROR("::setFilterOnActiveDataSource: something went wrong !");
+ }
+
+
+}
+//------------------------------------------------------------------------
+rtl::OUString BibDataManager::getFilter()
+{
+
+ rtl::OUString aQueryString;
+ try
+ {
+ uno::Reference< XPropertySet > aPropertySet(xForm, UNO_QUERY );
+ uno::Any aQuery=aPropertySet->getPropertyValue(C2U("Filter"));
+
+ if(aQuery.getValueType() == ::getCppuType((OUString*)0))
+ {
+ aQueryString=*(OUString*)aQuery.getValue();
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("::getFilterOnActiveDataSource: something went wrong !");
+ }
+
+
+ return aQueryString;
+
+}
+//------------------------------------------------------------------------
+uno::Sequence<rtl::OUString> BibDataManager::getQueryFields()
+{
+ uno::Sequence<rtl::OUString> aFieldSeq;
+ uno::Reference< XNameAccess > xFields = getColumns(xForm);
+ if (xFields.is())
+ aFieldSeq = xFields->getElementNames();
+ return aFieldSeq;
+}
+//------------------------------------------------------------------------
+void BibDataManager::setQueryField(const rtl::OUString& rQuery)
+{
+ try
+ {
+ Any aQuery; aQuery <<= rQuery;
+ xSourceProps->setPropertyValue(C2U("QueryField"),aQuery);
+
+ }
+ catch(...)
+ {
+ DBG_ERROR("Exception in BibDataManager::setQueryField")
+ }
+
+}
+//------------------------------------------------------------------------
+rtl::OUString BibDataManager::getQueryField()
+{
+ rtl::OUString aFieldString;
+ try
+ {
+ uno::Any aField=xSourceProps->getPropertyValue(C2U("QueryField"));
+
+ if(aField.getValueType() == ::getVoidCppuType())
+ {
+ uno::Sequence<rtl::OUString> aSeq=getQueryFields();
+ const rtl::OUString* pFields = aSeq.getConstArray();
+ if(aSeq.getLength()>0)
+ {
+ aFieldString=pFields[0];
+ }
+ }
+ else
+ {
+ aFieldString = *(OUString*)aField.getValue();
+ }
+
+ }
+ catch(...)
+ {
+ DBG_ERROR("Exception in BibDataManager::getQueryField")
+ }
+
+
+ return aFieldString;
+}
+//------------------------------------------------------------------------
+void BibDataManager::startQueryWith(const OUString& rQuery)
+{
+ try
+ {
+ uno::Any aQuery;
+ aQuery <<= rQuery;
+ xSourceProps->setPropertyValue(C2U("QueryText"), aQuery);
+
+ rtl::OUString aQueryString;
+ if(rQuery.len()>0)
+ {
+ aQueryString=aQuoteChar;
+ aQueryString+=getQueryField();
+ aQueryString+=aQuoteChar;
+ aQueryString+=C2U(" like '");
+ String sQuery(rQuery);
+ sQuery.SearchAndReplaceAll('?','_');
+ sQuery.SearchAndReplaceAll('*','%');
+ aQueryString += sQuery;
+ aQueryString+=C2U("%'");
+ }
+ setFilter(aQueryString);
+
+ }
+ catch(...)
+ {
+ DBG_ERROR("Exception in BibDataManager::StartQueryWith")
+ }
+
+}
+//------------------------------------------------------------------------
+rtl::OUString BibDataManager::getQueryString()
+{
+ rtl::OUString aQueryString;
+ try
+ {
+ uno::Any aQuery=xSourceProps->getPropertyValue(C2U("QueryText"));
+ if(aQuery.getValueType() == ::getCppuType((OUString*)0))
+ {
+ aQueryString=*(OUString*)aQuery.getValue();
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("Exception in BibDataManager::getQueryString")
+ }
+
+
+ return aQueryString;
+}
+/* -----------------03.12.99 15:05-------------------
+
+ --------------------------------------------------*/
+void BibDataManager::setActiveDataSource(const rtl::OUString& rURL)
+{
+ //unloadDatabase();
+ rtl::OUString uTable;
+ aDataSourceURL = rURL;
+ uno::Reference< XPropertySet > aPropertySet(xForm, UNO_QUERY );
+ if(aPropertySet.is())
+ {
+ Any aVal; aVal <<= rURL;
+ aPropertySet->setPropertyValue(C2U("DataSourceName"), aVal);
+ uno::Sequence<rtl::OUString> aTableNameSeq;
+ uno::Reference< sdbc::XConnection > xConnection = getConnection(xForm);
+ uno::Reference< sdbcx::XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY);
+ if(xSupplyTables.is())
+ {
+ uno::Reference< XNameAccess > xAccess = xSupplyTables->getTables();
+ aTableNameSeq = xAccess->getElementNames();
+ }
+ if(aTableNameSeq.getLength() > 0)
+ {
+ const rtl::OUString* pTableNames = aTableNameSeq.getConstArray();
+ aActiveDataTable = pTableNames[0];
+ aVal <<= aActiveDataTable;
+ aPropertySet->setPropertyValue(C2U("Command"), aVal);
+ rtl::OUString aString(C2U("SELECT * FROM "));
+ aString+=aQuoteChar;
+ aString+=aActiveDataTable;
+ aString+=aQuoteChar;
+ xParser->setQuery(aString);
+ setQueryField(getQueryField());
+ startQueryWith(getQueryString());
+ setActiveDataTable(aActiveDataTable);
+ }
+ FeatureStateEvent aEvent;
+ util::URL aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ //aEvent.Source = (XDispatch *) this;
+ aEvent.FeatureDescriptor = getActiveDataTable();
+
+ uno::Sequence<rtl::OUString> aStringSeq = getDataSources();
+ aEvent.State.setValue(&aStringSeq, ::getCppuType((uno::Sequence<rtl::OUString>*)0));
+
+ if(pToolbar)
+ {
+ aURL.Complete =C2U(".uno:Bib/source");
+ aEvent.FeatureURL = aURL;
+ pToolbar->statusChanged( aEvent );
+ }
+ if(pGridWin)
+ {
+ aURL.Complete =C2U(".uno:Bib/newGridModel");
+ aEvent.FeatureURL = aURL;
+ uno::Reference< awt::XControlModel > xModel = createGridModel();
+ aEvent.State.setValue(&xModel, ::getCppuType((Reference<awt::XControlModel>*)0));
+ pGridWin->statusChanged( aEvent );
+ }
+ }
+}
+/* --------------------------------------------------
+
+ --------------------------------------------------*/
+void BibDataManager::setActiveDataTable(const rtl::OUString& rTable)
+{
+ ResetIdentifierMapping();
+ try
+ {
+ sal_Bool bFlag=sal_False;
+ uno::Reference< XPropertySet > aPropertySet(xForm, UNO_QUERY );
+
+ if(aPropertySet.is())
+ {
+ uno::Reference< sdbc::XConnection > xConnection = getConnection(xForm);
+ uno::Reference< sdbcx::XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY);
+ uno::Reference< XNameAccess > xAccess = xSupplyTables->getTables();
+ uno::Sequence<rtl::OUString> aTableNameSeq = xAccess->getElementNames();
+ sal_uInt32 nCount = aTableNameSeq.getLength();
+ const rtl::OUString* pTableNames = aTableNameSeq.getConstArray();
+
+ for(sal_Int32 i=0;i<nCount;i++)
+ {
+ if(rTable == pTableNames[i])
+ {
+ aActiveDataTable=rTable;
+ Any aVal; aVal <<= rTable;
+ aPropertySet->setPropertyValue(C2U("Command"), aVal);
+ bFlag=sal_True;
+ break;
+ }
+ }
+ if(bFlag)
+ {
+/* if(xGridModel.is())
+ {
+ saveGridModel(xGridModel);
+ }*/
+
+ uno::Reference< registry::XRegistryKey > xRoot = xRegistry->getRootKey();
+ uno::Reference< registry::XRegistryKey > xKey = xRoot->openKey(aActiveDataTable);
+
+ if(!xKey.is())
+ xKey = xRoot->createKey(aActiveDataTable);
+
+ xSourceProps=uno::Reference< XPropertySet > (xKey, UNO_QUERY);
+
+ uno::Reference< sdbc::XDatabaseMetaData > xMetaData = xConnection->getMetaData();
+ aQuoteChar = xMetaData->getIdentifierQuoteString();
+
+ uno::Reference< sdb::XSQLQueryComposerFactory > xFactory(xConnection, UNO_QUERY);
+ xParser = xFactory->createQueryComposer();
+
+ rtl::OUString aString(C2U("SELECT * FROM "));
+ aString+=aQuoteChar;
+ aString+=aActiveDataTable;
+ aString+=aQuoteChar;
+ xParser->setQuery(aString);
+
+ setQueryField(getQueryField());
+ startQueryWith(getQueryString());
+
+ BibModul::SetBibliographyURL(aDataSourceURL, aActiveDataTable);
+ }
+ if(pBibView)
+ pBibView->UpdatePages();
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("::setActiveDataTable: something went wrong !");
+ }
+
+}
+//------------------------------------------------------------------------
+void BibDataManager::loadDatabase()
+{
+ if(xForm.is())
+ {
+ uno::Reference< XLoadable > xFormAsLoadable(xForm, UNO_QUERY );
+ DBG_ASSERT(xFormAsLoadable.is(), "BibDataManager::loadDatabase : invalid form !");
+ xFormAsLoadable->load();
+ xFormAsLoadable->reload(); // why ? may be very expensive !
+
+ SetMeAsUidListener();
+ }
+}
+//------------------------------------------------------------------------
+void BibDataManager::unloadDatabase()
+{
+ if(xForm.is())
+ {
+ RemoveMeAsUidListener();
+ uno::Reference< XLoadable > xFormAsLoadable(xForm, UNO_QUERY );
+ DBG_ASSERT(xFormAsLoadable.is(), "BibDataManager::unloadDatabase : invalid form !");
+ xFormAsLoadable->unload();
+ }
+}
+//------------------------------------------------------------------------
+uno::Reference< awt::XControlModel > BibDataManager::loadGridModel(const rtl::OUString& rName)
+{
+ uno::Reference< awt::XControlModel > xModel;
+
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+ uno::Reference< XInterface > xObject = xMgr->createInstance(C2U("com.sun.star.form.component.GridControl"));
+ xModel=uno::Reference< awt::XControlModel > ( xObject, UNO_QUERY );
+ uno::Reference< XPropertySet > xPropSet( xModel, UNO_QUERY );
+ uno::Any aDbSource; aDbSource <<= rName;
+ xPropSet->setPropertyValue( C2U("Name"),aDbSource);
+ rtl::OUString aControlName(C2U("com.sun.star.form.control.ExtendedGridControl"));
+ uno::Any aAny; aAny <<= aControlName;
+ xPropSet->setPropertyValue( C2U("DefaultControl"),aAny );
+
+ uno::Reference< XFormComponent > aFormComp(xModel,UNO_QUERY );
+ InsertFields(aFormComp);
+
+ rtl::OUString uProp(C2U("HelpURL"));
+ uno::Reference< XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo();
+ if(xPropInfo->hasPropertyByName(uProp))
+ {
+ String sId(C2S("HID:"));
+ sId += HID_BIB_DB_GRIDCTRL;
+ uno::Any aVal; aVal <<= OUString(sId);
+ xPropSet->setPropertyValue(uProp, aVal);
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("::loadGridModel: something went wrong !");
+ }
+
+
+ return xModel;
+}
+//------------------------------------------------------------------------
+/*void BibDataManager::saveGridModel(const uno::Reference< awt::XControlModel > & rGridModel)
+{
+ try
+ {
+ uno::Reference< XPersistObject > aPersistObject(rGridModel, UNO_QUERY );
+
+ uno::Any aGridModel(&aPersistObject, ::getCppuType((const XPersistObject*)0));
+
+ xSourceProps->setPropertyValue(gGridName,aGridModel);
+ }
+ catch(...)
+ {
+ DBG_ERROR("::saveGridModelData: something went wrong !");
+ }
+
+}*/
+//------------------------------------------------------------------------
+uno::Reference< XPropertySet > BibDataManager::createGlobalProperties()
+{
+ try
+ {
+ uno::Reference< registry::XRegistryKey > xRoot = xRegistry->getRootKey();
+ uno::Reference< registry::XRegistryKey > xKey = xRoot->openKey(gGlobalName);
+ if(!xKey.is())
+ xKey = xRoot->createKey(gGlobalName);
+
+ return uno::Reference< XPropertySet > (xKey, UNO_QUERY);
+ }
+
+ catch(...)
+ {
+ DBG_ERROR("::getViewProperties: something went wrong !");
+ }
+
+ return uno::Reference< XPropertySet > ();
+}
+//------------------------------------------------------------------------
+void BibDataManager::setViewSize(long nSize)
+{
+ try
+ {
+ uno::Any aViewSize; aViewSize <<= (sal_Int32) nSize;
+ xGlobalProps->setPropertyValue(gViewSize,aViewSize);
+ }
+ catch(...)
+ {
+ DBG_ERROR("::setViewSize: something went wrong !");
+ }
+
+}
+//------------------------------------------------------------------------
+long BibDataManager::getViewSize()
+{
+ long nSize=0;
+ try
+ {
+ uno::Any aViewSize=xGlobalProps->getPropertyValue(gViewSize);
+
+ if(aViewSize.getValueType() != ::getVoidCppuType())
+ {
+ aViewSize >>= nSize;
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("::getViewSize: something went wrong !");
+ }
+ return nSize;
+}
+//------------------------------------------------------------------------
+void BibDataManager::setBeamerSize(long nSize)
+{
+ try
+ {
+ uno::Any aBeamerSize; aBeamerSize <<= (sal_Int32) nSize;
+ xGlobalProps->setPropertyValue(gBeamerSize,aBeamerSize);
+ }
+ catch(...)
+ {
+ DBG_ERROR("::setBeamerSize: something went wrong !");
+ }
+
+}
+//------------------------------------------------------------------------
+long BibDataManager::getBeamerSize()
+{
+ long nSize=0;
+ try
+ {
+ uno::Any aBeamerSize=xGlobalProps->getPropertyValue(gBeamerSize);
+
+ if(aBeamerSize.getValueType() != ::getVoidCppuType())
+ {
+ aBeamerSize >>= nSize;
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("::getBeamerSize: something went wrong !");
+ }
+ return nSize;
+}
+//------------------------------------------------------------------------
+uno::Reference< XPropertySet > BibDataManager::getViewProperties()
+{
+ try
+ {
+ uno::Reference< registry::XRegistryKey > xKey = uno::Reference< registry::XRegistryKey > (xSourceProps, UNO_QUERY);
+ uno::Reference< registry::XRegistryKey > xViewKey=xKey->openKey(gViewName);
+ if(!xViewKey.is())
+ {
+ xViewKey=xKey->createKey(gViewName);
+ }
+ return uno::Reference< XPropertySet > (xViewKey, UNO_QUERY);
+ }
+ catch(...)
+ {
+ DBG_ERROR("::getViewProperties: something went wrong !");
+ }
+ return uno::Reference< XPropertySet > ();
+}
+//------------------------------------------------------------------------
+rtl::OUString BibDataManager::getControlName(sal_Int32 nFormatKey )
+{
+ rtl::OUString aResStr;
+ switch (nFormatKey)
+ {
+ case DataType::BIT:
+ aResStr=C2U("CheckBox");
+ break;
+ case DataType::TINYINT:
+ case DataType::SMALLINT:
+ case DataType::INTEGER:
+ aResStr=C2U("NumericField"); ;
+ break;
+ case DataType::REAL:
+ case DataType::DOUBLE:
+ case DataType::NUMERIC:
+ case DataType::DECIMAL:
+ aResStr=C2U("FormattedField");
+ break;
+ case DataType::TIMESTAMP:
+ aResStr=C2U("FormattedField");
+ break;
+ case DataType::DATE:
+ aResStr=C2U("DateField");
+ break;
+ case DataType::TIME:
+ aResStr=C2U("TimeField");
+ break;
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
+ default:
+ aResStr=C2U("TextField");
+ break;
+ }
+ return aResStr;
+}
+//------------------------------------------------------------------------
+uno::Reference< awt::XControlModel > BibDataManager::loadControlModel(const rtl::OUString& rName, sal_Bool bForceListBox)
+{
+ uno::Reference< awt::XControlModel > xModel;
+
+ rtl::OUString aName(C2U("View_"));
+ aName+=rName;
+
+ try
+ {
+ uno::Reference< io::XPersistObject > aObject;
+ uno::Any aControlModel=xSourceProps->getPropertyValue(aName);
+ if(aControlModel.getValueType() == ::getCppuType((Reference<io::XPersistObject>*)0))
+ {
+ aObject=*(uno::Reference< io::XPersistObject > *)aControlModel.getValue();
+ }
+
+ if(!aObject.is() )
+ {
+ uno::Reference< XNameAccess > xFields = getColumns(xForm);
+ if (!xFields.is())
+ return xModel;
+ uno::Reference< XPropertySet > xField;
+
+ uno::Any aElement;
+
+ if(xFields->hasByName(rName))
+ {
+ aElement = xFields->getByName(rName);
+ xField = *(uno::Reference< XPropertySet > *)aElement.getValue();
+ uno::Reference< XPropertySetInfo > xInfo = xField.is() ? xField->getPropertySetInfo() : uno::Reference< XPropertySetInfo > ();
+ sal_Int32 nFormatKey = 0;
+ if (xInfo.is() && xInfo->hasPropertyByName(FM_PROP_FORMATKEY))
+ xField->getPropertyValue(FM_PROP_FORMATKEY) >>= nFormatKey;
+
+ rtl::OUString aInstanceName(C2U("com.sun.star.form.component."));
+
+ if (bForceListBox)
+ aInstanceName += C2U("ListBox");
+ else
+ aInstanceName += getControlName(nFormatKey);
+
+ uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+ uno::Reference< XInterface > xObject = xMgr->createInstance(aInstanceName);
+ xModel=uno::Reference< awt::XControlModel > ( xObject, UNO_QUERY );
+ uno::Reference< XPropertySet > xPropSet( xModel, UNO_QUERY );
+ uno::Any aFieldName; aFieldName <<= aName;
+ xPropSet->setPropertyValue( FM_PROP_NAME,aFieldName);
+
+ uno::Any aDbSource; aDbSource <<= rName;
+ xPropSet->setPropertyValue(FM_PROP_CONTROLSOURCE,aDbSource);
+
+ uno::Reference< XFormComponent > aFormComp(xModel,UNO_QUERY );
+
+ uno::Reference< XNameContainer > xNameCont(xForm, UNO_QUERY);
+ xNameCont->insertByName(aName, uno::Any(&xModel, ::getCppuType((Reference<XFormComponent>*)0)));
+ }
+ }
+ else
+ {
+ xModel=uno::Reference< awt::XControlModel > (aObject,UNO_QUERY );
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("::loadControlModel: something went wrong !");
+ }
+ return xModel;
+}
+//------------------------------------------------------------------------
+void BibDataManager::saveCtrModel(const rtl::OUString& rName,const uno::Reference< awt::XControlModel > & rCtrModel)
+{
+ try
+ {
+ rtl::OUString aName(C2U("View_"));
+ aName+=rName;
+
+ uno::Reference< io::XPersistObject > aPersistObject(rCtrModel, UNO_QUERY );
+
+ uno::Any aModel(&aPersistObject, ::getCppuType((Reference<io::XPersistObject>*)0));
+
+ xSourceProps->setPropertyValue(aName,aModel);
+ }
+ catch(...)
+ {
+ DBG_ERROR("::saveCtrModel: something went wrong !");
+ }
+
+}
+//------------------------------------------------------------------------
+void BibDataManager::disposing( const lang::EventObject& Source )
+{
+ try
+ {
+// if ( xForm.is())
+// {
+// uno::Reference< XPropertySet > aPropSet(xForm, UNO_QUERY );
+// aPropSet->removePropertyChangeListener(FM_PROP_EDITMODE, this);
+// }
+ }
+ catch(...)
+ {
+ DBG_ERROR("::propertyChange: something went wrong !");
+ }
+
+
+
+}
+//------------------------------------------------------------------------
+void BibDataManager::propertyChange(const beans::PropertyChangeEvent& evt) throw( uno::RuntimeException )
+{
+ try
+ {
+ sal_Bool bFlag=sal_False;
+ if(evt.PropertyName == FM_PROP_VALUE)
+ {
+ if( evt.NewValue.getValueType() == ::getCppuType((Reference<io::XInputStream>*)0) )
+ {
+ uno::Reference< io::XDataInputStream > xStream(
+ *(const uno::Reference< io::XInputStream > *)evt.NewValue.getValue(), UNO_QUERY );
+ aUID <<= xStream->readUTF();
+ }
+ else
+ aUID = evt.NewValue;
+
+ uno::Reference< sdbcx::XRowLocate > xLocate(xBibCursor, UNO_QUERY);
+ DBG_ASSERT(xLocate.is(), "BibDataManager::propertyChange : invalid cursor !");
+ bFlag = xLocate->moveToBookmark(aUID);
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("::propertyChange: something went wrong !");
+ }
+
+
+}
+//------------------------------------------------------------------------
+void BibDataManager::SetMeAsUidListener()
+{
+try
+{
+ uno::Reference< XNameAccess > xFields = getColumns(xForm);
+ if (!xFields.is())
+ return;
+
+ uno::Sequence<rtl::OUString> aFields(xFields->getElementNames());
+ const rtl::OUString* pFields = aFields.getConstArray();
+ sal_Int32 nCount=aFields.getLength();
+ String StrUID(C2S(STR_UID));
+ rtl::OUString theFieldName;
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ String aName= pFields[i];
+
+ if(aName.EqualsIgnoreCaseAscii(StrUID))
+ {
+ theFieldName=pFields[i];
+ break;
+ }
+ }
+
+ if(theFieldName.len()>0)
+ {
+ uno::Reference< XPropertySet > xPropSet;
+ uno::Any aElement;
+
+ aElement = xFields->getByName(theFieldName);
+ xPropSet = *(uno::Reference< XPropertySet > *)aElement.getValue();
+
+ xPropSet->addPropertyChangeListener(FM_PROP_VALUE, this);
+ }
+
+}
+catch(...)
+{
+ DBG_ERROR("Exception in BibDataManager::SetMeAsUidListener")
+}
+
+
+}
+//------------------------------------------------------------------------
+void BibDataManager::RemoveMeAsUidListener()
+{
+try
+{
+ uno::Reference< XNameAccess > xFields = getColumns(xForm);
+ if (!xFields.is())
+ return;
+
+
+ uno::Sequence<rtl::OUString> aFields(xFields->getElementNames());
+ const rtl::OUString* pFields = aFields.getConstArray();
+ sal_Int32 nCount=aFields.getLength();
+ String StrUID(C2S(STR_UID));
+ rtl::OUString theFieldName;
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ String aName= pFields[i];
+
+ if(aName.EqualsIgnoreCaseAscii(StrUID))
+ {
+ theFieldName=pFields[i];
+ break;
+ }
+ }
+
+ if(theFieldName.len()>0)
+ {
+ uno::Reference< XPropertySet > xPropSet;
+ uno::Any aElement;
+
+ aElement = xFields->getByName(theFieldName);
+ xPropSet = *(uno::Reference< XPropertySet > *)aElement.getValue();
+
+ xPropSet->removePropertyChangeListener(FM_PROP_VALUE, this);
+ }
+
+}
+catch(...)
+{
+ DBG_ERROR("Exception in BibDataManager::RemoveMeAsUidListener")
+}
+
+
+}
+/* -----------------02.11.99 16:11-------------------
+
+ --------------------------------------------------*/
+sal_Bool BibDataManager::moveRelative(sal_Int32 nCount)
+{
+ sal_Bool bRet = sal_False;
+ try
+ {
+ uno::Reference< XResultSet > xCursor(xForm, UNO_QUERY);
+ uno::Reference< XResultSetUpdate > xCursorUpdate(xForm, UNO_QUERY);
+ if (xCursor.is() && xCursorUpdate.is())
+ {
+ bRet = xCursor->relative(nCount);
+ if (xCursor->isAfterLast())
+ xCursorUpdate->moveToInsertRow();
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("Exception in BibDataManager::moveRelative")
+ }
+
+ return bRet;
+}
+/* -----------------11.11.99 15:51-------------------
+
+ --------------------------------------------------*/
+void BibDataManager::CreateMappingDialog(Window* pParent)
+{
+ MappingDialog_Impl* pDlg = new MappingDialog_Impl(pParent, this);
+ if(RET_OK == pDlg->Execute() && pBibView)
+ {
+ unloadDatabase();
+ pBibView->UpdatePages();
+ loadDatabase();
+ }
+ delete pDlg;
+}
+/* --------------------------------------------------
+
+ --------------------------------------------------*/
+rtl::OUString BibDataManager::CreateDBChangeDialog(Window* pParent)
+{
+ rtl::OUString uRet;
+ DBChangeDialog_Impl * pDlg = new DBChangeDialog_Impl(pParent, this );
+ if(RET_OK == pDlg->Execute())
+ {
+ String sNewURL = pDlg->GetCurrentURL();
+ if(sNewURL != String(getActiveDataSource()))
+ {
+ uRet = sNewURL;
+ }
+ }
+ delete pDlg;
+ return uRet;
+}
+/* -----------------12.11.99 14:26-------------------
+
+ --------------------------------------------------*/
+const Mapping* BibDataManager::GetMapping(const rtl::OUString& rTableName, const rtl::OUString* pURL) const
+{
+ String sTable(rTableName);
+ String sURL(aDataSourceURL);
+ if(pURL)
+ sURL = String(*pURL);
+ for(sal_uInt16 i = 0; i < pMappingsArr->Count(); i++)
+ {
+ sal_Bool bCaseSensitive = sal_True;
+ INetURLObject aTempURL(sURL);
+ if(INET_PROT_FILE == aTempURL.GetProtocol())
+ {
+ sal_Bool bCaseSensitive = lcl_IsCaseSensitive(aTempURL.GetMainURL());
+// DirEntry aEnt(aTempURL.GetPath());
+// bCaseSensitive = aEnt.IsCaseSensitive();
+ }
+
+ const Mapping* pMapping = pMappingsArr->GetObject(i);
+ sal_Bool bURLEqual = bCaseSensitive ?
+ sURL.Equals(pMapping->sURL) :
+ sURL.EqualsIgnoreCaseAscii(pMapping->sURL);
+
+ if(sTable == pMapping->sTableName && bURLEqual)
+ return pMapping;
+ }
+ return 0;
+}
+/* -----------------12.11.99 14:26-------------------
+
+ --------------------------------------------------*/
+void BibDataManager::SetMapping(const rtl::OUString& rTableName, const Mapping* pSetMapping)
+{
+ ResetIdentifierMapping();
+ String sTable(rTableName);
+ const String sURL(aDataSourceURL);
+ for(sal_uInt16 i = 0; i < pMappingsArr->Count(); i++)
+ {
+ const Mapping* pMapping = pMappingsArr->GetObject(i);
+
+ sal_Bool bCaseSensitive = sal_True;
+ INetURLObject aTempURL(sURL);
+ if(INET_PROT_FILE == aTempURL.GetProtocol())
+ {
+ sal_Bool bCaseSensitive = lcl_IsCaseSensitive(aTempURL.GetMainURL());
+// DirEntry aEnt(aTempURL.GetPath());
+// bCaseSensitive = aEnt.IsCaseSensitive();
+ }
+
+ sal_Bool bURLEqual = bCaseSensitive ?
+ sURL.Equals(pMapping->sURL) :
+ sURL.EqualsIgnoreCaseAscii(pMapping->sURL);
+
+ if(sTable == pMapping->sTableName && bURLEqual)
+ {
+ pMappingsArr->DeleteAndDestroy(i, 1);
+ break;
+ }
+ }
+ Mapping* pNew = new Mapping(*pSetMapping);
+ pMappingsArr->Insert(pNew, pMappingsArr->Count());
+
+ SfxAppIniManagerProperty aProp;
+ GetpApp()->Property( aProp );
+ SfxIniManager* pIniMan = aProp.GetIniManager();
+ if(pIniMan)
+ {
+ //kill all old entries an rewrite all mappings
+ String sTempEntry;
+ sal_uInt16 nIdx = USHRT_MAX;
+ do
+ {
+ String sDBKey(C2S(BIBLIOGRAPHY_INI_DB_ENTRY));
+ String sMapKey = C2S(BIBLIOGRAPHY_INI_MAPPING);
+ if(USHRT_MAX != nIdx)
+ {
+ sDBKey += nIdx;
+ sMapKey += nIdx;
+ }
+ sTempEntry = pIniMan->ReadKey( C2S(BIBLIOGRAPHY_INI_GROUP),
+ sDBKey );
+ pIniMan->DeleteKey( C2S(BIBLIOGRAPHY_INI_GROUP), sDBKey);
+ pIniMan->DeleteKey( C2S(BIBLIOGRAPHY_INI_GROUP), sMapKey);
+ nIdx = USHRT_MAX == nIdx ? 0 : nIdx +1;
+ }while(sTempEntry.Len());
+
+ nIdx = USHRT_MAX;
+ for(sal_uInt16 i = 0; i < pMappingsArr->Count(); i++)
+ {
+ const Mapping* pMapping = pMappingsArr->GetObject(i);
+
+ String sDataTableEntry(pMapping->sURL);
+ sDataTableEntry = pIniMan->UsePathVars( sDataTableEntry );
+ sDataTableEntry += ';';
+ sDataTableEntry += pMapping->sTableName;
+
+ String sDBKey = C2S(BIBLIOGRAPHY_INI_DB_ENTRY);
+ String sMapKey = C2S(BIBLIOGRAPHY_INI_MAPPING);
+ if(USHRT_MAX != nIdx)
+ {
+ sDBKey += nIdx;
+ sMapKey += nIdx;
+ }
+ pIniMan->WriteKey( C2S(BIBLIOGRAPHY_INI_GROUP), sDBKey, sDataTableEntry );
+
+ String sEntry;
+ for(sal_uInt16 nColumn = 0; nColumn < COLUMN_COUNT; nColumn++)
+ {
+ if(!pMapping->aColumnPairs[nColumn].sLogicalColumnName.Len() ||
+ !pMapping->aColumnPairs[nColumn].sRealColumnName.Len())
+ break;
+ sEntry += pMapping->aColumnPairs[nColumn].sLogicalColumnName;
+ sEntry += PAIR_TOKEN;
+ sEntry += pMapping->aColumnPairs[nColumn].sRealColumnName;
+ sEntry += MAP_TOKEN;
+ }
+ pIniMan->WriteKey( C2S(BIBLIOGRAPHY_INI_GROUP), sMapKey, sEntry );
+
+ nIdx = USHRT_MAX == nIdx ? 0 : nIdx +1;
+ }
+ pIniMan->Flush();
+ }
+}
+/* -----------------06.12.99 15:11-------------------
+
+ --------------------------------------------------*/
+const String& BibDataManager::GetIdentifierMapping()
+{
+ if(!sIdentifierMapping.Len())
+ {
+ const Mapping* pMapping = GetMapping(getActiveDataTable());
+ sIdentifierMapping = GetDefColumnName(IDENTIFIER_POS);
+ if(pMapping)
+ {
+ for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
+ {
+ if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == sIdentifierMapping)
+ {
+ sIdentifierMapping = pMapping->aColumnPairs[nEntry].sRealColumnName;
+ break;
+ }
+ }
+ }
+ }
+ return sIdentifierMapping;
+}
+
diff --git a/extensions/source/bibliography/datman.hrc b/extensions/source/bibliography/datman.hrc
new file mode 100644
index 000000000..eb41a4f2a
--- /dev/null
+++ b/extensions/source/bibliography/datman.hrc
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * $RCSfile: datman.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#define BT_OK 1
+#define BT_CANCEL 2
+#define BT_HELP 3
+#define GB_MAPPING 4
+#define FT_IDENTIFIER 5
+#define LB_IDENTIFIER 6
+#define ST_NONE 7
+
+#define FT_AUTHORITYTYPE 8
+#define LB_AUTHORITYTYPE 9
+#define FT_ADDRESS 10
+#define LB_ADDRESS 11
+#define FT_ANNOTE 12
+#define LB_ANNOTE 13
+#define FT_AUTHOR 14
+#define LB_AUTHOR 15
+#define FT_TITLE 16
+#define LB_TITLE 17
+#define FT_MONTH 18
+#define LB_MONTH 19
+#define FT_YEAR 20
+#define LB_YEAR 21
+#define FT_ISBN 22
+#define LB_ISBN 23
+#define FT_BOOKTITLE 24
+#define LB_BOOKTITLE 25
+#define FT_CHAPTER 26
+#define LB_CHAPTER 27
+#define FT_EDITION 28
+#define LB_EDITION 29
+#define FT_EDITOR 30
+#define LB_EDITOR 31
+#define FT_HOWPUBLISHED 32
+#define LB_HOWPUBLISHED 33
+#define FT_INSTITUTION 34
+#define LB_INSTITUTION 35
+#define FT_JOURNAL 36
+#define LB_JOURNAL 37
+#define FT_NOTE 38
+#define LB_NOTE 39
+#define FT_NUMBER 40
+#define LB_NUMBER 41
+#define FT_ORGANIZATIONS 42
+#define LB_ORGANIZATIONS 43
+#define FT_PAGES 44
+#define LB_PAGES 45
+#define FT_PUBLISHER 46
+#define LB_PUBLISHER 47
+#define FT_SCHOOL 48
+#define LB_SCHOOL 49
+#define FT_SERIES 50
+#define LB_SERIES 51
+#define FT_REPORTTYPE 52
+#define LB_REPORTTYPE 53
+#define FT_VOLUME 54
+#define LB_VOLUME 55
+#define FT_URL 56
+#define LB_URL 57
+#define FT_CUSTOM1 58
+#define LB_CUSTOM1 59
+#define FT_CUSTOM2 60
+#define LB_CUSTOM2 61
+#define FT_CUSTOM3 62
+#define LB_CUSTOM3 63
+#define FT_CUSTOM4 64
+#define LB_CUSTOM4 65
+#define FT_CUSTOM5 66
+#define LB_CUSTOM5 67
+
+#define GB_SELECTION 68
+#define ST_ENTRY 69
+#define ST_URL 70
+#define LB_SELECTION 71
+#define HB_SELECTION 72
+
diff --git a/extensions/source/bibliography/datman.hxx b/extensions/source/bibliography/datman.hxx
new file mode 100644
index 000000000..d314512ac
--- /dev/null
+++ b/extensions/source/bibliography/datman.hxx
@@ -0,0 +1,253 @@
+/*************************************************************************
+ *
+ * $RCSfile: datman.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _BIB_DATMAN_HXX
+#define _BIB_DATMAN_HXX
+
+#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
+#include <com/sun/star/awt/XControlModel.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_
+#include <com/sun/star/form/XForm.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDB_XSQLQUERYCOMPOSER_HPP_
+#include <com/sun/star/sdb/XSQLQueryComposer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_REGISTRY_XSIMPLEREGISTRY_HPP_
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#endif
+
+class BibRegistry;
+class MappingArray;
+class Window;
+//-----------------------------------------------------------------------------
+#define COLUMN_COUNT 31
+#define IDENTIFIER_POS 0
+#define AUTHORITYTYPE_POS 1
+#define AUTHOR_POS 2
+#define TITLE_POS 3
+#define YEAR_POS 4
+#define ISBN_POS 5
+#define BOOKTITLE_POS 6
+#define CHAPTER_POS 7
+#define EDITION_POS 8
+#define EDITOR_POS 9
+#define HOWPUBLISHED_POS 10
+#define INSTITUTION_POS 11
+#define JOURNAL_POS 12
+#define MONTH_POS 13
+#define NOTE_POS 14
+#define ANNOTE_POS 15
+#define NUMBER_POS 16
+#define ORGANIZATIONS_POS 17
+#define PAGES_POS 18
+#define PUBLISHER_POS 19
+#define ADDRESS_POS 20
+#define SCHOOL_POS 21
+#define SERIES_POS 22
+#define REPORTTYPE_POS 23
+#define VOLUME_POS 24
+#define URL_POS 25
+#define CUSTOM1_POS 26
+#define CUSTOM2_POS 27
+#define CUSTOM3_POS 28
+#define CUSTOM4_POS 29
+#define CUSTOM5_POS 30
+
+//-----------------------------------------------------------------------------
+struct StringPair
+{
+ String sRealColumnName;
+ String sLogicalColumnName;
+};
+//-----------------------------------------------------------------------------
+struct Mapping
+{
+ String sTableName;
+ String sURL;
+ StringPair aColumnPairs[COLUMN_COUNT];
+};
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+class BibView;
+class BibToolBar;
+class BibGridwin;
+class BibDataManager : public cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener>
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > xForm;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xGridModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::registry::XSimpleRegistry > xRegistry;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSourceProps;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xGlobalProps;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLQueryComposer > xParser;
+ ::rtl::OUString aActiveDataTable;
+ ::rtl::OUString aDataSourceURL;
+ ::rtl::OUString aQuoteChar;
+// sal_Bool bNew;
+// sal_Bool bModified;
+ ::com::sun::star::uno::Any aUID;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xBibCursor;
+ MappingArray* pMappingsArr;
+
+ BibView* pBibView;
+ BibToolBar* pToolbar;
+ BibGridwin* pGridWin;
+
+ String aColumnDefaults[COLUMN_COUNT];
+ String sIdentifierMapping;
+protected:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createGlobalProperties();
+ void InsertFields(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > & xGrid);
+ void InitRegistry();
+ void SetMeAsUidListener();
+ void RemoveMeAsUidListener();
+
+ void UpdateAddressbookCursor(::rtl::OUString aSourceName);
+public:
+
+ BibDataManager(BibRegistry * pRegistry);
+ ~BibDataManager();
+
+ virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source );
+
+
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > createDatabaseForm(const ::rtl::OUString& rURL, ::rtl::OUString& rTableName);
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > getDatabaseForm();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > & xDbForm);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createGridModel();
+
+ void loadDatabase();
+ void unloadDatabase();
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> getDataSources();
+
+ ::rtl::OUString getActiveDataSource() {return aDataSourceURL;}
+ void setActiveDataSource(const ::rtl::OUString& rURL);
+
+ ::rtl::OUString getActiveDataTable();
+ void setActiveDataTable(const ::rtl::OUString& rTable);
+
+ void setFilter(const ::rtl::OUString& rQuery);
+ ::rtl::OUString getFilter();
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> getQueryFields();
+ void setQueryField(const ::rtl::OUString& rField);
+ ::rtl::OUString getQueryField();
+ void startQueryWith(const ::rtl::OUString& rQuery);
+ ::rtl::OUString getQueryString();
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLQueryComposer > getParser();
+
+// void saveGridModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & xDbForm);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > loadGridModel(const ::rtl::OUString& rName);
+
+ void setBeamerSize(long nSize);
+ long getBeamerSize();
+ void setViewSize(long nSize);
+ long getViewSize();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getViewProperties();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getChildViewProperties(const ::rtl::OUString& rName);
+
+ ::rtl::OUString getControlName(sal_Int32 nFormatKey );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > loadControlModel(const ::rtl::OUString& rName,
+ sal_Bool bForceListBox = sal_False);
+ void saveCtrModel(const ::rtl::OUString& rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & rCtrModel);
+
+// sal_Bool isNew() { return bNew;}
+// sal_Bool isModified() { return bModified;}
+
+ sal_Bool moveRelative(long nMove);
+
+ void CreateMappingDialog(Window* pParent);
+ ::rtl::OUString CreateDBChangeDialog(Window* pParent);
+ const Mapping* GetMapping(const ::rtl::OUString& rTableName, const ::rtl::OUString* pURL = 0) const;
+ void SetMapping(const ::rtl::OUString& rTableName, const Mapping* pMapping);
+
+ const String& GetDefColumnName(sal_uInt16 nIndex) const
+ {return aColumnDefaults[nIndex];}
+
+ void SetView(BibView* pView) {pBibView = pView;}
+
+ void SetToolbar(BibToolBar* pSet) {pToolbar = pSet;}
+ void SetGridWin(BibGridwin* pSet) {pGridWin = pSet;}
+
+ const String& GetIdentifierMapping();
+ void ResetIdentifierMapping() {sIdentifierMapping.Erase();}
+};
+
+
+#endif
diff --git a/extensions/source/bibliography/datman.src b/extensions/source/bibliography/datman.src
new file mode 100644
index 000000000..34c9465b2
--- /dev/null
+++ b/extensions/source/bibliography/datman.src
@@ -0,0 +1,1276 @@
+/*************************************************************************
+ *
+ * $RCSfile: datman.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//==================================================================
+// BibDataManager
+//
+//
+//
+// $Author: hr $ $Date: 2000-09-18 16:16:44 $ $Revision: 1.1.1.1 $
+// $Logfile: T:/sc/inc/scresid.hxv $ $Workfile: scresid.hxx $
+//------------------------------------------------------------------
+
+#include "bib.hrc"
+#include "datman.hrc"
+ModalDialog RID_DLG_MAPPING
+{
+ HelpID = HID_DLG_MAPPING;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 391 , 181 ) ;
+ Moveable = TRUE ;
+ Text = "Spaltenzuordung für Tabelle %1";
+ Text [ENGLISH] = "Column assignment for table %1";
+
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 338 , 3 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 338 , 18 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 338 , 36 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ };
+ GroupBox GB_MAPPING
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 329 , 175 ) ;
+ Text = "Spaltennamen";
+ Text [ENGLISH] = "Column names";
+ Text[ english_us ] = "Column names";
+ Text[ portuguese ] = "Nomes de coluna";
+ Text[ russian ] = "Íàçâàíèÿ êîëîíîê";
+ Text[ greek ] = "Ïíüìáôá óôçëþí";
+ Text[ dutch ] = "Kolomnamen";
+ Text[ french ] = "Noms des colonnes";
+ Text[ spanish ] = "Nombres de columna";
+ Text[ italian ] = "Nomi colonna";
+ Text[ danish ] = "Kolonnenavne";
+ Text[ swedish ] = "Kolumnnamn";
+ Text[ polish ] = "Nazwy kolumn";
+ Text[ portuguese_brazilian ] = "Column names";
+ Text[ japanese ] = "—ñ–¼";
+ Text[ korean ] = "¿­ À̸§";
+ Text[ chinese_simplified ] = "ÁÐÃû³Æ";
+ Text[ chinese_traditional ] = "Äæ¦W";
+ Text[ arabic ] = "ÃÓãÇÁ ÇáÃÚãÏÉ";
+ Text[ turkish ] = "Sütun adlarý";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_IDENTIFIER
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Kürzel";
+ Text [ENGLISH] = "Identifier";
+ Text[ english_us ] = "Identifier";
+ Text[ portuguese ] = "Abreviatura";
+ Text[ russian ] = "Ñîêðàùåíèå";
+ Text[ greek ] = "Óõíôüìåõóç";
+ Text[ dutch ] = "Initialen";
+ Text[ french ] = "Abréviation";
+ Text[ spanish ] = "Abreviatura";
+ Text[ italian ] = "Sigla";
+ Text[ danish ] = "Genvej";
+ Text[ swedish ] = "Initialer";
+ Text[ polish ] = "Inicja³y";
+ Text[ portuguese_brazilian ] = "Identifier";
+ Text[ japanese ] = "È—ª–¼";
+ Text[ korean ] = "À̴ϼÈ";
+ Text[ chinese_simplified ] = "±êʶ";
+ Text[ chinese_traditional ] = "ÁY¼g";
+ Text[ arabic ] = "ÇáÇÎÊÕÇÑ";
+ Text[ turkish ] = "Kýsaltma";
+ };
+ ListBox LB_IDENTIFIER
+ {
+ Pos = MAP_APPFONT ( 65 , 13 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_AUTHORITYTYPE
+ {
+ Pos = MAP_APPFONT ( 118 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Literaturart";
+ Text [ENGLISH] = "Type of literature";
+ Text[ english_us ] = "Type of literature";
+ Text[ portuguese ] = "Tipo de literatura";
+ Text[ russian ] = "Æàíð";
+ Text[ greek ] = "Åßäïò ëïãïôå÷íßáò";
+ Text[ dutch ] = "Soort literatuur";
+ Text[ french ] = "Genre";
+ Text[ spanish ] = "Tipo de literatura";
+ Text[ italian ] = "Tipo di letteratura";
+ Text[ danish ] = "Litteraturtype";
+ Text[ swedish ] = "Typ av litteratur";
+ Text[ polish ] = "Rodzaj literatury";
+ Text[ portuguese_brazilian ] = "Type of literature";
+ Text[ japanese ] = "–{‚Ì•ª—Þ";
+ Text[ korean ] = "Âü°í¹®Çå À¯Çü";
+ Text[ chinese_simplified ] = "ÎÄÏ×ÀàÐÍ";
+ Text[ chinese_traditional ] = "¤åÄmÃþ«¬";
+ Text[ arabic ] = "ÇáäæÚ";
+ Text[ turkish ] = "Kaynakça türü";
+ };
+ ListBox LB_AUTHORITYTYPE
+ {
+ Pos = MAP_APPFONT ( 171 , 13 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_AUTHOR
+ {
+ Pos = MAP_APPFONT ( 229 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Autor";
+ Text [ENGLISH] = "Author";
+ Text[ english_us ] = "Author";
+ Text[ portuguese ] = "Autor";
+ Text[ russian ] = "Àâòîð";
+ Text[ greek ] = "ÓõããñáöÝáò";
+ Text[ dutch ] = "Auteur";
+ Text[ french ] = "Auteur";
+ Text[ spanish ] = "Autor";
+ Text[ italian ] = "Autore";
+ Text[ danish ] = "Forfatter";
+ Text[ swedish ] = "Författare";
+ Text[ polish ] = "Autor";
+ Text[ portuguese_brazilian ] = "Author";
+ Text[ japanese ] = "’˜ŽÒ";
+ Text[ korean ] = "ÀúÀÚ";
+ Text[ chinese_simplified ] = "×÷Õß";
+ Text[ chinese_traditional ] = "§@ªÌ";
+ Text[ arabic ] = "ÇáãÄáÝ";
+ Text[ turkish ] = "Yazan";
+ };
+ ListBox LB_AUTHOR
+ {
+ Pos = MAP_APPFONT ( 282 , 13 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_TITLE
+ {
+ Pos = MAP_APPFONT ( 12 , 29 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Titel";
+ Text [ENGLISH] = "Title";
+ Text[ english_us ] = "Title";
+ Text[ portuguese ] = "Título";
+ Text[ russian ] = "Íàçâàíèå";
+ Text[ greek ] = "Ôßôëïò";
+ Text[ dutch ] = "Titel";
+ Text[ french ] = "Titre";
+ Text[ spanish ] = "Título";
+ Text[ italian ] = "Titolo";
+ Text[ danish ] = "Titel";
+ Text[ swedish ] = "Titel";
+ Text[ polish ] = "Tytu³";
+ Text[ portuguese_brazilian ] = "Title";
+ Text[ japanese ] = "À²ÄÙ";
+ Text[ korean ] = "Á¦¸ñ";
+ Text[ chinese_simplified ] = "±êÌâ";
+ Text[ chinese_traditional ] = "¼ÐÃD";
+ Text[ arabic ] = "ÇáÚäæÇä";
+ Text[ turkish ] = "Baþlýk";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_TITLE
+ {
+ Pos = MAP_APPFONT ( 65 , 28 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_MONTH
+ {
+ Pos = MAP_APPFONT ( 118 , 29 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Monat";
+ Text [ENGLISH] = "Month";
+ Text[ english_us ] = "Month";
+ Text[ portuguese ] = "Mês";
+ Text[ russian ] = "Ìåñÿö";
+ Text[ greek ] = "ÌÞíáò";
+ Text[ dutch ] = "Maand";
+ Text[ french ] = "Mois";
+ Text[ spanish ] = "Mes";
+ Text[ italian ] = "Mese";
+ Text[ danish ] = "Måned";
+ Text[ swedish ] = "Månad";
+ Text[ polish ] = "Miesi¹c";
+ Text[ portuguese_brazilian ] = "Month";
+ Text[ japanese ] = "ŒŽ";
+ Text[ korean ] = "´Þ";
+ Text[ chinese_simplified ] = "ÔÂ";
+ Text[ chinese_traditional ] = "¤ë";
+ Text[ arabic ] = "ÇáÔåÑ";
+ Text[ turkish ] = "Ay";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_MONTH
+ {
+ Pos = MAP_APPFONT ( 171 , 28 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_YEAR
+ {
+ Pos = MAP_APPFONT ( 229 , 29 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Jahr";
+ Text [ENGLISH] = "Year";
+ Text[ english_us ] = "Year";
+ Text[ portuguese ] = "Ano";
+ Text[ russian ] = "Ãîä";
+ Text[ greek ] = "¸ôïò";
+ Text[ dutch ] = "Jaar";
+ Text[ french ] = "An";
+ Text[ spanish ] = "Año";
+ Text[ italian ] = "Anno";
+ Text[ danish ] = "År";
+ Text[ swedish ] = "År";
+ Text[ polish ] = "Rok";
+ Text[ portuguese_brazilian ] = "Year";
+ Text[ japanese ] = "”N";
+ Text[ korean ] = "ÇØ";
+ Text[ chinese_simplified ] = "Äê";
+ Text[ chinese_traditional ] = "¦~";
+ Text[ arabic ] = "ÇáÓäÉ";
+ Text[ turkish ] = "Yýl";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_YEAR
+ {
+ Pos = MAP_APPFONT ( 282 , 28 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_ISBN
+ {
+ Pos = MAP_APPFONT ( 12 , 44 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "ISBN";
+ Text [ENGLISH] = "ISBN";
+ Text[ english_us ] = "ISBN";
+ Text[ portuguese ] = "ISBN";
+ Text[ russian ] = "ISBN";
+ Text[ greek ] = "ISBN";
+ Text[ dutch ] = "ISBN";
+ Text[ french ] = "ISBN";
+ Text[ spanish ] = "ISBN";
+ Text[ italian ] = "ISBN";
+ Text[ danish ] = "ISBN";
+ Text[ swedish ] = "ISBN";
+ Text[ polish ] = "ISBN";
+ Text[ portuguese_brazilian ] = "ISBN";
+ Text[ japanese ] = "ISBN";
+ Text[ korean ] = "ISBN";
+ Text[ chinese_simplified ] = "ISBN";
+ Text[ chinese_traditional ] = "ISBN";
+ Text[ arabic ] = "ISBN";
+ Text[ turkish ] = "ISBN";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_ISBN
+ {
+ Pos = MAP_APPFONT ( 65 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_BOOKTITLE
+ {
+ Pos = MAP_APPFONT ( 118 , 44 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Buchtitel";
+ Text [ENGLISH] = "Book title";
+ Text[ english_us ] = "Book title";
+ Text[ portuguese ] = "Título do livro";
+ Text[ russian ] = "Íàçâàíèå êíèãè";
+ Text[ greek ] = "Ôßôëïò âéâëßïõ";
+ Text[ dutch ] = "Boektitel";
+ Text[ french ] = "Titre du livre";
+ Text[ spanish ] = "Título del libro";
+ Text[ italian ] = "Titolo del libro";
+ Text[ danish ] = "Bogtitel";
+ Text[ swedish ] = "Boktitel";
+ Text[ polish ] = "Tytu³ ksi¹¿ki";
+ Text[ portuguese_brazilian ] = "Book title";
+ Text[ japanese ] = "‘–¼";
+ Text[ korean ] = "Ã¥ Á¦¸ñ";
+ Text[ chinese_simplified ] = "Êé¼®±êÌâ";
+ Text[ chinese_traditional ] = "®Ñ¦W";
+ Text[ arabic ] = "ÚäæÇä ÇáßÊÇÈ";
+ Text[ turkish ] = "Kitap baþlýðý";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_BOOKTITLE
+ {
+ Pos = MAP_APPFONT ( 171, 43 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_CHAPTER
+ {
+ Pos = MAP_APPFONT ( 229 , 44 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Kapitel";
+ Text [ENGLISH] = "Chapter";
+ Text[ english_us ] = "Chapter";
+ Text[ portuguese ] = "Capítulo";
+ Text[ russian ] = "Ãëàâà";
+ Text[ greek ] = "ÊåöÜëáéï";
+ Text[ dutch ] = "Hoofdstuk";
+ Text[ french ] = "Chapitre";
+ Text[ spanish ] = "Capítulo";
+ Text[ italian ] = "Capitolo";
+ Text[ danish ] = "Kapitel";
+ Text[ swedish ] = "Kapitel";
+ Text[ polish ] = "Rozdzia³";
+ Text[ portuguese_brazilian ] = "Chapter";
+ Text[ japanese ] = "Í";
+ Text[ korean ] = "Àå";
+ Text[ chinese_simplified ] = "ÕÂ";
+ Text[ chinese_traditional ] = "³¹";
+ Text[ arabic ] = "ÇáÝÕá";
+ Text[ turkish ] = "Bölüm";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_CHAPTER
+ {
+ Pos = MAP_APPFONT ( 282 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_EDITION
+ {
+ Pos = MAP_APPFONT ( 12 , 59 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Ausgabe";
+ Text [ENGLISH] = "Edition";
+ Text[ english_us ] = "Edition";
+ Text[ portuguese ] = "Edição";
+ Text[ russian ] = "Èçäàíèå";
+ Text[ greek ] = "ÅîáãùãÞ";
+ Text[ dutch ] = "Editie";
+ Text[ french ] = "Édition";
+ Text[ spanish ] = "Edición";
+ Text[ italian ] = "Edizione";
+ Text[ danish ] = "Udgave";
+ Text[ swedish ] = "Utgåva";
+ Text[ polish ] = "Wydanie";
+ Text[ portuguese_brazilian ] = "Edition";
+ Text[ japanese ] = "Ӂ";
+ Text[ korean ] = "ÆÇ";
+ Text[ chinese_simplified ] = "°æ±¾";
+ Text[ chinese_traditional ] = "ª©¥»";
+ Text[ arabic ] = "ÇáØÈÚÉ";
+ Text[ turkish ] = "Yayým";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_EDITION
+ {
+ Pos = MAP_APPFONT ( 65 , 58 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_EDITOR
+ {
+ Pos = MAP_APPFONT ( 118 , 59 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Herausgeber";
+ Text [ENGLISH] = "Editor";
+ Text[ english_us ] = "Editor";
+ Text[ portuguese ] = "Editor";
+ Text[ russian ] = "Ðåäàêòîð";
+ Text[ greek ] = "Åêäüôçò";
+ Text[ dutch ] = "Uitgever";
+ Text[ french ] = "Éditeur";
+ Text[ spanish ] = "Editor";
+ Text[ italian ] = "Editore";
+ Text[ danish ] = "Udgiver";
+ Text[ swedish ] = "Utgivare";
+ Text[ polish ] = "Wydawca";
+ Text[ portuguese_brazilian ] = "Editor";
+ Text[ japanese ] = "•ÒWŽÒ";
+ Text[ korean ] = "¹ßÇàÀÎ";
+ Text[ chinese_simplified ] = "·¢ÐÐÈË";
+ Text[ chinese_traditional ] = "¥Xª©°Ó";
+ Text[ arabic ] = "ÇáäÇÔÑ";
+ Text[ turkish ] = "Yayýmcý";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_EDITOR
+ {
+ Pos = MAP_APPFONT ( 171, 58) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_HOWPUBLISHED
+ {
+ Pos = MAP_APPFONT ( 229 , 59 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Ausgabeart";
+ Text [ENGLISH] = "How published";
+ Text[ english_us ] = "Publication type";
+ Text[ portuguese ] = "Tipo de publicação";
+ Text[ russian ] = "Òèï èçäàíèÿ";
+ Text[ greek ] = "Ôýðïò Ýêäïóçò";
+ Text[ dutch ] = "Wijze van publiceren";
+ Text[ french ] = "Mode de publication";
+ Text[ spanish ] = "Tipo de publicación";
+ Text[ italian ] = "Tipo di edizione";
+ Text[ danish ] = "Udgivelsestype";
+ Text[ swedish ] = "Utgivningstyp";
+ Text[ polish ] = "Rodzaj publikacji";
+ Text[ portuguese_brazilian ] = "How published";
+ Text[ japanese ] = "¶ÊÞ°À²Ìß";
+ Text[ korean ] = "¹ßÇà À¯Çü";
+ Text[ chinese_simplified ] = "·¢Ðз½Ê½";
+ Text[ chinese_traditional ] = "¥Xª©Ãþ«¬";
+ Text[ arabic ] = "ØÑíÞÉ ÇáäÔÑ";
+ Text[ turkish ] = "Yayým türü";
+ };
+ ListBox LB_HOWPUBLISHED
+ {
+ Pos = MAP_APPFONT ( 282 , 58 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_INSTITUTION
+ {
+ Pos = MAP_APPFONT ( 12 , 74 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Institution";
+ Text [ENGLISH] = "Institution";
+ Text[ english_us ] = "Institution";
+ Text[ portuguese ] = "Instituição";
+ Text[ russian ] = "Ó÷ðåæäåíèå";
+ Text[ greek ] = "ºäñõìá";
+ Text[ dutch ] = "Instelling";
+ Text[ french ] = "Institution";
+ Text[ spanish ] = "Institución";
+ Text[ italian ] = "Istituzione";
+ Text[ danish ] = "Institution";
+ Text[ swedish ] = "Institution";
+ Text[ polish ] = "Instytucja";
+ Text[ portuguese_brazilian ] = "Institution";
+ Text[ japanese ] = "‹@ŠÖ";
+ Text[ korean ] = "Çùȸ";
+ Text[ chinese_simplified ] = "»ú¹¹";
+ Text[ chinese_traditional ] = "ÉóÌÛ";
+ Text[ arabic ] = "ÇáåíÆÉ";
+ Text[ turkish ] = "Kurum";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_INSTITUTION
+ {
+ Pos = MAP_APPFONT ( 65 , 73 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_JOURNAL
+ {
+ Pos = MAP_APPFONT ( 118 , 74 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Zeitschrift";
+ Text [ENGLISH] = "Journal";
+ Text[ english_us ] = "Journal";
+ Text[ portuguese ] = "Revista";
+ Text[ russian ] = "Æóðíàë";
+ Text[ greek ] = "Ðåñéïäéêü";
+ Text[ dutch ] = "Tijdschrift";
+ Text[ french ] = "Revue";
+ Text[ spanish ] = "Revista";
+ Text[ italian ] = "Rivista";
+ Text[ danish ] = "Tidsskrift";
+ Text[ swedish ] = "Tidskrift";
+ Text[ polish ] = "Czasopismo";
+ Text[ portuguese_brazilian ] = "Journal";
+ Text[ japanese ] = "ŽGŽ";
+ Text[ korean ] = "ÀâÁö";
+ Text[ chinese_simplified ] = "ÔÓÖ¾";
+ Text[ chinese_traditional ] = "Âø»x";
+ Text[ arabic ] = "ãÌáÉ";
+ Text[ turkish ] = "Dergi";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_JOURNAL
+ {
+ Pos = MAP_APPFONT ( 171 , 73 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_NOTE
+ {
+ Pos = MAP_APPFONT ( 229 , 74 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Notiz";
+ Text [ENGLISH] = "Note";
+ Text[ english_us ] = "Note";
+ Text[ portuguese ] = "Anotações";
+ Text[ russian ] = "Ïðèìå÷àíèå";
+ Text[ greek ] = "Óçìåßùóç";
+ Text[ dutch ] = "Aantekening";
+ Text[ french ] = "Note";
+ Text[ spanish ] = "Nota";
+ Text[ italian ] = "Nota";
+ Text[ danish ] = "Note";
+ Text[ swedish ] = "Anteckning";
+ Text[ polish ] = "Notatka";
+ Text[ portuguese_brazilian ] = "Note";
+ Text[ japanese ] = "ÒÓ";
+ Text[ korean ] = "¸Þ¸ð";
+ Text[ chinese_simplified ] = "±¸×¢";
+ Text[ chinese_traditional ] = "µ§°O";
+ Text[ arabic ] = "ãáÇÍÙÉ";
+ Text[ turkish ] = "Not";
+ };
+ ListBox LB_NOTE
+ {
+ Pos = MAP_APPFONT ( 282 , 73 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_ANNOTE
+ {
+ Pos = MAP_APPFONT ( 12, 89 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Anmerkung";
+ Text [ENGLISH] = "Annotation";
+ Text[ english_us ] = "Annotation";
+ Text[ portuguese ] = "Anotações";
+ Text[ russian ] = "Ïîìåòêè";
+ Text[ greek ] = "ÐáñáôÞñçóç";
+ Text[ dutch ] = "Commentaar";
+ Text[ french ] = "Annotation";
+ Text[ spanish ] = "Anotación";
+ Text[ italian ] = "Annotazione";
+ Text[ danish ] = "Anmærkning";
+ Text[ swedish ] = "Anmärkning";
+ Text[ polish ] = "Adnotacja";
+ Text[ portuguese_brazilian ] = "Annotation";
+ Text[ japanese ] = "ºÒÝÄ";
+ Text[ korean ] = "ÁÖ¼®";
+ Text[ chinese_simplified ] = "˵Ã÷";
+ Text[ chinese_traditional ] = "³Æª`";
+ Text[ arabic ] = "ÊÚáíÞ ÊæÖíÍí";
+ Text[ turkish ] = "Açýklama";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_ANNOTE
+ {
+ Pos = MAP_APPFONT ( 65, 88 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_NUMBER
+ {
+ Pos = MAP_APPFONT ( 118 , 89 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Nummer";
+ Text [ENGLISH] = "No.";
+ Text[ english_us ] = "No.";
+ Text[ portuguese ] = "Nº.";
+ Text[ russian ] = "¹";
+ Text[ greek ] = "Áñéèìüò";
+ Text[ dutch ] = "Nummer";
+ Text[ french ] = "No.";
+ Text[ spanish ] = "Número";
+ Text[ italian ] = "No.";
+ Text[ danish ] = "Nummer";
+ Text[ swedish ] = "Nummer";
+ Text[ polish ] = "Numer";
+ Text[ portuguese_brazilian ] = "No.";
+ Text[ japanese ] = "No.";
+ Text[ korean ] = "¹øÈ£";
+ Text[ chinese_simplified ] = "񅧏";
+ Text[ chinese_traditional ] = "¸¹½X";
+ Text[ arabic ] = "ÑÞã";
+ Text[ turkish ] = "Sayý";
+ };
+ ListBox LB_NUMBER
+ {
+ Pos = MAP_APPFONT ( 171 , 88 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_ORGANIZATIONS
+ {
+ Pos = MAP_APPFONT ( 229 , 89 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Organisation";
+ Text [ENGLISH] = "Organization";
+ Text[ english_us ] = "Organization";
+ Text[ portuguese ] = "Organização";
+ Text[ russian ] = "Îðãàíèçàöèÿ";
+ Text[ greek ] = "Ïñãáíéóìüò";
+ Text[ dutch ] = "Organisatie";
+ Text[ french ] = "Organisation";
+ Text[ spanish ] = "Organización";
+ Text[ italian ] = "Organizzazione";
+ Text[ danish ] = "Organisation";
+ Text[ swedish ] = "Organisation";
+ Text[ polish ] = "Organizacja";
+ Text[ portuguese_brazilian ] = "Organization";
+ Text[ japanese ] = "‘gD’c‘Ì";
+ Text[ korean ] = "´Üü";
+ Text[ chinese_simplified ] = "×éÖ¯";
+ Text[ chinese_traditional ] = "²Õ´";
+ Text[ arabic ] = "ãäÙãÉ";
+ Text[ turkish ] = "Organizasyon";
+ };
+ ListBox LB_ORGANIZATIONS
+ {
+ Pos = MAP_APPFONT ( 282, 88 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_PAGES
+ {
+ Pos = MAP_APPFONT ( 12 , 104 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Seite(n)";
+ Text [ENGLISH] = "Page(s)";
+ Text[ english_us ] = "Page(s)";
+ Text[ portuguese ] = "Página(s)";
+ Text[ russian ] = "Ñòðàíèö(û)";
+ Text[ greek ] = "Óåëßäá/-åò";
+ Text[ dutch ] = "Pagina(s)";
+ Text[ french ] = "Page(s)";
+ Text[ spanish ] = "Página(s)";
+ Text[ italian ] = "Pagina/e";
+ Text[ danish ] = "Side(r)";
+ Text[ swedish ] = "Sida(-or)";
+ Text[ polish ] = "Strona(y)";
+ Text[ portuguese_brazilian ] = "Page(s)";
+ Text[ japanese ] = "Íß°¼Þ";
+ Text[ korean ] = "ÆäÀÌÁö ¼ö";
+ Text[ chinese_simplified ] = "Ò³";
+ Text[ chinese_traditional ] = "­¶";
+ Text[ arabic ] = "ÕÝÍÉ (ÕÝÍÇÊ)";
+ Text[ turkish ] = "Sayfa sayýsý";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_PAGES
+ {
+ Pos = MAP_APPFONT ( 65 , 103 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_PUBLISHER
+ {
+ Pos = MAP_APPFONT ( 118 , 104 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Verlag";
+ Text [ENGLISH] = "Publisher";
+ Text[ english_us ] = "Publisher";
+ Text[ portuguese ] = "Editora";
+ Text[ russian ] = "Èçäàòåëüñòâî";
+ Text[ greek ] = "Åêäïôéêüò ïßêïò";
+ Text[ dutch ] = "Uitgeverij";
+ Text[ french ] = "Édition";
+ Text[ spanish ] = "Editorial";
+ Text[ italian ] = "Casa editrice";
+ Text[ danish ] = "Forlag";
+ Text[ swedish ] = "Förlag";
+ Text[ polish ] = "Wydawnictwo";
+ Text[ portuguese_brazilian ] = "Publisher";
+ Text[ japanese ] = "”­sŠ";
+ Text[ korean ] = "ÃâÆÇ»ç";
+ Text[ chinese_simplified ] = "³ö°æÉç";
+ Text[ chinese_traditional ] = "¥Xª©ªÀ";
+ Text[ arabic ] = "ÏÇÑ ÇáäÔÑ";
+ Text[ turkish ] = "Yayým evi";
+ };
+ ListBox LB_PUBLISHER
+ {
+ Pos = MAP_APPFONT ( 171, 103 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_ADDRESS
+ {
+ Pos = MAP_APPFONT ( 229 , 104 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Adresse";
+ Text [ENGLISH] = "Address";
+ Text[ english_us ] = "Address";
+ Text[ portuguese ] = "Endereço";
+ Text[ russian ] = "Àäðåñ";
+ Text[ greek ] = "Äéåýèõíóç";
+ Text[ dutch ] = "Adres";
+ Text[ french ] = "Adresse";
+ Text[ spanish ] = "Dirección";
+ Text[ italian ] = "Indirizzo";
+ Text[ danish ] = "Adresse";
+ Text[ swedish ] = "Adress";
+ Text[ polish ] = "Adres";
+ Text[ portuguese_brazilian ] = "Address";
+ Text[ japanese ] = "ZŠ";
+ Text[ korean ] = "ÁÖ¼Ò";
+ Text[ chinese_simplified ] = "µØÖ·";
+ Text[ chinese_traditional ] = "¦a§}";
+ Text[ arabic ] = "ÇáÚäæÇä";
+ Text[ turkish ] = "Adres";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_ADDRESS
+ {
+ Pos = MAP_APPFONT ( 282 , 103 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_SCHOOL
+ {
+ Pos = MAP_APPFONT ( 12 , 119 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Hochschule";
+ Text [ENGLISH] = "School";
+ Text[ english_us ] = "University";
+ Text[ portuguese ] = "Universidade";
+ Text[ russian ] = "ÂÓÇ";
+ Text[ greek ] = "Á.Å.É./Ô.Å.É.";
+ Text[ dutch ] = "Hogeschool";
+ Text[ french ] = "École supérieure";
+ Text[ spanish ] = "Universidad";
+ Text[ italian ] = "Scuola superiore";
+ Text[ danish ] = "Universitet";
+ Text[ swedish ] = "Högskola";
+ Text[ polish ] = "Szko³a wy¿sza";
+ Text[ portuguese_brazilian ] = "School";
+ Text[ japanese ] = "‹³ˆç‹@ŠÖ";
+ Text[ korean ] = "Çб³";
+ Text[ chinese_simplified ] = "´óѧ";
+ Text[ chinese_traditional ] = "°ªµ¥°|®Õ";
+ Text[ arabic ] = "ÌÇãÚÉ";
+ Text[ turkish ] = "Üniversite";
+ };
+ ListBox LB_SCHOOL
+ {
+ Pos = MAP_APPFONT ( 65 , 118 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_SERIES
+ {
+ Pos = MAP_APPFONT ( 118 , 119 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Serie";
+ Text [ENGLISH] = "Series";
+ Text[ english_us ] = "Series";
+ Text[ portuguese ] = "Série";
+ Text[ russian ] = "Ñåðèÿ";
+ Text[ greek ] = "ÓåéñÜ";
+ Text[ dutch ] = "Serie";
+ Text[ french ] = "Série";
+ Text[ spanish ] = "Serie";
+ Text[ italian ] = "Serie";
+ Text[ danish ] = "Serie";
+ Text[ swedish ] = "Serie";
+ Text[ polish ] = "Seria";
+ Text[ portuguese_brazilian ] = "Series";
+ Text[ japanese ] = "‘p‘";
+ Text[ korean ] = "½Ã¸®Áî";
+ Text[ chinese_simplified ] = "ϵÁÐ";
+ Text[ chinese_traditional ] = "¨t¦C";
+ Text[ arabic ] = "ÓáÓáÉ";
+ Text[ turkish ] = "Dizi";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_SERIES
+ {
+ Pos = MAP_APPFONT ( 171 , 118) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_REPORTTYPE
+ {
+ Pos = MAP_APPFONT ( 229 , 119 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Art des Reports";
+ Text [ENGLISH] = "Report type";
+ Text[ english_us ] = "Report type";
+ Text[ portuguese ] = "Tipo de relatório";
+ Text[ russian ] = "Òèï îò÷åòà";
+ Text[ greek ] = "Ôýðïò áíáöïñÜò";
+ Text[ dutch ] = "Soort bericht";
+ Text[ french ] = "Type de rapport";
+ Text[ spanish ] = "Tipo de informe";
+ Text[ italian ] = "Rapporto";
+ Text[ danish ] = "Rapporttype";
+ Text[ swedish ] = "Typ av rapport";
+ Text[ polish ] = "Rodzaj raportu";
+ Text[ portuguese_brazilian ] = "Report type";
+ Text[ japanese ] = "ÚÎß°Ä‚ÌŽí—Þ";
+ Text[ korean ] = "º¸°í¼­ À¯Çü";
+ Text[ chinese_simplified ] = "±¨µÀÀàÐÍ";
+ Text[ chinese_traditional ] = "³ø§iÃþ«¬";
+ Text[ arabic ] = "äæÚ ÇáÊÞÑíÑ";
+ Text[ turkish ] = "Rapor türü";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_REPORTTYPE
+ {
+ Pos = MAP_APPFONT ( 282 , 118 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_VOLUME
+ {
+ Pos = MAP_APPFONT ( 12 , 134 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Band";
+ Text [ENGLISH] = "Volume";
+ Text[ english_us ] = "Volume";
+ Text[ portuguese ] = "Volume";
+ Text[ russian ] = "Òîì";
+ Text[ greek ] = "Ôüìïò";
+ Text[ dutch ] = "Deel";
+ Text[ french ] = "Volume";
+ Text[ spanish ] = "Tomo";
+ Text[ italian ] = "Volume";
+ Text[ danish ] = "Bind";
+ Text[ swedish ] = "Volym";
+ Text[ polish ] = "Tom";
+ Text[ portuguese_brazilian ] = "Volume";
+ Text[ japanese ] = "Šª";
+ Text[ korean ] = "±Ç";
+ Text[ chinese_simplified ] = "²á";
+ Text[ chinese_traditional ] = "¥U";
+ Text[ arabic ] = "ÇáãÌáÏ";
+ Text[ turkish ] = "Cilt";
+ };
+ ListBox LB_VOLUME
+ {
+ Pos = MAP_APPFONT ( 65 , 133) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_URL
+ {
+ Pos = MAP_APPFONT ( 118 , 134 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "URL";
+ Text [ENGLISH] = "URL";
+ Text[ english_us ] = "URL";
+ Text[ portuguese ] = "URL";
+ Text[ russian ] = "URL";
+ Text[ greek ] = "URL";
+ Text[ dutch ] = "URL";
+ Text[ french ] = "URL";
+ Text[ spanish ] = "URL";
+ Text[ italian ] = "URL";
+ Text[ danish ] = "URL";
+ Text[ swedish ] = "URL";
+ Text[ polish ] = "URL";
+ Text[ portuguese_brazilian ] = "URL";
+ Text[ japanese ] = "URL";
+ Text[ korean ] = "URL";
+ Text[ chinese_simplified ] = "URL";
+ Text[ chinese_traditional ] = "URL";
+ Text[ arabic ] = "URL";
+ Text[ turkish ] = "URL";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_URL
+ {
+ Pos = MAP_APPFONT ( 171 , 133 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_CUSTOM1
+ {
+ Pos = MAP_APPFONT ( 229 , 134 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Benutzerfeld 1";
+ Text [ENGLISH] = "Custom field 1";
+ Text[ english_us ] = "User-defined 1";
+ Text[ portuguese ] = "Campo de utilizador 1";
+ Text[ russian ] = "Ïîëå ïîëüçîâàòåëÿ 1";
+ Text[ greek ] = "Ðåäßï ÷ñÞóôç 1";
+ Text[ dutch ] = "Gebruikersveld 1";
+ Text[ french ] = "Champ d'utilisateur 1";
+ Text[ spanish ] = "Campo de usuario 1";
+ Text[ italian ] = "Utente 1";
+ Text[ danish ] = "Brugerdefineret 1";
+ Text[ swedish ] = "Användarfält 1";
+ Text[ polish ] = "Pole u¿ytkownika 1";
+ Text[ portuguese_brazilian ] = "Custom field 1";
+ Text[ japanese ] = "Õ°»Þ°Ì¨°ÙÄÞ1";
+ Text[ korean ] = "»ç¿ëÀÚ Á¤ÀÇ Çʵå 1";
+ Text[ chinese_simplified ] = "Óû§À¸ 1";
+ Text[ chinese_traditional ] = "¦Û­qÄæ¦ì 1";
+ Text[ arabic ] = "ÍÞá ÇáãÓÊÎÏã 1";
+ Text[ turkish ] = "Kullanýcý alaný 1";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_CUSTOM1
+ {
+ Pos = MAP_APPFONT ( 282 , 133 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_CUSTOM2
+ {
+ Pos = MAP_APPFONT ( 12 , 149 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Benutzerfeld 2";
+ Text [ENGLISH] = "Custom field 2";
+ Text[ english_us ] = "User-defined 2";
+ Text[ portuguese ] = "Campo de utilizador 2";
+ Text[ russian ] = "Ïîëå ïîëüçîâàòåëÿ 2";
+ Text[ greek ] = "Ðåäßï ÷ñÞóôç 2";
+ Text[ dutch ] = "Gebruikersveld 2";
+ Text[ french ] = "Champ d'tilisateur 2";
+ Text[ spanish ] = "Campo de usuario 2";
+ Text[ italian ] = "Utente 2";
+ Text[ danish ] = "Brugerdefineret 2";
+ Text[ swedish ] = "Användarfält 2";
+ Text[ polish ] = "Pole u¿ytkownika 2";
+ Text[ portuguese_brazilian ] = "Custom field 2";
+ Text[ japanese ] = "Õ°»Þ°Ì¨°ÙÄÞ2";
+ Text[ korean ] = "»ç¿ëÀÚ Á¤ÀÇ Çʵå 2";
+ Text[ chinese_simplified ] = "Óû§À¸ 2";
+ Text[ chinese_traditional ] = "¦Û­qÄæ¦ì 2";
+ Text[ arabic ] = "ÍÞá ÇáãÓÊÎÏã 2";
+ Text[ turkish ] = "Kullanýcý alaný 2";
+ Text[ language_user1 ] = " ";
+ };
+ ListBox LB_CUSTOM2
+ {
+ Pos = MAP_APPFONT ( 65 , 148 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_CUSTOM3
+ {
+ Pos = MAP_APPFONT ( 118 , 149 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Benutzerfeld 3";
+ Text [ENGLISH] = "Custom field 3";
+ Text[ english_us ] = "User-defined 3";
+ Text[ portuguese ] = "Campo de utilizador 3";
+ Text[ russian ] = "Ïîëå ïîëüçîâàòåëÿ 3";
+ Text[ greek ] = "Ðåäßï ÷ñÞóôç 3";
+ Text[ dutch ] = "Gebruikersveld 3";
+ Text[ french ] = "Champ d'utilisateur 3";
+ Text[ spanish ] = "Campo de usuario 3";
+ Text[ italian ] = "Utente 3";
+ Text[ danish ] = "Brugerdefineret 3";
+ Text[ swedish ] = "Användarfält 3";
+ Text[ polish ] = "Pole u¿ytkownika 3";
+ Text[ portuguese_brazilian ] = "Custom field 3";
+ Text[ japanese ] = "Õ°»Þ°Ì¨°ÙÄÞ3";
+ Text[ korean ] = "»ç¿ëÀÚ Á¤ÀÇ Çʵå 3";
+ Text[ chinese_simplified ] = "Óû§À¸ 3";
+ Text[ chinese_traditional ] = "¦Û­qÄæ¦ì 3";
+ Text[ arabic ] = "ÍÞá ÇáãÓÊÎÏã 3";
+ Text[ turkish ] = "Kullanýcý alaný 3";
+ };
+ ListBox LB_CUSTOM3
+ {
+ Pos = MAP_APPFONT ( 171 , 148 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_CUSTOM4
+ {
+ Pos = MAP_APPFONT ( 229 , 149 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Benutzerfeld 4";
+ Text [ENGLISH] = "Custom field 4";
+ Text[ english_us ] = "User-defined 4";
+ Text[ portuguese ] = "Campo de utilizador 4";
+ Text[ russian ] = "Ïîëå ïîëüçîâàòåëÿ 4";
+ Text[ greek ] = "Ðåäßï ÷ñÞóôç 4";
+ Text[ dutch ] = "Gebruikersveld 4";
+ Text[ french ] = "Champ d'utilisateur 4";
+ Text[ spanish ] = "Campo de usuario 4";
+ Text[ italian ] = "Utente 4";
+ Text[ danish ] = "Brugerdefineret 4";
+ Text[ swedish ] = "Användarfält 4";
+ Text[ polish ] = "Pole u¿ytkownika 4";
+ Text[ portuguese_brazilian ] = "Custom field 4";
+ Text[ japanese ] = "Õ°»Þ°Ì¨°ÙÄÞ4";
+ Text[ korean ] = "»ç¿ëÀÚ Á¤ÀÇ Çʵå 4";
+ Text[ chinese_simplified ] = "Óû§À¸ 4";
+ Text[ chinese_traditional ] = "¦Û­qÄæ¦ì 4";
+ Text[ arabic ] = "ÍÞá ÇáãÓÊÎÏã 4";
+ Text[ turkish ] = "Kullanýcý alaný 4";
+ };
+ ListBox LB_CUSTOM4
+ {
+ Pos = MAP_APPFONT ( 282, 148 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_CUSTOM5
+ {
+ Pos = MAP_APPFONT ( 12 , 164 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text = "Benutzerfeld 5";
+ Text [ENGLISH] = "Custom field 5";
+ Text[ english_us ] = "User-defined 5";
+ Text[ portuguese ] = "Campo de utilizador 5";
+ Text[ russian ] = "Ïîëå ïîëüçîâàòåëÿ 5";
+ Text[ greek ] = "Ðåäßï ÷ñÞóôç 5";
+ Text[ dutch ] = "Gebruikersveld 5";
+ Text[ french ] = "Champ d'utilisateur 5";
+ Text[ spanish ] = "Campo de usuario 5";
+ Text[ italian ] = "Utente 5";
+ Text[ danish ] = "Brugerdefineret 5";
+ Text[ swedish ] = "Användarfält 5";
+ Text[ polish ] = "Pole u¿ytkownika 5";
+ Text[ portuguese_brazilian ] = "Custom field 5";
+ Text[ japanese ] = "Õ°»Þ°Ì¨°ÙÄÞ5";
+ Text[ korean ] = "»ç¿ëÀÚ Á¤ÀÇ Çʵå 5";
+ Text[ chinese_simplified ] = "Óû§À¸ 5";
+ Text[ chinese_traditional ] = "¦Û­qÄæ¦ì 5";
+ Text[ arabic ] = "ÍÞá ÇáãÓÊÎÏã 5";
+ Text[ turkish ] = "Kullanýcý alaný 5";
+ };
+ ListBox LB_CUSTOM5
+ {
+ Pos = MAP_APPFONT ( 65 , 163 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ DropDown = TRUE;
+ };
+ String ST_NONE
+ {
+ Text = "<kein>";
+ Text [ENGLISH] = "<none>";
+ Text[ english_us ] = "<none>";
+ Text[ portuguese ] = "<nenhum>";
+ Text[ russian ] = "<áåç>";
+ Text[ greek ] = "<êáíÝíá>";
+ Text[ dutch ] = "<geen>";
+ Text[ french ] = "<aucun>";
+ Text[ spanish ] = "<ninguno>";
+ Text[ italian ] = "<nessuno>";
+ Text[ danish ] = "<ingen>";
+ Text[ swedish ] = "<ingen>";
+ Text[ polish ] = "<brak>";
+ Text[ portuguese_brazilian ] = "<none>";
+ Text[ japanese ] = "<‚È‚µ>";
+ Text[ korean ] = "<¾øÀ½>";
+ Text[ chinese_simplified ] = "<ÎÞ>";
+ Text[ chinese_traditional ] = "<µL>";
+ Text[ arabic ] = "<ÈÏæä>";
+ Text[ turkish ] = "<Yok>";
+ Text[ language_user1 ] = " ";
+ };
+ Text[ english_us ] = "Column Layout for Table %1";
+ Text[ portuguese ] = "Atribuição de colunas para a tabela %1";
+ Text[ russian ] = "Ðàñïîëîæåíèå êîëîíîê äëÿ òàáëèöû %1";
+ Text[ greek ] = "Ðñïóäéïñéóìüò óôçëþí ãéá ðßíáêá %1";
+ Text[ dutch ] = "Kolomindeling voor tabel %1";
+ Text[ french ] = "Assignation de colonnes pour la table %1";
+ Text[ spanish ] = "Asignación de columnas para tabla %1";
+ Text[ italian ] = "Assegnazione colonne per la tabella %1";
+ Text[ danish ] = "Kolonnetildeling for tabel %1";
+ Text[ swedish ] = "Kolumntilldelning för tabell %1";
+ Text[ polish ] = "Przyporz¹dkowanie kolumn tabeli %1";
+ Text[ portuguese_brazilian ] = "Column assignment for table %1";
+ Text[ japanese ] = "ðÌÞÙ%1—p‚Ì—ñ‚Ì•ª—Þ";
+ Text[ korean ] = "Å×À̺í¿ë ¿­ ·¹À̾ƿô %1";
+ Text[ chinese_simplified ] = "Ϊ±í¸ñ %1 ±àÅÅÉè¼ÆÁÐ";
+ Text[ chinese_traditional ] = "½s±Æ %1 ªí®æªºÄæ";
+ Text[ arabic ] = "ÊÚííä ÇáÃÚãÏÉ ááÌÏæá %1";
+ Text[ turkish ] = "Tablo %1 için sütun düzeni";
+};
+ModalDialog RID_DLG_DBCHANGE
+{
+ HelpID = HID_DLG_DBCHANGE;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 291 , 131 ) ;
+ Moveable = TRUE ;
+ Text = "Auswahl der Datenquelle";
+ Text [ENGLISH] = "Select data source";
+
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 238 , 3 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 238 , 18 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 238 , 36 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ };
+ GroupBox GB_SELECTION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 229 , 125 ) ;
+ Text = "Auswahl";
+ Text [ENGLISH] = "Selection";
+ Text[ english_us ] = "Selection";
+ Text[ portuguese ] = "Selecção";
+ Text[ russian ] = "Âûáîð";
+ Text[ greek ] = "ÅðéëïãÞ";
+ Text[ dutch ] = "Selectie";
+ Text[ french ] = "Sélection";
+ Text[ spanish ] = "Selección";
+ Text[ italian ] = "Selezione";
+ Text[ danish ] = "Udvalg";
+ Text[ swedish ] = "Urval";
+ Text[ polish ] = "Wybór";
+ Text[ portuguese_brazilian ] = "Selection";
+ Text[ japanese ] = "‘I‘ð";
+ Text[ korean ] = "¼±ÅÃ";
+ Text[ chinese_simplified ] = "Ñ¡Ôñ";
+ Text[ chinese_traditional ] = "¿ï¾Ü";
+ Text[ arabic ] = "ÇáÊÍÏíÏ";
+ Text[ turkish ] = "Seçim";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_ENTRY
+ {
+ Text = "Eintrag";
+ Text [ENGLISH] = "Entry";
+ Text[ english_us ] = "Entry";
+ Text[ portuguese ] = "Entrada";
+ Text[ russian ] = "Ýëåìåíò";
+ Text[ greek ] = "ÅããñáöÞ";
+ Text[ dutch ] = "Item";
+ Text[ french ] = "Entrée";
+ Text[ spanish ] = "Entrada";
+ Text[ italian ] = "Voce";
+ Text[ danish ] = "Element";
+ Text[ swedish ] = "Post";
+ Text[ polish ] = "Wpis";
+ Text[ portuguese_brazilian ] = "Entry";
+ Text[ japanese ] = "€–Ú";
+ Text[ korean ] = "Ç׸ñ";
+ Text[ chinese_simplified ] = "ÌõÄ¿";
+ Text[ chinese_traditional ] = "±ø¥Ø";
+ Text[ arabic ] = "ÅÏÎÇá";
+ Text[ turkish ] = "Giriþ";
+ };
+ String ST_URL
+ {
+ Text = "URL";
+ Text [ENGLISH] = "URL";
+ Text[ english_us ] = "URL";
+ Text[ portuguese ] = "URL";
+ Text[ russian ] = "URL";
+ Text[ greek ] = "URL";
+ Text[ dutch ] = "URL";
+ Text[ french ] = "URL";
+ Text[ spanish ] = "URL";
+ Text[ italian ] = "URL";
+ Text[ danish ] = "URL";
+ Text[ swedish ] = "URL";
+ Text[ polish ] = "URL";
+ Text[ portuguese_brazilian ] = "URL";
+ Text[ japanese ] = "URL";
+ Text[ korean ] = "URL";
+ Text[ chinese_simplified ] = "URL";
+ Text[ chinese_traditional ] = "URL";
+ Text[ arabic ] = "URL";
+ Text[ turkish ] = "URL";
+ Text[ language_user1 ] = " ";
+ };
+ Control LB_SELECTION
+ {
+ Pos = MAP_APPFONT ( 9 , 24 ) ;
+ Size = MAP_APPFONT ( 223 , 100 ) ;
+ Border = TRUE;
+ TabStop = TRUE;
+ };
+ Window HB_SELECTION
+ {
+ Pos = MAP_APPFONT ( 9 , 12 ) ;
+ Size = MAP_APPFONT ( 223 , 12 ) ;
+ Border = TRUE;
+ };
+ Text[ english_us ] = "Select Data Source";
+ Text[ portuguese ] = "Seleccionar fonte de dados";
+ Text[ russian ] = "Âûáîð èñòî÷íèêà äàííûõ";
+ Text[ greek ] = "ÅðéëïãÞ ðñïÝëåõóçò äåäïìÝíùí";
+ Text[ dutch ] = "Kies gegevensbron";
+ Text[ french ] = "Sélection de la source de données";
+ Text[ spanish ] = "Selección de la fuente de datos";
+ Text[ italian ] = "Selezione della sorgente dati";
+ Text[ danish ] = "Vælg datakilde";
+ Text[ swedish ] = "Urval av datakälla";
+ Text[ polish ] = "Wybór Ÿród³a danych";
+ Text[ portuguese_brazilian ] = "Select data source";
+ Text[ japanese ] = "ÃÞ°À¿°½‚Ì‘I‘ð";
+ Text[ korean ] = "µ¥ÀÌÅÍ ¼Ò½º ¼±ÅÃ";
+ Text[ chinese_simplified ] = "Ñ¡ÔñÊý¾ÝÔ´";
+ Text[ chinese_traditional ] = "¿ï¾Ü¼ÆÕu·½";
+ Text[ arabic ] = "ÊÍÏíÏ ãÕÏÑ ÇáÈíÇäÇÊ";
+ Text[ turkish ] = "Veri kaynaðý seçimi";
+ Text[ language_user1 ] = " ";
+};
+
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx
new file mode 100644
index 000000000..0eeab7fcd
--- /dev/null
+++ b/extensions/source/bibliography/framectr.cxx
@@ -0,0 +1,629 @@
+/*************************************************************************
+ *
+ * $RCSfile: framectr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SV_WAITOBJ_HXX //autogen wg. WaitObject
+#include <vcl/waitobj.hxx>
+#endif
+
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include <cppuhelper/interfacecontainer.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_URL_HPP_
+#include <com/sun/star/util/URL.hpp>
+#endif
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+//#ifndef _USR_ITERHLP_HXX
+//#include <usr/iterhlp.hxx>
+//#endif
+#ifndef _SV_MSGBOX_HXX
+#include <vcl/msgbox.hxx>
+#endif
+//#ifndef _TOOLKIT_UNOIFACE_HXX
+//#include <toolkit/unoiface.hxx>
+//#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _BIB_FRAMECTR_HXX
+#include "framectr.hxx"
+#endif
+#ifndef _BIB_DATMAN_HXX
+#include "datman.hxx"
+#endif
+#ifndef _BIB_FIELDWIN_HXX
+#include "fieldwin.hxx"
+#endif
+#ifndef ADRRESID_HXX
+#include "bibresid.hxx"
+#endif
+#ifndef BIB_HRC
+#include "bib.hrc"
+#endif
+#ifndef _TOOLKIT_UNOHLP_HXX
+#include <toolkit/helper/vclunohelper.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_DATA_XDATABASEDIALOGS_HPP_
+#include <com/sun/star/data/XDatabaseDialogs.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#endif
+
+//using namespace vos;
+using namespace osl;
+using namespace cppu;
+using namespace rtl;
+using namespace com::sun::star::frame;
+using namespace com::sun::star::uno;
+using namespace com::sun::star;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+extern rtl::OUString gGridModelCommand;
+
+SV_IMPL_PTRARR( BibStatusDispatchArr, BibStatusDispatchPtr );
+
+class BibFrameCtrl_Impl : public cppu::WeakImplHelper1 < XFrameActionListener >
+{
+public:
+ Mutex aMutex;
+ OMultiTypeInterfaceContainerHelper aLC;
+
+ BibFrameController_Impl* pController;
+
+ BibFrameCtrl_Impl()
+ : aLC( aMutex )
+ , pController(0)
+ {}
+
+ ~BibFrameCtrl_Impl();
+
+ virtual void SAL_CALL frameAction(const FrameActionEvent& aEvent) throw( RuntimeException );
+ virtual void SAL_CALL disposing( const lang::EventObject& Source );
+};
+
+
+BibFrameCtrl_Impl::~BibFrameCtrl_Impl()
+{
+}
+
+void BibFrameCtrl_Impl::frameAction(const FrameActionEvent& aEvent) throw( uno::RuntimeException )
+{
+ if ( pController && aEvent.Frame == pController->getFrame())
+ {
+ if(aEvent.Action == FrameAction_FRAME_ACTIVATED)
+ {
+ pController->activate();
+ }
+ else if(aEvent.Action == FrameAction_FRAME_DEACTIVATING)
+ {
+ pController->deactivate();
+ }
+ }
+}
+
+void BibFrameCtrl_Impl::disposing( const lang::EventObject& Source )
+{
+ if ( pController )
+ pController->getFrame()->removeFrameActionListener( this );
+}
+
+BibFrameController_Impl::BibFrameController_Impl( const uno::Reference< awt::XWindow > & xComponent):
+ xWindow( xComponent ),
+ pDatMan(NULL),
+ pFieldWin(NULL)
+
+{
+ pBibMod = OpenBibModul();
+ pDatMan = (*pBibMod)->createDataManager();
+ xDatman = pDatMan;
+ bDisposing=sal_False;
+ bHierarchical=sal_True;
+ pImp = new BibFrameCtrl_Impl;
+ pImp->pController = this;
+ pImp->acquire();
+}
+
+BibFrameController_Impl::BibFrameController_Impl( const uno::Reference< awt::XWindow > & xComponent,
+ BibDataManager* pDataManager):
+ xWindow( xComponent ),
+ pDatMan(pDataManager),
+ pFieldWin(NULL),
+ pBibMod(NULL)
+{
+ bDisposing=sal_False;
+ bHierarchical=sal_True;
+ pImp = new BibFrameCtrl_Impl;
+ pImp->pController = this;
+ pImp->acquire();
+}
+
+BibDataManager* BibFrameController_Impl::GetDataManager()
+{
+ return pDatMan;
+}
+
+BibFrameController_Impl::~BibFrameController_Impl()
+{
+ pImp->pController = NULL;
+ pImp->release();
+ delete pDatMan;
+ if(pBibMod)
+ CloseBibModul(pBibMod);
+}
+
+void BibFrameController_Impl::attachFrame( const uno::Reference< XFrame > & xArg )
+{
+ xFrame = xArg;
+ xFrame->addFrameActionListener( pImp );
+}
+
+sal_Bool BibFrameController_Impl::attachModel( const uno::Reference< XModel > & xModel )
+{
+ return sal_False;
+}
+
+sal_Bool BibFrameController_Impl::suspend( sal_Bool bSuspend )
+{
+ if ( bSuspend )
+ getFrame()->removeFrameActionListener( pImp );
+ else
+ getFrame()->addFrameActionListener( pImp );
+ return sal_True;
+}
+
+uno::Any BibFrameController_Impl::getViewData()
+{
+ return uno::Any();
+}
+
+void BibFrameController_Impl::restoreViewData( const uno::Any& Value )
+{
+}
+
+uno::Reference< XFrame > BibFrameController_Impl::getFrame()
+{
+ return xFrame;
+}
+
+uno::Reference< XModel > BibFrameController_Impl::getModel()
+{
+ return uno::Reference< XModel > ();
+}
+
+void BibFrameController_Impl::dispose()
+{
+ util::URL aURL;
+ aURL.Complete = C2U("0");
+ uno::Reference< XDispatchProvider > xProv( xFrame, UNO_QUERY );
+ if ( xProv.is() )
+ {
+ uno::Reference< XDispatch > aDisp = xProv->queryDispatch( aURL, C2U("_tool:_menubar"), 0 );
+ if ( aDisp.is() )
+ aDisp->dispatch( aURL, uno::Sequence<beans::PropertyValue>() );
+ }
+
+
+ delete pFieldWin;
+ bDisposing = sal_True;
+ lang::EventObject aObject;
+ aObject.Source = (XController*)this;
+ pImp->aLC.disposeAndClear(aObject);
+ xDatman = 0;
+ pDatMan = 0;
+ aStatusListeners.DeleteAndDestroy( 0, aStatusListeners.Count() );
+ }
+
+void BibFrameController_Impl::addEventListener( const uno::Reference< lang::XEventListener > & aListener )
+{
+ pImp->aLC.addInterface( ::getCppuType((const Reference< lang::XEventListener >*)0), aListener );
+}
+
+void BibFrameController_Impl::removeEventListener( const uno::Reference< lang::XEventListener > & aListener )
+{
+ pImp->aLC.removeInterface( ::getCppuType((const Reference< lang::XEventListener >*)0), aListener );
+}
+
+uno::Reference< frame::XDispatch > BibFrameController_Impl::queryDispatch( const util::URL& aURL, const rtl::OUString& aTarget, sal_Int32 nSearchFlags )
+{
+ if ( !bDisposing )
+ {
+ String aCommand( aURL.Path );
+ if ( aCommand.EqualsAscii("Undo") || aCommand.EqualsAscii("Cut") ||
+ aCommand.EqualsAscii("Copy") || aCommand.EqualsAscii("Paste") ||
+ aCommand.EqualsAscii("SelectAll") || aCommand.Copy(0,4).EqualsAscii("Bib/")||
+ aCommand.EqualsAscii("Title"))
+
+ return (frame::XDispatch*) this;
+ }
+
+ return uno::Reference< frame::XDispatch > ();
+}
+
+uno::Sequence<uno::Reference< XDispatch > > BibFrameController_Impl::queryDispatches( const uno::Sequence<DispatchDescriptor>& aDescripts )
+{
+ return uno::Sequence<uno::Reference< XDispatch > >();
+}
+
+//class XDispatch
+void BibFrameController_Impl::dispatch(const util::URL& aURL, const uno::Sequence< beans::PropertyValue >& aArgs)
+{
+ if ( !bDisposing )
+ {
+ WaitObject aWaitObject;
+
+ String aCommand( aURL.Path);
+ if(aCommand.EqualsAscii("Bib/Mapping"))
+ {
+ Window* pParent = VCLUnoHelper::GetWindow( xWindow );
+ pDatMan->CreateMappingDialog(pParent);
+ }
+ else if(aCommand.EqualsAscii("Bib/source"))
+ {
+ ChangeDataSource(aArgs);
+ }
+ else if(aCommand.EqualsAscii("Bib/sdbsource"))
+ {
+ Window* pParent = VCLUnoHelper::GetWindow( xWindow );
+ rtl::OUString aURL = pDatMan->CreateDBChangeDialog(pParent);
+ if(aURL.getLength())
+ {
+ uno::Sequence< beans::PropertyValue > aArgs(2);
+ beans::PropertyValue* pProps = aArgs.getArray();
+ pProps[0].Value <<= rtl::OUString();
+ pProps[1].Value <<= aURL;
+ ChangeDataSource(aArgs);
+ }
+ }
+ else if(aCommand.EqualsAscii("Bib/autoFilter"))
+ {
+ sal_uInt16 nCount = aStatusListeners.Count();
+ for ( sal_uInt16 n=0; n<nCount; n++ )
+ {
+ BibStatusDispatch *pObj = aStatusListeners[n];
+ if ( pObj->aURL.Path == C2U("Bib/removeFilter") )
+ {
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = pObj->aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ aEvent.Source = (XDispatch *) this;
+ pObj->xListener->statusChanged( aEvent );
+ //break; because there are more than one
+ }
+ }
+
+ const beans::PropertyValue* pPropertyValue = aArgs.getConstArray();
+ uno::Any aValue=pPropertyValue[0].Value;
+ rtl::OUString aQuery;
+ aValue >>= aQuery;
+
+ aValue=pPropertyValue[1].Value;
+ rtl::OUString aQueryField;
+ aValue >>= aQueryField;
+ pDatMan->setQueryField(aQueryField);
+ pDatMan->startQueryWith(aQuery);
+ }
+ else if(aCommand.EqualsAscii("Bib/standardFilter"))
+ {
+ sal_uInt16 nCount = aStatusListeners.Count();
+ for ( sal_uInt16 n=0; n<nCount; n++ )
+ {
+ BibStatusDispatch *pObj = aStatusListeners[n];
+ if ( pObj->aURL.Path == C2U("Bib/removeFilter") )
+ {
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = pObj->aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ aEvent.Source = (XDispatch *) this;
+ pObj->xListener->statusChanged( aEvent );
+ //break; because there are more than one
+ }
+ }
+
+ uno::Reference< sdb::XSQLQueryComposer > xParser=pDatMan->getParser();
+ uno::Reference< data::XDatabaseDialogs > xDlgs(xParser, UNO_QUERY);
+ if (xDlgs.is())
+ {
+ uno::Reference< container::XNamed > xField;
+ xDlgs->executeFilter(xField);
+ pDatMan->setFilter(xParser->getFilter());
+ }
+ }
+ else if(aCommand.EqualsAscii("Bib/removeFilter"))
+ {
+ RemoveFilter();
+ }
+ }
+}
+//-----------------------------------------------------------------------------
+void BibFrameController_Impl::addStatusListener(
+ const uno::Reference< frame::XStatusListener > & aListener,
+ const util::URL& aURL)
+{
+ // create a new Reference and insert into listener array
+ aStatusListeners.Insert( new BibStatusDispatch( aURL, aListener ), aStatusListeners.Count() );
+
+ // den ersten Status synchron zusenden
+ if ( aURL.Path == C2U("Bib/hierarchical") )
+ {
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ aEvent.Source = (XDispatch *) this;
+ const char* pHier = bHierarchical? "" : "*" ;
+ aEvent.State <<= rtl::OUString::createFromAscii(pHier);
+ aListener->statusChanged( aEvent );
+ }
+ else if(aURL.Path == C2U("Bib/MenuFilter"))
+ {
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ aEvent.Source = (XDispatch *) this;
+ aEvent.FeatureDescriptor=pDatMan->getQueryField();
+
+ uno::Sequence<rtl::OUString> aStringSeq=pDatMan->getQueryFields();
+ aEvent.State.setValue(&aStringSeq,::getCppuType((uno::Sequence<rtl::OUString>*)0));
+
+ aListener->statusChanged( aEvent );
+ }
+ else if ( aURL.Path == C2U("Bib/source"))
+ {
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ aEvent.Source = (XDispatch *) this;
+ aEvent.FeatureDescriptor=pDatMan->getActiveDataTable();
+
+ uno::Sequence<rtl::OUString> aStringSeq=pDatMan->getDataSources();
+ aEvent.State.setValue(&aStringSeq,::getCppuType((uno::Sequence<rtl::OUString>*)0));
+ aListener->statusChanged( aEvent );
+ }
+ else if(aURL.Path == C2U("Bib/query"))
+ {
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ aEvent.Source = (XDispatch *) this;
+ aEvent.State <<= pDatMan->getQueryString();
+ aListener->statusChanged( aEvent );
+ }
+ else if (aURL.Path == C2U("Bib/removeFilter") )
+ {
+ rtl::OUString aFilterStr=pDatMan->getFilter();
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = aURL;
+ aEvent.IsEnabled = (aFilterStr.len() > 0);
+ aEvent.Requery = sal_False;
+ aEvent.Source = (XDispatch *) this;
+ aListener->statusChanged( aEvent );
+ //break; because there are more than one
+ }
+ else
+ {
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ aEvent.Source = (XDispatch *) this;
+ aEvent.State <<= OUString(String(BibResId(RID_BIB_STR_FRAME_TITLE)));
+ aListener->statusChanged( aEvent );
+ }
+}
+//-----------------------------------------------------------------------------
+void BibFrameController_Impl::removeStatusListener(
+ const uno::Reference< frame::XStatusListener > & aObject, const util::URL& aURL)
+{
+ // search listener array for given listener
+ // for checking equality always "cast" to XInterface
+ if ( !bDisposing )
+ {
+ sal_uInt16 nCount = aStatusListeners.Count();
+ for ( sal_uInt16 n=0; n<nCount; n++ )
+ {
+ BibStatusDispatch *pObj = aStatusListeners[n];
+ sal_Bool bFlag=pObj->xListener.is();
+ if (!bFlag || (pObj->xListener == aObject &&
+ ( !aURL.Complete.len() || pObj->aURL.Path == aURL.Path )))
+ {
+ aStatusListeners.DeleteAndDestroy( n );
+ break;
+ }
+ }
+ }
+}
+//-----------------------------------------------------------------------------
+void BibFrameController_Impl::RemoveFilter()
+{
+ rtl::OUString aQuery;
+ pDatMan->startQueryWith(aQuery);
+
+ sal_uInt16 nCount = aStatusListeners.Count();
+ FeatureStateEvent aEvent;
+
+ sal_Bool bRemoveFilter=sal_False;
+ sal_Bool bQueryText=sal_False;
+
+ for ( sal_uInt16 n=0; n<nCount; n++ )
+ {
+ BibStatusDispatch *pObj = aStatusListeners[n];
+ if ( pObj->aURL.Path == C2U("Bib/removeFilter") )
+ {
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = pObj->aURL;
+ aEvent.IsEnabled = sal_False;
+ aEvent.Requery = sal_False;
+ aEvent.Source = (XDispatch *) this;
+ pObj->xListener->statusChanged( aEvent );
+ bRemoveFilter=sal_True;
+ }
+ else if(pObj->aURL.Path == C2U("Bib/query"))
+ {
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = pObj->aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ aEvent.Source = (XDispatch *) this;
+ aEvent.State <<= aQuery;
+ pObj->xListener->statusChanged( aEvent );
+ bQueryText=sal_True;
+ }
+
+ if(bRemoveFilter && bQueryText)
+ break;
+
+ }
+}
+//-----------------------------------------------------------------------------
+void BibFrameController_Impl::ChangeDataSource(const uno::Sequence< beans::PropertyValue >& aArgs)
+{
+ const beans::PropertyValue* pPropertyValue = aArgs.getConstArray();
+ uno::Any aValue=pPropertyValue[0].Value;
+ rtl::OUString aDBTableName;
+ aValue >>= aDBTableName;
+
+ pDatMan->unloadDatabase();
+
+ if(aArgs.getLength() > 1)
+ {
+ uno::Any aDB = pPropertyValue[1].Value;
+ rtl::OUString aURL;
+ aDB >>= aURL;
+ pDatMan->setActiveDataSource(aURL);
+ aDBTableName = pDatMan->getActiveDataTable();
+ }
+ else
+ pDatMan->setActiveDataTable(aDBTableName);
+ uno::Reference< awt::XControlModel > xNewModel=pDatMan->createGridModel();
+
+ sal_uInt16 nCount = aStatusListeners.Count();
+ FeatureStateEvent aEvent;
+
+ sal_Bool bGridMod=sal_False;
+ sal_Bool bMenuFilter=sal_False;
+ sal_Bool bQueryText=sal_False;
+ for ( sal_uInt16 n=0; n<nCount; n++ )
+ {
+ BibStatusDispatch *pObj = aStatusListeners[n];
+ if ( COMPARE_EQUAL == pObj->aURL.Path.compareToAscii("Bib/newGridModel"))
+ {
+ aEvent.FeatureURL = pObj->aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ aEvent.Source = (XDispatch *) this;
+
+ aEvent.State.setValue(&xNewModel, ::getCppuType((uno::Reference<awt::XControlModel>*)0));
+ pObj->xListener->statusChanged( aEvent );
+ bGridMod=sal_True;
+ }
+ else if(COMPARE_EQUAL == pObj->aURL.Path.compareToAscii("Bib/MenuFilter"))
+ {
+ aEvent.FeatureURL = pObj->aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ aEvent.Source = (XDispatch *) this;
+ aEvent.FeatureDescriptor=pDatMan->getQueryField();
+
+ uno::Sequence<rtl::OUString> aStringSeq=pDatMan->getQueryFields();
+ aEvent.State.setValue(&aStringSeq,::getCppuType((uno::Sequence<rtl::OUString>*)0));
+
+ pObj->xListener->statusChanged( aEvent );
+ bMenuFilter=sal_True;
+ }
+ else if(COMPARE_EQUAL == pObj->aURL.Path.compareToAscii("Bib/query"))
+ {
+ FeatureStateEvent aEvent;
+ aEvent.FeatureURL = pObj->aURL;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Requery = sal_False;
+ aEvent.Source = (XDispatch *) this;
+ aEvent.State <<= pDatMan->getQueryString();
+ pObj->xListener->statusChanged( aEvent );
+ bQueryText=sal_True;
+ }
+
+ if(bGridMod && bMenuFilter && bQueryText) break;
+
+ }
+ pDatMan->loadDatabase();
+ if(pFieldWin)
+ pFieldWin->Update(pDatMan->getDatabaseForm());
+}
+
+void BibFrameController_Impl::activate()
+{
+ if(pFieldWin) pFieldWin->Show();
+}
+void BibFrameController_Impl::deactivate()
+{
+ if(pFieldWin) pFieldWin->Hide();
+}
+
+
diff --git a/extensions/source/bibliography/framectr.hxx b/extensions/source/bibliography/framectr.hxx
new file mode 100644
index 000000000..a8e815e33
--- /dev/null
+++ b/extensions/source/bibliography/framectr.hxx
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *
+ * $RCSfile: framectr.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _BIB_FRAMECTR_HXX
+#define _BIB_FRAMECTR_HXX
+//#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
+//#include <com/sun/star/frame/XController.hpp>
+//#endif
+//#ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_
+//#include <com/sun/star/frame/XStorable.hpp>
+//#endif
+//#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_
+//#include <com/sun/star/frame/XModel.hpp>
+//#endif
+//#ifndef _COM_SUN_STAR_FRAME_XFRAMEACTIONLISTENER_HPP_
+//#include <com/sun/star/frame/XFrameActionListener.hpp>
+//#endif
+//#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
+//#include <com/sun/star/frame/XComponentLoader.hpp>
+//#endif
+//#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
+//#include <com/sun/star/frame/XFrame.hpp>
+//#endif
+//#ifndef _COM_SUN_STAR_FRAME_FRAMEACTIONEVENT_HPP_
+//#include <com/sun/star/frame/FrameActionEvent.hpp>
+//#endif
+//#ifndef _COM_SUN_STAR_FRAME_FRAMEACTION_HPP_
+//#include <com/sun/star/frame/FrameAction.hpp>
+//#endif
+//#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
+//#include <com/sun/star/util/XURLTransformer.hpp>
+//#endif
+//#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
+//#include <com/sun/star/awt/XTopWindow.hpp>
+//#endif
+//#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+//#include <com/sun/star/awt/XWindow.hpp>
+//#endif
+//#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
+//#include <com/sun/star/awt/PosSize.hpp>
+//#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_
+#include <com/sun/star/frame/XDispatch.hpp>
+#endif
+//#include <usr/uno.hxx>
+
+#ifndef _CPPUHELPER_IMPLBASE3_HXX_
+#include <cppuhelper/implbase3.hxx> // helper for implementations
+#endif
+
+#ifndef _SVARRAY_HXX
+#include <svtools/svarray.hxx>
+#endif
+
+#ifndef _BIB_FIELDWIN_HXX
+#include "fieldwin.hxx"
+#endif
+#include "bibmod.hxx"
+class BibDataManager;
+
+class BibStatusDispatch
+{
+public:
+ ::com::sun::star::util::URL aURL;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xListener;
+ BibStatusDispatch( const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xRef )
+ : aURL( rURL )
+ , xListener( xRef )
+ {}
+};
+
+typedef BibStatusDispatch* BibStatusDispatchPtr;
+SV_DECL_PTRARR_DEL( BibStatusDispatchArr, BibStatusDispatchPtr, 4, 4 );
+
+class BibFrameController_Impl : public cppu::WeakImplHelper3 <
+ ::com::sun::star::frame::XController,
+ ::com::sun::star::frame::XDispatch,
+ ::com::sun::star::frame::XDispatchProvider
+>
+{
+friend class BibFrameCtrl_Impl;
+ BibFrameCtrl_Impl* pImp;
+ BibStatusDispatchArr aStatusListeners;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWindow;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame;
+ sal_Bool bDisposing;
+ sal_Bool bHierarchical;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > xDatman;
+ BibDataManager* pDatMan;
+ BibFieldWin* pFieldWin;
+ HdlBibModul pBibMod;
+
+public:
+ BibFrameController_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > & xComponent);
+ BibFrameController_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > & xComponent,
+ BibDataManager* pDatMan);
+ ~BibFrameController_Impl();
+
+
+ void activate();
+ void deactivate();
+
+ BibDataManager* GetDataManager();
+ void ChangeDataSource(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs);
+ void RemoveFilter();
+
+
+ // ::com::sun::star::frame::XController
+ virtual void SAL_CALL attachFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame );
+ virtual sal_Bool SAL_CALL attachModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel );
+ virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend );
+ virtual ::com::sun::star::uno::Any SAL_CALL getViewData();
+ virtual void SAL_CALL restoreViewData( const ::com::sun::star::uno::Any& Value );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModel();
+
+ // ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL dispose();
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener );
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener );
+
+ // ::com::sun::star::frame::XDispatchProvider
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts);
+
+ //class ::com::sun::star::frame::XDispatch
+ virtual void SAL_CALL dispatch(const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs);
+ virtual void SAL_CALL addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL);
+ virtual void SAL_CALL removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL);
+
+};
+
+#endif
+
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
new file mode 100644
index 000000000..a2da3c62b
--- /dev/null
+++ b/extensions/source/bibliography/general.cxx
@@ -0,0 +1,803 @@
+/*************************************************************************
+ *
+ * $RCSfile: general.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
+#include <com/sun/star/awt/PosSize.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDB_XCOLUMN_HPP_
+#include <com/sun/star/sdb/XColumn.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_LISTSOURCETYPE_HPP_
+#include <com/sun/star/form/ListSourceType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+#ifndef _TOOLKIT_UNOHLP_HXX
+#include <toolkit/helper/vclunohelper.hxx>
+#endif
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#endif
+#ifndef _BIB_GENERAL_HXX
+#include "general.hxx"
+#endif
+#include "sections.hrc"
+#ifndef ADRRESID_HXX
+#include "bibresid.hxx"
+#endif
+#ifndef _BIB_DATMAN_HXX
+#include "datman.hxx"
+#endif
+#ifndef _BIB_FMPROP_HRC
+#include "bibprop.hrc"
+#endif
+//#ifndef _TOOLKIT_UNOIFACE_HXX
+//#include <toolkit/unoiface.hxx>
+//#endif
+#include <extensio.hrc>
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::form;
+using namespace ::rtl;
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+#define C2S(cChar) String::CreateFromAscii(cChar)
+
+Point lcl_MovePoint(const FixedText& rFixedText)
+{
+ Point aRet(rFixedText.GetPosPixel());
+ aRet.X() += rFixedText.GetSizePixel().Width();
+ aRet.X() += 5;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------
+String lcl_GetColumnName(BibDataManager* pDatMan, const Mapping* pMapping, sal_uInt16 nIndexPos)
+{
+ String sRet = pDatMan->GetDefColumnName(nIndexPos);
+ if(pMapping)
+ for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++)
+ {
+ if(pMapping->aColumnPairs[i].sLogicalColumnName == sRet)
+ {
+ sRet = pMapping->aColumnPairs[i].sRealColumnName;
+ break;
+ }
+ }
+ return sRet;
+}
+/* -----------------------------04.01.00 10:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class BibPosListener :public cppu::WeakImplHelper1 <sdbc::XRowSetListener>
+{
+ BibGeneralPage* pParentPage;
+public:
+ BibPosListener(BibGeneralPage* pParent);
+
+ //XPositioningListener
+ virtual void SAL_CALL cursorMoved(const lang::EventObject& event) throw( uno::RuntimeException );
+ virtual void SAL_CALL rowChanged(const lang::EventObject& event) throw( uno::RuntimeException ){ /* not interested in */ }
+ virtual void SAL_CALL rowSetChanged(const lang::EventObject& event) throw( uno::RuntimeException ){ /* not interested in */ }
+
+ //XEventListener
+ virtual void SAL_CALL disposing(const lang::EventObject& Source) throw( uno::RuntimeException );
+
+};
+/* -----------------------------04.01.00 10:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BibPosListener::BibPosListener(BibGeneralPage* pParent) :
+ pParentPage(pParent)
+{
+}
+/* -----------------------------04.01.00 10:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void BibPosListener::cursorMoved(const lang::EventObject& /*aEvent*/) throw( uno::RuntimeException )
+{
+ try
+ {
+ uno::Reference< form::XBoundComponent > xLstBox = pParentPage->GetTypeListBoxModel();
+ uno::Reference< beans::XPropertySet > xPropSet(xLstBox, UNO_QUERY);
+ if(xPropSet.is())
+ {
+ BibDataManager* pDatMan = pParentPage->GetDataManager();
+ const Mapping* pMapping = pDatMan->GetMapping(pDatMan->getActiveDataTable());
+ String sTypeMapping = pDatMan->GetDefColumnName(AUTHORITYTYPE_POS);
+ if(pMapping)
+ {
+ for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++)
+ {
+ if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == sTypeMapping)
+ {
+ sTypeMapping = pMapping->aColumnPairs[nEntry].sRealColumnName;
+ break;
+ }
+ }
+ }
+ rtl::OUString uTypeMapping = sTypeMapping;
+
+ uno::Reference< form::XForm > xForm = pDatMan->getDatabaseForm();
+ uno::Reference< sdbcx::XColumnsSupplier > xSupplyCols(xForm, UNO_QUERY);
+ uno::Reference< container::XNameAccess > xValueAcc;
+ if (xSupplyCols.is())
+ xValueAcc = xSupplyCols->getColumns();
+
+ sal_Int16 nTempVal = -1;
+ if(xValueAcc.is() && xValueAcc->hasByName(uTypeMapping))
+ {
+ uno::Any aVal = xValueAcc->getByName(uTypeMapping);
+ uno::Reference< uno::XInterface > xInt = *(uno::Reference< uno::XInterface > *)aVal.getValue();
+ uno::Reference< sdb::XColumn > xCol(xInt, UNO_QUERY);
+ DBG_ASSERT(xCol.is(), "BibPosListener::positioned : invalid column (no sdb::XColumn) !");
+ if (xCol.is())
+ {
+ nTempVal = xCol->getShort();
+ // getShort returns zero if the value is not a number
+ if (!nTempVal || xCol->wasNull())
+ {
+ rtl::OUString sTempVal = xCol->getString();
+ if(sTempVal != rtl::OUString('0'))
+ nTempVal = -1;
+ }
+ }
+ }
+ if(nTempVal < 0 || nTempVal >= TYPE_COUNT)
+ {
+ uno::Any aSel;
+ uno::Sequence<sal_Int16> aSelSeq(1);
+ sal_Int16* pArr = aSelSeq.getArray();
+ pArr[0] = TYPE_COUNT;
+ aSel.setValue(&aSelSeq, ::getCppuType((Sequence<sal_Int16>*)0));
+ xPropSet->setPropertyValue(C2U("SelectedItems"), aSel);
+ }
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("BibPosListener::positioned: something went wrong !");
+ }
+}
+/* -----------------------------04.01.00 11:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void BibPosListener::disposing(const lang::EventObject& Source) throw( uno::RuntimeException )
+{
+}
+
+/* -----------------16.11.99 13:06-------------------
+
+ --------------------------------------------------*/
+BibGeneralPage::BibGeneralPage(Window* pParent, BibDataManager* pMan):
+ TabPage(pParent,BibResId(RID_TP_GENERAL)),
+ pDatMan(pMan),
+ aControlParentWin(this, WB_DIALOGCONTROL),
+ aIdentifierFT(&aControlParentWin, ResId(FT_IDENTIFIER )),
+ aAuthTypeFT(&aControlParentWin, ResId(FT_AUTHTYPE )),
+ aAuthorFT(&aControlParentWin, ResId(FT_AUTHOR )),
+ aMonthFT(&aControlParentWin, ResId(FT_MONTH )),
+ aYearFT(&aControlParentWin, ResId(FT_YEAR )),
+
+ aPublisherFT(&aControlParentWin, ResId(FT_PUBLISHER )),
+ aISBNFT(&aControlParentWin, ResId(FT_ISBN )),
+
+ aAddressFT(&aControlParentWin, ResId(FT_ADDRESS )),
+ aAnnoteFT(&aControlParentWin, ResId(FT_ANNOTE )),
+ aBooktitleFT(&aControlParentWin, ResId(FT_BOOKTITLE )),
+ aChapterFT(&aControlParentWin, ResId(FT_CHAPTER )),
+ aEditionFT(&aControlParentWin, ResId(FT_EDITION )),
+ aEditorFT(&aControlParentWin, ResId(FT_EDITOR )),
+ aHowpublishedFT(&aControlParentWin, ResId(FT_HOWPUBLISHED )),
+ aInstitutionFT(&aControlParentWin, ResId(FT_INSTITUTION )),
+ aJournalFT(&aControlParentWin, ResId(FT_JOURNAL )),
+ aNoteFT(&aControlParentWin, ResId(FT_NOTE )),
+ aNumberFT(&aControlParentWin, ResId(FT_NUMBER )),
+ aOrganizationsFT(&aControlParentWin, ResId(FT_ORGANIZATION )),
+ aPagesFT(&aControlParentWin, ResId(FT_PAGE )),
+ aSchoolFT(&aControlParentWin, ResId(FT_SCHOOL )),
+ aSeriesFT(&aControlParentWin, ResId(FT_SERIES )),
+ aTitleFT(&aControlParentWin, ResId(FT_TITLE )),
+ aReportTypeFT(&aControlParentWin, ResId(FT_REPORT )),
+ aVolumeFT(&aControlParentWin, ResId(FT_VOLUME )),
+ aURLFT(&aControlParentWin, ResId(FT_URL )),
+ aCustom1FT(&aControlParentWin, ResId(FT_CUSTOM1 )),
+ aCustom2FT(&aControlParentWin, ResId(FT_CUSTOM2 )),
+ aCustom3FT(&aControlParentWin, ResId(FT_CUSTOM3 )),
+ aCustom4FT(&aControlParentWin, ResId(FT_CUSTOM4 )),
+ aCustom5FT(&aControlParentWin, ResId(FT_CUSTOM5 )),
+ aHoriScroll(this, WB_HORZ),
+ aVertScroll(this, WB_VERT),
+ sErrorPrefix(ResId(ST_ERROR_PREFIX))
+{
+ aControlParentWin.Show();
+ aStdSize = GetOutputSizePixel();
+
+ aBibTypeArr[0] = String(ResId(ST_TYPE_ARTICLE));
+ aBibTypeArr[1] = String(ResId(ST_TYPE_BOOK));
+ aBibTypeArr[2] = String(ResId(ST_TYPE_BOOKLET));
+ aBibTypeArr[3] = String(ResId(ST_TYPE_CONFERENCE));
+ aBibTypeArr[4] = String(ResId(ST_TYPE_INBOOK ));
+ aBibTypeArr[5] = String(ResId(ST_TYPE_INCOLLECTION));
+ aBibTypeArr[6] = String(ResId(ST_TYPE_INPROCEEDINGS));
+ aBibTypeArr[7] = String(ResId(ST_TYPE_JOURNAL ));
+ aBibTypeArr[8] = String(ResId(ST_TYPE_MANUAL ));
+ aBibTypeArr[9] = String(ResId(ST_TYPE_MASTERSTHESIS));
+ aBibTypeArr[10] = String(ResId(ST_TYPE_MISC ));
+ aBibTypeArr[11] = String(ResId(ST_TYPE_PHDTHESIS ));
+ aBibTypeArr[12] = String(ResId(ST_TYPE_PROCEEDINGS ));
+ aBibTypeArr[13] = String(ResId(ST_TYPE_TECHREPORT ));
+ aBibTypeArr[14] = String(ResId(ST_TYPE_UNPUBLISHED ));
+ aBibTypeArr[15] = String(ResId(ST_TYPE_EMAIL ));
+ aBibTypeArr[16] = String(ResId(ST_TYPE_WWW ));
+ aBibTypeArr[17] = String(ResId(ST_TYPE_CUSTOM1 ));
+ aBibTypeArr[18] = String(ResId(ST_TYPE_CUSTOM2 ));
+ aBibTypeArr[19] = String(ResId(ST_TYPE_CUSTOM3 ));
+ aBibTypeArr[20] = String(ResId(ST_TYPE_CUSTOM4 ));
+ aBibTypeArr[21] = String(ResId(ST_TYPE_CUSTOM5 ));
+
+ FreeResource();
+
+ aBasePos = aIdentifierFT.GetPosPixel();
+ aFixedTexts[0] = &aIdentifierFT;
+ aFixedTexts[1] = &aAuthTypeFT;
+ aFixedTexts[2] = &aAuthorFT;
+ aFixedTexts[3] = &aMonthFT;
+ aFixedTexts[4] = &aYearFT;
+ aFixedTexts[5] = &aPublisherFT;
+ aFixedTexts[6] = &aISBNFT;
+ aFixedTexts[7] = &aAddressFT;
+ aFixedTexts[8] = &aAnnoteFT;
+ aFixedTexts[9] = &aBooktitleFT;
+ aFixedTexts[10] = &aChapterFT;
+ aFixedTexts[11] = &aEditionFT;
+ aFixedTexts[12] = &aEditorFT;
+ aFixedTexts[13] = &aHowpublishedFT;
+ aFixedTexts[14] = &aInstitutionFT;
+ aFixedTexts[15] = &aJournalFT;
+ aFixedTexts[16] = &aNoteFT;
+ aFixedTexts[17] = &aNumberFT;
+ aFixedTexts[18] = &aOrganizationsFT;
+ aFixedTexts[19] = &aPagesFT;
+ aFixedTexts[20] = &aSchoolFT;
+ aFixedTexts[21] = &aSeriesFT;
+ aFixedTexts[22] = &aTitleFT;
+ aFixedTexts[23] = &aReportTypeFT;
+ aFixedTexts[24] = &aVolumeFT;
+ aFixedTexts[25] = &aURLFT;
+ aFixedTexts[26] = &aCustom1FT;
+ aFixedTexts[27] = &aCustom2FT;
+ aFixedTexts[28] = &aCustom3FT;
+ aFixedTexts[29] = &aCustom4FT;
+ aFixedTexts[30] = &aCustom5FT;
+ for(USHORT i = 0; i < FIELD_COUNT; i++)
+ aControls[i] = 0;
+
+ AdjustScrollbars();
+ Link aScrollLnk(LINK(this, BibGeneralPage, ScrollHdl));
+ aHoriScroll.SetScrollHdl( aScrollLnk );
+ aVertScroll.SetScrollHdl( aScrollLnk );
+ aHoriScroll.SetLineSize(10);
+ aVertScroll.SetLineSize(10);
+ aHoriScroll.SetPageSize( aIdentifierFT.GetSizePixel().Width());
+ aVertScroll.SetPageSize(
+ aPublisherFT.GetPosPixel().Y() - aIdentifierFT.GetPosPixel().Y());
+ aHoriScroll.Show();
+ aVertScroll.Show();
+
+ const Mapping* pMapping = pDatMan->GetMapping(pDatMan->getActiveDataTable());
+
+ xCtrlContnr = VCLUnoHelper::CreateControlContainer(&aControlParentWin);
+
+ xMgr = utl::getProcessServiceFactory();
+
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, IDENTIFIER_POS),
+ lcl_MovePoint(aIdentifierFT), aIdentifierFT.GetSizePixel(), sTableErrorString,
+ aIdentifierFT.GetText(), HID_BIB_IDENTIFIER_POS);
+
+ sTypeColumnName = lcl_GetColumnName(pDatMan, pMapping, AUTHORITYTYPE_POS);
+
+ AddControlWithError(
+ sTypeColumnName,
+ lcl_MovePoint(aAuthTypeFT ), aAuthTypeFT .GetSizePixel(), sTableErrorString, aAuthTypeFT.GetText(), HID_BIB_AUTHORITYTYPE_POS);
+
+
+ Point aYearPos = lcl_MovePoint(aYearFT);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, YEAR_POS),
+ aYearPos, aYearFT.GetSizePixel(), sTableErrorString, aYearFT.GetText(), HID_BIB_YEAR_POS);
+
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, AUTHOR_POS),
+ lcl_MovePoint(aAuthorFT ), aAuthorFT .GetSizePixel(), sTableErrorString, aAuthorFT.GetText(), HID_BIB_AUTHOR_POS);
+
+ Point aTitlePos(lcl_MovePoint(aTitleFT));
+ Size aTitleSize = aTitleFT .GetSizePixel();
+ aTitleSize.Width() = aYearPos.X() + aYearFT.GetSizePixel().Width() - aTitlePos.X();
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, TITLE_POS),
+ aTitlePos, aTitleSize, sTableErrorString, aTitleFT.GetText(), HID_BIB_TITLE_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, PUBLISHER_POS),
+ lcl_MovePoint(aPublisherFT), aPublisherFT.GetSizePixel(), sTableErrorString, aPublisherFT.GetText(), HID_BIB_PUBLISHER_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, ADDRESS_POS),
+ lcl_MovePoint(aAddressFT ), aAddressFT .GetSizePixel(), sTableErrorString, aAddressFT.GetText(), HID_BIB_ADDRESS_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, ISBN_POS),
+ lcl_MovePoint(aISBNFT ), aISBNFT .GetSizePixel(), sTableErrorString, aISBNFT.GetText(), HID_BIB_ISBN_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, CHAPTER_POS),
+ lcl_MovePoint(aChapterFT ), aChapterFT .GetSizePixel(), sTableErrorString, aChapterFT.GetText(), HID_BIB_CHAPTER_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, PAGES_POS),
+ lcl_MovePoint(aPagesFT ), aPagesFT .GetSizePixel(), sTableErrorString, aPagesFT.GetText(), HID_BIB_PAGES_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, EDITOR_POS),
+ lcl_MovePoint(aEditorFT ), aEditorFT .GetSizePixel(), sTableErrorString, aEditorFT.GetText(), HID_BIB_EDITOR_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, EDITION_POS),
+ lcl_MovePoint(aEditionFT ), aEditionFT .GetSizePixel(), sTableErrorString, aEditionFT.GetText(), HID_BIB_EDITION_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, BOOKTITLE_POS),
+ lcl_MovePoint(aBooktitleFT ), aBooktitleFT .GetSizePixel(), sTableErrorString, aBooktitleFT.GetText(), HID_BIB_BOOKTITLE_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, VOLUME_POS),
+ lcl_MovePoint(aVolumeFT ), aVolumeFT .GetSizePixel(), sTableErrorString, aVolumeFT.GetText(), HID_BIB_VOLUME_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, HOWPUBLISHED_POS),
+ lcl_MovePoint(aHowpublishedFT ), aHowpublishedFT .GetSizePixel(), sTableErrorString, aHowpublishedFT.GetText(), HID_BIB_HOWPUBLISHED_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, ORGANIZATIONS_POS),
+ lcl_MovePoint(aOrganizationsFT), aOrganizationsFT.GetSizePixel(), sTableErrorString, aOrganizationsFT.GetText(), HID_BIB_ORGANIZATIONS_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, INSTITUTION_POS),
+ lcl_MovePoint(aInstitutionFT ), aInstitutionFT .GetSizePixel(), sTableErrorString, aInstitutionFT.GetText(), HID_BIB_INSTITUTION_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, SCHOOL_POS),
+ lcl_MovePoint(aSchoolFT ), aSchoolFT .GetSizePixel(), sTableErrorString, aSchoolFT.GetText(), HID_BIB_SCHOOL_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, REPORTTYPE_POS),
+ lcl_MovePoint(aReportTypeFT ), aReportTypeFT .GetSizePixel(), sTableErrorString, aReportTypeFT.GetText(), HID_BIB_REPORTTYPE_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, MONTH_POS),
+ lcl_MovePoint(aMonthFT), aMonthFT .GetSizePixel(), sTableErrorString, aMonthFT.GetText(), HID_BIB_MONTH_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, JOURNAL_POS),
+ lcl_MovePoint(aJournalFT ), aJournalFT .GetSizePixel(), sTableErrorString, aJournalFT.GetText(), HID_BIB_JOURNAL_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, NUMBER_POS),
+ lcl_MovePoint(aNumberFT ), aNumberFT .GetSizePixel(), sTableErrorString, aNumberFT.GetText(), HID_BIB_NUMBER_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, SERIES_POS),
+ lcl_MovePoint(aSeriesFT ), aSeriesFT .GetSizePixel(), sTableErrorString, aSeriesFT.GetText(), HID_BIB_SERIES_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, ANNOTE_POS),
+ lcl_MovePoint(aAnnoteFT ), aAnnoteFT .GetSizePixel(), sTableErrorString, aAnnoteFT.GetText(), HID_BIB_ANNOTE_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, NOTE_POS),
+ lcl_MovePoint(aNoteFT ), aNoteFT .GetSizePixel(), sTableErrorString, aNoteFT.GetText(), HID_BIB_NOTE_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, URL_POS),
+ lcl_MovePoint(aURLFT ), aURLFT .GetSizePixel(), sTableErrorString, aURLFT.GetText(), HID_BIB_URL_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, CUSTOM1_POS),
+ lcl_MovePoint(aCustom1FT ), aCustom1FT.GetSizePixel(), sTableErrorString, aCustom1FT.GetText(), HID_BIB_CUSTOM1_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, CUSTOM2_POS),
+ lcl_MovePoint(aCustom2FT ), aCustom2FT.GetSizePixel(), sTableErrorString, aCustom2FT.GetText(), HID_BIB_CUSTOM2_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, CUSTOM3_POS),
+ lcl_MovePoint(aCustom3FT ), aCustom3FT.GetSizePixel(), sTableErrorString, aCustom3FT.GetText(), HID_BIB_CUSTOM3_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, CUSTOM4_POS),
+ lcl_MovePoint(aCustom4FT ), aCustom4FT.GetSizePixel(), sTableErrorString, aCustom4FT.GetText(), HID_BIB_CUSTOM4_POS);
+ AddControlWithError(
+ lcl_GetColumnName(pDatMan, pMapping, CUSTOM5_POS),
+ lcl_MovePoint(aCustom5FT ), aCustom5FT.GetSizePixel(), sTableErrorString, aCustom5FT.GetText(), HID_BIB_CUSTOM5_POS);
+
+// AddXControl("", lcl_MovePoint(.GetPosPixel()), .GetSizePixel(), sTableErrorString);
+
+ xPosListener = new BibPosListener(this);
+ uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getDatabaseForm(), UNO_QUERY);
+ if(xRowSet.is())
+ xRowSet->addRowSetListener(xPosListener);
+ xFormCtrl = uno::Reference< form::XFormController > (
+ xMgr->createInstance(C2U("com.sun.star.form.controller.FormController")), UNO_QUERY);
+ xFormCtrl->setModel(uno::Reference< awt::XTabControllerModel > (pDatMan->getDatabaseForm(), UNO_QUERY));
+ xFormCtrl->setContainer(xCtrlContnr);
+ xFormCtrl->activateTabOrder();
+
+ if(sTableErrorString.Len())
+ sTableErrorString.Insert(sErrorPrefix, 0);
+}
+//-----------------------------------------------------------------------------
+BibGeneralPage::~BibGeneralPage()
+{
+ if (pDatMan && xPosListener.is())
+ {
+ uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getDatabaseForm(), UNO_QUERY);
+ if(xRowSet.is())
+ xRowSet->removeRowSetListener(xPosListener);
+ }
+}
+ /* -----------------------------14.04.00 13:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ void BibGeneralPage::RemoveListeners()
+ {
+ for(USHORT i = 0; i < FIELD_COUNT; i++)
+ {
+ if(aControls[i].is())
+ {
+ uno::Reference< awt::XWindow > xCtrWin(aControls[i], uno::UNO_QUERY );
+ xCtrWin->removeFocusListener( this );
+ aControls[i] = 0;
+ }
+ }
+ }
+/* -----------------------------21.01.00 17:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void BibGeneralPage::CommitActiveControl()
+{
+ uno::Reference< awt::XControl > xCurr = xFormCtrl->getCurrentControl();
+ if(xCurr.is())
+ {
+ uno::Reference< awt::XControlModel > xModel = xCurr->getModel();
+ uno::Reference< form::XBoundComponent > xBound(xModel, UNO_QUERY);
+ if(xBound.is())
+ xBound->commit();
+ }
+}
+//-----------------------------------------------------------------------------
+void BibGeneralPage::AddControlWithError(const String& rColumnName,
+ const Point& rPos,
+ const Size& rSize,
+ String& rErrorString,
+ String aColumnUIName,
+ sal_uInt16 nHelpId)
+{
+ uno::Reference< awt::XControlModel > xTmp = AddXControl(rColumnName, rPos, rSize, nHelpId);
+ if(!xTmp.is())
+ {
+ if(rErrorString.Len())
+ {
+ rErrorString += '\n';
+ }
+ aColumnUIName.EraseAllChars('~');
+ rErrorString += aColumnUIName;
+ }
+}
+//-----------------------------------------------------------------------------
+uno::Reference< awt::XControlModel > BibGeneralPage::AddXControl(
+ const String& rName,
+ Point rPos, Size rSize, sal_uInt16 nHelpId)
+{
+ uno::Reference< awt::XControlModel > xCtrModel;
+ try
+ {
+ sal_Bool bTypeListBox = sTypeColumnName == rName;
+ xCtrModel = pDatMan->loadControlModel(rName, bTypeListBox);
+ if ( xCtrModel.is() && xMgr.is())
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xCtrModel, UNO_QUERY );
+
+ if( xPropSet.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo();
+
+ uno::Any aAny = xPropSet->getPropertyValue( C2U("DefaultControl") );
+ rtl::OUString aControlName;
+ aAny >>= aControlName;
+
+ rtl::OUString uProp(C2U("HelpURL"));
+ if(xPropInfo->hasPropertyByName(uProp))
+ {
+ String sId(C2S("HID:"));
+ sId += nHelpId;
+ rtl::OUString uId(sId) ;
+ uno::Any aVal; aVal <<= uId;
+ xPropSet->setPropertyValue(uProp, aVal);
+ }
+
+ if(bTypeListBox)
+ {
+ //uno::Reference< beans::XPropertySet > xPropSet(xControl, UNO_QUERY);
+ uno::Any aAny;
+ aAny <<= (sal_Int16)1;
+ xPropSet->setPropertyValue(C2U("BoundColumn"), aAny);
+ // ListSourceType eSet = ListSourceType_SQL;
+ ListSourceType eSet = ListSourceType_VALUELIST;
+ aAny.setValue( &eSet, ::getCppuType((const ListSourceType*)0) );
+ xPropSet->setPropertyValue(C2U("ListSourceType"), aAny);
+
+ uno::Sequence<rtl::OUString> aListSource(TYPE_COUNT);
+ rtl::OUString* pListSourceArr = aListSource.getArray();
+ //pListSourceArr[0] = C2U("select TypeName, TypeIndex from TypeNms");
+ for(sal_uInt16 i = 0; i < TYPE_COUNT; i++)
+ pListSourceArr[i] = String::CreateFromInt32(i);
+ aAny.setValue(&aListSource, ::getCppuType((uno::Sequence<rtl::OUString>*)0));
+
+ xPropSet->setPropertyValue(C2U("ListSource"), aAny);
+
+ uno::Sequence<rtl::OUString> aValues(TYPE_COUNT + 1);
+ rtl::OUString* pValuesArr = aValues.getArray();
+ for(sal_uInt16 j = 0; j < TYPE_COUNT; j++)
+ pValuesArr[j] = aBibTypeArr[j];
+ // empty string if an invalid value no values is set
+ pValuesArr[TYPE_COUNT] = rtl::OUString();
+
+ aAny.setValue(&aValues, ::getCppuType((uno::Sequence<rtl::OUString>*)0));
+
+ xPropSet->setPropertyValue(C2U("StringItemList"), aAny);
+
+ BOOL bTrue = sal_True;
+ aAny.setValue( &bTrue, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( C2U("Dropdown"), aAny );
+
+ aControlName = C2U("com.sun.star.form.control.ListBox");
+ xLBModel = Reference< form::XBoundComponent >(xCtrModel, UNO_QUERY);
+
+ }
+
+ uno::Reference< awt::XControl > xControl(xMgr->createInstance( aControlName ), UNO_QUERY );
+ if ( xControl.is() )
+ {
+ xControl->setModel( xCtrModel);
+
+ // Peer als Child zu dem FrameWindow
+ xCtrlContnr->addControl(rName, xControl);
+ uno::Reference< awt::XWindow > xCtrWin(xControl, UNO_QUERY );
+ xCtrWin->addFocusListener( this );
+ for(USHORT i = 0; i < FIELD_COUNT; i++)
+ if(!aControls[i].is())
+ {
+ aControls[i] = xCtrWin;
+ break;
+ }
+ xCtrWin->setVisible( sal_True );
+ xControl->setDesignMode(sal_False);
+
+ xCtrWin->setPosSize(rPos.X(), rPos.Y(), rSize.Width(),
+ rSize.Height(), awt::PosSize::POSSIZE);
+ }
+ }
+ }
+ }
+ catch(...)
+ {
+ DBG_ERROR("BibGeneralPage::AddXControl: something went wrong !");
+ }
+ return xCtrModel;
+}
+/* -----------------------------14.04.00 11:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void BibGeneralPage::AdjustScrollbars()
+{
+ long nVertScrollWidth = aVertScroll.GetSizePixel().Width();
+ long nHoriScrollHeight = aHoriScroll.GetSizePixel().Height();
+ Size aOutSize(GetOutputSizePixel());
+ BOOL bHoriVisible = aOutSize.Width() <= aStdSize.Width();
+ BOOL bVertVisible = (aOutSize.Height()-(bHoriVisible ? nHoriScrollHeight : 0)) <= (aStdSize.Height());
+ aHoriScroll.Show(bHoriVisible);
+ aVertScroll.Show(bVertVisible);
+
+ if(bHoriVisible)
+ {
+ Size aHoriSize(aOutSize.Width() - (bVertVisible ? nVertScrollWidth : 0),
+ nHoriScrollHeight);
+ aHoriScroll.SetSizePixel(aHoriSize);
+ aHoriScroll.SetRange( Range(0, aStdSize.Width()));
+ aHoriScroll.SetVisibleSize( aHoriSize.Width() - (bVertVisible ? nVertScrollWidth : 0));
+ }
+ if(bVertVisible)
+ {
+ Size aVertSize(nHoriScrollHeight, aOutSize.Height() -
+ (bHoriVisible ? nHoriScrollHeight : 0));
+ aVertScroll.SetSizePixel(aVertSize);
+ aVertScroll.SetRange( Range(0, aStdSize.Height()));
+ aVertScroll.SetVisibleSize( aVertSize.Height() );
+ }
+
+ Size aSize(8, 8);
+ aSize = LogicToPixel(aSize, MapMode(MAP_APPFONT));
+ Size aScrollSize(aOutSize.Width() - aSize.Height(), aSize.Height());
+ Point aScrollPos(0, aOutSize.Height() - aSize.Height());
+ aHoriScroll.SetPosSizePixel(aScrollPos, aScrollSize);
+
+ aScrollPos.X() = aOutSize.Width() - aSize.Width();
+ aScrollPos.Y() = 0;
+ aScrollSize.Width() = aSize.Width();
+ aScrollSize.Height() = aOutSize.Height() - aSize.Height();
+ aVertScroll.SetPosSizePixel(aScrollPos, aScrollSize);
+
+ Size aControlParentWinSz(aOutSize);
+ if(bHoriVisible)
+ aControlParentWinSz.Height() -= aSize.Height();
+ if(bVertVisible)
+ aControlParentWinSz.Width() -= aSize.Width();
+ aControlParentWin.SetSizePixel(aControlParentWinSz);
+}
+/* -----------------------------13.04.00 16:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void BibGeneralPage::Resize()
+{
+ AdjustScrollbars();
+ ScrollHdl(&aVertScroll);
+ ScrollHdl(&aHoriScroll);
+ Window::Resize();
+}
+/* -----------------------------14.04.00 11:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(BibGeneralPage, ScrollHdl, ScrollBar*, pScroll)
+{
+ BOOL bVertical = &aVertScroll == pScroll;
+ long nOffset = 0;
+ if(bVertical)
+ {
+ long nCurrentOffset = aFixedTexts[0]->GetPosPixel().Y() - aBasePos.Y();
+ nOffset = pScroll->GetThumbPos() + nCurrentOffset;
+ }
+ else
+ {
+ long nCurrentOffset = aFixedTexts[0]->GetPosPixel().X() - aBasePos.X();
+ nOffset = pScroll->GetThumbPos() + nCurrentOffset;
+ }
+
+ for(USHORT i = 0; i < FIELD_COUNT; i++)
+ {
+ Point aPos = aFixedTexts[i]->GetPosPixel();
+ if(bVertical)
+ aPos.Y() -= nOffset;
+ else
+ aPos.X() -= nOffset;
+ aFixedTexts[i]->SetPosPixel(aPos);
+ if(aControls[i].is())
+ {
+ awt::Rectangle aRect = aControls[i]->getPosSize();
+ long nX = aRect.X;
+ long nY = aRect.Y;
+ if(bVertical)
+ nY -= nOffset;
+ else
+ nX -= nOffset;
+ aControls[i]->setPosSize(nX, nY, 0, 0, awt::PosSize::POS);
+ }
+ }
+ return 0;
+}
+/* -----------------------------14.04.00 12:49--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void BibGeneralPage::focusGained(const awt::FocusEvent& rEvent) throw( uno::RuntimeException )
+{
+ Reference<awt::XWindow> xCtrWin(rEvent.Source, UNO_QUERY );
+ if(xCtrWin.is())
+ {
+ Size aOutSize = aControlParentWin.GetOutputSizePixel();
+ awt::Rectangle aRect = xCtrWin->getPosSize();
+ long nX = aRect.X;
+ if(nX < 0)
+ {
+ // left of the visible area
+ aHoriScroll.SetThumbPos(aHoriScroll.GetThumbPos() + nX);
+ ScrollHdl(&aHoriScroll);
+ }
+ else if(nX > aOutSize.Width())
+ {
+ // right of the visible area
+ aHoriScroll.SetThumbPos(aHoriScroll.GetThumbPos() + nX - aOutSize.Width() + aFixedTexts[0]->GetSizePixel().Width());
+ ScrollHdl(&aHoriScroll);
+ }
+ long nY = aRect.Y;
+ if(nY < 0)
+ {
+ // below the visible area
+ aVertScroll.SetThumbPos(aVertScroll.GetThumbPos() + nY);
+ ScrollHdl(&aVertScroll);
+ }
+ else if(nY > aOutSize.Height())
+ {
+ // over the visible area
+ aVertScroll.SetThumbPos(aVertScroll.GetThumbPos() + nY - aOutSize.Height()+ aFixedTexts[0]->GetSizePixel().Height());
+ ScrollHdl(&aVertScroll);
+ }
+ }
+}
+/* -----------------------------14.04.00 12:49--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void BibGeneralPage::focusLost(const awt::FocusEvent& ) throw( uno::RuntimeException )
+{
+}
+/* -----------------------------14.04.00 12:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void BibGeneralPage::disposing(const lang::EventObject& Source) throw( uno::RuntimeException )
+{
+}
+
+
+
+
diff --git a/extensions/source/bibliography/general.hxx b/extensions/source/bibliography/general.hxx
new file mode 100644
index 000000000..b113d14e4
--- /dev/null
+++ b/extensions/source/bibliography/general.hxx
@@ -0,0 +1,225 @@
+/*************************************************************************
+ *
+ * $RCSfile: general.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _BIB_GENERAL_HXX
+#define _BIB_GENERAL_HXX
+
+#ifndef _COM_SUN_STAR_AWT_XFOCUSLISTENER_HPP_
+#include <com/sun/star/awt/XFocusListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XControlContainer.hpp>
+#endif
+//#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+//#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+//#endif
+#ifndef _COM_SUN_STAR_FORM_XBOUNDCOMPONENT_HPP_
+#include <com/sun/star/form/XBoundComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_XFORMCONTROLLER_HPP_
+#include <com/sun/star/form/XFormController.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROWSETLISTENER_HPP_
+#include <com/sun/star/sdbc/XRowSetListener.hpp>
+#endif
+
+#ifndef _STDCTRL_HXX //autogen
+#include <svtools/stdctrl.hxx>
+#endif
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+#ifndef _SV_GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+
+#ifndef _SVEDIT_HXX //autogen
+#include <svtools/svmedit.hxx>
+#endif
+
+#ifndef _SV_TABPAGE_HXX //autogen
+#include <vcl/tabpage.hxx>
+#endif
+
+#ifndef _SV_COMBOBOX_HXX //
+#include <vcl/combobox.hxx>
+#endif
+#ifndef _SV_SCRBAR_HXX
+#include <vcl/scrbar.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#endif
+
+
+class BibDataManager;
+#define TYPE_COUNT 22
+#define FIELD_COUNT 31
+
+typedef cppu::WeakAggImplHelper1
+<
+ ::com::sun::star::awt::XFocusListener
+> BibGeneralPageBaseClass;
+
+class BibGeneralPage:
+ public BibGeneralPageBaseClass,
+ public TabPage
+{
+ Window aControlParentWin;
+ FixedText aIdentifierFT;
+ FixedText aAuthTypeFT;
+
+ FixedText aAuthorFT;
+ FixedText aMonthFT;
+ FixedText aYearFT;
+
+ FixedText aPublisherFT;
+ FixedText aISBNFT;
+
+ FixedText aAddressFT;
+ FixedText aAnnoteFT;
+ FixedText aBooktitleFT;
+ FixedText aChapterFT;
+ FixedText aEditionFT;
+ FixedText aEditorFT;
+ FixedText aHowpublishedFT;
+ FixedText aInstitutionFT;
+ FixedText aJournalFT;
+ FixedText aNoteFT;
+ FixedText aNumberFT;
+ FixedText aOrganizationsFT;
+ FixedText aPagesFT;
+ FixedText aSchoolFT;
+ FixedText aSeriesFT;
+ FixedText aTitleFT;
+ FixedText aReportTypeFT;
+ FixedText aVolumeFT;
+ FixedText aURLFT;
+ FixedText aCustom1FT;
+ FixedText aCustom2FT;
+ FixedText aCustom3FT;
+ FixedText aCustom4FT;
+ FixedText aCustom5FT;
+
+ ScrollBar aHoriScroll;
+ ScrollBar aVertScroll;
+
+ FixedText* aFixedTexts[FIELD_COUNT];
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> aControls[FIELD_COUNT];
+
+ Size aStdSize;
+ Point aBasePos;
+
+ String aBibTypeArr[TYPE_COUNT];
+ String sErrorPrefix;
+ String sTableErrorString;
+
+ String sTypeColumnName;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > xCtrlContnr;
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > xFormCtrl;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent > xCurrentBoundComponent;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent > xLBModel;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener > xPosListener;
+
+
+ BibDataManager* pDatMan;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > AddXControl(const String& rName, Point aPos, Size aSize, sal_uInt16 nHelpId);
+
+ void AddControlWithError(const String& rColumnName,
+ const Point& rPos, const Size& rSize, String& rErrorString,
+ String aColumnUIName, sal_uInt16 nHelpId);
+
+ void AdjustScrollbars();
+ DECL_LINK(ScrollHdl, ScrollBar*);
+
+protected:
+ virtual void Resize();
+public:
+ BibGeneralPage(Window* pParent, BibDataManager* pDatMan);
+ virtual ~BibGeneralPage();
+
+ const String& GetErrorString() const {return sTableErrorString;}
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::form::XBoundComponent > GetTypeListBoxModel() {return xLBModel;}
+ BibDataManager* GetDataManager() {return pDatMan;}
+
+ void CommitActiveControl();
+
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( com::sun::star::uno::RuntimeException );
+
+ void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e) throw( com::sun::star::uno::RuntimeException );
+ void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e) throw( com::sun::star::uno::RuntimeException );
+
+ void RemoveListeners();
+};
+
+
+#endif
+
+
diff --git a/extensions/source/bibliography/hidother.src b/extensions/source/bibliography/hidother.src
new file mode 100644
index 000000000..fdfed918a
--- /dev/null
+++ b/extensions/source/bibliography/hidother.src
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * $RCSfile: hidother.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "..\..\inc\extensio.hrc" // HID_FUNC_XXX
+//#include "hidother.hrc"
+
+hidspecial HID_BIB_IDENTIFIER_POS { HelpID = HID_BIB_IDENTIFIER_POS ; };
+hidspecial HID_BIB_AUTHORITYTYPE_POS { HelpID = HID_BIB_AUTHORITYTYPE_POS ; };
+hidspecial HID_BIB_AUTHOR_POS { HelpID = HID_BIB_AUTHOR_POS ; };
+hidspecial HID_BIB_TITLE_POS { HelpID = HID_BIB_TITLE_POS ; };
+hidspecial HID_BIB_YEAR_POS { HelpID = HID_BIB_YEAR_POS ; };
+hidspecial HID_BIB_ISBN_POS { HelpID = HID_BIB_ISBN_POS ; };
+hidspecial HID_BIB_BOOKTITLE_POS { HelpID = HID_BIB_BOOKTITLE_POS ; };
+hidspecial HID_BIB_CHAPTER_POS { HelpID = HID_BIB_CHAPTER_POS ; };
+hidspecial HID_BIB_EDITION_POS { HelpID = HID_BIB_EDITION_POS ; };
+hidspecial HID_BIB_EDITOR_POS { HelpID = HID_BIB_EDITOR_POS ; };
+hidspecial HID_BIB_HOWPUBLISHED_POS { HelpID = HID_BIB_HOWPUBLISHED_POS ; };
+hidspecial HID_BIB_INSTITUTION_POS { HelpID = HID_BIB_INSTITUTION_POS ; };
+hidspecial HID_BIB_JOURNAL_POS { HelpID = HID_BIB_JOURNAL_POS ; };
+hidspecial HID_BIB_MONTH_POS { HelpID = HID_BIB_MONTH_POS ; };
+hidspecial HID_BIB_NOTE_POS { HelpID = HID_BIB_NOTE_POS ; };
+hidspecial HID_BIB_ANNOTE_POS { HelpID = HID_BIB_ANNOTE_POS ; };
+hidspecial HID_BIB_NUMBER_POS { HelpID = HID_BIB_NUMBER_POS ; };
+hidspecial HID_BIB_ORGANIZATIONS_POS { HelpID = HID_BIB_ORGANIZATIONS_POS ; };
+hidspecial HID_BIB_PAGES_POS { HelpID = HID_BIB_PAGES_POS ; };
+hidspecial HID_BIB_PUBLISHER_POS { HelpID = HID_BIB_PUBLISHER_POS ; };
+hidspecial HID_BIB_ADDRESS_POS { HelpID = HID_BIB_ADDRESS_POS ; };
+hidspecial HID_BIB_SCHOOL_POS { HelpID = HID_BIB_SCHOOL_POS ; };
+hidspecial HID_BIB_SERIES_POS { HelpID = HID_BIB_SERIES_POS ; };
+hidspecial HID_BIB_REPORTTYPE_POS { HelpID = HID_BIB_REPORTTYPE_POS ; };
+hidspecial HID_BIB_VOLUME_POS { HelpID = HID_BIB_VOLUME_POS ; };
+hidspecial HID_BIB_URL_POS { HelpID = HID_BIB_URL_POS ; };
+hidspecial HID_BIB_CUSTOM1_POS { HelpID = HID_BIB_CUSTOM1_POS ; };
+hidspecial HID_BIB_CUSTOM2_POS { HelpID = HID_BIB_CUSTOM2_POS ; };
+hidspecial HID_BIB_CUSTOM3_POS { HelpID = HID_BIB_CUSTOM3_POS ; };
+hidspecial HID_BIB_CUSTOM4_POS { HelpID = HID_BIB_CUSTOM4_POS ; };
+hidspecial HID_BIB_CUSTOM5_POS { HelpID = HID_BIB_CUSTOM5_POS ; };
+hidspecial HID_BIB_DB_GRIDCTRL { HelpID = HID_BIB_DB_GRIDCTRL ; };
diff --git a/extensions/source/bibliography/makefile.mk b/extensions/source/bibliography/makefile.mk
new file mode 100644
index 000000000..1781f8fa1
--- /dev/null
+++ b/extensions/source/bibliography/makefile.mk
@@ -0,0 +1,225 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=bib
+TARGET=bib
+GEN_HID=TRUE
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+NO_BSYMBOLIC=TRUE
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= bibcont.cxx \
+ bibload.cxx \
+ bibmod.cxx \
+ general.cxx \
+ framectr.cxx \
+ bibview.cxx \
+ bibbeam.cxx \
+ toolbar.cxx \
+ datman.cxx \
+ registry.cxx \
+ bibexch.cxx \
+ fieldwin.cxx \
+ viewsect.cxx
+
+
+SLOFILES= $(SLO)$/bibcont.obj \
+ $(SLO)$/bibload.obj \
+ $(SLO)$/bibmod.obj \
+ $(SLO)$/general.obj \
+ $(SLO)$/framectr.obj \
+ $(SLO)$/bibview.obj \
+ $(SLO)$/bibbeam.obj \
+ $(SLO)$/toolbar.obj \
+ $(SLO)$/datman.obj \
+ $(SLO)$/registry.obj \
+ $(SLO)$/bibexch.obj \
+ $(SLO)$/fieldwin.obj\
+ $(SLO)$/viewsect.obj
+
+
+SRCFILES= bib.src \
+ datman.src \
+ sections.src \
+ menu.src \
+ toolbar.src
+
+RESLIB1NAME=bib
+RESLIB1SRSFILES= $(SRS)/bib.srs
+RESLIB1DEPN= bib.src bib.hrc
+
+SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
+
+# $(UNOLIB) \
+
+SHL1STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(TOOLSLIB) \
+ $(SO2LIB) \
+ $(VCLLIB) \
+ $(TKLIB) \
+ $(SVTOOLLIB)\
+ $(SVLLIB) \
+ $(OSLLIB) \
+ $(SALLIB) \
+ $(UNOTOOLSLIB) \
+ $(SOTLIB) \
+ $(UCBHELPERLIB)
+
+#Create UNO Header files
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)
+INCPRE+=$(UNOUCROUT)
+
+UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
+
+UNOTYPES=\
+ com.sun.star.awt.PosSize \
+ com.sun.star.awt.XPointer \
+ com.sun.star.awt.XControl \
+ com.sun.star.awt.XControlContainer \
+ com.sun.star.awt.XControlModel \
+ com.sun.star.awt.XWindowPeer \
+ com.sun.star.beans.PropertyAttribute \
+ com.sun.star.beans.PropertyValue \
+ com.sun.star.beans.PropertyValues \
+ com.sun.star.data.XDatabaseDialogs \
+ com.sun.star.data.XDatabaseFavorites \
+ com.sun.star.form.XBoundComponent \
+ com.sun.star.form.XLoadable \
+ com.sun.star.form.XGridColumnFactory \
+ com.sun.star.form.ListSourceType \
+ com.sun.star.form.XForm \
+ com.sun.star.form.XFormController \
+ com.sun.star.frame.XComponentLoader \
+ com.sun.star.frame.XDispatchProvider \
+ com.sun.star.frame.XFilterDetect\
+ com.sun.star.frame.FrameSearchFlag \
+ com.sun.star.io.XPersistObject \
+ com.sun.star.io.XDataInputStream \
+ com.sun.star.io.XActiveDataSource \
+ com.sun.star.io.XMarkableStream \
+ com.sun.star.io.XActiveDataSink \
+ com.sun.star.lang.XLocalizable \
+ com.sun.star.lang.XServiceName \
+ com.sun.star.registry.XSimpleRegistry \
+ com.sun.star.sdb.CommandType\
+ com.sun.star.sdb.XDatabaseEnvironment \
+ com.sun.star.sdb.XColumn\
+ com.sun.star.sdb.XSQLQueryComposerFactory\
+ com.sun.star.sdbc.DataType \
+ com.sun.star.sdbc.ResultSetType \
+ com.sun.star.sdbc.ResultSetConcurrency \
+ com.sun.star.sdbc.XConnection \
+ com.sun.star.sdbc.XDataSource \
+ com.sun.star.sdbc.XResultSetUpdate \
+ com.sun.star.sdbcx.XTablesSupplier \
+ com.sun.star.sdbcx.XColumnsSupplier \
+ com.sun.star.sdbcx.XRowLocate \
+ com.sun.star.sdb.XSQLQueryComposer\
+ com.sun.star.sdbc.XResultSet \
+ com.sun.star.sdbc.ResultSetType \
+ com.sun.star.sdbc.XRowSet\
+ com.sun.star.text.BibliographyDataField \
+ com.sun.star.uno.XNamingService\
+ com.sun.star.util.XLocalizedAliases\
+ com.sun.star.util.XURLTransformer
+
+#END
+
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1IMPLIB= i$(TARGET)
+SHL1DEPN= $(SHL1LIBS)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1EXPORTFILE= exports.dxp
+
+ALL:\
+ $(do_build) \
+ $(SRS)$/hidother.hid\
+ ALLTAR
+
+$(SRS)$/hidother.hid: hidother.src
+.IF "$(GUI)" =="WNT"
+ @+echo
+ @+echo NO HIDS!
+ @+echo
+ +copy ..\..\inc\extensio.hrc .
+ +mhids hidother.src ..$/..$/$(INPATH)$/srs bib hidother
+ +del extensio.hrc
+.ELSE
+ @echo wnt only
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/extensions/source/bibliography/menu.src b/extensions/source/bibliography/menu.src
new file mode 100644
index 000000000..b889ef60f
--- /dev/null
+++ b/extensions/source/bibliography/menu.src
@@ -0,0 +1,594 @@
+/*************************************************************************
+ *
+ * $RCSfile: menu.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <svtools/solar.hrc>
+#include <sfx2/sfxsids.hrc>
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#ifndef _GLOBALACC_SRC
+#include <svx/globlac.hrc>
+#endif
+#include <offmgr/ofaids.hrc>
+#include <offmgr/sbasltid.hrc>
+#include <extensio.hrc>
+
+#include "bib.hrc"
+
+#define MN_EDIT 20
+#define MN_VIEW 21
+#define MN_EXTRA 22
+#define MN_WIN 30
+#define MN_HELP 31
+
+Menu RID_MAIN_MENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_FILE_PICKLIST
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_FILE_NEWDOC
+ };
+ MenuItem
+ {
+ ITEM_FILE_OPENDOC
+ };
+ ITEM_FILE_AUTOPILOT
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ ITEM_FILE_CLOSEDOC
+ };
+ /*
+ MenuItem
+ {
+ ITEM_FILE_SAVEDOC
+ };
+ MenuItem
+ {
+ ITEM_FILE_SAVEASDOC
+ };
+ */
+ MenuItem
+ {
+ ITEM_FILE_SAVEDOCS //!!muss fuer andere geoeffnete Tasks drinbleiben
+ };
+ MenuItem
+ {
+ Command = ".uno:ss/sendasemail" ;
+ Identifier = 369;
+ Text = "Als E-Mail ~versenden..." ;
+ Text[ English ] = "Send as EMail...";
+ Text [ english_us ] = "Send as ~E-mail..." ;
+ Text[ portuguese ] = "~Enviar como e-mail...";
+ Text[ russian ] = "Îòïðàâèòü êàê ýëåêòðîííîå ïèñüìî...";
+ Text[ dutch ] = "Als ~e-mail verzenden...";
+ Text[ french ] = "~Envoyer par e-mail...";
+ Text[ spanish ] = "Enviar como ~mensaje electrónico...";
+ Text[ italian ] = "~Invia come eMail...";
+ Text[ danish ] = "Send som e-mail...";
+ Text[ swedish ] = "~Skicka som e-post...";
+ Text[ polish ] = "Wyœlij jako e-mail...";
+ Text[ portuguese_brazilian ] = "Send Even~t as EMail...";
+ Text[ japanese ] = "E-mail‚Æ‚µ‚Ä‘—M(~E)...";
+ Text[ chinese_simplified ] = "µ±×÷µç×ÓÓʼþ¼Ä·¢(~E)...";
+ Text[ chinese_traditional ] = "·í§@¹q¤l¶l¥óµo°e(~E)...";
+ Text[ arabic ] = "ÅÑÓÇá ßÈÑíÏ ÅáßÊÑæäí...";
+ Text[ greek ] = "ÁðïóôïëÞ ~ùò E-mail...";
+ Text[ korean ] = "ÀüÀÚ¿ìÆíÀ¸·Î º¸³»±â(~E)...";
+ Text[ turkish ] = "E-posta olarak gönder...";
+ Text[ language_user1 ] = " ";
+ };
+ /*
+ MenuItem
+ {
+ ITEM_FILE_MAIL_SENDDOC
+ };
+ */
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ ITEM_FILE_PRINTDOC
+ };
+ MenuItem
+ {
+ ITEM_FILE_SETUPPRINTER
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ ITEM_FILE_QUITAPP
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Identifier = MN_EDIT ;
+ HelpID = MN_EDIT ;
+ Text = "~Bearbeiten" ;
+ Text [ English ] = "~Edit" ;
+ Text [ norwegian ] = "~Rediger" ;
+ Text [ italian ] = "~Modifica" ;
+ Text [ portuguese_brazilian ] = "~Editar" ;
+ Text [ portuguese ] = "~Editar" ;
+ Text [ finnish ] = "~Muokkaa" ;
+ Text [ danish ] = "~Rediger" ;
+ Text [ french ] = "~Édition" ;
+ Text [ swedish ] = "R~edigera" ;
+ Text [ dutch ] = "Be~werken" ;
+ Text [ spanish ] = "~Editar" ;
+ Text [ english_us ] = "~Edit" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+/* MenuItem
+ {
+ ITEM_EDIT_UNDO
+ Command = ".uno:Bib/undo" ;
+ };
+ MenuItem
+ {
+ ITEM_EDIT_REDO
+ };
+ MenuItem
+ {
+ ITEM_EDIT_REPEAT
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };*/
+ MenuItem
+ {
+ ITEM_EDIT_CUT
+ };
+ MenuItem
+ {
+ ITEM_EDIT_COPY
+ };
+ MenuItem
+ {
+ ITEM_EDIT_PASTE
+ };
+ MenuItem
+ {
+ ITEM_EDIT_SELECTALL
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ HelpId = HID_BIB_MAPPINGDLG;
+ Text = "~Spaltenzuordnung..." ;
+ Text[ English ] = "~Column assignment..." ;
+ Command = ".uno:Bib/Mapping" ;
+ Identifier = RID_MAIN_ME_MAPPING ;
+ Checkable=TRUE;
+ Text[ english_us ] = "~Column Arrangement...";
+ Text[ portuguese ] = "~Dispor colunas...";
+ Text[ russian ] = "~Ðàñïîëîæåíèå êîëîíîê...";
+ Text[ greek ] = "Áíôéóôïß÷éóç ~óôÞëçò...";
+ Text[ dutch ] = "~Kolomindeling...";
+ Text[ french ] = "~Assignation de colonnes...";
+ Text[ spanish ] = "~Asignación de columnas...";
+ Text[ italian ] = "A~ssegnazione colonne...";
+ Text[ danish ] = "Kolonnetildeling...";
+ Text[ swedish ] = "~Kolumntilldelning...";
+ Text[ polish ] = "Przyporz¹dkowanie kolumn...";
+ Text[ portuguese_brazilian ] = "~Column assignment...";
+ Text[ japanese ] = "—ñ‚Ì•ª—Þ(~C)...";
+ Text[ korean ] = "¿­ ¹èÁ¤(~C)...";
+ Text[ chinese_simplified ] = "±àÅÅÁÐ(~C)...";
+ Text[ chinese_traditional ] = "½s±ÆÄæ(~C)...";
+ Text[ arabic ] = "ÊÚííä ÇáÃÚãÏÉ...";
+ Text[ turkish ] = "~Sütun düzeni...";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ HelpId = HID_BIB_CHANGESOURCE;
+ Text = "~Datenquelle..." ;
+ Text[ English ] = "~Data source..." ;
+ Command = ".uno:Bib/sdbsource" ;
+ Identifier = RID_MAIN_ME_DBSOURCE;
+ Checkable=TRUE;
+ Text[ english_us ] = "~Data Source...";
+ Text[ portuguese ] = "~Fonte de dados...";
+ Text[ russian ] = "~Èñõîäíûå äàííûå...";
+ Text[ greek ] = "ÐñïÝëåõóç ~äåäïìÝíùí...";
+ Text[ dutch ] = "~Gegevensbron...";
+ Text[ french ] = "~Source de données...";
+ Text[ spanish ] = "~Fuente de datos...";
+ Text[ italian ] = "Sorgente ~dati...";
+ Text[ danish ] = "Datakilde...";
+ Text[ swedish ] = "~Datakälla...";
+ Text[ polish ] = "ród³o danych...";
+ Text[ portuguese_brazilian ] = "~Data source...";
+ Text[ japanese ] = "ÃÞ°À¿°½(~D)...";
+ Text[ korean ] = "µ¥ÀÌÅÍ ¼Ò½º(~D)...";
+ Text[ chinese_simplified ] = "Êý¾ÝÀ´Ô´(~D)...";
+ Text[ chinese_traditional ] = "¼ÆÕu·½(~D)...";
+ Text[ arabic ] = "ãÕÏÑ ÇáÈíÇäÇÊ...";
+ Text[ turkish ] = "~Veri kaynaðý...";
+ Text[ language_user1 ] = " ";
+ };
+/* MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Text = "~Layout" ;
+ Text[ English ] = "~Layout" ;
+ Command = ".uno:Bib/Layout" ;
+ Identifier = RID_MAIN_ME_LAYOUT;
+ Checkable=TRUE;
+ };
+
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ ITEM_EDIT_SEARCH_DLG
+ };
+ MenuItem
+ {
+ ITEM_EDIT_SBA_ADDRPI
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ ITEM_EDIT_EDIT_FRAMESET
+ };
+ */
+ };
+ };
+ Text[ russian ] = "~Ïðàâêà";
+ Text[ polish ] = "~Edytuj";
+ Text[ japanese ] = "•ÒW(~E)";
+ Text[ chinese_simplified ] = "±à¼­(~E)";
+ Text[ chinese_traditional ] = "½s¿è(~E)";
+ Text[ arabic ] = "~ÊÍÑíÑ";
+ Text[ greek ] = "~Åðåîåñãáóßá";
+ Text[ korean ] = "ÆíÁý(~E)";
+ Text[ turkish ] = "~Düzenle";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = MN_VIEW ;
+ HelpID = MN_VIEW ;
+ Text = "~Ansicht" ;
+ Text [ English ] = "~View" ;
+ Text [ norwegian ] = "~Vis" ;
+ Text [ italian ] = "~Visualizza" ;
+ Text [ portuguese_brazilian ] = "~Ver" ;
+ Text [ portuguese ] = "~Ver" ;
+ Text [ finnish ] = "~Näytä" ;
+ Text [ danish ] = "~Vis" ;
+ Text [ french ] = "~Affichage" ;
+ Text [ swedish ] = "Vi~sa" ;
+ Text [ dutch ] = "Beel~d" ;
+ Text [ spanish ] = "~Ver" ;
+ Text [ english_us ] = "~View" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_VIEW_EXPLORER
+ };
+ MenuItem
+ {
+ ITEM_VIEW_BROWSER
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = 22 ;
+ HelpID = 22 ;
+ Text = "S~ymbolleisten" ;
+ Text [ English ] = "Toolbars" ;
+ Text [ english_us ] = "~Toolbars" ;
+ Text [ swedish ] = "S~ymbollister" ;
+ Text [ danish ] = "Ikonlin~jer" ;
+ Text [ italian ] = "Barr~e dei simboli" ;
+ Text [ spanish ] = "Barras de ~símbolos" ;
+ Text [ french ] = "Barres d'~outils" ;
+ Text [ dutch ] = "We~rkbalken" ;
+ Text [ portuguese ] = "Barras de ~ferramentas" ;
+ Text [ portuguese_brazilian ] = "Symbolleisten" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_VIEW_TOGGLEFUNCTIONBAR
+ };
+ MenuItem
+ {
+ ITEM_VIEW_TOGGLEOBJECTBAR
+ };
+ MenuItem
+ {
+ ITEM_INSERT_HYPERLINK_INSERT
+ };
+ /*
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = SID_CUSTOMIZETOOLBOX ;
+ HelpID = SID_CUSTOMIZETOOLBOX ;
+ Text = "~Bearbeiten..." ;
+ Text [ English ] = "~Customize..." ;
+ Text [ english_us ] = "~Customize..." ;
+ Text [ swedish ] = "~Redigera..." ;
+ Text [ danish ] = "~Rediger..." ;
+ Text [ italian ] = "~Modifica..." ;
+ Text [ spanish ] = "~Personalizar..." ;
+ Text [ french ] = "~Personnaliser..." ;
+ Text [ dutch ] = "~Bewerken..." ;
+ Text [ portuguese ] = "~Personalizar..." ;
+ Text [ portuguese_brazilian ] = "~Bearbeiten..." ;
+ };
+ */
+ };
+ };
+ Text[ russian ] = "Ïàíåëè ñèìâîëîâ";
+ Text[ polish ] = "Paski symboli";
+ Text[ japanese ] = "°ÙÊÞ°(~T)";
+ Text[ chinese_simplified ] = "ͼ±êÀ¸(~T)";
+ Text[ chinese_traditional ] = "¤u¨ã¦C(~T)";
+ Text[ arabic ] = "ÃÔÑØÉ ÇáÑãæÒ";
+ Text[ greek ] = "ÃñáììÝò ó~õìâüëùí";
+ Text[ korean ] = "µµ±¸¸ðÀ½(~T)";
+ Text[ turkish ] = "Araç çubuklarý";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ ITEM_VIEW_TOGGLESTATUSBAR
+ };
+/* MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Text = "Hierarchisch" ;
+ Text[ English ] = "Hierarchical" ;
+ Command = ".uno:Bib/hierarchical" ;
+ Identifier = RID_MAIN_ME_HIERARCHICAL;
+ Checkable=TRUE;
+ };
+*/ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ ITEM_VIEW_SCREENMODE
+ };
+ };
+ Text[ russian ] = "~Âèä";
+ Text[ greek ] = "Ðñï~âïëÞ";
+ Text[ polish ] = "~Widok";
+ Text[ japanese ] = "•\\Ž¦(~V)";
+ Text[ korean ] = "º¸±â(~V)";
+ Text[ chinese_simplified ] = "ÊÓͼ(~V)";
+ Text[ chinese_traditional ] = "À˵ø(~V)";
+ Text[ arabic ] = "~ÚÑÖ";
+ Text[ turkish ] = "Görünüm";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Identifier = MN_EXTRA ;
+ HelpID = MN_EXTRA ;
+ Text = "E~xtras" ;
+ Text [ English ] = "T~ools" ;
+ Text [ norwegian ] = "Verk~tøy" ;
+ Text [ italian ] = "~Strumenti" ;
+ Text [ portuguese_brazilian ] = "F~erramentas" ;
+ Text [ portuguese ] = "~Ferramentas" ;
+ Text [ finnish ] = "~Työkalut" ;
+ Text [ danish ] = "Fun~ktioner" ;
+ Text [ french ] = "~Outils" ;
+ Text [ swedish ] = "~Verktyg" ;
+ Text [ dutch ] = "E~xtra" ;
+ Text [ spanish ] = "~Herramientas" ;
+ Text [ english_us ] = "~Tools" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+/* MenuItem
+ {
+ Text = "Neue Adresse" ;
+ Text [ English ] = "New Address" ;
+ Command = ".uno:Bib/newEntry" ;
+ Identifier = RID_MAIN_ME_NEWENTRY;
+ };
+ MenuItem
+ {
+ Text = "Adresse ändern" ;
+ Text [ English ] = "Change Address" ;
+ Command = ".uno:Bib/changeEntry" ;
+ Identifier = RID_MAIN_ME_CHANGEENTRY;
+ };
+ MenuItem
+ {
+ Text = "Adresse löschen" ;
+ Text [ English ] = "Remove Address" ;
+ Command = ".uno:Bib/removeEntry" ;
+ Identifier = RID_MAIN_ME_REMOVEENTRY;
+ };
+
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+
+*/ MenuItem
+ {
+ Command = ".uno:Bib/standardFilter" ;
+ Identifier = RID_MAIN_ME_SEARCH;
+ Text = "~Filtern...";
+ Text[ English ] = "Filter..." ;
+ Text[ english_us ] = "~Filter...";
+ Text[ portuguese ] = "~Filtrar...";
+ Text[ russian ] = "Ôèëüòð...";
+ Text[ greek ] = "ÖéëôñÜñéóìá...";
+ Text[ dutch ] = "~Filteren...";
+ Text[ french ] = "~Filtrer...";
+ Text[ spanish ] = "~Filtrar...";
+ Text[ italian ] = "~Filtra...";
+ Text[ danish ] = "Filtrer...";
+ Text[ swedish ] = "~Filtrera...";
+ Text[ polish ] = "Filtruj...";
+ Text[ portuguese_brazilian ] = "Filter...";
+ Text[ japanese ] = "̨ÙÀ(~F)...";
+ Text[ korean ] = "ÇÊÅÍ(~F)...";
+ Text[ chinese_simplified ] = "ɸѡ(~F)...";
+ Text[ chinese_traditional ] = "¿z¿ï(~F)...";
+ Text[ arabic ] = "ÊÕÝíÉ...";
+ Text[ turkish ] = "~Filtrele...";
+ Text[ language_user1 ] = " ";
+ };
+/* MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Command = ".uno:Bib/InsertFieldDlg" ;
+ Identifier = RID_MAIN_ME_FIELDDLG;
+ Text = "Felder ~einfügen...";
+ Text[ English ] = "Insert Fields..." ;
+ };
+*/ MenuItem
+ {
+ Separator = TRUE ;
+ };
+
+
+ MenuItem
+ {
+ ITEM_TOOLS_BASICCHOOSER
+ };
+
+
+ /*
+ MenuItem
+ {
+ ITEM_TOOLS_CONFIG
+ };
+ */
+ ITEM_MN_OPTIONS
+ };
+ };
+ Text[ russian ] = "~Ñåðâèñ";
+ Text[ greek ] = "Å~ñãáëåßá";
+ Text[ polish ] = "~Narzêdzia";
+ Text[ japanese ] = "°Ù(~T)";
+ Text[ korean ] = "µµ±¸(~T)";
+ Text[ chinese_simplified ] = "¹¤¾ß(~T)";
+ Text[ chinese_traditional ] = "¤u¨ã(~T)";
+ Text[ arabic ] = "Ã~ÏæÇÊ";
+ Text[ turkish ] = "~Araçlar";
+ Text[ language_user1 ] = " ";
+ };
+ ITEM_WINDOW_MENU
+ ITEM_HELP_MENU
+ };
+};
+
diff --git a/extensions/source/bibliography/sections.hrc b/extensions/source/bibliography/sections.hrc
new file mode 100644
index 000000000..14aa7bad7
--- /dev/null
+++ b/extensions/source/bibliography/sections.hrc
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * $RCSfile: sections.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "bib.hrc"
+
+//General
+/*#define FT_FIRST_MIDDLE 1
+#define ED_FIRST 2
+#define ED_MIDDLE 3
+#define FT_NAME_SUFFIX 4
+#define ED_NAME 5
+#define CB_SUFFIX 6
+#define ED_INITIALS 8
+#define FT_COMPANY 9
+#define ED_COMPANY 10
+#define FT_DEPARTMENT 11
+#define ED_DEPARTMENT 12
+#define FT_SALUTATION 13
+#define CB_SALUTATION 14
+#define FT_SHOWNNAME 15
+#define ED_SHOWNNAME 16*/
+#define FT_IDENTIFIER 1
+#define FT_AUTHTYPE 2
+#define FT_AUTHOR 3
+#define FT_YEAR 4
+#define FT_ISBN 5
+
+#define FT_MONTH 6
+
+#define FT_PUBLISHER 8
+
+#define FT_ADDRESS 9
+#define FT_ANNOTE 10
+#define FT_BOOKTITLE 11
+#define FT_CHAPTER 12
+#define FT_EDITION 13
+#define FT_EDITOR 14
+#define FT_HOWPUBLISHED 15
+#define FT_INSTITUTION 16
+#define FT_JOURNAL 17
+#define FT_NOTE 18
+#define FT_NUMBER 19
+#define FT_ORGANIZATION 20
+#define FT_PAGE 21
+#define FT_SCHOOL 22
+#define FT_SERIES 23
+#define FT_TITLE 24
+#define FT_REPORT 25
+#define FT_VOLUME 26
+#define FT_URL 27
+#define FT_CUSTOM1 28
+#define FT_CUSTOM2 29
+#define FT_CUSTOM3 30
+#define FT_CUSTOM4 31
+#define FT_CUSTOM5 32
+#define ST_ERROR_PREFIX 33
+
+//Business Address
+#define FT_OFFICE 1
+#define FT_STREET 2
+#define FT_CITY 3
+#define FT_STATE 4
+#define FT_COUNTRY 5
+#define FT_ZIP 6
+#define ED_OFFICE 7
+#define ED_STREET 8
+#define ED_CITY 9
+#define ED_STATE 10
+#define ED_COUNTRY 11
+#define ED_ZIP 12
+#define ED_POBOX 13
+
+
+//Popup SectionControl
+#define PU_INSERT 1
+#define PU_REMOVE 2
+#define PU_CHG_NAME 3
+
+#define ST_TYPE_ARTICLE 40
+#define ST_TYPE_BOOK 41
+#define ST_TYPE_BOOKLET 42
+#define ST_TYPE_CONFERENCE 43
+#define ST_TYPE_INBOOK 44
+#define ST_TYPE_INCOLLECTION 45
+#define ST_TYPE_INPROCEEDINGS 46
+#define ST_TYPE_JOURNAL 47
+#define ST_TYPE_MANUAL 48
+#define ST_TYPE_MASTERSTHESIS 49
+#define ST_TYPE_MISC 50
+#define ST_TYPE_PHDTHESIS 51
+#define ST_TYPE_PROCEEDINGS 52
+#define ST_TYPE_TECHREPORT 53
+#define ST_TYPE_UNPUBLISHED 54
+#define ST_TYPE_EMAIL 55
+#define ST_TYPE_WWW 56
+#define ST_TYPE_CUSTOM1 57
+#define ST_TYPE_CUSTOM2 58
+#define ST_TYPE_CUSTOM3 59
+#define ST_TYPE_CUSTOM4 60
+#define ST_TYPE_CUSTOM5 61
+
diff --git a/extensions/source/bibliography/sections.src b/extensions/source/bibliography/sections.src
new file mode 100644
index 000000000..cab2647a1
--- /dev/null
+++ b/extensions/source/bibliography/sections.src
@@ -0,0 +1,1538 @@
+/*************************************************************************
+ *
+ * $RCSfile: sections.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//#pragma CHARSET_ANSI
+
+#include "sections.hrc"
+
+#define FT_POS 6
+#define FTSIZE_LEFT 65
+#define ED_POS_LEFT FT_POS+FTSIZE_LEFT+1
+#define ED_SIZE 65
+#define BTN_SIZE 12
+#define ED_POS_LEFT2 ED_POS_LEFT + ED_SIZE +1
+#define FT_POS_MIDDLE ED_POS_LEFT2 + 5
+#define FT_POS_RIGHT FT_POS_MIDDLE + FT_POS_MIDDLE - FT_POS
+
+TabPage RID_TP_GENERAL
+{
+ Size = MAP_APPFONT( 452, 195 );
+ Text = "Allgemein";
+ Text[English]= "General";
+
+ FixedText FT_IDENTIFIER
+ {
+ Pos = MAP_APPFONT( FT_POS, 6 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "~Kurzbezeichnung";
+ Text[English]= "Identifier";
+ Text[ english_us ] = "Short ~name";
+ Text[ portuguese ] = "~Abreviatura";
+ Text[ russian ] = "Ñîêðàùåíèå";
+ Text[ greek ] = "Óõíôïìïãñáößá";
+ Text[ dutch ] = "~Beknopte aanduiding";
+ Text[ french ] = "~Abrégé";
+ Text[ spanish ] = "~Abreviatura";
+ Text[ italian ] = "Abbreviazione";
+ Text[ danish ] = "Kort betegnelse";
+ Text[ swedish ] = "~Kort beteckning";
+ Text[ polish ] = "Skrót";
+ Text[ portuguese_brazilian ] = "Identifier";
+ Text[ japanese ] = "’˜ŽÒID(~N)";
+ Text[ korean ] = "¾àĪ(~N)";
+ Text[ chinese_simplified ] = "¼ò³Æ(~N)";
+ Text[ chinese_traditional ] = "ÃѧO¤å(~N)";
+ Text[ arabic ] = "ÇÓã ãÎÊÕÑ";
+ Text[ turkish ] = "~Kýsa ad";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_AUTHTYPE
+ {
+ Pos = MAP_APPFONT( FT_POS_MIDDLE, 6 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "~Art";
+ Text[English]= "Type";
+ Text[ english_us ] = "~Type";
+ Text[ portuguese ] = "~Tipo";
+ Text[ russian ] = "Òèï";
+ Text[ greek ] = "Ôýðïò";
+ Text[ dutch ] = "~Type";
+ Text[ french ] = "T~ype";
+ Text[ spanish ] = "~Tipo";
+ Text[ italian ] = "Tipo";
+ Text[ danish ] = "Type";
+ Text[ swedish ] = "Typ";
+ Text[ polish ] = "Typ";
+ Text[ portuguese_brazilian ] = "Type";
+ Text[ japanese ] = "–{‚Ì•ª—Þ(~T)";
+ Text[ korean ] = "À¯Çü(~T)";
+ Text[ chinese_simplified ] = "ÀàÐÍ(~T)";
+ Text[ chinese_traditional ] = "Ãþ«¬(~T)";
+ Text[ arabic ] = "ÇáäæÚ";
+ Text[ turkish ] = "~Tür";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_YEAR
+ {
+ Pos = MAP_APPFONT( FT_POS_RIGHT, 6 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "~Jahr";
+ Text[English]= "Year";
+ Text[ english_us ] = "~Year";
+ Text[ portuguese ] = "A~no";
+ Text[ russian ] = "Ãîä";
+ Text[ greek ] = "¸ôïò";
+ Text[ dutch ] = "~Jaar";
+ Text[ french ] = "A~nnée";
+ Text[ spanish ] = "~Año";
+ Text[ italian ] = "Anno";
+ Text[ danish ] = "År";
+ Text[ swedish ] = "År";
+ Text[ polish ] = "Rok";
+ Text[ portuguese_brazilian ] = "Year";
+ Text[ japanese ] = "’˜ì”N(~Y)";
+ Text[ korean ] = "¿¬µµ(~Y)";
+ Text[ chinese_simplified ] = "Äê(~Y)";
+ Text[ chinese_traditional ] = "¦~";
+ Text[ arabic ] = "";
+ Text[ turkish ] = "Yýl";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_AUTHOR
+ {
+ Pos = MAP_APPFONT( FT_POS, 20 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "A~utor";
+ Text[English]= "Author";
+ Text[ english_us ] = "~Author";
+ Text[ portuguese ] = "A~utor";
+ Text[ russian ] = "Àâòîð";
+ Text[ greek ] = "ÓõíôÜêôçò";
+ Text[ dutch ] = "~Auteur";
+ Text[ french ] = "A~uteur";
+ Text[ spanish ] = "A~utor";
+ Text[ italian ] = "A~utore";
+ Text[ danish ] = "Forfatter";
+ Text[ swedish ] = "Författare";
+ Text[ polish ] = "Autor";
+ Text[ portuguese_brazilian ] = "Author";
+ Text[ japanese ] = "’˜ŽÒ(~A)";
+ Text[ korean ] = "ÀúÀÚ(~A)";
+ Text[ chinese_simplified ] = "×÷Õß(~A)";
+ Text[ chinese_traditional ] = "§@ªÌ(~A)";
+ Text[ arabic ] = "ÇáãÄáÝ";
+ Text[ turkish ] = "Yazar";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_TITLE
+ {
+ Pos = MAP_APPFONT( FT_POS_MIDDLE, 20 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Tite~l";
+ Text[English]= "Title";
+ Text[ english_us ] = "Tit~le";
+ Text[ portuguese ] = "Títu~lo";
+ Text[ russian ] = "Çàãîëîâîê";
+ Text[ greek ] = "Ôßôëïò";
+ Text[ dutch ] = "~Titel";
+ Text[ french ] = "Tit~re";
+ Text[ spanish ] = "Títu~lo";
+ Text[ italian ] = "Tito~lo";
+ Text[ danish ] = "Titel";
+ Text[ swedish ] = "Titel";
+ Text[ polish ] = "Tytu³";
+ Text[ portuguese_brazilian ] = "Title";
+ Text[ japanese ] = "‘è–¼(~L)";
+ Text[ korean ] = "Á¦¸ñ(~L)";
+ Text[ chinese_simplified ] = "±êÌâ(~L)";
+ Text[ chinese_traditional ] = "¼ÐÃD(~L)";
+ Text[ arabic ] = "ÇáÚäæÇä";
+ Text[ turkish ] = "Baþlýk";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_PUBLISHER
+ {
+ Pos = MAP_APPFONT( FT_POS, 34 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "~Verlag";
+ Text[English]= "Publisher";
+ Text[ english_us ] = "~Publisher";
+ Text[ portuguese ] = "~Editora";
+ Text[ russian ] = "Èçäàòåëüñòâî";
+ Text[ greek ] = "Åêäüôçò";
+ Text[ dutch ] = "~Uitgeverij";
+ Text[ french ] = "Éditi~on";
+ Text[ spanish ] = "~Editorial";
+ Text[ italian ] = "Casa editrice";
+ Text[ danish ] = "Forlag";
+ Text[ swedish ] = "Förlag";
+ Text[ polish ] = "Wydawnictwo";
+ Text[ portuguese_brazilian ] = "Publisher";
+ Text[ japanese ] = "o”ŎЖ¼(~P)";
+ Text[ korean ] = "ÃâÆÇ»ç(~P)";
+ Text[ chinese_simplified ] = "³ö°æÉç(~P)";
+ Text[ chinese_traditional ] = "¥Xª©ªÀ(~P)";
+ Text[ arabic ] = "ÏÇÑ ÇáäÔÑ";
+ Text[ turkish ] = "Yayýnevi";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_ADDRESS
+ {
+ Pos = MAP_APPFONT( FT_POS_MIDDLE, 34 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "A~dresse";
+ Text[English]= "Address";
+ Text[ english_us ] = "A~ddress";
+ Text[ portuguese ] = "En~dereço";
+ Text[ russian ] = "Àäðåñ";
+ Text[ greek ] = "Äéåýèõíóç";
+ Text[ dutch ] = "A~dres";
+ Text[ french ] = "A~dresse";
+ Text[ spanish ] = "~Dirección";
+ Text[ italian ] = "Indirizzo";
+ Text[ danish ] = "Adresse";
+ Text[ swedish ] = "Adress";
+ Text[ polish ] = "Adres";
+ Text[ portuguese_brazilian ] = "Address";
+ Text[ japanese ] = "ZŠ(~D)";
+ Text[ korean ] = "ÁÖ¼Ò(~D)";
+ Text[ chinese_simplified ] = "µØÖ·(~D)";
+ Text[ chinese_traditional ] = "¦a§}(~D)";
+ Text[ arabic ] = "ÇáÚäæÇä";
+ Text[ turkish ] = "Adres";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_ISBN
+ {
+ Pos = MAP_APPFONT( FT_POS_RIGHT, 34 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "~ISBN";
+ Text[English]= "ISBN";
+ Text[ english_us ] = "~ISBN";
+ Text[ portuguese ] = "~ISBN";
+ Text[ russian ] = "ISBN";
+ Text[ greek ] = "ISBN";
+ Text[ dutch ] = "~ISBN";
+ Text[ french ] = "~ISBN";
+ Text[ spanish ] = "I~SBN";
+ Text[ italian ] = "~ISBN";
+ Text[ danish ] = "ISBN";
+ Text[ swedish ] = "ISBN";
+ Text[ polish ] = "ISBN";
+ Text[ portuguese_brazilian ] = "ISBN";
+ Text[ japanese ] = "ISBN(~I)";
+ Text[ korean ] = "ISBN(~I)";
+ Text[ chinese_simplified ] = "ISBN(~I)";
+ Text[ chinese_traditional ] = "ISBN(~I)";
+ Text[ arabic ] = "ISBN";
+ Text[ turkish ] = "~ISBN";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_CHAPTER
+ {
+ Pos = MAP_APPFONT( FT_POS, 48 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "~Kapitel";
+ Text[English]= "Chapter";
+ Text[ english_us ] = "~Chapter";
+ Text[ portuguese ] = "~Capítulo";
+ Text[ russian ] = "Ãëàâà";
+ Text[ greek ] = "ÊåöÜëáéï";
+ Text[ dutch ] = "~Hoofdstuk";
+ Text[ french ] = "~Chapitre";
+ Text[ spanish ] = "~Capítulo";
+ Text[ italian ] = "Capitolo";
+ Text[ danish ] = "Kapitel";
+ Text[ swedish ] = "Kapitel";
+ Text[ polish ] = "Rozdzia³";
+ Text[ portuguese_brazilian ] = "Chapter";
+ Text[ japanese ] = "Í(~C)";
+ Text[ korean ] = "Àå(~C)";
+ Text[ chinese_simplified ] = "ÕÂ(~C)";
+ Text[ chinese_traditional ] = "³¹(~C)";
+ Text[ arabic ] = "ÇáÝÕá";
+ Text[ turkish ] = "Bölüm";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_PAGE
+ {
+ Pos = MAP_APPFONT( FT_POS_MIDDLE, 48 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Seite~(n)";
+ Text[English]= "Page(s)";
+ Text[ english_us ] = "Pa~ge(s)";
+ Text[ portuguese ] = "Pá~gina(s)";
+ Text[ russian ] = "Ñòðàíèö(û)";
+ Text[ greek ] = "Óåëßäá/-åò";
+ Text[ dutch ] = "~Pagina's";
+ Text[ french ] = "~Page(s)";
+ Text[ spanish ] = "~Página(s)";
+ Text[ italian ] = "Pagina/e";
+ Text[ danish ] = "Side(r)";
+ Text[ swedish ] = "Sida(-or)";
+ Text[ polish ] = "Strona(y)";
+ Text[ portuguese_brazilian ] = "Page(s)";
+ Text[ japanese ] = "Íß°¼Þ”(~G)";
+ Text[ korean ] = "ÆäÀÌÁö(~G)";
+ Text[ chinese_simplified ] = "Ò³(~G)";
+ Text[ chinese_traditional ] = "­¶(~G)";
+ Text[ arabic ] = "ÕÝÍÉ (ÕÝÍÇÊ)";
+ Text[ turkish ] = "Sayfa(lar)";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_EDITOR
+ {
+ Pos = MAP_APPFONT( FT_POS, 69 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "~Herausgeber";
+ Text[English]= "Editor";
+ Text[ english_us ] = "Editor";
+ Text[ portuguese ] = "Edi~tor";
+ Text[ russian ] = "Ðåäàêòîð èçäàíèÿ";
+ Text[ greek ] = "Åêäüô~çò";
+ Text[ dutch ] = "Uit~gever";
+ Text[ french ] = "Éditeu~r";
+ Text[ spanish ] = "~Editor";
+ Text[ italian ] = "Editore";
+ Text[ danish ] = "Udgiver";
+ Text[ swedish ] = "Utgivare";
+ Text[ polish ] = "Wydawca";
+ Text[ portuguese_brazilian ] = "Editor";
+ Text[ japanese ] = "•ÒŽÒ";
+ Text[ korean ] = "¹ßÇàÀÎ";
+ Text[ chinese_simplified ] = "·¢ÐÐÈË";
+ Text[ chinese_traditional ] = "¥Xª©¤H";
+ Text[ arabic ] = "ÇáäÇÔÑ";
+ Text[ turkish ] = "Yayýma hazýrlayan";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_EDITION
+ {
+ Pos = MAP_APPFONT( FT_POS_MIDDLE, 67 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Aus~gabe";
+ Text[English]= "Edition";
+ Text[ english_us ] = "Ed~ition";
+ Text[ portuguese ] = "~Edição";
+ Text[ russian ] = "Èçäàíèå";
+ Text[ greek ] = "Åîá~ãùãÞ";
+ Text[ dutch ] = "E~ditie";
+ Text[ french ] = "É~dition";
+ Text[ spanish ] = "~Edición";
+ Text[ italian ] = "Edizione";
+ Text[ danish ] = "Udgave";
+ Text[ swedish ] = "Utgåva";
+ Text[ polish ] = "Wydanie";
+ Text[ portuguese_brazilian ] = "Edition";
+ Text[ japanese ] = "Ӂ(~I)";
+ Text[ korean ] = "ÆÇ(~I)";
+ Text[ chinese_simplified ] = "°æ±¾(~I)";
+ Text[ chinese_traditional ] = "ª©¥»(~I)";
+ Text[ arabic ] = "ÇáØÈÚÉ";
+ Text[ turkish ] = "Yayým";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_BOOKTITLE
+ {
+ Pos = MAP_APPFONT( FT_POS, 83 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Bu~chtitel";
+ Text[English]= "Book title";
+ Text[ english_us ] = "~Book title";
+ Text[ portuguese ] = "~Título do livro";
+ Text[ russian ] = "Íàçâàíèå êíèãè";
+ Text[ greek ] = "Ôßôëïò âéâëßïõ";
+ Text[ dutch ] = "Bo~ektitel";
+ Text[ french ] = "~Titre du livre";
+ Text[ spanish ] = "~Título del libro";
+ Text[ italian ] = "Titolo libro";
+ Text[ danish ] = "Bogtitel";
+ Text[ swedish ] = "Boktitel";
+ Text[ polish ] = "Tytu³ ksi¹¿ki";
+ Text[ portuguese_brazilian ] = "Book title";
+ Text[ japanese ] = "‘–¼(~B)";
+ Text[ korean ] = "Ã¥ Á¦¸ñ(~B)";
+ Text[ chinese_simplified ] = "Êé¼®±êÌâ(~B)";
+ Text[ chinese_traditional ] = "®Ñ¦W(~B)";
+ Text[ arabic ] = "ÚäæÇä ÇáßÊÇÈ";
+ Text[ turkish ] = "Kitap adý";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_VOLUME
+ {
+ Pos = MAP_APPFONT( FT_POS_MIDDLE, 83 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Buch Nummer";
+ Text[English]= "Volume";
+ Text[ english_us ] = "Volume";
+ Text[ portuguese ] = "Volume";
+ Text[ russian ] = "Òîì";
+ Text[ greek ] = "Ôüìïò";
+ Text[ dutch ] = "Deel nummer";
+ Text[ french ] = "Volume";
+ Text[ spanish ] = "Tomo";
+ Text[ italian ] = "Numero libro";
+ Text[ danish ] = "Bind";
+ Text[ swedish ] = "Volym";
+ Text[ polish ] = "Tom";
+ Text[ portuguese_brazilian ] = "Volume";
+ Text[ japanese ] = "Šª";
+ Text[ korean ] = "±Ç";
+ Text[ chinese_simplified ] = "Êé¼®±àºÅ";
+ Text[ chinese_traditional ] = "®Ñ¸¹";
+ Text[ arabic ] = "ÑÞã ÇáãÌáÏ";
+ Text[ turkish ] = "Kitap no.";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_HOWPUBLISHED
+ {
+ Pos = MAP_APPFONT( FT_POS_RIGHT, 83 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Au~sgabeart";
+ Text[English]= "How published";
+ Text[ english_us ] = "Publication t~ype";
+ Text[ portuguese ] = "Ti~po de publicação";
+ Text[ russian ] = "Òèï èçäàíèÿ";
+ Text[ greek ] = "Ôýðï~ò Ýêäïóçò";
+ Text[ dutch ] = "Wijze van ~publiceren";
+ Text[ french ] = "Mode de ~publication";
+ Text[ spanish ] = "Tip~o de publicación";
+ Text[ italian ] = "Tipo di edizione";
+ Text[ danish ] = "Udgivelsestype";
+ Text[ swedish ] = "Utgivningstyp";
+ Text[ polish ] = "Rodzaj publikacji";
+ Text[ portuguese_brazilian ] = "How published";
+ Text[ japanese ] = "¶ÊÞ°À²Ìß(~Y)";
+ Text[ korean ] = "ÃâÆÇÇüÅÂ(~Y)";
+ Text[ chinese_simplified ] = "·¢Ðз½Ê½(~Y)";
+ Text[ chinese_traditional ] = "ª©¥»Ãþ«¬(~Y)";
+ Text[ arabic ] = "ØÑíÞÉ ÇáØÈÇÚÉ";
+ Text[ turkish ] = "Yayým türü";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_ORGANIZATION
+ {
+ Pos = MAP_APPFONT( FT_POS, 97 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "~Organisation";
+ Text[English]= "Organization";
+ Text[ english_us ] = "Organi~zation";
+ Text[ portuguese ] = "~Organização";
+ Text[ russian ] = "Îðãàíèçàöèÿ";
+ Text[ greek ] = "~Ïñãáíéóìüò";
+ Text[ dutch ] = "~Organisatie";
+ Text[ french ] = "Or~ganisation";
+ Text[ spanish ] = "~Organización";
+ Text[ italian ] = "~Organizzazione";
+ Text[ danish ] = "Organisation";
+ Text[ swedish ] = "Organisation";
+ Text[ polish ] = "Organizacja";
+ Text[ portuguese_brazilian ] = "Organization";
+ Text[ japanese ] = "‘gD’c‘Ì(~Z)";
+ Text[ korean ] = "Á¶Á÷(~Z)";
+ Text[ chinese_simplified ] = "×éÖ¯(~Z)";
+ Text[ chinese_traditional ] = "²Õ´(~Z)";
+ Text[ arabic ] = "ãäÙãÉ";
+ Text[ turkish ] = "Organizasyon";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_INSTITUTION
+ {
+ Pos = MAP_APPFONT( FT_POS_MIDDLE, 97 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "~Institution";
+ Text[English]= "Institution";
+ Text[ english_us ] = "Instit~ution";
+ Text[ portuguese ] = "~Instituição";
+ Text[ russian ] = "Ðåäàêöèÿ";
+ Text[ greek ] = "ºäñõìá";
+ Text[ dutch ] = "~Instelling";
+ Text[ french ] = "~Institution";
+ Text[ spanish ] = "I~nstitución";
+ Text[ italian ] = "~Istituzione";
+ Text[ danish ] = "Institution";
+ Text[ swedish ] = "Institution";
+ Text[ polish ] = "Instytucja";
+ Text[ portuguese_brazilian ] = "Institution";
+ Text[ japanese ] = "‹@ŠÖ(~U)";
+ Text[ korean ] = "°ø°ø±â°ü(~U)";
+ Text[ chinese_simplified ] = "»ú¹¹(~U)";
+ Text[ chinese_traditional ] = "ÉóÌÛ(~U)";
+ Text[ arabic ] = "ÇáåíÆÉ";
+ Text[ turkish ] = "Kurum";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_SCHOOL
+ {
+ Pos = MAP_APPFONT( FT_POS_RIGHT, 97 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Universit~ät/Hochschule";
+ Text[English]= "University";
+ Text[ english_us ] = "Unive~rsity";
+ Text[ portuguese ] = "~Universidade/Escola Sup.";
+ Text[ russian ] = "ÂÓÇ";
+ Text[ greek ] = "Á.Å.É./Ô.Å.É.";
+ Text[ dutch ] = "~Universeit/Hogeschool";
+ Text[ french ] = "~Université/École supérieure";
+ Text[ spanish ] = "~Universidad";
+ Text[ italian ] = "Università";
+ Text[ danish ] = "Universitet/læreanstalt";
+ Text[ swedish ] = "Universitet/högskola";
+ Text[ polish ] = "Uniwersytet/Szko³a wy¿sza";
+ Text[ portuguese_brazilian ] = "University";
+ Text[ japanese ] = "‘åŠw(~R)";
+ Text[ korean ] = "´ëÇб³(~R)";
+ Text[ chinese_simplified ] = "´óѧ(~R)";
+ Text[ chinese_traditional ] = "°ªµ¥°|®Õ(~R)";
+ Text[ arabic ] = "ÇáÌÇãÚÉ";
+ Text[ turkish ] = "Üniversite/yüksek okul";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_REPORT
+ {
+ Pos = MAP_APPFONT( FT_POS, 111);
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Re~port";
+ Text[English]= "Report";
+ Text[ english_us ] = "Re~port";
+ Text[ portuguese ] = "~Relatório";
+ Text[ russian ] = "Îò÷åò";
+ Text[ greek ] = "ÁíáöïñÜ";
+ Text[ dutch ] = "~Reportage";
+ Text[ french ] = "Rapport";
+ Text[ spanish ] = "I~nforme";
+ Text[ italian ] = "Relazione";
+ Text[ danish ] = "Rapport";
+ Text[ swedish ] = "Rapport";
+ Text[ polish ] = "Raport";
+ Text[ portuguese_brazilian ] = "Report";
+ Text[ japanese ] = "ÚÎß°Ä(~P)";
+ Text[ korean ] = "¸®Æ÷Æ®(~P)";
+ Text[ chinese_simplified ] = "±¨¸æ(~P)";
+ Text[ chinese_traditional ] = "³ø§i(~P)";
+ Text[ arabic ] = "ÊÞÑíÑ";
+ Text[ turkish ] = "Rapor";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_MONTH
+ {
+ Pos = MAP_APPFONT( FT_POS_MIDDLE, 111 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "~Monat";
+ Text[English]= "Month";
+ Text[ english_us ] = "~Month";
+ Text[ portuguese ] = "~Mês";
+ Text[ russian ] = "Ìåñÿö";
+ Text[ greek ] = "ÌÞíáò";
+ Text[ dutch ] = "~Maand";
+ Text[ french ] = "~Mois";
+ Text[ spanish ] = "~Mes";
+ Text[ italian ] = "~Mese";
+ Text[ danish ] = "Måned";
+ Text[ swedish ] = "Månad";
+ Text[ polish ] = "Miesi¹c";
+ Text[ portuguese_brazilian ] = "Month";
+ Text[ japanese ] = "ŒŽ(~M)";
+ Text[ korean ] = "¿ù(~M)";
+ Text[ chinese_simplified ] = "ÔÂ(~M)";
+ Text[ chinese_traditional ] = "¤ë(~M)";
+ Text[ arabic ] = "";
+ Text[ turkish ] = "Ay";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_JOURNAL
+ {
+ Pos = MAP_APPFONT( FT_POS, 132 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Zeitschri~ft";
+ Text[English]= "Journal";
+ Text[ english_us ] = "~Journal";
+ Text[ portuguese ] = "~Revista";
+ Text[ russian ] = "Æóðíàë";
+ Text[ greek ] = "Ðåñéïäéêü";
+ Text[ dutch ] = "~Tijdschrift";
+ Text[ french ] = "~Journal";
+ Text[ spanish ] = "~Revista";
+ Text[ italian ] = "Rivista";
+ Text[ danish ] = "Tidsskrift";
+ Text[ swedish ] = "Tidskrift";
+ Text[ polish ] = "Czasopismo";
+ Text[ portuguese_brazilian ] = "Journal";
+ Text[ japanese ] = "ŽGŽ(~J)";
+ Text[ korean ] = "ÀâÁö(~J)";
+ Text[ chinese_simplified ] = "ÔÓÖ¾(~J)";
+ Text[ chinese_traditional ] = "Âø»x(~J)";
+ Text[ arabic ] = "ãÌáÉ";
+ Text[ turkish ] = "Dergi";
+ Text[ language_user1 ] = " ";
+ };
+
+ FixedText FT_NUMBER
+ {
+ Pos = MAP_APPFONT( FT_POS_MIDDLE, 132 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Numm~er";
+ Text[English]= "Number";
+ Text[ english_us ] = "Numb~er";
+ Text[ portuguese ] = "Núm~ero";
+ Text[ russian ] = "Íîìåð";
+ Text[ greek ] = "Áñéèìüò";
+ Text[ dutch ] = "~Nummer";
+ Text[ french ] = "Nu~méro";
+ Text[ spanish ] = "~Número";
+ Text[ italian ] = "Num~ero";
+ Text[ danish ] = "Nummer";
+ Text[ swedish ] = "Nummer";
+ Text[ polish ] = "Numer";
+ Text[ portuguese_brazilian ] = "Number";
+ Text[ japanese ] = "”Ô†(~E)";
+ Text[ korean ] = "¹øÈ£(~E)";
+ Text[ chinese_simplified ] = "񅧏(~E)";
+ Text[ chinese_traditional ] = "¸¹(~E)";
+ Text[ arabic ] = "ÑÞã";
+ Text[ language_user1 ] = "\"Sayý\" burada istisna (dergi için)";
+ Text[ turkish ] = "Sayý";
+ };
+ FixedText FT_SERIES
+ {
+ Pos = MAP_APPFONT( FT_POS_RIGHT, 132 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Ser~ie";
+ Text[English]= "Series";
+ Text[ english_us ] = "Se~ries";
+ Text[ portuguese ] = "~Série";
+ Text[ russian ] = "Ñåðèÿ";
+ Text[ greek ] = "ÓåéñÜ";
+ Text[ dutch ] = "~Serie";
+ Text[ french ] = "Sér~ie";
+ Text[ spanish ] = "~Serie";
+ Text[ italian ] = "Ser~ie";
+ Text[ danish ] = "Serie";
+ Text[ swedish ] = "Serie";
+ Text[ polish ] = "Seria";
+ Text[ portuguese_brazilian ] = "Series";
+ Text[ japanese ] = "‘p‘(~R)";
+ Text[ korean ] = "½Ã¸®Áî(~R)";
+ Text[ chinese_simplified ] = "ϵÁÐ(~R)";
+ Text[ chinese_traditional ] = "¨t¦C(~R)";
+ Text[ arabic ] = "ÓáÓáÉ";
+ Text[ turkish ] = "Dizi";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_ANNOTE
+ {
+ Pos = MAP_APPFONT( FT_POS, 146 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "A~nmerkung";
+ Text[English]= "Annotation";
+ Text[ english_us ] = "Ann~otation";
+ Text[ portuguese ] = "A~notações";
+ Text[ russian ] = "Ïðèìå÷àíèå";
+ Text[ greek ] = "ÐáñáôÞñçóç";
+ Text[ dutch ] = "~Commentaar";
+ Text[ french ] = "Ann~otation";
+ Text[ spanish ] = "A~notación";
+ Text[ italian ] = "A~nnotazione";
+ Text[ danish ] = "Anmærkning";
+ Text[ swedish ] = "Anmärkning";
+ Text[ polish ] = "Adnotacja";
+ Text[ portuguese_brazilian ] = "Annotation";
+ Text[ japanese ] = "”õl(~O)";
+ Text[ korean ] = "ÁÖ¼®(~O)";
+ Text[ chinese_simplified ] = "˵Ã÷(~O)";
+ Text[ chinese_traditional ] = "³Æª`(~O)";
+ Text[ arabic ] = "ÊÚáíÞ ÊæÖíÍí";
+ Text[ turkish ] = "Açýklama";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_NOTE
+ {
+ Pos = MAP_APPFONT( FT_POS_MIDDLE, 146 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Noti~z";
+ Text[English]= "Note";
+ Text[ english_us ] = "~Note";
+ Text[ portuguese ] = "~Anotação";
+ Text[ russian ] = "Ïðèìå÷àíèå";
+ Text[ greek ] = "Óçìåßùóç";
+ Text[ dutch ] = "~Aantekening";
+ Text[ french ] = "N~ote";
+ Text[ spanish ] = "~Nota";
+ Text[ italian ] = "Nota";
+ Text[ danish ] = "Note";
+ Text[ swedish ] = "Anteckning";
+ Text[ polish ] = "Notatka";
+ Text[ portuguese_brazilian ] = "Note";
+ Text[ japanese ] = "ÒÓ(~N)";
+ Text[ korean ] = "¸Þ¸ð(~N)";
+ Text[ chinese_simplified ] = "±¸×¢(~N)";
+ Text[ chinese_traditional ] = "µ§°O(~N)";
+ Text[ arabic ] = "ãáÇÍÙÉ";
+ Text[ turkish ] = "Not";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_URL
+ {
+ Pos = MAP_APPFONT( FT_POS_RIGHT, 146 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "URL";
+ Text[English]= "URL";
+ Text[ english_us ] = "URL";
+ Text[ portuguese ] = "URL";
+ Text[ russian ] = "URL";
+ Text[ greek ] = "URL";
+ Text[ dutch ] = "URL";
+ Text[ french ] = "URL";
+ Text[ spanish ] = "URL";
+ Text[ italian ] = "URL";
+ Text[ danish ] = "URL";
+ Text[ swedish ] = "URL";
+ Text[ polish ] = "URL";
+ Text[ portuguese_brazilian ] = "URL";
+ Text[ japanese ] = "URL";
+ Text[ korean ] = "URL";
+ Text[ chinese_simplified ] = "URL";
+ Text[ chinese_traditional ] = "URL";
+ Text[ arabic ] = "URL";
+ Text[ turkish ] = "URL";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_CUSTOM1
+ {
+ Pos = MAP_APPFONT( FT_POS, 167 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Benutzerfeld ~1";
+ Text[English]= "Custom field 1";
+ Text[ english_us ] = "User-defined field ~1";
+ Text[ portuguese ] = "Campo personalizado ~1";
+ Text[ russian ] = "Ïîëå ïîëüçîâàòåëÿ 1";
+ Text[ greek ] = "Ðåäßï ÷ñÞóôç 1";
+ Text[ dutch ] = "Gebruikerveld ~1";
+ Text[ french ] = "Champ d'utilisateur ~1";
+ Text[ spanish ] = "Campo de usuario ~1";
+ Text[ italian ] = "Campo utente ~1";
+ Text[ danish ] = "Brugerdefineret ~1";
+ Text[ swedish ] = "Användarfält 1";
+ Text[ polish ] = "Pole u¿ytkownika ~1";
+ Text[ portuguese_brazilian ] = "Custom field 1";
+ Text[ japanese ] = "Õ°»Þ°Ì¨°ÙÄÞ 1";
+ Text[ korean ] = "»ç¿ëÀÚÇʵå1(~ 1)";
+ Text[ chinese_simplified ] = "Óû§À¸ 1";
+ Text[ chinese_traditional ] = "¦Û­qÄæ¦ì ~1";
+ Text[ arabic ] = "ÍÞá ÇáãÓÊÎÏã 1";
+ Text[ turkish ] = "Kullanýcý alaný ~1";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_CUSTOM2
+ {
+ Pos = MAP_APPFONT( FT_POS_MIDDLE, 167 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Benutzerfeld ~2";
+ Text[English]= "Custom field 2";
+ Text[ english_us ] = "User-defined field ~2";
+ Text[ portuguese ] = "Campo personalizado ~2";
+ Text[ russian ] = "Ïîëå ïîëüçîâàòåëÿ 2";
+ Text[ greek ] = "Ðåäßï ÷ñÞóôç 2";
+ Text[ dutch ] = "Gebruikerveld ~2";
+ Text[ french ] = "Champ d'utilisateur ~2";
+ Text[ spanish ] = "Campo de usuario ~2";
+ Text[ italian ] = "Campo utente ~2";
+ Text[ danish ] = "Brugerdefineret ~2";
+ Text[ swedish ] = "Användarfält 2";
+ Text[ polish ] = "Pole u¿ytkownika ~2";
+ Text[ portuguese_brazilian ] = "Custom field 2";
+ Text[ japanese ] = "Õ°»Þ°Ì¨°ÙÄÞ 2";
+ Text[ korean ] = "»ç¿ëÀÚÇʵå 2(~2)";
+ Text[ chinese_simplified ] = "Óû§À¸ 2";
+ Text[ chinese_traditional ] = "¦Û­qÄæ¦ì ~2";
+ Text[ arabic ] = "ÍÞá ÇáãÓÊÎÏã 2";
+ Text[ turkish ] = "Kullanýcý alaný ~2";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_CUSTOM3
+ {
+ Pos = MAP_APPFONT( FT_POS_RIGHT, 167 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Benutzerfeld ~3";
+ Text[English]= "Custom field 3";
+ Text[ english_us ] = "User-defined field ~3";
+ Text[ portuguese ] = "Campo personalizado ~3";
+ Text[ russian ] = "Ïîëå ïîëüçîâàòåëÿ 3";
+ Text[ greek ] = "Ðåäßï ÷ñÞóôç 3";
+ Text[ dutch ] = "Gebruikerveld ~3";
+ Text[ french ] = "Champ d'utilisateur ~3";
+ Text[ spanish ] = "Campo de usuario ~3";
+ Text[ italian ] = "Campo utente ~3";
+ Text[ danish ] = "Brugerdefineret ~3";
+ Text[ swedish ] = "Användarfält 3";
+ Text[ polish ] = "Pole u¿ytkownika ~3";
+ Text[ portuguese_brazilian ] = "Custom field 3";
+ Text[ japanese ] = "Õ°»Þ°Ì¨°ÙÄÞ 3";
+ Text[ korean ] = "»ç¿ëÀÚÇʵå 3(~3)";
+ Text[ chinese_simplified ] = "Óû§À¸ 3";
+ Text[ chinese_traditional ] = "¦Û­qÄæ¦ì ~3";
+ Text[ arabic ] = "ÍÞá ÇáãÓÊÎÏã 3";
+ Text[ turkish ] = "Kullanýcý alaný ~3";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_CUSTOM4
+ {
+ Pos = MAP_APPFONT( FT_POS, 181 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Benutzerfeld ~4";
+ Text[English]= "Custom field 4";
+ Text[ english_us ] = "User-defined field ~4";
+ Text[ portuguese ] = "Campo personalizado ~4";
+ Text[ russian ] = "Ïîëå ïîëüçîâàòåëÿ 4";
+ Text[ greek ] = "Ðåäßï ÷ñÞóôç 4";
+ Text[ dutch ] = "Gebruikerveld ~4";
+ Text[ french ] = "Champ d'utilisateur ~4";
+ Text[ spanish ] = "Campo de usuario ~4";
+ Text[ italian ] = "Campo utente ~4";
+ Text[ danish ] = "Brugerdefineret ~4";
+ Text[ swedish ] = "Användarfält 4";
+ Text[ polish ] = "Pole u¿ytkownika ~4";
+ Text[ portuguese_brazilian ] = "Custom field 4";
+ Text[ japanese ] = "Õ°»Þ°Ì¨°ÙÄÞ 4";
+ Text[ korean ] = "»ç¿ëÀÚÇʵå 4(~4)";
+ Text[ chinese_simplified ] = "Óû§À¸ 4";
+ Text[ chinese_traditional ] = "¦Û­qÄæ¦ì ~4";
+ Text[ arabic ] = "ÍÞá ÇáãÓÊÎÏã 4";
+ Text[ turkish ] = "Kullanýcý alaný ~4";
+ Text[ language_user1 ] = " ";
+ };
+ FixedText FT_CUSTOM5
+ {
+ Pos = MAP_APPFONT( FT_POS_MIDDLE, 181 );
+ Size = MAP_APPFONT( FTSIZE_LEFT, 10 );
+ Text = "Benutzerfeld ~5";
+ Text[English]= "Custom field 5";
+ Text[ english_us ] = "User-defined field ~5";
+ Text[ portuguese ] = "Campo personalizado ~5";
+ Text[ russian ] = "Ïîëå ïîëüçîâàòåëÿ 5";
+ Text[ greek ] = "Ðåäßï ÷ñÞóôç 5";
+ Text[ dutch ] = "Gebruikerveld ~5";
+ Text[ french ] = "Champ d'utilisateur ~5";
+ Text[ spanish ] = "Campo de usuario ~5";
+ Text[ italian ] = "Campo utente ~5";
+ Text[ danish ] = "Brugerdefineret ~5";
+ Text[ swedish ] = "Användarfält 5";
+ Text[ polish ] = "Pole u¿ytkownika ~5";
+ Text[ portuguese_brazilian ] = "Custom field 5";
+ Text[ japanese ] = "Õ°»Þ°Ì¨°ÙÄÞ 5";
+ Text[ korean ] = "»ç¿ëÀÚÇʵå 5(~5)";
+ Text[ chinese_simplified ] = "Óû§À¸ 5";
+ Text[ chinese_traditional ] = "¦Û­qÄæ¦ì ~5";
+ Text[ arabic ] = "ÍÞá ÇáãÓÊÎÏã 5";
+ Text[ turkish ] = "Kullanýcý alaný ~5";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_ERROR_PREFIX
+ {
+ Text = "Die folgenden Spaltennamen konnten nicht zugeordnet werden:\n" ;
+ Text [ English ] = "The following column names could not be assigned:\n" ;
+ Text[ english_us ] = "The following column names could not be assigned:\n";
+ Text[ portuguese ] = "Foi impossível atribuir os seguintes nomes de coluna:\n";
+ Text[ russian ] = "Ñëåäóþùèå èìåíà êîëîíîê êëàññèôèöèðîâàòü íå óäàëîñü:\n";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá ãßíåé áíôéóôïß÷éóç ôïõ áêüëïõèïõ ïíüìáôïò óôÞëçò:\n";
+ Text[ dutch ] = "De volgende kolomnaam kon niet worden toegewezen:\n";
+ Text[ french ] = "Impossible d'assigner les noms de colonnes :\n";
+ Text[ spanish ] = "No se pudieron asignar los siguientes nombres de columnas:\n";
+ Text[ italian ] = "Non è stato possibile assegnare i nomi seguenti delle colonne:\n";
+ Text[ danish ] = "Det var ikke muligt at tildele de følgende kolonnenavne:\n";
+ Text[ swedish ] = "Följande kolumnnamn kunde inte tilldelas:\n";
+ Text[ polish ] = "Nie mo¿na by³o przypisaæ nastêpuj¹cej nazwy kolumny:\n";
+ Text[ portuguese_brazilian ] = "The following column names could not be assigned:\n";
+ Text[ japanese ] = "ˆÈ‰º‚Ì—ñ–¼‚Í•ª—Þ‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½:\n";
+ Text[ korean ] = "´ÙÀ½°ú °°Àº ´Ü¸íĪÀº ÁöÁ¤µÉ ¼ö ¾ø½À´Ï´Ù :\n";
+ Text[ chinese_simplified ] = "ÎÞ·¨±àÅÅÒÔÏÂÁÐÃû³Æ£º\n";
+ Text[ chinese_traditional ] = "µLªk«ü©w¤U¦CÄæ¦W¡G\n";
+ Text[ arabic ] = "ÊÚÐÑ ÊÚííä ÃÓãÇÁ ÇáÃÚãÏÉ ÇáÊÇáíÉ:\n";
+ Text[ turkish ] = "Þu sütun adlarý atanamadý:\n";
+ };
+ String ST_TYPE_ARTICLE
+ {
+ Text = "Artikel" ;
+ Text [ English ] = "Article" ;
+ Text[ english_us ] = "Article";
+ Text[ portuguese ] = "Artigo";
+ Text[ russian ] = "Ñòàòüÿ";
+ Text[ greek ] = "¢ñèñï";
+ Text[ dutch ] = "Artikel";
+ Text[ french ] = "Article";
+ Text[ spanish ] = "Artículo";
+ Text[ italian ] = "Articolo";
+ Text[ danish ] = "Artikel";
+ Text[ swedish ] = "Artikel";
+ Text[ polish ] = "Artyku³";
+ Text[ portuguese_brazilian ] = "Article";
+ Text[ japanese ] = "±°Ã¨¸Ù";
+ Text[ korean ] = "Ç׸ñ";
+ Text[ chinese_simplified ] = "ÎÄÕÂ";
+ Text[ chinese_traditional ] = "¤å³¹";
+ Text[ arabic ] = "ãÞÇáÉ";
+ Text[ turkish ] = "Makale";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_BOOK
+ {
+ Text = "Buch" ;
+ Text [ English ] = "Book" ;
+ Text[ english_us ] = "Book";
+ Text[ portuguese ] = "Livro";
+ Text[ russian ] = "Êíèãà";
+ Text[ greek ] = "Âéâëßï";
+ Text[ dutch ] = "Boek";
+ Text[ french ] = "Livre";
+ Text[ spanish ] = "Libro";
+ Text[ italian ] = "Libro";
+ Text[ danish ] = "Bog";
+ Text[ swedish ] = "Bok";
+ Text[ polish ] = "Ksi¹¿ka";
+ Text[ portuguese_brazilian ] = "Book";
+ Text[ japanese ] = "–{";
+ Text[ korean ] = "Ã¥";
+ Text[ chinese_simplified ] = "Êé¼®";
+ Text[ chinese_traditional ] = "®ÑÄy";
+ Text[ arabic ] = "ßÊÇÈ";
+ Text[ turkish ] = "Kitap";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_BOOKLET
+ {
+ Text = "Broschüre" ;
+ Text [ English ] = "Booklet" ;
+ Text[ english_us ] = "Brochures";
+ Text[ portuguese ] = "Brochura";
+ Text[ russian ] = "Áðîøþðà";
+ Text[ greek ] = "Ìðñïóïýñá";
+ Text[ dutch ] = "Brochure";
+ Text[ french ] = "Brochure";
+ Text[ spanish ] = "Folleto";
+ Text[ italian ] = "Dépliant";
+ Text[ danish ] = "Brochure";
+ Text[ swedish ] = "Broschyr";
+ Text[ polish ] = "Broszura";
+ Text[ portuguese_brazilian ] = "Booklet";
+ Text[ japanese ] = "ÊßÝÌÚ¯Ä";
+ Text[ korean ] = "¾È³»Ã¥ÀÚ";
+ Text[ chinese_simplified ] = "С²á×Ó";
+ Text[ chinese_traditional ] = "¤p¤â¥U";
+ Text[ arabic ] = "ßÊíÈ";
+ Text[ turkish ] = "Broþür";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_CONFERENCE
+ {
+ Text = "Konferenzbericht" ;
+ Text [ English ] = "Conference report" ;
+ Text[ english_us ] = "Conference report";
+ Text[ portuguese ] = "Relatório sobre conferência";
+ Text[ russian ] = "Îò÷åò î êîíôåðåíöèè";
+ Text[ greek ] = "ÁíáöïñÜ óýóêåøçò";
+ Text[ dutch ] = "Conferentiebericht";
+ Text[ french ] = "Rapport de conférence";
+ Text[ spanish ] = "Informe de conferencia";
+ Text[ italian ] = "Rapporto sulla conferenza";
+ Text[ danish ] = "Konferencerapport";
+ Text[ swedish ] = "Konferensrapport";
+ Text[ polish ] = "Sprawozdanie z konferencji";
+ Text[ portuguese_brazilian ] = "Conference report";
+ Text[ japanese ] = "‰ï‹c•ñ";
+ Text[ korean ] = "ȸÀǺ¸°í¼­";
+ Text[ chinese_simplified ] = "ÌÖÂۻᱨ¸æ";
+ Text[ chinese_traditional ] = "·|½Í³ø§i";
+ Text[ arabic ] = "ÊÞÑíÑ Úä ãÄÊãÑ";
+ Text[ turkish ] = "Toplantý tutanaðý";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_INBOOK
+ {
+ Text = "Buchauszug" ;
+ Text [ English ] = "Book excerpt" ;
+ Text[ english_us ] = "Book excerpt";
+ Text[ portuguese ] = "Excerto de livro";
+ Text[ russian ] = "Öèòàòà èç êíèãè";
+ Text[ greek ] = "Áðüóðáóìá âéâëßïõ";
+ Text[ dutch ] = "Uittreksel";
+ Text[ french ] = "Extrait de livre";
+ Text[ spanish ] = "Extracto de libro";
+ Text[ italian ] = "Brano";
+ Text[ danish ] = "Boguddrag";
+ Text[ swedish ] = "Bokutdrag";
+ Text[ polish ] = "Wyci¹g z ksi¹¿ki";
+ Text[ portuguese_brazilian ] = "Book excerpt";
+ Text[ japanese ] = "–{‚Ì”²ˆ";
+ Text[ korean ] = "Ã¥ ¹ßÃé";
+ Text[ chinese_simplified ] = "Ê鼮ժ¼ÎÄ";
+ Text[ chinese_traditional ] = "®ÑÄy¤å³¹ºK­n";
+ Text[ arabic ] = "ãÞÊÈÓÇÊ ãä ßÊÇÈ";
+ Text[ turkish ] = "Kitap özeti";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_INCOLLECTION
+ {
+ Text = "Buchauszug mit Titel" ;
+ Text [ English ] = "Book excerpt with title" ;
+ Text[ english_us ] = "Book excerpt with title";
+ Text[ portuguese ] = "Excerto de livro com título";
+ Text[ russian ] = "Âûäåðæêà èç êíèãè ñ çàãîëîâêîì";
+ Text[ greek ] = "Áðüóðáóìá âéâëßïõ ìå ôßôëï";
+ Text[ dutch ] = "Uittreksel met titel";
+ Text[ french ] = "Extrait de livre avec titre";
+ Text[ spanish ] = "Extracto de libro con título";
+ Text[ italian ] = "Brano con titolo";
+ Text[ danish ] = "Boguddrag med titel";
+ Text[ swedish ] = "Bokutdrag med titel";
+ Text[ polish ] = "Wyci¹g z ksi¹¿ki z tytu³em";
+ Text[ portuguese_brazilian ] = "Book excerpt with title";
+ Text[ japanese ] = "–{‚Ì”²ˆi‘–¼•t‚«j";
+ Text[ korean ] = "Á¦¸ñÀÌ Àִ å ¹ßÃé";
+ Text[ chinese_simplified ] = "×¢Ã÷±êÌâµÄÊ鼮ժ¼ÎÄ";
+ Text[ chinese_traditional ] = "§t¦³¼ÐÃDªº®ÑÄy¤å³¹ºK­n";
+ Text[ arabic ] = "ãÞÊÈÓÇÊ ãä ßÊÇÈ ÐÇÊ ÚäæÇä";
+ Text[ turkish ] = "Baþlýklý kitap özeti";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_INPROCEEDINGS
+ {
+ Text = "Tagungsbericht" ;
+ Text [ English ] = "Conference proceedings";
+ Text[ english_us ] = "Conference proceedings";
+ Text[ portuguese ] = "Relatório de congresso";
+ Text[ russian ] = "Îò÷åò î çàñåäàíèè";
+ Text[ greek ] = "Ðñùôüêïëëï óõíåäñßáóçò";
+ Text[ dutch ] = "Conferentiebericht";
+ Text[ french ] = "Rapport de congrès";
+ Text[ spanish ] = "Informe de congreso";
+ Text[ italian ] = "Rapporto sulla conferenza";
+ Text[ danish ] = "Kongresberetning";
+ Text[ swedish ] = "Konferensrapport";
+ Text[ polish ] = "Sprawozdanie z obrady";
+ Text[ portuguese_brazilian ] = "Conference proceedings";
+ Text[ japanese ] = "‰ï•ñ";
+ Text[ korean ] = "ȸÀÇ·Ï";
+ Text[ chinese_simplified ] = "»áÒ鱨¸æ";
+ Text[ chinese_traditional ] = "·|ij³ø§i";
+ Text[ arabic ] = "ÈÑæÊæßæá ÇÌÊãÇÚ";
+ Text[ turkish ] = "Konferans raporu";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_JOURNAL
+ {
+ Text = "Zeitschrift" ;
+ Text [ English ] = "Journal" ;
+ Text[ english_us ] = "Journal";
+ Text[ portuguese ] = "Revista";
+ Text[ russian ] = "Æóðíàë";
+ Text[ greek ] = "Ðåñéïäéêü";
+ Text[ dutch ] = "Tijdschrift";
+ Text[ french ] = "Revue";
+ Text[ spanish ] = "Revista";
+ Text[ italian ] = "Rivista";
+ Text[ danish ] = "Tidsskrift";
+ Text[ swedish ] = "Tidskrift";
+ Text[ polish ] = "Czasopismo";
+ Text[ portuguese_brazilian ] = "Journal";
+ Text[ japanese ] = "ŽGŽ";
+ Text[ korean ] = "ÀâÁö";
+ Text[ chinese_simplified ] = "ÔÓÖ¾";
+ Text[ chinese_traditional ] = "Âø»x";
+ Text[ arabic ] = "ãÌáÉ";
+ Text[ turkish ] = "Dergi";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_MANUAL
+ {
+ Text = "Techn. Dokumentation" ;
+ Text [ English ] = "Manual" ;
+ Text[ english_us ] = "Manual";
+ Text[ portuguese ] = "Documentação técnica";
+ Text[ russian ] = "Òåõíè÷åñêàÿ äîêóìåíòàöèÿ";
+ Text[ greek ] = "Eã÷åéñßäéï";
+ Text[ dutch ] = "Techn. documentatie";
+ Text[ french ] = "Documentation technique";
+ Text[ spanish ] = "Documentación técnica";
+ Text[ italian ] = "Documentazione tec.";
+ Text[ danish ] = "Teknisk dokumentation";
+ Text[ swedish ] = "Manual";
+ Text[ polish ] = "Dokumentacja techn.";
+ Text[ portuguese_brazilian ] = "Manual";
+ Text[ japanese ] = "ÏÆ­±Ù";
+ Text[ korean ] = "¸Å´º¾ó";
+ Text[ chinese_simplified ] = "¼¼ÊõÎÄÏ×";
+ Text[ chinese_traditional ] = "§Þ³N»¡©ú®Ñ";
+ Text[ arabic ] = "Ïáíá ÇÓÊÎÏÇã";
+ Text[ turkish ] = "Teknik dokümantasyon";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_MASTERSTHESIS
+ {
+ Text = "Diplomarbeit" ;
+ Text [ English ] = "Thesis" ;
+ Text[ english_us ] = "Thesis";
+ Text[ portuguese ] = "Tese";
+ Text[ russian ] = "Äèïëîìíàÿ ðàáîòà";
+ Text[ greek ] = "ÄéðëùìáôéêÞ åñãáóßá";
+ Text[ dutch ] = "Scriptie";
+ Text[ french ] = "Mémoire";
+ Text[ spanish ] = "Trabajo de diplomatura";
+ Text[ italian ] = "Tesi di laurea";
+ Text[ danish ] = "Eksamensopgave";
+ Text[ swedish ] = "Examensarbete";
+ Text[ polish ] = "Praca dyplomowa";
+ Text[ portuguese_brazilian ] = "Thesis";
+ Text[ japanese ] = "‘²‹Æ˜_•¶";
+ Text[ korean ] = "´ëÇÐÁ¹¾÷³í¹®";
+ Text[ chinese_simplified ] = "´óѧ±ÏÒµÂÛÎÄ";
+ Text[ chinese_traditional ] = "²¦·~½×¤å";
+ Text[ arabic ] = "ÑÓÇáÉ ãÇÌÓÊíÑ";
+ Text[ turkish ] = "Tez";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_MISC
+ {
+ Text = "Verschiedenes" ;
+ Text [ ENGLISH ] = "Miscellaneous" ;
+ Text[ english_us ] = "Miscellaneous";
+ Text[ portuguese ] = "Miscelânea";
+ Text[ russian ] = "Ïðî÷åå";
+ Text[ greek ] = "ÄéÜöïñá";
+ Text[ dutch ] = "Diverse";
+ Text[ french ] = "Divers";
+ Text[ spanish ] = "Diversos";
+ Text[ italian ] = "Varie";
+ Text[ danish ] = "Forskelligt";
+ Text[ swedish ] = "Diverse";
+ Text[ polish ] = "Ró¿ne";
+ Text[ portuguese_brazilian ] = "Miscellaneous";
+ Text[ japanese ] = "”õl";
+ Text[ korean ] = "¿©·¯ °¡Áö";
+ Text[ chinese_simplified ] = "ÆäËü";
+ Text[ chinese_traditional ] = "Âø¶µ";
+ Text[ arabic ] = "ãäæÚÇÊ";
+ Text[ turkish ] = "Diðer";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_PHDTHESIS
+ {
+ Text = "Dissertation" ;
+ Text [ ENGLISH ] = "Dissertation";
+ Text[ english_us ] = "Dissertation";
+ Text[ portuguese ] = "Dissertação";
+ Text[ russian ] = "Äèññåðòàöèÿ";
+ Text[ greek ] = "ÄéáôñéâÞ";
+ Text[ dutch ] = "Dissertatie";
+ Text[ french ] = "Thèse de doctorat";
+ Text[ spanish ] = "Tesis doctoral";
+ Text[ italian ] = "Dottorato di ricerca";
+ Text[ danish ] = "Doktorafhandling";
+ Text[ swedish ] = "Avhandling";
+ Text[ polish ] = "Praca doktorska";
+ Text[ portuguese_brazilian ] = "Dissertation";
+ Text[ japanese ] = "”ŽŽm˜_•¶";
+ Text[ korean ] = "¹Ú»çÇÐÀ§³í¹®";
+ Text[ chinese_simplified ] = "²©Ê¿ÂÛÎÄ";
+ Text[ chinese_traditional ] = "³Õ¤h½×¤å";
+ Text[ arabic ] = "ÑÓÇáÉ ÏßÊæÑÇå";
+ Text[ turkish ] = "Disertasyon";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_PROCEEDINGS
+ {
+ Text = "Tagungsbericht" ;
+ Text [ English ] = "Conference proceedings";
+ Text[ english_us ] = "Conference proceedings";
+ Text[ portuguese ] = "Relatório de congresso";
+ Text[ russian ] = "Îò÷åò î çàñåäàíèè";
+ Text[ greek ] = "Ðñùôüêïëëï óõíåäñßáóçò";
+ Text[ dutch ] = "Conferentiebericht";
+ Text[ french ] = "Rapport de congrès";
+ Text[ spanish ] = "Informe de congreso";
+ Text[ italian ] = "Rapporto sulla conferenza";
+ Text[ danish ] = "Kongresberetning";
+ Text[ swedish ] = "Konferensrapport";
+ Text[ polish ] = "Sprawozdanie z obrady";
+ Text[ portuguese_brazilian ] = "Conference proceedings";
+ Text[ japanese ] = "‰ï•ñ";
+ Text[ korean ] = "ȸÀÇ·Ï";
+ Text[ chinese_simplified ] = "»áÒ鱨¸æ";
+ Text[ chinese_traditional ] = "·|ij³ø§i";
+ Text[ arabic ] = "ÈÑæÊæßæá ÇÌÊãÇÚ";
+ Text[ turkish ] = "Konferans raporu";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_TECHREPORT
+ {
+ Text = "Forschungsbericht" ;
+ Text [ English ] = "Research report";
+ Text[ english_us ] = "Research report";
+ Text[ portuguese ] = "Relatório de investigação";
+ Text[ russian ] = "Îò÷åò î íàó÷íîì èññëåäîâàíèè";
+ Text[ greek ] = "ÁíáöïñÜ Ýñåõíáò";
+ Text[ dutch ] = "Onderzoeksbericht";
+ Text[ french ] = "Rapport de recherche";
+ Text[ spanish ] = "Informe de investigación";
+ Text[ italian ] = "Rapporto di ricerca";
+ Text[ danish ] = "Forskningsrapport";
+ Text[ swedish ] = "Forskningsrapport";
+ Text[ polish ] = "Sprawozdanie z badania naukow.";
+ Text[ portuguese_brazilian ] = "Research report";
+ Text[ japanese ] = "Œ¤‹†•ñ";
+ Text[ korean ] = "¿¬±¸º¸°í¼­";
+ Text[ chinese_simplified ] = "¿ÆÑб¨¸æ";
+ Text[ chinese_traditional ] = "¬ã¨s³ø§i";
+ Text[ arabic ] = "ÊÞÑíÑ Úä ÚãáíÉ ÇáÈÍË";
+ Text[ turkish ] = "Araþtýrma raporu";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_UNPUBLISHED
+ {
+ Text = "Unveröffentlicht" ;
+ Text [ ENGLISH ] = "Unpublished" ;
+ Text[ english_us ] = "Unpublished";
+ Text[ portuguese ] = "Inédito";
+ Text[ russian ] = "Íå îïóáëèêîâàíî";
+ Text[ greek ] = "Áäçìïóßåõôï";
+ Text[ dutch ] = "Niet gepubliceerd";
+ Text[ french ] = "Non publié";
+ Text[ spanish ] = "Inédito";
+ Text[ italian ] = "Non pubblicato";
+ Text[ danish ] = "Ikke offentliggjort";
+ Text[ swedish ] = "Opublicerad";
+ Text[ polish ] = "Nieopublikowane";
+ Text[ portuguese_brazilian ] = "Unpublished";
+ Text[ japanese ] = "–¢”­•\\";
+ Text[ korean ] = "ºñ°ø°³";
+ Text[ chinese_simplified ] = "ÉÐδ·¢±íµÄ";
+ Text[ chinese_traditional ] = "©|¥¼µoªí";
+ Text[ arabic ] = "áã íõäÔÑ ÈÚÏ";
+ Text[ turkish ] = "Yayýmlanmamýþ";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_EMAIL
+ {
+ Text = "e-Mail" ;
+ Text [ English ] = "e-mail" ;
+ Text[ english_us ] = "e-mail";
+ Text[ portuguese ] = "e-mail";
+ Text[ russian ] = "e-mail";
+ Text[ greek ] = "e-mail";
+ Text[ dutch ] = "e-mail";
+ Text[ french ] = "E-mail";
+ Text[ spanish ] = "Mensaje electrónico";
+ Text[ italian ] = "eMail";
+ Text[ danish ] = "E-mail";
+ Text[ swedish ] = "e-post";
+ Text[ polish ] = "e-mail";
+ Text[ portuguese_brazilian ] = "e-mail";
+ Text[ japanese ] = "E-mail";
+ Text[ korean ] = "ÀüÀÚ¿ìÆí";
+ Text[ chinese_simplified ] = "µç×ÓÓʼþ";
+ Text[ chinese_traditional ] = "¹q¤l¶l¥ó";
+ Text[ arabic ] = "ÈÑíÏ ÅáßÊÑæäí";
+ Text[ turkish ] = "e-posta";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_WWW
+ {
+ Text = "WWW-Dokument" ;
+ Text [ ENGLISH ] = "WWW document" ;
+ Text[ english_us ] = "WWW document";
+ Text[ portuguese ] = "Documento WWW";
+ Text[ russian ] = "Äîêóìåíò WWW";
+ Text[ greek ] = "¸ããñáöï WWW";
+ Text[ dutch ] = "WWW document";
+ Text[ french ] = "Document WWW";
+ Text[ spanish ] = "Documento WWW";
+ Text[ italian ] = "Documento Web";
+ Text[ danish ] = "WWW-dokument";
+ Text[ swedish ] = "WWW-dokument";
+ Text[ polish ] = "Dokument WWW";
+ Text[ portuguese_brazilian ] = "WWW document";
+ Text[ japanese ] = "WWW ÄÞ·­ÒÝÄ";
+ Text[ korean ] = "WWW ¹®¼­";
+ Text[ chinese_simplified ] = "ÍòάÍøÎĵµ";
+ Text[ chinese_traditional ] = "WWW ¤å¥ó";
+ Text[ arabic ] = "ãÓÊäÏ æíÈ";
+ Text[ turkish ] = "WWW belgesi";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_CUSTOM1
+ {
+ Text = "Benutzertyp1" ;
+ Text [ English ] = "User-defined1";
+ Text[ english_us ] = "User-defined1";
+ Text[ portuguese ] = "Tipo personalizado1";
+ Text[ russian ] = "Òèï ïîëüçîâàòåëÿ1";
+ Text[ greek ] = "Ôýðïò ÷ñÞóôç1";
+ Text[ dutch ] = "Gebruikerstype1";
+ Text[ french ] = "Utilisateur1";
+ Text[ spanish ] = "Definido por usuario 1";
+ Text[ italian ] = "Utente1";
+ Text[ danish ] = "Brugerdefineret1";
+ Text[ swedish ] = "Användartyp1";
+ Text[ polish ] = "Typ u¿ytkownika1";
+ Text[ portuguese_brazilian ] = "User-defined1";
+ Text[ japanese ] = "Õ°»Þ°À²Ìß 1";
+ Text[ korean ] = "»ç¿ëÀÚÀ¯Çü1";
+ Text[ chinese_simplified ] = "Óû§ÀàÐÍ1";
+ Text[ chinese_traditional ] = "¦Û­qÃþ«¬ 1";
+ Text[ arabic ] = "ãõÚÑøóÝ ãä ÞÈá ÇáãÓÊÎÏã1";
+ Text[ turkish ] = "Kullanýcý tanýmlý1";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_CUSTOM2
+ {
+ Text = "Benutzertyp2" ;
+ Text [ English ] = "User-defined2";
+ Text[ english_us ] = "User-defined2";
+ Text[ portuguese ] = "Tipo personalizado2";
+ Text[ russian ] = "Òèï ïîëüçîâàòåëÿ2";
+ Text[ greek ] = "Ôýðïò ÷ñÞóôç2";
+ Text[ dutch ] = "Gebruikerstype2";
+ Text[ french ] = "Utilisateur2";
+ Text[ spanish ] = "Definido por usuario 2";
+ Text[ italian ] = "Utente2";
+ Text[ danish ] = "Brugerdefineret2";
+ Text[ swedish ] = "Användartyp2";
+ Text[ polish ] = "Typ u¿ytkownika2";
+ Text[ portuguese_brazilian ] = "User-defined2";
+ Text[ japanese ] = "¶½Àϲ½Þ2";
+ Text[ korean ] = "»ç¿ëÀÚÀ¯Çü2";
+ Text[ chinese_simplified ] = "Óû§ÀàÐÍ2";
+ Text[ chinese_traditional ] = "¦Û­qÃþ«¬ 2";
+ Text[ arabic ] = "ãõÚÑøóÝ ãä ÞÈá ÇáãÓÊÎÏã2";
+ Text[ turkish ] = "Kullanýcý tanýmlý2";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_CUSTOM3
+ {
+ Text = "Benutzertyp3" ;
+ Text [ English ] = "User-defined3";
+ Text[ english_us ] = "User-defined3";
+ Text[ portuguese ] = "Tipo personalizado3";
+ Text[ russian ] = "Òèï ïîëüçîâàòåëÿ3";
+ Text[ greek ] = "Ôýðïò ÷ñÞóôç3";
+ Text[ dutch ] = "Gebruikerstype3";
+ Text[ french ] = "Utilisateur3";
+ Text[ spanish ] = "Definido por usuario 3";
+ Text[ italian ] = "Utente3";
+ Text[ danish ] = "Brugerdefineret3";
+ Text[ swedish ] = "Användartyp3";
+ Text[ polish ] = "Typ u¿ytkownika3";
+ Text[ portuguese_brazilian ] = "User-defined3";
+ Text[ japanese ] = "¶½Àϲ½Þ3";
+ Text[ korean ] = "»ç¿ëÀÚÀ¯Çü3";
+ Text[ chinese_simplified ] = "Óû§ÀàÐÍ 3";
+ Text[ chinese_traditional ] = "¦Û­qÃþ«¬ 3";
+ Text[ arabic ] = "ãõÚÑøóÝ ãä ÞÈá ÇáãÓÊÎÏã3";
+ Text[ turkish ] = "Kullanýcý tanýmlý3";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_CUSTOM4
+ {
+ Text = "Benutzertyp4" ;
+ Text [ English ] = "User-defined4";
+ Text[ english_us ] = "User-defined4";
+ Text[ portuguese ] = "Tipo personalizado4";
+ Text[ russian ] = "Òèï ïîëüçîâàòåëÿ4";
+ Text[ greek ] = "Ôýðïò ÷ñÞóôç4";
+ Text[ dutch ] = "Gebruikerstype4";
+ Text[ french ] = "Utilisateur4";
+ Text[ spanish ] = "Definido por usuario 4";
+ Text[ italian ] = "Utente4";
+ Text[ danish ] = "Brugerdefineret4";
+ Text[ swedish ] = "Användartyp4";
+ Text[ polish ] = "Typ u¿ytkownika4";
+ Text[ portuguese_brazilian ] = "User-defined4";
+ Text[ japanese ] = "¶½Àϲ½Þ4";
+ Text[ korean ] = "»ç¿ëÀÚÀ¯Çü4";
+ Text[ chinese_simplified ] = "Óû§ÀàÐÍ 4";
+ Text[ chinese_traditional ] = "¦Û­qÃþ«¬ 4";
+ Text[ arabic ] = "ãõÚÑøóÝ ãä ÞÈá ÇáãÓÊÎÏã4";
+ Text[ turkish ] = "Kullanýcý tanýmlý4";
+ Text[ language_user1 ] = " ";
+ };
+ String ST_TYPE_CUSTOM5
+ {
+ Text = "Benutzertyp5" ;
+ Text [ English ] = "User-defined5";
+ Text[ english_us ] = "User-defined5";
+ Text[ portuguese ] = "Tipo personalizado5";
+ Text[ russian ] = "Òèï ïîëüçîâàòåëÿ5";
+ Text[ greek ] = "Ôýðïò ÷ñÞóôç5";
+ Text[ dutch ] = "Gebruikerstype5";
+ Text[ french ] = "Utilisateur5";
+ Text[ spanish ] = "Definido por usuario 5";
+ Text[ italian ] = "Utente5";
+ Text[ danish ] = "Brugerdefineret5";
+ Text[ swedish ] = "Användartyp5";
+ Text[ polish ] = "Typ u¿ytkownika5";
+ Text[ portuguese_brazilian ] = "User-defined5";
+ Text[ japanese ] = "¶½Àϲ½Þ5";
+ Text[ korean ] = "»ç¿ëÀÚÀ¯Çü5";
+ Text[ chinese_simplified ] = "Óû§ÀàÐÍ 5";
+ Text[ chinese_traditional ] = "¦Û­qÃþ«¬ 5";
+ Text[ arabic ] = "ãõÚÑøóÝ ãä ÞÈá ÇáãÓÊÎÏã5";
+ Text[ turkish ] = "Kullanýcý tanýmlý5";
+ Text[ language_user1 ] = " ";
+ };
+ Text[ english_us ] = "General";
+ Text[ portuguese ] = "Geral";
+ Text[ russian ] = "Îáùåå";
+ Text[ greek ] = "ÃåíéêÜ";
+ Text[ dutch ] = "Algemeen";
+ Text[ french ] = "Général";
+ Text[ spanish ] = "General";
+ Text[ italian ] = "Generale";
+ Text[ danish ] = "Generel";
+ Text[ swedish ] = "Allmän";
+ Text[ polish ] = "Ogólne";
+ Text[ portuguese_brazilian ] = "General";
+ Text[ japanese ] = "‘S”Ê";
+ Text[ korean ] = "ÀϹÝ";
+ Text[ chinese_simplified ] = "³£¹æ";
+ Text[ chinese_traditional ] = "¤@¯ë";
+ Text[ arabic ] = "ÚÇã";
+ Text[ turkish ] = "Genel";
+ Text[ language_user1 ] = " ";
+};
+Menu RID_POPUP_ME_VIEW
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Text = "Abschnitt einfügen..." ;
+ Text [ English ] = "Insert Section..." ;
+ Identifier = PU_INSERT;
+ Text[ english_us ] = "Insert Section...";
+ Text[ portuguese ] = "Inserir secção...";
+ Text[ russian ] = "Âñòàâèòü ðàçäåë...";
+ Text[ greek ] = "ÐñïóèÞêç ôìÞìáôïò...";
+ Text[ dutch ] = "Sectie invoegen...";
+ Text[ french ] = "Insérer une section...";
+ Text[ spanish ] = "Insertar sección...";
+ Text[ italian ] = "Inserisci sezione...";
+ Text[ danish ] = "Indsæt sektion...";
+ Text[ swedish ] = "Infoga avsnitt...";
+ Text[ polish ] = "Wstaw sekcjê...";
+ Text[ portuguese_brazilian ] = "Insert Section...";
+ Text[ japanese ] = "€–Ú‚Ì‘}“ü...";
+ Text[ korean ] = "¼½¼Ç »ðÀÔ...";
+ Text[ chinese_simplified ] = "²åÈë¶ÎÂä...";
+ Text[ chinese_traditional ] = "´¡¤J¬q¸¨...";
+ Text[ arabic ] = "ÅÏÑÇÌ äØÇÞ...";
+ Text[ turkish ] = "Bölüm ekle...";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Text = "Abschnitt löschen..." ;
+ Text [ English ] = "Remove Section..." ;
+ Identifier = PU_REMOVE;
+ Text[ english_us ] = "Delete Section...";
+ Text[ portuguese ] = "Eliminar secção...";
+ Text[ russian ] = "Óáðàòü ðàçäåë...";
+ Text[ greek ] = "ÄéáãñáöÞ ôìÞìáôïò...";
+ Text[ dutch ] = "Sectie wissen...";
+ Text[ french ] = "Supprimer une section...";
+ Text[ spanish ] = "Eliminar sección...";
+ Text[ italian ] = "Elimina sezione...";
+ Text[ danish ] = "Slet sektion...";
+ Text[ swedish ] = "Radera avsnitt...";
+ Text[ polish ] = "Usuñ sekcjê...";
+ Text[ portuguese_brazilian ] = "Remove Section...";
+ Text[ japanese ] = "€–Ú‚Ìíœ...";
+ Text[ korean ] = "¼½¼Ç »èÁ¦...";
+ Text[ chinese_simplified ] = "ɾ³ý¶ÎÂä...";
+ Text[ chinese_traditional ] = "§R°£¬q¸¨...";
+ Text[ arabic ] = "ÍÐÝ äØÇÞ...";
+ Text[ turkish ] = "Bölümü sil...";
+ Text[ language_user1 ] = " ";
+ };
+ MenuItem
+ {
+ Text = "Namen ändern..." ;
+ Text [ English ] = "Remove Address..." ;
+ Identifier = PU_CHG_NAME;
+ Text[ english_us ] = "Modify Name...";
+ Text[ portuguese ] = "Modificar nome...";
+ Text[ russian ] = "Èçìåíèòü èìåíà...";
+ Text[ greek ] = "ÁëëáãÞ ïíüìáôïò...";
+ Text[ dutch ] = "Adres wissen...";
+ Text[ french ] = "Corriger un nom...";
+ Text[ spanish ] = "Modificar nombre...";
+ Text[ italian ] = "Cambia indirizzo...";
+ Text[ danish ] = "Modificer navn...";
+ Text[ swedish ] = "Ändra namn...";
+ Text[ polish ] = "Modyfikuj nazwê...";
+ Text[ portuguese_brazilian ] = "Remove Address...";
+ Text[ japanese ] = "–¼‘O‚Ì•ÏX...";
+ Text[ korean ] = "ÁÖ¼Ò »èÁ¦...";
+ Text[ chinese_simplified ] = "¸ü¸ÄÃû³Æ...";
+ Text[ chinese_traditional ] = "Åܧó¦WºÙ...";
+ Text[ arabic ] = "ÊÚÏíá ÇÓã...";
+ Text[ turkish ] = "Adý deðiþtir...";
+ Text[ language_user1 ] = " ";
+ };
+ };
+};
diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx
new file mode 100644
index 000000000..a09612688
--- /dev/null
+++ b/extensions/source/bibliography/toolbar.cxx
@@ -0,0 +1,566 @@
+/*************************************************************************
+ *
+ * $RCSfile: toolbar.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <osl/mutex.hxx>
+#include <tools/urlobj.hxx>
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_
+#include <com/sun/star/frame/XDispatch.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
+#include <com/sun/star/util/XURLTransformer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#endif
+
+
+#include <svtools/iniprop.hxx>
+#include <svtools/iniman.hxx>
+
+#ifndef _TOOLS_DEBUG_HXX //autogen wg. DBG_ASSERT
+#include <tools/debug.hxx>
+#endif
+
+#include "bibbeam.hxx"
+#include "toolbar.hrc"
+#include "bibresid.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+#define C2U(cChar) OUString::createFromAscii(cChar)
+
+
+// Konstanten -------------------------------------------------------------
+
+
+BibToolBarListener::BibToolBarListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId):
+ pToolBar(pTB),
+ nIndex(nId),
+ aCommand(aStr)
+{
+}
+
+BibToolBarListener::~BibToolBarListener()
+{
+}
+
+void BibToolBarListener::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& rEvt)throw( ::com::sun::star::uno::RuntimeException )
+{
+ if(rEvt.FeatureURL.Complete == aCommand)
+ {
+ pToolBar->EnableItem(nIndex,rEvt.IsEnabled);
+
+ ::com::sun::star::uno::Any aState=rEvt.State;
+ if(aState.getValueType()==::getBooleanCppuType())
+ {
+ sal_Bool bChecked= *(sal_Bool*)aState.getValue();
+ pToolBar->CheckItem(nIndex, bChecked);
+ }
+
+ /*
+ rtl::OUString FeatureDescriptor;
+ sal_Bool Requery;
+ ::com::sun::star::uno::Any State;*/
+ }
+};
+
+sal_uInt16 BibToolBarListener::GetIndex()
+{
+ return nIndex;
+}
+void BibToolBarListener::SetIndex(sal_uInt16 nId)
+{
+ nIndex=nId;
+}
+
+rtl::OUString BibToolBarListener::GetCommand()
+{
+ return aCommand;
+}
+void BibToolBarListener::SetCommand(const rtl::OUString& aStr)
+{
+ aCommand=aStr;
+}
+
+BibTBListBoxListener::BibTBListBoxListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId):
+ BibToolBarListener(pTB,aStr,nId)
+{
+}
+
+BibTBListBoxListener::~BibTBListBoxListener()
+{
+}
+
+void BibTBListBoxListener::statusChanged(const ::com::sun::star::frame::FeatureStateEvent& rEvt)throw( ::com::sun::star::uno::RuntimeException )
+{
+ if(rEvt.FeatureURL.Complete == GetCommand())
+ {
+ pToolBar->EnableSourceList(rEvt.IsEnabled);
+
+ Any aState = rEvt.State;
+ if(aState.getValueType() == ::getCppuType((Sequence<rtl::OUString>*)0))
+ {
+ pToolBar->UpdateSourceList(sal_False);
+ pToolBar->ClearSourceList();
+
+ Sequence<rtl::OUString>* pStringSeq = (Sequence<rtl::OUString>*)aState.getValue();
+ const rtl::OUString* pStringArray = (const rtl::OUString*)pStringSeq->getConstArray();
+
+ sal_uInt32 nCount = pStringSeq->getLength();
+ XubString aEntry;
+ for( sal_uInt32 i=0; i<nCount; i++ )
+ {
+ aEntry = String(pStringArray[i]);
+ pToolBar->InsertSourceEntry(aEntry);
+ }
+ pToolBar->UpdateSourceList(sal_True);
+ }
+
+ XubString aStr = String(rEvt.FeatureDescriptor);
+ pToolBar->SelectSourceEntry(aStr);
+ }
+};
+
+BibTBQueryMenuListener::BibTBQueryMenuListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId):
+ BibToolBarListener(pTB,aStr,nId)
+{
+}
+
+BibTBQueryMenuListener::~BibTBQueryMenuListener()
+{
+}
+
+void BibTBQueryMenuListener::statusChanged(const frame::FeatureStateEvent& rEvt)throw( uno::RuntimeException )
+{
+ if(rEvt.FeatureURL.Complete == GetCommand())
+ {
+ pToolBar->EnableSourceList(rEvt.IsEnabled);
+
+ uno::Any aState=rEvt.State;
+ if(aState.getValueType()==::getCppuType((Sequence<rtl::OUString>*)0))
+ {
+ pToolBar->ClearFilterMenu();
+
+ Sequence<rtl::OUString>* pStringSeq = (Sequence<rtl::OUString>*) aState.getValue();
+ const rtl::OUString* pStringArray = (const rtl::OUString*)pStringSeq->getConstArray();
+
+ sal_uInt32 nCount = pStringSeq->getLength();
+ for( sal_uInt32 i=0; i<nCount; i++ )
+ {
+ sal_uInt16 nID=pToolBar->InsertFilterItem(String(pStringArray[i]));
+ if(pStringArray[i]==rEvt.FeatureDescriptor)
+ {
+// XubString aStr = rEvt.FeatureDescriptor;
+ pToolBar->SelectFilterItem(nID);
+ }
+ }
+ }
+ }
+};
+
+BibTBEditListener::BibTBEditListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId):
+ BibToolBarListener(pTB,aStr,nId)
+{
+}
+
+BibTBEditListener::~BibTBEditListener()
+{
+}
+
+void BibTBEditListener::statusChanged(const frame::FeatureStateEvent& rEvt)throw( uno::RuntimeException )
+{
+ if(rEvt.FeatureURL.Complete == GetCommand())
+ {
+ pToolBar->EnableQuery(rEvt.IsEnabled);
+
+ uno::Any aState=rEvt.State;
+ if(aState.getValueType()==::getCppuType((const OUString*)0))
+ {
+ String aStr = String(*(OUString*) aState.getValue());
+ pToolBar->SetQueryString(aStr);
+ }
+ }
+}
+
+SV_IMPL_PTRARR( BibToolBarListenerArr, BibToolBarListenerPtr);
+
+BibToolBar::BibToolBar(Window* pParent, WinBits nStyle):
+ ToolBox(pParent,BibResId(RID_BIB_TOOLBAR)),
+ aFtSource(this,WB_VCENTER),
+ aLBSource(this,WB_DROPDOWN),
+ aFtQuery(this,WB_VCENTER),
+ aEdQuery(this),
+ nSelMenuItem(0),
+ nMenuId(0)
+{
+ SetStyle(GetStyle()|nStyle);
+ SetOutStyle(TOOLBOX_STYLE_FLAT);
+ Size aSize=GetSizePixel();
+ Size a2Size(GetOutputSizePixel());
+ a2Size.Width()=100;
+ aLBSource.SetSizePixel(a2Size);
+ aLBSource.SetDropDownLineCount(9);
+ aLBSource.Show();
+ aLBSource.SetSelectHdl(LINK( this, BibToolBar, SelHdl));
+
+ aTimer.SetTimeoutHdl(LINK( this, BibToolBar, SendSelHdl));
+ aTimer.SetTimeout(400);
+
+ aMenuTimer.SetTimeoutHdl(LINK( this, BibToolBar, MenuHdl));
+ aMenuTimer.SetTimeout(300);
+
+ aEdQuery.SetSizePixel(aLBSource.GetSizePixel());
+ aEdQuery.Show();
+
+ XubString aStr=GetItemText(TBC_FT_SOURCE);
+ Rectangle aRect=GetItemRect(TBC_FT_SOURCE);
+ aFtSource.SetText(aStr);
+ aFtSource.SetSizePixel(aRect.GetSize());
+
+ aStr=GetItemText(TBC_FT_QUERY);
+ aRect=GetItemRect(TBC_FT_QUERY);
+ aFtQuery.SetText(aStr);
+ aFtQuery.SetSizePixel(aRect.GetSize());
+
+ SetItemWindow(TBC_FT_SOURCE,&aFtSource);
+ SetItemWindow(TBC_LB_SOURCE,&aLBSource);
+ SetItemWindow(TBC_FT_QUERY ,&aFtQuery);
+ SetItemWindow(TBC_ED_QUERY ,&aEdQuery);
+
+
+}
+
+BibToolBar::~BibToolBar()
+{
+}
+void BibToolBar::InitListener()
+{
+ sal_uInt16 nCount=GetItemCount();
+
+ uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+ uno::Reference< frame::XDispatch > xDisp(xController,UNO_QUERY);
+
+ uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY );
+ if( xTrans.is() )
+ {
+ util::URL aQueryURL;
+ aQueryURL.Complete = C2U(".uno:Bib/MenuFilter");
+ xTrans->parseStrict( aQueryURL);
+ BibToolBarListener* pQuery=new BibTBQueryMenuListener(this,aQueryURL.Complete,TBC_BT_AUTOFILTER);
+ xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pQuery),aQueryURL);
+
+ for(sal_uInt16 nPos=0;nPos<nCount;nPos++)
+ {
+ sal_uInt16 nId=GetItemId(nPos);
+ if(nId==TBC_FT_SOURCE || nId==TBC_FT_QUERY) continue;
+
+ util::URL aURL;
+ aURL.Complete = GetItemCommand(nId);
+
+ xTrans->parseStrict( aURL );
+
+ BibToolBarListener* pListener=NULL;
+ if(nId==TBC_LB_SOURCE)
+ {
+ pListener=new BibTBListBoxListener(this,aURL.Complete,nId);
+ }
+ else if(nId==TBC_ED_QUERY)
+ {
+ pListener=new BibTBEditListener(this,aURL.Complete,nId);
+ }
+ else
+ {
+ pListener=new BibToolBarListener(this,aURL.Complete,nId);
+ }
+
+ BibToolBarListenerPtr pxInsert = new Reference<frame::XStatusListener>;
+ (*pxInsert) = pListener;
+ aListenerArr.Insert( pxInsert, aListenerArr.Count() );
+ xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pListener),aURL);
+ }
+ }
+}
+
+void BibToolBar::SetXController(const uno::Reference< frame::XController > & xCtr)
+{
+ xController=xCtr;
+ InitListener();
+
+}
+
+void BibToolBar::Select()
+{
+ sal_uInt16 nId=GetCurItemId();
+
+ if(nId!=TBC_BT_AUTOFILTER)
+ {
+ SendDispatch(nId,Sequence<PropertyValue>() );
+ }
+ else
+ {
+ Sequence<PropertyValue> aPropVal(2);
+ PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray();
+ pPropertyVal[0].Name=C2U("QueryText");
+ rtl::OUString aSelection = aEdQuery.GetText();
+ pPropertyVal[0].Value <<= aSelection;
+
+ pPropertyVal[1].Name=C2U("QueryField");
+ pPropertyVal[1].Value <<= aQueryField;
+ SendDispatch(nId,aPropVal);
+ }
+}
+
+void BibToolBar::SendDispatch(sal_uInt16 nId, const Sequence< PropertyValue >& rArgs)
+{
+ rtl::OUString aCommand = GetItemCommand(nId);
+
+ uno::Reference< frame::XDispatchProvider > xDSP( xController, UNO_QUERY );
+
+ if( xDSP.is() && aCommand.len())
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr = utl::getProcessServiceFactory();
+
+ uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY );
+ if( xTrans.is() )
+ {
+ // Datei laden
+ util::URL aURL;
+ aURL.Complete = aCommand;
+
+ xTrans->parseStrict( aURL );
+
+ uno::Reference< frame::XDispatch > xDisp = xDSP->queryDispatch( aURL, rtl::OUString(), frame::FrameSearchFlag::SELF );
+
+ if ( xDisp.is() )
+ xDisp->dispatch( aURL, rArgs);
+ }
+ }
+
+}
+
+void BibToolBar::Click()
+{
+ sal_uInt16 nId=GetCurItemId();
+
+ if(nId==TBC_BT_AUTOFILTER)
+ {
+ aMenuTimer.Start();
+ }
+}
+
+void BibToolBar::ClearFilterMenu()
+{
+ aPopupMenu.Clear();
+ nMenuId=0;
+}
+sal_uInt16 BibToolBar::InsertFilterItem(const XubString& aMenuEntry)
+{
+ nMenuId++;
+ aPopupMenu.InsertItem(nMenuId,aMenuEntry);
+
+ return nMenuId;
+}
+void BibToolBar::SelectFilterItem(sal_uInt16 nId)
+{
+ aPopupMenu.CheckItem(nId);
+ nSelMenuItem=nId;
+ aQueryField = aPopupMenu.GetItemText(nId).EraseAllChars( '~' );
+}
+
+void BibToolBar::EnableSourceList(sal_Bool bFlag)
+{
+ aFtSource.Enable(bFlag);
+ aLBSource.Enable(bFlag);
+}
+
+void BibToolBar::ClearSourceList()
+{
+ aLBSource.Clear();
+}
+
+void BibToolBar::UpdateSourceList(sal_Bool bFlag)
+{
+ aLBSource.SetUpdateMode(bFlag);
+}
+
+void BibToolBar::InsertSourceEntry(const XubString& aEntry, sal_uInt16 nPos)
+{
+ aLBSource.InsertEntry(aEntry, nPos);
+}
+
+void BibToolBar::SelectSourceEntry(const XubString& aStr)
+{
+ aLBSource.SelectEntry(aStr);
+}
+
+void BibToolBar::EnableQuery(sal_Bool bFlag)
+{
+ aFtQuery.Enable(bFlag);
+ aEdQuery.Enable(bFlag);
+}
+
+void BibToolBar::SetQueryString(const XubString& aStr)
+{
+ aEdQuery.SetText(aStr);
+}
+
+
+long BibToolBar::PreNotify( NotifyEvent& rNEvt )
+{
+ long nResult=sal_True;
+
+ sal_uInt16 nSwitch=rNEvt.GetType();
+ if(aEdQuery.HasFocus() && nSwitch==EVENT_KEYINPUT)// || nSwitch==EVENT_KEYUP)
+ {
+ const KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode();
+ sal_uInt16 nKey = aKeyCode.GetCode();
+ if(nKey == KEY_RETURN)
+ {
+ Sequence<PropertyValue> aPropVal(2);
+ PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray();
+ pPropertyVal[0].Name = C2U("QueryText");
+ rtl::OUString aSelection = aEdQuery.GetText();
+ pPropertyVal[0].Value <<= aSelection;
+ pPropertyVal[1].Name=C2U("QueryField");
+ pPropertyVal[1].Value <<= aQueryField;
+ SendDispatch(TBC_BT_AUTOFILTER,aPropVal);
+ return nResult;
+ }
+
+ }
+
+ nResult=ToolBox::PreNotify(rNEvt);
+
+ return nResult;
+}
+
+IMPL_LINK( BibToolBar, SelHdl, ListBox*, pLb )
+{
+ aTimer.Start();
+ return 0;
+}
+
+IMPL_LINK( BibToolBar, SendSelHdl, Timer*,pT)
+{
+ Sequence<PropertyValue> aPropVal(1);
+ PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray();
+ pPropertyVal[0].Name = C2U("DataSourceName");
+ String aEntry( aLBSource.GetSelectEntry().EraseAllChars( '~' ) );
+ rtl::OUString aSelection = aEntry;
+ pPropertyVal[0].Value <<= aSelection;
+ SendDispatch(TBC_LB_SOURCE,aPropVal);
+
+ return 0;
+}
+//-----------------------------------------------------------------------------
+IMPL_LINK( BibToolBar, MenuHdl, Timer*,pT)
+{
+ if(IsItemDown(TBC_BT_AUTOFILTER))
+ {
+ EndSelection(); // vor SetDropMode (SetDropMode ruft SetItemImage)
+
+ SetItemDown(TBC_BT_AUTOFILTER,sal_True);
+ sal_uInt16 nId = aPopupMenu.Execute(this, GetItemRect(TBC_BT_AUTOFILTER));
+
+
+ if(nId>0)
+ {
+ aPopupMenu.CheckItem(nSelMenuItem,sal_False);
+ aPopupMenu.CheckItem(nId);
+ nSelMenuItem=nId;
+ aQueryField = aPopupMenu.GetItemText(nId).EraseAllChars( '~' );
+ Sequence<PropertyValue> aPropVal(2);
+ PropertyValue* pPropertyVal = (PropertyValue*)aPropVal.getConstArray();
+ pPropertyVal[0].Name = C2U("QueryText");
+ rtl::OUString aSelection = aEdQuery.GetText();
+ pPropertyVal[0].Value <<= aSelection;
+ pPropertyVal[1].Name=C2U("QueryField");
+ pPropertyVal[1].Value <<= aQueryField;
+ SendDispatch(TBC_BT_AUTOFILTER,aPropVal);
+ }
+
+ Point aPoint;
+ MouseEvent aLeave( aPoint, 0, MOUSE_LEAVEWINDOW | MOUSE_SYNTHETIC );
+ MouseMove( aLeave );
+ SetItemDown(TBC_BT_AUTOFILTER,sal_False);
+
+
+ }
+ return 0;
+}
+//-----------------------------------------------------------------------------
+void BibToolBar::statusChanged(const frame::FeatureStateEvent& rEvent)
+ throw( uno::RuntimeException )
+{
+ for(sal_uInt16 i = 0; i < aListenerArr.Count(); i++)
+ {
+ BibToolBarListenerPtr pListener = aListenerArr.GetObject(i);
+ (*pListener)->statusChanged(rEvent);
+ }
+}
diff --git a/extensions/source/bibliography/toolbar.hrc b/extensions/source/bibliography/toolbar.hrc
new file mode 100644
index 000000000..db5b29cf2
--- /dev/null
+++ b/extensions/source/bibliography/toolbar.hrc
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: toolbar.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "bib.hrc"
+
+#define TBC_FT_SOURCE 1
+#define TBC_LB_SOURCE 2
+#define TBC_FT_QUERY 3
+#define TBC_ED_QUERY 4
+#define TBC_BT_AUTOFILTER 5
+#define TBC_BT_FILTERCRIT 6
+#define TBC_BT_REMOVEFILTER 7
+#define TBC_BT_NEWCARD 8
+#define TBC_BT_EDITCARD 9
+#define TBC_BT_REMOVECARD 10
+#define TBC_BT_INSERT 11
+#define TBC_BT_UPDATE 12
+#define TBC_BT_MAIL 13
+#define TBC_BT_URL 14
+
diff --git a/extensions/source/bibliography/toolbar.hxx b/extensions/source/bibliography/toolbar.hxx
new file mode 100644
index 000000000..4cf6b355d
--- /dev/null
+++ b/extensions/source/bibliography/toolbar.hxx
@@ -0,0 +1,234 @@
+/*************************************************************************
+ *
+ * $RCSfile: toolbar.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _BIB_TOOLBAR_HXX
+#define _BIB_TOOLBAR_HXX
+
+#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
+#include <com/sun/star/frame/XController.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XSTATUSLISTENER_HPP_
+#include <com/sun/star/frame/XStatusListener.hpp>
+#endif
+
+
+
+#ifndef _SV_TOOLBOX_HXX //autogen wg. ToolBox
+#include <vcl/toolbox.hxx>
+#endif
+
+#ifndef _SV_LSTBOX_HXX //autogen wg. ::com::sun::star::form
+#include <vcl/lstbox.hxx>
+#endif
+
+#ifndef _SV_EDIT_HXX //autogen wg. Edit
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _SV_FIXED_HXX //autogen wg. FixedText
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _SVARRAY_HXX
+#include <svtools/svarray.hxx>
+#endif
+
+#ifndef _SV_TIMER_HXX //autogen wg. Timer
+#include <vcl/timer.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#endif
+
+
+class BibToolBar;
+
+class BibToolBarListener: public cppu::WeakImplHelper1 < ::com::sun::star::frame::XStatusListener>
+{
+private:
+
+ sal_uInt16 nIndex;
+ rtl::OUString aCommand;
+
+protected:
+
+ BibToolBar *pToolBar;
+
+public:
+
+ BibToolBarListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
+ ~BibToolBarListener();
+
+ rtl::OUString GetCommand();
+ void SetCommand(const rtl::OUString& aStr);
+
+ sal_uInt16 GetIndex();
+ void SetIndex(sal_uInt16 nIndex);
+
+ // ::com::sun::star::lang::XEventListener
+ // we do not hold References to dispatches, so there is nothing to do on disposal
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source)
+ throw( ::com::sun::star::uno::RuntimeException ){};
+
+ // ::com::sun::star::frame::XStatusListener
+ virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+};
+
+class BibTBListBoxListener: public BibToolBarListener
+{
+public:
+
+ BibTBListBoxListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
+ ~BibTBListBoxListener();
+
+ virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+};
+
+class BibTBEditListener: public BibToolBarListener
+{
+public:
+
+ BibTBEditListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
+ ~BibTBEditListener();
+
+ virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+};
+
+class BibTBQueryMenuListener: public BibToolBarListener
+{
+public:
+
+ BibTBQueryMenuListener(BibToolBar *pTB,rtl::OUString aStr,sal_uInt16 nId);
+ ~BibTBQueryMenuListener();
+
+ virtual void SAL_CALL statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+};
+
+
+typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener>* BibToolBarListenerPtr;
+SV_DECL_PTRARR_DEL( BibToolBarListenerArr, BibToolBarListenerPtr, 4, 4 );
+
+class BibToolBar: public ToolBox
+{
+ private:
+
+ BibToolBarListenerArr aListenerArr;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > xController;
+ Timer aTimer;
+ Timer aMenuTimer;
+
+ FixedText aFtSource;
+ ListBox aLBSource;
+ FixedText aFtQuery;
+ Edit aEdQuery;
+ PopupMenu aPopupMenu;
+ sal_uInt16 nMenuId;
+ sal_uInt16 nSelMenuItem;
+ rtl::OUString aQueryField;
+ DECL_LINK( SelHdl, ListBox* );
+ DECL_LINK( SendSelHdl, Timer* );
+ DECL_LINK( MenuHdl, Timer* );
+
+ protected:
+
+ void InitListener();
+ virtual void Select();
+ virtual void Click();
+ void SendDispatch(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs);
+ long PreNotify( NotifyEvent& rNEvt );
+
+
+ public:
+
+ BibToolBar(Window* pParent, WinBits nStyle = 0 );
+ ~BibToolBar();
+
+ void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &);
+
+ void ClearSourceList();
+ void UpdateSourceList(sal_Bool bFlag=sal_True);
+ void EnableSourceList(sal_Bool bFlag=sal_True);
+ void InsertSourceEntry(const XubString&,sal_uInt16 nPos=LISTBOX_APPEND );
+ void SelectSourceEntry(const XubString& );
+
+ void EnableQuery(sal_Bool bFlag=sal_True);
+ void SetQueryString(const XubString& );
+
+ void ClearFilterMenu();
+ sal_uInt16 InsertFilterItem(const XubString& );
+ void SelectFilterItem(sal_uInt16 nId);
+
+ void statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event)
+ throw( ::com::sun::star::uno::RuntimeException );
+};
+
+
+
+
+#endif
diff --git a/extensions/source/bibliography/toolbar.src b/extensions/source/bibliography/toolbar.src
new file mode 100644
index 000000000..3b7fa7a8b
--- /dev/null
+++ b/extensions/source/bibliography/toolbar.src
@@ -0,0 +1,421 @@
+/*************************************************************************
+ *
+ * $RCSfile: toolbar.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <offmgr/sba.hrc>
+#include "extensio.hrc"
+#include "toolbar.hrc"
+
+ToolBox RID_BIB_TOOLBAR
+{
+ HelpId = HID_BIB_DB_TBX;
+ Sizeable = TRUE ;
+ HideWhenDeactivate = TRUE ;
+ LineSpacing = TRUE ;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 200 , 16 ) ;
+ ButtonType = BUTTON_SYMBOL ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = TBC_FT_SOURCE;
+ //HelpID = SID_SBA_BRW_INSERT ;
+ Text = "Tabelle" ;
+ Text [ ENGLISH ] = "Table" ;
+ Text[ english_us ] = "Table";
+ Text[ portuguese ] = "Tabela";
+ Text[ russian ] = "Òàáëèöà";
+ Text[ greek ] = "Ðßíáêáò";
+ Text[ dutch ] = "Tabel";
+ Text[ french ] = "Table";
+ Text[ spanish ] = "Tabla";
+ Text[ italian ] = "Tabella";
+ Text[ danish ] = "Tabel";
+ Text[ swedish ] = "Tabell";
+ Text[ polish ] = "Tabela";
+ Text[ portuguese_brazilian ] = "Data source";
+ Text[ japanese ] = "ðÌÞÙ";
+ Text[ korean ] = "µ¥ÀÌÅÍ ¼Ò½º";
+ Text[ chinese_simplified ] = "±í¸ñ";
+ Text[ chinese_traditional ] = "ªí®æ";
+ Text[ arabic ] = "ÌÏæá";
+ Text[ turkish ] = "Tablo";
+ Text[ language_user1 ] = " ";
+ };
+ ToolBoxItem
+ {
+ Identifier = TBC_LB_SOURCE;
+ HelpID = HID_BIB_TBX_TABLE;
+ Command = ".uno:Bib/source" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+
+ ToolBoxItem
+ {
+ Identifier = TBC_FT_QUERY;
+ //HelpID = SID_SBA_BRW_INSERT ;
+ Text = "Suchbegriff" ;
+ Text [ ENGLISH ] = "Search key" ;
+ Text[ english_us ] = "Search Key";
+ Text[ portuguese ] = "Expressão procurada";
+ Text[ russian ] = "Èñêîìîå ïîíÿòèå";
+ Text[ greek ] = "¼ñïò áíáæÞôçóçò";
+ Text[ dutch ] = "Zoekbegrip";
+ Text[ french ] = "Élément recherché";
+ Text[ spanish ] = "Expresión de búsqueda";
+ Text[ italian ] = "Termine ricercato";
+ Text[ danish ] = "Søgeord";
+ Text[ swedish ] = "Sökord";
+ Text[ polish ] = "Szukane has³o";
+ Text[ portuguese_brazilian ] = "Search key";
+ Text[ japanese ] = "ŒŸõ·°";
+ Text[ korean ] = "°Ë»ö Å°";
+ Text[ chinese_simplified ] = "ËÑÑ°ÄÚÈÝ";
+ Text[ chinese_traditional ] = "·j´MÃöÁä¦r";
+ Text[ arabic ] = "ãÕØáÍ ÇáÈÍË";
+ Text[ turkish ] = "Arama ölçütü";
+ };
+ ToolBoxItem
+ {
+ Identifier = TBC_ED_QUERY;
+ HelpID = HID_BIB_TBX_SEARCH;
+ Command = ".uno:Bib/query" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+
+ ToolBoxItem
+ {
+ Identifier = TBC_BT_AUTOFILTER ;
+ HelpID = HID_BIB_TBX_AUTOFILTER;
+ ItemBitmap = Bitmap { File = "sc10716.bmp" ; };
+ DropDown = TRUE ;
+ Text = "AutoFilter" ;
+ Text [ ENGLISH ] = "AutoFilter" ;
+ Command = ".uno:Bib/autoFilter" ;
+ Text[ english_us ] = "AutoFilter";
+ Text[ portuguese ] = "AutoFiltro";
+ Text[ russian ] = "Àâòîôèëüòð";
+ Text[ greek ] = "ÁõôïÖßëôñï";
+ Text[ dutch ] = "AutoFilter";
+ Text[ french ] = "AutoFiltre";
+ Text[ spanish ] = "AutoFiltro";
+ Text[ italian ] = "Filtro automatico";
+ Text[ danish ] = "AutoFilter";
+ Text[ swedish ] = "AutoFilter";
+ Text[ polish ] = "Autofiltr";
+ Text[ portuguese_brazilian ] = "AutoFilter";
+ Text[ japanese ] = "µ°Ą̈ÙÀ";
+ Text[ korean ] = "ÀÚµ¿ÇÊÅÍ";
+ Text[ chinese_simplified ] = "×Ô¶¯É¸Ñ¡";
+ Text[ chinese_traditional ] = "¦Û­q¿z¿ï";
+ Text[ arabic ] = "ÝáÊÑ Âáí";
+ Text[ turkish ] = "Otomatik filtre";
+ Text[ language_user1 ] = " ";
+ };
+
+ ToolBoxItem
+ {
+ Identifier = TBC_BT_FILTERCRIT ;
+ HelpID = SID_SBA_QRY_FILTERCRIT ;
+ ItemBitmap = Bitmap { File = "sc10715.bmp" ; };
+ Text = "Standard Filter" ;
+ Text [ ENGLISH ] = "Standard Filter" ;
+ Command = ".uno:Bib/standardFilter" ;
+ Text[ english_us ] = "Standard Filter";
+ Text[ portuguese ] = "Filtro padrão";
+ Text[ russian ] = "Ñòàíäàðòíûé ôèëüòð";
+ Text[ greek ] = "Ößëôñï ðñïåðéëïãÞò";
+ Text[ dutch ] = "Standaardfilter";
+ Text[ french ] = "Filtre par défaut";
+ Text[ spanish ] = "Filtro estándar";
+ Text[ italian ] = "Filtro standard";
+ Text[ danish ] = "Standardfilter";
+ Text[ swedish ] = "Standardfilter";
+ Text[ polish ] = "Filtr standardowy";
+ Text[ portuguese_brazilian ] = "Standard Filter";
+ Text[ japanese ] = "•W€Ì¨ÙÀ";
+ Text[ korean ] = "±âº» ÇÊÅÍ";
+ Text[ chinese_simplified ] = "±ê׼ɸѡ";
+ Text[ chinese_traditional ] = "¼Ð­ã¿z¿ï";
+ Text[ arabic ] = "ÝáÊÑ ÞíÇÓí";
+ Text[ turkish ] = "Standart filtre";
+ Text[ language_user1 ] = " ";
+ };
+
+ ToolBoxItem
+ {
+ Identifier = TBC_BT_REMOVEFILTER ;
+ HelpID = SID_SBA_QRY_REMOVEFILTER ;
+ ItemBitmap = Bitmap { File = "sc10711.bmp" ; };
+ Text = "Filter entfernen" ;
+ Text [ ENGLISH ] = "Remove Filter" ;
+ Command = ".uno:Bib/removeFilter" ;
+ Text[ english_us ] = "Remove Filter";
+ Text[ portuguese ] = "Eliminar filtro";
+ Text[ russian ] = "Óáðàòü ôèëüòð";
+ Text[ greek ] = "ÄéáãñáöÞ ößëôñïõ";
+ Text[ dutch ] = "Filter verwijderen";
+ Text[ french ] = "Supprimer le filtre";
+ Text[ spanish ] = "Eliminar filtro";
+ Text[ italian ] = "Rimuovi filtro";
+ Text[ danish ] = "Fjern filter";
+ Text[ swedish ] = "Ta bort filter";
+ Text[ polish ] = "Usuñ filtr";
+ Text[ portuguese_brazilian ] = "Remove Filter";
+ Text[ japanese ] = "̨ÙÀ‚̉ðœ";
+ Text[ korean ] = "ÇÊÅÍ Á¦°Å";
+ Text[ chinese_simplified ] = "ɾ³ýɸѡ";
+ Text[ chinese_traditional ] = "§R°£¿z¿ï";
+ Text[ arabic ] = "ÅÒÇáÉ ÝáÊÑ";
+ Text[ turkish ] = "Filtreyi kaldýr";
+ Text[ language_user1 ] = " ";
+ };
+/*
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+
+ ToolBoxItem
+ {
+ Identifier = TBC_BT_NEWCARD ;
+ //HelpID = SID_SBA_QRY_REMOVEFILTER ;
+ Command = ".uno:Bib/newEntry" ;
+ ItemBitmap = Bitmap { File = "newcard.bmp" ; };
+ Text = "Neue Adresse" ;
+ Text [ ENGLISH ] = "New Address" ;
+ Text[ english_us ] = "New Address";
+ Text[ portuguese ] = "Novo endereço";
+ Text[ russian ] = "Íîâûé àäðåñ";
+ Text[ greek ] = "New Address";
+ Text[ dutch ] = "Nieuw adres";
+ Text[ french ] = "Nouvelle adresse";
+ Text[ spanish ] = "Nueva dirección";
+ Text[ italian ] = "Nuovo indirizzo";
+ Text[ danish ] = "Ny adresse";
+ Text[ swedish ] = "Ny adress";
+ Text[ polish ] = "Nowy adres";
+ Text[ portuguese_brazilian ] = "New Address";
+ Text[ japanese ] = "V‚µ‚¢ZŠ";
+ Text[ korean ] = "New Address";
+ Text[ chinese_simplified ] = "еØÖ·";
+ Text[ chinese_traditional ] = "·s¦a§}";
+ Text[ arabic ] = "ÚäæÇä ÌÏíÏ";
+ };
+
+ ToolBoxItem
+ {
+ Identifier = TBC_BT_EDITCARD ;
+ //HelpID = SID_SBA_QRY_REMOVEFILTER ;
+ Command = ".uno:Bib/changeEntry" ;
+ ItemBitmap = Bitmap { File = "modcard.bmp" ; };
+ Text = "Adresse bearbeiten" ;
+ Text [ ENGLISH ] = "Edit address" ;
+ Text[ english_us ] = "Edit Address";
+ Text[ portuguese ] = "Editar endereço";
+ Text[ russian ] = "Ïðàâêà àäðåñà";
+ Text[ greek ] = "Edit address";
+ Text[ dutch ] = "Adres wijzigen";
+ Text[ french ] = "Éditer une adresse";
+ Text[ spanish ] = "Editar dirección";
+ Text[ italian ] = "Modifica indirizzo";
+ Text[ danish ] = "Rediger adresse";
+ Text[ swedish ] = "Redigera adress";
+ Text[ polish ] = "Edytuj adres";
+ Text[ portuguese_brazilian ] = "Edit address";
+ Text[ japanese ] = "±ÄÞÚ½‚Ì•ÒW";
+ Text[ korean ] = "Edit address";
+ Text[ chinese_simplified ] = "±à¼­µØÖ·";
+ Text[ chinese_traditional ] = "½s¿è¦a§}";
+ Text[ arabic ] = "ÊÍÑíÑ ÚäæÇä";
+ };
+
+ ToolBoxItem
+ {
+ Identifier = TBC_BT_REMOVECARD ;
+ //HelpID = SID_SBA_QRY_REMOVEFILTER ;
+ Command = ".uno:Bib/removeEntry" ;
+ ItemBitmap = Bitmap { File = "remcard.bmp" ; };
+ Text = "Adresse löschen" ;
+ Text [ ENGLISH ] = "Remove address" ;
+ Text[ english_us ] = "Remove Address";
+ Text[ portuguese ] = "Eliminar endereço";
+ Text[ russian ] = "Óäàëèòü àäðåñ";
+ Text[ greek ] = "ÄéáãñáöÞ äéåýèõíóçò";
+ Text[ dutch ] = "Adres wissen";
+ Text[ french ] = "Supprimer une adresse";
+ Text[ spanish ] = "Eliminar dirección";
+ Text[ italian ] = "Elimina indirizzo";
+ Text[ danish ] = "Slet adresse";
+ Text[ swedish ] = "Ta bort adress";
+ Text[ polish ] = "Usuñ adres";
+ Text[ portuguese_brazilian ] = "Remove address";
+ Text[ japanese ] = "±ÄÞÚ½‚Ìíœ";
+ Text[ korean ] = "Remove address";
+ Text[ chinese_simplified ] = "ɾ³ýµØÖ·";
+ Text[ chinese_traditional ] = "§R°£¦a§}";
+ Text[ arabic ] = "ÍÐÝ ÚäæÇä";
+ };
+
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+
+ ToolBoxItem
+ {
+ Identifier = TBC_BT_INSERT ;
+ HelpID = SID_SBA_BRW_INSERT ;
+ ItemBitmap = Bitmap { File = "sc12202.bmp" ; };
+ Text = "Daten in Text" ;
+ Text [ ENGLISH ] = "Insert" ;
+ Text[ english_us ] = "Data into Text";
+ Text[ portuguese ] = "Dados no texto";
+ Text[ russian ] = "Äàííûå â òåêñò";
+ Text[ greek ] = "ÄåäïìÝíá óôï êåßìåíï";
+ Text[ dutch ] = "Gegevens in tekst";
+ Text[ french ] = "Données dans le texte";
+ Text[ spanish ] = "Datos en texto";
+ Text[ italian ] = "Dati nel testo";
+ Text[ danish ] = "Data i tekst";
+ Text[ swedish ] = "Data i text";
+ Text[ polish ] = "Dane w tekœcie";
+ Text[ portuguese_brazilian ] = "Insert";
+ Text[ japanese ] = "•¶‘‚ÉÃÞ°À";
+ Text[ korean ] = "Insert";
+ Text[ chinese_simplified ] = "²åÈëÊý¾ÝÖÁÎı¾ÖÐ";
+ Text[ chinese_traditional ] = "¼ÆÕuÂà´«¦¨¤å¦r";
+ Text[ arabic ] = "ÈíÇäÇÊ Åáì äÕ";
+ };
+ ToolBoxItem
+ {
+ Identifier = TBC_BT_UPDATE ;
+ HelpID = SID_SBA_BRW_UPDATE ;
+ ItemBitmap = Bitmap { File = "sc12201.bmp" ; };
+ Text = "Daten in Felder" ;
+ };
+
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+
+ ToolBoxItem
+ {
+ Identifier = TBC_BT_MAIL ;
+ //HelpID = HID_ADDRPI_AUTOMAIL ;
+ ItemBitmap = Bitmap { File = "sc06305.bmp" ; };
+ Text = "AutoMail" ;
+ Text [ ENGLISH ] = "AutoMail" ;
+ Text[ english_us ] = "AutoMail";
+ Text[ portuguese ] = "AutoMail";
+ Text[ russian ] = "AutoMail";
+ Text[ greek ] = "AutoMail";
+ Text[ dutch ] = "AutoMail";
+ Text[ french ] = "AutoMail";
+ Text[ spanish ] = "AutoMail";
+ Text[ italian ] = "Mail automatica";
+ Text[ danish ] = "AutoPost";
+ Text[ swedish ] = "AutoMail";
+ Text[ polish ] = "AutoMail";
+ Text[ portuguese_brazilian ] = "AutoMail";
+ Text[ japanese ] = "µ°ÄÒ°Ù";
+ Text[ korean ] = "AutoMail";
+ Text[ chinese_simplified ] = "×Ô¶¯µç×ÓÓʼþ";
+ Text[ chinese_traditional ] = "¦Û°Ê¹q¤l¶l¥ó";
+ Text[ arabic ] = "ÈÑíÏ Âáí";
+ };
+ ToolBoxItem
+ {
+ Identifier = TBC_BT_URL ;
+ //HelpID = HID_ADDRPI_AUTOBROWSE ;
+ ItemBitmap = Bitmap { File = "sc06304.bmp" ; };
+ Text = "AutoBrowse" ;
+ Text [ ENGLISH ] = "AutoBrowse" ;
+ Text[ english_us ] = "AutoBrowse";
+ Text[ portuguese ] = "AutoBrowse";
+ Text[ russian ] = "Àâòîïðîñìîòð";
+ Text[ greek ] = "AutoBrowse";
+ Text[ dutch ] = "AutoBrowse";
+ Text[ french ] = "AutoBrowse";
+ Text[ spanish ] = "AutoBrowse";
+ Text[ italian ] = "Browse automatico";
+ Text[ danish ] = "AutoBrowse";
+ Text[ swedish ] = "AutoBrowse";
+ Text[ polish ] = "AutoBrowse";
+ Text[ portuguese_brazilian ] = "AutoBrowse";
+ Text[ japanese ] = "µ°ÄÌÞ׳¾Þ";
+ Text[ korean ] = "AutoBrowse";
+ Text[ chinese_simplified ] = "×Ô¶¯ä¯ÀÀ";
+ Text[ chinese_traditional ] = "¦Û°ÊÂsÄý";
+ Text[ arabic ] = "ÇÓÊÚÑÇÖ Âáí";
+ };*/
+ };
+ Scroll = TRUE ;
+};
+
diff --git a/extensions/source/ole/comifaces.hxx b/extensions/source/ole/comifaces.hxx
new file mode 100644
index 000000000..e3f0f4e95
--- /dev/null
+++ b/extensions/source/ole/comifaces.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * $RCSfile: comifaces.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __COMIFACES_HXX
+#define __COMIFACES_HXX
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+using namespace com::sun::star::uno;
+
+MIDL_INTERFACE("e40a2331-3bc1-11d4-8321-005004526ab4")
+IJScriptValueObject: public IUnknown
+{
+ STDMETHOD( Set)( VARIANT type, VARIANT value)= 0;
+ STDMETHOD( Get)( VARIANT *val)= 0;
+ STDMETHOD( InitOutParam)()= 0;
+ STDMETHOD( InitInOutParam)( VARIANT type, VARIANT value)= 0;
+ STDMETHOD( IsOutParam)( VARIANT_BOOL * flag)= 0;
+ STDMETHOD( IsInOutParam)( VARIANT_BOOL * flag)= 0;
+ STDMETHOD( GetValue)( BSTR* type, VARIANT *value)= 0;
+
+};
+
+MIDL_INTERFACE("7B5C3410-66FA-11d4-832A-005004526AB4")
+IUnoObjectWrapper: public IUnknown
+{
+ STDMETHOD( getWrapperXInterface)( Reference<XInterface>* pInt)=0;
+ STDMETHOD( getOriginalUnoObject)( Reference<XInterface>* pInt)=0;
+ STDMETHOD( getOriginalUnoStruct)( Any * pStruct)=0;
+
+};
+
+#endif
diff --git a/extensions/source/ole/jscriptclasses.cxx b/extensions/source/ole/jscriptclasses.cxx
new file mode 100644
index 000000000..ca0a01b67
--- /dev/null
+++ b/extensions/source/ole/jscriptclasses.cxx
@@ -0,0 +1,350 @@
+/*************************************************************************
+ *
+ * $RCSfile: jscriptclasses.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "jscriptclasses.hxx"
+
+//========================================================================
+// JScriptValue
+//========================================================================
+JScriptValue::JScriptValue(): m_bOutParam(0), m_bInOutParam(0)
+{
+}
+
+JScriptValue::~JScriptValue()
+{
+}
+
+
+// JScriptValue, IDispatch --------------------------------------------
+STDMETHODIMP JScriptValue::GetTypeInfoCount(UINT *pctinfo)
+{
+ return E_NOTIMPL;
+}
+
+// JScriptValue, IDispatch --------------------------------------------
+STDMETHODIMP JScriptValue::GetTypeInfo( UINT iTInfo,
+ LCID lcid,
+ ITypeInfo **ppTInfo)
+{
+ return E_NOTIMPL;
+}
+
+// JScriptValue, IDispatch --------------------------------------------
+STDMETHODIMP JScriptValue::GetIDsOfNames( REFIID riid,
+ LPOLESTR *rgszNames,
+ UINT cNames,
+ LCID lcid,
+ DISPID *rgDispId)
+{
+ if( !rgDispId)
+ return E_POINTER;
+
+
+ HRESULT ret= S_OK;
+ CComBSTR name(*rgszNames);
+ name.ToLower();
+
+ if( name == CComBSTR( L"set") )
+ *rgDispId= 1;
+ else if( name == CComBSTR( L"get") )
+ *rgDispId= 2;
+ else if( name == CComBSTR( L"initoutparam") )
+ *rgDispId= 3;
+ else if( name == CComBSTR( L"initinoutparam") )
+ *rgDispId= 4;
+ else
+ ret= DISP_E_UNKNOWNNAME;
+
+ return ret;
+}
+
+// JScriptValue, IDispatch --------------------------------------------
+STDMETHODIMP JScriptValue::Invoke( DISPID dispIdMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ DISPPARAMS *pDispParams,
+ VARIANT *pVarResult,
+ EXCEPINFO *pExcepInfo,
+ UINT *puArgErr)
+{
+ if( pDispParams->cNamedArgs)
+ return DISP_E_NONAMEDARGS;
+
+
+ HRESULT ret= S_OK;
+ switch( dispIdMember)
+ {
+ case 0: // DISPID_VALUE
+ if( wFlags & DISPATCH_PROPERTYGET && pVarResult)
+ {
+ if( FAILED( VariantCopy( pVarResult, &m_varValue)))
+ ret= E_FAIL;
+ }
+ else
+ ret= E_POINTER;
+ break;
+ case 1:
+ if( wFlags & DISPATCH_METHOD)
+ ret= Set( pDispParams->rgvarg[1], pDispParams->rgvarg[0]);
+ if( FAILED( ret))
+ ret= DISP_E_EXCEPTION;
+ break;
+ case 2:
+ if( wFlags & DISPATCH_METHOD)
+ ret= Get( pVarResult);
+ if( FAILED( ret))
+ ret= DISP_E_EXCEPTION;
+ break;
+ case 3:
+ if( wFlags & DISPATCH_METHOD)
+ ret= InitOutParam();
+ if( FAILED( ret))
+ ret= DISP_E_EXCEPTION;
+ break;
+ case 4:
+ if( wFlags & DISPATCH_METHOD)
+ ret= InitInOutParam( pDispParams->rgvarg[1], pDispParams->rgvarg[0]);
+ if( FAILED( ret))
+ ret= DISP_E_EXCEPTION;
+ break;
+ default:
+ ret= DISP_E_MEMBERNOTFOUND;
+ break;
+ }
+
+ return ret;
+}
+
+// JScriptValue, IScriptOutParam-----------------------
+STDMETHODIMP JScriptValue::Set( VARIANT type, VARIANT value)
+{
+ Lock();
+ HRESULT hr= S_OK;
+ m_varValue= value;
+ VARIANT var;
+ VariantInit( &var);
+ if( SUCCEEDED( hr= VariantChangeType( &var, &type, 0, VT_BSTR)))
+ m_bstrType= var.bstrVal;
+ Unlock();
+ return hr;
+}
+// JScriptValue, IScriptOutParam-----------------------
+STDMETHODIMP JScriptValue::Get( VARIANT *val)
+{
+ Lock();
+ if( !val)
+ return E_POINTER;
+ HRESULT hr= VariantCopy( val, &m_varValue);
+ Unlock();
+ return hr;
+}
+
+STDMETHODIMP JScriptValue::InitOutParam()
+{
+ Lock();
+ m_bOutParam= true;
+ m_bInOutParam= false;
+ Unlock();
+ return S_OK;
+}
+
+STDMETHODIMP JScriptValue::InitInOutParam( VARIANT type, VARIANT value)
+{
+ Lock();
+ m_bInOutParam= true;
+ m_bOutParam= false;
+ Unlock();
+ return Set( type, value);
+}
+
+STDMETHODIMP JScriptValue::IsOutParam( VARIANT_BOOL * flag)
+{
+ Lock();
+ if( !flag)
+ return E_POINTER;
+ *flag= m_bOutParam ? VARIANT_TRUE : VARIANT_FALSE;
+ Unlock();
+ return S_OK;
+}
+
+STDMETHODIMP JScriptValue::IsInOutParam( VARIANT_BOOL * flag)
+{
+ Lock();
+ if( !flag)
+ return E_POINTER;
+ *flag= m_bInOutParam ? VARIANT_TRUE : VARIANT_FALSE;
+ Unlock();
+ return S_OK;
+}
+
+STDMETHODIMP JScriptValue::GetValue( BSTR* type, VARIANT *value)
+{
+ Lock();
+ if( !type || !value)
+ return E_POINTER;
+ HRESULT hr;
+ if( SUCCEEDED( hr= m_bstrType.CopyTo( type)))
+ hr= VariantCopy( value, &m_varValue);
+ Unlock();
+ return hr;
+}
+
+//##########################################################################################
+// JScriptOutValue
+//##########################################################################################
+
+JScriptOutParam::JScriptOutParam()
+{
+}
+
+JScriptOutParam::~JScriptOutParam()
+{
+}
+
+
+// JScriptOutParam, IDispatch --------------------------------------------
+STDMETHODIMP JScriptOutParam::GetTypeInfoCount(UINT *pctinfo)
+{
+ return E_NOTIMPL;
+}
+
+// JScriptOutParam, IDispatch --------------------------------------------
+STDMETHODIMP JScriptOutParam::GetTypeInfo( UINT iTInfo,
+ LCID lcid,
+ ITypeInfo **ppTInfo)
+{
+ return E_NOTIMPL;
+}
+
+// JScriptOutParam, IDispatch --------------------------------------------
+STDMETHODIMP JScriptOutParam::GetIDsOfNames( REFIID riid,
+ LPOLESTR *rgszNames,
+ UINT cNames,
+ LCID lcid,
+ DISPID *rgDispId)
+{
+ if( !rgDispId)
+ return E_POINTER;
+
+
+ HRESULT ret= S_OK;
+ CComBSTR name(*rgszNames);
+ name.ToLower();
+
+ if( name == CComBSTR( L"0") )
+ *rgDispId= 1;
+ else
+ ret= DISP_E_UNKNOWNNAME;
+
+ return ret;
+}
+
+// JScriptOutParam, IDispatch --------------------------------------------
+STDMETHODIMP JScriptOutParam::Invoke( DISPID dispIdMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ DISPPARAMS *pDispParams,
+ VARIANT *pVarResult,
+ EXCEPINFO *pExcepInfo,
+ UINT *puArgErr)
+{
+ HRESULT ret= S_OK;
+ switch( dispIdMember)
+ {
+ case 0: // DISPID_VALUE
+ if( wFlags & DISPATCH_PROPERTYGET && pVarResult)
+ {
+ if( FAILED( VariantCopy( pVarResult, &m_varValue)))
+ ret= E_FAIL;
+ }
+ else if( wFlags & DISPATCH_PROPERTYPUT || wFlags & DISPATCH_PROPERTYPUTREF)
+ {
+ m_varValue.Clear();
+ if( FAILED( VariantCopyInd( &m_varValue, &pDispParams->rgvarg[0])))
+ ret= E_FAIL;
+ }
+ else
+ ret= E_POINTER;
+ break;
+ case 1: //
+ if( wFlags & DISPATCH_PROPERTYGET && pVarResult)
+ {
+ if( FAILED( VariantCopy( pVarResult, &m_varValue)))
+ ret= E_FAIL;
+ }
+ else if( wFlags & DISPATCH_PROPERTYPUT || wFlags & DISPATCH_PROPERTYPUTREF)
+ {
+ m_varValue.Clear();
+ if( FAILED( VariantCopyInd( &m_varValue, &pDispParams->rgvarg[0])))
+ ret= E_FAIL;
+ }
+ else
+ ret= E_POINTER;
+ break;
+
+ default:
+ ret= DISP_E_MEMBERNOTFOUND;
+ break;
+ }
+
+ return ret;
+}
diff --git a/extensions/source/ole/jscriptclasses.hxx b/extensions/source/ole/jscriptclasses.hxx
new file mode 100644
index 000000000..fae153ad8
--- /dev/null
+++ b/extensions/source/ole/jscriptclasses.hxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * $RCSfile: jscriptclasses.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __JSCRIPTCLASSES_HXX
+#define __JSCRIPTCLASSES_HXX
+#include <tools/presys.h>
+#include "stdafx.h"
+#include <tools/postsys.h>
+
+#include "comifaces.hxx"
+
+
+
+// Sequences are represented by prepending "[]", e.g. []char, [][]byte, [][][]object, etc.
+
+// To make a JScriptValue object to an out parameter, call
+// "InitOutParam" and to make it a in/out parameter call
+// "InitInOutParam"
+
+// If the object represents an out parameter then the value can after the call
+// be retrived by "Get".
+
+// From JavaScript the functions Get, Set, InitOutParam and InitInOutParam are
+// used, that is they are accessible through IDispatch. The functions are used
+// by the bridge.
+
+class JScriptValue:
+ public CComObjectRootEx<CComMultiThreadModel>,
+ public IJScriptValueObject,
+ public IDispatch
+{
+public:
+ JScriptValue();
+ virtual ~JScriptValue();
+
+ BEGIN_COM_MAP(JScriptValue)
+ COM_INTERFACE_ENTRY(IDispatch)
+ COM_INTERFACE_ENTRY(IJScriptValueObject)
+ END_COM_MAP()
+
+ // IDispatch -------------------------------------------
+ STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
+
+ STDMETHOD( GetTypeInfo)( UINT iTInfo,
+ LCID lcid,
+ ITypeInfo **ppTInfo);
+
+ STDMETHOD( GetIDsOfNames)( REFIID riid,
+ LPOLESTR *rgszNames,
+ UINT cNames,
+ LCID lcid,
+ DISPID *rgDispId);
+
+ STDMETHOD( Invoke)( DISPID dispIdMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ DISPPARAMS *pDispParams,
+ VARIANT *pVarResult,
+ EXCEPINFO *pExcepInfo,
+ UINT *puArgErr);
+ // IJScriptOutParam --------------------------------------
+
+ STDMETHOD( Set)( VARIANT type, VARIANT value);
+ STDMETHOD( Get)( VARIANT *val);
+ STDMETHOD( InitOutParam)();
+ STDMETHOD( InitInOutParam)( VARIANT type, VARIANT value);
+ STDMETHOD( IsOutParam)( VARIANT_BOOL * flag);
+ STDMETHOD( IsInOutParam)( VARIANT_BOOL * flag);
+ STDMETHOD( GetValue)( BSTR* type, VARIANT *value);
+
+
+ CComVariant m_varValue;
+ CComBSTR m_bstrType;
+ unsigned m_bOutParam: 1;
+ unsigned m_bInOutParam: 1;
+
+};
+
+// If a class is implemented in JScript, then its method
+class JScriptOutParam:
+ public CComObjectRootEx<CComMultiThreadModel>,
+ public IDispatch
+{
+public:
+ JScriptOutParam();
+ virtual ~JScriptOutParam();
+
+ BEGIN_COM_MAP(JScriptOutParam)
+ COM_INTERFACE_ENTRY(IDispatch)
+ END_COM_MAP()
+
+ // IDispatch -------------------------------------------
+ STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
+
+ STDMETHOD( GetTypeInfo)( UINT iTInfo,
+ LCID lcid,
+ ITypeInfo **ppTInfo);
+
+ STDMETHOD( GetIDsOfNames)( REFIID riid,
+ LPOLESTR *rgszNames,
+ UINT cNames,
+ LCID lcid,
+ DISPID *rgDispId);
+
+ STDMETHOD( Invoke)( DISPID dispIdMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ DISPPARAMS *pDispParams,
+ VARIANT *pVarResult,
+ EXCEPINFO *pExcepInfo,
+ UINT *puArgErr);
+
+
+private:
+ CComVariant m_varValue;
+};
+
+#endif
diff --git a/extensions/source/ole/makefile.mk b/extensions/source/ole/makefile.mk
new file mode 100644
index 000000000..d7c68e2c4
--- /dev/null
+++ b/extensions/source/ole/makefile.mk
@@ -0,0 +1,188 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+# from cppumaker --------------------------------------------------
+UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
+
+UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
+.IF "$(BOOTSTRAP_SERVICE)" == "TRUE"
+UNOUCROUT= $(OUT)$/inc$/comprehensive
+INCPRE+= $(OUT)$/inc$/comprehensive
+CPPUMAKERFLAGS += -C
+.ELSE
+UNOUCROUT= $(OUT)$/inc
+INCPRE+= $(OUT)$/inc
+.ENDIF
+
+# -----------------------------------------------------------------
+
+PRJNAME=extensions
+TARGET=olebrdg
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+LIBTARGET=NO
+USE_DEFFILE=YES
+
+USE_DEFFILE=TRUE
+INCPRE+= -I$(SOLARINCDIR)$/external$/atl
+
+.IF "$(PRODUCT)"=="" || "$(debug)"!=""
+LIBCMT=msvcrtd.lib
+.ENDIF
+# --- Settings -----------------------------------------------------
+
+ENABLE_EXCEPTIONS=TRUE
+
+
+#----------------------------------------------------------------
+#.INCLUDE: .$/cppumaker.mk
+
+
+UNOTYPES= \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.lang.XEventListener \
+ com.sun.star.lang.XUnoTunnel \
+ com.sun.star.lang.XInitialization \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.script.FinishEngineEvent \
+ com.sun.star.script.XInvocation \
+ com.sun.star.script.XInvocation \
+ com.sun.star.script.XLibraryAccess \
+ com.sun.star.script.XAllListener \
+ com.sun.star.script.FailReason \
+ com.sun.star.script.XEventAttacher \
+ com.sun.star.script.XEventAttacherManager \
+ com.sun.star.script.XAllListenerAdapterService \
+ com.sun.star.script.XInvocationAdapterFactory \
+ com.sun.star.script.XInvocationAdapterFactory2 \
+ com.sun.star.registry.InvalidValueException \
+ com.sun.star.registry.RegistryKeyType \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.registry.RegistryValueType \
+ com.sun.star.registry.InvalidRegistryException \
+ com.sun.star.loader.XImplementationLoader \
+ com.sun.star.loader.CannotActivateFactoryException \
+ com.sun.star.bridge.XBridgeSupplier \
+ com.sun.star.bridge.XBridgeSupplier2 \
+ com.sun.star.bridge.ModelDependent \
+ com.sun.star.reflection.InvocationTargetException \
+ com.sun.star.beans.UnknownPropertyException \
+ com.sun.star.beans.MethodConcept \
+ com.sun.star.beans.PropertyConcept \
+ com.sun.star.beans.XExactName \
+ com.sun.star.beans.XMaterialHolder \
+ com.sun.star.uno.Exception \
+ com.sun.star.uno.XWeak \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.reflection.XIdlReflection
+
+# com.sun.star.beans.XMaterialHolder \
+
+
+.IF "$(GUI)"=="WNT"
+
+
+
+
+SLOFILES= \
+ $(SLO)$/servreg.obj \
+ $(SLO)$/servprov.obj \
+ $(SLO)$/unoobjw.obj \
+ $(SLO)$/oleobjw.obj \
+ $(SLO)$/oleclassw.obj \
+ $(SLO)$/olethread.obj \
+ $(SLO)$/oledll.obj \
+ $(SLO)$/StdAfx.obj \
+ $(SLO)$/jscriptclasses.obj
+
+
+SHL1TARGET=$(TARGET)
+SHL1STDLIBS=\
+ $(SALLIB) \
+ $(VOSLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(LIBCIMT) \
+ ole32.lib \
+ uuid.lib \
+ oleaut32.lib
+
+#SHL1LIBS = $(SLB)$/$(TARGET).lib
+SHL1LIBS=
+SHL1OBJS=$(SLOFILES)
+#SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+#SHL1DEF=$(TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=$(SHL1TARGET).dxp
+
+.ENDIF
+
+#----------------------------------------------------------------
+
+.INCLUDE : target.mk
+
+#.INCLUDE : $(PRJ)$/util$/target.pmk
+
diff --git a/extensions/source/ole/ole2uno.hxx b/extensions/source/ole/ole2uno.hxx
new file mode 100644
index 000000000..557a7f6ba
--- /dev/null
+++ b/extensions/source/ole/ole2uno.hxx
@@ -0,0 +1,408 @@
+/*************************************************************************
+ *
+ * $RCSfile: ole2uno.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OLE2UNO_HXX
+#define _OLE2UNO_HXX
+
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define STRICT
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0400
+#endif
+
+#define _WIN32_DCOM
+#ifdef _DEBUG
+//#define _ATL_DEBUG_INTERFACES
+#endif
+
+//#include <atlbase.h>
+//You may derive a class from CComModule and use it if you want to override
+//something, but do not change the name of _Module
+
+#include <tools/prewin.h>
+//#include <stdlib.h>
+//#include <malloc.h>
+//#include <ole2.h>
+//#include <oleauto.h>
+//#include <oaidl.h>
+//#include <ocidl.h>
+#include <tchar.h>
+//#include <objbase.h>
+//#include <atlbase.h>
+//extern CComModule _Module;
+//#include <atlcom.h>
+#if _MSC_VER >= 1200
+#include <dispex.h>
+//#include <winbase.h>
+#endif
+#include <tools/postwin.h>
+
+#include <tools/presys.h>
+#include <list>
+#include <hash_map>
+#include <tools/postsys.h>
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XTYPECONVERTER_HPP_
+#include <com/sun/star/script/XTypeConverter.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_FINISHENGINEEVENT_HPP_
+#include <com/sun/star/script/FinishEngineEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_INTERRUPTREASON_HPP_
+#include <com/sun/star/script/InterruptReason.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XENGINELISTENER_HPP_
+#include <com/sun/star/script/XEngineListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XDEBUGGING_HPP__
+#include <com/sun/star/script/XDebugging.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XINVOCATION_HPP_
+#include <com/sun/star/script/XInvocation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_CONTEXTINFORMATION_HPP_
+#include <com/sun/star/script/ContextInformation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_FINISHREASON_HPP_
+#include <com/sun/star/script/FinishReason.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XENGINE_HPP_
+#include <com/sun/star/script/XEngine.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_INTERRUPTENGINEEVENT_HPP_
+#include <com/sun/star/script/InterruptEngineEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYACCESS_HXX_
+#include <com/sun/star/script/XLibraryAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REGISTRY_INVALIDVALUEEXCEPTION_HPP_
+#include <com/sun/star/registry/InvalidValueException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REGISTRY_REGISTRYKEYTYPE_HPP_
+#include <com/sun/star/registry/RegistryKeyType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REGISTRY_REGISTRYVALUETYPE_HPP_
+#include <com/sun/star/registry/RegistryValueType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REGISTRY_INVALIDREGISTRYEXCEPTION_HPP_
+#include <com/sun/star/registry/InvalidRegistryException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LOADER_XIMPLEMENTATIONLOADER_HPP_
+#include <com/sun/star/loader/XImplementationLoader.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LOADER_CANNOTACTIVATEFACTORYEXCEPTION_HPP_
+#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BRIDGE_XBRIDGESUPPLIER_HPP_
+#include <com/sun/star/bridge/XBridgeSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BRIDGE_XBRIDGESUPPLIER2_HPP_
+#include <com/sun/star/bridge/XBridgeSupplier2.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BRIDGE_MODELDEPENDENT_HPP_
+#include <com/sun/star/bridge/ModelDependent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_INVOCATIONTARGETEXCEPTION_HPP_
+#include <com/sun/star/reflection/InvocationTargetException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_
+#include <com/sun/star/uno/Exception.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_UNKNOWNPROPERTYEXCEPTION_HPP_
+#include <com/sun/star/beans/UnknownPropertyException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+#include <cppuhelper/implbase2.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#ifndef _CPPUHELPER_FACTORY_HXX_
+#include <cppuhelper/factory.hxx>
+#endif
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+#ifndef _TYPELIB_TYPECLASS_H_
+#include <typelib/typeclass.h>
+#endif
+
+#ifndef _UNO_DISPATCHER_H_
+#include <uno/dispatcher.h>
+#endif
+
+#ifndef _UNO_MAPPING_H_
+#include <uno/mapping.hxx>
+#endif
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+
+#ifndef _RTL_PROCESS_H_
+#include <rtl/process.h>
+#endif
+
+#ifndef _RTL_UUID_H_
+#include <rtl/uuid.h>
+#endif
+
+#define UNO_2_OLE_EXCEPTIONCODE 1001
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::script;
+using namespace com::sun::star::registry;
+using namespace com::sun::star::reflection;
+using namespace com::sun::star::beans;
+using namespace osl;
+using namespace rtl;
+using namespace std;
+
+
+
+namespace ole_adapter
+{
+// function shared in this component
+Reference<XSingleServiceFactory> o2u_getConverterProvider2(const Reference<XMultiServiceFactory>& xMan, const Reference<XRegistryKey>& xKey);
+Reference<XSingleServiceFactory> o2u_getConverterProviderVar1(const Reference<XMultiServiceFactory>& xMan, const Reference<XRegistryKey>& xKey);
+Reference<XSingleServiceFactory> o2u_getClientProvider(const Reference<XMultiServiceFactory>& xMan, const Reference<XRegistryKey>& xKey);
+Reference<XSingleServiceFactory> o2u_getServerProvider(const Reference<XMultiServiceFactory>& xMan, const Reference<XRegistryKey>& xKey);
+
+Reference<XMultiServiceFactory> o2u_getMultiServiceFactory();
+Reference<XRegistryKey> o2u_getRegistryKey();
+const VARTYPE getVarType( const Any& val);
+Type getType( BSTR type);
+
+
+Uik o2u_uikFromGUID(GUID* pGuid);
+void o2u_attachCurrentThread();
+
+struct equalOUString_Impl
+{
+ bool operator()(const OUString & s1, const OUString & s2) const
+ {
+ return s1 == s2;
+ }
+};
+
+struct hashOUString_Impl
+{
+ size_t operator()(const OUString & rName) const
+ {
+ return rName.hashCode();
+ }
+};
+
+
+
+
+// ask the object for XBridgeSupplier2 and on success bridges
+// the uno object to IDispatch.
+template < class T >
+sal_Bool convertSelfToIDispatch( T& unoInterface, IDispatch** ppDisp)
+{
+ OSL_ASSERT( ppDisp);
+ *ppDisp= NULL;
+
+ Reference< XInterface > xInt( unoInterface, UNO_QUERY);
+ if( xInt.is())
+ {
+ Reference< XBridgeSupplier2 > xSupplier( xInt, UNO_QUERY);
+ if( xSupplier.is())
+ {
+ sal_Int8 arId[16];
+ rtl_getGlobalProcessId( (sal_uInt8*)arId);
+ Sequence<sal_Int8> seqId( arId, 16);
+ Any anySource;
+ anySource <<= xInt;
+ Any anyDisp= xSupplier->createBridge( anySource, seqId, UNO, OLE);
+ if( anyDisp.getValueTypeClass() == TypeClass_UNSIGNED_LONG)
+ {
+ VARIANT* pvar= *(VARIANT**)anyDisp.getValue();
+ if( pvar->vt == VT_DISPATCH)
+ {
+ *ppDisp= pvar->pdispVal;
+ (*ppDisp)->AddRef();
+ }
+ VariantClear( pvar);
+ CoTaskMemFree( pvar);
+ }
+ }
+ }
+ return *ppDisp ? sal_True : sal_False;
+}
+// ----------------------------------------------------------------------
+// see the overloaded getCppuType function in this file
+//class IUnknownWrapper: public XInterface
+//{
+//public:
+//
+// virtual Any invokeWithDispId(DISPID dispID, const Sequence< Any >& Params, Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam) throw ( IllegalArgumentException, CannotConvertException, InvocationTargetException, Exception ) = 0;
+// virtual void setValueWithDispId(DISPID dispID, const Any& Value) throw( UnknownPropertyException, CannotConvertException, InvocationTargetException, Exception) = 0;
+// virtual Any getValueWithDispId(DISPID dispID) throw( UnknownPropertyException, Exception) = 0;
+//};
+//-----------------------------------------------------------------------
+
+
+
+/* ref class to hold IUnknown pointer
+*/
+template <class UnknownClass> class OleRef
+{
+public:
+
+ typedef OleRef<UnknownClass> self;
+
+ OleRef()
+ : m_pUnknown(NULL)
+ {}
+
+ OleRef(const self& copy)
+ : m_pUnknown(copy.m_pUnknown)
+ {
+ if (m_pUnknown) m_pUnknown->AddRef();
+ }
+
+ OleRef(UnknownClass* pUnknown)
+ : m_pUnknown(pUnknown)
+ {
+ if (m_pUnknown) m_pUnknown->AddRef();
+ }
+
+ ~OleRef()
+ {
+ if (m_pUnknown) m_pUnknown->Release();
+ }
+
+ self& operator = (const self& copy)
+ {
+ if (m_pUnknown) m_pUnknown->Release();
+ m_pUnknown = copy.m_pUnknown;
+ if (m_pUnknown) m_pUnknown->AddRef();
+
+ return *this;
+ }
+
+ self& operator = (UnknownClass* pUnknown)
+ {
+ if (m_pUnknown) m_pUnknown->Release();
+ m_pUnknown = pUnknown;
+ if (m_pUnknown) m_pUnknown->AddRef();
+ return *this;
+ }
+
+ UnknownClass* get() { return m_pUnknown; }
+
+ UnknownClass* operator->() { return m_pUnknown; }
+
+ const UnknownClass* operator->() const { return m_pUnknown; }
+
+ Boolean is() { return (m_pUnknown != NULL); }
+
+protected:
+
+ UnknownClass* m_pUnknown;
+};
+
+inline sal_Bool operator == (const Uik & uik1, const Uik & uik2)
+{
+ if( ! memcmp( &uik1, &uik2, sizeof( Uik)))
+ return sal_True;
+ else
+ return sal_False;
+}
+
+} // end namespace
+
+
+
+#endif _OLE2UNO_HXX
+
diff --git a/extensions/source/ole/oledll.cxx b/extensions/source/ole/oledll.cxx
new file mode 100644
index 000000000..e75309e86
--- /dev/null
+++ b/extensions/source/ole/oledll.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * $RCSfile: oledll.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "stdafx.h"
+
+CComModule _Module;
+
+BEGIN_OBJECT_MAP(ObjectMap)
+END_OBJECT_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// DLL Entry Point
+
+extern "C"
+BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
+{
+ if (dwReason == DLL_PROCESS_ATTACH)
+ {
+ _Module.Init(ObjectMap, hInstance, NULL);
+ DisableThreadLibraryCalls(hInstance);
+ }
+ else if (dwReason == DLL_PROCESS_DETACH)
+ {
+ _Module.Term();
+ }
+ return TRUE; // ok
+}
+
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
new file mode 100644
index 000000000..b6bb011ac
--- /dev/null
+++ b/extensions/source/ole/oleobjw.cxx
@@ -0,0 +1,1581 @@
+/*************************************************************************
+ *
+ * $RCSfile: oleobjw.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "ole2uno.hxx"
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#include <osl/diagnose.h>
+
+#ifndef _COM_SUN_STAR_SCRIPT_FAILREASON_HPP_
+#include <com/sun/star/script/FailReason.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XMATERIALHOLDER_HPP_
+#include <com/sun/star/beans/XMaterialHolder.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XTYPECONVERTER_HPP_
+#include <com/sun/star/script/XTypeConverter.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_FINISHENGINEEVENT_HPP_
+#include <com/sun/star/script/FinishEngineEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_INTERRUPTREASON_HPP_
+#include <com/sun/star/script/InterruptReason.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XENGINELISTENER_HPP_
+#include <com/sun/star/script/XEngineListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XDEBUGGING_HPP_
+#include <com/sun/star/script/XDebugging.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XINVOCATION_HPP_
+#include <com/sun/star/script/XInvocation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_CONTEXTINFORMATION_HPP_
+#include <com/sun/star/script/ContextInformation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_FINISHREASON_HPP_
+#include <com/sun/star/script/FinishReason.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XENGINE_HPP_
+#include <com/sun/star/script/XEngine.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_INTERRUPTENGINEEVENT_HPP_
+#include <com/sun/star/script/InterruptEngineEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYACCESS_HPP_
+#include <com/sun/star/script/XLibraryAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BRIDGE_XBRIDGESUPPLIER_HPP_
+#include <com/sun/star/bridge/XBridgeSupplier.hpp>
+#endif
+//#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+//#include <com/sun/star/lang/XUnoTunnel.hpp>
+//#endif
+
+#ifndef _COM_SUN_STAR_BRIDGE_MODELDEPENDENT_HPP_
+#include <com/sun/star/bridge/ModelDependent.hpp>
+#endif
+
+#include <typelib/typedescription.hxx>
+#include <rtl/uuid.h>
+#include <rtl/memory.h>
+#ifndef _RTL_USTRING_
+#include <rtl/ustring>
+#endif
+
+//#include <tools/presys.h>
+
+#include "jscriptclasses.hxx"
+//#include <tools/postsys.h>
+
+#include "oleobjw.hxx"
+#include "unoobjw.hxx"
+
+using namespace std;
+using namespace osl;
+using namespace rtl;
+using namespace cppu;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::bridge;
+using namespace com::sun::star::bridge::ModelDependent;
+
+#define JSCRIPT_ID_PROPERTY L"_environment"
+#define JSCRIPT_ID L"jscript"
+namespace ole_adapter
+{
+
+
+
+
+
+// key: XInterface pointer created by Invocation Adapter Factory
+// value: XInterface pointer to the wrapper class.
+// Entries to the map are made within
+// Any createOleObjectWrapper(IUnknown* pUnknown, const Type& aType);
+// Entries are being deleted if the wrapper class's destructor has been
+// called.
+// Before UNO object is wrapped to COM object this map is checked
+// to see if the UNO object is already a wrapper.
+hash_map<sal_uInt32,sal_uInt32> AdapterToWrapperMap;
+// key: XInterface of the wrapper object.
+// value: XInterface of the Interface created by the Invocation Adapter Factory.
+// A COM wrapper is responsible for removing the corresponding entry
+// in AdapterToWrappperMap if it is being destroyed. Because the wrapper does not
+// know about its adapted interface it uses WrapperToAdapterMap to get the
+// adapted interface which is then used to locate the entry in AdapterToWrapperMap.
+hash_map<sal_uInt32,sal_uInt32> WrapperToAdapterMap;
+
+
+/*****************************************************************************
+
+ class implementation IUnknownWrapper_Impl
+
+*****************************************************************************/
+
+IUnknownWrapper_Impl::IUnknownWrapper_Impl( Reference<XMultiServiceFactory>& xFactory,
+ sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass):
+ UnoConversionUtilities<IUnknownWrapper_Impl>( xFactory, unoWrapperClass, comWrapperClass),
+ m_pxIdlClass( NULL), m_pDispatch(NULL), m_eJScript( JScriptUndefined)
+{
+}
+
+
+IUnknownWrapper_Impl::~IUnknownWrapper_Impl()
+{
+ OGuard guard( globalWrapperMutex);
+ acquire(); // make sure we don't delete us twice
+ Reference<XInterface> xInt( static_cast<XWeak*>(this), UNO_QUERY);
+
+ // remove entries in global maps
+ typedef hash_map<sal_uInt32, sal_uInt32>::iterator _IT;
+ _IT it= WrapperToAdapterMap.find( (sal_uInt32) xInt.get());
+ if( it != WrapperToAdapterMap.end())
+ {
+ sal_uInt32 adapter= it->second;
+
+ AdapterToWrapperMap.erase( adapter);
+ WrapperToAdapterMap.erase( it);
+ }
+
+ o2u_attachCurrentThread();
+
+ m_pUnknown->Release();
+ if (m_pDispatch)
+ {
+ m_pDispatch->Release();
+ }
+
+}
+
+
+
+Reference<XIntrospectionAccess> SAL_CALL IUnknownWrapper_Impl::getIntrospection(void)
+ throw (RuntimeException )
+{
+ Reference<XIntrospectionAccess> ret;
+
+ return ret;
+}
+
+DispIdMap::iterator IUnknownWrapper_Impl::getDispIdEntry(const OUString& name)
+{
+
+ DispIdMap::iterator iter = m_dispIdMap.find(name);
+
+ if (iter == m_dispIdMap.end())
+ {
+ unsigned int flags = 0;
+ HRESULT result;
+ DISPID dispId;
+ OLECHAR* oleNames[1];
+
+ oleNames[0] = (OLECHAR*)name.getStr();
+
+ result = m_pDispatch->GetIDsOfNames(IID_NULL,
+ oleNames,
+ 1,
+ LOCALE_SYSTEM_DEFAULT,
+ &dispId);
+
+ if (result == NOERROR)
+ {
+ flags |= DISPATCH_METHOD;
+ flags |= DISPATCH_PROPERTYPUT;
+ flags |= DISPATCH_PROPERTYPUTREF;
+
+ DISPPARAMS dispparams;
+ VARIANT varResult;
+ EXCEPINFO excepinfo;
+ unsigned int uArgErr;
+
+ VariantInit(&varResult);
+
+ // converting UNO parameters to OLE variants
+ dispparams.rgdispidNamedArgs = NULL;
+ dispparams.cArgs = 0;
+ dispparams.cNamedArgs = 0;
+ dispparams.rgvarg = NULL;
+
+ // try to invoke PROPERTY_GET to evaluate if this name denotes a property
+ result = m_pDispatch->Invoke(dispId,
+ IID_NULL,
+ LOCALE_SYSTEM_DEFAULT,
+ DISPATCH_PROPERTYGET,
+ &dispparams,
+ &varResult,
+ &excepinfo,
+ &uArgErr);
+
+ if (result == S_OK)
+ {
+ flags |= DISPATCH_PROPERTYGET;
+ }
+
+ // freeing allocated OLE parameters
+ VariantClear(&varResult);
+
+ if (flags != 0)
+ {
+ iter = ((DispIdMap&)m_dispIdMap).insert(
+ DispIdMap::value_type(name, pair<DISPID, unsigned short>(dispId, flags))).first;
+ }
+ }
+ }
+
+ return iter;
+}
+
+
+Any SAL_CALL IUnknownWrapper_Impl::invoke( const OUString& aFunctionName,
+ const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex,
+ Sequence< Any >& aOutParam )
+ throw(IllegalArgumentException, CannotConvertException, InvocationTargetException,
+ RuntimeException)
+{
+ setCurrentInvokeCall( aFunctionName);
+
+ Any ret;
+
+ DispIdMap::iterator iter = getDispIdEntry(aFunctionName);
+
+ if ((iter != m_dispIdMap.end()) && (((*iter).second.second & DISPATCH_METHOD) != 0))
+ {
+ TypeDescription methodDesc;
+ getMethodInfo( methodDesc );
+ if( methodDesc.is())
+ ret = invokeWithDispIdUnoTlb((*iter).second.first,
+ aParams,
+ aOutParamIndex,
+ aOutParam);
+ else
+ ret= invokeWithDispIdComTlb( (*iter).second.first, //DISPID
+ aParams,
+ aOutParamIndex,
+ aOutParam);
+
+ }
+ else
+ throw IllegalArgumentException();
+
+ return ret;
+}
+
+void SAL_CALL IUnknownWrapper_Impl::setValue( const OUString& aPropertyName,
+ const Any& aValue )
+ throw(UnknownPropertyException, CannotConvertException, InvocationTargetException,
+ RuntimeException)
+{
+
+ DispIdMap::iterator iter = getDispIdEntry(aPropertyName);
+
+ if ((iter != m_dispIdMap.end()) && (((*iter).second.second & DISPATCH_PROPERTYPUT) != 0))
+ {
+ setValueWithDispId((*iter).second.first, aValue);
+ }
+ else
+ throw UnknownPropertyException();
+}
+
+Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ setCurrentGetCall( aPropertyName);
+
+ Any ret;
+
+ DispIdMap::iterator iter = getDispIdEntry(aPropertyName);
+
+ if (iter != m_dispIdMap.end() && (((*iter).second.second & DISPATCH_PROPERTYGET) != 0))
+ {
+ ret = getValueWithDispId((*iter).second.first);
+ }
+ else
+ throw UnknownPropertyException();
+
+ return ret;
+}
+
+sal_Bool SAL_CALL IUnknownWrapper_Impl::hasMethod( const OUString& aName )
+ throw(RuntimeException)
+{
+ sal_Bool ret = FALSE;
+
+ o2u_attachCurrentThread();
+
+ DispIdMap::iterator iter = ((IUnknownWrapper_Impl*)this)->getDispIdEntry(aName);
+
+ ret = (
+ (iter != ((IUnknownWrapper_Impl*)this)->m_dispIdMap.end()) &&
+ (((*iter).second.second & DISPATCH_METHOD) != 0)
+ );
+
+ return ret;
+}
+
+sal_Bool SAL_CALL IUnknownWrapper_Impl::hasProperty( const OUString& aName )
+ throw(RuntimeException)
+{
+ sal_Bool ret = FALSE;
+
+ o2u_attachCurrentThread();
+
+ DispIdMap::iterator iter = ((IUnknownWrapper_Impl*)this)->getDispIdEntry(aName);
+
+ ret = (
+ (iter != ((IUnknownWrapper_Impl*)this)->m_dispIdMap.end()) &&
+ (((*iter).second.second & DISPATCH_PROPERTYGET) != 0)
+ );
+
+ return ret;
+}
+
+Any SAL_CALL IUnknownWrapper_Impl::createBridge( const Any& modelDepObject,
+ const Sequence< sal_Int8 >& aProcessId, sal_Int16 sourceModelType,
+ sal_Int16 destModelType )
+ throw( IllegalArgumentException, RuntimeException)
+{
+ Any ret;
+
+ if (
+ (sourceModelType == UNO) &&
+ (destModelType == OLE) &&
+ (modelDepObject.getValueTypeClass() == TypeClass_INTERFACE)
+ )
+ {
+ Reference<XInterface> xInt( *(XInterface**) modelDepObject.getValue());
+ Reference<XInterface> xSelf( (OWeakObject*)this);
+
+ if (xInt == xSelf)
+ {
+ VARIANT* pVariant = (VARIANT*) CoTaskMemAlloc(sizeof(VARIANT));
+
+ VariantInit(pVariant);
+
+ if (m_pDispatch != NULL)
+ {
+ V_VT(pVariant) = VT_DISPATCH;
+ V_DISPATCH(pVariant) = m_pDispatch;
+ m_pDispatch->AddRef();
+ }
+ else
+ {
+ V_VT(pVariant) = VT_UNKNOWN;
+ V_UNKNOWN(pVariant) = m_pUnknown;
+ m_pUnknown->AddRef();
+ }
+
+ ret.setValue((void*)&pVariant, getCppuType( (sal_uInt32*) 0));
+ }
+ }
+
+ return ret;
+}
+
+Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(DISPID dispID,
+ const Sequence< Any >& Params,
+ Sequence< sal_Int16 >& OutParamIndex,
+ Sequence< Any >& OutParam)
+ throw ( IllegalArgumentException, CannotConvertException,
+ InvocationTargetException, RuntimeException)
+{
+ Any ret;
+ HRESULT hr= S_OK;
+ o2u_attachCurrentThread();
+
+
+ sal_Int32 parameterCount= Params.getLength();
+ sal_Int32 outParameterCount= 0;
+ typelib_InterfaceMethodTypeDescription* pMethod= NULL;
+ TypeDescription methodDesc;
+ getMethodInfo( methodDesc);
+
+ // We need to know whether the IDispatch is from a JScript object.
+ // Then out and in/out parameters have to be treated differently than
+ // with common COM objects.
+ sal_Bool bJScriptObject= isJScriptObject();
+// CComDispatchDriver disp( m_pDispatch);
+
+ CComVariant *pVarParams= NULL;
+ CComVariant *pVarParamsRef= NULL;
+ sal_Bool bConvOk= sal_True;
+ sal_Bool bConvRet= sal_True;
+
+ if( methodDesc.is())
+ {
+ pMethod= ( typelib_InterfaceMethodTypeDescription* )methodDesc.get();
+ parameterCount= pMethod->nParams;
+ // Create the Array for the array being passed in DISPPARAMS
+ // the array also contains the outparameter (but not the values)
+ if( pMethod->nParams > 0)
+ pVarParams= new CComVariant[ parameterCount];
+ // Create the Array for the out an in/out parameter. These values
+ // are referenced by the VT_BYREF VARIANTs in DISPPARAMS.
+ // We need to find out the number of out and in/out parameter.
+ for( sal_Int32 i=0; i < parameterCount; i++)
+ {
+ if( pMethod->pParams[i].bOut)
+ outParameterCount++;
+ }
+
+ if( !bJScriptObject)
+ {
+ pVarParamsRef= new CComVariant[ outParameterCount];
+ // build up the parameters for IDispatch::Invoke
+ sal_Int32 inParamIndex=0;
+ sal_Int32 outParamIndex=0;
+
+ for( i= 0; i < parameterCount; i++)
+ {
+
+ // In parameter
+ if( pMethod->pParams[i].bIn == sal_True && ! pMethod->pParams[i].bOut)
+ {
+ bConvOk= anyToVariant( &pVarParams[parameterCount - i -1], Params[inParamIndex++]);
+ }
+ // Out parameter + in/out parameter
+ else if( pMethod->pParams[i].bOut == sal_True)
+ {
+ CComVariant var;
+ switch( pMethod->pParams[i].pTypeRef->eTypeClass)
+ {
+ case TypeClass_INTERFACE:
+ case TypeClass_STRUCT:
+ if( pMethod->pParams[i].bIn && (bConvOk= anyToVariant( &var,Params[i])))
+ pVarParamsRef[ outParamIndex]= var;
+ else
+ {
+ pVarParamsRef[ outParamIndex].vt= VT_DISPATCH;
+ pVarParamsRef[ outParamIndex].pdispVal= 0;
+ }
+ pVarParams[parameterCount - i -1].vt = VT_DISPATCH | VT_BYREF;
+ pVarParams[parameterCount - i -1].ppdispVal= &pVarParamsRef[outParamIndex].pdispVal;
+ break;
+ case TypeClass_ENUM:
+ case TypeClass_LONG:
+ case TypeClass_UNSIGNED_LONG:
+ if( pMethod->pParams[i].bIn && (bConvOk= anyToVariant( &var,Params[i])))
+ pVarParamsRef[ outParamIndex]= var;
+ else
+ {
+ pVarParamsRef[ outParamIndex].vt = VT_I4;
+ pVarParamsRef[ outParamIndex].lVal= 0;
+ }
+ pVarParams[parameterCount - i -1].vt = VT_I4 | VT_BYREF;
+ pVarParams[parameterCount - i -1].plVal= &pVarParamsRef[outParamIndex].lVal;
+ break;
+ case TypeClass_SEQUENCE:
+ if( pMethod->pParams[i].bIn && (bConvOk= anyToVariant( &var,Params[i])))
+ pVarParamsRef[ outParamIndex]= var;
+ else
+ {
+ pVarParamsRef[ outParamIndex].vt = VT_ARRAY| VT_VARIANT;
+ pVarParamsRef[ outParamIndex].parray= NULL;
+ }
+ pVarParams[parameterCount - i -1].vt = VT_ARRAY| VT_BYREF | VT_VARIANT;
+ pVarParams[parameterCount - i -1].pparray= &pVarParamsRef[outParamIndex].parray;
+ break;
+ case TypeClass_ANY:
+ if( pMethod->pParams[i].bIn && (bConvOk= anyToVariant( &var,Params[i])))
+ pVarParamsRef[ outParamIndex]= var;
+ else
+ {
+ pVarParamsRef[ outParamIndex].vt = VT_EMPTY;
+ pVarParamsRef[ outParamIndex].lVal = 0;
+ }
+ pVarParams[parameterCount - i -1].vt = VT_VARIANT | VT_BYREF;
+ pVarParams[parameterCount - i -1].pvarVal= &pVarParamsRef[outParamIndex];
+ break;
+ case TypeClass_BOOLEAN:
+ if( pMethod->pParams[i].bIn && (bConvOk= anyToVariant( &var,Params[i])) )
+ pVarParamsRef[ outParamIndex]= var;
+ else
+ {
+ pVarParamsRef[ outParamIndex].vt = VT_BOOL;
+ pVarParamsRef[ outParamIndex].boolVal = 0;
+ }
+ pVarParams[parameterCount - i -1].vt = VT_BOOL| VT_BYREF;
+ pVarParams[parameterCount - i -1].pboolVal= &pVarParamsRef[outParamIndex].boolVal;
+ break;
+
+ case TypeClass_STRING:
+ if( pMethod->pParams[i].bIn && (bConvOk= anyToVariant( &var,Params[i])))
+ pVarParamsRef[ outParamIndex]= var;
+ else
+ {
+ pVarParamsRef[ outParamIndex].vt = VT_BSTR;
+ pVarParamsRef[ outParamIndex].bstrVal= 0;
+ }
+ pVarParams[parameterCount - i -1].vt = VT_BSTR| VT_BYREF;
+ pVarParams[parameterCount - i -1].pbstrVal= &pVarParamsRef[outParamIndex].bstrVal;
+ break;
+
+ case TypeClass_FLOAT:
+ if( pMethod->pParams[i].bIn && (bConvOk= anyToVariant( &var,Params[i])))
+ pVarParamsRef[ outParamIndex]= var;
+ else
+ {
+ pVarParamsRef[ outParamIndex].vt = VT_R4;
+ pVarParamsRef[ outParamIndex].fltVal= 0;
+ }
+ pVarParams[parameterCount - i -1].vt = VT_R4| VT_BYREF;
+ pVarParams[parameterCount - i -1].pfltVal= &pVarParamsRef[outParamIndex].fltVal;
+ break;
+ case TypeClass_DOUBLE:
+ if( pMethod->pParams[i].bIn&& (bConvOk= anyToVariant( &var,Params[i])))
+ pVarParamsRef[ outParamIndex]= var;
+ else
+ {
+ pVarParamsRef[ outParamIndex].vt = VT_R8;
+ pVarParamsRef[ outParamIndex].dblVal= 0;
+ }
+ pVarParams[parameterCount - i -1].vt = VT_R8| VT_BYREF;
+ pVarParams[parameterCount - i -1].pdblVal= &pVarParamsRef[outParamIndex].dblVal;
+ break;
+ case TypeClass_BYTE:
+ if( pMethod->pParams[i].bIn && (bConvOk= anyToVariant( &var,Params[i])))
+ pVarParamsRef[ outParamIndex]= var;
+ else
+ {
+ pVarParamsRef[ outParamIndex].vt = VT_UI1;
+ pVarParamsRef[ outParamIndex].bVal= 0;
+ }
+ pVarParams[parameterCount - i -1].vt = VT_UI1| VT_BYREF;
+ pVarParams[parameterCount - i -1].pbVal= &pVarParamsRef[outParamIndex].bVal;
+ break;
+ case TypeClass_CHAR:
+ case TypeClass_SHORT:
+ case TypeClass_UNSIGNED_SHORT:
+ if( pMethod->pParams[i].bIn&& (bConvOk= anyToVariant( &var,Params[i])))
+ pVarParamsRef[ outParamIndex]= var;
+ else
+ {
+ pVarParamsRef[ outParamIndex].vt = VT_I2;
+ pVarParamsRef[ outParamIndex].iVal = 0;
+ }
+ pVarParams[parameterCount - i -1].vt = VT_I2| VT_BYREF;
+ pVarParams[parameterCount - i -1].piVal= &pVarParamsRef[outParamIndex].iVal;
+ break;
+
+ default:
+ if( pMethod->pParams[i].bIn && (bConvOk= anyToVariant( &var,Params[i])))
+ pVarParamsRef[ outParamIndex]= var;
+ else
+ {
+ pVarParamsRef[ outParamIndex].vt = VT_EMPTY;
+ pVarParamsRef[ outParamIndex].lVal = 0;
+ }
+ pVarParams[parameterCount - i -1].vt = VT_VARIANT | VT_BYREF;
+ pVarParams[parameterCount - i -1].pvarVal= &pVarParamsRef[outParamIndex];
+ }
+ outParamIndex++;
+ } // end else if
+ if( ! bConvOk) break;
+ } // end for
+ }
+ else // it is an JScriptObject
+ {
+ sal_Int32 inParamIndex= 0;
+ for( sal_Int32 i= 0; i< parameterCount; i++)
+ {
+ // In parameter
+ if( pMethod->pParams[i].bIn == sal_True && ! pMethod->pParams[i].bOut)
+ {
+ bConvOk= anyToVariant( &pVarParams[parameterCount - i -1], Params[inParamIndex++]);
+ }
+ // Out parameter + in/out parameter
+ else if( pMethod->pParams[i].bOut == sal_True)
+ {
+ CComObject<JScriptOutParam>* pParamObject;
+ if( SUCCEEDED( CComObject<JScriptOutParam>::CreateInstance( &pParamObject)))
+ {
+ CComPtr<IUnknown> pUnk(pParamObject->GetUnknown());
+ CComQIPtr<IDispatch> pDisp( pUnk);
+
+ pVarParams[ parameterCount - i -1].vt= VT_DISPATCH;
+ pVarParams[ parameterCount - i -1].pdispVal= pDisp;
+ pVarParams[ parameterCount - i -1].pdispVal->AddRef();
+ // if the param is in/out then put the parameter on index 0
+ if( pMethod->pParams[i].bIn == sal_True ) // in / out
+ {
+ CComVariant varParam;
+ bConvOk= anyToVariant( &varParam, Params[ inParamIndex++]);
+ if( bConvOk)
+ {
+ CComDispatchDriver dispDriver( pDisp);
+ if( pDisp)
+ if( FAILED( dispDriver.PutPropertyByName( L"0", &varParam)))
+ bConvOk= sal_False;
+ }
+ }
+ }
+ }
+ if( ! bConvOk) break;
+ }
+ }
+ }
+ // No type description Available, that is we have to deal with a COM component,
+ // that does not implements UNO interfaces ( IDispatch based)
+ else
+ {
+ if( parameterCount)
+ {
+ pVarParams= new CComVariant[parameterCount];
+ CComVariant var;
+ for( sal_Int32 i= 0; i < parameterCount; i++)
+ {
+ var.Clear();
+ if( bConvOk= anyToVariant( &var, Params[i]))
+ pVarParams[ parameterCount - 1 -i]= var;
+ }
+ }
+ }
+
+ if( bConvOk)
+ {
+ CComVariant varResult;
+ EXCEPINFO excepinfo;
+ unsigned int uArgErr;
+ DISPPARAMS dispparams= { pVarParams, NULL, parameterCount, 0};
+ // invoking OLE method
+ hr = m_pDispatch->Invoke(dispID,
+ IID_NULL,
+ LOCALE_SYSTEM_DEFAULT,
+ DISPATCH_METHOD,
+ &dispparams,
+ &varResult,
+ &excepinfo,
+ &uArgErr);
+
+ // converting return value and out parameter back to UNO
+ if (hr == S_OK)
+ {
+ if( outParameterCount && pMethod)
+ {
+ OutParamIndex.realloc( outParameterCount);
+ OutParam.realloc( outParameterCount);
+ sal_Int32 outIndex=0;
+ for( sal_Int32 i= 0; i < parameterCount; i++)
+ {
+ if( pMethod->pParams[i].bOut )
+ {
+ OutParamIndex[outIndex]= i;
+ Any outAny;
+ if( !bJScriptObject)
+ {
+ if( bConvRet= variantToAny2( &pVarParamsRef[outIndex], outAny,
+ Type(pMethod->pParams[i].pTypeRef), sal_False))
+ OutParam[outIndex++]= outAny;
+
+ }
+ else //JScriptObject
+ {
+ if( pVarParams[i].vt= VT_DISPATCH)
+ {
+ CComDispatchDriver pDisp( pVarParams[i].pdispVal);
+ if( pDisp)
+ {
+ CComVariant varOut;
+ if( SUCCEEDED( pDisp.GetPropertyByName( L"0", &varOut)))
+ {
+ if( bConvRet= variantToAny2( &varOut, outAny,
+ Type(pMethod->pParams[parameterCount - 1 - i].pTypeRef), sal_False))
+ OutParam[outParameterCount - 1 - outIndex++]= outAny;
+
+ }
+ else
+ bConvRet= sal_False;
+ }
+ else
+ bConvRet= sal_False;
+ }
+ else
+ bConvRet= sal_False;
+ }
+ }
+ if( !bConvRet) break;
+ }
+ }
+ // return value, no type information available
+ if ( bConvRet)
+ if( pMethod )
+ bConvRet= variantToAny2(&varResult, ret, Type( pMethod->pReturnTypeRef), sal_False);
+ else
+ bConvRet= variantToAny(&varResult, ret, sal_False);
+ }
+
+ if( pVarParams)
+ delete[] pVarParams;
+ // The destructor of CComVariant calls VariantClear which takes null pointers into account
+ // and does not try to destroy them.
+ if( pVarParamsRef)
+ delete[] pVarParamsRef;
+
+ if( !bConvRet) // conversion of return or out parameter failed
+ throw CannotConvertException( L"Call to COM object failed. Conversion of return or out value failed",
+ Reference<XInterface>( static_cast<XWeak*>(this), UNO_QUERY ), TypeClass_UNKNOWN,
+ FailReason::UNKNOWN, 0);// lookup error code
+ // conversion of return or out parameter failed
+ switch (hr)
+ {
+ case S_OK:
+ break;
+ case DISP_E_BADPARAMCOUNT:
+ throw IllegalArgumentException();
+ break;
+ case DISP_E_BADVARTYPE:
+ throw RuntimeException();
+ break;
+ case DISP_E_EXCEPTION:
+ throw InvocationTargetException();
+ break;
+ case DISP_E_MEMBERNOTFOUND:
+ throw IllegalArgumentException();
+ break;
+ case DISP_E_NONAMEDARGS:
+ throw IllegalArgumentException();
+ break;
+ case DISP_E_OVERFLOW:
+ throw CannotConvertException(L"call to OLE object failed", static_cast<XInterface*>(
+ static_cast<XWeak*>(this)), TypeClass_UNKNOWN, FailReason::OUT_OF_RANGE, uArgErr);
+ break;
+ case DISP_E_PARAMNOTFOUND:
+ throw IllegalArgumentException(L"call to OLE object failed", static_cast<XInterface*>(
+ static_cast<XWeak*>(this)), uArgErr);
+ break;
+ case DISP_E_TYPEMISMATCH:
+ throw CannotConvertException(L"call to OLE object failed",static_cast<XInterface*>(
+ static_cast<XWeak*>(this)) , TypeClass_UNKNOWN, FailReason::UNKNOWN, uArgErr);
+ break;
+ case DISP_E_UNKNOWNINTERFACE:
+ throw RuntimeException() ;
+ break;
+ case DISP_E_UNKNOWNLCID:
+ throw RuntimeException() ;
+ break;
+ case DISP_E_PARAMNOTOPTIONAL:
+ throw CannotConvertException(L"call to OLE object failed", static_cast<XInterface*>(
+ static_cast<XWeak*>(this)), TypeClass_UNKNOWN, FailReason::NO_DEFAULT_AVAILABLE, uArgErr);
+ break;
+ default:
+ throw RuntimeException();
+ break;
+ }
+ }
+ if( !bConvOk) // conversion of parameters failed
+ {
+ if( pVarParams)
+ delete [] pVarParams;
+ if( pVarParamsRef)
+ delete [] pVarParamsRef;
+ throw CannotConvertException( L"Call to COM object failed. Conversion of in or in/out parameters failed",
+ Reference<XInterface>( static_cast<XWeak*>(this), UNO_QUERY ), TypeClass_UNKNOWN,
+ FailReason::UNKNOWN, 0);
+ }
+
+ return ret;
+}
+
+void IUnknownWrapper_Impl::setValueWithDispId(DISPID dispID,
+ const Any& Value)
+ throw (UnknownPropertyException,
+ CannotConvertException,
+ InvocationTargetException,
+ RuntimeException)
+{
+ HRESULT hr= S_OK;
+ DISPPARAMS dispparams;
+ VARIANT varResult;
+ EXCEPINFO excepinfo;
+ unsigned int uArgErr;
+
+ o2u_attachCurrentThread();
+
+ VariantInit(&varResult);
+
+ // converting UNO value to OLE variant
+ DISPID dispidPut= DISPID_PROPERTYPUT;
+ dispparams.rgdispidNamedArgs = &dispidPut;
+ dispparams.cArgs = 1;
+ dispparams.cNamedArgs = 1;
+
+ dispparams.rgvarg = (VARIANTARG*)malloc(sizeof(VARIANTARG));
+
+ anyToVariant(&(dispparams.rgvarg[0]), Value);
+
+ // set OLE property
+ hr = m_pDispatch->Invoke(dispID,
+ IID_NULL,
+ LOCALE_SYSTEM_DEFAULT,
+ DISPATCH_PROPERTYPUT,
+ &dispparams,
+ &varResult,
+ &excepinfo,
+ &uArgErr);
+
+ // freeing allocated OLE parameters
+ VariantClear(&(dispparams.rgvarg[0]));
+ free(dispparams.rgvarg);
+ VariantClear(&varResult);
+
+ // lookup error code
+ switch (hr)
+ {
+ case S_OK:
+ break;
+ case DISP_E_BADPARAMCOUNT:
+ throw RuntimeException();
+ break;
+ case DISP_E_BADVARTYPE:
+ throw RuntimeException();
+ break;
+ case DISP_E_EXCEPTION:
+ throw InvocationTargetException();
+ break;
+ case DISP_E_MEMBERNOTFOUND:
+ throw UnknownPropertyException();
+ break;
+ case DISP_E_NONAMEDARGS:
+ throw RuntimeException();
+ break;
+ case DISP_E_OVERFLOW:
+ throw CannotConvertException(L"call to OLE object failed", static_cast<XInterface*>(
+ static_cast<XWeak*>(this)), TypeClass_UNKNOWN, FailReason::OUT_OF_RANGE, uArgErr);
+ break;
+ case DISP_E_PARAMNOTFOUND:
+ throw IllegalArgumentException(L"call to OLE object failed", static_cast<XInterface*>(
+ static_cast<XWeak*>(this)), uArgErr) ;
+ break;
+ case DISP_E_TYPEMISMATCH:
+ throw CannotConvertException(L"call to OLE object failed", static_cast<XInterface*>(
+ static_cast<XWeak*>(this)), TypeClass_UNKNOWN, FailReason::UNKNOWN, uArgErr);
+ break;
+ case DISP_E_UNKNOWNINTERFACE:
+ throw RuntimeException();
+ break;
+ case DISP_E_UNKNOWNLCID:
+ throw RuntimeException();
+ break;
+ case DISP_E_PARAMNOTOPTIONAL:
+ throw CannotConvertException(L"call to OLE object failed",static_cast<XInterface*>(
+ static_cast<XWeak*>(this)) , TypeClass_UNKNOWN, FailReason::NO_DEFAULT_AVAILABLE, uArgErr);
+ break;
+ default:
+ throw RuntimeException();
+ break;
+ }
+}
+
+Any IUnknownWrapper_Impl::getValueWithDispId(DISPID dispID)
+ throw (UnknownPropertyException,RuntimeException)
+{
+ Any ret;
+ HRESULT hr;
+ DISPPARAMS dispparams;
+ VARIANT varResult;
+ EXCEPINFO excepinfo;
+ unsigned int uArgErr;
+
+ o2u_attachCurrentThread();
+
+ VariantInit(&varResult);
+
+ // converting UNO parameters to OLE variants
+ dispparams.rgdispidNamedArgs = NULL;
+ dispparams.cArgs = 0;
+ dispparams.cNamedArgs = 0;
+ dispparams.rgvarg = NULL;
+
+ // invoking OLE method
+ hr = m_pDispatch->Invoke(dispID,
+ IID_NULL,
+ LOCALE_SYSTEM_DEFAULT,
+ DISPATCH_PROPERTYGET,
+ &dispparams,
+ &varResult,
+ &excepinfo,
+ &uArgErr);
+
+ // converting return value and out parameter back to UNO
+ if (hr == S_OK)
+ {
+ variantToAny(&varResult, ret);
+ }
+
+ // freeing allocated OLE parameters
+ VariantClear(&varResult);
+
+ // lookup error code
+ switch (hr)
+ {
+ case S_OK:
+ break;
+ case DISP_E_BADPARAMCOUNT:
+ throw RuntimeException();
+ break;
+ case DISP_E_BADVARTYPE:
+ throw RuntimeException();
+ break;
+ case DISP_E_EXCEPTION:
+ throw RuntimeException();
+ break;
+ case DISP_E_MEMBERNOTFOUND:
+ throw UnknownPropertyException();
+ break;
+ case DISP_E_NONAMEDARGS:
+ throw RuntimeException();
+ break;
+ case DISP_E_OVERFLOW:
+ throw RuntimeException();
+ break;
+ case DISP_E_PARAMNOTFOUND:
+ throw RuntimeException();
+ break;
+ case DISP_E_TYPEMISMATCH:
+ throw RuntimeException();
+ break;
+ case DISP_E_UNKNOWNINTERFACE:
+ throw RuntimeException();
+ break;
+ case DISP_E_UNKNOWNLCID:
+ throw RuntimeException();
+ break;
+ case DISP_E_PARAMNOTOPTIONAL:
+ throw RuntimeException();
+ break;
+ default:
+ throw RuntimeException();
+ break;
+ }
+
+ return ret;
+}
+
+
+ // --------------------------
+// XInitialization
+void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException)
+{
+ // 1.parameter is IUnknown
+ // 2.parameter is a Sequence<Type> ( not mandatory)
+ HRESULT result;
+ o2u_attachCurrentThread();
+
+ if( aArguments.getLength() == 1)
+ {
+ m_pUnknown= *(IUnknown**) aArguments[0].getValue();
+ result = m_pUnknown->QueryInterface(IID_IDispatch, (void**) &m_pDispatch);
+ m_pUnknown->AddRef();
+ }
+ else if( aArguments.getLength() == 2)
+ {
+ m_pUnknown= *(IUnknown**) aArguments[0].getValue();
+ result = m_pUnknown->QueryInterface(IID_IDispatch, (void**) &m_pDispatch);
+ m_pUnknown->AddRef();
+
+ aArguments[1] >>= m_seqTypes;
+ }
+
+}
+
+// UnoConversionUtilities --------------------------------------------------------------------------------
+Reference< XInterface > IUnknownWrapper_Impl::createUnoWrapperInstance()
+{
+ if( m_nUnoWrapperClass == INTERFACE_OLE_WRAPPER_IMPL)
+ {
+ Reference<XWeak> xWeak= static_cast<XWeak*>( new InterfaceOleWrapper_Impl(
+ m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
+ return Reference<XInterface>( xWeak, UNO_QUERY);
+ }
+ else if( m_nUnoWrapperClass == UNO_OBJECT_WRAPPER_REMOTE_OPT)
+ {
+ Reference<XWeak> xWeak= static_cast<XWeak*>( new UnoObjectWrapperRemoteOpt(
+ m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
+ return Reference<XInterface>( xWeak, UNO_QUERY);
+ }
+ else
+ return Reference<XInterface>();
+}
+Reference<XInterface> IUnknownWrapper_Impl::createComWrapperInstance()
+{
+ Reference<XWeak> xWeak= static_cast<XWeak*>( new IUnknownWrapper_Impl(
+ m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
+ return Reference<XInterface>( xWeak, UNO_QUERY);
+}
+
+
+
+void IUnknownWrapper_Impl::getMethodInfo( TypeDescription& methodInfo)
+{
+ TypeDescription desc= getInterfaceMemberDescOfCurrentCall();
+ if( desc.is())
+ {
+ typelib_TypeDescription* pMember= desc.get();
+ if( pMember->eTypeClass == TypeClass_INTERFACE_METHOD )
+ methodInfo= pMember;
+ }
+}
+
+TypeDescription IUnknownWrapper_Impl::getInterfaceMemberDescOfCurrentCall( )
+{
+ TypeDescription ret;
+ OUString usCurrentCall;
+ if( m_usCurrentInvoke.getLength())
+ {
+ usCurrentCall= m_usCurrentInvoke;
+ }
+ else
+ {
+ usCurrentCall= m_usCurrentGet;
+ }
+ OSL_ENSURE( usCurrentCall.getLength() != 0, "");
+
+ for( sal_Int32 i=0; i < m_seqTypes.getLength(); i++)
+ {
+ TypeDescription _curDesc( m_seqTypes[i]);
+ typelib_InterfaceTypeDescription * pInterface= (typelib_InterfaceTypeDescription*) _curDesc.get();
+ if( pInterface)
+ {
+ typelib_InterfaceMemberTypeDescription* pMember= NULL;
+ //find the member description of the current call
+ for( int i=0; i < pInterface->nAllMembers; i++)
+ {
+ typelib_TypeDescriptionReference* pTypeRefMember = pInterface->ppAllMembers[i];
+ typelib_TypeDescription* pDescMember= NULL;
+ TYPELIB_DANGER_GET( &pDescMember, pTypeRefMember)
+
+ typelib_InterfaceMemberTypeDescription* pInterfaceMember=
+ (typelib_InterfaceMemberTypeDescription*) pDescMember;
+ if( OUString( pInterfaceMember->pMemberName) == usCurrentCall)
+ {
+ pMember= pInterfaceMember;
+ break;
+ }
+ TYPELIB_DANGER_RELEASE( pDescMember)
+ }
+
+ if( pMember)
+ {
+ ret= (typelib_TypeDescription*)pMember;
+ TYPELIB_DANGER_RELEASE( (typelib_TypeDescription*)pMember);
+ }
+ }
+ if( ret.is())
+ break;
+ }
+ return ret;
+}
+
+sal_Bool IUnknownWrapper_Impl::isJScriptObject()
+{
+ if( m_eJScript == JScriptUndefined)
+ {
+ CComDispatchDriver disp( m_pDispatch);
+ if( disp)
+ {
+ CComVariant result;
+ if( SUCCEEDED( disp.GetPropertyByName( JSCRIPT_ID_PROPERTY, &result)))
+ {
+ if(result.vt == VT_BSTR)
+ {
+ CComBSTR name( result.bstrVal);
+ name.ToLower();
+ if( name == JSCRIPT_ID)
+ m_eJScript= IsJScript;
+ }
+ }
+ }
+ if( m_eJScript == JScriptUndefined)
+ m_eJScript= NoJScript;
+ }
+
+ return m_eJScript == NoJScript ? sal_False : sal_True;
+}
+
+// check for all changed parameter and create UNO out parameters
+void IUnknownWrapper_Impl::processOutParameters(VARIANT* pOrgParams,
+ VARIANT* pResultParams,
+ sal_uInt32 n,
+ Sequence< sal_Int16 >& OutParamIndex,
+ Sequence< Any >& OutParam)
+{
+ for (sal_uInt32 i = 0; i < n; i++)
+ {
+ VARIANT* pOrgElement = &(pOrgParams[n - (i + 1)]);
+ VARIANT* pResultElement = &(pResultParams[n - (i + 1)]);
+ Any aOutParam;
+
+ // check for changes in element
+ if (memcmp(pOrgElement, pResultElement, sizeof(VARIANT)) != 0)
+ {
+ // out parameters are only valid if the new type matches the original type
+ if (V_VT(pOrgElement) == V_VT(pResultElement))
+ {
+ variantToAny(pResultElement, aOutParam);
+ }
+ }
+
+// if (aOutParam.getReflection() != Void_getReflection())
+ if( aOutParam.getValueTypeClass() != TypeClass_VOID)
+ {
+ sal_uInt32 outParamCount = OutParam.getLength() + 1;
+
+ OutParam.realloc(outParamCount);
+ OutParamIndex.realloc(outParamCount);
+
+ OutParam.getArray()[outParamCount - 1] = aOutParam;
+ OutParamIndex.getArray()[outParamCount - 1] = i;
+ }
+ }
+}
+
+
+// It would be desirable if every COM component could handle parameters of VT_BYREF be it
+// in or out parameter. But that is not the case. When calling an ATL component that
+// has a dual interface then note this:
+// - in parameter can be VT_BYREF
+// - in parameter of VARIANT: one can pass the exact type
+// - out parameter: one must pass the exact type
+// - out parameter of VARIANT: the referenced VARIANT must be VT_EMPTY
+// - inout - the same as out
+Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(DISPID dispID,
+ const Sequence< Any >& Params,
+ Sequence< sal_Int16 >& OutParamIndex,
+ Sequence< Any >& OutParam)
+ throw ( IllegalArgumentException, CannotConvertException,
+ InvocationTargetException, RuntimeException)
+{
+ Any ret;
+ HRESULT result;
+
+ DISPPARAMS dispparams;
+ CComVariant varResult;
+ EXCEPINFO excepinfo;
+ unsigned int uArgErr;
+ sal_uInt32 i;
+
+ o2u_attachCurrentThread();
+
+ // converting UNO parameters to OLE variants
+ dispparams.rgdispidNamedArgs = NULL;
+ dispparams.cArgs = Params.getLength();
+ dispparams.cNamedArgs = 0;
+
+ CComVariant* arArgs = NULL;
+ CComVariant* arRefArgs= NULL; // referenced arguments
+
+ if (dispparams.cArgs == 0)
+ {
+ dispparams.rgvarg = NULL;
+ }
+ else
+ {
+ arArgs = new CComVariant[dispparams.cArgs];
+ arRefArgs= new CComVariant[dispparams.cArgs];
+
+ // converting orginal parameters
+ // if the object uses ATL with a dual interface, then VT_VARIANT| VT_BYREF does not suffice
+// prepareOutParams( orgArgs, dispparams.cArgs);
+ getParameterInfo();
+
+ for (i = 0; i < dispparams.cArgs; i++)
+ {
+ sal_Int32 revIndex= dispparams.cArgs - i -1;
+ arRefArgs[revIndex].byref=0;
+ // out param
+ if (m_seqCurrentParamTypes[i] & PARAMFLAG_FOUT &&
+ ! (m_seqCurrentParamTypes[i] & PARAMFLAG_FIN) )
+ {
+ VARTYPE type= m_seqCurrentVartypes[i] ^ VT_BYREF;
+ if( type == VT_VARIANT )
+ {
+ arArgs[revIndex].vt= VT_VARIANT | VT_BYREF;
+ arArgs[revIndex].byref= &arRefArgs[revIndex];
+ }
+ else
+ {
+ arRefArgs[revIndex].vt= type;
+ arArgs[revIndex].vt= m_seqCurrentVartypes[i];
+ arArgs[revIndex].byref= &arRefArgs[revIndex].byref;
+ }
+ }
+ // in/out param
+ else if( m_seqCurrentParamTypes[i] & PARAMFLAG_FOUT&&
+ m_seqCurrentParamTypes[i] & PARAMFLAG_FIN)
+ {
+ VARTYPE type= m_seqCurrentVartypes[i] ^ VT_BYREF;
+ CComVariant var;
+ anyToVariant( &arRefArgs[revIndex],
+ Params.getConstArray()[i]);
+
+ if( type == VT_VARIANT )
+ {
+ arArgs[revIndex].vt= VT_VARIANT | VT_BYREF;
+ arArgs[revIndex].byref= &arRefArgs[revIndex];
+ }
+ else
+ {
+ arArgs[revIndex].vt= arRefArgs[revIndex].vt | VT_BYREF;
+ arArgs[revIndex].byref= &arRefArgs[revIndex].byref;
+ }
+ }
+ // in/param
+ else if( m_seqCurrentParamTypes[i] & PARAMFLAG_FIN &&
+ ! (m_seqCurrentParamTypes[i] & PARAMFLAG_FOUT))
+ {
+ if( m_seqCurrentVartypes[i] & VT_BYREF)
+ anyToVariant( &arRefArgs[revIndex],
+ Params.getConstArray()[i]);
+ else
+ anyToVariant( &arArgs[revIndex],
+ Params.getConstArray()[i]);
+ }
+
+ }
+ }
+ dispparams.rgvarg= arArgs;
+ // invoking OLE method
+ result = m_pDispatch->Invoke(dispID,
+ IID_NULL,
+ LOCALE_SYSTEM_DEFAULT,
+ DISPATCH_METHOD | DISPATCH_PROPERTYGET,
+ &dispparams,
+ &varResult,
+ &excepinfo,
+ &uArgErr);
+
+ // converting return value and out parameter back to UNO
+ if (result == S_OK)
+ {
+ if ( m_seqCurrentParamTypes.getLength())
+ {
+ // allocate space for the out param Sequence and indices Sequence
+ sal_Int32 outParamsCount= 0; // includes in/out parameter
+ for( sal_Int32 iparams=0; iparams < m_seqCurrentParamTypes.getLength(); iparams++)
+ {
+ if( m_seqCurrentParamTypes[iparams] & PARAMFLAG_FOUT)
+ outParamsCount++;
+ }
+
+ OutParamIndex.realloc( outParamsCount);
+ OutParam.realloc( outParamsCount);
+
+ sal_Int32 outParamIndex=0;
+ for( sal_Int32 i=0; i < m_seqCurrentParamTypes.getLength(); i ++)
+ {
+ if( m_seqCurrentParamTypes[i] & PARAMFLAG_FOUT)
+ {
+ OutParamIndex[outParamIndex]= i;
+ variantToAny( &arRefArgs[dispparams.cArgs - i -1], OutParam[outParamIndex] );
+ outParamIndex++;
+ }
+ }
+ }
+ // Return value
+ variantToAny(&varResult, ret);
+ }
+
+ // lookup error code
+ switch (result)
+ {
+ case S_OK:
+ break;
+ case DISP_E_BADPARAMCOUNT:
+ throw IllegalArgumentException();
+ break;
+ case DISP_E_BADVARTYPE:
+ throw RuntimeException();
+ break;
+ case DISP_E_EXCEPTION:
+ throw InvocationTargetException();
+ break;
+ case DISP_E_MEMBERNOTFOUND:
+ throw IllegalArgumentException();
+ break;
+ case DISP_E_NONAMEDARGS:
+ throw IllegalArgumentException();
+ break;
+ case DISP_E_OVERFLOW:
+ throw CannotConvertException(L"call to OLE object failed", static_cast<XInterface*>(
+ static_cast<XWeak*>(this)), TypeClass_UNKNOWN, FailReason::OUT_OF_RANGE, uArgErr);
+ break;
+ case DISP_E_PARAMNOTFOUND:
+ throw IllegalArgumentException(L"call to OLE object failed", static_cast<XInterface*>(
+ static_cast<XWeak*>(this)), uArgErr);
+ break;
+ case DISP_E_TYPEMISMATCH:
+ throw CannotConvertException(L"call to OLE object failed",static_cast<XInterface*>(
+ static_cast<XWeak*>(this)) , TypeClass_UNKNOWN, FailReason::UNKNOWN, uArgErr);
+ break;
+ case DISP_E_UNKNOWNINTERFACE:
+ throw RuntimeException() ;
+ break;
+ case DISP_E_UNKNOWNLCID:
+ throw RuntimeException() ;
+ break;
+ case DISP_E_PARAMNOTOPTIONAL:
+ throw CannotConvertException(L"call to OLE object failed", static_cast<XInterface*>(
+ static_cast<XWeak*>(this)), TypeClass_UNKNOWN, FailReason::NO_DEFAULT_AVAILABLE, uArgErr);
+ break;
+ default:
+ throw RuntimeException();
+ break;
+ }
+
+ return ret;
+}
+// parameter is an array that contains the referenced parameters
+// params is an array of VARIANTs that contains values which are referenced by
+// the VARIANTS in DISPPARAMS::rgvarg
+//sal_Bool IUnknownWrapper_Impl::prepareOutParams( VARIANT* params, sal_uInt32 count )
+//{
+// sal_Bool ret= sal_True;
+// ITypeInfo* pType= getTypeInfo();
+// if(! pType )
+// return sal_False;
+// // build the map of function names and their tlb index
+// if( sal_False == isComTlbIndex())
+// buildComTlbIndex();
+//
+// typedef TLBFuncIndexMap::const_iterator cit;
+// cit itIndex= m_mapComFunc.find( m_usCurrentInvoke );
+// if( itIndex != m_mapComFunc.end())
+// {
+// FUNCDESC* funcDesc= NULL;
+// if( SUCCEEDED( pType->GetFuncDesc( itIndex->second, &funcDesc)))
+// {
+// m_seqCurrentParamTypes.realloc( funcDesc->cParams);
+// // Examine each param
+// for( sal_Int16 iparams= 0; iparams < funcDesc->cParams; iparams++)
+// {
+// sal_Int32 flags= funcDesc->lprgelemdescParam->paramdesc.wParamFlags;
+//
+// // out parameter
+// if( flags & PARAMFLAG_FOUT &&
+// ! (flags & PARAMFLAG_FIN))
+// {
+// m_seqCurrentParamTypes[ iparams]= (sal_Int32) OUT_PARAM;
+// VariantClear( &params[iparams] );
+// params[ iparams].byref=0;
+// // Get the type
+// VARTYPE paramType;
+// if( getElementTypeDesc( & funcDesc->lprgelemdescParam[iparams].tdesc, paramType))
+// {
+// // dispparams: VT_VARIANT |VT_BYREF , referenced Value: VT_EMPTY
+// if( !( paramType & VT_ARRAY) &&
+// (paramType & VT_TYPEMASK) == VT_VARIANT)
+// params[iparams].vt= VT_EMPTY;
+// else
+// params[iparams].vt= (paramType ^ VT_BYREF);
+// }
+// else
+// ret= sal_False;
+// }
+// // in/out parameter
+// else if(flags & PARAMFLAG_FIN && flags & PARAMFLAG_FOUT )
+// m_seqCurrentParamTypes[ iparams]= (sal_Int32) INOUT_PARAM;
+// // in parameter
+// else if(flags & PARAMFLAG_FIN && ! (flags & PARAMFLAG_FOUT ))
+// m_seqCurrentParamTypes[ iparams]= (sal_Int32) IN_PARAM;
+// }
+// pType->ReleaseFuncDesc( funcDesc);
+// }
+// else
+// ret= sal_False;
+// }
+// else
+// ret= sal_False;
+//
+// return ret;
+//}
+
+sal_Bool IUnknownWrapper_Impl::getParameterInfo()
+{
+ sal_Bool ret= sal_True;
+ ITypeInfo* pType= getTypeInfo();
+ if(! pType )
+ return sal_False;
+ // build the map of function names and their tlb index
+ if( sal_False == isComTlbIndex())
+ buildComTlbIndex();
+
+ typedef TLBFuncIndexMap::const_iterator cit;
+ cit itIndex= m_mapComFunc.find( m_usCurrentInvoke );
+ if( itIndex != m_mapComFunc.end())
+ {
+ FUNCDESC* funcDesc= NULL;
+ if( SUCCEEDED( pType->GetFuncDesc( itIndex->second, &funcDesc)))
+ {
+ m_seqCurrentParamTypes.realloc( funcDesc->cParams);
+ m_seqCurrentVartypes.realloc( funcDesc->cParams);
+ // Examine each param
+ for( sal_Int16 iparams= 0; iparams < funcDesc->cParams; iparams++)
+ {
+ sal_Int32 flags= funcDesc->lprgelemdescParam[iparams].paramdesc.wParamFlags;
+ m_seqCurrentParamTypes[iparams]= flags & ( PARAMFLAG_FIN | PARAMFLAG_FOUT);
+
+ if( ! getElementTypeDesc( & funcDesc->lprgelemdescParam[iparams].tdesc,
+ m_seqCurrentVartypes[iparams]))
+ ret= sal_False;
+
+ if( ! ret) break;
+ }
+ pType->ReleaseFuncDesc( funcDesc);
+ }
+ else
+ ret= sal_False;
+ }
+ else
+ ret= sal_False;
+
+ return ret;
+}
+
+sal_Bool IUnknownWrapper_Impl::getElementTypeDesc( TYPEDESC *desc, VARTYPE& varType )
+{
+ sal_Bool ret= sal_True;
+ VARTYPE _type;
+
+ if( desc->vt == VT_PTR)
+ {
+ if( getElementTypeDesc( desc->lptdesc, _type))
+ varType= _type | VT_BYREF;
+ else
+ ret= sal_False;
+ }
+ else if( desc->vt == VT_SAFEARRAY )
+ {
+ if( getElementTypeDesc( desc->lptdesc, _type))
+ varType= _type | VT_ARRAY;
+ else
+ sal_False;
+ }
+ else
+ {
+ varType= desc->vt;
+ }
+ return ret;
+}
+
+sal_Bool IUnknownWrapper_Impl::buildComTlbIndex()
+{
+ sal_Bool ret= sal_True;
+
+ ITypeInfo* pType= getTypeInfo();
+ if( pType)
+ {
+ TYPEATTR* typeAttr= NULL;
+ if( SUCCEEDED( pType->GetTypeAttr( &typeAttr)))
+ {
+ for( long i= 0; i < typeAttr->cFuncs; i++)
+ {
+ FUNCDESC* funcDesc= NULL;
+ if( SUCCEEDED( pType->GetFuncDesc( i, &funcDesc)))
+ {
+ BSTR memberName= NULL;
+ unsigned int pcNames=0;
+ if( SUCCEEDED(pType->GetNames( funcDesc->memid, & memberName, 1, &pcNames)))
+ {
+ m_mapComFunc.insert( TLBFuncIndexMap::value_type( OUString( memberName), i));
+ SysFreeString( memberName);
+ }
+ else
+ ret= sal_False;
+ pType->ReleaseFuncDesc( funcDesc);
+ }
+ else
+ ret=sal_False;
+ }
+ pType->ReleaseTypeAttr( typeAttr);
+ }
+ else
+ ret= sal_False;
+ }
+ else
+ ret= sal_False;
+ return ret;
+}
+
+inline sal_Bool IUnknownWrapper_Impl::isComTlbIndex()
+{
+ if( m_mapComFunc.size())
+ return sal_True;
+ return sal_False;
+}
+
+ITypeInfo* IUnknownWrapper_Impl::getTypeInfo()
+{
+ HRESULT hr= S_OK;
+ if( !m_pDispatch)
+ return NULL;
+
+ if( !m_spTypeInfo )
+ {
+ LCID localId= GetUserDefaultLCID();
+ CComPtr< ITypeInfo > spType;
+ if( SUCCEEDED( m_pDispatch->GetTypeInfo( 0, localId, &spType.p)))
+ m_spTypeInfo= spType;
+ }
+ return m_spTypeInfo;
+}
+} // end namespace
+
diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx
new file mode 100644
index 000000000..8557d9aa7
--- /dev/null
+++ b/extensions/source/ole/oleobjw.hxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * $RCSfile: oleobjw.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef __OLEOBJW_HXX
+#define __OLEOBJW_HXX
+#include "ole2uno.hxx"
+
+#include <tools/presys.h>
+#include "stdafx.h"
+#include <vector>
+#include <hash_map>
+#include <tools/postsys.h>
+
+#ifndef _CPPUHELPER_IMPLBASE3_HXX_
+#include <cppuhelper/implbase3.hxx>
+#endif
+#include <com/sun/star/lang/XInitialization.hpp>
+#ifndef _RTL_USTRING_
+#include <rtl/ustring>
+#endif
+
+#include <typelib/typedescription.hxx>
+#include "unoconversionutilities.hxx"
+
+using namespace cppu;
+using namespace rtl;
+using namespace std;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::bridge;
+
+namespace ole_adapter
+{
+
+
+
+typedef hash_map<OUString, pair<DISPID, unsigned short>, hashOUString_Impl, equalOUString_Impl> DispIdMap;
+
+typedef hash_map<OUString, unsigned int, hashOUString_Impl, equalOUString_Impl> TLBFuncIndexMap;
+
+// This class wraps an IDispatch and maps XInvocation calls to IDispatch calls on the wrapped object.
+// If m_TypeDescription is set then this class represents an UNO interface implemented in a COM component.
+// The interface is not a real interface in terms of an abstract class but is realized through IDispatch.
+class IUnknownWrapper_Impl : public WeakImplHelper3<XInvocation, XBridgeSupplier2, XInitialization>,
+ public UnoConversionUtilities<IUnknownWrapper_Impl>
+
+{
+public:
+ IUnknownWrapper_Impl(Reference<XMultiServiceFactory> &xFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass);
+
+ ~IUnknownWrapper_Impl();
+
+ // XIdlClassProvider
+// virtual Sequence< Reference<XIdlClass > > getIdlClasses( void );
+
+ // XInvokation
+ virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection( ) throw(RuntimeException);
+ virtual Any SAL_CALL invoke( const OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw(IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException);
+ virtual void SAL_CALL setValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException);
+ virtual Any SAL_CALL getValue( const OUString& aPropertyName ) throw(UnknownPropertyException, RuntimeException);
+ virtual sal_Bool SAL_CALL hasMethod( const OUString& aName ) throw(RuntimeException);
+ virtual sal_Bool SAL_CALL hasProperty( const OUString& aName ) throw(RuntimeException);
+
+ // XBridgeSupplier2
+ // This interface is implemented to provide a safe way to obtain the original
+ // IUnknown or IDispatch within the function anyToVariant. The function asks
+ // every UNO object for its XBridgeSupplier and if it is available uses it to convert
+ // the object with its own supplier.
+ virtual Any SAL_CALL createBridge( const Any& modelDepObject, const Sequence< sal_Int8 >& aProcessId, sal_Int16 sourceModelType, sal_Int16 destModelType ) throw(IllegalArgumentException, RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
+
+ // XUnoTunnel ------------------------------------------------------------------------------------------
+// virtual sal_Int64 SAL_CALL getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw( RuntimeException);
+
+ // Helper for XUnoTunnel --------------------------------------------------------------------------------
+// static Sequence<sal_Int8> getUnoTunnelId();
+
+ virtual Any invokeWithDispIdUnoTlb(DISPID dispID, const Sequence< Any >& Params, Sequence<sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException);
+ // Is used for OleClient service
+ virtual Any invokeWithDispIdComTlb(DISPID dispID,
+ const Sequence< Any >& Params,
+ Sequence< sal_Int16 >& OutParamIndex,
+ Sequence< Any >& OutParam)
+ throw ( IllegalArgumentException, CannotConvertException,
+ InvocationTargetException, RuntimeException);
+ void processOutParameters( VARIANT* pOrgParams,
+ VARIANT* pResultParams,
+ sal_uInt32 n,
+ Sequence< sal_Int16 >& OutParamIndex,
+ Sequence< Any >& OutParam);
+
+ virtual void setValueWithDispId(DISPID dispID, const Any& Value) throw ( UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException);
+ virtual Any getValueWithDispId(DISPID dispID) throw (UnknownPropertyException, RuntimeException );
+
+
+ // UnoConversionUtilities -------------------------------------------------------------------------------
+ virtual Reference<XInterface> createUnoWrapperInstance();
+ virtual Reference<XInterface> createComWrapperInstance();
+protected:
+
+ // These functions are for the case if an object of this class wraps an IDispatch
+ // object that implements UNO interfaces. In that case the member m_seqTypes
+ // is set through XInitialization::initialize.
+ void getMethodInfo( TypeDescription& methodDescription);
+ // used by get MethodInfo
+ TypeDescription getInterfaceMemberDescOfCurrentCall( );
+ ITypeInfo* getTypeInfo();
+
+
+ // Gets information about the parameter types ( VARTYPE) and mode ( in, out, in/out)
+ sal_Bool getParameterInfo();
+ // analyses the type information provided by the COM component and saves the idizes of the
+ // out and in/out parameter in the member m_outIndizes
+// sal_Bool prepareOutParams( VARIANT* params, sal_uInt32 count );
+ // Builds up the complete vartype from a TYPEDESC, e.g VT_BSTR, VT_BYREF | VT_I4, VT_BYREF|VT_ARRAY|VT_I1
+ sal_Bool getElementTypeDesc( TYPEDESC *desc, VARTYPE& varType );
+ // Iterates over all functions and put the names and indices into a map (TLBFuncIndexMap)
+ sal_Bool buildComTlbIndex();
+ // Determines whether the map m_mapComFunc has already been set up
+ sal_Bool isComTlbIndex();
+
+ // The information is necessary for getReturnType and getOutParameterType because they obtain
+ // the information for the current call on Invocation.
+ void setCurrentInvokeCall( const OUString& name){ m_usCurrentGet=L""; m_usCurrentInvoke= name;}
+ void setCurrentGetCall( const OUString& name){ m_usCurrentInvoke= L""; m_usCurrentGet= name;}
+
+ // Finds out wheter the wrapped IDispatch is an JScript Object. This is is done by
+ // asking for the property "_environment". If it has the value "JScript" ( case insensitive)
+ // then the IDispatch is considered a JScript object.
+ sal_Bool isJScriptObject();
+ // -------------------------------------------------------------------------------
+
+// void processOutParameters( VARIANT* pOrgParams,
+// VARIANT* pResultParams,
+// sal_uInt32 n,
+// Sequence< sal_Int16 >& OutParamIndex,
+// Sequence< Any >& OutParam);
+
+
+
+ DispIdMap::iterator getDispIdEntry(const OUString& name);
+ // If UNO interfaces are being implemented in JScript objects, VB or C++ COM objects
+ // and those are passed as parameter to a UNO interface function, then
+ // the IDispatch* are wrapped by objects of this class. Assuming that the functions
+ // implemented by the IDispatch object returns another UNO interface then
+ // it has to be wrapped to this type. But this is only possible if an object of this
+ // wrapper class knows what type it is represting. The member m_TypeDescription holds this
+ // information.
+ // m_TypeDescription is only useful when an object wrapps an IDispatch object that implements
+ // an UNO interface. The value is set during a call to XInitialization::initialize.
+ Sequence<Type> m_seqTypes;
+ IUnknown* m_pUnknown;
+ IDispatch* m_pDispatch;
+ DispIdMap m_dispIdMap;
+ Reference<XIdlClass>* m_pxIdlClass;
+ Mutex m_mutex;
+
+ // see prepare OutParams
+ Sequence< sal_Int16 > m_seqOutIndizes;
+ // The name of the function being executed ( invoke)
+ OUString m_usCurrentInvoke;
+ // The name of the property being retrieved ( getValue)
+ OUString m_usCurrentGet;
+ // used by isJScriptObject
+ enum JScriptDetermination{ JScriptUndefined=0, NoJScript, IsJScript};
+ JScriptDetermination m_eJScript;
+ // The map is filled by buildComTlbIndex and
+ TLBFuncIndexMap m_mapComFunc;
+ // Keeps the ITypeInfo obtained from IDispatch::GetTypeInfo
+ CComPtr< ITypeInfo > m_spTypeInfo;
+ // keeps the modes of parameters of the current function call
+ // These values correspond to Windows PARAMFLAGS constants ( PARAMFLAG_FIN, PARAMFLAG_FOUT)
+ // The Sequence contains only the in and out flag
+ Sequence< sal_Int32> m_seqCurrentParamTypes;
+ // contains the VARTYPES of the parameters of the current call
+ Sequence<sal_uInt16> m_seqCurrentVartypes;
+
+};
+
+} // end namespace
+#endif
+
diff --git a/extensions/source/ole/olethread.cxx b/extensions/source/ole/olethread.cxx
new file mode 100644
index 000000000..b1f617581
--- /dev/null
+++ b/extensions/source/ole/olethread.cxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * $RCSfile: olethread.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#if defined _MSC_VER && ( _MSC_VER >= 1200 )
+#define _WIN32_WINNT 0x0400
+#endif
+
+#include "ole2uno.hxx"
+
+#include <tools/presys.h>
+#include <hash_map>
+#include <tools/postsys.h>
+
+#include <vos/thread.hxx>
+
+using namespace vos;
+using namespace std;
+
+namespace ole_adapter
+{
+// CoInitializeEx *
+typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInitEx)( LPVOID, DWORD);
+// CoInitialize *
+typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *ptrCoInit)( LPVOID);
+
+void o2u_attachCurrentThread()
+{
+ static OThreadData oleThreadData;
+
+ if ((sal_Bool)oleThreadData.getData() != sal_True)
+ {
+ HINSTANCE inst= LoadLibrary( _T("ole32.dll"));
+ if( inst )
+ {
+ HRESULT hr;
+ // Try DCOM
+ ptrCoInitEx initFuncEx= (ptrCoInitEx)GetProcAddress( inst, _T("CoInitializeEx"));
+ if( initFuncEx)
+ hr= initFuncEx( NULL, COINIT_MULTITHREADED);
+ // No DCOM, try COM
+ else
+ {
+ ptrCoInit initFunc= (ptrCoInit)GetProcAddress( inst,_T("CoInitialize"));
+ if( initFunc)
+ hr= initFunc( NULL);
+ }
+ }
+ oleThreadData.setData((void*)sal_True);
+ }
+}
+
+} // end namespace
diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
new file mode 100644
index 000000000..bb1622470
--- /dev/null
+++ b/extensions/source/ole/servprov.cxx
@@ -0,0 +1,898 @@
+/*************************************************************************
+ *
+ * $RCSfile: servprov.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <vos/mutex.hxx>
+
+#include "ole2uno.hxx"
+#include "unoconversionutilities.hxx"
+#include "servprov.hxx"
+ //#include <vos/xception.hxx>
+#include "unoobjw.hxx"
+#include "oleobjw.hxx"
+
+
+using namespace std;
+using namespace cppu;
+using namespace rtl;
+using namespace osl;
+using namespace vos;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::bridge;
+using namespace com::sun::star::bridge::ModelDependent;
+
+
+//#define INVOCATION_SERVICE L"com.sun.star.script.Invocation"
+
+namespace ole_adapter
+{
+
+#include <initguid.h>
+// prior 5.2 ( src569 ver m)
+// {3ECF78F0-B149-11D2-8EBE-00105AD848AF}
+//DEFINE_GUID(OID_ServiceManager, 0x3ECF78F0, 0xB149, 0x11d2, 0x8E, 0xBE, 0x00, 0x10, 0x5A, 0xD8, 0x48, 0xAF);
+
+// GUID used since 5.2 ( src569 m)
+// {82154420-0FBF-11d4-8313-005004526AB4}
+DEFINE_GUID(OID_ServiceManager, 0x82154420, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50, 0x4, 0x52, 0x6a, 0xb4);
+
+
+
+static Reference<XMultiServiceFactory> xMultiServiceFactory;
+static Reference<XRegistryKey> xRegistryKey;
+
+Reference<XMultiServiceFactory> o2u_getMultiServiceFactory()
+{
+ return xMultiServiceFactory;
+}
+
+Reference<XRegistryKey> o2u_getRegistryKey()
+{
+ return xRegistryKey;
+}
+
+extern OMutex globalWrapperMutex;
+Reference<XSingleServiceFactory> getInvocationFactory()
+{
+ OGuard aGuard(globalWrapperMutex);
+ static Reference<XSingleServiceFactory> factory= Reference<XSingleServiceFactory>(o2u_getMultiServiceFactory()->createInstance( INVOCATION_SERVICE), UNO_QUERY);
+ return factory;
+}
+
+/*****************************************************************************
+
+ class implementation ProviderOleWrapper_Impl
+
+*****************************************************************************/
+
+ProviderOleWrapper_Impl::ProviderOleWrapper_Impl(const Reference<XSingleServiceFactory>& xSFact, GUID* pGuid)
+ : m_xSingleServiceFactory(xSFact)
+{
+ m_guid = *pGuid;
+
+ Reference<XInterface> xInt = o2u_getMultiServiceFactory()->createInstance(L"com.sun.star.bridge.OleBridgeSupplier2");
+
+ if (xInt.is())
+ {
+ Any a= xInt->queryInterface( ::getCppuType( reinterpret_cast<
+ Reference< XBridgeSupplier2>* >(0)));
+ a >>= m_bridgeSupplier;
+
+ }
+}
+
+ProviderOleWrapper_Impl::~ProviderOleWrapper_Impl()
+{
+}
+
+sal_Bool ProviderOleWrapper_Impl::registerClass()
+{
+ HRESULT hresult;
+
+ o2u_attachCurrentThread();
+
+ hresult = CoRegisterClassObject(
+ m_guid,
+ this,
+ CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
+ REGCLS_MULTIPLEUSE,
+ &m_factoryHandle);
+
+ return (hresult == NOERROR);
+}
+
+sal_Bool ProviderOleWrapper_Impl::deregisterClass()
+{
+ HRESULT hresult = CoRevokeClassObject(m_factoryHandle);
+
+ return (hresult == NOERROR);
+}
+
+STDMETHODIMP ProviderOleWrapper_Impl::QueryInterface(REFIID riid, void FAR* FAR* ppv)
+{
+ if(IsEqualIID(riid, IID_IUnknown))
+ {
+ AddRef();
+ *ppv = (IUnknown*) (IClassFactory*) this;
+ return NOERROR;
+ }
+ else if (IsEqualIID(riid, IID_IClassFactory))
+ {
+ AddRef();
+ *ppv = (IClassFactory*) this;
+ return NOERROR;
+ }
+
+ *ppv = NULL;
+ return ResultFromScode(E_NOINTERFACE);
+}
+
+STDMETHODIMP_(ULONG) ProviderOleWrapper_Impl::AddRef()
+{
+ return osl_incrementInterlockedCount( &m_refCount);
+}
+
+STDMETHODIMP_(ULONG) ProviderOleWrapper_Impl::Release()
+{
+ MutexGuard aGuard( Mutex::getGlobalMutex());
+ m_refCount--;
+ if (m_refCount == 0)
+ {
+ delete this;
+ }
+
+ return m_refCount;
+}
+
+STDMETHODIMP ProviderOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter,
+ REFIID riid,
+ void FAR* FAR* ppv)
+{
+ HRESULT ret = ResultFromScode(E_UNEXPECTED);
+ punkOuter = NULL;
+
+ Reference<XInterface> xInstance;
+
+ if (m_xSingleServiceFactory.is())
+ {
+ xInstance = m_xSingleServiceFactory->createInstance();
+
+ if (xInstance.is())
+ {
+ Any usrAny(&xInstance, getCppuType( & xInstance));
+
+ sal_uInt8 arId[16];
+ rtl_getGlobalProcessId( arId );
+ Any oleAny = m_bridgeSupplier->createBridge(usrAny,
+ Sequence<sal_Int8>((sal_Int8*)arId, 16),
+ UNO,
+ OLE);
+
+
+ if (oleAny.getValueTypeClass() == getCppuType( (sal_uInt32 *)0).getTypeClass())
+ {
+ VARIANT* pVariant = (VARIANT*)oleAny.getValue();
+
+ if ((pVariant->vt == VT_UNKNOWN) || (pVariant->vt == VT_DISPATCH))
+ {
+ ret = pVariant->punkVal->QueryInterface(riid, ppv);
+ }
+
+ VariantClear(pVariant);
+ CoTaskMemFree(pVariant);
+ }
+ }
+ }
+
+ return ret;
+}
+
+STDMETHODIMP ProviderOleWrapper_Impl::LockServer(int fLock)
+{
+ return NOERROR;
+}
+
+/*****************************************************************************
+
+ class implementation OneInstanceOleWrapper_Impl
+
+*****************************************************************************/
+
+OneInstanceOleWrapper_Impl::OneInstanceOleWrapper_Impl(const Reference<XInterface>& xInst, GUID* pGuid)
+ : m_xInst(xInst)
+{
+ m_guid = *pGuid;
+
+ Reference<XInterface> xInt = o2u_getMultiServiceFactory()->createInstance(L"com.sun.star.bridge.OleBridgeSupplier2");
+
+ if (xInt.is())
+ {
+ Any a= xInt->queryInterface( getCppuType(
+ reinterpret_cast< Reference<XBridgeSupplier2>*>(0)));
+ a >>= m_bridgeSupplier;
+ }
+}
+
+OneInstanceOleWrapper_Impl::~OneInstanceOleWrapper_Impl()
+{
+}
+
+sal_Bool OneInstanceOleWrapper_Impl::registerClass()
+{
+ HRESULT hresult;
+
+ o2u_attachCurrentThread();
+
+ hresult = CoRegisterClassObject(
+ m_guid,
+ this,
+ CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
+ REGCLS_MULTIPLEUSE,
+ &m_factoryHandle);
+
+ return (hresult == NOERROR);
+}
+
+sal_Bool OneInstanceOleWrapper_Impl::deregisterClass()
+{
+ HRESULT hresult = CoRevokeClassObject(m_factoryHandle);
+
+ return (hresult == NOERROR);
+}
+
+STDMETHODIMP OneInstanceOleWrapper_Impl::QueryInterface(REFIID riid, void FAR* FAR* ppv)
+{
+ if(IsEqualIID(riid, IID_IUnknown))
+ {
+ AddRef();
+ *ppv = (IUnknown*) (IClassFactory*) this;
+ return NOERROR;
+ }
+ else if (IsEqualIID(riid, IID_IClassFactory))
+ {
+ AddRef();
+ *ppv = (IClassFactory*) this;
+ return NOERROR;
+ }
+
+ *ppv = NULL;
+ return ResultFromScode(E_NOINTERFACE);
+}
+
+STDMETHODIMP_(ULONG) OneInstanceOleWrapper_Impl::AddRef()
+{
+ return osl_incrementInterlockedCount( &m_refCount);
+}
+
+STDMETHODIMP_(ULONG) OneInstanceOleWrapper_Impl::Release()
+{
+
+ MutexGuard oGuard( Mutex::getGlobalMutex());
+ m_refCount--;
+ if ( m_refCount == 0)
+ {
+ delete this;
+ }
+
+ return m_refCount;
+}
+
+STDMETHODIMP OneInstanceOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter,
+ REFIID riid,
+ void FAR* FAR* ppv)
+{
+ HRESULT ret = ResultFromScode(E_UNEXPECTED);
+ punkOuter = NULL;
+
+ if (m_xInst.is())
+ {
+ Any usrAny(&m_xInst, getCppuType( &m_xInst));
+ sal_uInt8 arId[16];
+ rtl_getGlobalProcessId( arId);
+ Any oleAny = m_bridgeSupplier->createBridge(usrAny,
+ Sequence<sal_Int8>( (sal_Int8*)arId, 16),
+ UNO,
+ OLE);
+
+
+ if (oleAny.getValueTypeClass() == TypeClass_UNSIGNED_LONG)
+ {
+ VARIANT* pVariant = *(VARIANT**)oleAny.getValue();
+
+ if ((pVariant->vt == VT_UNKNOWN) || (pVariant->vt == VT_DISPATCH))
+ {
+ ret = pVariant->punkVal->QueryInterface(riid, ppv);
+ }
+
+ VariantClear(pVariant);
+ CoTaskMemFree(pVariant);
+ }
+ }
+
+ return ret;
+}
+
+STDMETHODIMP OneInstanceOleWrapper_Impl::LockServer(int fLock)
+{
+ return NOERROR;
+}
+
+
+/*****************************************************************************
+
+ class implementation OleConverter_Impl2
+
+*****************************************************************************/
+
+OleConverter_Impl2::OleConverter_Impl2()
+
+{
+}
+
+// The XMultiServiceFactory is later set by XInitialization
+OleConverter_Impl2::OleConverter_Impl2( sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass ):
+ UnoConversionUtilities<OleConverter_Impl2>( unoWrapperClass, comWrapperClass )
+
+{
+}
+
+OleConverter_Impl2::~OleConverter_Impl2()
+{
+}
+
+// XBridgeSupplier --------------------------------------------------------------
+Any SAL_CALL OleConverter_Impl2::createBridge(const Any& modelDepObject,
+ const Sequence< sal_Int8 >& ProcessId,
+ sal_Int16 sourceModelType,
+ sal_Int16 destModelType)
+ throw (IllegalArgumentException,
+ RuntimeException )
+{
+ Any ret;
+ sal_uInt8 arId[16];
+ rtl_getGlobalProcessId( arId );
+
+ Sequence< sal_Int8 > seqProcessId( (sal_Int8*)arId, 16);
+
+ if ( seqProcessId == ProcessId)
+ {
+ if (sourceModelType == UNO)
+ {
+ if (destModelType == UNO)
+ {
+ // same model -> copy value only
+ ret = modelDepObject;
+ }
+ else if (destModelType == OLE)
+ {
+ // convert UNO any into variant
+ VARIANT* pVariant = (VARIANT*) CoTaskMemAlloc(sizeof(VARIANT));
+ VariantInit( pVariant);
+ if (! anyToVariant( pVariant, modelDepObject))
+ {
+ CoTaskMemFree(pVariant);
+ throw IllegalArgumentException();
+ }
+ else
+ {
+ ret.setValue((void*) &pVariant, getCppuType((sal_uInt32*)0));
+ }
+ }
+ else
+ throw IllegalArgumentException();
+ }
+ else if (sourceModelType == OLE)
+ {
+ if (modelDepObject.getValueType() != getCppuType((sal_uInt32*)0))
+ {
+ throw IllegalArgumentException();
+ }
+ else if (destModelType == OLE)
+ {
+ // same model -> copy value only
+ VARIANT* pVariant = (VARIANT*) CoTaskMemAlloc(sizeof(VARIANT));
+
+ if (NOERROR != VariantCopy(pVariant, (VARIANT*)modelDepObject.getValue()))
+ {
+ CoTaskMemFree(pVariant);
+ throw(IllegalArgumentException());
+ }
+ else
+ {
+ ret.setValue((void*) &pVariant, getCppuType((sal_uInt32*)0));
+ }
+ }
+ else if (destModelType == UNO)
+ {
+ // convert variant into UNO any
+ VARIANT* pVariant = (VARIANT*)modelDepObject.getValue();
+
+ if (!variantToAny(pVariant, ret))
+ {
+ throw IllegalArgumentException();
+ }
+ }
+ else
+ throw IllegalArgumentException();
+
+ }
+ else
+ throw IllegalArgumentException();
+ }
+
+ return ret;
+}
+
+
+// XInitialize ------------------------------------------------------------------------------
+// the first argument is an XMultiServiceFactory if at all
+void SAL_CALL OleConverter_Impl2::initialize( const Sequence< Any >& aArguments )
+ throw(Exception, RuntimeException)
+{
+ if( aArguments.getLength() == 1 && aArguments[0].getValueTypeClass() == TypeClass_INTERFACE)
+ {
+ Reference < XInterface > xInt;
+ aArguments[0] >>= xInt;
+ Reference <XMultiServiceFactory> xMulti( xInt, UNO_QUERY);
+ m_xMultiServiceFactory= xMulti;
+ }
+}
+
+// UnoConversionUtilities -------------------------------------------------------------------
+Reference< XInterface > OleConverter_Impl2::createUnoWrapperInstance()
+{
+ if( m_nUnoWrapperClass == INTERFACE_OLE_WRAPPER_IMPL)
+ {
+ Reference<XWeak> xWeak= static_cast<XWeak*>( new InterfaceOleWrapper_Impl(
+ m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
+ return Reference<XInterface>( xWeak, UNO_QUERY);
+ }
+ else if( m_nUnoWrapperClass == UNO_OBJECT_WRAPPER_REMOTE_OPT)
+ {
+ Reference<XWeak> xWeak= static_cast<XWeak*>( new UnoObjectWrapperRemoteOpt(
+ m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
+ return Reference<XInterface>( xWeak, UNO_QUERY);
+ }
+ else
+ return Reference<XInterface>();
+}
+
+Reference< XInterface > OleConverter_Impl2::createComWrapperInstance()
+{
+ Reference<XWeak> xWeak= static_cast<XWeak*>( new IUnknownWrapper_Impl(
+ m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
+ return Reference<XInterface>( xWeak, UNO_QUERY);
+}
+
+
+
+/*****************************************************************************
+
+ class implementation OleClient_Impl
+
+*****************************************************************************/
+
+OleClient_Impl::OleClient_Impl()
+{
+ Reference<XInterface> xInt = o2u_getMultiServiceFactory()->createInstance(L"com.sun.star.bridge.OleBridgeSupplier2");
+
+ if (xInt.is())
+ {
+ Any a= xInt->queryInterface(getCppuType(
+ reinterpret_cast<Reference<XBridgeSupplier2>*>(0)));
+ a >>= m_bridgeSupplier;
+ }
+}
+
+OleClient_Impl::~OleClient_Impl()
+{
+}
+
+Sequence< OUString > SAL_CALL OleClient_Impl::getAvailableServiceNames() throw( RuntimeException )
+{
+ Sequence< OUString > ret;
+
+ return ret;
+}
+
+
+OUString OleClient_Impl::getImplementationName()
+{
+ return OUString(L"com.sun.star.comp.ole.OleClient");
+}
+
+Reference<XInterface> SAL_CALL OleClient_Impl::createInstance(const OUString& ServiceSpecifier) throw (Exception, RuntimeException )
+{
+ Reference<XInterface> ret;
+ HRESULT result;
+ IUnknown* pUnknown = NULL;
+ CLSID classId;
+
+ o2u_attachCurrentThread();
+
+ result = CLSIDFromProgID(
+ ServiceSpecifier.getStr(), //Pointer to the ProgID
+ &classId); //Pointer to the CLSID
+
+
+ if (result == NOERROR)
+ {
+ result = CoCreateInstance(
+ classId, //Class identifier (CLSID) of the object
+ NULL, //Pointer to whether object is or isn't part of an aggregate
+ CLSCTX_ALL, //Context for running executable code
+ IID_IUnknown, //Reference to the identifier of the interface
+ (void**)&pUnknown); //Address of output variable that receives
+ // the interface pointer requested in riid
+ }
+
+ if (pUnknown != NULL)
+ {
+ Any any;
+ VARIANT variant;
+
+ VariantInit(&variant);
+
+ V_VT(&variant) = VT_UNKNOWN;
+ V_UNKNOWN(&variant) = pUnknown;
+
+ pUnknown->AddRef();
+
+ if (variantToAny(&variant, any))
+ {
+ if (any.getValueTypeClass() == TypeClass_INTERFACE)
+ {
+ ret = *(Reference<XInterface>*)any.getValue();
+ }
+ }
+
+ VariantClear(&variant);
+ }
+
+ return ret;
+}
+
+Reference<XInterface> SAL_CALL OleClient_Impl::createInstanceWithArguments(const OUString& ServiceSpecifier, const Sequence< Any >& Arguments) throw (Exception, RuntimeException)
+{
+ Reference<XInterface> ret;
+ HRESULT result;
+ IUnknown* pUnknown = NULL;
+ CLSID classId;
+
+ o2u_attachCurrentThread();
+
+ result = CLSIDFromProgID(
+ ServiceSpecifier.getStr(), //Pointer to the ProgID
+ &classId); //Pointer to the CLSID
+
+
+ if (result == NOERROR)
+ {
+ result = CoCreateInstance(
+ classId, //Class identifier (CLSID) of the object
+ NULL, //Pointer to whether object is or isn't part of an aggregate
+ CLSCTX_LOCAL_SERVER, //Context for running executable code
+ IID_IUnknown, //Reference to the identifier of the interface
+ (void**)&pUnknown); //Address of output variable that receives
+ // the interface pointer requested in riid
+ }
+
+ if (pUnknown != NULL)
+ {
+ Any any;
+ VARIANT variant;
+
+ VariantInit(&variant);
+
+ V_VT(&variant) = VT_UNKNOWN;
+ V_UNKNOWN(&variant) = pUnknown;
+
+ pUnknown->AddRef();
+
+ if (variantToAny(&variant, any))
+ {
+ if (any.getValueTypeClass() == TypeClass_INTERFACE)
+ {
+ ret = *(Reference<XInterface>*)any.getValue();
+ }
+ }
+
+ VariantClear(&variant);
+ }
+
+ return ret;
+}
+
+// UnoConversionUtilities -----------------------------------------------------------------------------
+Reference< XInterface > OleClient_Impl::createUnoWrapperInstance()
+{
+ if( m_nUnoWrapperClass == INTERFACE_OLE_WRAPPER_IMPL)
+ {
+ Reference<XWeak> xWeak= static_cast<XWeak*>( new InterfaceOleWrapper_Impl(
+ m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
+ return Reference<XInterface>( xWeak, UNO_QUERY);
+ }
+ else if( m_nUnoWrapperClass == UNO_OBJECT_WRAPPER_REMOTE_OPT)
+ {
+ Reference<XWeak> xWeak= static_cast<XWeak*>( new UnoObjectWrapperRemoteOpt(
+ m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
+ return Reference<XInterface>( xWeak, UNO_QUERY);
+ }
+ else
+ return Reference< XInterface>();
+}
+// UnoConversionUtilities -----------------------------------------------------------------------------
+Reference< XInterface > OleClient_Impl::createComWrapperInstance( )
+{
+ Reference<XWeak> xWeak= static_cast<XWeak*>( new IUnknownWrapper_Impl(
+ m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
+ return Reference<XInterface>( xWeak, UNO_QUERY);
+}
+
+
+
+/*****************************************************************************
+
+ class implementation OleServer_Impl
+
+*****************************************************************************/
+
+OleServer_Impl::OleServer_Impl()
+{
+ Reference<XInterface> xInt = o2u_getMultiServiceFactory()->createInstance(L"com.sun.star.bridge.OleBridgeSupplier2");
+
+ if (xInt.is())
+ {
+ Any a= xInt->queryInterface( getCppuType(
+ reinterpret_cast< Reference<XBridgeSupplier2>*>(0)));
+ a >>= m_bridgeSupplier;
+ }
+
+ sal_Bool ret = provideInstance(o2u_getMultiServiceFactory(), (GUID*)&OID_ServiceManager);
+}
+
+OleServer_Impl::~OleServer_Impl()
+{
+ while (!m_wrapperList.empty())
+ {
+ (*m_wrapperList.begin())->deregisterClass();
+ (*m_wrapperList.begin())->Release();
+ m_wrapperList.pop_front();
+ }
+}
+// XInterface --------------------------------------------------
+Any SAL_CALL OleServer_Impl::queryInterface( const Type& aType ) throw(RuntimeException)
+{
+ Any a= ::cppu::queryInterface( aType, static_cast<XTypeProvider*>(this));
+ if( a == Any())
+ return OWeakObject::queryInterface( aType);
+ else
+ return a;
+}
+void SAL_CALL OleServer_Impl::acquire( ) throw(RuntimeException)
+{
+ OWeakObject::acquire();
+}
+void SAL_CALL OleServer_Impl::release( ) throw (RuntimeException)
+{
+ OWeakObject::release();
+}
+
+
+// XTypeProvider --------------------------------------------------
+Sequence< Type > SAL_CALL OleServer_Impl::getTypes( ) throw(RuntimeException)
+{
+ static OTypeCollection *pCollection = 0;
+ if( ! pCollection )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pCollection )
+ {
+ static OTypeCollection collection(
+ getCppuType(reinterpret_cast< Reference< XWeak>*>(0)),
+ getCppuType(reinterpret_cast< Reference< XTypeProvider>*>(0)) );
+ pCollection = &collection;
+ }
+ }
+ return (*pCollection).getTypes();
+}
+Sequence< sal_Int8 > SAL_CALL OleServer_Impl::getImplementationId() throw(RuntimeException)
+{
+ static OImplementationId *pId = 0;
+ if( ! pId )
+ {
+ MutexGuard guard( Mutex::getGlobalMutex() );
+ if( ! pId )
+ {
+ static OImplementationId id( sal_False );
+ pId = &id;
+ }
+ }
+ return (*pId).getImplementationId();
+}
+
+
+sal_Bool OleServer_Impl::provideService(const Reference<XSingleServiceFactory>& xSFact, GUID* guid)
+{
+ sal_Bool ret = FALSE;
+
+ IClassFactoryWrapper* pFac = new ProviderOleWrapper_Impl(xSFact, guid);
+
+ pFac->AddRef();
+
+ m_wrapperList.push_back(pFac);
+
+ return pFac->registerClass();
+}
+
+sal_Bool OleServer_Impl::provideInstance(const Reference<XInterface>& xInst, GUID* guid)
+{
+ sal_Bool ret = FALSE;
+
+ IClassFactoryWrapper* pFac = new OneInstanceOleWrapper_Impl(xInst, guid);
+
+ pFac->AddRef();
+ m_wrapperList.push_back(pFac);
+
+ return pFac->registerClass();
+}
+
+
+
+/*****************************************************************************
+
+ functions to create the service providers
+
+*****************************************************************************/
+
+Reference<XSingleServiceFactory> o2u_getConverterProvider2(const Reference<XMultiServiceFactory>& xMan,
+ const Reference<XRegistryKey>& xKey)
+{
+ static Reference<XSingleServiceFactory> ret = NULL;
+
+ if (!ret.is())
+ {
+ if (!xMultiServiceFactory.is()) xMultiServiceFactory = xMan;
+
+ Sequence<OUString> seqServiceNames;
+ ret = createSingleFactory( xMan, L"com.sun.star.comp.ole.OleConverter2",
+ ConverterProvider_CreateInstance2, seqServiceNames );
+ }
+ return ret;
+}
+
+Reference<XSingleServiceFactory> o2u_getConverterProviderVar1(const Reference<XMultiServiceFactory>& xMan,
+ const Reference<XRegistryKey>& xKey)
+{
+ static Reference<XSingleServiceFactory> ret = NULL;
+
+ if (!ret.is())
+ {
+ if (!xMultiServiceFactory.is()) xMultiServiceFactory = xMan;
+
+ Sequence<OUString> seqServiceNames;
+ ret = createSingleFactory( xMan, L"com.sun.star.comp.ole.OleConverterVar1",
+ ConverterProvider_CreateInstanceVar1, seqServiceNames );
+ }
+ return ret;
+}
+Reference<XSingleServiceFactory> o2u_getClientProvider(const Reference<XMultiServiceFactory>& xMan,
+ const Reference<XRegistryKey>& xKey)
+{
+ static Reference<XSingleServiceFactory> ret = NULL;
+
+ if (!ret.is())
+ {
+ if (!xMultiServiceFactory.is()) xMultiServiceFactory = xMan;
+ Sequence<OUString> seqServiceNames;
+ ret = createSingleFactory( xMan, L"com.sun.star.comp.ole.OleClient",
+ OleClient_CreateInstance, seqServiceNames);
+ }
+
+ return ret;
+}
+
+Reference<XSingleServiceFactory> o2u_getServerProvider(const Reference<XMultiServiceFactory>& xMan,
+ const Reference<XRegistryKey>& xKey)
+{
+ static Reference<XSingleServiceFactory> ret = NULL;
+
+ if (!ret.is())
+ {
+ if (!xMultiServiceFactory.is()) xMultiServiceFactory = xMan;
+ Sequence<OUString> seqServiceNames;
+ ret = createOneInstanceFactory( xMan, L"com.sun.star.comp.ole.OleServer",
+ OleServer_CreateInstance, seqServiceNames);
+ }
+
+ return ret;
+}
+// Creator functions --------------------
+
+Reference<XInterface> SAL_CALL ConverterProvider_CreateInstance2( const Reference<XMultiServiceFactory> & xSMgr)
+ throw(Exception)
+{
+ Reference<XInterface> xService = *new OleConverter_Impl2();
+ return xService;
+}
+
+Reference<XInterface> SAL_CALL ConverterProvider_CreateInstanceVar1( const Reference<XMultiServiceFactory> & xSMgr)
+ throw(Exception)
+{
+ Reference<XInterface> xService = *new OleConverter_Impl2( UNO_OBJECT_WRAPPER_REMOTE_OPT, IUNKNOWN_WRAPPER_IMPL);
+ return xService;
+}
+
+Reference<XInterface> SAL_CALL OleClient_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
+ throw(Exception)
+{
+ Reference<XInterface> xService = *new OleClient_Impl();
+ return xService;
+}
+
+Reference<XInterface> SAL_CALL OleServer_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
+ throw (Exception)
+{
+ Reference<XInterface > xService = *new OleServer_Impl();
+ return xService;
+}
+
+
+} // end namespace
diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx
new file mode 100644
index 000000000..b8609eb23
--- /dev/null
+++ b/extensions/source/ole/servprov.hxx
@@ -0,0 +1,308 @@
+/*************************************************************************
+ *
+ * $RCSfile: servprov.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SERVPROV_HXX
+#define _SERVPROV_HXX
+
+#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
+#include <com/sun/star/lang/XInitialization.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE3_HXX_
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+#include "ole2uno.hxx"
+#include "unoconversionutilities.hxx"
+
+
+using namespace com::sun::star::bridge;
+using namespace cppu;
+using namespace std;
+
+namespace ole_adapter
+{
+Reference< XInterface> SAL_CALL ConverterProvider_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
+ throw( Exception);
+Reference< XInterface> SAL_CALL ConverterProvider_CreateInstance2( const Reference<XMultiServiceFactory> & xSMgr)
+ throw( Exception);
+Reference< XInterface> SAL_CALL ConverterProvider_CreateInstanceVar1( const Reference<XMultiServiceFactory> & xSMgr)
+ throw( Exception);
+Reference<XInterface> SAL_CALL OleClient_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
+ throw( Exception);
+Reference<XInterface> SAL_CALL OleServer_CreateInstance( const Reference<XMultiServiceFactory> & xSMgr)
+ throw( Exception);
+/*****************************************************************************
+
+ class declaration IClassFactoryWrapper
+
+ Specify abstract helper methods on class factories, which provide
+ UNO objects. These methods are used by objects of class OleServer_Impl,
+ to handle the OLE registration of different class factories.
+
+*****************************************************************************/
+
+class IClassFactoryWrapper : public IClassFactory
+{
+public:
+
+ virtual sal_Bool registerClass() = 0;
+ virtual sal_Bool deregisterClass() = 0;
+};
+
+/*****************************************************************************
+
+ class declaration ProviderOleWrapper_Impl
+
+ Provides an UNO service provider as OLE class factory. Handle the
+ OLE registration by overloading the abstract methods from
+ IClassFactoryWrapper.
+
+ Acts as a COM class factory. When IClassFactory::CreateInstance is being called
+ then it creates an service by help of the XSingleServiceFactory member and maps
+ maps it to a COM object.
+
+*****************************************************************************/
+
+class ProviderOleWrapper_Impl : public IClassFactoryWrapper
+{
+public:
+
+ ProviderOleWrapper_Impl(const Reference<XSingleServiceFactory>& xSFactory, GUID* pGuid);
+ ~ProviderOleWrapper_Impl();
+
+ sal_Bool registerClass();
+ sal_Bool deregisterClass();
+
+ /* IUnknown methods */
+ STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
+ STDMETHOD_(ULONG, AddRef)();
+ STDMETHOD_(ULONG, Release)();
+
+ /* IClassFactory methods */
+ STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv);
+ STDMETHOD(LockServer)(int fLock);
+
+protected:
+
+ oslInterlockedCount m_refCount;
+ Reference<XSingleServiceFactory> m_xSingleServiceFactory;
+ GUID m_guid;
+ DWORD m_factoryHandle;
+ Reference<XBridgeSupplier2> m_bridgeSupplier;
+};
+
+/*****************************************************************************
+
+ class declaration OneInstanceOleWrapper_Impl
+
+ Provides an single UNO object as OLE object. Handle the
+ OLE registration by overloading the abstract methods from
+ IClassFactoryWrapper.
+
+ Acts as a COM class factory. When IClassFactory::CreateInstance is being called
+ then it maps the XInstance member it to a COM object.
+
+*****************************************************************************/
+
+class OneInstanceOleWrapper_Impl : public IClassFactoryWrapper
+{
+public:
+
+ OneInstanceOleWrapper_Impl(const Reference<XInterface>& xInst, GUID* pGuid);
+ ~OneInstanceOleWrapper_Impl();
+
+ sal_Bool registerClass();
+ sal_Bool deregisterClass();
+
+ /* IUnknown methods */
+ STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
+ STDMETHOD_(ULONG, AddRef)();
+ STDMETHOD_(ULONG, Release)();
+
+ /* IClassFactory methods */
+ STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv);
+ STDMETHOD(LockServer)(int fLock);
+
+protected:
+
+ //ORefCount m_refCount;
+ oslInterlockedCount m_refCount;
+ Reference<XInterface> m_xInst;
+ GUID m_guid;
+ DWORD m_factoryHandle;
+ Reference<XBridgeSupplier2> m_bridgeSupplier;
+};
+
+/*****************************************************************************
+
+ class declaration OleConverter_Impl2
+
+ Implementation of the UNO service com.sun.star.bridge.OleBridgeSupplier2.
+
+*****************************************************************************/
+
+// This class realizes the service com.sun.star.bridge.OleBridgeSupplier2 and
+// com.sun.star.bridge.OleBridgeSupplierVar1. The class implements XBridgeSupplier2
+// instead of XBridgeSuppplier as done by class OleConverter_Impl. The XBridgeSupplier2
+// interface does not need a Maschine Id in its createBridge function anymore,
+// If an UNO interface is to be converted then the member m_nUnoWrapperClass determines
+// what wrapper class is to be used. There are currently InterfaceOleWrapper_Impl and
+// UnoObjectWrapperRemoteOpt. The first is used for the OleBridgeSupplier2 and the
+// latter for OleBridgeSupplierVar1.
+// The m_nComWrapperClass specifies the class which is used as wrapper for COM interfaces.
+// Currently there is only one class available ( IUnknownWrapper_Impl).
+class OleConverter_Impl2 : public WeakImplHelper2<XBridgeSupplier2, XInitialization>,
+ public UnoConversionUtilities<OleConverter_Impl2>
+{
+public:
+ OleConverter_Impl2();
+ OleConverter_Impl2( sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass );
+ virtual ~OleConverter_Impl2();
+
+ // XBridgeSupplier2 ---------------------------------------------------
+
+ virtual Any SAL_CALL createBridge(const Any& modelDepObject,
+ const Sequence<sal_Int8>& ProcessId,
+ sal_Int16 sourceModelType,
+ sal_Int16 destModelType)
+ throw (IllegalArgumentException, RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
+
+ // Abstract struct UnoConversionUtilities
+ virtual Reference< XInterface > createUnoWrapperInstance();
+ virtual Reference< XInterface > createComWrapperInstance();
+};
+
+
+/*****************************************************************************
+
+ class declaration OleClient_Impl
+
+ Implementation of the UNO service com.sun.star.bridge.OleObjectFactory.
+
+*****************************************************************************/
+
+
+class OleClient_Impl : public WeakImplHelper1<XMultiServiceFactory>,
+ public UnoConversionUtilities<OleClient_Impl>
+{
+public:
+ OleClient_Impl();
+ ~OleClient_Impl();
+
+ // XMultiServiceFactory
+ virtual Reference<XInterface> SAL_CALL createInstance(const OUString& ServiceSpecifier) throw( Exception, RuntimeException);
+ virtual Reference<XInterface> SAL_CALL createInstanceWithArguments(const OUString& ServiceSpecifier, const Sequence< Any >& Arguments) throw (Exception, RuntimeException);
+ Sequence< OUString > SAL_CALL getAvailableServiceNames() throw (RuntimeException);
+
+ // Abstract struct UnoConversionUtilities
+ virtual Reference< XInterface > createUnoWrapperInstance();
+ virtual Reference< XInterface > createComWrapperInstance();
+
+
+ OUString getImplementationName();
+protected:
+
+ Reference<XBridgeSupplier2> m_bridgeSupplier;
+};
+
+/*****************************************************************************
+
+ class declaration OleServer_Impl
+
+ Implementation of the UNO service com.sun.star.bridge.OleApplicationRegistration.
+ Register the calling application as OLE automation server for
+ standard OLE object. The objects will be registered while instanciating
+ this implementation and deregistrated, if this implementation is destroyed.
+
+*****************************************************************************/
+
+class OleServer_Impl : public OWeakObject, XTypeProvider
+{
+public:
+ OleServer_Impl();
+ ~OleServer_Impl();
+
+ // XInterface
+ virtual Any SAL_CALL queryInterface( const Type& aType ) throw(RuntimeException);
+ virtual void SAL_CALL acquire( ) throw (RuntimeException);
+ virtual void SAL_CALL release( ) throw (RuntimeException);
+
+ // XTypeProvider
+ virtual Sequence< Type > SAL_CALL getTypes( ) throw(RuntimeException);
+ virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(RuntimeException);
+
+protected:
+
+ sal_Bool provideService(const Reference<XSingleServiceFactory>& xMulFact, GUID* guid);
+ sal_Bool provideInstance(const Reference<XInterface>& xInst, GUID* guid);
+
+ list< IClassFactoryWrapper* > m_wrapperList;
+ Reference< XBridgeSupplier2 > m_bridgeSupplier;
+};
+
+} // end namespace
+#endif
+
+
+
diff --git a/extensions/source/ole/servreg.cxx b/extensions/source/ole/servreg.cxx
new file mode 100644
index 000000000..dcaf2360b
--- /dev/null
+++ b/extensions/source/ole/servreg.cxx
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * $RCSfile: servreg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "ole2uno.hxx"
+
+#ifndef _RTL_USTRING_
+#include <rtl/ustring>
+#endif
+
+
+
+using namespace rtl;
+using namespace ole_adapter;
+
+
+extern "C" void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ void * pRet = 0;
+
+ OUString aImplName( OUString::createFromAscii( pImplName ) );
+ Reference< XSingleServiceFactory > xFactory;
+ if (pServiceManager && aImplName.equals( L"com.sun.star.comp.ole.OleConverter2" ))
+ {
+ xFactory= o2u_getConverterProvider2(
+ reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
+ reinterpret_cast< XRegistryKey*>(pRegistryKey));
+ }
+ else if (pServiceManager && aImplName.equals( L"com.sun.star.comp.ole.OleConverterVar1" ))
+ {
+ xFactory= o2u_getConverterProviderVar1(
+ reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
+ reinterpret_cast< XRegistryKey*>(pRegistryKey));
+ }
+ else if(pServiceManager && aImplName.equals(L"com.sun.star.comp.ole.OleClient"))
+ {
+ xFactory= o2u_getClientProvider(
+ reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
+ reinterpret_cast< XRegistryKey*>(pRegistryKey));
+ }
+ else if(pServiceManager && aImplName.equals(L"com.sun.star.comp.ole.OleServer"))
+ {
+ xFactory= o2u_getServerProvider(
+ reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
+ reinterpret_cast< XRegistryKey*>(pRegistryKey));
+ }
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+}
+
+
+extern "C" sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey )
+{
+ if (pRegistryKey)
+ {
+ try
+ {
+ Reference<XRegistryKey> xNewKey =
+ reinterpret_cast<XRegistryKey*>( pRegistryKey)->createKey(L"/com.sun.star.comp.ole.OleConverter2/UNO/SERVICES");
+ xNewKey->createKey(L"com.sun.star.bridge.OleBridgeSupplier2");
+
+ xNewKey =
+ reinterpret_cast<XRegistryKey*>( pRegistryKey)->createKey(L"/com.sun.star.comp.ole.OleConverterVar1/UNO/SERVICES");
+ xNewKey->createKey(L"com.sun.star.bridge.OleBridgeSupplierVar1");
+
+ xNewKey =
+ reinterpret_cast<XRegistryKey*>( pRegistryKey)->createKey(L"/com.sun.star.comp.ole.OleClient/UNO/SERVICES");
+ xNewKey->createKey(L"com.sun.star.bridge.OleObjectFactory");
+
+ xNewKey =
+ reinterpret_cast<XRegistryKey*>( pRegistryKey)->createKey(L"/com.sun.star.comp.ole.OleServer/UNO/SERVICES");
+ xNewKey->createKey(L"com.sun.star.bridge.OleApplicationRegistration");
+
+ return sal_True;
+ }
+ catch (InvalidRegistryException &)
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+}
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+
diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx
new file mode 100644
index 000000000..193db271f
--- /dev/null
+++ b/extensions/source/ole/unoconversionutilities.hxx
@@ -0,0 +1,1574 @@
+/*************************************************************************
+ *
+ * $RCSfile: unoconversionutilities.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _UNO_CONVERSION_UTILITIES
+#define _UNO_CONVERSION_UTILITIES
+
+#include <com/sun/star/script/XInvocationAdapterFactory.hpp>
+#include <com/sun/star/script/XInvocationAdapterFactory2.hpp>
+
+#include <vos/mutex.hxx>
+#include "ole2uno.hxx"
+
+// classes for wrapping uno objects
+#define INTERFACE_OLE_WRAPPER_IMPL 1
+#define UNO_OBJECT_WRAPPER_REMOTE_OPT 2
+
+#define INVOCATION_SERVICE L"com.sun.star.script.Invocation"
+
+
+// classes for wrapping ole objects
+#define IUNKNOWN_WRAPPER_IMPL 1
+
+#define INTERFACE_ADAPTER_FACTORY L"com.sun.star.script.InvocationAdapterFactory"
+// COM or JScript objects implementing UNO interfaces have to implement this interface as well
+#define SUPPORTED_INTERFACES_PROP L"_implementedInterfaces"
+
+using namespace com::sun::star::script;
+using namespace com::sun::star::beans;
+using namespace vos;
+
+namespace ole_adapter
+{
+extern OMutex globalWrapperMutex;
+extern hash_map<sal_uInt32, sal_uInt32> AdapterToWrapperMap;
+extern hash_map<sal_uInt32, sal_uInt32> WrapperToAdapterMap;
+
+ // createUnoObjectWrapper gets a wrapper instance by calling createUnoWrapperInstance
+ // and initializes it via XInitialization. The wrapper object is required to implement
+ // XBridgeSupplier so that it can convert itself to IDispatch.
+ // class T: Deriving class ( must implement XInterface )
+template< class >
+class UnoConversionUtilities
+{
+public:
+ UnoConversionUtilities(): m_nUnoWrapperClass( INTERFACE_OLE_WRAPPER_IMPL),
+ m_nComWrapperClass( IUNKNOWN_WRAPPER_IMPL)
+ {}
+ UnoConversionUtilities( sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass )
+ : m_nUnoWrapperClass( unoWrapperClass), m_nComWrapperClass( comWrapperClass)
+ {}
+ UnoConversionUtilities( Reference<XMultiServiceFactory> xFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass )
+ : m_xMultiServiceFactory( xFactory), m_nComWrapperClass( comWrapperClass), m_nUnoWrapperClass( unoWrapperClass)
+ {}
+ // converts only into oleautomation types, that is there is no VT_I1, VT_UI2, VT_UI4
+ // a sal_Unicode character is converted into a BSTR
+ sal_Bool anyToVariant(VARIANT* pVariant, const Any& rAny);
+ SAFEARRAY* createUnoSequenceWrapper(const Any& rSeq);
+ IDispatch* createUnoObjectWrapper(const Any& rObj);
+
+ sal_Bool variantToAny(const VARIANT* pVariant, Any& rAny, sal_Bool bReduceValueRange = sal_True);
+ sal_Bool variantToAny2( const VARIANTARG* pArg, Any& rAny, const Type& ptype, sal_Bool bReduceValueRange = sal_True);
+ Any createOleObjectWrapper(IUnknown* pUnknown);
+ Any createOleObjectWrapper(IUnknown* pUnknown, const Type& aType);
+
+
+ sal_Bool convertValueObject( const VARIANTARG *var, Any& any, sal_Bool& bHandled);
+ sal_Bool dispatchExObject2Sequence( const VARIANTARG* pvar, Any& anySeq, const Type& type);
+
+ Sequence<Any> createOleArrayWrapperOfDim(SAFEARRAY* pArray, unsigned int dimCount, unsigned int actDim, long* index, VARTYPE type);
+ Sequence<Any> createOleArrayWrapper(SAFEARRAY* pArray, VARTYPE type);
+
+// SAFEARRAY* createUnoSequenceWrapper(const Any& rSeq);
+
+ VARTYPE mapTypeClassToVartype( TypeClass type);
+
+ Reference< XSingleServiceFactory > getInvocationFactory();
+
+ virtual Reference< XInterface > createUnoWrapperInstance()=0;
+ virtual Reference< XInterface > createComWrapperInstance()=0;
+
+ static sal_Bool isJScriptArray(const VARIANT* pvar);
+
+
+
+// Attributes:
+protected:
+ // This member determines what class is used to convert a UNO object
+ // or struct to a COM object. It is passed along to the o2u_anyToVariant
+ // function in the createBridge function implementation
+ sal_uInt8 m_nUnoWrapperClass;
+ sal_uInt8 m_nComWrapperClass;
+
+ // This factory is set by calling XInitialization::initialize.
+ // If this ServiceManager is supplied then it is used to create all
+ // necessary services.
+ Reference<XMultiServiceFactory> m_xMultiServiceFactory;
+ Reference<XSingleServiceFactory> m_xInvocationFactory;
+
+
+};
+
+template<class T>
+Reference< XSingleServiceFactory > UnoConversionUtilities<T>::getInvocationFactory()
+{
+ if( m_xInvocationFactory.is() )
+ return Reference< XSingleServiceFactory >( m_xInvocationFactory );
+
+ if( m_xMultiServiceFactory.is() )
+ m_xInvocationFactory= Reference<XSingleServiceFactory >( m_xMultiServiceFactory->createInstance( INVOCATION_SERVICE), UNO_QUERY);
+ else
+ m_xInvocationFactory= Reference<XSingleServiceFactory>( o2u_getMultiServiceFactory()->createInstance(INVOCATION_SERVICE ), UNO_QUERY);
+
+ return m_xInvocationFactory;
+}
+
+template<class T>
+sal_Bool UnoConversionUtilities<T>::variantToAny2( const VARIANTARG* pArg, Any& rAny, const Type& ptype, sal_Bool bReduceValueRange /* = sal_True */)
+{
+ HRESULT hr;
+ sal_Bool retVal= sal_True;
+
+ VARIANT var;
+ VariantInit( &var);
+ // There is no need to support indirect values, since they're not supported by UNO
+ if( FAILED(hr= VariantCopyInd( &var, const_cast<VARIANTARG*>(pArg)))) // remove VT_BYREF
+ return sal_False;
+
+ sal_Bool bHandled= sal_False;
+ if( pArg->vt == VT_DISPATCH )
+ {
+ convertValueObject( &var, rAny, bHandled);
+ if( bHandled)
+ OSL_ENSURE( rAny.getValueType() == ptype, "type in Value Object must tally with the type parameter");
+ }
+
+
+ if( ! bHandled)
+ {
+ // convert into a variant type that is the equivalent to the type
+ // the sequence expects. Thus variantToAny produces the correct type
+ // E.g. An Array object contains VT_I4 and the sequence expects shorts
+ // than the vartype must be changed. The reason is, you can't specify the
+ // type in JavaScript and the script engine determines the type beeing used.
+ switch( ptype.getTypeClass())
+ {
+ case TypeClass_CHAR: // could be: new Array( 12, 'w', "w")
+ if( pArg->vt == VT_BSTR)
+ {
+ if( SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_BSTR)))
+ rAny.setValue( (void*)V_BSTR( &var), ptype);
+ else
+ retVal= sal_False;
+ }
+ else if( pArg->vt == VT_I4 ||
+ pArg->vt == VT_UI4 ||
+ pArg->vt == VT_I2 ||
+ pArg->vt == VT_UI2 ||
+ pArg->vt == VT_I1 ||
+ pArg->vt == VT_UI1)
+ {
+ if( SUCCEEDED( hr= VariantChangeType( &var, & var, 0, VT_UI2)))
+ rAny.setValue(& V_UI2( &var), ptype);
+ else
+ retVal= sal_False;
+ }
+ break;
+ case TypeClass_INTERFACE: // could also be an IUnknown
+ // if( SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_DISPATCH)))
+ // retVal= variantToAny(&var, rAny);
+ {
+ CComVariant varUnk;
+ if( SUCCEEDED( hr= VariantChangeType( &varUnk, &var, 0, VT_UNKNOWN)))
+ {
+ rAny = createOleObjectWrapper( varUnk.punkVal, ptype);
+ retVal = sal_True;
+ }
+ else
+ retVal= sal_False;
+ break;
+ }
+ case TypeClass_SERVICE: break; // meta construct
+ case TypeClass_STRUCT:
+ {// dispatch
+ CComVariant varUnk;
+ if( SUCCEEDED( hr= VariantChangeType( &varUnk, &var, 0, VT_UNKNOWN)))
+ {
+ rAny= createOleObjectWrapper( varUnk.punkVal, ptype);
+ retVal= sal_True;
+ }
+ else
+ retVal= sal_False;
+ break;
+ }
+ case TypeClass_TYPEDEF: break;
+ case TypeClass_UNION: break;
+ case TypeClass_ENUM:
+ if( SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_I4)))
+ {
+ rAny.setValue( (void*)&var.lVal, ptype);
+ retVal= sal_True;
+ }
+ else
+ retVal= sal_False;
+ break;
+ case TypeClass_EXCEPTION: break;
+ case TypeClass_ARRAY: break; // there's no Array at the moment
+ case TypeClass_SEQUENCE:
+ // There are different ways of receiving a sequence:
+ // 1: JScript, VARTYPE: VT_DISPATCH
+ // 2. VBScript simple arraysVT_VARIANT|VT_BYREF the referenced VARIANT contains
+ // a VT_ARRAY| <type>
+ // 3. VBSrcript multi dimensional arrays: VT_ARRAY|VT_BYREF
+ if( pArg->vt == VT_DISPATCH)
+ {
+ retVal= dispatchExObject2Sequence( pArg, rAny, ptype);
+ }
+ else
+ retVal= variantToAny(&var, rAny);
+ break; // maybe later ( convert to VT_ARRAY| ??? )
+ case TypeClass_VOID:
+ rAny.setValue(NULL,Type());
+ break;
+
+ case TypeClass_ANY: // Any
+ // There could be a JScript Array that needs special handling
+ // If an Any is expected and this Any must contain a Sequence
+ // then we cannot figure out what element type is required.
+ // Therefore we convert to Sequence< Any >
+ if( pArg->vt == VT_DISPATCH && isJScriptArray( pArg))
+ {
+ Sequence<Any> s;
+ retVal= dispatchExObject2Sequence( pArg, rAny, getCppuType(&s));
+ }
+ else
+ retVal= variantToAny( &var, rAny);
+ break;
+ case TypeClass_UNKNOWN: break;
+ case TypeClass_BOOLEAN: // VARIANT could be VARIANT_BOOL or other
+ if(SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_BOOL)))
+ retVal= variantToAny(&var, rAny);
+ else
+ retVal= sal_False;
+ break;
+ case TypeClass_STRING: // UString
+ if( SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_BSTR)))
+ retVal= variantToAny(&var, rAny);
+ else
+ retVal= sal_False;
+ break;
+ case TypeClass_FLOAT: // float
+ if( SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_R4)))
+ retVal= variantToAny(&var, rAny);
+ else
+ retVal= sal_False;
+ break;
+ case TypeClass_DOUBLE: // double
+ if( SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_R8)))
+ retVal= variantToAny(&var, rAny );
+ else
+ retVal= sal_False;
+ break;
+ case TypeClass_BYTE: // BYTE
+ if( SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_I1)))
+ retVal= variantToAny(&var, rAny);
+ else
+ retVal= sal_False;
+ break;
+ case TypeClass_SHORT: // INT16
+ if( SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_I2)))
+ retVal= variantToAny(&var, rAny);
+ else
+ retVal= sal_False;
+ break;
+ case TypeClass_LONG: // INT32
+ if( SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_I4)))
+ retVal= variantToAny(&var, rAny, bReduceValueRange);
+ else
+ retVal= sal_False;
+ break;
+ case TypeClass_HYPER: break; // INT64
+ case TypeClass_UNSIGNED_SHORT: // UINT16
+ if( SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_UI2)))
+ retVal= variantToAny(&var, rAny);
+ else
+ retVal= sal_False;
+ break;
+ case TypeClass_UNSIGNED_LONG: // UINT32
+ if( SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_UI4)))
+ retVal= variantToAny(&var, rAny, bReduceValueRange);
+ else
+ retVal= sal_False;
+ break;
+ case TypeClass_UNSIGNED_HYPER: break;// UINT64
+ case TypeClass_MODULE: break; // module
+
+ default:
+ retVal= variantToAny(pArg, rAny); // hopfully delegating ;-)
+ break;
+
+ }
+ }
+ return retVal;
+}
+
+
+template<class T>
+sal_Bool UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny)
+{
+ sal_Bool ret = sal_False;
+
+ switch (rAny.getValueTypeClass())
+ {
+ case TypeClass_INTERFACE: // XInterfaceRef
+ {
+ Reference<XInterface> xInt( *(XInterface**)rAny.getValue());
+
+ V_VT(pVariant) = VT_DISPATCH;
+ V_DISPATCH(pVariant) = NULL;
+
+ if (xInt.is())
+ {
+ // check, wether the object provides OLE bridging or not
+ Reference<XBridgeSupplier2> XBridgeSup(xInt, UNO_QUERY);
+ sal_Bool bOwnService= sal_False;
+ if (XBridgeSup.is())
+ {
+ // check if we try to convert our own OleConverter2 service
+ // If so we would run into a recursion!!!
+ T* pT= static_cast< T* >( this);
+
+ Any anyXInt= pT->queryInterface( getCppuType( static_cast<Reference<XInterface>* >( 0) ));
+ Reference< XInterface > xIntThis;
+
+ if( (anyXInt >>= xIntThis) && xInt != xIntThis)
+ { // not our own OleConverter_Impl2
+ sal_uInt8 arId[16];
+ rtl_getGlobalProcessId( arId);
+ Any oleAny = XBridgeSup->createBridge(
+ rAny,
+ Sequence<sal_Int8>( (sal_Int8*)arId, 16),
+ UNO,
+ OLE);
+
+ if( oleAny.getValueType() == getCppuType( (sal_uInt32*)0))
+ {
+ VARIANT* pTmpVariant = *(VARIANT**)oleAny.getValue();
+
+ VariantCopy(pVariant, pTmpVariant);
+ VariantClear(pTmpVariant);
+ CoTaskMemFree(pTmpVariant);
+ }
+ else
+ {
+ XBridgeSup = Reference<XBridgeSupplier2>();
+ }
+ }
+ else
+ {// The object is our OleConverter_Impl2 !!
+ bOwnService= sal_True;
+ }
+ }
+
+ if (!XBridgeSup.is() || bOwnService )
+ {
+ V_DISPATCH(pVariant)= createUnoObjectWrapper( rAny);
+ }
+ }
+ ret = sal_True;
+
+ break;
+ }
+ case TypeClass_SERVICE: // meta construct
+ break;
+ case TypeClass_STRUCT: // struct
+ V_VT(pVariant) = VT_DISPATCH;
+ V_DISPATCH(pVariant) = createUnoObjectWrapper(rAny);
+ ret = sal_True;
+ break;
+ case TypeClass_TYPEDEF: // typedef compiler construct ???
+ break;
+ case TypeClass_UNION: // union
+ break;
+ case TypeClass_ENUM: // enumeration
+ V_VT(pVariant) = VT_I4;
+ V_I4(pVariant) = *(sal_Int32*)rAny.getValue();
+ ret = sal_True;
+ break;
+ case TypeClass_EXCEPTION: // exception
+ break;
+ case TypeClass_ARRAY: // array not implemented
+ break;
+ case TypeClass_SEQUENCE: // sequence ??? SafeArray descriptor
+ {
+ SAFEARRAY* pArray = createUnoSequenceWrapper(rAny);
+ if (pArray)
+ {
+ V_VT(pVariant) = VT_ARRAY | VT_VARIANT;
+ V_ARRAY(pVariant) = pArray;
+ ret = sal_True;
+ }
+ break;
+ }
+ case TypeClass_VOID: // void
+ VariantClear(pVariant);
+ ret = sal_True;
+ break;
+ case TypeClass_ANY: // Any
+ break;
+ case TypeClass_UNKNOWN: // unknown type
+ break;
+ case TypeClass_BOOLEAN: // BOOL
+ {
+ V_VT(pVariant) = VT_BOOL;
+ V_BOOL( pVariant)= *(sal_Bool*) rAny.getValue() == sal_True? VARIANT_TRUE: VARIANT_FALSE;
+ ret = sal_True;
+ break;
+ }
+ case TypeClass_CHAR:// char
+ {
+ // Because VT_UI2 does not conform to oleautomation we convert into VT_I2 instead
+// V_VT(pVariant) = VT_BSTR;
+// sal_uInt16 _c = *(sal_uInt16*)rAny.getValue();
+// pVariant->bstrVal= SysAllocStringLen( &_c, 1);
+// ret= pVariant->bstrVal ? sal_True : sal_False;
+ V_VT(pVariant) = VT_I2;
+ V_I2(pVariant) = *(sal_Int16*)rAny.getValue();
+ ret = sal_True;
+ break;
+ }
+ case TypeClass_STRING: // UString
+ V_VT(pVariant) = VT_BSTR;
+ V_BSTR(pVariant) = SysAllocString( OUString(*(rtl_uString**)rAny.getValue()));
+ ret = sal_True;
+ break;
+ case TypeClass_FLOAT: // float
+ V_VT(pVariant) = VT_R4;
+ V_R4(pVariant) = *(float*)rAny.getValue();
+ ret = sal_True;
+ break;
+ case TypeClass_DOUBLE: // double
+ V_VT(pVariant) = VT_R8;
+ V_R8(pVariant) = *(double*)rAny.getValue();
+ ret = sal_True;
+ break;
+ case TypeClass_BYTE: // BYTE
+ // ole automation does not know a signed char but only unsigned char
+ V_VT(pVariant) = VT_UI1;
+ V_UI1(pVariant) = *(sal_uInt8*)rAny.getValue();
+ ret= sal_False;
+ break;
+ case TypeClass_SHORT: // INT16
+ V_VT(pVariant) = VT_I2;
+ V_I2(pVariant) = *(sal_Int16*)rAny.getValue();
+ ret = sal_True;
+ break;
+ case TypeClass_LONG: // INT32
+ V_VT(pVariant) = VT_I4;
+ V_I4(pVariant) = *(sal_Int32*)rAny.getValue();
+ ret = sal_True;
+ break;
+ case TypeClass_HYPER: // INT64
+ // V_VT(pVariant) = VT_CY;
+ // V_CY(pVariant).Lo = rAny.getINT64().p.loPart;
+ // V_CY(pVariant).Lo = rAny.getINT64().p.hiPart;
+ // ret = sal_True;
+ break;
+ //case TypeClass_UNSIGNED_OCTET: // ??? not implemented
+ // V_VT(pVariant) = VT_UI1;
+ // V_UI1(pVariant) = rAny.getBYTE();
+ // ret = sal_True;
+ // break;
+ case TypeClass_UNSIGNED_SHORT: // UINT16
+ V_VT(pVariant) = VT_I2;
+ V_I2(pVariant) = *(sal_Int16*)rAny.getValue();
+ ret = sal_False;
+ break;
+ case TypeClass_UNSIGNED_LONG: // UINT32
+ V_VT(pVariant) = VT_I4;
+ V_I4(pVariant) = *(sal_Int32*)rAny.getValue();
+ ret = sal_False;
+ break;
+ case TypeClass_UNSIGNED_HYPER: // UINT64
+ // V_VT(pVariant) = VT_UI8;
+ // V_UI8(pVariant) = rAny.getUINT64();
+ // ret = sal_True;
+ break;
+ // case TypeClass_UNSIGNED_INT: // int not implemented
+ // break;
+ //case TypeClass_UNSIGNED_BYTE:
+ // V_VT(pVariant) = VT_UI1;
+ // V_UI1(pVariant) = rAny.getBYTE();
+ // ret = sal_True;
+ // break;
+ case TypeClass_MODULE: // module
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+template<class T>
+SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq)
+{
+ SAFEARRAY* pArray = NULL;
+ sal_uInt32 n = 0;
+
+ if( rSeq.getValueTypeClass() == TypeClass_SEQUENCE )
+ {
+ uno_Sequence * punoSeq= *(uno_Sequence**) rSeq.getValue();
+
+ typelib_TypeDescriptionReference* pSeqTypeRef= rSeq.getValueTypeRef();
+ typelib_TypeDescription* pSeqType= NULL;
+ TYPELIB_DANGER_GET( &pSeqType, pSeqTypeRef)
+ typelib_IndirectTypeDescription * pSeqIndDec= (typelib_IndirectTypeDescription*) pSeqType;
+// typelib_IndirectTypeDescription * pSeqDec= (typelib_IndirectTypeDescription*)rSeq.getValueTypeDescriptionRef();
+
+ typelib_TypeDescriptionReference * pSeqElementTypeRef= pSeqIndDec->pType;
+ TYPELIB_DANGER_RELEASE( pSeqType)
+
+
+
+ typelib_TypeDescription* pSeqElementDesc= NULL;
+ TYPELIB_DANGER_GET( &pSeqElementDesc, pSeqElementTypeRef)
+ sal_Int32 nElementSize= pSeqElementDesc->nSize;
+ n= punoSeq->nElements;
+
+ SAFEARRAYBOUND rgsabound[1];
+ rgsabound[0].lLbound = 0;
+ rgsabound[0].cElements = n;
+ VARIANT oleElement;
+ long safeI[1];
+
+ pArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
+
+ Any unoElement;
+ // sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->pElements;
+ sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->elements;
+
+ for (sal_uInt32 i = 0; i < n; i++)
+ {
+ unoElement.setValue( pSeqData + i * nElementSize, pSeqElementDesc);
+ VariantInit(&oleElement);
+
+ if (anyToVariant(&oleElement, unoElement))
+ {
+ safeI[0] = i;
+ SafeArrayPutElement(pArray, safeI, &oleElement);
+ }
+
+ VariantClear(&oleElement);
+ }
+ TYPELIB_DANGER_RELEASE( pSeqElementDesc)
+ }
+
+ return pArray;
+}
+
+template<class T>
+IDispatch* UnoConversionUtilities<T>::createUnoObjectWrapper(const Any& rObj)
+{
+ OGuard guard(globalWrapperMutex);
+
+ IDispatch* pDispatch = NULL;
+ Reference<XInvocation> xInv;
+ Reference<XInterface> xInt;
+
+
+ // If the UNO object is already a wrapped COM object then
+ // of course the original IDispatch is returned.
+ if( rObj.getValueTypeClass() == TypeClass_INTERFACE)
+ {
+ if( rObj >>= xInt)
+ {
+ // can the object provide a Wrapper on its own
+ if( ! convertSelfToIDispatch( xInt, &pDispatch) )
+ {
+ // figure out if the UNO object is a Wrapper through global maps
+ typedef hash_map<sal_uInt32,sal_uInt32>::iterator _IT;
+ _IT it= AdapterToWrapperMap.find( (sal_uInt32) xInt.get());
+ if( it != AdapterToWrapperMap.end() )
+ {
+ Reference<XInterface> xIntWrapper( (XInterface*)it->second);
+ convertSelfToIDispatch( xIntWrapper, &pDispatch); // should always work on the objects in the map
+ }
+ else
+ xInv= Reference<XInvocation>( xInt, UNO_QUERY);
+ }
+ }
+ }
+
+ if (! pDispatch && !xInv.is())
+ {
+ // static Reference<XSingleServiceFactory> xInvFactory(o2u_getMultiServiceFactory()->createInstance(INVOCATION_SERVICE),UNO_QUERY);
+ Reference<XSingleServiceFactory> xInvFactory= getInvocationFactory();
+ if( xInvFactory.is())
+ {
+ Sequence<Any> params(1);
+ params.getArray()[0] = rObj;
+ Reference<XInterface> xInt = xInvFactory->createInstanceWithArguments(params);
+ xInv= Reference<XInvocation>(xInt, UNO_QUERY);
+ }
+ }
+
+ OSL_ENSURE(xInv.is() || pDispatch, "no invocation interface");
+ if( !pDispatch)
+ {
+ Reference< XInterface > xIntWrapper= createUnoWrapperInstance();
+ if( xIntWrapper.is())
+ {
+ Reference< XInitialization > xInitWrapper( xIntWrapper, UNO_QUERY);
+ if( xInitWrapper.is() )
+ {
+ VARTYPE vartype= getVarType( rObj);
+
+ if( xInt.is())
+ {
+ Any params[3];
+ params[0] <<= xInv;
+ params[1] <<= xInt;
+ params[2] <<= vartype;
+ xInitWrapper->initialize( Sequence<Any>(params, 3));
+ }
+ else
+ {
+ Any params[2];
+ params[0] <<= xInv;
+ params[1] <<= vartype;
+ xInitWrapper->initialize( Sequence<Any>(params, 2));
+ }
+
+ // Get the IDispatch
+ // A wrapper is expected to implement XBridgeSupplier in order to
+ // convert itself to an IDispatch:
+ IDispatch* pDisp;
+ if( convertSelfToIDispatch( xIntWrapper, &pDisp))
+ pDispatch= pDisp;
+ }
+ }
+ }
+
+ return pDispatch;
+}
+
+template<class T>
+sal_Bool UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny,
+ sal_Bool bReduceValueRange /* = sal_True */)
+{
+ sal_Bool ret = sal_False;
+ VARTYPE oleTypeFlags = V_VT(pVariant);
+
+ if ((oleTypeFlags & VT_BYREF) != 0)
+ {
+ oleTypeFlags ^= VT_BYREF;
+
+ if ((oleTypeFlags & VT_ARRAY) != 0)
+ {
+ oleTypeFlags ^= VT_ARRAY;
+
+ Sequence<Any> unoSeq = createOleArrayWrapper(*V_ARRAYREF(pVariant), oleTypeFlags);
+ rAny.setValue( &unoSeq, getCppuType( &unoSeq));
+
+ ret = sal_True;
+ }
+ else
+ {
+ switch (oleTypeFlags) // conversion by reference
+ {
+ case VT_EMPTY: // jo
+ rAny.setValue(NULL, Type());
+ ret= sal_True;
+ break;
+ case VT_NULL:
+ rAny.setValue(NULL, Type());
+ ret = sal_True;
+ break;
+ case VT_I2:
+ rAny.setValue(V_I2REF(pVariant), getCppuType((sal_Int16*)0));
+ ret = sal_True;
+ break;
+ case VT_I4:
+ rAny.setValue(V_I4REF(pVariant), getCppuType((sal_Int32*)0));
+ ret = sal_True;
+ break;
+ case VT_R4:
+ rAny.setValue(V_R4REF(pVariant), getCppuType( (float*)0));
+ ret = sal_True;
+ break;
+ case VT_R8:
+ rAny.setValue(V_R8REF(pVariant), getCppuType( (double*)0));
+ ret = sal_True;
+ break;
+ case VT_CY:
+ // rAny.setHyper(*V_CYREF(pVariant));
+ // ret = sal_True;
+ break;
+ case VT_DATE:
+ break;
+ case VT_BSTR:
+ {
+ OUString s(*V_BSTRREF(pVariant));
+ rAny.setValue( &s, getCppuType( &s));
+ ret = sal_True;
+ break;
+ }
+ case VT_DISPATCH:
+ {
+ IUnknown* pUnknown = NULL;
+
+ if ((*V_DISPATCHREF(pVariant)) != NULL)
+ {
+ (*V_DISPATCHREF(pVariant))->QueryInterface(IID_IUnknown, (void**)&pUnknown);
+ }
+
+ rAny = createOleObjectWrapper(pUnknown);
+
+ if (pUnknown != NULL)
+ {
+ pUnknown->Release();
+ }
+
+ ret = sal_True;
+ break;
+ }
+ case VT_ERROR:
+ rAny.setValue(V_ERRORREF(pVariant), getCppuType( (sal_uInt32*)0));
+ ret = sal_True;
+ break;
+ case VT_BOOL:
+ {
+ sal_Bool b= (*V_BOOLREF(pVariant)) == VARIANT_TRUE;
+ rAny.setValue( &b, getCppuType( &b));
+ ret = sal_True;
+ break;
+ }
+ case VT_VARIANT:
+ {
+ if (V_VT(V_VARIANTREF(pVariant)) == VT_EMPTY)
+ {
+ rAny.setValue(NULL, Type());
+ ret = sal_True;
+ }
+ else
+ {
+ ret = variantToAny(V_VARIANTREF(pVariant), rAny);
+ }
+ }
+ break;
+ case VT_UNKNOWN:
+ rAny = createOleObjectWrapper(*V_UNKNOWNREF(pVariant));
+ ret = sal_True;
+ break;
+ case VT_I1:
+ rAny.setValue(V_I1REF(pVariant), getCppuType( (sal_Int8*)0));
+ ret = sal_True;
+ break;
+ case VT_UI1:
+ // convert to sal_Int8 because there is no Type for sal_uInt8
+ rAny.setValue(V_UI1REF(pVariant), getCppuType( (sal_Int8*)0));
+ ret = sal_True;
+ break;
+ case VT_UI2:
+ rAny.setValue(V_UI2REF(pVariant), getCppuType( (sal_uInt16*)0));
+ ret = sal_True;
+ break;
+ case VT_UI4:
+ rAny.setValue(V_UI4REF(pVariant), getCppuType( (sal_uInt32*)0));
+ ret = sal_True;
+ break;
+ case VT_INT:
+ rAny.setValue(V_INTREF(pVariant), getCppuType( (sal_Int32*)0));
+ ret = sal_True;
+ break;
+ case VT_UINT:
+ rAny.setValue(V_UINTREF(pVariant), getCppuType((sal_uInt32*)0));
+ ret = sal_True;
+ break;
+ case VT_VOID:
+ rAny.setValue( NULL, Type());
+ ret = sal_True;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ else
+ {
+ if ((oleTypeFlags & VT_ARRAY) > 0)
+ {
+ oleTypeFlags ^= VT_ARRAY;
+
+ Sequence<Any> unoSeq = createOleArrayWrapper(V_ARRAY(pVariant), oleTypeFlags);
+ rAny.setValue( &unoSeq, getCppuType( &unoSeq));
+
+ ret = sal_True;
+ }
+ else
+ {
+ switch (oleTypeFlags) // conversion by value
+ {
+ case VT_EMPTY: // jo
+ rAny.setValue(NULL, Type());
+ ret= sal_True;
+ break;
+
+ case VT_NULL:
+ rAny.setValue(NULL, Type());
+ ret = sal_True;
+ break;
+ case VT_I2:
+ rAny.setValue(&V_I2(pVariant), getCppuType( (sal_Int16*)0));
+ ret = sal_True;
+ break;
+ case VT_I4:
+ rAny.setValue(&V_I4(pVariant), getCppuType( (sal_Int32*)0));
+ // necessary for use in JavaScript ( see "reduceRange")
+ if( bReduceValueRange)
+ reduceRange( rAny);
+ ret = sal_True;
+ break;
+ case VT_R4:
+ rAny.setValue(&V_R4(pVariant), getCppuType( (float*)0));
+ ret = sal_True;
+ break;
+ case VT_R8:
+ rAny.setValue(&V_R8(pVariant), getCppuType( (double*)0));
+ ret = sal_True;
+ break;
+ case VT_CY:
+ // rAny.setHyper(V_CY(pVariant));
+ // ret = sal_True;
+ break;
+ case VT_DATE:
+ break;
+ case VT_BSTR:
+ {
+ OUString b( V_BSTR(pVariant));
+ rAny.setValue( &b, getCppuType( &b));
+ ret = sal_True;
+ break;
+ }
+ case VT_DISPATCH:
+ {
+ IUnknown* pUnknown = NULL;
+
+ if (V_DISPATCH(pVariant) != NULL)
+ {
+ V_DISPATCH(pVariant)->QueryInterface(IID_IUnknown, (void**)&pUnknown);
+ }
+
+ rAny = createOleObjectWrapper(pUnknown);
+
+ if (pUnknown != NULL)
+ {
+ pUnknown->Release();
+ }
+
+ ret = sal_True;
+
+ break;
+ }
+ case VT_ERROR:
+ rAny.setValue(&V_ERROR(pVariant), getCppuType( (sal_uInt32*)0));
+ ret = sal_True;
+ break;
+ case VT_BOOL:
+ {
+ sal_Bool b= V_BOOL(pVariant) == VARIANT_TRUE;
+ rAny.setValue( &b, getCppuType( &b));
+ ret = sal_True;
+ break;
+ }
+ case VT_UNKNOWN:
+ rAny = createOleObjectWrapper(V_UNKNOWN(pVariant));
+ ret = sal_True;
+ break;
+ case VT_I1:
+ rAny.setValue(&V_I1(pVariant), getCppuType((sal_Int8*)0));
+ ret = sal_True;
+ break;
+ case VT_UI1: // there is no unsigned char in UNO
+ rAny.setValue((char*)&V_UI1(pVariant), getCppuType( (sal_Int8*)0));
+ ret = sal_True;
+ break;
+ case VT_UI2:
+ rAny.setValue(&V_UI2(pVariant), getCppuType( (sal_uInt16*)0));
+ ret = sal_True;
+ break;
+ case VT_UI4:
+ rAny.setValue(&V_UI4(pVariant), getCppuType( (sal_uInt32*)0));
+ ret = sal_True;
+ break;
+ case VT_INT:
+ rAny.setValue(&V_INT(pVariant), getCppuType( (sal_Int32*)0));
+ ret = sal_True;
+ break;
+ case VT_UINT:
+ rAny.setValue(&V_UINT(pVariant), getCppuType( (sal_uInt32*)0));
+ ret = sal_True;
+ break;
+ case VT_VOID:
+ rAny.setValue( NULL, Type());
+ ret = sal_True;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
+
+template<class T>
+Any UnoConversionUtilities<T>::createOleObjectWrapper(IUnknown* pUnknown)
+{
+ Any ret;
+
+ Reference<XInterface> xInt;
+
+ if (pUnknown == NULL)
+ {
+ ret <<= xInt;
+ }
+ else
+ {
+ CComQIPtr<IUnoObjectWrapper> spUno( pUnknown);
+ if( spUno)
+ {
+ Reference<XInterface> xInt;
+ spUno->getOriginalUnoObject( &xInt);
+ ret <<= xInt;
+ }
+ else
+ {
+ Reference<XInterface> xInt= createComWrapperInstance();
+ if( xInt.is())
+ {
+ Reference<XInitialization> xInit( xInt, UNO_QUERY);
+ if( xInit.is())
+ {
+ Any param;
+ param <<= (sal_uInt32) pUnknown;
+ xInit->initialize( Sequence<Any>(&param, 1));
+ }
+ }
+ ret<<= Reference<XInvocation>( xInt, UNO_QUERY);
+ }
+ }
+
+ return ret;
+}
+
+// if the object supports only one type then it does not have to implement the property
+// SUPPORTER_INTERFACES_PROP ( define)
+template<class T>
+Any UnoConversionUtilities<T>::createOleObjectWrapper(IUnknown* pUnknown, const Type& aType)
+{
+ OGuard guard( globalWrapperMutex);
+ Any ret;
+
+ Reference<XInterface> xInt;
+
+ if (pUnknown == NULL)
+ {
+ if( aType.getTypeClass() == TypeClass_INTERFACE)
+ ret.setValue( &xInt, aType);
+ else if( aType.getTypeClass() == TypeClass_STRUCT)
+ ret.setValue( NULL, aType);
+ }
+ else
+ {
+ CComQIPtr<IUnoObjectWrapper> spUno( pUnknown);
+ if( spUno)
+ {
+ if( aType.getTypeClass() == TypeClass_INTERFACE)
+ {
+ Reference<XInterface> xInt;
+ spUno->getOriginalUnoObject( &xInt);
+ if( xInt.is())
+ {
+ ret= xInt->queryInterface( aType);
+ }
+
+ }
+ else if( aType.getTypeClass() == TypeClass_STRUCT)
+ {
+ Any any;
+ if( SUCCEEDED( spUno->getOriginalUnoStruct(&any)))
+ ret= any;
+ }
+ }
+ else
+ {
+ Reference<XInterface> xInt= createComWrapperInstance();
+ if( xInt.is())
+ {
+// Reference<XInitialization> xInit( xInt, UNO_QUERY);
+// if( xInit.is())
+// {
+// Any params[2];
+// params[0] <<= (sal_uInt32) pUnknown;
+// params[1] <<= aType;
+// xInit->initialize( Sequence<Any>( params, 2));
+// }
+
+ Reference<XInvocation> xInv( xInt, UNO_QUERY);
+
+ Sequence<Type> seqTypes;
+
+ // create the actual Interface of type "Type"
+ // If the type is XInvocation than we use the COM wrapper directly.
+ if( aType.getTypeName() == OUString::createFromAscii("com.sun.star.script.XInvocation"))
+ {
+ ret <<= xInv;
+ }
+ else
+ {
+ Reference< XInterface> xIntAdapterFac;
+ if( m_xMultiServiceFactory.is())
+ {
+ xIntAdapterFac= m_xMultiServiceFactory->createInstance( INTERFACE_ADAPTER_FACTORY);
+
+ }
+ else
+ {
+ xIntAdapterFac= o2u_getMultiServiceFactory()->createInstance( INTERFACE_ADAPTER_FACTORY);
+ }
+
+ // We create an adapter object that does not only implement the required type but also
+ // all types that the COM object pretends to implement. An COM object must therefore
+ // support the property "_implementedInterfaces". If it does not an Adapter of param
+ // type
+// Sequence<Type> seqTypes;
+ CComDispatchDriver disp( pUnknown);
+ if( disp)
+ {
+ CComVariant var;
+ if( SUCCEEDED( disp.GetPropertyByName( SUPPORTED_INTERFACES_PROP, &var)))
+ {// we exspect an array( SafeArray or IDispatch) of Strings.
+ Any anyNames;
+ if( variantToAny2( &var, anyNames, getCppuType( (Sequence<Any>*) 0)))
+ {
+ Sequence<Any> seqAny;
+ if( anyNames >>= seqAny)
+ {
+ seqTypes.realloc( seqAny.getLength());
+ for( sal_Int32 i=0; i < seqAny.getLength(); i++)
+ {
+ OUString typeName;
+ seqAny[i] >>= typeName;
+ seqTypes[i]= Type( TypeClass_INTERFACE, typeName);
+ }
+ }
+ }
+ }
+ }
+
+ Reference<XInterface> xIntAdapted;
+ if( seqTypes.getLength() >0)
+ {
+ Reference< XInvocationAdapterFactory2> xAdapterFac( xIntAdapterFac, UNO_QUERY);
+ if( xAdapterFac.is())
+ xIntAdapted= xAdapterFac->createAdapter( xInv, seqTypes);
+ }
+ else
+ {
+ Reference<XInvocationAdapterFactory> xAdapterFac( xIntAdapterFac, UNO_QUERY);
+ if( xAdapterFac.is())
+ xIntAdapted= xAdapterFac->createAdapter( xInv, aType);
+ }
+ if( xIntAdapted.is())
+ {
+ ret= xIntAdapted->queryInterface( aType);
+ // Put the pointer to the wrapper object and the interface pointer of the adapted interface
+ // in a global map. Thus we can determine in a call to createUnoObjectWrapper whether the UNO
+ // object is a wrapped COM object. In that case we extract the original COM object rather than
+ // creating a wrapper around the UNO object.
+ typedef hash_map<sal_uInt32,sal_uInt32>::value_type VALUE;
+ AdapterToWrapperMap.insert( VALUE( (sal_uInt32) xIntAdapted.get(), (sal_uInt32) xInt.get()));
+ WrapperToAdapterMap.insert( VALUE( (sal_uInt32) xInt.get(), (sal_uInt32) xIntAdapted.get()));
+
+ }
+ }
+
+ // initialize the COM wrapper ( IUnknown + Type s)
+ Reference<XInitialization> xInit( xInt, UNO_QUERY);
+ if( xInit.is())
+ {
+ Any params[2];
+ params[0] <<= (sal_uInt32) pUnknown;
+ if( ! seqTypes.getLength() )
+ {
+ params[1] <<= Sequence<Type>( &aType, 1);
+ }
+ else
+ {
+ params[1] <<= seqTypes;
+ }
+
+ xInit->initialize( Sequence<Any>( params, 2));
+ }
+
+ }
+ }
+ }
+
+ return ret;
+}
+// "convertValueObject" converts a JScriptValue object contained in "var" into
+// an any. The type contained in the any is stipulated by a "type value" thas
+// was set within the JScript script on the value object ( see JScriptValue).
+template<class T>
+sal_Bool UnoConversionUtilities<T>::convertValueObject( const VARIANTARG *var, Any& any, sal_Bool& bHandled)
+{
+ sal_Bool ret= sal_True;
+ bHandled= sal_False;
+ HRESULT hr= S_OK;
+
+ if( var->vt == VT_DISPATCH)
+ {
+ CComPtr <IJScriptValueObject> spValue;
+ VARIANT_BOOL varBool;
+ CComBSTR bstrType;
+ CComVariant varValue;
+
+ if( SUCCEEDED( var->pdispVal->QueryInterface( __uuidof( IJScriptValueObject),
+ reinterpret_cast<void**> (&spValue))))
+ {
+ // Out Parameter --------------------------------------------------
+ if( SUCCEEDED( hr= spValue->IsOutParam( &varBool) )
+ && varBool == VARIANT_TRUE )
+ {// no conversion necessary
+ bHandled= sal_True;
+ }
+ // In / Out Parameter ---------------------------------------------
+ else if( SUCCEEDED( hr= spValue->IsInOutParam( &varBool) )
+ && varBool == VARIANT_TRUE)
+ {
+ if( SUCCEEDED( hr= spValue->GetValue( &bstrType, &varValue)))
+ {
+ if( variantToAny2( &varValue, any, getType( bstrType)))
+ {
+ bHandled= sal_True;
+ }
+ } //IJScriptValueObject::GetValue()
+ } // in/out parameter
+ // In Parameter
+ else
+ {
+ if( SUCCEEDED( hr= spValue->GetValue( &bstrType, &varValue)))
+ {
+ if( variantToAny2(&varValue, any, getType( bstrType)))
+ {
+ bHandled= sal_True;
+ }
+ }
+ }
+
+ }// if IJScriptValueObject
+ }// if IDispatch
+ if( FAILED( hr) )
+ ret= sal_False;
+ return ret;
+}
+template<class T>
+sal_Bool UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pvar, Any& anySeq, const Type& type)
+{
+ sal_Bool retVal= TRUE;
+
+ if( pvar->vt != VT_DISPATCH) return FALSE;
+ IDispatchEx* pdispEx;
+ HRESULT hr;
+ if( FAILED( hr= pvar->pdispVal->QueryInterface( IID_IDispatchEx,
+ reinterpret_cast<void**>( &pdispEx)))) return FALSE;
+
+ DISPID dispid;
+ OUString sindex;
+ DISPPARAMS param= {0,0,0,0};
+ VARIANT result;
+ VariantInit( & result);
+ OLECHAR* sLength= L"length";
+
+ // Get the length of the array. Can also be obtained throu GetNextDispID. The
+ // method only returns DISPIDs of the array data. Their names are like "0", "1" etc.
+ if( FAILED( hr= pdispEx->GetIDsOfNames(IID_NULL, &sLength , 1, LOCALE_USER_DEFAULT, &dispid)))
+ return FALSE;
+ if( FAILED( hr= pdispEx->InvokeEx(dispid, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET,
+ &param, &result, NULL, NULL)))
+ return FALSE;
+ if( FAILED( VariantChangeType( &result, &result, 0, VT_I4)))
+ return FALSE;
+ long length= result.lVal;
+ VariantClear( &result);
+
+ // get a few basic facts about the sequence, and reallocate:
+ // create the Sequences
+ // get the size of the elements
+ typelib_TypeDescription *pDesc= NULL;
+ type.getDescription( &pDesc);
+
+ typelib_IndirectTypeDescription *pSeqDesc= reinterpret_cast<typelib_IndirectTypeDescription*>(pDesc);
+ typelib_TypeDescriptionReference *pSeqElemDescRef= pSeqDesc->pType; // type of the Sequence' elements
+ Type elemType( pSeqElemDescRef);
+ _typelib_TypeDescription* pSeqElemDesc=NULL;
+ TYPELIB_DANGER_GET( &pSeqElemDesc, pSeqElemDescRef)
+ sal_uInt32 nelementSize= pSeqElemDesc->nSize;
+ TYPELIB_DANGER_RELEASE( pSeqElemDesc)
+
+ uno_Sequence *p_uno_Seq;
+ uno_sequence_construct( &p_uno_Seq, pDesc, NULL, length, cpp_acquire);
+
+ typelib_TypeClass typeElement= pSeqDesc->pType->eTypeClass;
+ char *pArray= p_uno_Seq->elements;
+
+ // Get All properties in the object, convert their values to the expected type and
+ // put them into the passed in sequence
+ for( sal_Int32 i= 0; i< length; i++)
+ {
+ OLECHAR* sindex = (sal_Unicode*)(const sal_Unicode*)OUString::valueOf( i);
+
+ if( FAILED( hr= pdispEx->GetIDsOfNames(IID_NULL, &sindex , 1, LOCALE_USER_DEFAULT, &dispid)))
+ {
+ retVal= FALSE;
+ break;
+ }
+ if( FAILED( hr= pdispEx->InvokeEx(dispid, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET,
+ &param, &result, NULL, NULL)))
+ {
+ retVal= FALSE;
+ break;
+ }
+
+ // If the result is VT_DISPATCH than the Sequence's element type could be Sequence
+ // Look that up in the CoreReflection to make clear.
+ // That requires a recursiv conversion
+ Any any;
+ // Destination address within the out-Sequence "anySeq" where to copy the next converted element
+ void* pDest= (void*)(pArray + (i * nelementSize));
+
+ if( result.vt & VT_DISPATCH && typeElement == typelib_TypeClass_SEQUENCE)
+ {
+ if( variantToAny2( &result, any, elemType, sal_False) )
+ {
+ // copy the converted VARIANT, that is a Sequence to the Sequence
+ uno_Sequence * p_unoSeq= *(uno_Sequence**)any.getValue();
+ // just copy the pointer of the uno_Sequence
+ // nelementSize should be 4 !!!!
+ memcpy( pDest, &p_unoSeq, nelementSize);
+ osl_incrementInterlockedCount( &p_unoSeq->nRefCount);
+ }
+ else
+ {
+ retVal= FALSE;
+ break;
+ }
+ }
+ else // Element type is no Sequence -> do one conversion
+ {
+ if( variantToAny2( &result, any, elemType, sal_False) )
+ {
+
+ if( typeElement == typelib_TypeClass_ANY)
+ {
+ // copy the converted VARIANT to the Sequence
+ uno_type_assignData( pDest, pSeqElemDescRef , &any, pSeqElemDescRef,cpp_queryInterface,
+ cpp_acquire, cpp_release);
+ }
+ else
+ {
+ // type after conversion must be the element type of the sequence
+ OSL_ENSURE( (any.getValueTypeClass() == typeElement), "wrong conversion");
+ uno_type_assignData( pDest, pSeqElemDescRef,const_cast<void*>( any.getValue()), any.getValueTypeRef(),
+ cpp_queryInterface, cpp_acquire, cpp_release);
+ }
+ } // if
+ else
+ {
+ retVal= FALSE;
+ break;
+ }
+ } // else
+ VariantClear(&result);
+ if( retVal == FALSE)
+ break;
+ } // for
+ VariantClear(&result);
+ uno_Sequence **pps= &p_uno_Seq;
+ anySeq.setValue( &p_uno_Seq, pDesc);
+ uno_destructData( &p_uno_Seq, pDesc, cpp_release);
+ typelib_typedescription_release( pDesc);
+ return retVal;
+}
+template<class T>
+Sequence<Any> UnoConversionUtilities<T>::createOleArrayWrapperOfDim(SAFEARRAY* pArray, unsigned int dimCount, unsigned int actDim, long* index, VARTYPE type)
+{
+ HRESULT hr= S_OK;
+ long lBound;
+ long uBound;
+ long nCountElements;
+
+ SafeArrayGetLBound(pArray, actDim + 1, &lBound);
+ SafeArrayGetUBound(pArray, actDim + 1, &uBound);
+ nCountElements= uBound - lBound +1;
+
+
+ Sequence<Any> anySeq(nCountElements);
+ Any* pUnoArray = anySeq.getArray();
+
+ for (index[actDim] = lBound; index[actDim] < nCountElements; index[actDim]++)
+ {
+ if (actDim < (dimCount - 1))
+ {
+ Sequence<Any> element = createOleArrayWrapperOfDim(pArray, dimCount, actDim + 1, index, type);
+
+ pUnoArray[index[actDim] - lBound].setValue(&element, getCppuType(&element));
+ }
+ else
+ {
+ VARIANT variant;
+
+ VariantInit(&variant);
+
+ V_VT(&variant) = type;
+
+ switch (type)
+ {
+ case VT_I2:
+ SafeArrayGetElement(pArray, index, &V_I2(&variant));
+ break;
+ case VT_I4:
+ SafeArrayGetElement(pArray, index, &V_I4(&variant));
+ break;
+ case VT_R4:
+ SafeArrayGetElement(pArray, index, &V_R4(&variant));
+ break;
+ case VT_R8:
+ SafeArrayGetElement(pArray, index, &V_R8(&variant));
+ break;
+ case VT_CY:
+ SafeArrayGetElement(pArray, index, &V_CY(&variant));
+ break;
+ case VT_DATE:
+ SafeArrayGetElement(pArray, index, &V_DATE(&variant));
+ break;
+ case VT_BSTR:
+ hr= SafeArrayGetElement(pArray, index, &V_BSTR(&variant));
+ break;
+ case VT_DISPATCH:
+ SafeArrayGetElement(pArray, index, &V_DISPATCH(&variant));
+ break;
+ case VT_ERROR:
+ SafeArrayGetElement(pArray, index, &V_ERROR(&variant));
+ break;
+ case VT_BOOL:
+ SafeArrayGetElement(pArray, index, &V_BOOL(&variant));
+ break;
+ case VT_VARIANT:
+ SafeArrayGetElement(pArray, index, &variant);
+ break;
+ case VT_UNKNOWN:
+ SafeArrayGetElement(pArray, index, &V_UNKNOWN(&variant));
+ break;
+ case VT_I1:
+ SafeArrayGetElement(pArray, index, &V_I1(&variant));
+ break;
+ case VT_UI1:
+ SafeArrayGetElement(pArray, index, &V_UI1(&variant));
+ break;
+ case VT_UI2:
+ SafeArrayGetElement(pArray, index, &V_UI2(&variant));
+ break;
+ case VT_UI4:
+ SafeArrayGetElement(pArray, index, &V_UI4(&variant));
+ break;
+ default:
+ break;
+ }
+
+ variantToAny(&variant, pUnoArray[index[actDim] - lBound], sal_False);
+
+ VariantClear(&variant);
+ }
+ }
+
+ return anySeq;
+}
+template<class T>
+Sequence<Any> UnoConversionUtilities<T>::createOleArrayWrapper(SAFEARRAY* pArray, VARTYPE type)
+{
+ sal_uInt32 dim = SafeArrayGetDim(pArray);
+
+ Sequence<Any> ret;
+
+ if (dim > 0)
+ {
+ long * index = new long[dim];
+
+ for (unsigned int i = 0; i < dim; i++)
+ {
+ index[i] = 0;
+ }
+
+ ret = createOleArrayWrapperOfDim(pArray, dim, 0, index, type);
+
+ delete[] index;
+ }
+
+ return ret;
+}
+
+// If an VARIANT has the type VT_DISPATCH it can either be an JScript Array
+// or some other object. This function finds out if it is such an array or
+// not. Currently there's no way to make sure it's an array
+// so we assume that when the object has a property "0" then it is an Array.
+// An JScript has property like "0", "1", "2" etc. which represent the
+// value at the corresponding index of the array
+template<class T>
+sal_Bool UnoConversionUtilities<T>::isJScriptArray(const VARIANT* rvar)
+{
+ OSL_ENSURE( rvar->vt == VT_DISPATCH, "param is not a VT_DISPATCH");
+ HRESULT hr;
+ OLECHAR* sindex= L"0";
+ DISPID id;
+ hr= rvar->pdispVal->GetIDsOfNames( IID_NULL, &sindex, 1,
+ LOCALE_USER_DEFAULT, &id);
+
+ if( SUCCEEDED ( hr) )
+ return sal_True;
+ return sal_False;
+}
+
+template<class T>
+VARTYPE UnoConversionUtilities<T>::mapTypeClassToVartype( TypeClass type)
+{
+ VARTYPE ret;
+ switch( type)
+ {
+ case TypeClass_INTERFACE: ret= VT_DISPATCH;
+ break;
+ case TypeClass_STRUCT: ret= VT_DISPATCH;
+ break;
+ case TypeClass_ENUM: ret= VT_I4;
+ break;
+ case TypeClass_SEQUENCE: ret= VT_ARRAY;
+ break;
+ case TypeClass_ANY: ret= VT_VARIANT;
+ break;
+ case TypeClass_BOOLEAN: ret= VT_BOOL;
+ break;
+ case TypeClass_CHAR: ret= VT_UI2;
+ break;
+ case TypeClass_STRING: ret= VT_BSTR;
+ break;
+ case TypeClass_FLOAT: ret= VT_R4;
+ break;
+ case TypeClass_DOUBLE: ret= VT_R8;
+ break;
+ case TypeClass_BYTE: ret= VT_I1;
+ break;
+ case TypeClass_SHORT: ret= VT_I2;
+ break;
+ case TypeClass_LONG: ret= VT_I4;
+ break;
+ case TypeClass_UNSIGNED_SHORT: ret= VT_UI2;
+ break;
+ case TypeClass_UNSIGNED_LONG: ret= VT_UI4;
+ break;
+ default:
+ ret= VT_EMPTY;
+ }
+ return ret;
+}
+
+
+// This function tries to the change the type of a value (contained in the Any)
+// to the smallest possible that can hold the value. This is actually done only
+// for types of VT_I4 (see o2u_variantToAny). The reason is the following:
+// JavaScript passes integer values always as VT_I4. If there is a parameter or
+// property of type any then the bridge converts the any's content according
+// to "o2u_variantToAny". Because the VARTYPE is VT_I4 the value would be converted
+// to TypeClass_LONG. Say the method XPropertySet::setPropertyValue( string name, any value)
+// would be called on an object and the property actually is of TypeClass_SHORT.
+// After conversion of the VARIANT parameter the Any would contain type
+// TypeClass_LONG. Because the corereflection does not cast from long to short
+// the "setPropertValue" would fail as the value has not the right type.
+
+// The corereflection does convert small integer types to bigger types.
+// Therefore we can reduce the type if possible and avoid the above mentioned
+// problem.
+
+// The function is not used when elements are to be converted for Sequences.
+
+#ifndef _REDUCE_RANGE
+#define _REDUCE_RANGE
+inline void reduceRange( Any& any)
+{
+ OSL_ASSERT( any.getValueTypeClass() == TypeClass_LONG);
+
+ sal_Int32 value= *(sal_Int32*)any.getValue();
+ if( value <= 0x7f && value >= -0x80)
+ {// -128 bis 127
+ sal_Int8 charVal= static_cast<sal_Int8>( value);
+ any.setValue( &charVal, getCppuType( (sal_Int8*)0));
+ }
+ else if( value <= 0x7fff && value >= -0x8000)
+ {// -32768 bis 32767
+ sal_Int16 shortVal= static_cast<sal_Int16>( value);
+ any.setValue( &shortVal, getCppuType( (sal_Int16*)0));
+ }
+}
+#endif
+} // end namespace
+#endif
+
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
new file mode 100644
index 000000000..d61bcd7d8
--- /dev/null
+++ b/extensions/source/ole/unoobjw.cxx
@@ -0,0 +1,2414 @@
+/*************************************************************************
+ *
+ * $RCSfile: unoobjw.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "ole2uno.hxx"
+
+#include <tools/presys.h>
+#include <olectl.h>
+#include <vector>
+#include <list>
+#include <hash_map>
+#include "stdafx.h"
+#include "comifaces.hxx"
+#include <tools/postsys.h>
+
+
+#include <vos/diagnose.hxx>
+#include <vos/mutex.hxx>
+#include <vos/refernce.hxx>
+#include <tools/debug.hxx>
+
+#ifndef _RTL_USTRING_
+#include <rtl/ustring>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_METHODCONCEPT_HPP_
+#include <com/sun/star/beans/MethodConcept.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYCONCEPT_HPP_
+#include <com/sun/star/beans/PropertyConcept.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_FAILREASON_HPP_
+#include <com/sun/star/script/FailReason.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_PARAMINFO_HPP_
+#include <com/sun/star/reflection/ParamInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_XIDLARRAY_H_
+#include <com/sun/star/reflection/XIdlArray.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_FIELDACCESSMODE_HPP_
+#include <com/sun/star/reflection/FieldAccessMode.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_XIDLCLASS_HPP_
+#include <com/sun/star/reflection/XIdlClass.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_XIDLFIELD_HPP_
+#include <com/sun/star/reflection/XIdlField.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_PARAMMODE_HPP_
+#include <com/sun/star/reflection/ParamMode.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_METHODMODE_HPP_
+#include <com/sun/star/reflection/MethodMode.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_XIDLMEMBER_HPP_
+#include <com/sun/star/reflection/XIdlMember.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_XIDLREFLECTION_HPP_
+#include <com/sun/star/reflection/XIdlReflection.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_XIDLMETHOD_HPP_
+#include <com/sun/star/reflection/XIdlMethod.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XEXACTNAME_HPP_
+#include <com/sun/star/beans/XExactName.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XEVENTATTACHER_HPP_
+#include <com/sun/star/script/XEventAttacher.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XEVENTATTACHERMANAGER_HPP_
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_SCRIPTEVENT_HPP_
+#include <com/sun/star/script/ScriptEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XSCRIPTLISTENER_HPP_
+#include <com/sun/star/script/XScriptListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_SCRIPTEVENTDESCRIPTOR_HPP_
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
+#include <com/sun/star/lang/XEventListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_EVENTOBJECT_HPP_
+#include <com/sun/star/lang/EventObject.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XALLLISTENERADAPTERSERVICE_HPP_
+#include <com/sun/star/script/XAllListenerAdapterService.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_XALLLISTENER_HPP_
+#include <com/sun/star/script/XAllListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCRIPT_ALLEVENTOBJECT_HPP_
+#include <com/sun/star/script/AllEventObject.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_NOSUCHELEMENTEXCEPTION_HPP_
+#include <com/sun/star/container/NoSuchElementException.hpp>
+#endif
+#include <com/sun/star/beans/XMaterialHolder.hpp>
+
+
+#ifndef _TYPELIB_TYPEDESCRIPTION_H_
+#include <uno/typedescription.h>
+#endif
+#ifndef _OSL_INTERLOCK_H_
+#include <osl/interlck.h>
+#endif
+#ifndef _COM_SUN_STAR_UNO_GENFUNC_H_
+#include <com/sun/star/uno/genfunc.h>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+
+#include "comifaces.hxx"
+#include "jscriptclasses.hxx"
+#include "oleobjw.hxx"
+#include "unoobjw.hxx"
+#include "servprov.hxx"
+
+using namespace vos;
+using namespace std;
+using namespace rtl;
+using namespace osl;
+using namespace cppu;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::container;
+using namespace com::sun::star::script;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::bridge::ModelDependent;
+
+#define INVOCATION_SERVICE L"com.sun.star.script.Invocation"
+#define JSCRIPT_VALUE_FUNC L"_GetValueObject"
+#define DISPID_JSCRIPT_VALUE_FUNC -1000l
+
+
+
+#if _MSC_VER < 1200
+extern "C" const GUID IID_IDispatchEx;
+#endif
+
+namespace ole_adapter
+{
+static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource);
+static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource);
+//static const VARTYPE getVarType( const Any& val);
+//static sal_Bool convertValueObject( const VARIANTARG *var, Any& any, sal_Bool& bHandled);
+static HRESULT mapCannotConvertException( CannotConvertException e, unsigned int * puArgErr);
+
+
+
+/*****************************************************************************
+
+ static objects
+
+*****************************************************************************/
+
+OMutex globalWrapperMutex;
+//static WrapperMap globalWrapperMap;
+
+/*****************************************************************************
+
+ class implementation: InterfaceOleWrapper_Impl
+
+*****************************************************************************/
+InterfaceOleWrapper_Impl::InterfaceOleWrapper_Impl( Reference<XMultiServiceFactory>& xFactory,
+ sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass):
+ m_defaultValueType( 0),
+ UnoConversionUtilities<InterfaceOleWrapper_Impl>( xFactory, unoWrapperClass, comWrapperClass)
+{
+}
+
+InterfaceOleWrapper_Impl::~InterfaceOleWrapper_Impl()
+{
+}
+
+STDMETHODIMP InterfaceOleWrapper_Impl::QueryInterface(REFIID riid, LPVOID FAR * ppv)
+{
+ HRESULT ret= S_OK;
+
+ if( !ppv)
+ return E_POINTER;
+
+ if(IsEqualIID(riid, IID_IUnknown))
+ {
+ AddRef();
+ *ppv = (IUnknown*) (IDispatch*) this;
+ }
+ else if (IsEqualIID(riid, IID_IDispatch))
+ {
+ AddRef();
+ *ppv = (IDispatch*) this;
+ }
+ else if( IsEqualIID( riid, __uuidof( IUnoObjectWrapper)))
+ {
+ AddRef();
+ *ppv= (IUnoObjectWrapper*) this;
+ }
+ else
+ ret= E_NOINTERFACE;
+// else if (IsEqualIID(riid, IID_IDispatchEx))
+// {
+// AddRef();
+// *ppv = (IDispatchEx*) this;
+// return NOERROR;
+// }
+// else if (IsEqualIID(riid, IID_IConnectionPointContainer))
+// {
+// AddRef();
+// *ppv = (IConnectionPointContainer*) this;
+// return NOERROR;
+// }
+//
+ return ret;
+}
+
+STDMETHODIMP_(ULONG) InterfaceOleWrapper_Impl::AddRef()
+{
+ return m_refCount.acquire();
+}
+
+STDMETHODIMP_(ULONG) InterfaceOleWrapper_Impl::Release()
+{
+ ULONG n;
+
+ {
+ OGuard guard(globalWrapperMutex);
+
+ n = m_refCount.release();
+ }
+
+ if (n == 0)
+ {
+ delete this;
+ }
+
+ return n;
+}
+
+// IUnoObjectWrapper --------------------------------------------------------
+STDMETHODIMP InterfaceOleWrapper_Impl::getWrapperXInterface( Reference<XInterface>* pXInt)
+{
+ *pXInt= Reference<XInterface>( static_cast<XWeak*>( this), UNO_QUERY);
+ return pXInt->is() ? S_OK : E_FAIL;
+}
+STDMETHODIMP InterfaceOleWrapper_Impl::getOriginalUnoObject( Reference<XInterface>* pXInt)
+{
+ *pXInt= m_xOrigin;
+ return S_OK;
+}
+STDMETHODIMP InterfaceOleWrapper_Impl::getOriginalUnoStruct( Any * pStruct)
+{
+ HRESULT ret= E_FAIL;
+ if( !m_xOrigin.is())
+ {
+ Reference<XMaterialHolder> xMatHolder( m_xInvocation, UNO_QUERY);
+ if( xMatHolder.is())
+ {
+ Any any = xMatHolder->getMaterial();
+ if( any.getValueTypeClass() == TypeClass_STRUCT)
+ {
+ *pStruct= any;
+ ret= S_OK;
+ }
+ }
+ }
+ return ret;
+}
+
+STDMETHODIMP InterfaceOleWrapper_Impl::GetTypeInfoCount( unsigned int * pctinfo )
+{
+ return E_NOTIMPL ;
+}
+
+STDMETHODIMP InterfaceOleWrapper_Impl::GetTypeInfo(unsigned int itinfo, LCID lcid, ITypeInfo ** pptinfo)
+{
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID riid,
+ OLECHAR ** rgszNames,
+ unsigned int cNames,
+ LCID lcid,
+ DISPID * rgdispid )
+{
+ if( ! rgdispid)
+ return E_POINTER;
+ HRESULT ret = E_UNEXPECTED;
+ // ----------------------------------------
+ if( ! wcscmp( *rgszNames, JSCRIPT_VALUE_FUNC))
+ {
+ *rgdispid= DISPID_JSCRIPT_VALUE_FUNC;
+ return S_OK;
+ }
+ // ----------------------------------------
+ if (m_xInvocation.is() && (cNames > 0))
+ {
+ OUString name(rgszNames[0]);
+ NameToIdMap::iterator iter = m_nameToDispIdMap.find(name);
+
+ if (iter == m_nameToDispIdMap.end())
+ {
+ OUString exactName;
+
+ if (m_xExactName.is())
+ {
+ exactName = m_xExactName->getExactName(name);
+ }
+ else
+ {
+ exactName = name;
+ }
+
+ MemberInfo d(0, exactName);
+
+ if (m_xInvocation->hasProperty(exactName))
+ {
+ d.flags |= DISPATCH_PROPERTYGET;
+ d.flags |= DISPATCH_PROPERTYPUT;
+ d.flags |= DISPATCH_PROPERTYPUTREF;
+ }
+
+ if (m_xInvocation->hasMethod(exactName))
+ {
+ d.flags |= DISPATCH_METHOD;
+ }
+
+ if (d.flags != 0)
+ {
+ m_MemberInfos.push_back(d);
+ iter = m_nameToDispIdMap.insert(NameToIdMap::value_type(exactName, (DISPID)m_MemberInfos.size())).first;
+
+ if (exactName != name)
+ {
+ iter = m_nameToDispIdMap.insert(NameToIdMap::value_type(name, (DISPID)m_MemberInfos.size())).first;
+ }
+ }
+ }
+
+ if (iter == m_nameToDispIdMap.end())
+ {
+ ret = ResultFromScode(DISP_E_UNKNOWNNAME);
+ }
+ else
+ {
+ *rgdispid = (*iter).second;
+ ret = ResultFromScode(S_OK);
+ }
+ }
+
+ return ret;
+}
+
+// "convertVARIANTARGS" converts VARIANTS to their respecting Any counterparts
+// As parameter it uses some of the parameters passed to IDispatch::Invoke. These
+// ar "id", "wFlags" and "pdispparams". The function handles special JavaScript
+// cases where a VARIANT of type VT_DISPATCH is ambiguous and can represent
+// an object, array ( JavaScript Array object), out ( Array) and in/out ( Array)
+// parameter. Because all those VT_DISPATCH objects need a different conversion
+// we have to find out what the object is supposed to be. The function does this
+// by either using type information or by help of specialized JavaScript object.
+
+// A. Type Information
+// -----------------------------------------------------------------------------
+// With the help of type information the kind of parameter can be exactly determined
+// and an appropriate conversion can be choosen. A problem arises if a method expects
+// an Any. Then the type info does not tell what the type of the value, that is kept
+// by the any, should be. In this situation the decision wheter the param is a
+// sequence or an object is made upon the fact if the object has a property "0"
+// ( see function "isJScriptArray"). Since this is unsafe it is recommended to use
+// the JScript value objects within a JScript script on such an occasion.
+
+// B. JavaScript Value Object ( class JScriptValue )
+// -----------------------------------------------------------------------------
+// A JScriptValue object is a COM object in that it implements IDispatch and the
+// IJScriptValue object interface. Such objects are provided by all UNO wrapper
+// objects used within a JScript script. To obtain an instance one has to call
+// "_GetValueObject()" on an UNO wrapper object (class InterfaceOleWrapper_Impl).
+// A value object is appropriately initialized within the script and passed as
+// parameter to an UNO object method or property. The convertVARIANTARGS function
+// can easily find out that a param is such an object by queriing for the
+// IJScriptValue interface. By this interface one the type and kind ( out, in/out)
+// can be determined and the right conversion can be applied.
+// Using ValueObjects we spare us the effort of aquiring and examining type information
+// in order to figure out what the an IDispatch parameter is meant for.
+
+// Normal JScript object parameter can be mixed with JScriptValue object. If an
+// VARIANT contains an VT_DISPATCH that is no JScriptValue than the type information
+// is used to find out about the reqired type.
+
+// out Parameter in Visual Basic have the type VT_BYREF | VT_VARIANT and if the bridge
+// is used from C++ than the type is usually VT_BYREF |VT_xxx. Those parameter are converted
+// and we don't go to the trouble of aquiring type information.
+sal_Bool InterfaceOleWrapper_Impl::convertVARIANTARGS( DISPID id, unsigned short wFlags, DISPPARAMS* pdispparams, Sequence<Any>& rSeq)
+{
+ HRESULT hr;
+ if( pdispparams->cArgs == 0)
+ return TRUE;
+ sal_Bool convOk = TRUE;
+
+ // iterate over all parameter and check for special JScript value objects that originated in this bridge.
+ // Those can be converted straight away. The index in the sequence "seqConvertedParams" matches the index in the
+ // DISPPARAMS.rgvarg array. If the value is true then the corresponding VARIANT has been converted
+ // and the any has been written to the Sequence that holds the converted values.
+ Sequence< sal_Bool > seqConvertedParams( pdispparams->cArgs);
+ rSeq.realloc( pdispparams->cArgs);
+ Any* pParams = rSeq.getArray();
+
+ sal_Bool allDispHandled= sal_True;
+ Any anyParam;
+ sal_Bool bHandled= sal_False;
+
+ for( int i= 0; i < pdispparams->cArgs; i++)
+ {
+ if( sal_False == convertValueObject( &pdispparams->rgvarg[i], anyParam, bHandled) )
+ {
+ convOk= sal_False;
+ break;
+ }
+ else if( bHandled)
+ {// a param is a JScriptValue and could be converted
+ pParams[pdispparams->cArgs - i - 1]= anyParam;
+ seqConvertedParams[i]= sal_True;
+ continue;
+ }// also take care of VBasic ( VT_BYREF)
+ else if( (pdispparams->rgvarg[i].vt & VT_DISPATCH )== VT_DISPATCH )
+ allDispHandled= sal_False;
+ }
+
+ if( ! convOk)
+ return sal_False;
+ // ----------------------
+
+ // If there is a VT_DISPATCH and it is no JScriptValue object then
+ // we need to know if it represents a Sequence, out or in/out parameter
+ // or an actual object. Therefore we obtain type information
+ try{
+ Sequence<ParamMode> seqParamMode;
+ sal_Bool bTypesAvailable= sal_False;
+ Sequence< Type > seqParamTypes;
+ sal_Bool bIsMethod= sal_False;
+
+ //only aquire type information if at least one of the parameter is IDispatch
+ // and has not been convert yet because it is no JScriptValue object
+ if( ! allDispHandled)
+ {
+ if( !m_xInvocation.is() )return FALSE;
+ Reference<XIntrospectionAccess> xIntroAccess= m_xInvocation->getIntrospection();
+ if( !xIntroAccess.is()) return FALSE;
+
+ // We need the name of the property or method to get its type description
+ // The name can be identified through the param "id"
+ // that is kept als value in the map m_nameToDispIdMap.
+ // Proplem: the Windows JScript engine sometimes changes small letters to capital
+ // letters as happens in xidlclass_obj.createObject( var) // in JScript.
+ // IDispatch::GetIdsOfNames is then called with "CreateObject" !!!
+ // m_nameToDispIdMap can contain several names for one DISPID but only one is
+ // the exact one. If there's no m_xExactName and therfore no exact name then
+ // there's only one entry in the map.
+ typedef NameToIdMap::const_iterator cit;
+ OUString sMemberName;
+ if( m_xExactName.is())
+ {
+ for(cit ci1= m_nameToDispIdMap.begin(); ci1 != m_nameToDispIdMap.end(); ci1++)
+ {
+ if( (*ci1).second == id) // iterator is a pair< OUString, DISPID>
+ {
+ sMemberName= (*ci1).first;
+ sMemberName= m_xExactName->getExactName( sMemberName);
+ break;
+ }
+ }
+ }
+ else // the first match is certainly the only
+ {
+ for(cit ci1= m_nameToDispIdMap.begin(); ci1 != m_nameToDispIdMap.end(); ci1++)
+ {
+ if( (*ci1).second == id) // iterator is a pair< OUString, DISPID>
+ {
+ sMemberName= (*ci1).first;
+ break;
+ }
+ }
+ }
+
+ if( sMemberName == L"")
+ return FALSE;
+ // Get the type description of the uno method or property
+ // Problem: In some cases DISPATCH_METHOD AND!!! DISPATCH_PROPERTYPUT or
+ // DISPATCH_PROPERTYGET can be set. That might
+ // be due to VBScript or JScript that can't differ what's what or it doesnt matter
+ // For that reaseon we can't use the wFlags param in Invoke
+ // The automation wrapper (this class (InterfaceOleWrapper_Impl) doesn't provide
+ // any type information currently.
+ try{
+ // throws // NoSuchMethodException
+ Reference< XIdlMethod > spTypeMethod= xIntroAccess->getMethod( sMemberName, MethodConcept::ALL);
+ // ----------------
+ Sequence< ParamInfo > seqInfos= spTypeMethod->getParameterInfos();
+ Sequence< Reference< XIdlClass > > seqParamClasses= spTypeMethod->getParameterTypes();
+ int count= min( seqParamClasses.getLength(), seqConvertedParams.getLength());
+
+ seqParamTypes.realloc( count);
+ seqParamMode.realloc( count);
+ // --------------------
+ for( int i= 0; i < count ; i++)
+ {
+ seqParamTypes[i]= Type( seqParamClasses[count - 1 - i]->getTypeClass(),
+ seqParamClasses[count - 1 - i]->getName());
+
+ seqParamMode[i]= seqInfos[ count - 1 -i].aMode;
+ }
+ bTypesAvailable= sal_True;
+ bIsMethod= sal_True;
+ }catch(...) {}
+
+ if( ! bTypesAvailable)
+ {
+ try{
+ // throws NoSuchElementException
+ Property aProperty= xIntroAccess->getProperty( sMemberName, PropertyConcept::ATTRIBUTES);
+ seqParamTypes.realloc(1);
+ seqParamTypes[0]= aProperty.Type;
+ bTypesAvailable= sal_True;
+ }catch(...) {}
+ }
+ if( ! bTypesAvailable)
+ return FALSE;
+ }
+
+ // used within the for loop. If the param is a IDispatch and the reqired parameter
+ // is an in/out parameter, then this uno wrapper is likely used in JScript. Then we
+ // extract Array[0] and put the value into varParam. At the end of the loop varParam
+ // is converted if it contains a value otherwise the VARIANT from
+ // DISPPARAMS is converted.
+ CComVariant varParam;
+
+ // In this loop all params are converted except for those which are already converted
+ // by convertValueObject ( see above ). If a parameter is converted or is can be infered
+ // from the Sequence seqConvertedParams. Its values relate to the VARIANT params in DISPPARAMS
+ // at the same index.
+ for (int i = 0; convOk && (i < pdispparams->cArgs); i++)
+ {
+ if( seqConvertedParams[i] == sal_True)
+ continue;
+ sal_Bool bDoConversion= TRUE;
+ varParam.Clear();
+ // Check for dispatch
+ // If the param is one and is not refereced ( VT_BYREF) then it could be an object
+ // from JScript like an Array used for Squences and out-params
+ if( pdispparams->rgvarg[i].vt == VT_DISPATCH )
+ {
+ if( bIsMethod && seqParamMode[i] == ParamMode_INOUT)
+ {
+ // An INOUT-param in JSCript must be VT_DISPATCH since JScript Array objects are used
+ // for OUT-params. Index ( property) "0" contains the actual IN-param.
+ // It can also be an JScript Array or an other object (Interface).
+ // First get the IN-param at index "0"
+ IDispatch* pdisp= pdispparams->rgvarg[i].pdispVal;
+
+ OLECHAR* sindex= L"0";
+ DISPID id;
+ DISPPARAMS noParams= {0,0,0,0};
+ if(SUCCEEDED( hr= pdisp->GetIDsOfNames( IID_NULL, &sindex, 1, LOCALE_USER_DEFAULT, &id)))
+ hr= pdisp->Invoke( id, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET,
+ &noParams, &varParam, NULL, NULL);
+ if( FAILED( hr))
+ {
+ varParam.Clear();
+ convOk= FALSE; break;
+ }
+ }
+ else if( bIsMethod && seqParamMode[i] == ParamMode_OUT)
+ {
+ // No conversion necessary. The VT_DISPATCH represents
+ // an Array in which the outparam is written on index 0
+ bDoConversion= FALSE;
+ }
+ }
+ if( bDoConversion)
+ {
+ if( varParam.vt == VT_EMPTY) // then it was no in/out parameter
+ varParam= pdispparams->rgvarg[i];
+
+ Any theParam;
+ if( bTypesAvailable)
+ convOk= variantToAny2( & varParam,theParam,
+ seqParamTypes[i]);
+ else
+ convOk = variantToAny( & varParam, theParam);
+
+ if( convOk)
+ pParams[pdispparams->cArgs - (i + 1)]= theParam;
+ }
+
+ }// end for / iterating over all parameters
+
+
+ }catch(NoSuchMethodException e)
+ {
+ e;
+ convOk= FALSE;
+ }catch(RuntimeException e)
+ {
+ e;
+ convOk= FALSE;
+ }catch( NoSuchElementException e)
+ {
+ e;
+ convOk= FALSE;
+ }
+ catch(...)
+ {
+ convOk= FALSE;
+ }
+ return convOk;
+}
+
+// XBridgeSupplier2 ---------------------------------------------------
+// only bridges itself ( this instance of InterfaceOleWrapper_Impl)from UNO to IDispatch
+// If sourceModelType is UNO than any UNO interface implemented by InterfaceOleWrapper_Impl
+// can bridged to IDispatch ( if destModelType == OLE). The IDispatch is
+// implemented by this class.
+Any SAL_CALL InterfaceOleWrapper_Impl::createBridge(const Any& modelDepObject,
+ const Sequence<sal_Int8>& ProcessId,
+ sal_Int16 sourceModelType,
+ sal_Int16 destModelType)
+ throw (IllegalArgumentException, RuntimeException)
+{
+
+ Any retAny;
+ if( sourceModelType == UNO && destModelType == OLE &&
+ modelDepObject.getValueTypeClass() == TypeClass_INTERFACE )
+ {
+ Reference<XInterface> xInt;
+ if( modelDepObject >>= xInt )
+ {
+ if( xInt == Reference<XInterface>( static_cast<XWeak*>( this)), UNO_QUERY)
+ {
+ VARIANT *pVar= (VARIANT*)CoTaskMemAlloc( sizeof( VARIANT));
+ if( pVar)
+ {
+ pVar->vt= VT_DISPATCH;
+ pVar->pdispVal= static_cast<IDispatch*>( this);
+ AddRef();
+
+ retAny<<= reinterpret_cast< sal_uInt32 >( pVar);
+ }
+ }
+ }
+ }
+
+ return retAny;
+}
+
+// XInterface ------------------------------------------------------
+void SAL_CALL InterfaceOleWrapper_Impl::acquire( ) throw()
+{
+ AddRef();
+}
+void SAL_CALL InterfaceOleWrapper_Impl::release( ) throw()
+{
+ Release();
+}
+
+
+// XInitialization --------------------------------------------------
+void SAL_CALL InterfaceOleWrapper_Impl::initialize( const Sequence< Any >& aArguments )
+ throw(Exception, RuntimeException)
+{
+ switch( aArguments.getLength() )
+ {
+ case 2: // the object wraps an UNO struct
+ aArguments[0] >>= m_xInvocation;
+ aArguments[1] >>= m_defaultValueType;
+ break;
+ case 3: // the object wraps an UNO interface
+ aArguments[0] >>= m_xInvocation;
+ aArguments[1] >>= m_xOrigin;
+ aArguments[2] >>= m_defaultValueType;
+ break;
+ }
+
+ m_xExactName= Reference< XExactName> ( m_xOrigin, UNO_QUERY);
+ if( ! m_xExactName.is())
+ {
+ m_xExactName= Reference<XExactName>( m_xInvocation, UNO_QUERY);
+ }
+
+}
+
+Reference< XInterface > InterfaceOleWrapper_Impl::createUnoWrapperInstance()
+{
+ Reference<XWeak> xWeak= static_cast<XWeak*>( new InterfaceOleWrapper_Impl(
+ m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
+ return Reference<XInterface>( xWeak, UNO_QUERY);
+}
+
+Reference<XInterface> InterfaceOleWrapper_Impl::createComWrapperInstance()
+{
+ Reference<XWeak> xWeak= static_cast<XWeak*>( new IUnknownWrapper_Impl(
+ m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
+ return Reference<XInterface>( xWeak, UNO_QUERY);
+}
+
+
+
+// "getType" is used in convertValueObject to map the string denoting the type
+// to an actual Type object.
+Type getType( const BSTR type)
+{
+ Type retType;
+ typelib_TypeDescription * pDesc= NULL;
+ OUString str( type);
+ typelib_typedescription_getByName( &pDesc, str.pData );
+ if( pDesc)
+ {
+ retType= Type( pDesc->pWeakRef );
+ typelib_typedescription_release( pDesc);
+ }
+ return retType;
+}
+
+
+static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource)
+{
+ sal_Bool ret = sal_False;
+ HRESULT hr;
+
+ if( !(pDest->vt & VT_BYREF) && (pDest->vt == VT_DISPATCH) )
+ {
+ CComPtr <IJScriptValueObject> spValue;
+
+ // special Handling for a JScriptValue object
+ if( SUCCEEDED( pDest->pdispVal->QueryInterface( __uuidof( IJScriptValueObject),
+ reinterpret_cast<void**> (&spValue))))
+
+ {
+ VARIANT_BOOL varBool= VARIANT_FALSE;
+ if( SUCCEEDED( hr= spValue->IsOutParam( &varBool) )
+ && varBool == VARIANT_TRUE ||
+ SUCCEEDED(hr= spValue->IsInOutParam( &varBool) )
+ && varBool == VARIANT_TRUE )
+ {
+ if( SUCCEEDED( spValue->Set( CComVariant(), *pSource)))
+ ret= sal_True;
+ }
+ }
+ else// // no VT_BYREF but VT_DISPATCH -> JScript out param
+ {
+ // prepare DISPPARAMS for PROPERTYPUT operation
+ DISPID namedArgs = DISPID_PROPERTYPUT;
+ DISPPARAMS dispparamsPut;
+ dispparamsPut.rgdispidNamedArgs= &namedArgs;
+ dispparamsPut.cArgs = 1;
+ dispparamsPut.cNamedArgs = 1;
+
+ CComBSTR bstrNullIndex= SysAllocString( L"0");
+ if( bstrNullIndex)
+ {
+ CComPtr<IDispatchEx> pdispEx;
+ if( SUCCEEDED( hr= pDest->pdispVal->QueryInterface( IID_IDispatchEx, (void**)&pdispEx)))
+ {
+ DISPID dispid;
+ if( SUCCEEDED(hr= pdispEx->GetDispID( bstrNullIndex, fdexNameEnsure, &dispid)))
+ {
+ dispparamsPut.rgvarg= pSource;
+ if( SUCCEEDED( hr= pdispEx->InvokeEx(dispid, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUT,
+ &dispparamsPut, NULL, NULL, NULL)))
+ ret= sal_True;
+ } // if( bstrIndex)
+ }
+ }
+ }
+ }
+ else // The param can't be a JScript out-parameter ( an Array object), it could be a VBScript
+ { // param. The function checks itself for correct VBScript params
+ ret= writeBackOutParameter( pDest, pSource);
+ }
+
+
+ return ret;
+}
+// VisualBasic Script passes arguments as VT_VARIANT | VT_BYREF be it in or out parameter.
+// Thus we are in charge of freeing an eventual value contained by the inner VARIANT
+// Please note: VariantCopy doesn't free a VT_BYREF value
+static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource)
+{
+ HRESULT hr;
+ sal_Bool ret = FALSE;
+ // Out parameter must be VT_BYREF
+ if ((V_VT(pDest) & VT_BYREF) != 0 )
+ {
+ VARTYPE oleTypeFlags = V_VT(pSource);
+
+ // if caller accept VARIANT as out parameter, any value must be converted
+ if (V_VT(pDest) == (VT_VARIANT | VT_BYREF))
+ {
+ if (oleTypeFlags == (VT_VARIANT | VT_BYREF))
+ {
+ if (V_VARIANTREF(pSource) != NULL)
+ VariantCopy(V_VARIANTREF(pDest), V_VARIANTREF(pSource));
+ ret = sal_True;
+ }
+ else
+ {
+ VariantCopy(V_VARIANTREF(pDest), pSource);
+ ret = sal_True;
+ }
+ }
+ else
+ {
+ // variantarg and variant must have same type
+ if ((V_VT(pDest) & oleTypeFlags) == oleTypeFlags)
+ {
+ if ((oleTypeFlags & VT_ARRAY) != 0)
+ {
+ // copy safearray
+ // if VT_ARRAY | VT_BYREF then VariantCopy doesn't destroy the array
+ if (*V_ARRAYREF(pDest) != NULL)
+ SafeArrayDestroy(*V_ARRAYREF(pDest));
+
+ if (SafeArrayCopy(V_ARRAY(pSource), V_ARRAYREF(pDest)) == NOERROR)
+ ret = sal_True;
+ }
+ else
+ {
+ // copy base type
+ switch (V_VT(pSource))
+ {
+ case VT_I2:
+ *V_I2REF(pDest) = V_I2(pSource);
+ ret = sal_True;
+ break;
+ case VT_I4:
+ *V_I4REF(pDest) = V_I4(pSource);
+ ret = sal_True;
+ break;
+ case VT_R4:
+ *V_R4REF(pDest) = V_R4(pSource);
+ ret = sal_True;
+ break;
+ case VT_R8:
+ *V_R8REF(pDest) = V_R8(pSource);
+ ret = sal_True;
+ break;
+ case VT_CY:
+ *V_CYREF(pDest) = V_CY(pSource);
+ ret = sal_True;
+ break;
+ case VT_DATE:
+ *V_DATEREF(pDest) = V_DATE(pSource);
+ ret = sal_True;
+ break;
+ case VT_BSTR:
+ *V_BSTRREF(pDest) = SysAllocString(V_BSTR(pSource));
+ ret = sal_True;
+ break;
+ case VT_DISPATCH:
+ if (*V_DISPATCHREF(pDest) != NULL)
+ (*V_DISPATCHREF(pDest))->Release();
+
+ *V_DISPATCHREF(pDest) = V_DISPATCH(pSource);
+
+ if (*V_DISPATCHREF(pDest) != NULL)
+ (*V_DISPATCHREF(pDest))->AddRef();
+
+ ret = sal_True;
+ break;
+ case VT_ERROR:
+ *V_ERRORREF(pDest) = V_ERROR(pSource);
+ ret = sal_True;
+ break;
+ case VT_BOOL:
+ *V_BOOLREF(pDest) = V_BOOL(pSource);
+ ret = sal_True;
+ break;
+ case VT_UNKNOWN:
+ if (*V_UNKNOWNREF(pDest) != NULL)
+ (*V_UNKNOWNREF(pDest))->Release();
+
+ *V_UNKNOWNREF(pDest) = V_UNKNOWN(pSource);
+
+ if (*V_UNKNOWNREF(pDest) != NULL)
+ (*V_UNKNOWNREF(pDest))->AddRef();
+
+ ret = sal_True;
+ break;
+ case VT_I1:
+ *V_I1REF(pDest) = V_I1(pSource);
+ ret = sal_True;
+ break;
+ case VT_UI1:
+ *V_UI1REF(pDest) = V_UI1(pSource);
+ ret = sal_True;
+ break;
+ case VT_UI2:
+ *V_UI2REF(pDest) = V_UI2(pSource);
+ ret = sal_True;
+ break;
+ case VT_UI4:
+ *V_UI4REF(pDest) = V_UI4(pSource);
+ ret = sal_True;
+ break;
+ case VT_INT:
+ *V_INTREF(pDest) = V_INT(pSource);
+ ret = sal_True;
+ break;
+ case VT_UINT:
+ *V_UINTREF(pDest) = V_UINT(pSource);
+ ret = sal_True;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+ return ret;
+}
+
+
+
+STDMETHODIMP InterfaceOleWrapper_Impl::Invoke(DISPID dispidMember,
+ REFIID riid,
+ LCID lcid,
+ unsigned short wFlags,
+ DISPPARAMS * pdispparams,
+ VARIANT * pvarResult,
+ EXCEPINFO * pexcepinfo,
+ unsigned int * puArgErr )
+{
+ HRESULT ret = S_OK;
+
+ sal_Bool bHandled= sal_False;
+ ret= InvokeGeneral( dispidMember, wFlags, pdispparams, pvarResult, pexcepinfo,
+ puArgErr, bHandled);
+ if( bHandled)
+ return ret;
+
+ if ((dispidMember > 0) && (dispidMember <= m_MemberInfos.size()) && m_xInvocation.is())
+ {
+ MemberInfo d = m_MemberInfos[dispidMember - 1];
+ DWORD flags = wFlags & d.flags;
+
+ if (flags != 0)
+ {
+ if ((flags & DISPATCH_METHOD) != 0)
+ {
+ if (pdispparams->cNamedArgs > 0)
+ ret = DISP_E_NONAMEDARGS;
+ else
+ {
+ Sequence<Any> params;
+ if( convertVARIANTARGS(dispidMember, wFlags, pdispparams , params ))
+ {
+ ret= doInvoke( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, d.name, params );
+ }
+ else
+ ret = DISP_E_BADVARTYPE;
+ }
+ }
+ else if ((flags & DISPATCH_PROPERTYGET) != 0)
+ {
+ ret= doGetProperty( pdispparams, pvarResult,
+ pexcepinfo, d.name);
+ }
+ else if ((flags & DISPATCH_PROPERTYPUT || flags & DISPATCH_PROPERTYPUTREF) != 0)
+ {
+ if (pdispparams->cArgs != 1)
+ ret = DISP_E_BADPARAMCOUNT;
+ else
+ {
+ Sequence<Any> params;
+ if (convertVARIANTARGS(dispidMember, wFlags, pdispparams, params ) && (params.getLength() > 0))
+ {
+ ret= doSetProperty( pdispparams, pvarResult, pexcepinfo, puArgErr, d.name, params);
+ }
+ else
+ ret = DISP_E_BADVARTYPE;
+ }
+ }
+ }
+ }
+ else
+ ret = DISP_E_MEMBERNOTFOUND;
+
+ return ret;
+}
+
+HRESULT InterfaceOleWrapper_Impl::doInvoke( DISPPARAMS * pdispparams, VARIANT * pvarResult,
+ EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString& name, Sequence<Any>& params)
+{
+
+ HRESULT ret= S_OK;
+ Sequence<INT16> outIndex;
+ Sequence<Any> outParams;
+ Any returnValue;
+
+ if (pdispparams->cNamedArgs > 0)
+ return DISP_E_NONAMEDARGS;
+
+ // invoke method and take care of exceptions
+ try
+ {
+ returnValue = m_xInvocation->invoke(name,
+ params,
+ outIndex,
+ outParams);
+
+ // try to write back out parameter
+ if (outIndex.getLength() > 0)
+ {
+ const INT16* pOutIndex = outIndex.getConstArray();
+ const Any* pOutParams = outParams.getConstArray();
+
+ for (UINT32 i = 0; i < outIndex.getLength(); i++)
+ {
+ VARIANT variant;
+
+ VariantInit(&variant);
+
+ // Currently a Sequence is converted to an SafeArray of VARIANTs.
+ anyToVariant( &variant, pOutParams[i]);
+
+ // out parameter need special handling if they are VT_DISPATCH
+ // and used in JScript
+ int outindex= pOutIndex[i];
+ writeBackOutParameter2(&(pdispparams->rgvarg[pdispparams->cArgs - 1 - outindex]),
+ &variant );
+
+ VariantClear(&variant);
+ }
+ }
+
+ // write back return value
+ if ((pvarResult != NULL) && ! anyToVariant(pvarResult, returnValue))
+ {
+ ret = DISP_E_BADVARTYPE;
+ }
+// else
+// {
+// ret = NOERROR;
+// }
+ }
+ catch(IllegalArgumentException e)
+ {
+ e;
+ ret = ResultFromScode(DISP_E_TYPEMISMATCH);
+ }
+ catch(CannotConvertException e)
+ {
+ ret= mapCannotConvertException( e, puArgErr);
+ }
+ catch(InvocationTargetException e)
+ {
+ if (pexcepinfo != NULL)
+ {
+ Any org = e.TargetException;
+
+ pexcepinfo->wCode = UNO_2_OLE_EXCEPTIONCODE;
+ pexcepinfo->bstrSource = SysAllocString(L"any ONE component");
+ pexcepinfo->bstrDescription = SysAllocString(
+ org.getValueType().getTypeName());
+ }
+ ret = ResultFromScode(DISP_E_EXCEPTION);
+ }
+ catch( NoSuchMethodException e)
+ {
+ ret= DISP_E_MEMBERNOTFOUND;
+ }
+ catch( ... )
+ {
+ ret= DISP_E_EXCEPTION;
+ }
+ return ret;
+}
+
+HRESULT InterfaceOleWrapper_Impl::doGetProperty( DISPPARAMS * pdispparams, VARIANT * pvarResult,
+ EXCEPINFO * pexcepinfo, OUString& name)
+{
+ HRESULT ret= S_OK;
+
+ Any value;
+ try
+ {
+ Any returnValue = m_xInvocation->getValue( name);
+ // write back return value
+ if (!anyToVariant(pvarResult, returnValue)) {
+ ret = DISP_E_BADVARTYPE;
+ }
+ }
+ catch(UnknownPropertyException e)
+ {
+ ret = DISP_E_MEMBERNOTFOUND;
+ }
+ catch( ... )
+ {
+ ret= DISP_E_EXCEPTION;
+ }
+ return ret;
+}
+
+HRESULT InterfaceOleWrapper_Impl::doSetProperty( DISPPARAMS * pdispparams, VARIANT * pvarResult,
+ EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString& name, Sequence<Any> params)
+{
+ HRESULT ret= S_OK;
+
+ try
+ {
+ m_xInvocation->setValue( name, params.getConstArray()[0]);
+ }
+ catch(UnknownPropertyException )
+ {
+ ret = DISP_E_MEMBERNOTFOUND;
+ }
+ catch(CannotConvertException e)
+ {
+ ret= mapCannotConvertException( e, puArgErr);
+ }
+ catch(InvocationTargetException e)
+ {
+ if (pexcepinfo != NULL)
+ {
+ Any org = e.TargetException;
+
+ pexcepinfo->wCode = UNO_2_OLE_EXCEPTIONCODE;
+ pexcepinfo->bstrSource = SysAllocString(L"any ONE component");
+ pexcepinfo->bstrDescription = SysAllocString(
+ org.getValueType().getTypeName());
+ }
+ ret = DISP_E_EXCEPTION;
+ }
+ catch( ... )
+ {
+ ret= DISP_E_EXCEPTION;
+ }
+ return ret;
+}
+
+HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned short wFlags,
+ DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
+ unsigned int * puArgErr, sal_Bool& bHandled)
+{
+ HRESULT ret= S_OK;
+// DISPID_VALUE | The DEFAULT Value is required in JScript when the situation
+// is that we put an object into an Array object ( out parameter). We have to return
+// IDispatch otherwise the object cannot be accessed from the Script.
+ if( dispidMember == DISPID_VALUE && wFlags == DISPATCH_PROPERTYGET
+ && m_defaultValueType != VT_EMPTY && pvarResult != NULL)
+ {
+ bHandled= sal_True;
+ if( m_defaultValueType == VT_DISPATCH)
+ {
+ pvarResult->vt= VT_DISPATCH;
+ pvarResult->pdispVal= static_cast<IDispatch*>( this);
+ AddRef();
+ ret= S_OK;
+ }
+ }
+// ---------
+ // function: _GetValueObject
+ else if( dispidMember == DISPID_JSCRIPT_VALUE_FUNC)
+ {
+ bHandled= sal_True;
+ if( !pvarResult)
+ ret= E_POINTER;
+ CComObject< JScriptValue>* pValue;
+ if( SUCCEEDED( CComObject<JScriptValue>::CreateInstance( &pValue)))
+ {
+ pvarResult->vt= VT_UNKNOWN;
+ pvarResult->punkVal= pValue->GetUnknown();
+ pvarResult->punkVal->AddRef();
+ ret= S_OK;
+ }
+ else
+ ret= DISP_E_EXCEPTION;
+ }
+ return S_OK;
+}
+
+STDMETHODIMP InterfaceOleWrapper_Impl::GetDispID(BSTR bstrName, DWORD grfdex, DISPID __RPC_FAR *pid)
+{
+ HRESULT ret = ResultFromScode(E_NOTIMPL);
+
+ return ret;
+}
+
+STDMETHODIMP InterfaceOleWrapper_Impl::InvokeEx(
+ /* [in] */ DISPID id,
+ /* [in] */ LCID lcid,
+ /* [in] */ WORD wFlags,
+ /* [in] */ DISPPARAMS __RPC_FAR *pdp,
+ /* [out] */ VARIANT __RPC_FAR *pvarRes,
+ /* [out] */ EXCEPINFO __RPC_FAR *pei,
+ /* [unique][in] */ IServiceProvider __RPC_FAR *pspCaller)
+{
+ HRESULT ret = ResultFromScode(E_NOTIMPL);
+
+ return ret;
+}
+
+
+STDMETHODIMP InterfaceOleWrapper_Impl::DeleteMemberByName(
+ /* [in] */ BSTR bstr,
+ /* [in] */ DWORD grfdex)
+{
+ HRESULT ret = ResultFromScode(E_NOTIMPL);
+
+ return ret;
+}
+
+STDMETHODIMP InterfaceOleWrapper_Impl::DeleteMemberByDispID(DISPID id)
+{
+ HRESULT ret = ResultFromScode(E_NOTIMPL);
+
+ return ret;
+}
+
+STDMETHODIMP InterfaceOleWrapper_Impl::GetMemberProperties(
+ /* [in] */ DISPID id,
+ /* [in] */ DWORD grfdexFetch,
+ /* [out] */ DWORD __RPC_FAR *pgrfdex)
+{
+ HRESULT ret = ResultFromScode(E_NOTIMPL);
+
+ return ret;
+}
+
+STDMETHODIMP InterfaceOleWrapper_Impl::GetMemberName(
+ /* [in] */ DISPID id,
+ /* [out] */ BSTR __RPC_FAR *pbstrName)
+{
+ HRESULT ret = ResultFromScode(E_NOTIMPL);
+
+ return ret;
+}
+
+STDMETHODIMP InterfaceOleWrapper_Impl::GetNextDispID(
+ /* [in] */ DWORD grfdex,
+ /* [in] */ DISPID id,
+ /* [out] */ DISPID __RPC_FAR *pid)
+{
+ HRESULT ret = ResultFromScode(E_NOTIMPL);
+
+ return ret;
+}
+
+STDMETHODIMP InterfaceOleWrapper_Impl::GetNameSpaceParent(
+ /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunk)
+{
+ HRESULT ret = ResultFromScode(E_NOTIMPL);
+
+ return ret;
+}
+
+//STDMETHODIMP InterfaceOleWrapper_Impl::EnumConnectionPoints(IEnumConnectionPoints __RPC_FAR *__RPC_FAR *ppEnum)
+//{
+// HRESULT ret = ResultFromScode(CONNECT_E_NOCONNECTION);
+//
+// (*ppEnum) = new EnumConnectionPoints_Impl(&m_rConnectionPoint, 1);
+//
+// return ret;
+//}
+//
+//STDMETHODIMP InterfaceOleWrapper_Impl::FindConnectionPoint(
+// /* [in] */ REFIID riid,
+// /* [out] */ IConnectionPoint __RPC_FAR *__RPC_FAR *ppCP)
+//{
+// HRESULT ret = ResultFromScode(S_OK);
+//
+// if (!m_rConnectionPoint.is())
+// {
+// OGuard guard(globalWrapperMutex);
+//
+// if ((!m_rConnectionPoint.is()) && m_xOrigin.is() && m_xEventAttacher.is())
+// {
+// ConnectionPoint_Impl* pConnectionPoint = new ConnectionPoint_Impl(m_xInvocation, m_xOrigin, m_xEventAttacher, this);
+//
+// m_rConnectionPoint = pConnectionPoint;
+// }
+// }
+//
+// *ppCP = m_rConnectionPoint.get();
+//
+// (*ppCP)->AddRef();
+//
+// return ret;
+//}
+
+/*****************************************************************************
+
+ class implementation: ConnectionPoint_Impl
+
+*****************************************************************************/
+
+
+//ConnectionPoint_Impl::ConnectionPoint_Impl(const Reference<XInvocation>& xInv,
+// const Reference<XInterface>& xOrigin,
+// const Reference<XEventAttacher>& xEventAttacher,
+// IConnectionPointContainer* pContainer)
+// : m_xInvocation(xInv)
+// , m_xOrigin(xOrigin)
+// , m_xEventAttacher(xEventAttacher)
+// , m_rContainer(pContainer)
+// , m_nextCookie(1)
+//{
+//}
+//
+//ConnectionPoint_Impl::~ConnectionPoint_Impl()
+//{
+//}
+//
+//STDMETHODIMP ConnectionPoint_Impl::QueryInterface(REFIID riid, LPVOID FAR * ppv)
+//{
+// if(IsEqualIID(riid, IID_IUnknown))
+// {
+// AddRef();
+// *ppv = (IUnknown*) (IConnectionPoint*) this;
+// return NOERROR;
+// }
+// else if (IsEqualIID(riid, IID_IConnectionPoint))
+// {
+// AddRef();
+// *ppv = (IConnectionPoint*) this;
+// return NOERROR;
+// }
+//
+// *ppv = NULL;
+//
+// return ResultFromScode(E_NOINTERFACE);
+//}
+//
+//STDMETHODIMP_(ULONG) ConnectionPoint_Impl::AddRef()
+//{
+// return m_refCount.acquire();
+//}
+//
+//STDMETHODIMP_(ULONG) ConnectionPoint_Impl::Release()
+//{
+//
+// ULONG n = m_refCount.release();
+//
+// if (n == 0)
+// {
+// delete this;
+// }
+//
+// return n;
+//}
+//
+//STDMETHODIMP ConnectionPoint_Impl::GetConnectionInterface( IID __RPC_FAR *piid)
+//{
+// HRESULT ret = ResultFromScode(S_OK);
+//
+// *piid = IID_IDispatch;
+//
+// return ret;
+//}
+//
+//STDMETHODIMP ConnectionPoint_Impl::GetConnectionPointContainer(IConnectionPointContainer __RPC_FAR *__RPC_FAR *ppCPC)
+//{
+// HRESULT ret = ResultFromScode(S_OK);
+//
+// *ppCPC = m_rContainer.get();
+//
+// (*ppCPC)->AddRef();
+//
+// return ret;
+//}
+//
+//void ConnectionPoint_Impl::registerListener()
+//{
+// Reference<XIntrospectionAccess> xAccess = m_xInvocation->getIntrospection();
+//
+// if (xAccess.is())
+// {
+// Sequence< Type > listeners = xAccess->getSupportedListeners();
+// Reference<XAllListener> xListener = this;
+//
+// for (sal_uInt32 i = 0; i < listeners.getLength(); i++)
+// {
+// GenListenerData data;
+
+ // data.listenerType = OUString::createFromAscii(
+ // listeners.getConstArray()[i].getTypeName());
+// data.listenerType = listeners.getConstArray()[i].getTypeName();
+//
+// try
+// {
+// data.xGenListener = m_xEventAttacher->attachListener(m_xOrigin,
+// xListener,
+// data.helper,
+// data.listenerType,
+// data.addListenerParam);
+//
+// m_xGenListenerList.push_back(data);
+// }
+// catch(IllegalArgumentException e)
+// {e;
+// }
+// catch(IntrospectionException e)
+// {e;
+// }
+// catch(CannotCreateAdapterException e)
+// {e;
+// }
+// catch(ServiceNotRegisteredException e)
+// {e;
+// }
+// }
+// }
+//}
+//
+//void ConnectionPoint_Impl::unregisterListener()
+//{
+// Reference<XIntrospectionAccess> xAccess = m_xInvocation->getIntrospection();
+//
+// if (xAccess.is())
+// {
+// GenListenerDataList::iterator iter = m_xGenListenerList.begin();
+//
+// while (iter != m_xGenListenerList.end())
+// {
+// try
+// {
+// m_xEventAttacher->removeListener(m_xOrigin,
+// (*iter).listenerType,
+// (*iter).addListenerParam,
+// (*iter).xGenListener);
+// }
+// catch(IllegalArgumentException e)
+// {e;
+// }
+// catch(IntrospectionException e)
+// {e;
+// }
+//
+// iter++;
+// }
+// }
+//
+// m_xGenListenerList = GenListenerDataList();
+//}
+//
+//STDMETHODIMP ConnectionPoint_Impl::Advise(IUnknown __RPC_FAR *pUnkSink, DWORD __RPC_FAR *pdwCookie)
+//{
+// HRESULT ret = ResultFromScode(CONNECT_E_CANNOTCONNECT);
+//
+// OGuard guard(globalWrapperMutex);
+//
+// IDispatch* pDispatch = NULL;
+//
+// if (pUnkSink->QueryInterface(IID_IDispatch, (void**) &pDispatch) == NOERROR)
+// {
+// *pdwCookie = m_nextCookie++;
+//
+// if (m_connection.size() == 0)
+// {
+// registerListener();
+// }
+//
+// m_connection.insert(ConnectionMap::value_type(*pdwCookie, OleRef<IDispatch>(pDispatch)));
+//
+// pDispatch->Release();
+//
+// ret = ResultFromScode(S_OK);
+// }
+//
+// return ret;
+//}
+//
+//STDMETHODIMP ConnectionPoint_Impl::Unadvise(DWORD dwCookie)
+//{
+// HRESULT ret = ResultFromScode(CONNECT_E_NOCONNECTION);
+//
+// OGuard guard(globalWrapperMutex);
+//
+// ConnectionMap::iterator iter = m_connection.find(dwCookie);
+//
+// if (iter != m_connection.end())
+// {
+// m_connection.erase(iter);
+// ret = ResultFromScode(S_OK);
+// }
+//
+// if (m_connection.size() == 0)
+// {
+// unregisterListener();
+// }
+//
+// return ret;
+//}
+//
+//STDMETHODIMP ConnectionPoint_Impl::EnumConnections(IEnumConnections __RPC_FAR *__RPC_FAR *ppEnum)
+//{
+// HRESULT ret = ResultFromScode(S_OK);
+//
+// OGuard guard(globalWrapperMutex);
+//
+// CONNECTDATA* pConnection = NULL;
+// UINT32 n = m_connection.size();
+//
+// if (n > 0)
+// {
+// pConnection = new CONNECTDATA[n];
+//
+// ConnectionMap::iterator iter = m_connection.begin();
+// UINT32 i = 0;
+//
+// while (iter != m_connection.end())
+// {
+// (*iter).second->QueryInterface(IID_IUnknown, (void**)&(pConnection[i].pUnk));
+// pConnection[i].dwCookie = (*iter).first;
+//
+// i++;
+// iter++;
+// }
+//
+// *ppEnum = new EnumConnections_Impl(pConnection, n);
+//
+// for (i = 0; i < n; i++)
+// {
+// pConnection[i].pUnk->Release();
+// }
+//
+// delete[] pConnection;
+// }
+// else
+// {
+// *ppEnum = new EnumConnections_Impl(NULL, 0);
+// }
+//
+// (*ppEnum)->AddRef();
+//
+// return ret;
+//}
+//
+//
+//
+//
+//void SAL_CALL ConnectionPoint_Impl::disposing(const EventObject& Source) throw( RuntimeException)
+//{
+//}
+//
+//void SAL_CALL ConnectionPoint_Impl::firing(const AllEventObject& Event) throw( RuntimeException)
+//{
+// IEnumConnections* pEnum = NULL;
+//
+// EnumConnections(&pEnum);
+//
+// CONNECTDATA connection = {NULL, 0};
+// ULONG fetched = NULL;
+//
+// while (pEnum->Next(1, &connection, &fetched) == NOERROR)
+// {
+// IDispatch* pDispatch = NULL;
+//
+// if (connection.pUnk->QueryInterface(IID_IDispatch, (void**) &pDispatch) == NOERROR)
+// {
+// // getting dispid of event sink
+// unsigned int flags = 0;
+// HRESULT result;
+// DISPID dispId;
+// OLECHAR* oleNames[1];
+//
+// oleNames[0] = (OLECHAR*)Event.MethodName.getStr();
+//
+// result = pDispatch ->GetIDsOfNames(IID_NULL,
+// oleNames,
+// 1,
+// LOCALE_SYSTEM_DEFAULT,
+// &dispId);
+//
+// if (result == NOERROR)
+// {
+// DISPPARAMS dispparams;
+// VARIANT varResult;
+// EXCEPINFO excepinfo;
+// unsigned int uArgErr;
+//
+// VariantInit(&varResult);
+//
+// // converting UNO parameters to OLE variants
+// dispparams.rgdispidNamedArgs = NULL;
+// dispparams.cArgs = Event.Arguments.getLength();
+// dispparams.cNamedArgs = 0;
+//
+// if (dispparams.cArgs == 0)
+// {
+// dispparams.rgvarg = NULL;
+// }
+// else
+// {
+// dispparams.rgvarg = (VARIANTARG*)malloc(sizeof(VARIANTARG) * dispparams.cArgs);
+//
+// for (UINT32 i = 0; i < dispparams.cArgs; i++)
+// {
+// o2u_anyToVariant(&(dispparams.rgvarg[i]),
+// Event.Arguments.getConstArray()[dispparams.cArgs - (i + 1)]);
+// }
+// }
+//
+// // invoking OLE method
+// result = pDispatch ->Invoke(dispId,
+// IID_NULL,
+// LOCALE_SYSTEM_DEFAULT,
+// DISPATCH_METHOD,
+// &dispparams,
+// &varResult,
+// &excepinfo,
+// &uArgErr);
+//
+//
+// // freeing allocated OLE parameters
+// if (dispparams.cArgs > 0)
+// {
+// for (UINT32 i = 0; i < dispparams.cArgs; i++)
+// {
+// VariantClear(&(dispparams.rgvarg[i]));
+// }
+// free(dispparams.rgvarg);
+// }
+//
+// VariantClear(&varResult);
+// }
+//
+// // getting dispid of event sink
+// oleNames[0] = L"EventRaised";
+//
+// result = pDispatch ->GetIDsOfNames(IID_NULL,
+// oleNames,
+// 1,
+// LOCALE_SYSTEM_DEFAULT,
+// &dispId);
+//
+// if (result == NOERROR)
+// {
+// DISPPARAMS dispparams;
+// VARIANT varResult;
+// EXCEPINFO excepinfo;
+// unsigned int uArgErr;
+//
+// VariantInit(&varResult);
+//
+// // converting UNO parameters to OLE variants
+// dispparams.rgdispidNamedArgs = NULL;
+// dispparams.cArgs = Event.Arguments.getLength() + 1;
+// dispparams.cNamedArgs = 0;
+//
+// if (dispparams.cArgs == 0)
+// {
+// dispparams.rgvarg = NULL;
+// }
+// else
+// {
+// dispparams.rgvarg = (VARIANTARG*)malloc(sizeof(VARIANTARG) * dispparams.cArgs);
+//
+// for (UINT32 i = 0; i < (dispparams.cArgs - 1); i++)
+// {
+// o2u_anyToVariant(&(dispparams.rgvarg[i]),
+// Event.Arguments.getConstArray()[dispparams.cArgs - (i + 2)]);
+// }
+// Any methodName( &Event.MethodName, getCppuType( &Event.MethodName));
+//
+// o2u_anyToVariant(&(dispparams.rgvarg[i]), methodName);
+// }
+//
+// // invoking OLE method
+// result = pDispatch ->Invoke(dispId,
+// IID_NULL,
+// LOCALE_SYSTEM_DEFAULT,
+// DISPATCH_METHOD,
+// &dispparams,
+// &varResult,
+// &excepinfo,
+// &uArgErr);
+//
+//
+// // freeing allocated OLE parameters
+// if (dispparams.cArgs > 0)
+// {
+// for (UINT32 i = 0; i < dispparams.cArgs; i++)
+// {
+// VariantClear(&(dispparams.rgvarg[i]));
+// }
+// free(dispparams.rgvarg);
+// }
+//
+// VariantClear(&varResult);
+// }
+//
+// pDispatch->Release();
+// }
+//
+// connection.pUnk->Release();
+// }
+//
+// pEnum->Release();
+//}
+
+//Any SAL_CALL ConnectionPoint_Impl::approveFiring(const AllEventObject& Event) throw( InvocationTargetException, RuntimeException)
+//{
+// Any ret;
+//
+// return ret;
+//}
+
+/*****************************************************************************
+
+ class implementation: EnumConnections_Impl
+
+*****************************************************************************/
+
+
+//EnumConnections_Impl::EnumConnections_Impl(CONNECTDATA* pConnection, ULONG numOfConn)
+//{
+// m_index = 0;
+// m_numOfConn = numOfConn;
+//
+// if (m_numOfConn)
+// {
+// m_pConnection = new CONNECTDATA[m_numOfConn];
+//
+// for (ULONG i = 0; i < m_numOfConn; i++)
+// {
+// m_pConnection[i] = pConnection[i];
+// m_pConnection[i].pUnk->AddRef();
+// }
+// }
+//}
+//
+//EnumConnections_Impl::~EnumConnections_Impl()
+//{
+// for (ULONG i = 0; i < m_numOfConn; i++)
+// {
+// m_pConnection[i].pUnk->Release();
+// }
+//
+// if (m_numOfConn)
+// {
+// delete[] m_pConnection;
+// }
+//}
+//
+//STDMETHODIMP EnumConnections_Impl::QueryInterface(REFIID riid, LPVOID FAR * ppv)
+//{
+// if(IsEqualIID(riid, IID_IUnknown))
+// {
+// AddRef();
+// *ppv = (IUnknown*) (IEnumConnections *) this;
+// return NOERROR;
+// }
+// else if (IsEqualIID(riid, IID_IEnumConnections ))
+// {
+// AddRef();
+// *ppv = (IEnumConnections *) this;
+// return NOERROR;
+// }
+//
+// *ppv = NULL;
+//
+// return ResultFromScode(E_NOINTERFACE);
+//}
+//
+//STDMETHODIMP_(ULONG) EnumConnections_Impl::AddRef()
+//{
+// return m_refCount.acquire();
+//}
+//
+//STDMETHODIMP_(ULONG) EnumConnections_Impl::Release()
+//{
+//
+// ULONG n = m_refCount.release();
+//
+// if (n == 0)
+// {
+// delete this;
+// }
+//
+// return n;
+//}
+//
+//STDMETHODIMP EnumConnections_Impl::Next(
+// /* [in] */ ULONG cConnections,
+// /* [out] */ CONNECTDATA __RPC_FAR *rgcd,
+// /* [out] */ ULONG __RPC_FAR *lpcFetched)
+//{
+// HRESULT ret = ResultFromScode(S_FALSE);
+//
+// *lpcFetched = VOS_MIN(cConnections, m_numOfConn - m_index);
+//
+// for (ULONG i = 0; i < (*lpcFetched); i++)
+// {
+// rgcd[i] = m_pConnection[m_index + i];
+// rgcd[i].pUnk->AddRef();
+// }
+//
+// m_index += (*lpcFetched);
+//
+// if ((*lpcFetched) == cConnections)
+// ret = ResultFromScode(S_OK);
+//
+// return ret;
+//}
+//
+//
+//STDMETHODIMP EnumConnections_Impl::Skip(
+// /* [in] */ ULONG cConnections)
+//{
+// HRESULT ret = ResultFromScode(S_OK);
+//
+// m_index = VOS_MIN(m_index + cConnections, m_numOfConn);
+//
+// return ret;
+//}
+//
+//STDMETHODIMP EnumConnections_Impl::Reset( void)
+//{
+// HRESULT ret = ResultFromScode(S_OK);
+//
+// m_index = 0;
+//
+// return ret;
+//}
+//
+//STDMETHODIMP EnumConnections_Impl::Clone(
+// /* [out] */ IEnumConnections __RPC_FAR *__RPC_FAR *ppEnum)
+//{
+// HRESULT ret = ResultFromScode(S_OK);
+//
+// *ppEnum = new EnumConnections_Impl(m_pConnection, m_numOfConn);
+//
+// return ret;
+//}
+
+/*****************************************************************************
+
+ class implementation: EnumConnectionPoints_Impl
+
+*****************************************************************************/
+
+//EnumConnectionPoints_Impl::EnumConnectionPoints_Impl(OleRef<IConnectionPoint>* pPoints,
+// ULONG numOfPoints)
+//{
+// m_index = 0;
+// m_numOfPoints = numOfPoints;
+//
+// if (m_numOfPoints)
+// {
+// m_pPoints = new OleRef<IConnectionPoint>[m_numOfPoints];
+//
+// for (ULONG i = 0; i < m_numOfPoints; i++)
+// {
+// m_pPoints[i] = pPoints[i];
+// }
+// }
+//}
+//
+//EnumConnectionPoints_Impl::~EnumConnectionPoints_Impl()
+//{
+// if (m_numOfPoints)
+// {
+// delete[] m_pPoints;
+// }
+//}
+//
+//STDMETHODIMP EnumConnectionPoints_Impl::QueryInterface(REFIID riid, LPVOID FAR * ppv)
+//{
+// if(IsEqualIID(riid, IID_IUnknown))
+// {
+// AddRef();
+// *ppv = (IUnknown*) (IEnumConnectionPoints*) this;
+// return NOERROR;
+// }
+// else if (IsEqualIID(riid, IID_IEnumConnectionPoints))
+// {
+// AddRef();
+// *ppv = (IEnumConnectionPoints*) this;
+// return NOERROR;
+// }
+//
+// *ppv = NULL;
+//
+// return ResultFromScode(E_NOINTERFACE);
+//}
+//
+//STDMETHODIMP_(ULONG) EnumConnectionPoints_Impl::AddRef()
+//{
+// return m_refCount.acquire();
+//}
+//
+//STDMETHODIMP_(ULONG) EnumConnectionPoints_Impl::Release()
+//{
+//
+// ULONG n = m_refCount.release();
+//
+// if (n == 0)
+// {
+// delete this;
+// }
+//
+// return n;
+//}
+//
+//STDMETHODIMP EnumConnectionPoints_Impl::Next(
+// /* [in] */ ULONG cPoints,
+// /* [out] */ IConnectionPoint __RPC_FAR *__RPC_FAR *rgpcn,
+// /* [out] */ ULONG __RPC_FAR *lpcFetched)
+//{
+// HRESULT ret = ResultFromScode(S_FALSE);
+//
+// *lpcFetched = VOS_MIN(cPoints, m_numOfPoints - m_index);
+//
+// for (ULONG i = 0; i < (*lpcFetched); i++)
+// {
+// rgpcn[i] = m_pPoints[m_index + i].get();
+// rgpcn[i]->AddRef();
+// }
+//
+// m_index += (*lpcFetched);
+//
+// if ((*lpcFetched) == cPoints)
+// ret = ResultFromScode(S_OK);
+//
+// return ret;
+//}
+//
+//STDMETHODIMP EnumConnectionPoints_Impl::Skip(
+// /* [in] */ ULONG cPoints)
+//{
+// HRESULT ret = ResultFromScode(S_OK);
+//
+// m_index = VOS_MIN(m_index + cPoints, m_numOfPoints);
+//
+// return ret;
+//}
+//
+//STDMETHODIMP EnumConnectionPoints_Impl::Reset( void)
+//{
+// HRESULT ret = ResultFromScode(S_OK);
+//
+// m_index = 0;
+//
+// return ret;
+//}
+//
+//STDMETHODIMP EnumConnectionPoints_Impl::Clone(
+// /* [out] */ IEnumConnectionPoints __RPC_FAR *__RPC_FAR *ppEnum)
+//{
+// HRESULT ret = ResultFromScode(S_OK);
+//
+// *ppEnum = new EnumConnectionPoints_Impl(m_pPoints, m_numOfPoints);
+//
+// return ret;
+//}
+
+/*************************************************************************
+
+ UnoObjectWrapperRemoteOpt
+
+*************************************************************************/
+UnoObjectWrapperRemoteOpt::UnoObjectWrapperRemoteOpt( Reference<XMultiServiceFactory>& aFactory,
+ sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass):
+ InterfaceOleWrapper_Impl( aFactory, unoWrapperClass, comWrapperClass)
+
+{
+}
+UnoObjectWrapperRemoteOpt::~UnoObjectWrapperRemoteOpt()
+{
+}
+
+// UnoConversionUtilities
+Reference< XInterface > UnoObjectWrapperRemoteOpt::createUnoWrapperInstance()
+{
+ Reference<XWeak> xWeak= static_cast<XWeak*>( new UnoObjectWrapperRemoteOpt(
+ m_xMultiServiceFactory, m_nUnoWrapperClass, m_nComWrapperClass));
+ return Reference<XInterface>( xWeak, UNO_QUERY);
+}
+
+STDMETHODIMP UnoObjectWrapperRemoteOpt::GetIDsOfNames ( REFIID riid, OLECHAR ** rgszNames, unsigned int cNames,
+ LCID lcid, DISPID * rgdispid )
+{
+ static DISPID currentId= 1;
+
+ if( ! rgdispid)
+ return E_POINTER;
+ HRESULT ret = E_UNEXPECTED;
+ // ----------------------------------------
+ // _GetValueObject
+ if( ! wcscmp( *rgszNames, JSCRIPT_VALUE_FUNC))
+ {
+ *rgdispid= DISPID_JSCRIPT_VALUE_FUNC;
+ return S_OK;
+ }
+ // ----------------------------------------
+ if (m_xInvocation.is() && (cNames > 0))
+ {
+ OUString name(rgszNames[0]);
+ // has this name been determined as "bad"
+ BadNameMap::iterator badIter= m_badNameMap.find( name);
+ if( badIter == m_badNameMap.end() )
+ {
+ // name has not been bad before( member exists
+ typedef NameToIdMap::iterator ITnames;
+ pair< ITnames, bool > pair_id= m_nameToDispIdMap.insert( NameToIdMap::value_type(name, currentId++));
+ // new ID inserted ?
+ if( pair_id.second )
+ {// yes, now create MemberInfo and ad to IdToMemberInfoMap
+ MemberInfo d(0, name);
+ m_idToMemberInfoMap.insert( IdToMemberInfoMap::value_type( currentId - 1, d));
+ }
+
+ *rgdispid = pair_id.first->second;
+ ret = S_OK;
+ }
+ else
+ ret= DISP_E_UNKNOWNNAME;
+ }
+ return ret;
+}
+
+STDMETHODIMP UnoObjectWrapperRemoteOpt::Invoke ( DISPID dispidMember, REFIID riid, LCID lcid, unsigned short wFlags,
+ DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
+ unsigned int * puArgErr )
+{
+ HRESULT ret = S_OK;
+
+ sal_Bool bHandled= sal_False;
+ ret= InvokeGeneral( dispidMember, wFlags, pdispparams, pvarResult, pexcepinfo,
+ puArgErr, bHandled);
+ if( bHandled)
+ return ret;
+
+ if ( dispidMember > 0 && m_xInvocation.is())
+ {
+
+ IdToMemberInfoMap::iterator it_MemberInfo= m_idToMemberInfoMap.find( dispidMember);
+ if( it_MemberInfo != m_idToMemberInfoMap.end() )
+ {
+ MemberInfo& info= it_MemberInfo->second;
+
+ Sequence<Any> params; // holds converted any s
+ if( ! info.flags )
+ { // DISPID called for the first time
+ if( wFlags == DISPATCH_METHOD )
+ {
+ if( convertVARIANTARGS(dispidMember, wFlags, pdispparams, params ))
+ {
+ if( FAILED( ret= doInvoke( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, info.name, params))
+ && ret == DISP_E_MEMBERNOTFOUND)
+ {
+ // try to get the exact name
+ OUString exactName;
+ if (m_xExactName.is())
+ {
+ exactName = m_xExactName->getExactName( info.name);
+ // invoke again
+ if( exactName.getLength() != 0)
+ {
+ if( SUCCEEDED( ret= doInvoke( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, exactName, params)))
+ info.name= exactName;
+ }
+ }
+ }
+ if( SUCCEEDED( ret ) )
+ info.flags= DISPATCH_METHOD;
+
+ } // end if ( convertVARIANTARGS )
+ else // convertVARIANTARGS failed
+ ret= DISP_E_BADVARTYPE;
+ } //if( wFlags == DISPATCH_METHOD )
+
+ else if( wFlags == DISPATCH_PROPERTYPUT || wFlags == DISPATCH_PROPERTYPUTREF)
+ {
+ if( convertVARIANTARGS(dispidMember, wFlags, pdispparams, params ))
+ {
+ if( FAILED( ret= doSetProperty( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, info.name, params))
+ && ret == DISP_E_MEMBERNOTFOUND)
+ {
+ // try to get the exact name
+ OUString exactName;
+ if (m_xExactName.is())
+ {
+ exactName = m_xExactName->getExactName( info.name);
+ // invoke again
+ if( exactName.getLength() != 0)
+ {
+ if( SUCCEEDED( ret= doSetProperty( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, exactName, params)))
+ info.name= exactName;
+ }
+ }
+ }
+ if( SUCCEEDED( ret ) )
+ info.flags= DISPATCH_PROPERTYPUT | DISPATCH_PROPERTYGET;
+ } // end if ( convertVARIANTARGS )
+ else
+ ret= DISP_E_BADVARTYPE;
+
+ }
+
+ else if( wFlags == DISPATCH_PROPERTYGET)
+ {
+ if( FAILED( ret= doGetProperty( pdispparams, pvarResult,
+ pexcepinfo, info.name))
+ && ret == DISP_E_MEMBERNOTFOUND)
+ {
+ // try to get the exact name
+ OUString exactName;
+ if (m_xExactName.is())
+ {
+ exactName = m_xExactName->getExactName( info.name);
+ // invoke again
+ if( exactName.getLength() != 0)
+ {
+ if( SUCCEEDED( ret= doGetProperty( pdispparams, pvarResult,
+ pexcepinfo, exactName)))
+ info.name= exactName;
+ }
+ }
+ }
+ if( SUCCEEDED( ret ) )
+ info.flags= DISPATCH_PROPERTYGET | DISPATCH_PROPERTYPUT;
+ }
+ else if( wFlags & DISPATCH_METHOD &&
+ (wFlags & DISPATCH_PROPERTYPUT || wFlags & DISPATCH_PROPERTYPUTREF))
+ {
+
+ OUString exactName;
+ // convert params for DISPATCH_METHOD or DISPATCH_PROPERTYPUT
+ if( convertVARIANTARGS(dispidMember, wFlags, pdispparams, params ))
+ {// try first as method
+ if( FAILED( ret= doInvoke( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, info.name, params))
+ && ret == DISP_E_MEMBERNOTFOUND)
+ {
+ // try to get the exact name
+ if (m_xExactName.is())
+ {
+ exactName = m_xExactName->getExactName( info.name);
+ // invoke again
+ if( exactName.getLength() != 0)
+ {
+ if( SUCCEEDED( ret= doInvoke( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, exactName, params)))
+ info.name= exactName;
+ }
+ }
+ }
+ if( SUCCEEDED( ret ) )
+ info.flags= DISPATCH_METHOD;
+
+ // try as property
+ if( FAILED( ret) && pdispparams->cArgs == 1)
+ {
+ if( FAILED( ret= doSetProperty( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, info.name, params))
+ && ret == DISP_E_MEMBERNOTFOUND)
+ {
+ // try to get the exact name
+ if( exactName.getLength() != 0)
+ {
+ if( SUCCEEDED( ret= doSetProperty( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, exactName, params)))
+ info.name= exactName;
+ }
+ }
+ if( SUCCEEDED( ret ) )
+ info.flags= DISPATCH_PROPERTYPUT | DISPATCH_PROPERTYGET;
+ }
+ } // end if ( convertVARIANTARGS )
+ else
+ ret= DISP_E_BADVARTYPE;
+ }
+ else if( wFlags & DISPATCH_METHOD && wFlags & DISPATCH_PROPERTYGET)
+ {
+ OUString exactName;
+ if( convertVARIANTARGS(dispidMember, wFlags, pdispparams, params ))
+ {
+ if( FAILED( ret= doInvoke( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, info.name, params))
+ && ret == DISP_E_MEMBERNOTFOUND)
+ {
+ // try to get the exact name
+ if (m_xExactName.is())
+ {
+ exactName = m_xExactName->getExactName( info.name);
+ // invoke again
+ if( exactName.getLength() != 0)
+ {
+ if( SUCCEEDED( ret= doInvoke( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, exactName, params)))
+ info.name= exactName;
+ }
+ }
+ }
+ if( SUCCEEDED( ret ) )
+ info.flags= DISPATCH_METHOD;
+
+ } // end if ( convertVARIANTARGS )
+ else
+ ret= DISP_E_BADVARTYPE;
+
+ // try as property
+ if( FAILED( ret) && pdispparams->cArgs == 1)
+ {
+ if( FAILED( ret= doGetProperty( pdispparams, pvarResult,
+ pexcepinfo, info.name))
+ && ret == DISP_E_MEMBERNOTFOUND)
+ {
+ if( exactName.getLength() != 0)
+ {
+ if( SUCCEEDED( ret= doSetProperty( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, exactName, params)))
+ info.name= exactName;
+ }
+ }
+ if( SUCCEEDED( ret ) )
+ info.flags= DISPATCH_PROPERTYGET;
+ }
+ }
+
+ // update ínformation about this member
+ if( ret == DISP_E_MEMBERNOTFOUND)
+ {
+ // Remember the name as not existing
+ // and remove the MemberInfo
+ m_badNameMap[info.name]= sal_False;
+ m_idToMemberInfoMap.erase( it_MemberInfo);
+ }
+ } // if( ! info.flags )
+ else // IdToMemberInfoMap contains a MemberInfo
+ {
+ if( wFlags & DISPATCH_METHOD && info.flags == DISPATCH_METHOD)
+ {
+ if( convertVARIANTARGS(dispidMember, wFlags, pdispparams, params ))
+ {
+ ret= doInvoke( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, info.name, params);
+ }
+ else
+ ret= DISP_E_BADVARTYPE;
+ }
+ else if( (wFlags & DISPATCH_PROPERTYPUT || wFlags & DISPATCH_PROPERTYPUTREF ) &&
+ info.flags & DISPATCH_PROPERTYPUT)
+ {
+ if( convertVARIANTARGS(dispidMember, wFlags, pdispparams, params ))
+ {
+ ret= doSetProperty( pdispparams, pvarResult,
+ pexcepinfo, puArgErr, info.name, params);
+ }
+ else
+ ret= DISP_E_BADVARTYPE;
+ }
+ else if( (wFlags & DISPATCH_PROPERTYGET) && ( info.flags & DISPATCH_PROPERTYGET))
+ {
+ ret= doGetProperty( pdispparams, pvarResult,
+ pexcepinfo, info.name);
+ }
+ }
+ }// if( it_MemberInfo != m_idToMemberInfoMap.end() )
+ else
+ ret= DISP_E_MEMBERNOTFOUND;
+ }
+ return ret;
+}
+
+HRESULT UnoObjectWrapperRemoteOpt::methodInvoke( DISPID dispidMember, DISPPARAMS * pdispparams, VARIANT * pvarResult,
+ EXCEPINFO * pexcepinfo, unsigned int * puArgErr, Sequence<Any> params)
+{
+ return S_OK;
+}
+
+
+// The returned HRESULT is only appropriate for IDispatch::Invoke
+static HRESULT mapCannotConvertException( CannotConvertException e, unsigned int * puArgErr)
+{
+ HRESULT ret;
+ sal_Bool bWriteIndex= sal_True;
+
+ switch ( e.Reason)
+ {
+ case FailReason::OUT_OF_RANGE:
+ ret = DISP_E_OVERFLOW;
+ break;
+ case FailReason::IS_NOT_NUMBER:
+ ret = DISP_E_TYPEMISMATCH;
+ break;
+ case FailReason::IS_NOT_ENUM:
+ ret = DISP_E_TYPEMISMATCH;
+ break;
+ case FailReason::IS_NOT_BOOL:
+ ret = DISP_E_TYPEMISMATCH;
+ break;
+ case FailReason::NO_SUCH_INTERFACE:
+ ret = DISP_E_TYPEMISMATCH;
+ break;
+ case FailReason::SOURCE_IS_NO_DERIVED_TYPE:
+ ret = DISP_E_TYPEMISMATCH;
+ break;
+ case FailReason::TYPE_NOT_SUPPORTED:
+ ret = DISP_E_TYPEMISMATCH;
+ break;
+ case FailReason::INVALID:
+ ret = DISP_E_TYPEMISMATCH;
+ break;
+ case FailReason::NO_DEFAULT_AVAILABLE:
+ ret = DISP_E_BADPARAMCOUNT;
+ break;
+ case FailReason::UNKNOWN:
+ ret = E_UNEXPECTED;
+ break;
+ default:
+ ret = E_UNEXPECTED;
+ bWriteIndex= sal_False;
+ break;
+ }
+
+ if( bWriteIndex && puArgErr != NULL)
+ *puArgErr = e.ArgumentIndex;
+ return ret;
+}
+
+// The function maps the TypeClass of the any to VARTYPE: If
+// the Any contains STRUCT or INTERFACE then the return value
+// is VT_DISPATCH. The function is used from o2u_createUnoObjectWrapper
+// and the result is put into the constructor of the uno - wrapper
+// object. If a client asks the object for DISPID_VALUE and this
+// funtion returned VT_DISPATCH then the IDispatch of the same
+// object is being returned.
+// See InterfaceOleWrapper_Impl::Invoke, InterfaceOleWrapper_Impl::m_defaultValueType
+const VARTYPE getVarType( const Any& value)
+{
+ VARTYPE ret= VT_EMPTY;
+
+ switch ( value.getValueTypeClass())
+ {
+ case TypeClass_STRUCT: ret= VT_DISPATCH; break;
+ case TypeClass_INTERFACE: ret= VT_DISPATCH; break;
+ default: break;
+ }
+ return ret;
+}
+
+
+
+
+} // end namespace
diff --git a/extensions/source/ole/unoobjw.hxx b/extensions/source/ole/unoobjw.hxx
new file mode 100644
index 000000000..7eabfcdc7
--- /dev/null
+++ b/extensions/source/ole/unoobjw.hxx
@@ -0,0 +1,505 @@
+/*************************************************************************
+ *
+ * $RCSfile: unoobjw.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNOOBJW_HXX
+#define _UNOOBJW_HXX
+
+#include <com/sun/star/script/XAllListener.hpp>
+#include <com/sun/star/script/XEventAttacher.hpp>
+#include <com/sun/star/bridge/XBridgeSupplier2.hpp>
+#include <com/sun/star/beans/XExactName.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <vos/refernce.hxx>
+#include <tools/presys.h>
+#include "stdafx.h"
+#include "comifaces.hxx"
+#include <tools/postsys.h>
+
+#include "ole2uno.hxx"
+#include "unoconversionutilities.hxx"
+
+
+using namespace std;
+using namespace cppu;
+using namespace com::sun::star::bridge;
+namespace ole_adapter
+{
+
+
+
+struct hash_IUnknown_Impl
+{
+ size_t operator()(const IUnknown* p) const
+ {
+ return (size_t)p;
+ }
+};
+
+struct equal_to_IUnknown_Impl
+{
+ bool operator()(const IUnknown* s1, const IUnknown* s2) const
+ {
+ return s1 == s2;
+ }
+};
+
+typedef hash_map
+<
+ IUnknown*,
+ Reference<XInterface>,
+ hash_IUnknown_Impl,
+ equal_to_IUnknown_Impl
+> WrapperMap;
+
+typedef hash_map
+<
+ DWORD,
+ OleRef<IDispatch>,
+ hash<DWORD>,
+ equal_to<DWORD>
+> ConnectionMap;
+
+struct GenListenerData
+{
+ Any helper;
+ OUString listenerType;
+ OUString addListenerParam;
+ Reference<XEventListener> xGenListener;
+};
+
+typedef vector<GenListenerData> GenListenerDataList;
+
+struct MemberInfo
+{
+ MemberInfo() : flags(0), name() {}
+ MemberInfo(WORD f, const OUString& n) : flags(f), name(n) {}
+
+ WORD flags;
+ OUString name;
+};
+
+typedef hash_map
+<
+ OUString,
+ DISPID,
+ hashOUString_Impl,
+ equalOUString_Impl
+> NameToIdMap;
+
+typedef hash_map
+<
+ OUString,
+ sal_Bool,
+ hashOUString_Impl,
+ equalOUString_Impl
+> BadNameMap;
+
+typedef hash_map
+<
+ DISPID,
+ MemberInfo
+> IdToMemberInfoMap;
+/*****************************************************************************
+
+ class declaration: EnumConnections_Impl
+
+*****************************************************************************/
+
+//class EnumConnections_Impl : public IEnumConnections
+//{
+//public:
+//
+// EnumConnections_Impl(CONNECTDATA* pConnection, ULONG numOfConn);
+// ~EnumConnections_Impl();
+//
+// /* IUnknown methods */
+// STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
+// STDMETHOD_(ULONG, AddRef)();
+// STDMETHOD_(ULONG, Release)();
+//
+// /* IEnumConnections */
+// virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next(
+// /* [in] */ ULONG cConnections,
+// /* [out] */ CONNECTDATA __RPC_FAR *rgcd,
+// /* [out] */ ULONG __RPC_FAR *lpcFetched);
+//
+// virtual HRESULT STDMETHODCALLTYPE Skip(
+// /* [in] */ ULONG cConnections);
+//
+// virtual HRESULT STDMETHODCALLTYPE Reset(void);
+//
+// virtual HRESULT STDMETHODCALLTYPE Clone(
+// /* [out] */ IEnumConnections __RPC_FAR *__RPC_FAR *ppEnum);
+//
+//protected:
+//
+// vos::ORefCount m_refCount;
+// CONNECTDATA* m_pConnection;
+// ULONG m_numOfConn;
+// ULONG m_index;
+//};
+
+
+/*****************************************************************************
+
+ class declaration: ConnectionPoint_Impl
+
+*****************************************************************************/
+
+
+//class ConnectionPoint_Impl : public IConnectionPoint
+// , public WeakImplHelper1<XAllListener>
+//{
+//public:
+//
+// ConnectionPoint_Impl(const Reference<XInvocation>& xInv,
+// const Reference<XInterface>& xOrigin,
+// const Reference<XEventAttacher>& xEventAttacher,
+// IConnectionPointContainer* pContainer);
+//
+// ~ConnectionPoint_Impl();
+//
+// /* IUnknown methods */
+// STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
+// STDMETHOD_(ULONG, AddRef)();
+// STDMETHOD_(ULONG, Release)();
+//
+// /* IConnectionPoint */
+// virtual HRESULT STDMETHODCALLTYPE GetConnectionInterface(
+// /* [out] */ IID __RPC_FAR *piid);
+//
+// virtual HRESULT STDMETHODCALLTYPE GetConnectionPointContainer(
+// /* [out] */ IConnectionPointContainer __RPC_FAR *__RPC_FAR *ppCPC);
+//
+// virtual HRESULT STDMETHODCALLTYPE Advise(
+// /* [in] */ IUnknown __RPC_FAR *pUnkSink,
+// /* [out] */ DWORD __RPC_FAR *pdwCookie);
+//
+// virtual HRESULT STDMETHODCALLTYPE Unadvise(
+// /* [in] */ DWORD dwCookie);
+//
+// virtual HRESULT STDMETHODCALLTYPE EnumConnections(
+// /* [out] */ IEnumConnections __RPC_FAR *__RPC_FAR *ppEnum);
+//
+//
+//
+// /* XEventListener */
+// virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException);
+//
+// /* XAllListener */
+// virtual void SAL_CALL firing( const AllEventObject& iaEvent ) throw(RuntimeException);
+// virtual Any SAL_CALL approveFiring( const AllEventObject& aEvent ) throw(InvocationTargetException, RuntimeException);
+//
+//
+//protected:
+//
+// void registerListener();
+// void unregisterListener();
+//
+// vos::ORefCount m_refCount;
+// Reference<XInvocation> m_xInvocation;
+// Reference<XInterface> m_xOrigin;
+// OleRef<IConnectionPointContainer> m_rContainer;
+// ConnectionMap m_connection;
+// DWORD m_nextCookie;
+// Reference<XEventAttacher> m_xEventAttacher;
+// GenListenerDataList m_xGenListenerList;
+//};
+
+/*****************************************************************************
+
+ class declaration: EnumConnectionPoints_Impl
+
+*****************************************************************************/
+
+//class EnumConnectionPoints_Impl : public IEnumConnectionPoints
+//{
+//public:
+//
+// EnumConnectionPoints_Impl(OleRef<IConnectionPoint>* pPoints, ULONG numOfPoints);
+// ~EnumConnectionPoints_Impl();
+//
+// /* IUnknown methods */
+// STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
+// STDMETHOD_(ULONG, AddRef)();
+// STDMETHOD_(ULONG, Release)();
+//
+// /* IEnumConnectionPoints */
+// virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next(
+// /* [in] */ ULONG cConnections,
+// /* [out] */ IConnectionPoint __RPC_FAR *__RPC_FAR *rgpcn,
+// /* [out] */ ULONG __RPC_FAR *lpcFetched);
+//
+// virtual HRESULT STDMETHODCALLTYPE Skip(
+// /* [in] */ ULONG cConnections);
+//
+// virtual HRESULT STDMETHODCALLTYPE Reset(void);
+//
+// virtual HRESULT STDMETHODCALLTYPE Clone(
+// /* [out] */ IEnumConnectionPoints __RPC_FAR *__RPC_FAR *ppEnum);
+//
+//protected:
+//
+// vos::ORefCount m_refCount;
+// OleRef<IConnectionPoint>* m_pPoints;
+// ULONG m_numOfPoints;
+// ULONG m_index;
+//};
+
+/*****************************************************************************
+
+ class declaration: InterfaceOleWrapper_Impl
+
+*****************************************************************************/
+
+class InterfaceOleWrapper_Impl : public WeakImplHelper2<XBridgeSupplier2, XInitialization>,
+ public IDispatchEx,
+// public IConnectionPointContainer,
+ public UnoConversionUtilities<InterfaceOleWrapper_Impl>,
+ public IUnoObjectWrapper
+{
+public:
+
+
+ InterfaceOleWrapper_Impl(Reference<XMultiServiceFactory>& xFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass);
+ ~InterfaceOleWrapper_Impl();
+
+ /* IUnknown methods */
+ STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
+ STDMETHOD_(ULONG, AddRef)();
+ STDMETHOD_(ULONG, Release)();
+
+ /* IDispatch methods */
+ STDMETHOD( GetTypeInfoCount )( unsigned int * pctinfo );
+ STDMETHOD( GetTypeInfo )( unsigned int itinfo, LCID lcid, ITypeInfo ** pptinfo );
+ STDMETHOD( GetIDsOfNames )( REFIID riid, OLECHAR ** rgszNames, unsigned int cNames,
+ LCID lcid, DISPID * rgdispid );
+ STDMETHOD( Invoke )( DISPID dispidMember, REFIID riid, LCID lcid, unsigned short wFlags,
+ DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
+ unsigned int * puArgErr );
+
+ /* IDispatchEx methods */
+
+ virtual HRESULT STDMETHODCALLTYPE GetDispID(
+ /* [in] */ BSTR bstrName,
+ /* [in] */ DWORD grfdex,
+ /* [out] */ DISPID __RPC_FAR *pid);
+
+ virtual /* [local] */ HRESULT STDMETHODCALLTYPE InvokeEx(
+ /* [in] */ DISPID id,
+ /* [in] */ LCID lcid,
+ /* [in] */ WORD wFlags,
+ /* [in] */ DISPPARAMS __RPC_FAR *pdp,
+ /* [out] */ VARIANT __RPC_FAR *pvarRes,
+ /* [out] */ EXCEPINFO __RPC_FAR *pei,
+ /* [unique][in] */ IServiceProvider __RPC_FAR *pspCaller);
+
+ virtual HRESULT STDMETHODCALLTYPE DeleteMemberByName(
+ /* [in] */ BSTR bstr,
+ /* [in] */ DWORD grfdex);
+
+ virtual HRESULT STDMETHODCALLTYPE DeleteMemberByDispID(
+ /* [in] */ DISPID id);
+
+ virtual HRESULT STDMETHODCALLTYPE GetMemberProperties(
+ /* [in] */ DISPID id,
+ /* [in] */ DWORD grfdexFetch,
+ /* [out] */ DWORD __RPC_FAR *pgrfdex);
+
+ virtual HRESULT STDMETHODCALLTYPE GetMemberName(
+ /* [in] */ DISPID id,
+ /* [out] */ BSTR __RPC_FAR *pbstrName);
+
+ virtual HRESULT STDMETHODCALLTYPE GetNextDispID(
+ /* [in] */ DWORD grfdex,
+ /* [in] */ DISPID id,
+ /* [out] */ DISPID __RPC_FAR *pid);
+
+ virtual HRESULT STDMETHODCALLTYPE GetNameSpaceParent(
+ /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunk);
+
+ /* IConnectionPointContainer */
+// virtual HRESULT STDMETHODCALLTYPE EnumConnectionPoints(
+// /* [out] */ IEnumConnectionPoints __RPC_FAR *__RPC_FAR *ppEnum);
+//
+// virtual HRESULT STDMETHODCALLTYPE FindConnectionPoint(
+// /* [in] */ REFIID riid,
+// /* [out] */ IConnectionPoint __RPC_FAR *__RPC_FAR *ppCP);
+
+ //XInterface ----------------------------------------------------------
+ void SAL_CALL InterfaceOleWrapper_Impl::acquire( ) throw();
+ void SAL_CALL InterfaceOleWrapper_Impl::release( ) throw();
+
+ // XBridgeSupplier2 ---------------------------------------------------
+ virtual Any SAL_CALL createBridge(const Any& modelDepObject,
+ const Sequence<sal_Int8>& ProcessId,
+ sal_Int16 sourceModelType,
+ sal_Int16 destModelType)
+ throw (IllegalArgumentException, RuntimeException);
+
+ //XInitialization -----------------------------------------------------
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
+
+ // IUnoObjectWrapper
+ STDMETHOD( getWrapperXInterface)( Reference<XInterface>* pXInt);
+ STDMETHOD( getOriginalUnoObject)( Reference<XInterface>* pXInt);
+ STDMETHOD( getOriginalUnoStruct)( Any * pStruct);
+
+ // UnoConversionUtility
+// virtual Reference< XSingleServiceFactory > getInvocationFactory();
+ virtual Reference< XInterface > createUnoWrapperInstance();
+ virtual Reference< XInterface > createComWrapperInstance();
+
+
+protected:
+ virtual HRESULT doInvoke( DISPPARAMS * pdispparams, VARIANT * pvarResult,
+ EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString & name, Sequence<Any>& params);
+
+ virtual HRESULT doGetProperty( DISPPARAMS * pdispparams, VARIANT * pvarResult,
+ EXCEPINFO * pexcepinfo, OUString & name );
+
+ virtual HRESULT doSetProperty( DISPPARAMS * pdispparams, VARIANT * pvarResult,
+ EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString & name, Sequence<Any> params);
+
+ virtual HRESULT InvokeGeneral( DISPID dispidMember, unsigned short wFlags,
+ DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
+ unsigned int * puArgErr, sal_Bool& bHandled);
+
+ sal_Bool convertVARIANTARGS( DISPID id, unsigned short wFlags, DISPPARAMS* pdispparams,
+ Sequence<Any>& rSeq);
+
+ vos::ORefCount m_refCount;
+ Reference<XInvocation> m_xInvocation;
+ Reference<XExactName> m_xExactName;
+ Reference<XInterface> m_xOrigin;
+ Reference<XEventAttacher> m_xEventAttacher;
+ NameToIdMap m_nameToDispIdMap;
+ vector<MemberInfo> m_MemberInfos;
+ OleRef<IConnectionPoint> m_rConnectionPoint;
+ // This member is used to determine the default value
+ // denoted by DISPID_VALUE (0). For proper results in JavaScript
+ // we have to return the default value when we write an object
+ // as out parameter. That is, we get an JScript Array as parameter
+ // and put a wrapped object on index null. The array object tries
+ // to detect the default value. The wrapped object must then return
+ // its own IDispatch* otherwise we cannot access it within the script.
+ // see InterfaceOleWrapper_Impl::Invoke
+ VARTYPE m_defaultValueType;
+
+};
+
+/*****************************************************************************
+
+ class declaration: UnoObjectWrapperRemoteOpt
+ ( Uno Object Wrapper Remote Optimized)
+ This is the UNO wrapper used in the service com.sun.star.bridge.OleBridgeSupplierVar1.
+ Key features:
+ DISPIDs are passed out blindly. That is in GetIDsOfNames is no name checking carried out.
+ Only if Invoke fails the name is being checked. Moreover Invoke tries to figure out
+ if a call is made to a property or method if the flags are DISPATCH_METHOD | DISPATCH_PROPERTYPUT.
+ If something has been found out about a property or member than it is saved
+ in a MemberInfo structure hold by a IdToMemberInfoMap stl map.
+
+*****************************************************************************/
+class UnoObjectWrapperRemoteOpt: public InterfaceOleWrapper_Impl
+{
+public:
+ UnoObjectWrapperRemoteOpt( Reference<XMultiServiceFactory>& aFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass);
+ ~UnoObjectWrapperRemoteOpt();
+
+ STDMETHOD( GetIDsOfNames )( REFIID riid, OLECHAR ** rgszNames, unsigned int cNames,
+ LCID lcid, DISPID * rgdispid );
+ STDMETHOD( Invoke )( DISPID dispidMember, REFIID riid, LCID lcid, unsigned short wFlags,
+ DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
+ unsigned int * puArgErr );
+
+ // UnoConversionUtility
+ // If UNO interfaces are converted in methods of this class then
+ // they are always wrapped with instances of this class
+ virtual Reference< XInterface > createUnoWrapperInstance();
+
+protected:
+
+ HRESULT methodInvoke( DISPID dispidMember, DISPPARAMS * pdispparams, VARIANT * pvarResult,
+ EXCEPINFO * pexcepinfo, unsigned int * puArgErr, Sequence<Any> params);
+ // In GetIDsOfNames are blindly passed out, that is without verifying
+ // the name. If two names are passed in during different calls to
+ // GetIDsOfNames and the names differ only in their cases then different
+ // id's are passed out ( e.g. "doSomethingMethod" or "dosomethingmethod").
+ // In Invoke the DISPID is remapped to the name passed to GetIDsOfNames
+ // and the name is used as parameter for XInvocation::invoke. If invoke
+ // fails because of a wrong name, then m_xExactName ( XExactName) is used
+ // to verify the name. The correct name is then inserted to m_MemberInfos
+ // ( vector<MemberInfo> ). During the next call to Invoke the right name
+ // is used. .
+
+
+ BadNameMap m_badNameMap;
+
+ IdToMemberInfoMap m_idToMemberInfoMap;
+
+};
+
+
+
+} // end namespace
+
+#endif
diff --git a/extensions/source/plugin/base/context.cxx b/extensions/source/plugin/base/context.cxx
new file mode 100644
index 000000000..004a294d3
--- /dev/null
+++ b/extensions/source/plugin/base/context.cxx
@@ -0,0 +1,364 @@
+/*************************************************************************
+ *
+ * $RCSfile: context.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <plugin/impl.hxx>
+
+#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAGS_HPP_
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#endif
+#include <tools/fsys.hxx>
+#include <tools/urlobj.hxx>
+
+#include <cppuhelper/implbase1.hxx>
+
+namespace ext_plug {
+
+class FileSink : public ::cppu::WeakAggImplHelper1< ::com::sun::star::io::XOutputStream >
+{
+private:
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ FILE* fp;
+ Reference< ::com::sun::star::plugin::XPlugin > m_xPlugin;
+ ::rtl::OUString m_aMIMEType;
+ ::rtl::OUString m_aTarget;
+ ::rtl::OUString m_aFileName;
+
+public:
+ FileSink( const Reference< ::com::sun::star::lang::XMultiServiceFactory > &,
+ const Reference< ::com::sun::star::plugin::XPlugin > & plugin,
+ const ::rtl::OUString& mimetype,
+ const ::rtl::OUString& target,
+ const Reference< ::com::sun::star::io::XActiveDataSource > & source );
+ virtual ~FileSink();
+
+ // ::com::sun::star::io::XOutputStream
+ virtual void SAL_CALL writeBytes( const Sequence<sal_Int8>& );
+ virtual void SAL_CALL flush();
+ virtual void SAL_CALL closeOutput();
+};
+
+}
+using namespace ext_plug;
+
+class XPluginContext_Impl : public ::cppu::WeakAggImplHelper1< ::com::sun::star::plugin::XPluginContext >
+{
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ rtl_TextEncoding m_aEncoding;
+public:
+
+ XPluginContext_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
+ virtual ~XPluginContext_Impl();
+
+
+ virtual ::rtl::OUString SAL_CALL getValue(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, ::com::sun::star::plugin::PluginVariable variable) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual void SAL_CALL getURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Reference< ::com::sun::star::lang::XEventListener > & listener) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual void SAL_CALL getURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual void SAL_CALL postURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file, const Reference< ::com::sun::star::lang::XEventListener > & listener) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual void SAL_CALL postURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual void SAL_CALL newStream(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& mimetype, const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual void SAL_CALL displayStatusText(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& message) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+ virtual ::rtl::OUString SAL_CALL getUserAgent(const Reference< ::com::sun::star::plugin::XPlugin > & plugin) throw( ::com::sun::star::plugin::PluginException, RuntimeException );
+};
+
+Reference< ::com::sun::star::plugin::XPluginContext > XPluginManager_Impl::createPluginContext()
+{
+ return new XPluginContext_Impl( m_xSMgr );
+}
+
+XPluginContext_Impl::XPluginContext_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr )
+ : m_xSMgr( rSMgr ),
+ m_aEncoding( gsl_getSystemTextEncoding() )
+{
+}
+
+XPluginContext_Impl::~XPluginContext_Impl()
+{
+}
+
+::rtl::OUString XPluginContext_Impl::getValue( const Reference< ::com::sun::star::plugin::XPlugin > & plugin, ::com::sun::star::plugin::PluginVariable variable )
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ return ::rtl::OUString();
+}
+
+
+void XPluginContext_Impl::getURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target) throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) );
+ if( ! xInst.is() )
+ return;
+
+ if( ! target.len() )
+ {
+ INetURLObject aURL;
+ aURL.SetSmartProtocol( INET_PROT_FILE );
+ aURL.SetSmartURL( ::rtl::OUStringToOString( url, m_aEncoding ) );
+
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > xFact( m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.DataSourceFactory" ) ), UNO_QUERY );
+ if ( xFact.is() )
+ {
+ Sequence < Any > aArgs(1);
+ ::rtl::OUString aUURL( aURL.GetMainURL() );
+ aArgs.getArray()[0] <<= aUURL;
+ ::rtl::OUString aProt( INetURLObject::GetScheme( aURL.GetProtocol() ) );
+ Reference< ::com::sun::star::io::XActiveDataSource > aSource( xFact->createInstanceWithArguments( aProt, aArgs ), UNO_QUERY );
+ if ( aSource.is() )
+ {
+ // the mimetype cannot be specified
+ plugin->provideNewStream( ::rtl::OUString(),
+ aSource,
+ aUURL,
+ 0, 0, sal_False );
+ }
+ }
+ return;
+ }
+
+ Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY );
+ XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( plugin );
+
+ if( xLoader.is() && pPlugin )
+ {
+ ::com::sun::star::beans::PropertyValue aValue;
+ aValue.Name = ::rtl::OUString::createFromAscii( "Referer" );
+ aValue.Value <<= pPlugin->getRefererURL();
+
+ Sequence< ::com::sun::star::beans::PropertyValue > aArgs( &aValue, 1 );
+ Reference< ::com::sun::star::lang::XComponent > xComp =
+ xLoader->loadComponentFromURL(
+ url,
+ target,
+ ::com::sun::star::frame::FrameSearchFlag::PARENT |
+ ::com::sun::star::frame::FrameSearchFlag::SELF |
+ ::com::sun::star::frame::FrameSearchFlag::CHILDREN |
+ ::com::sun::star::frame::FrameSearchFlag::SIBLINGS |
+ ::com::sun::star::frame::FrameSearchFlag::TASKS |
+ ::com::sun::star::frame::FrameSearchFlag::CREATE,
+ aArgs
+ );
+ }
+}
+
+void XPluginContext_Impl::getURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Reference< ::com::sun::star::lang::XEventListener > & listener )
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ getURL( plugin, url, target );
+ if( listener.is() )
+ listener->disposing( ::com::sun::star::lang::EventObject() );
+}
+
+::rtl::OUString XPluginContext_Impl::getUserAgent(const Reference< ::com::sun::star::plugin::XPlugin > & plugin)
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ return ::rtl::OUString::createFromAscii( "Mozilla 3.0" );
+}
+
+void XPluginContext_Impl::displayStatusText(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& message)
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+}
+
+void XPluginContext_Impl::postURL(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file)
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ Sequence< sal_Int8 > aBuf;
+
+ if( file )
+ {
+ String aFileName( (char*)buf.getConstArray(), m_aEncoding );
+ INetURLObject aFilePath( aFileName );
+ aFileName = aFilePath.PathToFileName();
+ SvFileStream aStream( aFileName, STREAM_READ );
+ if( aStream.IsOpen() )
+ {
+ int nBytes = 0;
+ aStream.Seek( STREAM_SEEK_TO_END );
+ aBuf = Sequence<sal_Int8>( nBytes = aStream.Tell() );
+ aStream.Seek( STREAM_SEEK_TO_BEGIN );
+ aStream.Read( aBuf.getArray(), nBytes );
+ aStream.Close();
+ DirEntry( aFileName ).Kill();
+ }
+ }
+
+ Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) );
+ if( ! xInst.is() )
+ return ;
+
+ Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY );
+ XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( plugin );
+ if( xLoader.is() && pPlugin )
+ {
+ ::com::sun::star::beans::PropertyValue aValues[2];
+ aValues[0].Name = ::rtl::OUString::createFromAscii( "Referer" );
+ aValues[0].Value <<= pPlugin->getRefererURL();
+
+ aValues[1].Name = ::rtl::OUString::createFromAscii( "PostString" );
+ aValues[1].Value <<= ::rtl::OStringToOUString( (char*)( file ? aBuf : buf ).getConstArray(), m_aEncoding );
+ Sequence< ::com::sun::star::beans::PropertyValue > aArgs( aValues, 2 );
+ Reference< ::com::sun::star::lang::XComponent > xComp =
+ xLoader->loadComponentFromURL(
+ url,
+ target,
+ ::com::sun::star::frame::FrameSearchFlag::PARENT |
+ ::com::sun::star::frame::FrameSearchFlag::SELF |
+ ::com::sun::star::frame::FrameSearchFlag::CHILDREN |
+ ::com::sun::star::frame::FrameSearchFlag::SIBLINGS |
+ ::com::sun::star::frame::FrameSearchFlag::TASKS |
+ ::com::sun::star::frame::FrameSearchFlag::CREATE,
+ aArgs
+ );
+ }
+}
+
+void XPluginContext_Impl::postURLNotify(const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& url, const ::rtl::OUString& target, const Sequence< sal_Int8 >& buf, sal_Bool file, const Reference< ::com::sun::star::lang::XEventListener > & listener )
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ postURL( plugin, url, target, buf, file );
+ if( listener.is() )
+ listener->disposing( ::com::sun::star::lang::EventObject() );
+}
+
+void XPluginContext_Impl::newStream( const Reference< ::com::sun::star::plugin::XPlugin > & plugin, const ::rtl::OUString& mimetype, const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source )
+ throw( ::com::sun::star::plugin::PluginException, RuntimeException )
+{
+ FileSink* pNewSink = new FileSink( m_xSMgr, plugin, mimetype, target, source );
+ pNewSink->acquire();
+}
+
+
+
+FileSink::FileSink( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr, const Reference< ::com::sun::star::plugin::XPlugin > & plugin,
+ const ::rtl::OUString& mimetype,
+ const ::rtl::OUString& target, const Reference< ::com::sun::star::io::XActiveDataSource > & source ) :
+ m_xSMgr( rSMgr ),
+ m_aMIMEType( mimetype ),
+ m_aTarget( target ),
+ m_xPlugin( plugin )
+{
+ DirEntry aEntry;
+ m_aFileName = aEntry.TempName().GetFull();
+ ::rtl::OString aFile = ::rtl::OUStringToOString( m_aFileName, gsl_getSystemTextEncoding() );
+ fp = fopen( aFile.getStr() , "wb" );
+
+ Reference< ::com::sun::star::io::XActiveDataControl > xControl( source, UNO_QUERY );
+
+ source->setOutputStream( Reference< ::com::sun::star::io::XOutputStream > ( this ) );
+ if( xControl.is() )
+ xControl->start();
+}
+
+FileSink::~FileSink()
+{
+ DirEntry aEntry( m_aFileName );
+ aEntry.Kill();
+}
+
+void FileSink::closeOutput()
+{
+ if( fp )
+ fclose( fp );
+
+ Reference< XInterface > xInst = m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) );
+ Reference< ::com::sun::star::frame::XComponentLoader > xLoader( xInst, UNO_QUERY );
+ XPlugin_Impl* pPlugin = XPluginManager_Impl::getPluginImplementation( m_xPlugin );
+
+ if( xLoader.is() && pPlugin )
+ {
+ ::com::sun::star::beans::PropertyValue aValue;
+ aValue.Name = ::rtl::OUString::createFromAscii( "Referer" );
+ aValue.Value <<= pPlugin->getRefererURL();
+
+ Sequence< ::com::sun::star::beans::PropertyValue > aArgs( &aValue, 1 );
+ Reference< ::com::sun::star::lang::XComponent > xComp =
+ xLoader->loadComponentFromURL(
+ m_aFileName,
+ m_aTarget,
+ ::com::sun::star::frame::FrameSearchFlag::PARENT |
+ ::com::sun::star::frame::FrameSearchFlag::SELF |
+ ::com::sun::star::frame::FrameSearchFlag::CHILDREN |
+ ::com::sun::star::frame::FrameSearchFlag::SIBLINGS |
+ ::com::sun::star::frame::FrameSearchFlag::TASKS |
+ ::com::sun::star::frame::FrameSearchFlag::CREATE,
+ aArgs
+ );
+ }
+ release();
+}
+
+void FileSink::writeBytes( const Sequence<sal_Int8>& Buffer )
+{
+ if( fp )
+ fwrite( Buffer.getConstArray(), 1, Buffer.getLength(), fp );
+}
+
+void FileSink::flush()
+{
+ if( fp )
+ fflush( fp );
+}
diff --git a/extensions/source/plugin/base/evtlstnr.cxx b/extensions/source/plugin/base/evtlstnr.cxx
new file mode 100644
index 000000000..0579e7c09
--- /dev/null
+++ b/extensions/source/plugin/base/evtlstnr.cxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * $RCSfile: evtlstnr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <plugin/impl.hxx>
+
+PluginEventListener::PluginEventListener( XPlugin_Impl* pPlugin,
+ const char* url,
+ const char* normurl,
+ void* notifyData ) :
+ m_pPlugin( pPlugin ),
+ m_xPlugin( pPlugin ),
+ m_pUrl( strdup( url ) ),
+ m_pNormalizedUrl( strdup( normurl ) ),
+ m_pNotifyData( notifyData )
+{
+}
+
+PluginEventListener::~PluginEventListener()
+{
+ if( m_pUrl )
+ free( m_pUrl );
+ if( m_pNormalizedUrl )
+ free( m_pNormalizedUrl );
+}
+
+void PluginEventListener::disposing( const ::com::sun::star::lang::EventObject& rEvt )
+{
+ m_pPlugin->getPluginComm()->
+ NPP_URLNotify( m_pPlugin->getNPPInstance(),
+ m_pUrl,
+ NPRES_DONE,
+ m_pNotifyData );
+}
diff --git a/extensions/source/plugin/base/makefile.mk b/extensions/source/plugin/base/makefile.mk
new file mode 100644
index 000000000..56d73938e
--- /dev/null
+++ b/extensions/source/plugin/base/makefile.mk
@@ -0,0 +1,159 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..$/..
+
+PRJNAME=plugin
+TARGET=plbase
+ENABLE_EXCEPTIONS=TRUE
+
+.INCLUDE : ..$/util$/makefile.pmk
+
+# --- Types -------------------------------------
+
+UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)
+INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+UNOTYPES=\
+ com.sun.star.awt.PosSize \
+ com.sun.star.awt.MouseButton \
+ com.sun.star.awt.FocusChangeReason \
+ com.sun.star.awt.KeyFunction \
+ com.sun.star.awt.Key \
+ com.sun.star.awt.KeyModifier \
+ com.sun.star.awt.KeyGroup \
+ com.sun.star.awt.XAdjustmentListener \
+ com.sun.star.awt.XActionListener \
+ com.sun.star.awt.XTextListener \
+ com.sun.star.awt.XSpinListener \
+ com.sun.star.awt.XItemListener \
+ com.sun.star.awt.XVclContainerListener \
+ com.sun.star.awt.XVclContainerPeer \
+ com.sun.star.awt.XVclContainer \
+ com.sun.star.awt.XVclWindowPeer \
+ com.sun.star.awt.VclWindowPeerAttribute \
+ com.sun.star.awt.XActivateListener \
+ com.sun.star.awt.XTopWindowListener \
+ com.sun.star.awt.XKeyListener \
+ com.sun.star.awt.XTopWindow \
+ com.sun.star.awt.XControl \
+ com.sun.star.awt.XControlModel \
+ com.sun.star.awt.XUnoControlContainer \
+ com.sun.star.beans.PropertyValues \
+ com.sun.star.beans.PropertyAttribute \
+ com.sun.star.beans.XPropertySet \
+ com.sun.star.beans.XMultiPropertySet \
+ com.sun.star.beans.XFastPropertySet \
+ com.sun.star.beans.XPropertyState \
+ com.sun.star.beans.XPropertyAccess \
+ com.sun.star.beans.XPropertyContainer \
+ com.sun.star.beans.XPropertyChangeListener \
+ com.sun.star.beans.XPropertyStateChangeListener \
+ com.sun.star.plugin.PluginMode \
+ com.sun.star.plugin.XPluginManager \
+ com.sun.star.io.XConnectable \
+ com.sun.star.io.XActiveDataSource \
+ com.sun.star.io.XActiveDataSink \
+ com.sun.star.io.XActiveDataControl \
+ com.sun.star.io.XDataOutputStream \
+ com.sun.star.io.XDataInputStream \
+ com.sun.star.io.XObjectInputStream \
+ com.sun.star.io.XMarkableStream \
+ com.sun.star.lang.XServiceName \
+ com.sun.star.lang.XServiceInfo \
+ com.sun.star.lang.XTypeProvider \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.loader.XImplementationLoader \
+ com.sun.star.container.XSet \
+ com.sun.star.container.XNameAccess \
+ com.sun.star.container.XIndexAccess \
+ com.sun.star.frame.XComponentLoader \
+ com.sun.star.frame.FrameSearchFlag \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.uno.XWeak
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/plctrl.obj \
+ $(SLO)$/service.obj \
+ $(SLO)$/xplugin.obj \
+ $(SLO)$/nfuncs.obj \
+ $(SLO)$/manager.obj \
+ $(SLO)$/context.obj \
+ $(SLO)$/evtlstnr.obj \
+ $(SLO)$/plcom.obj \
+ $(SLO)$/multiplx.obj \
+ $(SLO)$/plmodel.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : ..$/util$/target.pmk
diff --git a/extensions/source/plugin/base/manager.cxx b/extensions/source/plugin/base/manager.cxx
new file mode 100644
index 000000000..eda95f67b
--- /dev/null
+++ b/extensions/source/plugin/base/manager.cxx
@@ -0,0 +1,316 @@
+/*************************************************************************
+ *
+ * $RCSfile: manager.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <plugin/impl.hxx>
+#include <osl/mutex.hxx>
+#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATION_HPP_
+#include <com/sun/star/container/XEnumeration.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XELEMENTACCESS_HPP_
+#include <com/sun/star/container/XElementAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
+#include <com/sun/star/container/XIndexAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LOADER_XIMPLEMENTATIONLOADER_HPP_
+#include <com/sun/star/loader/XImplementationLoader.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LOADER_CANNOTACTIVATEFACTORYEXCEPTION_HPP_
+#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
+#endif
+
+PluginManager* PluginManager::pManager = NULL;
+
+PluginManager& PluginManager::get()
+{
+ if( ! pManager )
+ pManager = new PluginManager();
+ return *pManager;
+}
+
+void PluginManager::setServiceFactory( const Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
+{
+ PluginManager& rManager = get();
+ if( ! rManager.m_xSMgr.is() )
+ rManager.m_xSMgr = xFactory;
+}
+
+PluginManager::PluginManager()
+{
+}
+
+PluginManager::~PluginManager()
+{
+}
+
+const Sequence< ::rtl::OUString >& PluginManager::getAdditionalSearchPaths()
+{
+ static Sequence< ::rtl::OUString > aPaths;
+
+ if( ! aPaths.getLength() )
+ {
+ Reference< XInterface > xInst = get().m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Settings" ) );
+ Reference< ::com::sun::star::container::XNameAccess > xAccess( xInst, UNO_QUERY );
+ if( xAccess.is() )
+ {
+ Any aValue = xAccess->getByName( ::rtl::OUString::createFromAscii( "PathSettings" ) );
+ Reference< ::com::sun::star::beans::XPropertySet > xProp;
+ if( aValue.hasValue() )
+ aValue >>= xProp;
+ if( xProp.is() )
+ {
+ aValue = xProp->getPropertyValue( ::rtl::OUString::createFromAscii( "Plugins" ) );
+ if( aValue.getValueType().getTypeClass() == TypeClass_STRING )
+
+ {
+ ::rtl::OUString sValue;
+ aValue >>= sValue;
+ sal_Int32 nTokens = sValue.getTokenCount();
+ aPaths = Sequence< ::rtl::OUString >( nTokens );
+ while( nTokens-- )
+ aPaths.getArray()[nTokens] = sValue.getToken( nTokens );
+ }
+ else if( aValue.getValueType().equals( ::getCppuType( (Sequence< ::rtl::OUString >*)0 ) ) )
+
+ {
+ Sequence< ::rtl::OUString > aArr;
+ aValue >>= aArr;
+ sal_Int32 nGlobalTokens = 0;
+ int i = 0;
+ for( i = 0; i < aArr.getLength(); i++ )
+ nGlobalTokens += aArr.getConstArray()[i].getTokenCount();
+ aPaths = Sequence< ::rtl::OUString >( nGlobalTokens );
+ for( i = aArr.getLength()-1; i >= 0; i-- )
+ {
+ sal_Int32 nTokens = aArr.getConstArray()[i].getTokenCount();
+ while( nTokens-- )
+ aPaths.getArray()[--nGlobalTokens] =
+ aArr.getConstArray()[i].getToken( nTokens );
+ }
+ }
+ }
+ }
+ }
+
+ return aPaths;
+}
+
+//==================================================================================================
+Reference< XInterface > SAL_CALL PluginManager_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) throw( Exception )
+{
+ Reference< XInterface > xService = *new XPluginManager_Impl( rSMgr );
+ return xService;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+::rtl::OUString XPluginManager_Impl::getImplementationName() throw( )
+
+{
+ return getImplementationName_Static();
+
+}
+
+// ::com::sun::star::lang::XServiceInfo
+sal_Bool XPluginManager_Impl::supportsService(const ::rtl::OUString& ServiceName) throw( )
+{
+ 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;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+Sequence< ::rtl::OUString > XPluginManager_Impl::getSupportedServiceNames(void) throw( )
+{
+ return getSupportedServiceNames_Static();
+}
+
+// XPluginManager_Impl
+Sequence< ::rtl::OUString > XPluginManager_Impl::getSupportedServiceNames_Static(void) throw( )
+{
+ Sequence< ::rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[0] = ::rtl::OUString::createFromAscii( "com.sun.star.plugin.PluginManager" );
+ return aSNS;
+}
+
+XPluginManager_Impl::XPluginManager_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr )
+: m_xSMgr( rSMgr )
+{
+ PluginManager::setServiceFactory( rSMgr );
+}
+
+XPluginManager_Impl::~XPluginManager_Impl()
+{
+}
+
+XPlugin_Impl* XPluginManager_Impl::getXPluginFromNPP( NPP instance )
+{
+ ::std::list<XPlugin_Impl*>::iterator iter;
+ for( iter = PluginManager::get().getPlugins().begin();
+ iter != PluginManager::get().getPlugins().end(); ++iter )
+ {
+ if( (*iter)->getNPPInstance() == instance )
+ return *iter;
+ }
+
+ return NULL;
+}
+
+XPlugin_Impl* XPluginManager_Impl::getPluginImplementation( const Reference< ::com::sun::star::plugin::XPlugin >& plugin )
+{
+ ::std::list<XPlugin_Impl*>::iterator iter;
+ for( iter = PluginManager::get().getPlugins().begin();
+ iter != PluginManager::get().getPlugins().end(); ++iter )
+ {
+ if( plugin == Reference< ::com::sun::star::plugin::XPlugin >((*iter)) )
+ return *iter;
+ }
+
+ return NULL;
+}
+
+XPlugin_Impl* XPluginManager_Impl::getFirstXPlugin()
+{
+ if( PluginManager::get().getPlugins().begin() == PluginManager::get().getPlugins().end() )
+ return NULL;
+
+ return *PluginManager::get().getPlugins().begin();
+}
+
+Reference< ::com::sun::star::plugin::XPlugin > XPluginManager_Impl::createPlugin( const Reference< ::com::sun::star::plugin::XPluginContext >& acontext, INT16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const ::com::sun::star::plugin::PluginDescription& plugintype)
+ throw( RuntimeException,::com::sun::star::plugin::PluginException )
+{
+ XPlugin_Impl* pImpl = new XPlugin_Impl( m_xSMgr );
+ pImpl->setPluginContext( acontext );
+
+ PluginManager::get().getPlugins().push_back( pImpl );
+
+ pImpl->initInstance( plugintype,
+ argn,
+ argv,
+ mode );
+
+ return pImpl;
+}
+
+Reference< ::com::sun::star::plugin::XPlugin > XPluginManager_Impl::createPluginFromURL( const Reference< ::com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const Reference< ::com::sun::star::awt::XToolkit > & toolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & parent, const ::rtl::OUString& url )
+{
+ XPlugin_Impl* pImpl = new XPlugin_Impl( m_xSMgr );
+ Reference< ::com::sun::star::plugin::XPlugin > xRef = pImpl; // festhalten...
+
+ pImpl->setPluginContext( acontext );
+
+ PluginManager::get().getPlugins().push_back( pImpl );
+
+ int nDescr = -1;
+ Sequence< ::com::sun::star::plugin::PluginDescription > aDescrs = getPluginDescriptions();
+ const ::com::sun::star::plugin::PluginDescription* pDescrs = aDescrs.getConstArray();
+
+ int nPos = url.lastIndexOf( (sal_Unicode)'.' );
+ if( nPos != -1 )
+ {
+ ::rtl::OUString aExt = url.copy( nPos ).toLowerCase();
+ for( int i = 0; i < aDescrs.getLength(); i++ )
+ {
+ if( pDescrs[ i ].Extension.equalsIgnoreCase( aExt ) != STRING_NOTFOUND )
+ {
+ nDescr = i;
+ break;
+ }
+ }
+ }
+
+ pImpl->initInstance( (nDescr != -1) ? pDescrs[ nDescr ] : ::com::sun::star::plugin::PluginDescription(),
+ argn,
+ argv,
+ mode );
+
+ pImpl->createPeer( toolkit, parent );
+
+ Reference< ::com::sun::star::beans::XPropertySet > xProperty( pImpl->getModel(), UNO_QUERY );
+ if( xProperty.is() )
+ {
+ Any aAny;
+ aAny <<= url;
+ xProperty->setPropertyValue( ::rtl::OUString::createFromAscii( "URL" ), aAny );
+ }
+
+ if( ! pImpl->getPluginComm() )
+ {
+ pImpl->dispose();
+ xRef = NULL;
+ }
+
+ return xRef;
+}
+
diff --git a/extensions/source/plugin/base/multiplx.cxx b/extensions/source/plugin/base/multiplx.cxx
new file mode 100644
index 000000000..40ac19b36
--- /dev/null
+++ b/extensions/source/plugin/base/multiplx.cxx
@@ -0,0 +1,391 @@
+/*************************************************************************
+ *
+ * $RCSfile: multiplx.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <vos/diagnose.hxx>
+#include <plugin/multiplx.hxx>
+
+// ---------------------------------------------------------------------
+// class MRCListenerMultiplexerHelper
+// ---------------------------------------------------------------------
+MRCListenerMultiplexerHelper::MRCListenerMultiplexerHelper
+(
+ const Reference< ::com::sun::star::awt::XWindow > & rControl
+ , const Reference< ::com::sun::star::awt::XWindow > & rPeer
+)
+ : aListenerHolder( aMutex )
+ , xPeer( rPeer )
+ , xControl( Reference< ::com::sun::star::awt::XControl >( rControl, UNO_QUERY ) )
+{
+}
+
+
+void MRCListenerMultiplexerHelper::setPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer )
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( aMutex );
+ if( xPeer != rPeer )
+ {
+ if( xPeer.is() )
+ {
+ // get all uiks from the listener added to the peer
+ Sequence<Type> aContainedTypes = aListenerHolder.getContainedTypes();
+ const Type* pArray = aContainedTypes.getConstArray();
+ sal_Int32 nCount = aContainedTypes.getLength();
+ // loop over all listener types and remove the listeners from the peer
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ unadviseFromPeer( xPeer, pArray[i] );
+ }
+ xPeer = rPeer;
+ if( xPeer.is() )
+ {
+ // get all uiks from the listener added to the peer
+ Sequence<Type> aContainedTypes = aListenerHolder.getContainedTypes();
+ const Type * pArray = aContainedTypes.getConstArray();
+ sal_Int32 nCount = aContainedTypes.getLength();
+ // loop over all listener types and add the listeners to the peer
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ adviseToPeer( xPeer, pArray[i] );
+ }
+ }
+}
+
+// MRCListenerMultiplexerHelper
+void MRCListenerMultiplexerHelper::disposeAndClear()
+{
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = xControl;
+ aListenerHolder.disposeAndClear( aEvt );
+}
+
+// MRCListenerMultiplexerHelper
+void MRCListenerMultiplexerHelper::adviseToPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type )
+{
+ // add a listener to the source (peer)
+ if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0) )
+ rPeer->addWindowListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0) )
+ rPeer->addKeyListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0) )
+ rPeer->addFocusListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0) )
+ rPeer->addMouseListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0) )
+ rPeer->addMouseMotionListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0) )
+ rPeer->addPaintListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XTopWindowListener >*)0) )
+ {
+ Reference< ::com::sun::star::awt::XTopWindow > xTop( rPeer, UNO_QUERY );
+ if( xTop.is() )
+ xTop->addTopWindowListener( this );
+ }
+ else
+ {
+ VOS_ENSHURE( sal_False, "unknown listener" );
+ }
+}
+
+// MRCListenerMultiplexerHelper
+void MRCListenerMultiplexerHelper::unadviseFromPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type )
+{
+ // the last listener is removed, remove the listener from the source (peer)
+ if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0) )
+ rPeer->removeWindowListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0) )
+ rPeer->removeKeyListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0) )
+ rPeer->removeFocusListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0) )
+ rPeer->removeMouseListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0) )
+ rPeer->removeMouseMotionListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0) )
+ rPeer->removePaintListener( this );
+ else if( type == ::getCppuType((const Reference< ::com::sun::star::awt::XTopWindowListener >*)0) )
+ {
+ Reference< ::com::sun::star::awt::XTopWindow > xTop( rPeer, UNO_QUERY );
+ if( xTop.is() )
+ xTop->removeTopWindowListener( this );
+ }
+ else
+ {
+ VOS_ENSHURE( sal_False, "unknown listener" );
+ }
+}
+
+// MRCListenerMultiplexerHelper
+void MRCListenerMultiplexerHelper::advise( const Type & type, const Reference< XInterface > & listener)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( aMutex );
+ if( 1 == aListenerHolder.addInterface( type, listener ) )
+ {
+ // the first listener is added
+ if( xPeer.is() )
+ adviseToPeer( xPeer, type );
+ }
+}
+
+// MRCListenerMultiplexerHelper
+void MRCListenerMultiplexerHelper::unadvise(const Type & type, const Reference< XInterface > & listener)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( aMutex );
+ ::cppu::OInterfaceContainerHelper * pCont = aListenerHolder.getContainer( type );
+ if( pCont )
+ {
+ if( 0 == pCont->removeInterface( listener ) && xPeer.is() )
+ // the last listener is removed
+ unadviseFromPeer( xPeer, type );
+ }
+}
+
+// ::com::sun::star::lang::XEventListener
+void MRCListenerMultiplexerHelper::disposing(const ::com::sun::star::lang::EventObject& )
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( aMutex );
+ // peer is disposed, clear the reference
+ xPeer = Reference< ::com::sun::star::awt::XWindow > ();
+}
+
+#define MULTIPLEX( InterfaceName, MethodName, EventName ) \
+::cppu::OInterfaceContainerHelper * pCont; \
+pCont = aListenerHolder.getContainer( ::getCppuType((const Reference< InterfaceName >*)0) ); \
+if( pCont ) \
+{ \
+ ::cppu::OInterfaceIteratorHelper aIt( *pCont ); \
+ EventName aEvt = e; \
+ /* Remark: The control is the event source not the peer. We must change */ \
+ /* the source of the event */ \
+ aEvt.Source = xControl;\
+ /*.is the control not destroyed */ \
+ if( aEvt.Source.is() ) \
+ { \
+ if( aIt.hasMoreElements() ) \
+ { \
+ InterfaceName * pListener = (InterfaceName *)aIt.next(); \
+ try \
+ { \
+ pListener->MethodName( aEvt ); \
+ } \
+ catch( RuntimeException& ) \
+ { \
+ /* ignore all usr system exceptions from the listener */ \
+ } \
+ } \
+ } \
+}
+
+// ::com::sun::star::awt::XFocusListener
+void MRCListenerMultiplexerHelper::focusGained(const ::com::sun::star::awt::FocusEvent& e)
+{
+/*
+ OInterfaceContainerHelper * pCont = aListenerHolder.getContainer( ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0) );
+ if( pCont )
+ {
+ OInterfaceIteratorHelper aIt( *pCont );
+ ::com::sun::star::awt::FocusEvent aEvt = e;
+ // Reamark: The control is the event source not the peer. We must change
+ // the source of the event
+ xControl.queryHardRef( ((XInterface*)NULL)->getSmartUik(), aEvt.Source );
+ //.is the control not destroyed
+ if( aEvt.Source.is() )
+ {
+ if( aIt.hasMoreElements() )
+ {
+ ::com::sun::star::awt::XFocusListener * pListener = (::com::sun::star::awt::XFocusListener *)aIt.next();
+ TRY
+ {
+ pListener->focusGained( aEvt );
+ }
+ CATCH( RuntimeException, e )
+ {
+ // ignore all usr system exceptions from the listener
+ }
+ END_CATCH;
+ }
+ }
+ }
+*/
+ MULTIPLEX( ::com::sun::star::awt::XFocusListener, focusGained, ::com::sun::star::awt::FocusEvent )
+}
+
+// ::com::sun::star::awt::XFocusListener
+void MRCListenerMultiplexerHelper::focusLost(const ::com::sun::star::awt::FocusEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XFocusListener, focusLost, ::com::sun::star::awt::FocusEvent )
+}
+
+// ::com::sun::star::awt::XWindowListener
+void MRCListenerMultiplexerHelper::windowResized(const ::com::sun::star::awt::WindowEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowResized, ::com::sun::star::awt::WindowEvent )
+}
+
+// ::com::sun::star::awt::XWindowListener
+void MRCListenerMultiplexerHelper::windowMoved(const ::com::sun::star::awt::WindowEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowMoved, ::com::sun::star::awt::WindowEvent )
+}
+
+// ::com::sun::star::awt::XWindowListener
+void MRCListenerMultiplexerHelper::windowShown(const ::com::sun::star::lang::EventObject& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowShown, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XWindowListener
+void MRCListenerMultiplexerHelper::windowHidden(const ::com::sun::star::lang::EventObject& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XWindowListener, windowHidden, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XKeyListener
+void MRCListenerMultiplexerHelper::keyPressed(const ::com::sun::star::awt::KeyEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XKeyListener, keyPressed, ::com::sun::star::awt::KeyEvent )
+}
+
+// ::com::sun::star::awt::XKeyListener
+void MRCListenerMultiplexerHelper::keyReleased(const ::com::sun::star::awt::KeyEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XKeyListener, keyReleased, ::com::sun::star::awt::KeyEvent )
+}
+
+// ::com::sun::star::awt::XMouseListener
+void MRCListenerMultiplexerHelper::mousePressed(const ::com::sun::star::awt::MouseEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XMouseListener, mousePressed, ::com::sun::star::awt::MouseEvent )
+}
+
+// ::com::sun::star::awt::XMouseListener
+void MRCListenerMultiplexerHelper::mouseReleased(const ::com::sun::star::awt::MouseEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XMouseListener, mouseReleased, ::com::sun::star::awt::MouseEvent )
+}
+
+// ::com::sun::star::awt::XMouseListener
+void MRCListenerMultiplexerHelper::mouseEntered(const ::com::sun::star::awt::MouseEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XMouseListener, mouseEntered, ::com::sun::star::awt::MouseEvent )
+}
+
+// ::com::sun::star::awt::XMouseListener
+void MRCListenerMultiplexerHelper::mouseExited(const ::com::sun::star::awt::MouseEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XMouseListener, mouseExited, ::com::sun::star::awt::MouseEvent )
+}
+
+// ::com::sun::star::awt::XMouseMotionListener
+void MRCListenerMultiplexerHelper::mouseDragged(const ::com::sun::star::awt::MouseEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XMouseMotionListener, mouseDragged, ::com::sun::star::awt::MouseEvent )
+}
+
+// ::com::sun::star::awt::XMouseMotionListener
+void MRCListenerMultiplexerHelper::mouseMoved(const ::com::sun::star::awt::MouseEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XMouseMotionListener, mouseMoved, ::com::sun::star::awt::MouseEvent )
+}
+
+// ::com::sun::star::awt::XPaintListener
+void MRCListenerMultiplexerHelper::windowPaint(const ::com::sun::star::awt::PaintEvent& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XPaintListener, windowPaint, ::com::sun::star::awt::PaintEvent )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowOpened(const ::com::sun::star::lang::EventObject& e)
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowOpened, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowClosing( const ::com::sun::star::lang::EventObject& e )
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowClosing, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowClosed( const ::com::sun::star::lang::EventObject& e )
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowClosed, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowMinimized( const ::com::sun::star::lang::EventObject& e )
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowMinimized, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowNormalized( const ::com::sun::star::lang::EventObject& e )
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowNormalized, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowActivated( const ::com::sun::star::lang::EventObject& e )
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowActivated, ::com::sun::star::lang::EventObject )
+}
+
+// ::com::sun::star::awt::XTopWindowListener
+void MRCListenerMultiplexerHelper::windowDeactivated( const ::com::sun::star::lang::EventObject& e )
+{
+ MULTIPLEX( ::com::sun::star::awt::XTopWindowListener, windowDeactivated, ::com::sun::star::lang::EventObject )
+}
diff --git a/extensions/source/plugin/base/nfuncs.cxx b/extensions/source/plugin/base/nfuncs.cxx
new file mode 100644
index 000000000..c732147a9
--- /dev/null
+++ b/extensions/source/plugin/base/nfuncs.cxx
@@ -0,0 +1,576 @@
+/*************************************************************************
+ *
+ * $RCSfile: nfuncs.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <stl/list>
+
+#ifdef USE_NAMESPACE
+using namespace std;
+#endif
+
+
+#include <plugin/impl.hxx>
+
+// #define TRACE(x) DBG_ERROR( (x) )
+#define TRACE(x)
+
+
+NPNetscapeFuncs aNPNFuncs =
+{
+ sizeof( NPNetscapeFuncs ),
+ (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR,
+ NPN_GetURL,
+ NPN_PostURL,
+ NPN_RequestRead,
+ NPN_NewStream,
+ NPN_Write,
+ NPN_DestroyStream,
+ NPN_Status,
+ NPN_UserAgent,
+ NPN_MemAlloc,
+ NPN_MemFree,
+ NPN_MemFlush,
+ NPN_ReloadPlugins,
+ NPN_GetJavaEnv,
+ NPN_GetJavaPeer,
+ NPN_GetURLNotify,
+ NPN_PostURLNotify,
+ NPN_GetValue,
+ NPN_SetValue,
+ NPN_InvalidateRect,
+ NPN_InvalidateRegion,
+ NPN_ForceRedraw
+};
+
+static ::rtl::OString normalizeURL( XPlugin_Impl* plugin, const ::rtl::OString& url )
+{
+ ::rtl::OString aLoadURL;
+ if( url.indexOf( ":/" ) == -1 )
+ {
+ aLoadURL = ::rtl::OUStringToOString( plugin->getCreationURL(), plugin->getTextEncoding() );
+ int nPos;
+ if( ( nPos = aLoadURL.indexOf( "://" ) ) != -1 )
+ {
+ if( url.getLength() && url.getStr()[ 0 ] == '/' || url.indexOf( '/' ) != -1 )
+ {
+ // this means same server but new path
+ nPos = aLoadURL.indexOf( '/', nPos+3 );
+
+ if( nPos != -1 )
+ aLoadURL = aLoadURL.copy( 0, url.getStr()[0] == '/' ? nPos : nPos+1 );
+ }
+ else
+ {
+ // same server but new file
+ nPos = aLoadURL.lastIndexOf( '/' );
+ aLoadURL = aLoadURL.copy( 0, nPos+1 );
+ }
+ aLoadURL += url;
+ }
+ else
+ aLoadURL = url;
+ }
+ else
+ aLoadURL = url;
+
+ return aLoadURL;
+}
+
+
+extern "C" {
+
+ void* SAL_CALL NP_LOADDS NPN_MemAlloc( uint32 nBytes )
+ {
+ TRACE( "NPN_MemAlloc" );
+ void* pMem = malloc( nBytes );
+ return pMem;
+ }
+
+ void SAL_CALL NP_LOADDS NPN_MemFree( void* pMem )
+ {
+ TRACE( "NPN_MemFree" );
+ free( pMem );
+ }
+
+ uint32 SAL_CALL NP_LOADDS NPN_MemFlush( uint32 nSize )
+ {
+ TRACE( "NPN_MemFlush" );
+ return 0;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_DestroyStream( NPP instance, NPStream* stream, NPError reason )
+ {
+ TRACE( "NPN_DestroyStream" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ PluginStream* pStream = pImpl->getStreamFromNPStream( stream );
+ if( pStream )
+ delete pStream;
+
+ return NPERR_NO_ERROR;
+ }
+
+ const JRIEnvInterface** SAL_CALL NP_LOADDS NPN_GetJavaEnv()
+ {
+ TRACE( "NPN_GetJavaEnv" );
+ // no java in this program
+ return NULL;
+ }
+
+ void* SAL_CALL NP_LOADDS NPN_GetJavaPeer( NPP instance )
+ {
+ TRACE( "NPN_GetJavaPeer" );
+ return NULL;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_GetURL( NPP instance, const char* url, const char* window )
+ {
+ TRACE( "NPN_GetURL" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ ::rtl::OString aLoadURL = normalizeURL( pImpl, url );
+ try
+ {
+ pImpl->enterPluginCallback();
+ pImpl->getPluginContext()->
+ getURL( pImpl,
+ ::rtl::OStringToOUString( aLoadURL, pImpl->getTextEncoding() ),
+ ::rtl::OStringToOUString( window, pImpl->getTextEncoding() )
+ );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& e )
+ {
+ pImpl->leavePluginCallback();
+ return e.ErrorCode;
+ }
+
+ return NPERR_NO_ERROR;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_GetURLNotify( NPP instance, const char* url, const char* target,
+ void* notifyData )
+ {
+ TRACE( "NPN_GetURLNotify" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ ::rtl::OString aLoadURL = normalizeURL( pImpl, url );
+ PluginEventListener* pListener =
+ new PluginEventListener( pImpl, url, aLoadURL.getStr(), notifyData );
+ if( ! target || ! *target )
+ {
+ // stream will be fed back to plugin,
+ // notify immediately after destruction of stream
+ pImpl->addPluginEventListener( pListener );
+ pListener = NULL;
+ }
+
+ try
+ {
+ pImpl->enterPluginCallback();
+ pImpl->getPluginContext()->
+ getURLNotify( pImpl,
+ ::rtl::OStringToOUString( aLoadURL, pImpl->getTextEncoding() ),
+ ::rtl::OStringToOUString( target, pImpl->getTextEncoding() ),
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > ( pListener ) );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& e )
+ {
+ pImpl->leavePluginCallback();
+ return e.ErrorCode;
+ }
+
+ return NPERR_NO_ERROR;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_NewStream( NPP instance, NPMIMEType type, const char* target,
+ NPStream** stream )
+ // stream is a return value
+ {
+ TRACE( "NPN_NewStream" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ PluginOutputStream* pStream = new PluginOutputStream( pImpl,
+ "", 0, 0 );
+ *stream = pStream->getStream();
+
+ try
+ {
+ pImpl->enterPluginCallback();
+ pImpl->getPluginContext()->
+ newStream(
+ pImpl,
+ ::rtl::OStringToOUString( type, pImpl->getTextEncoding () ),
+ ::rtl::OStringToOUString( target, pImpl->getTextEncoding() ),
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XActiveDataSource > ( pStream->getOutputStream(), UNO_QUERY )
+ );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& e )
+ {
+ pImpl->leavePluginCallback();
+ return e.ErrorCode;
+ }
+
+ return NPERR_NO_ERROR;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_PostURLNotify( NPP instance, const char* url, const char* target, uint32 len, const char* buf, NPBool file, void* notifyData )
+ {
+ TRACE( "NPN_PostURLNotify" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ ::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buf, len );
+
+ ::rtl::OString aPostURL = normalizeURL( pImpl, url );
+ PluginEventListener* pListener =
+ new PluginEventListener( pImpl, url, aPostURL.getStr(), notifyData );
+
+ if( ! target || ! *target )
+ {
+ // stream will be fed back to plugin,
+ // notify immediately after destruction of stream
+ pImpl->addPluginEventListener( pListener );
+ pListener = NULL;
+ }
+
+ try
+ {
+ pImpl->enterPluginCallback();
+ pImpl->getPluginContext()->
+ postURLNotify( pImpl,
+ ::rtl::OStringToOUString( aPostURL, pImpl->getTextEncoding() ),
+ ::rtl::OStringToOUString( target, pImpl->getTextEncoding() ),
+ Bytes,
+ file,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > ( pListener ) );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& e )
+ {
+ pImpl->leavePluginCallback();
+ return e.ErrorCode;
+ }
+
+ return NPERR_NO_ERROR;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_PostURL( NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file )
+ {
+ TRACE( "NPN_PostURL" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ ::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buf, len );
+ ::rtl::OString aPostURL = normalizeURL( pImpl, url );
+ try
+ {
+ pImpl->enterPluginCallback();
+ pImpl->getPluginContext()->
+ postURL( pImpl,
+ ::rtl::OStringToOUString( aPostURL, pImpl->getTextEncoding() ),
+ ::rtl::OStringToOUString( window, pImpl->getTextEncoding () ),
+ Bytes,
+ file );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& e )
+ {
+ pImpl->leavePluginCallback();
+ return e.ErrorCode;
+ }
+
+ return NPERR_NO_ERROR;
+ }
+
+ NPError SAL_CALL NP_LOADDS NPN_RequestRead( NPStream* stream, NPByteRange* rangeList )
+ {
+ TRACE( "NPN_RequestRead" );
+ if( ! rangeList )
+ return NPERR_NO_ERROR;
+
+ ::std::list<XPlugin_Impl*>& rList = PluginManager::get().getPlugins();
+ ::std::list<XPlugin_Impl*>::iterator iter;
+ XPlugin_Impl* pPlugin = NULL;
+ PluginStream* pStream = NULL;
+ for( iter = rList.begin(); iter!= rList.end(); ++iter )
+ if( ( pStream = (*iter)->getStreamFromNPStream( stream ) ) )
+ {
+ pPlugin = *iter;
+ break;
+ }
+ if( ! pPlugin )
+ return NPERR_INVALID_INSTANCE_ERROR;
+ if( ! pStream || pStream->getStreamType() != InputStream )
+ return NPERR_FILE_NOT_FOUND;
+
+ PluginInputStream* pInputStream = (PluginInputStream*)pStream;
+ sal_Int8* pBytes = NULL;
+ int nBytes = 0;
+ pPlugin->enterPluginCallback();
+ while( rangeList )
+ {
+ if( pBytes && nBytes < rangeList->length )
+ {
+ delete pBytes;
+ pBytes = NULL;
+ }
+ if( ! pBytes )
+ pBytes = new sal_Int8[ nBytes = rangeList->length ];
+ int nRead =
+ pInputStream->read( rangeList->offset, pBytes, rangeList->length );
+ int nPos = 0;
+ int nNow;
+ do
+ {
+ nNow = pPlugin->getPluginComm()->
+ NPP_WriteReady( pPlugin->getNPPInstance(),
+ stream );
+ pPlugin->getPluginComm()->
+ NPP_Write( pPlugin->getNPPInstance(),
+ stream,
+ rangeList->offset + nPos,
+ nNow,
+ pBytes+nPos );
+ nPos += nNow;
+ nRead -= nNow;
+ } while( nRead > 0 && nNow );
+ rangeList = rangeList->next;
+ }
+ pPlugin->leavePluginCallback();
+
+ return NPERR_NO_ERROR;
+ }
+
+ void SAL_CALL NP_LOADDS NPN_Status( NPP instance, const char* message )
+ {
+ TRACE( "NPN_Status" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return;
+
+ try
+ {
+ pImpl->enterPluginCallback();
+ pImpl->getPluginContext()->
+ displayStatusText( pImpl, ::rtl::OStringToOUString( message, pImpl->getTextEncoding() ) );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& )
+ {
+ pImpl->leavePluginCallback();
+ return;
+ }
+ }
+
+ const char* SAL_CALL NP_LOADDS NPN_UserAgent( NPP instance )
+ {
+ TRACE( "NPN_UserAgent" );
+ static char* pAgent = strdup( "Mozilla" );
+
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return pAgent;
+
+ ::rtl::OUString UserAgent;
+ try
+ {
+ pImpl->enterPluginCallback();
+ UserAgent = pImpl->getPluginContext()->
+ getUserAgent( pImpl );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& )
+ {
+ pImpl->leavePluginCallback();
+ return pAgent;
+ }
+
+ if( pAgent )
+ free( pAgent );
+ pAgent = strdup( ::rtl::OUStringToOString( UserAgent, pImpl->getTextEncoding() ).getStr() );
+
+ return pAgent;
+ }
+
+void SAL_CALL NP_LOADDS NPN_Version( int* major, int* minor, int* net_major, int* net_minor )
+{
+ TRACE( "NPN_Version" );
+ *major = 4;
+ *minor = 0;
+ *net_major = 4;
+ *net_minor = 5;
+}
+
+int32 SAL_CALL NP_LOADDS NPN_Write( NPP instance, NPStream* stream, int32 len,
+ void* buffer )
+{
+ TRACE( "NPN_Write" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+ if( ! pImpl )
+ return 0;
+
+ PluginStream* pStream = pImpl->getStreamFromNPStream( stream );
+ if( ! pStream || pStream->getStreamType() != OutputStream )
+ return 0;
+
+ pImpl->enterPluginCallback();
+ ::com::sun::star::uno::Sequence<sal_Int8> Bytes( (sal_Int8*)buffer, len );
+ ((PluginOutputStream*)pStream)->getOutputStream()->writeBytes( Bytes );
+ pImpl->leavePluginCallback();
+
+ return len;
+}
+
+
+NPError SAL_CALL NP_LOADDS NPN_GetValue( NPP instance, NPNVariable variable, void* value )
+{
+ TRACE( "NPN_GetValue" );
+ XPlugin_Impl* pImpl = XPluginManager_Impl::getXPluginFromNPP( instance );
+
+#ifdef UNX
+ // some special unix variables
+ XPlugin_Impl* pInstance = pImpl ? pImpl : XPluginManager_Impl::getFirstXPlugin();
+ if( ! pInstance )
+ return NULL;
+
+ switch( variable )
+ {
+ case NPNVxDisplay:
+ *((Display**)value) = pInstance->getAppDisplay();
+#ifdef DEBUG
+ fprintf( stderr, "NPN_GetValue of display\n" );
+#endif
+ return NPERR_NO_ERROR;
+ break;
+ case NPNVxtAppContext:
+ *((XtAppContext*)value) = pInstance->getAppContext();
+#ifdef DEBUG
+ fprintf( stderr, "NPN_GetValue of application context\n" );
+#endif
+ return NPERR_NO_ERROR;
+ }
+#endif
+
+ if( ! pImpl )
+ return 0;
+
+ ::rtl::OUString aValue;
+ try
+ {
+ pImpl->enterPluginCallback();
+ aValue = pImpl->getPluginContext()->
+ getValue( pImpl, (::com::sun::star::plugin::PluginVariable)variable );
+ pImpl->leavePluginCallback();
+ }
+ catch( ::com::sun::star::plugin::PluginException& e )
+ {
+ pImpl->leavePluginCallback();
+ return e.ErrorCode;
+ }
+
+ return NPERR_NO_ERROR;
+}
+
+void SAL_CALL NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages)
+{
+ TRACE( "NPN_ReloadPlugins" );
+}
+
+
+NPError SAL_CALL NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable,
+ void *value)
+{
+ TRACE( "NPN_SetValue" );
+ return 0;
+}
+
+void SAL_CALL NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
+{
+ TRACE( "NPN_InvalidateRect" );
+}
+
+void SAL_CALL NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
+{
+ TRACE( "NPN_InvalidateRegion" );
+}
+
+void SAL_CALL NP_LOADDS NPN_ForceRedraw(NPP instance)
+{
+ TRACE( "NPN_ForceRedraw" );
+}
+
+}
diff --git a/extensions/source/plugin/base/plcom.cxx b/extensions/source/plugin/base/plcom.cxx
new file mode 100644
index 000000000..98a160237
--- /dev/null
+++ b/extensions/source/plugin/base/plcom.cxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * $RCSfile: plcom.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef SOLARIS
+#include <limits>
+#endif
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <tools/fsys.hxx>
+#include <plugin/impl.hxx>
+
+PluginComm::PluginComm( const ::rtl::OString& rLibName ) :
+ m_nRefCount( 0 ),
+ m_aLibName( rLibName )
+{
+ PluginManager::get().getPluginComms().push_back( this );
+}
+
+PluginComm::~PluginComm()
+{
+ PluginManager::get().getPluginComms().remove( this );
+ while( m_aFilesToDelete.size() )
+ {
+ String aFile = m_aFilesToDelete.front();
+ m_aFilesToDelete.pop_front();
+ DirEntry aEntry( aFile );
+ aEntry.Kill();
+ }
+}
diff --git a/extensions/source/plugin/base/plctrl.cxx b/extensions/source/plugin/base/plctrl.cxx
new file mode 100644
index 000000000..bf9081ea3
--- /dev/null
+++ b/extensions/source/plugin/base/plctrl.cxx
@@ -0,0 +1,373 @@
+/*************************************************************************
+ *
+ * $RCSfile: plctrl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _COM_SUN_STAR_AWT_XADJUSTMENTLISTENER_HPP_
+#include <com/sun/star/awt/XAdjustmentListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XACTIONLISTENER_HPP_
+#include <com/sun/star/awt/XActionListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTEXTLISTENER_HPP_
+#include <com/sun/star/awt/XTextListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XSPINLISTENER_HPP_
+#include <com/sun/star/awt/XSpinListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XITEMLISTENER_HPP_
+#include <com/sun/star/awt/XItemListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERLISTENER_HPP_
+#include <com/sun/star/awt/XVclContainerListener.hpp>
+#endif
+
+#include <plugin/plctrl.hxx>
+#include <vcl/syschild.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+
+//--------------------------------------------------------------------------------------------------
+PluginControl_Impl::PluginControl_Impl() :
+ _pMultiplexer( NULL )
+ , _bVisible( sal_False )
+ , _bInDesignMode( sal_False )
+ , _bEnable( sal_True )
+ , _nX( 0 )
+ , _nY( 0 )
+ , _nWidth( 100 )
+ , _nHeight( 100 )
+ , _nFlags( WINDOW_POSSIZE_ALL )
+{
+}
+
+//--------------------------------------------------------------------------------------------------
+PluginControl_Impl::~PluginControl_Impl()
+{
+}
+
+MRCListenerMultiplexerHelper* PluginControl_Impl::getMultiplexer()
+{
+ if( ! _pMultiplexer )
+ _pMultiplexer = new MRCListenerMultiplexerHelper( this, _xPeerWindow );
+ return _pMultiplexer;
+}
+//==================================================================================================
+Reference< XInterface > PluginControl_Impl_NewInstance()
+{
+ return (::cppu::OWeakObject*)new PluginControl_Impl();
+}
+
+//--------------------------------------------------------------------------------------------------
+
+void PluginControl_Impl::addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l )
+ throw( RuntimeException )
+{
+ _aDisposeListeners.push_back( l );
+}
+
+//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
+void PluginControl_Impl::removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l )
+ throw( RuntimeException )
+{
+ _aDisposeListeners.remove( l );
+}
+
+//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
+void PluginControl_Impl::dispose(void)
+ throw( RuntimeException )
+{
+ // send disposing events
+ ::com::sun::star::lang::EventObject aEvt;
+ if( getMultiplexer() )
+ getMultiplexer()->disposeAndClear();
+
+ // release context
+ _xContext = Reference< XInterface > ();
+ releasePeer();
+}
+
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags )
+ throw( RuntimeException )
+{
+ _nX = nX_ >=0 ? nX_ : 0;
+ _nY = nY_ >=0 ? nY_ : 0;
+ _nWidth = nWidth_ >=0 ? nWidth_ : 0;
+ _nHeight = nHeight_ >=0 ? nHeight_ : 0;
+ _nFlags = nFlags;
+
+ if (_xPeerWindow.is())
+ _xPeerWindow->setPosSize( _nX, _nY, _nWidth, _nHeight, nFlags );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+::com::sun::star::awt::Rectangle PluginControl_Impl::getPosSize(void)
+ throw( RuntimeException )
+{
+ return _xPeerWindow->getPosSize();
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::setVisible( sal_Bool bVisible )
+ throw( RuntimeException )
+{
+ _bVisible = bVisible;
+ if (_xPeerWindow.is())
+ _xPeerWindow->setVisible( _bVisible && !_bInDesignMode );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::setEnable( sal_Bool bEnable )
+ throw( RuntimeException )
+{
+ _bEnable = bEnable;
+ if (_xPeerWindow.is())
+ _xPeerWindow->setEnable( _bEnable );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::setFocus(void) throw( RuntimeException )
+{
+ if (_xPeerWindow.is())
+ _xPeerWindow->setFocus();
+}
+
+
+//--------------------------------------------------------------------------------------------------
+void PluginControl_Impl::releasePeer()
+{
+ if (_xPeer.is())
+ {
+ _xParentWindow->removeFocusListener( this );
+ _xPeerWindow->dispose();
+ _pSysChild = NULL;
+ _xPeerWindow = Reference< ::com::sun::star::awt::XWindow > ();
+ _xPeer = Reference< ::com::sun::star::awt::XWindowPeer > ();
+ getMultiplexer()->setPeer( Reference< ::com::sun::star::awt::XWindow > () );
+ }
+}
+
+//---- ::com::sun::star::awt::XControl ------------------------------------------------------------------------------------
+void PluginControl_Impl::createPeer( const Reference< ::com::sun::star::awt::XToolkit > & xToolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & xParentPeer )
+ throw( RuntimeException )
+{
+ if (_xPeer.is())
+ {
+ DBG_ERROR( "### Peer is already set!" );
+ return;
+ }
+
+ _xParentPeer = xParentPeer;
+ _xParentWindow = Reference< ::com::sun::star::awt::XWindow > ( xParentPeer, UNO_QUERY );
+ DBG_ASSERT( _xParentWindow.is(), "### no parent peer window!" );
+
+ Window* pImpl = VCLUnoHelper::GetWindow( xParentPeer );
+ if (pImpl)
+ {
+ _pSysChild = new SystemChildWindow( pImpl, WB_CLIPCHILDREN );
+// _pSysChild->Show();
+ if (pImpl->HasFocus())
+ _pSysChild->GrabFocus();
+
+ // get peer
+ _xPeer = Reference< ::com::sun::star::awt::XWindowPeer > ( _pSysChild->GetComponentInterface() );
+ _xPeerWindow = Reference< ::com::sun::star::awt::XWindow > ( _xPeer, UNO_QUERY );
+ // !_BOTH_ MUST BE VALID!
+ DBG_ASSERT( (_xPeer.is() && _xPeerWindow.is()), "### no peer!" );
+
+ _xParentWindow->addFocusListener( this );
+ _xPeerWindow->setPosSize( _nX, _nY, _nWidth, _nHeight, _nFlags );
+ _xPeerWindow->setEnable( _bEnable );
+ _xPeerWindow->setVisible( _bVisible && !_bInDesignMode );
+ }
+ else
+ {
+ DBG_ERROR( "### cannot get implementation of parent peer!" );
+ }
+
+ getMultiplexer()->setPeer( _xPeerWindow );
+}
+
+//---- ::com::sun::star::awt::XControl ------------------------------------------------------------------------------------
+void PluginControl_Impl::setDesignMode( sal_Bool bOn )
+ throw( RuntimeException )
+{
+ _bInDesignMode = bOn;
+ if (_xPeerWindow.is())
+ _xPeerWindow->setVisible( _bVisible && !_bInDesignMode );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::addPaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::removePaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XPaintListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::addWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::removeWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XWindowListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::addFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::removeFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XFocusListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::addKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::removeKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XKeyListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::addMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::removeMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::addMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->advise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0), l );
+}
+
+//---- ::com::sun::star::awt::XWindow -------------------------------------------------------------------------------------
+void PluginControl_Impl::removeMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l )
+ throw( RuntimeException )
+{
+ getMultiplexer()->unadvise( ::getCppuType((const Reference< ::com::sun::star::awt::XMouseMotionListener >*)0), l );
+}
+
+
+//---- ::com::sun::star::awt::XView ---------------------------------------------------------------------------------------
+void PluginControl_Impl::draw( sal_Int32 x, sal_Int32 y )
+ throw( RuntimeException )
+{
+ // has to be done by further implementation of control
+}
+
+//---- ::com::sun::star::awt::XView ---------------------------------------------------------------------------------------
+void PluginControl_Impl::setZoom( float ZoomX, float ZoomY )
+ throw( RuntimeException )
+{
+ // has to be done by further implementation of control
+}
+
+//---- ::com::sun::star::lang::XEventListener ------------------------------------------------------------------------------
+void PluginControl_Impl::disposing( const ::com::sun::star::lang::EventObject & rSource )
+ throw( RuntimeException )
+{
+}
+//---- ::com::sun::star::awt::XFocusListener ------------------------------------------------------------------------------
+void PluginControl_Impl::focusGained( const ::com::sun::star::awt::FocusEvent & rEvt )
+ throw( RuntimeException )
+{
+ if (_xPeerWindow.is())
+ _xPeerWindow->setFocus();
+}
+//---- ::com::sun::star::awt::XFocusListener ------------------------------------------------------------------------------
+void PluginControl_Impl::focusLost( const ::com::sun::star::awt::FocusEvent & rEvt )
+ throw( RuntimeException )
+{
+}
+
diff --git a/extensions/source/plugin/base/plmodel.cxx b/extensions/source/plugin/base/plmodel.cxx
new file mode 100644
index 000000000..28002ffbe
--- /dev/null
+++ b/extensions/source/plugin/base/plmodel.cxx
@@ -0,0 +1,243 @@
+/*************************************************************************
+ *
+ * $RCSfile: plmodel.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <plugin/model.hxx>
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+
+using namespace com::sun::star::uno;
+
+//==================================================================================================
+Reference< XInterface > SAL_CALL PluginModel_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & ) throw( Exception )
+{
+ Reference< XInterface > xService = *new PluginModel();
+ return xService;
+}
+
+Any PluginModel::queryAggregation( const Type& type )
+{
+ Any aRet( ::cppu::queryInterface( type,
+ static_cast< ::com::sun::star::lang::XComponent* >(this),
+ static_cast< ::com::sun::star::io::XPersistObject* >(this ),
+ static_cast< ::com::sun::star::awt::XControlModel* >(this),
+ static_cast< ::com::sun::star::beans::XPropertySet* >(this),
+ static_cast< ::com::sun::star::beans::XMultiPropertySet* >(this),
+ static_cast< ::com::sun::star::beans::XFastPropertySet* >(this)
+ ) );
+ return aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( type );
+}
+
+
+// ::com::sun::star::lang::XServiceInfo
+::rtl::OUString PluginModel::getImplementationName() throw( )
+
+{
+ return getImplementationName_Static();
+}
+
+// ::com::sun::star::lang::XServiceInfo
+sal_Bool PluginModel::supportsService(const ::rtl::OUString& ServiceName) throw( )
+{
+ 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;
+}
+
+// ::com::sun::star::lang::XServiceInfo
+Sequence< ::rtl::OUString > PluginModel::getSupportedServiceNames(void) throw( )
+{
+ return getSupportedServiceNames_Static();
+}
+
+// XPluginManager_Impl
+Sequence< ::rtl::OUString > PluginModel::getSupportedServiceNames_Static(void) throw( )
+{
+ Sequence< ::rtl::OUString > aSNS( 1 );
+ aSNS.getArray()[0] = ::rtl::OUString::createFromAscii( "com.sun.star.plugin.PluginModel" );
+ return aSNS;
+}
+
+
+static char* aCreationURL = "URL";
+
+static ::osl::Mutex aPropertyMutex;
+
+static ::com::sun::star::beans::Property aProps[] =
+{
+ ::com::sun::star::beans::Property(
+ ::rtl::OUString::createFromAscii( aCreationURL ),
+ -1,
+ ::getCppuType((const ::rtl::OUString*)0),
+ ::com::sun::star::beans::PropertyAttribute::BOUND )
+};
+
+PluginModel::PluginModel() :
+ BroadcasterHelperHolder( aPropertyMutex ),
+ OPropertySetHelper( m_aHelper ),
+ OPropertyArrayHelper( aProps, 1 )
+{
+}
+
+PluginModel::PluginModel(const ::rtl::OUString& rURL) :
+ BroadcasterHelperHolder( aPropertyMutex ),
+ OPropertySetHelper( m_aHelper ),
+ OPropertyArrayHelper( aProps, 1 ),
+ m_aCreationURL( rURL )
+{
+}
+
+PluginModel::~PluginModel()
+{
+}
+
+Reference< ::com::sun::star::beans::XPropertySetInfo > PluginModel::getPropertySetInfo()
+{
+ static Reference< ::com::sun::star::beans::XPropertySetInfo > aInfo =
+ createPropertySetInfo( *this );
+ return aInfo;
+}
+
+::cppu::IPropertyArrayHelper& PluginModel::getInfoHelper()
+{
+ return *this;
+}
+
+sal_Bool PluginModel::convertFastPropertyValue( Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue )
+{
+ if( rValue.getValueTypeClass() == typelib_TypeClass_STRING )
+
+ {
+ rConvertedValue = rValue;
+ rOldValue <<= m_aCreationURL;
+ return sal_True;
+ }
+ return sal_False;
+}
+
+void PluginModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
+ const Any& rValue )
+ throw( ::com::sun::star::lang::IllegalArgumentException )
+{
+ if( rValue.getValueTypeClass() == typelib_TypeClass_STRING )
+
+ {
+ rValue >>= m_aCreationURL;
+ }
+ else
+ throw ::com::sun::star::lang::IllegalArgumentException();
+}
+
+void PluginModel::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
+{
+ rValue <<= m_aCreationURL;
+}
+
+//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
+void PluginModel::addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l )
+{
+ m_aDisposeListeners.push_back( l );
+}
+
+//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
+void PluginModel::removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l )
+{
+ m_aDisposeListeners.remove( l );
+}
+
+//---- ::com::sun::star::lang::XComponent ----------------------------------------------------------------------------------
+void PluginModel::dispose(void)
+{
+ // send disposing events
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ ::std::list< Reference< ::com::sun::star::lang::XEventListener > > aLocalListeners = m_aDisposeListeners;
+ for( ::std::list< Reference< ::com::sun::star::lang::XEventListener > >::iterator it = aLocalListeners.begin();
+ it != aLocalListeners.end(); ++it )
+ (*it)->disposing( aEvt );
+
+ m_aDisposeListeners.clear();
+
+ disposing();
+}
+
+
+// ::com::sun::star::io::XPersistObject
+::rtl::OUString PluginModel::getServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.plugin.PluginModel" );
+}
+
+void PluginModel::write(const Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream)
+{
+ OutStream->writeUTF( m_aCreationURL );
+}
+
+void PluginModel::read(const Reference< ::com::sun::star::io::XObjectInputStream > & InStream)
+{
+ m_aCreationURL = InStream->readUTF();
+}
diff --git a/extensions/source/plugin/base/service.cxx b/extensions/source/plugin/base/service.cxx
new file mode 100644
index 000000000..4c1042fd8
--- /dev/null
+++ b/extensions/source/plugin/base/service.cxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * $RCSfile: service.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <plugin/impl.hxx>
+#include <tools/debug.hxx>
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
+#include <com/sun/star/container/XSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#endif
+
+#include <uno/dispatcher.h> // declaration of generic uno interface
+#include <uno/mapping.hxx> // mapping stuff
+
+#include <cppuhelper/factory.hxx>
+
+using namespace cppu;
+
+//==================================================================================================
+void registerPluginService( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMgr )
+{
+ if (! xMgr.is())
+ return;
+
+ Reference< ::com::sun::star::container::XSet > xReg( xMgr, UNO_QUERY );
+ if(xReg.is())
+ {
+ Any aAny;
+ Reference< ::com::sun::star::lang::XSingleServiceFactory > xF;
+ xF = createSingleFactory( xMgr, PluginModel::getImplementationName_Static(),
+
+ PluginModel_CreateInstance,
+ PluginModel::getSupportedServiceNames_Static() );
+ aAny <<= xF;
+ xReg->insert( aAny );
+ xF = createSingleFactory( xMgr, XPluginManager_Impl::getImplementationName_Static(),
+
+ PluginManager_CreateInstance,
+ XPluginManager_Impl::getSupportedServiceNames_Static() );
+ aAny <<= xF;
+ xReg->insert( aAny );
+ }
+}
+
+extern "C" {
+ void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char** ppEnvTypeName,
+ uno_Environment** ppEnv )
+ {
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+ }
+
+ sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pXUnoKey )
+ {
+ if( pXUnoKey )
+ {
+ try
+ {
+ Reference< ::com::sun::star::registry::XRegistryKey > xKey( reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( pXUnoKey ) );
+
+ ::rtl::OUString aImplName = ::rtl::OUString::createFromAscii( "/" );
+ aImplName += XPluginManager_Impl::getImplementationName_Static();
+ aImplName += ::rtl::OUString::createFromAscii( "/UNO/SERVICES/com.sun.star.plugin.PluginManager" );
+ xKey->createKey( aImplName );
+
+ aImplName = ::rtl::OUString::createFromAscii( "/" );
+ aImplName += PluginModel::getImplementationName_Static();
+ aImplName += ::rtl::OUString::createFromAscii( "/UNO/SERVICES/com.sun.star.plugin.PluginModel" );
+ xKey->createKey( aImplName );
+
+ return sal_True;
+ }
+ catch( ::com::sun::star::registry::InvalidRegistryException& )
+ {
+ }
+ }
+ return sal_False;
+ }
+
+ void* SAL_CALL component_getFactory(
+ const sal_Char* pImplementationName,
+ void* pXUnoSMgr,
+ void* pXUnoKey
+ )
+ {
+ void* pRet = 0;
+
+ ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplementationName ) );
+
+ if( pXUnoSMgr )
+ {
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > xMgr(
+ reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pXUnoSMgr )
+ );
+ Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory;
+ if( aImplName.equals( XPluginManager_Impl::getImplementationName_Static() ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ xMgr, aImplName, PluginManager_CreateInstance,
+ XPluginManager_Impl::getSupportedServiceNames_Static() );
+ }
+ else if( aImplName.equals( PluginModel::getImplementationName_Static() ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ xMgr, aImplName, PluginModel_CreateInstance,
+ PluginModel::getSupportedServiceNames_Static() );
+ }
+ if( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+ return pRet;
+ }
+
+/** special registration procedure for the staroffice player */
+ void SAL_CALL exService_getSmartFactory( const sal_Char* implementationName, const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr, Reference< ::com::sun::star::lang::XSingleServiceFactory > & xFactory )
+ {
+ ::rtl::OUString aImplementationName( ::rtl::OUString::createFromAscii(implementationName));
+
+ if (aImplementationName == PluginModel::getImplementationName_Static() )
+
+ {
+ xFactory = createSingleFactory( rSMgr, aImplementationName,
+ PluginModel_CreateInstance,
+ PluginModel::getSupportedServiceNames_Static() );
+ }
+ else if (aImplementationName == XPluginManager_Impl::getImplementationName_Static() )
+
+ {
+ xFactory = createSingleFactory( rSMgr, aImplementationName,
+ PluginManager_CreateInstance,
+ XPluginManager_Impl::getSupportedServiceNames_Static() );
+ }
+ }
+} /* extern "C" */
diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx
new file mode 100644
index 000000000..0c08e750f
--- /dev/null
+++ b/extensions/source/plugin/base/xplugin.cxx
@@ -0,0 +1,888 @@
+/*************************************************************************
+ *
+ * $RCSfile: xplugin.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string> // workaround for SUNPRO workshop include conflicts
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LOADER_XIMPLEMENTATIONLOADER_HPP_
+#include <com/sun/star/loader/XImplementationLoader.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LOADER_CANNOTACTIVATEFACTORYEXCEPTION_HPP_
+#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
+#endif
+
+#include <plugin/impl.hxx>
+#include <tools/fsys.hxx>
+
+#include <tools/urlobj.hxx>
+#include <tools/string.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/timer.hxx>
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+class PluginDisposer : public ::vos::OTimer
+{
+private:
+ XPlugin_Impl* m_pPlugin;
+
+ virtual void SAL_CALL onShot();
+public:
+ PluginDisposer( XPlugin_Impl* pPlugin ) :
+ OTimer( ::vos::TTimeValue( 2, 0 ),
+ ::vos::TTimeValue( 2, 0 ) ),
+ m_pPlugin( pPlugin )
+ { start(); }
+ ~PluginDisposer() {}
+};
+
+void PluginDisposer::onShot()
+{
+ if( m_pPlugin )
+ {
+ if( m_pPlugin->isDisposable() )
+ {
+ sal_uInt32 nEvent;
+ Application::PostUserEvent( nEvent, LINK( m_pPlugin, XPlugin_Impl, secondLevelDispose ), (void*)m_pPlugin );
+ }
+ }
+ else
+ release();
+}
+
+//==================================================================================================
+
+//==================================================================================================
+// const Reference< ::com::sun::star::reflection::XIdlClass > & XPlugin_Impl::staticGetIdlClass()
+// {
+// static Reference< ::com::sun::star::reflection::XIdlClass > aClass = createStandardClass( L"Plugin",
+// OWeakAggObject::getStaticIdlClass(), 6,
+// ::getCppuType((const ::com::sun::star::awt::XControl*)0),
+// ::getCppuType((const ::com::sun::star::awt::XControlModel*)0),
+// ::getCppuType((const ::com::sun::star::awt::XWindow*)0),
+// ::getCppuType((const ::com::sun::star::lang::XComponent*)0),
+// ::getCppuType((const ::com::sun::star::awt::XView*)0),
+// ::getCppuType((const ::com::sun::star::plugin::XPlugin*)0) );
+// return aClass;
+// }
+
+Any XPlugin_Impl::queryInterface( const Type& type )
+
+{
+ return OWeakAggObject::queryInterface( type );
+}
+
+Any XPlugin_Impl::queryAggregation( const Type& type )
+{
+ Any aRet( ::cppu::queryInterface( type, static_cast< ::com::sun::star::plugin::XPlugin* >(this) ) );
+ if( ! aRet.hasValue() )
+ aRet = PluginControl_Impl::queryAggregation( type );
+ return aRet;
+}
+
+
+XPlugin_Impl::XPlugin_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) :
+ m_xSMgr( rSMgr ),
+ PluginControl_Impl(),
+ m_pPluginComm( NULL ),
+ m_pArgn( NULL ),
+ m_pArgv( NULL ),
+ m_nArgs( 0 ),
+ m_aPluginMode( NP_FULL ),
+ m_nProvidingState( PROVIDING_NONE ),
+ m_nCalledFromPlugin( 0 ),
+ m_pDisposer( NULL ),
+ m_bIsDisposed( sal_False ),
+ m_aEncoding( gsl_getSystemTextEncoding() )
+{
+ memset( &m_aInstance, 0, sizeof( m_aInstance ) );
+ memset( &m_aNPWindow, 0, sizeof( m_aNPWindow ) );
+#ifdef UNX
+ m_aAppContext = NULL;
+ m_pDisplay = NULL;
+ memset( &m_aWSInfo, 0, sizeof( m_aWSInfo ) );
+#endif
+
+ m_xModel = new PluginModel();
+ Reference< ::com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
+ xPS->addPropertyChangeListener( ::rtl::OUString(), this );
+
+ ::osl::Guard< ::osl::Mutex > aGuard( PluginManager::get().getPluginMutex() );
+ PluginManager::get().getPlugins().push_back( this );
+}
+
+void XPlugin_Impl::destroyInstance()
+{
+ NPSavedData* pSavedData = NULL;
+
+ destroyStreams();
+ if( getPluginComm() )
+ {
+ getPluginComm()->NPP_Destroy( getNPPInstance(),
+ &pSavedData );
+ getPluginComm()->decRef();
+ m_pPluginComm = NULL;
+ }
+
+ if( m_nArgs > 0 )
+ {
+ for( ; m_nArgs--; )
+ {
+ free( (void*)m_pArgn[m_nArgs] );
+ free( (void*)m_pArgv[m_nArgs] );
+ }
+ delete m_pArgn;
+ delete m_pArgv;
+ }
+ while( m_aPEventListeners.size() )
+ {
+ delete *m_aPEventListeners.begin();
+ m_aPEventListeners.pop_front();
+ }
+}
+
+XPlugin_Impl::~XPlugin_Impl()
+{
+ destroyInstance();
+}
+
+void XPlugin_Impl::checkListeners( const char* normalizedURL )
+{
+ if( ! normalizedURL )
+ return;
+
+ ::std::list<PluginEventListener*>::iterator iter;
+ for( iter = m_aPEventListeners.begin();
+ iter != m_aPEventListeners.end();
+ ++iter )
+ {
+ if( ! strcmp( normalizedURL, (*iter)->getURL() ) ||
+ ! strcmp( normalizedURL, (*iter)->getNormalizedURL() ) )
+ {
+ (*iter)->disposing( ::com::sun::star::lang::EventObject() );
+ delete *iter;
+ m_aPEventListeners.remove( *iter );
+ return;
+ }
+ }
+}
+
+IMPL_LINK( XPlugin_Impl, secondLevelDispose, XPlugin_Impl*, pThis )
+{
+ // may have become undisposable between PostUserEvent and here
+ // or may have disposed and receive a second UserEvent
+ ::std::list<XPlugin_Impl*>& rList = PluginManager::get().getPlugins();
+ ::std::list<XPlugin_Impl*>::iterator iter;
+
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( PluginManager::get().getPluginMutex() );
+ for( iter = rList.begin(); iter != rList.end(); ++iter )
+ {
+ if( *iter == this )
+ break;
+ }
+ if( iter == rList.end() || ! isDisposable() )
+ return 0;
+ }
+
+ if (m_pDisposer)
+ {
+ m_pDisposer->release();
+ m_pDisposer = NULL;
+ }
+
+ Reference< ::com::sun::star::plugin::XPlugin > xProtection( this );
+ Reference< ::com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
+ xPS->removePropertyChangeListener( ::rtl::OUString(), this );
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( PluginManager::get().getPluginMutex() );
+ rList.remove( this );
+ }
+ m_aNPWindow.window = NULL;
+#ifndef UNX
+ // acrobat does an unconditional XtParent on the windows widget
+ getPluginComm()->
+ NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
+#endif
+ destroyInstance();
+ PluginControl_Impl::dispose();
+ return 0;
+}
+
+void XPlugin_Impl::dispose()
+{
+ if (m_bIsDisposed || !getPluginComm())
+ return;
+ m_bIsDisposed = sal_True;
+
+ if( isDisposable() )
+ secondLevelDispose( this );
+ else
+ {
+ m_pDisposer = new PluginDisposer( this );
+ m_pDisposer->acquire();
+ }
+}
+
+void XPlugin_Impl::initInstance( const ::com::sun::star::plugin::PluginDescription& rDescription,
+ const Sequence< ::rtl::OUString >& argn,
+ const Sequence< ::rtl::OUString >& argv,
+ sal_Int16 mode )
+{
+ m_aDescription = rDescription;
+
+ // #69333# special for pdf
+ m_aPluginMode = mode;
+ if( m_aDescription.Mimetype.compareToAscii( "application/pdf" ) )
+ m_aPluginMode = ::com::sun::star::plugin::PluginMode::FULL;
+
+ m_nArgs = argn.getLength();
+ m_pArgn = new const char*[m_nArgs];
+ m_pArgv = new const char*[m_nArgs];
+ const ::rtl::OUString* pUArgn = argn.getConstArray();
+ const ::rtl::OUString* pUArgv = argv.getConstArray();
+ for( int i = 0; i < m_nArgs; i++ )
+ {
+ m_pArgn[i] = strdup(
+ ::rtl::OUStringToOString( pUArgn[i], m_aEncoding ).getStr()
+ );
+ m_pArgv[i] = strdup(
+ ::rtl::OUStringToOString( pUArgv[i], m_aEncoding ).getStr()
+ );
+ }
+}
+
+void XPlugin_Impl::modelChanged()
+{
+ m_nProvidingState = PROVIDING_MODEL_UPDATE;
+
+ // empty description is only set when created by createPluginFromURL
+ if( m_aDescription.Mimetype.getLength() )
+ destroyInstance();
+
+ Reference< ::com::sun::star::plugin::XPluginManager > xPMgr( m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.plugin.PluginManager" ) ), UNO_QUERY );
+ if( !xPMgr.is() )
+ {
+ m_nProvidingState = PROVIDING_NONE;
+ return;
+ }
+
+ int nDescr = -1;
+ Sequence< ::com::sun::star::plugin::PluginDescription > aDescrs = xPMgr->getPluginDescriptions();
+ const ::com::sun::star::plugin::PluginDescription* pDescrs = aDescrs.getConstArray();
+
+ ::rtl::OUString aURL = getCreationURL();
+ int nPos = aURL.lastIndexOf( (sal_Unicode)'.' );
+ ::rtl::OUString aExt = aURL.copy( nPos ).toLowerCase();
+ if( nPos != -1 )
+ {
+ for( int i = 0; i < aDescrs.getLength(); i++ )
+ {
+ ::rtl::OUString aThisExt = pDescrs[ i ].Extension.toLowerCase();
+ if( aThisExt.indexOf( aExt ) != -1 )
+ {
+ nDescr = i;
+ break;
+ }
+ }
+ }
+
+ if( nDescr != -1 )
+ {
+ INetURLObject aURL;
+ aURL.SetSmartProtocol( INET_PROT_FILE );
+ aURL.SetSmartURL( ::rtl::OUStringToOString( getCreationURL(), m_aEncoding ) );
+
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > xFact( m_xSMgr->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.DataSourceFactory" ) ), UNO_QUERY );
+ if ( xFact.is() )
+ {
+ Sequence < Any > aArgs(1);
+ aArgs.getArray()[0] <<= ::rtl::OUString( aURL.GetMainURL() );
+ ::rtl::OUString aProt( INetURLObject::GetScheme( aURL.GetProtocol() ) );
+ Reference< ::com::sun::star::io::XActiveDataSource > xSource( xFact->createInstanceWithArguments( aProt, aArgs ), UNO_QUERY );
+ if ( xSource.is() )
+ {
+ m_aDescription = pDescrs[ nDescr ];
+ provideNewStream( m_aDescription.Mimetype,
+ xSource,
+ getRefererURL(),
+ 0, 0, sal_False );
+ }
+ }
+ }
+ m_nProvidingState = PROVIDING_NONE;
+}
+
+::rtl::OUString XPlugin_Impl::getCreationURL()
+{
+ ::rtl::OUString aRet;
+ Reference< ::com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
+ if( xPS.is() )
+ {
+ Any aValue = xPS->getPropertyValue( ::rtl::OUString::createFromAscii( "URL" ) );
+ aValue >>= aRet;
+ }
+ return aRet;
+}
+
+
+sal_Bool XPlugin_Impl::setModel( const Reference< ::com::sun::star::awt::XControlModel > & Model )
+ throw( RuntimeException )
+{
+ Reference< ::com::sun::star::beans::XPropertySet > xPS( Model, UNO_QUERY );
+ if( ! xPS.is() )
+ return sal_False;
+
+ if( getCreationURL().getLength() )
+ {
+ m_xModel = Model;
+ modelChanged();
+ xPS->addPropertyChangeListener( ::rtl::OUString(), this );
+ return sal_True;
+ }
+ return sal_False;
+}
+
+void XPlugin_Impl::createPeer( const Reference< ::com::sun::star::awt::XToolkit > & xToolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & Parent )
+ throw( RuntimeException )
+{
+ if( ! _xPeer.is() )
+ {
+ if( ! Parent.is() )
+ throw RuntimeException();
+ PluginControl_Impl::createPeer( xToolkit, Parent );
+ }
+}
+
+void XPlugin_Impl::loadPlugin()
+{
+ ::std::list<PluginComm*>::iterator iter;
+ for( iter = PluginManager::get().getPluginComms().begin();
+ iter != PluginManager::get().getPluginComms().end(); ++iter )
+ {
+ if( ::rtl::OStringToOUString( (*iter)->getLibName(), m_aEncoding ) == m_aDescription.PluginName )
+ {
+ setPluginComm( *iter );
+ break;
+ }
+ }
+ const SystemEnvData* pEnvData = getSysChildSysData();
+#ifdef UNX
+ XSync( (Display*)pEnvData->pDisplay, False );
+#endif
+ if( ! getPluginComm() )
+ {
+#ifdef UNX
+ m_pDisplay = (Display*)pEnvData->pDisplay;
+ m_aAppContext = (XtAppContext)pEnvData->pAppContext;
+ // need a new PluginComm
+ PluginComm* pComm = new UnxPluginComm( ::rtl::OUStringToOString( m_aDescription.PluginName, gsl_getSystemTextEncoding() ) );
+#elif (defined WNT || defined OS2)
+ PluginComm* pComm = new PluginComm_Impl( m_aDescription.Mimetype,
+ m_aDescription.PluginName,
+ (HWND)pEnvData->hWnd );
+#endif
+ setPluginComm( pComm );
+ }
+
+ NPError aError = getPluginComm()->
+ NPP_New( (char*)::rtl::OUStringToOString( m_aDescription.Mimetype,
+ m_aEncoding).getStr(),
+ getNPPInstance(),
+ m_aPluginMode,
+ m_nArgs,
+ (char**)(m_nArgs ? m_pArgn : NULL),
+ (char**)(m_nArgs ? m_pArgv : NULL),
+ NULL );
+
+#ifdef UNX
+ XSync( (Display*)pEnvData->pDisplay, False );
+#endif
+#ifdef UNX
+ m_aNPWindow.window = (void*)pEnvData->aWindow;
+ m_aNPWindow.ws_info = &m_aWSInfo;
+
+ m_aWSInfo.type = NP_SETWINDOW;
+ m_aWSInfo.display = (Display*)pEnvData->pDisplay;
+ m_aWSInfo.visual = (Visual*)pEnvData->pVisual;
+ m_aWSInfo.colormap = (Colormap)pEnvData->aColormap;
+ m_aWSInfo.depth = pEnvData->nDepth;
+#else
+ m_aNPWindow.window = (void*)pEnvData->hWnd;
+#endif
+ ::com::sun::star::awt::Rectangle aPosSize = getPosSize();
+
+ m_aNPWindow.clipRect.top = 0;
+ m_aNPWindow.clipRect.left = 0;
+ m_aNPWindow.clipRect.bottom = 0;
+ m_aNPWindow.clipRect.right = 0;
+ m_aNPWindow.type = NPWindowTypeWindow;
+
+ m_aNPWindow.x = aPosSize.X;
+ m_aNPWindow.y = aPosSize.Y;
+ m_aNPWindow.width = aPosSize.Width ? aPosSize.Width : 600;
+ m_aNPWindow.height = aPosSize.Height ? aPosSize.Height : 600;
+
+ aError = getPluginComm()->
+ NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
+}
+
+void XPlugin_Impl::destroyStreams()
+{
+ // streams remove themselves from this list when deleted
+ while( m_aOutputStreams.size() )
+ delete *m_aOutputStreams.begin();
+
+ // input streams are XOutputStreams, they cannot be simply deleted
+ ::std::list<PluginInputStream*> aLocalList( m_aInputStreams );
+ for( ::std::list<PluginInputStream*>::iterator it = aLocalList.begin();
+ it != aLocalList.end(); ++it )
+ (*it)->setMode( -1 );
+}
+
+PluginStream* XPlugin_Impl::getStreamFromNPStream( NPStream* stream )
+{
+ ::std::list<PluginInputStream*>::iterator iter;
+ for( iter = m_aInputStreams.begin(); iter != m_aInputStreams.end(); ++iter )
+ if( (*iter)->getStream() == stream )
+ return *iter;
+
+ ::std::list<PluginOutputStream*>::iterator iter2;
+ for( iter2 = m_aOutputStreams.begin(); iter2 != m_aOutputStreams.end(); ++iter2 )
+ if( (*iter2)->getStream() == stream )
+ return *iter2;
+
+ return NULL;
+}
+
+sal_Bool XPlugin_Impl::provideNewStream(const ::rtl::OUString& mimetype,
+ const Reference< ::com::sun::star::io::XActiveDataSource > & stream,
+ const ::rtl::OUString& url, sal_Int32 length,
+ sal_Int32 lastmodified, sal_Bool isfile)
+
+{
+ if( m_nProvidingState == PROVIDING_NONE )
+ {
+ m_nProvidingState = PROVIDING_NOW;
+ Any aAny;
+ aAny <<= url;
+ Reference< ::com::sun::star::beans::XPropertySet > xPS( m_xModel, UNO_QUERY );
+ xPS->setPropertyValue( ::rtl::OUString::createFromAscii( "URL" ), aAny );
+ }
+
+ m_nProvidingState = PROVIDING_NOW;
+ if( ! m_pPluginComm )
+ loadPlugin();
+
+ ::rtl::OString aMIME;
+ if( mimetype.len() )
+ aMIME = ::rtl::OUStringToOString( mimetype, m_aEncoding );
+ else
+ // Notnagel
+ aMIME = ::rtl::OUStringToOString( m_aDescription.Mimetype, m_aEncoding );
+
+ ::rtl::OString aURL = ::rtl::OUStringToOString( url, m_aEncoding );
+
+ // check wether there is a notifylistener for this stream
+ // this means that the strema is created from the plugin
+ // via NPN_GetURLNotify or NPN_PostURLNotify
+ ::std::list<PluginEventListener*>::iterator iter;
+ for( iter = m_aPEventListeners.begin();
+ iter != m_aPEventListeners.end();
+ ++iter )
+ {
+ if( (*iter)->getNormalizedURL() == aURL )
+ {
+ aURL = (*iter)->getURL();
+ break;
+ }
+ }
+
+ if( iter == m_aPEventListeners.end() )
+ {
+ // e.g. plugger.so does not like file:///
+ if( ! aURL.compareTo( "file://", 7 ) )
+ {
+ INetURLObject aPath( url );
+ aURL = ::rtl::OUStringToOString( aPath.PathToFileName(), m_aEncoding );
+ }
+ }
+
+ PluginInputStream* pStream = new PluginInputStream( this, aURL.getStr(),
+ length, lastmodified );
+ Reference< ::com::sun::star::io::XOutputStream > xNewStream( pStream );
+
+ if( iter != m_aPEventListeners.end() )
+ pStream->getStream()->notifyData = (*iter)->getNotifyData();
+
+ uint16 stype = 0;
+
+ // sal_False in the following statement should logically be isfile
+ // but e.g. the acrobat reader plugin does not WANT a file
+ // NP_ASFILE or NP_ASFILEONLY if the new stream is seekable
+ // the reason for this behaviour is unknown
+#ifdef DEBUG
+ fprintf( stderr, "new stream \"%s\" of MIMEType \"%s\"\nfor plugin \"%s\"\n", aURL.getStr(), aMIME.getStr(), getPluginComm()->getLibName().getStr() );
+
+#endif
+ if( ! m_pPluginComm->NPP_NewStream( &m_aInstance, (char*)aMIME.getStr(),
+ pStream->getStream(), sal_False,
+ &stype ) )
+ {
+ getPluginComm()->NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
+#ifdef DEBUG
+ char* pType;
+ switch( stype )
+ {
+ case NP_NORMAL: pType = "NP_NORMAL";break;
+ case NP_SEEK: pType = "NP_SEEK";break;
+ case NP_ASFILE: pType = "NP_ASFILE";break;
+ case NP_ASFILEONLY: pType = "NP_ASFILEONLY";break;
+ default: pType = "unknown!!!";
+ }
+ fprintf( stderr, "Plugin wants it in Mode %s\n", pType );
+#endif
+ if( isfile && stype == NP_ASFILEONLY )
+ {
+ m_pPluginComm->
+ NPP_StreamAsFile( &m_aInstance,
+ pStream->getStream(),
+ pStream->getStream()->url );
+ m_nProvidingState = PROVIDING_NONE;
+ return sal_True;
+ }
+
+ if( ! stream.is() )
+ {
+ m_pPluginComm->
+ NPP_DestroyStream( &m_aInstance,
+ pStream->getStream(),
+ NPRES_NETWORK_ERR );
+ m_nProvidingState = PROVIDING_NONE;
+ throw RuntimeException();
+ }
+ pStream->setMode( stype );
+ Reference< ::com::sun::star::io::XConnectable > xConnectable( stream, UNO_QUERY );
+ pStream->setPredecessor( xConnectable );
+ if( xConnectable.is() )
+ {
+ xConnectable->setSuccessor( static_cast< ::com::sun::star::io::XConnectable* >(pStream) );
+ while( xConnectable->getPredecessor().is() )
+ xConnectable = xConnectable->getPredecessor();
+ }
+ stream->setOutputStream( xNewStream );
+ pStream->setSource( stream );
+ Reference< ::com::sun::star::io::XActiveDataControl > xController;
+ if( xConnectable.is() )
+ xController = Reference< ::com::sun::star::io::XActiveDataControl >( xConnectable, UNO_QUERY );
+ else
+ xController = Reference< ::com::sun::star::io::XActiveDataControl >( stream, UNO_QUERY );
+
+ if( xController.is() )
+ xController->start();
+ }
+
+ m_nProvidingState = PROVIDING_NONE;
+
+ return sal_False;
+}
+
+void XPlugin_Impl::disposing( const ::com::sun::star::lang::EventObject& rSource )
+{
+}
+
+void XPlugin_Impl::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvent )
+{
+ if( ! rEvent.PropertyName.compareToAscii( "URL" ) )
+ {
+ ::rtl::OUString aStr;
+ rEvent.NewValue >>= aStr;
+ if( m_nProvidingState == PROVIDING_NONE )
+ {
+ if( aStr != m_aURL )
+ {
+ m_aURL = aStr;
+ modelChanged();
+ }
+ }
+ }
+}
+
+void XPlugin_Impl::setPluginContext( const Reference< ::com::sun::star::plugin::XPluginContext > & rContext )
+{
+ m_rBrowserContext = rContext;
+}
+
+void XPlugin_Impl::setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags )
+ throw( RuntimeException )
+{
+#ifdef DEBUG
+ fprintf( stderr, "XPlugin_Impl::setPosSize( %d, %d, %d, %d, %d )\n",
+ nX_, nY_, nWidth_, nHeight_, nFlags );
+#endif
+
+ PluginControl_Impl::setPosSize(nX_, nY_, nWidth_, nHeight_, nFlags);
+ m_aNPWindow.x = nX_;
+ m_aNPWindow.y = nY_;
+ m_aNPWindow.width = nWidth_;
+ m_aNPWindow.height = nHeight_;
+
+ if(getPluginComm())
+ getPluginComm()->NPP_SetWindow( getNPPInstance(), &m_aNPWindow );
+}
+
+PluginStream::PluginStream( XPlugin_Impl* pPlugin,
+ const char* url, sal_uInt32 len, sal_uInt32 lastmod ) :
+ m_pPlugin( pPlugin )
+{
+ memset( &m_aNPStream, 0, sizeof( m_aNPStream ) );
+ m_aNPStream.url = strdup( url );
+ m_aNPStream.end = len;
+ m_aNPStream.lastmodified = lastmod;
+}
+
+PluginStream::~PluginStream()
+{
+ if( m_pPlugin && m_pPlugin->getPluginComm() )
+ {
+ m_pPlugin->getPluginComm()->NPP_DestroyStream( m_pPlugin->getNPPInstance(),
+ &m_aNPStream, NPRES_DONE );
+ m_pPlugin->checkListeners( m_aNPStream.url );
+ m_pPlugin->getPluginComm()->
+ NPP_SetWindow( m_pPlugin->getNPPInstance(),
+ m_pPlugin->getNPWindow());
+ }
+ ::free( (void*)m_aNPStream.url );
+}
+
+PluginInputStream::PluginInputStream( XPlugin_Impl* pPlugin,
+ const char* url,
+ sal_uInt32 len,
+ sal_uInt32 lastmod ) :
+ PluginStream( pPlugin, url, len, lastmod ),
+ m_nMode( NP_NORMAL ),
+ m_nWritePos( 0 )
+{
+ m_pPlugin->getInputStreams().push_back( this );
+ DirEntry aEntry;
+ aEntry = aEntry.TempName();
+
+ // set correct extension, some plugins need that
+ DirEntry aName( String( m_aNPStream.url, m_pPlugin->getTextEncoding() ) );
+ String aExtension = aName.GetExtension();
+ if( aExtension.Len() )
+ aEntry.SetExtension( aExtension );
+ m_aFileStream.Open( aEntry.GetFull(), STREAM_READ | STREAM_WRITE );
+ if( ! m_aFileStream.IsOpen() )
+ {
+ // #74808# might be that the extension scrambled the whole filename
+ aEntry = aEntry.TempName();
+ m_aFileStream.Open( aEntry.GetFull(), STREAM_READ | STREAM_WRITE );
+ }
+}
+
+PluginInputStream::~PluginInputStream()
+{
+ String aFile( m_aFileStream.GetFileName() );
+ m_aFileStream.Close();
+ if( m_pPlugin )
+ {
+ ByteString aFileName( aFile, m_pPlugin->getTextEncoding() );
+ if( m_pPlugin->getPluginComm() && m_nMode != -1 )
+ // mode -1 means either an error occured,
+ // or the plugin is already disposing
+ {
+ m_pPlugin->getPluginComm()->addFileToDelete( aFile );
+ if( m_nMode == NP_ASFILE )
+ {
+ m_pPlugin->getPluginComm()->
+ NPP_StreamAsFile( m_pPlugin->getNPPInstance(),
+ &m_aNPStream,
+ aFileName.GetBuffer() );
+ }
+ m_pPlugin->getPluginComm()->NPP_SetWindow( m_pPlugin->getNPPInstance(), m_pPlugin->getNPWindow());
+ m_pPlugin->getInputStreams().remove( this );
+ }
+ else
+ DirEntry( m_aFileStream.GetFileName() ).Kill();
+ }
+ else
+ DirEntry( m_aFileStream.GetFileName() ).Kill();
+}
+
+PluginStreamType PluginInputStream::getStreamType()
+{
+ return InputStream;
+}
+
+void PluginInputStream::setMode( sal_uInt32 nMode )
+{
+ m_nMode = nMode;
+
+ // invalidation by plugin
+ if( m_nMode == -1 && m_pPlugin )
+ {
+ m_pPlugin->getInputStreams().remove( this );
+ m_pPlugin = NULL;
+ }
+}
+
+void PluginInputStream::writeBytes( const Sequence<sal_Int8>& Buffer )
+{
+ if( m_nMode == -1 )
+ return;
+
+ m_aFileStream.Seek( STREAM_SEEK_TO_END );
+ m_aFileStream.Write( Buffer.getConstArray(), Buffer.getLength() );
+
+ int nPos = m_aFileStream.Tell();
+ int nBytes = 0;
+ while( m_nMode != NP_SEEK && m_nMode != NP_ASFILEONLY &&
+ ( nBytes = m_pPlugin->getPluginComm()->
+ NPP_WriteReady( m_pPlugin->getNPPInstance(),
+ &m_aNPStream ) ) > 0 &&
+ m_nWritePos < nPos )
+ {
+ nBytes = nBytes > nPos - m_nWritePos ? nPos - m_nWritePos : nBytes;
+
+ char* pBuffer = new char[ nBytes ];
+ m_aFileStream.Seek( m_nWritePos );
+ nBytes = m_aFileStream.Read( pBuffer, nBytes );
+
+ int nBytesRead = 0;
+ try
+ {
+ nBytesRead = m_pPlugin->getPluginComm()->
+ NPP_Write( m_pPlugin->getNPPInstance(),
+ &m_aNPStream,
+ m_nWritePos,
+ nBytes,
+ pBuffer );
+ delete pBuffer;
+ }
+ catch( ... )
+ {
+ delete pBuffer;
+ return;
+ }
+
+ if( nBytesRead < 0 )
+ {
+ m_nMode = -1;
+ return;
+ }
+
+ m_nWritePos += nBytesRead;
+ }
+
+ m_pPlugin->getPluginComm()->
+ NPP_SetWindow( m_pPlugin->getNPPInstance(),
+ m_pPlugin->getNPWindow());
+}
+
+void PluginInputStream::closeOutput()
+{
+ flush();
+ m_xSource = Reference< ::com::sun::star::io::XActiveDataSource >();
+}
+
+sal_uInt32 PluginInputStream::read( sal_uInt32 offset, sal_Int8* buffer, sal_uInt32 size )
+{
+ if( m_nMode != NP_SEEK )
+ return 0;
+
+ m_aFileStream.Seek( offset );
+ int nBytes = m_aFileStream.Read( buffer, size );
+
+ return nBytes;
+}
+
+void PluginInputStream::flush(void)
+{
+}
+
+PluginOutputStream::PluginOutputStream( XPlugin_Impl* pPlugin,
+ const char* url,
+ sal_uInt32 len,
+ sal_uInt32 lastmod ) :
+ PluginStream( pPlugin, url, len, lastmod ),
+ m_xStream( pPlugin->getServiceManager()->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.io.DataOutputStream" ) ), UNO_QUERY )
+{
+ m_pPlugin->getOutputStreams().push_back( this );
+}
+
+PluginOutputStream::~PluginOutputStream()
+{
+ m_pPlugin->getOutputStreams().remove( this );
+}
+
+PluginStreamType PluginOutputStream::getStreamType()
+{
+ return OutputStream;
+}
+
diff --git a/extensions/source/plugin/inc/plugin/impl.hxx b/extensions/source/plugin/inc/plugin/impl.hxx
new file mode 100644
index 000000000..10fad0a14
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/impl.hxx
@@ -0,0 +1,478 @@
+/*************************************************************************
+ *
+ * $RCSfile: impl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __PLUGIN_SOURCE_MGR_IMPL_HXX
+#define __PLUGIN_SOURCE_MGR_IMPL_HXX
+
+#ifdef SOLARIS
+#include <limits>
+#endif
+
+#include <cppuhelper/weak.hxx>
+
+#ifndef _COM_SUN_STAR_AWT_KEY_HPP_
+#include <com/sun/star/awt/Key.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYFUNCTION_HPP_
+#include <com/sun/star/awt/KeyFunction.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_PLUGINMODE_HPP_
+#include <com/sun/star/plugin/PluginMode.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_PLUGINDESCRIPTION_HPP_
+#include <com/sun/star/plugin/PluginDescription.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_PLUGINEXCEPTION_HPP_
+#include <com/sun/star/plugin/PluginException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_PLUGINVARIABLE_HPP_
+#include <com/sun/star/plugin/PluginVariable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_XPLUGIN_HPP_
+#include <com/sun/star/plugin/XPlugin.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_XPLUGINMANAGER_HPP_
+#include <com/sun/star/plugin/XPluginManager.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PLUGIN_XPLUGINCONTEXT_HPP_
+#include <com/sun/star/plugin/XPluginContext.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XCONNECTABLE_HPP_
+#include <com/sun/star/io/XConnectable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XDATAOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XDataOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATACONTROL_HPP_
+#include <com/sun/star/io/XActiveDataControl.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XDATAINPUTSTREAM_HPP_
+#include <com/sun/star/io/XDataInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XMARKABLESTREAM_HPP_
+#include <com/sun/star/io/XMarkableStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XSTREAMLISTENER_HPP_
+#include <com/sun/star/io/XStreamListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
+#include <com/sun/star/lang/XServiceName.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_GRADIENTSTYLE_HPP_
+#include <com/sun/star/awt/GradientStyle.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_RASTEROPERATION_HPP_
+#include <com/sun/star/awt/RasterOperation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_GRADIENT_HPP_
+#include <com/sun/star/awt/Gradient.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XGRAPHICS_HPP_
+#include <com/sun/star/awt/XGraphics.hpp>
+#endif
+
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#ifdef WNT
+#include <plugin/win/sysplug.hxx>
+#else
+#include <list>
+#endif
+
+#ifdef OS2
+#include <plugin/os2/sysplug.hxx>
+#endif
+
+#ifdef UNX
+#include <plugin/unx/sysplug.hxx>
+#endif
+
+#include <vcl/sysdata.hxx>
+#include <vcl/syschild.hxx>
+#include <plugin/plctrl.hxx>
+#include <plugin/model.hxx>
+#include <tools/link.hxx>
+#include <tools/stream.hxx>
+
+using namespace com::sun::star::uno;
+
+#define PROVIDING_NONE 0
+#define PROVIDING_NOW 1
+#define PROVIDING_MODEL_UPDATE 2
+
+class PluginStream;
+class PluginInputStream;
+class PluginOutputStream;
+class XPlugin_Impl;
+class PluginDisposer;
+class PluginEventListener;
+
+class XPlugin_Impl : public ::com::sun::star::plugin::XPlugin,
+ public PluginControl_Impl,
+ public ::com::sun::star::beans::XPropertyChangeListener
+{
+private:
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ Reference< ::com::sun::star::plugin::XPluginContext > m_rBrowserContext;
+
+ PluginComm* m_pPluginComm;
+ NPP_t m_aInstance;
+ NPWindow m_aNPWindow;
+ rtl_TextEncoding m_aEncoding;
+#ifdef UNX
+ NPSetWindowCallbackStruct m_aWSInfo;
+ Display* m_pDisplay;
+ XtAppContext m_aAppContext;
+#endif
+
+ const char** m_pArgv;
+ const char** m_pArgn;
+ int m_nArgs;
+
+ Reference< ::com::sun::star::awt::XControlModel > m_xModel;
+
+ ::com::sun::star::plugin::PluginDescription m_aDescription;
+ sal_Int16 m_aPluginMode;
+
+ int m_nProvidingState;
+ int m_nCalledFromPlugin;
+ PluginDisposer* m_pDisposer;
+
+ ::std::list<PluginInputStream*> m_aInputStreams;
+ ::std::list<PluginOutputStream*> m_aOutputStreams;
+ ::std::list<PluginEventListener*> m_aPEventListeners;
+ ::rtl::OUString m_aURL;
+
+ sal_Bool m_bIsDisposed;
+
+ void init( const ::com::sun::star::plugin::PluginDescription& rDescription );
+ void loadPlugin();
+ void destroyInstance();
+ void modelChanged();
+
+public:
+ XPlugin_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr );
+ virtual ~XPlugin_Impl();
+
+ void destroyStreams();
+
+ ::std::list<PluginInputStream*>& getInputStreams() { return m_aInputStreams; }
+ ::std::list<PluginOutputStream*>& getOutputStreams() { return m_aOutputStreams; }
+ PluginComm* getPluginComm() { return m_pPluginComm; }
+ void setPluginComm( PluginComm* comm )
+ {
+ if( ! m_pPluginComm )
+ {
+ m_pPluginComm = comm;
+ m_pPluginComm->addRef();
+ }
+ }
+#ifdef UNX
+ Display* getAppDisplay() { return m_pDisplay; }
+ XtAppContext getAppContext() { return m_aAppContext; }
+#endif
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceManager() { return m_xSMgr; }
+ rtl_TextEncoding getTextEncoding() { return m_aEncoding; }
+ NPP getNPPInstance() { return &m_aInstance; }
+ NPWindow* getNPWindow() { return &m_aNPWindow; }
+
+ void enterPluginCallback() { m_nCalledFromPlugin++; }
+ void leavePluginCallback() { m_nCalledFromPlugin--; }
+ sal_Bool isDisposable() { return m_nCalledFromPlugin < 1 ? sal_True : sal_False; }
+ DECL_LINK( secondLevelDispose, XPlugin_Impl* );
+
+ void addPluginEventListener( PluginEventListener* pListener )
+ { m_aPEventListeners.push_back( pListener ); }
+ void checkListeners( const char* normalizedURL );
+
+ void initInstance(
+ const ::com::sun::star::plugin::PluginDescription& rDescription,
+ const Sequence< ::rtl::OUString >& argn,
+ const Sequence< ::rtl::OUString >& argv,
+ sal_Int16 mode );
+
+ const ::rtl::OUString& getRefererURL() { return m_aURL; }
+ ::rtl::OUString getCreationURL();
+
+ PluginStream* getStreamFromNPStream( NPStream* );
+
+ const SystemEnvData* getSysChildSysData()
+ { return _pSysChild->GetSystemData(); }
+
+ const Reference< ::com::sun::star::plugin::XPluginContext > & getPluginContext() const
+ { return m_rBrowserContext; }
+ void setPluginContext( const Reference< ::com::sun::star::plugin::XPluginContext > & );
+
+ void secondLevelDispose();
+
+// static const Reference< ::com::sun::star::reflection::XIdlClass > & staticGetIdlClass();
+
+ // XInterface
+ virtual Any SAL_CALL queryInterface( const Type& );
+ virtual void SAL_CALL acquire() { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() { OWeakAggObject::release(); }
+
+ // OWeakAggObject
+ virtual Any SAL_CALL queryAggregation( const Type& );
+
+ // PluginContol_Impl
+ virtual void SAL_CALL dispose();
+ virtual void SAL_CALL createPeer( const Reference< ::com::sun::star::awt::XToolkit > & xToolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & Parent) throw( RuntimeException );
+
+ virtual sal_Bool SAL_CALL setModel( const Reference< ::com::sun::star::awt::XControlModel > & Model ) throw( RuntimeException );
+ virtual Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel(void) const throw( RuntimeException )
+ { return m_xModel; }
+
+ virtual void SAL_CALL setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags ) throw( RuntimeException );
+
+ // ::com::sun::star::plugin::XPlugin
+ virtual sal_Bool SAL_CALL provideNewStream(const ::rtl::OUString& mimetype, const Reference< ::com::sun::star::io::XActiveDataSource > & stream, const ::rtl::OUString& url, sal_Int32 length, sal_Int32 lastmodified, sal_Bool isfile);
+
+ // ::com::sun::star::beans::XPropertyChangeListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rSource );
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvent );
+};
+
+class PluginManager
+{
+private:
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ ::std::list<PluginComm*> m_aPluginComms;
+ ::std::list<XPlugin_Impl*> m_aAllPlugins;
+ ::osl::Mutex m_aPluginMutex;
+
+ static PluginManager* pManager;
+
+ PluginManager();
+ ~PluginManager();
+public:
+
+ static PluginManager& get();
+ static void setServiceFactory( const Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ static const Sequence< ::rtl::OUString >& getAdditionalSearchPaths();
+
+ ::std::list<PluginComm*>& getPluginComms() { return m_aPluginComms; }
+ ::std::list<XPlugin_Impl*>& getPlugins() { return m_aAllPlugins; }
+ ::osl::Mutex& getPluginMutex() { return m_aPluginMutex; }
+};
+
+class XPluginManager_Impl :
+ public ::cppu::WeakAggImplHelper1< ::com::sun::star::plugin::XPluginManager >
+{
+ Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+public:
+ XPluginManager_Impl( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
+ virtual ~XPluginManager_Impl();
+
+ static XPlugin_Impl* getXPluginFromNPP( NPP );
+ static XPlugin_Impl* getFirstXPlugin();
+ static XPlugin_Impl* getPluginImplementation( const Reference< ::com::sun::star::plugin::XPlugin >& plugin );
+
+ virtual Reference< ::com::sun::star::plugin::XPluginContext > SAL_CALL createPluginContext();
+
+ // has to be implemented per system
+ virtual Sequence< ::com::sun::star::plugin::PluginDescription > SAL_CALL getPluginDescriptions(void) throw( );
+
+ virtual Reference< ::com::sun::star::plugin::XPlugin > SAL_CALL createPlugin( const Reference< ::com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const ::com::sun::star::plugin::PluginDescription& plugintype) throw( RuntimeException,::com::sun::star::plugin::PluginException );
+
+ virtual Reference< ::com::sun::star::plugin::XPlugin > SAL_CALL createPluginFromURL( const Reference< ::com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const Reference< ::com::sun::star::awt::XToolkit > & toolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & parent, const ::rtl::OUString& url );
+
+ virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( );
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw();
+
+ Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( );
+ static Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( );
+ static ::rtl::OUString getImplementationName_Static() throw( )
+ {
+ /** the soplayer uses this name in its source! maybe not after 5.2 */
+ return ::rtl::OUString::createFromAscii( "com.sun.star.extensions.PluginManager" );
+ }
+};
+Reference< XInterface > SAL_CALL PluginManager_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & ) throw( Exception );
+
+enum PluginStreamType { InputStream, OutputStream };
+
+class PluginStream
+{
+protected:
+ XPlugin_Impl* m_pPlugin;
+ NPStream m_aNPStream;
+public:
+ PluginStream( XPlugin_Impl* pPlugin,
+ const char* url, sal_uInt32 len, sal_uInt32 lastmod );
+ virtual ~PluginStream();
+
+ NPStream* getStream() { return &m_aNPStream; }
+ XPlugin_Impl* getPlugin() { return m_pPlugin; }
+
+ virtual PluginStreamType getStreamType() = 0;
+};
+
+class PluginInputStream :
+ public PluginStream,
+ public ::cppu::WeakAggImplHelper2<
+ ::com::sun::star::io::XOutputStream,
+ ::com::sun::star::io::XConnectable
+ >
+{
+private:
+ UINT32 m_nMode;
+ UINT32 m_nWritePos;
+
+ Reference< ::com::sun::star::io::XActiveDataSource > m_xSource;
+ // hold a reference on input until closeOutput is called
+
+ Reference< ::com::sun::star::io::XConnectable > m_xPredecessor;
+ Reference< ::com::sun::star::io::XConnectable > m_xSuccessor;
+
+ SvFileStream m_aFileStream;
+public:
+ PluginInputStream( XPlugin_Impl* pPlugin,
+ const char* url, UINT32 len, UINT32 lastmod );
+
+ PluginInputStream() : PluginStream( NULL, NULL, 0, 0 ) {}
+
+ virtual ~PluginInputStream();
+
+ virtual PluginStreamType getStreamType();
+
+ void setMode( UINT32 nMode );
+ UINT32 read( UINT32 offset, sal_Int8* buffer, UINT32 size );
+ void setSource( const Reference< ::com::sun::star::io::XActiveDataSource >& xSource ) { m_xSource = xSource; }
+
+ // XOutputStream
+ virtual void SAL_CALL writeBytes( const Sequence<sal_Int8>& );
+ virtual void SAL_CALL flush();
+ virtual void SAL_CALL closeOutput();
+
+ // XConnectable
+ virtual void SAL_CALL setPredecessor( const Reference< ::com::sun::star::io::XConnectable >& xPredecessor )
+ { m_xPredecessor = xPredecessor; }
+ virtual Reference< ::com::sun::star::io::XConnectable > SAL_CALL getPredecessor()
+ { return m_xPredecessor; }
+
+ virtual void SAL_CALL setSuccessor( const Reference< ::com::sun::star::io::XConnectable >& xSuccessor )
+ { m_xSuccessor = xSuccessor; }
+ virtual Reference< ::com::sun::star::io::XConnectable > SAL_CALL getSuccessor()
+ { return m_xSuccessor; }
+};
+
+class PluginOutputStream : public PluginStream
+{
+private:
+ Reference< ::com::sun::star::io::XOutputStream > m_xStream;
+public:
+ PluginOutputStream( XPlugin_Impl* pPlugin, const char* url,
+ sal_uInt32 len, sal_uInt32 lastmod );
+ virtual ~PluginOutputStream();
+
+ virtual PluginStreamType getStreamType();
+
+ Reference< ::com::sun::star::io::XOutputStream > & getOutputStream() { return m_xStream; }
+};
+
+class PluginEventListener :
+ public ::cppu::WeakAggImplHelper1< ::com::sun::star::lang::XEventListener >
+{
+private:
+ XPlugin_Impl* m_pPlugin;
+ Reference< ::com::sun::star::plugin::XPlugin > m_xPlugin; // just to hold the plugin
+ char* m_pUrl;
+ char* m_pNormalizedUrl;
+ void* m_pNotifyData;
+public:
+ PluginEventListener( XPlugin_Impl*,
+ const char* url,
+ const char* normurl,
+ void* notifyData );
+ virtual ~PluginEventListener();
+
+ const char* getURL() { return m_pUrl; }
+ const char* getNormalizedURL() { return m_pNormalizedUrl; }
+ void* getNotifyData() { return m_pNotifyData; }
+
+ // ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source );
+};
+
+#endif
diff --git a/extensions/source/plugin/inc/plugin/model.hxx b/extensions/source/plugin/inc/plugin/model.hxx
new file mode 100644
index 000000000..5265b6201
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/model.hxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * $RCSfile: model.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __PLUGIN_MODEL_HXX
+#define __PLUGIN_MODEL_HXX
+
+#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_
+#include <com/sun/star/io/XObjectInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_
+#include <com/sun/star/io/XPersistObject.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
+#include <com/sun/star/lang/XServiceName.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
+#include <com/sun/star/awt/XControlModel.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
+#include <com/sun/star/awt/XControl.hpp>
+#endif
+
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/weakagg.hxx>
+#include <rtl/alloc.h>
+
+#include <stl/list>
+
+using namespace com::sun::star::uno;
+
+class BroadcasterHelperHolder
+{
+protected:
+ ::cppu::OBroadcastHelper m_aHelper;
+public:
+ BroadcasterHelperHolder( ::osl::Mutex& rMutex ) :
+ m_aHelper( rMutex ) {}
+ ~BroadcasterHelperHolder() {}
+
+ ::cppu::OBroadcastHelper& getHelper() { return m_aHelper; }
+
+};
+
+class PluginModel : public BroadcasterHelperHolder,
+ public ::cppu::OPropertySetHelper,
+ public ::cppu::OPropertyArrayHelper,
+ public ::cppu::OWeakAggObject,
+ public ::com::sun::star::lang::XComponent,
+ public ::com::sun::star::io::XPersistObject,
+ public ::com::sun::star::awt::XControlModel
+{
+ private:
+ ::rtl::OUString m_aCreationURL;
+
+ ::std::list< Reference< ::com::sun::star::lang::XEventListener > >
+ m_aDisposeListeners;
+ public:
+ // these are here to force memory de/allocation to sal lib.
+ static void * SAL_CALL operator new( size_t nSize ) throw()
+ { return ::rtl_allocateMemory( nSize ); }
+ static void SAL_CALL operator delete( void * pMem ) throw()
+ { ::rtl_freeMemory( pMem ); }
+
+ PluginModel();
+ PluginModel( const ::rtl::OUString& );
+ virtual ~PluginModel();
+
+
+ const ::rtl::OUString& getCreationURL() { return m_aCreationURL; }
+
+ // XInterface
+ virtual Any SAL_CALL queryInterface( const Type& rType )
+ { return OWeakAggObject::queryInterface( rType ); }
+ virtual void SAL_CALL acquire() { OWeakAggObject::acquire(); }
+ virtual void SAL_CALL release() { OWeakAggObject::release(); }
+
+ virtual Any SAL_CALL queryAggregation( const Type& );
+
+
+ // ::com::sun::star::lang::XTypeProvider
+
+ // ::com::sun::star::lang::XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName() throw( );
+
+ sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( );
+ Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( );
+ static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static(void) throw( );
+ static ::rtl::OUString SAL_CALL getImplementationName_Static() throw( )
+ {
+ /** the soplayer uses this name in its source! maybe not after 5.2 */
+ return ::rtl::OUString::createFromAscii( "com.sun.star.extensions.PluginModel" );
+ }
+
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue );
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
+ const Any& rValue )
+ throw( ::com::sun::star::lang::IllegalArgumentException );
+ virtual void SAL_CALL getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const;
+ virtual Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo();
+
+ // ::com::sun::star::io::XPersistObject
+ virtual ::rtl::OUString SAL_CALL getServiceName();
+ virtual void SAL_CALL write(const Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream);
+ virtual void SAL_CALL read(const Reference< ::com::sun::star::io::XObjectInputStream > & InStream);
+
+ // ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l );
+ virtual void SAL_CALL removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l );
+ virtual void SAL_CALL dispose();
+};
+Reference< XInterface > SAL_CALL PluginModel_CreateInstance( const Reference< ::com::sun::star::lang::XMultiServiceFactory > & ) throw( Exception );
+
+#endif // __PLUGIN_MODEL_HXX
diff --git a/extensions/source/plugin/inc/plugin/multiplx.hxx b/extensions/source/plugin/inc/plugin/multiplx.hxx
new file mode 100644
index 000000000..3a4f4a6f8
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/multiplx.hxx
@@ -0,0 +1,249 @@
+/*************************************************************************
+ *
+ * $RCSfile: multiplx.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _MRC_MULTIPLX_HXX
+#define _MRC_MULTIPLX_HXX
+
+#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
+#include <com/sun/star/awt/XControl.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XKEYLISTENER_HPP_
+#include <com/sun/star/awt/XKeyListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XPAINTLISTENER_HPP_
+#include <com/sun/star/awt/XPaintListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYEVENT_HPP_
+#include <com/sun/star/awt/KeyEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYMODIFIER_HPP_
+#include <com/sun/star/awt/KeyModifier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMOUSEMOTIONLISTENER_HPP_
+#include <com/sun/star/awt/XMouseMotionListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FOCUSEVENT_HPP_
+#include <com/sun/star/awt/FocusEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOWLISTENER_HPP_
+#include <com/sun/star/awt/XWindowListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XACTIVATELISTENER_HPP_
+#include <com/sun/star/awt/XActivateListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_MOUSEEVENT_HPP_
+#include <com/sun/star/awt/MouseEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTOPWINDOWLISTENER_HPP_
+#include <com/sun/star/awt/XTopWindowListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_PAINTEVENT_HPP_
+#include <com/sun/star/awt/PaintEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_INPUTEVENT_HPP_
+#include <com/sun/star/awt/InputEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYGROUP_HPP_
+#include <com/sun/star/awt/KeyGroup.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEY_HPP_
+#include <com/sun/star/awt/Key.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_WINDOWEVENT_HPP_
+#include <com/sun/star/awt/WindowEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XMOUSELISTENER_HPP_
+#include <com/sun/star/awt/XMouseListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_KEYFUNCTION_HPP_
+#include <com/sun/star/awt/KeyFunction.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FOCUSCHANGEREASON_HPP_
+#include <com/sun/star/awt/FocusChangeReason.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_MOUSEBUTTON_HPP_
+#include <com/sun/star/awt/MouseButton.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XFOCUSLISTENER_HPP_
+#include <com/sun/star/awt/XFocusListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
+#include <com/sun/star/awt/XTopWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
+#include <com/sun/star/awt/PosSize.hpp>
+#endif
+
+#include <cppuhelper/implbase7.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+using namespace com::sun::star::uno;
+
+struct MRCListenerMultiplexerHelper_Mutex
+{
+ ::osl::Mutex aMutex;
+};
+
+class MRCListenerMultiplexerHelper :
+ public MRCListenerMultiplexerHelper_Mutex,
+
+ public ::cppu::WeakAggImplHelper7<
+ ::com::sun::star::awt::XFocusListener,
+ ::com::sun::star::awt::XWindowListener,
+ ::com::sun::star::awt::XKeyListener,
+ ::com::sun::star::awt::XMouseListener,
+ ::com::sun::star::awt::XMouseMotionListener,
+ ::com::sun::star::awt::XPaintListener,
+ ::com::sun::star::awt::XTopWindowListener >
+{
+public:
+ /**
+ * Create a Multiplexer of XWindowEvents.
+ *
+ * @param rControl The control. All listeners think that this is the original
+ * broadcaster.
+ * @param rPeer The peer from which the original events are dispatched. Null is
+ * allowed.
+ */
+ MRCListenerMultiplexerHelper( const Reference< ::com::sun::star::awt::XWindow > & rControl, const Reference< ::com::sun::star::awt::XWindow > & rPeer );
+
+ /**
+ * Remove all listeners from the previous set peer and add the needed listeners to rPeer.
+ * @param rPeer The peer from which the original events are dispatched. Null is
+ * allowed.
+ */
+ void setPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer );
+
+ /**
+ * Remove all listeners and send a disposing message.
+ */
+ void disposeAndClear();
+
+ /**
+ * Add the specified listener to the source.
+ */
+ void advise( const Type& type, const Reference< XInterface > & listener);
+ /**
+ * Remove the specified listener from the source.
+ */
+ void unadvise(const Type& type, const Reference< XInterface > & listener);
+
+ // ::com::sun::star::lang::XEventListener
+ void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source);
+ // ::com::sun::star::awt::XFocusListener
+ void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e);
+ void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e);
+ // ::com::sun::star::awt::XWindowListener
+ void SAL_CALL windowResized(const ::com::sun::star::awt::WindowEvent& e);
+ void SAL_CALL windowMoved(const ::com::sun::star::awt::WindowEvent& e);
+ void SAL_CALL windowShown(const ::com::sun::star::lang::EventObject& e);
+ void SAL_CALL windowHidden(const ::com::sun::star::lang::EventObject& e);
+ // ::com::sun::star::awt::XKeyListener
+ void SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& e );
+ void SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& e );
+ // ::com::sun::star::awt::XMouseListener
+ void SAL_CALL mousePressed(const ::com::sun::star::awt::MouseEvent& e);
+ void SAL_CALL mouseReleased(const ::com::sun::star::awt::MouseEvent& e);
+ void SAL_CALL mouseEntered(const ::com::sun::star::awt::MouseEvent& e);
+ void SAL_CALL mouseExited(const ::com::sun::star::awt::MouseEvent& e);
+ // ::com::sun::star::awt::XMouseMotionListener
+ void SAL_CALL mouseDragged(const ::com::sun::star::awt::MouseEvent& e);
+ void SAL_CALL mouseMoved(const ::com::sun::star::awt::MouseEvent& e);
+ // ::com::sun::star::awt::XPaintListener
+ void SAL_CALL windowPaint(const ::com::sun::star::awt::PaintEvent& e);
+ // ::com::sun::star::awt::XTopWindowListener
+ void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e );
+ void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e );
+ void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e );
+ void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e );
+ void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e );
+ void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e );
+ void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e );
+protected:
+ /**
+ * Remove the listener with the uik rUik from the peer rPeer.
+ * @param rPeer the peer from which the listener is removed.
+ * @param rUik the listener uik, which specify the type of the listener.
+ */
+ void adviseToPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type );
+ /**
+ * Add the listener with the uik rUik to the peer rPeer.
+ * @param rPeer the peer to which the listener is added.
+ * @param rUik the listener uik, which specify the type of the listener.
+ */
+ void unadviseFromPeer( const Reference< ::com::sun::star::awt::XWindow > & rPeer, const Type & type );
+private:
+ /** The source of the events. Normally this is the peer object.*/
+ Reference< ::com::sun::star::awt::XWindow > xPeer;
+ WeakReference< ::com::sun::star::awt::XControl > xControl;
+ ::cppu::OMultiTypeInterfaceContainerHelper aListenerHolder;
+
+
+ MRCListenerMultiplexerHelper( const MRCListenerMultiplexerHelper & );
+ MRCListenerMultiplexerHelper & operator = ( const MRCListenerMultiplexerHelper & );
+};
+
+#endif // _MRC_MULTIPLX_HXX
+
+
+
diff --git a/extensions/source/plugin/inc/plugin/plcom.hxx b/extensions/source/plugin/inc/plugin/plcom.hxx
new file mode 100644
index 000000000..4c2ac322c
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/plcom.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * $RCSfile: plcom.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __PLUGIN_INC_PLCOM_HXX
+#define __PLUGIN_INC_PLCOM_HXX
+
+#include <tools/string.hxx>
+#include <list>
+
+class PluginComm
+{
+protected:
+ int m_nRefCount;
+ ::rtl::OString m_aLibName;
+ std::list< String > m_aFilesToDelete;
+public:
+ PluginComm( const ::rtl::OString& rLibName );
+ virtual ~PluginComm();
+
+ int getRefCount() { return m_nRefCount; }
+ void addRef() { m_nRefCount++; }
+ void decRef() { m_nRefCount--; if( ! m_nRefCount ) delete this; }
+
+ const ::rtl::OString& getLibName() { return m_aLibName; }
+ void setLibName( const ::rtl::OString& rName ) { m_aLibName = rName; }
+
+ void addFileToDelete( const String& filename )
+ { m_aFilesToDelete.push_back( filename ); }
+
+ virtual NPError NPP_Destroy( NPP instance, NPSavedData** save ) = 0;
+ virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream,
+ NPError reason ) = 0;
+ virtual void* NPP_GetJavaClass() = 0;
+ virtual NPError NPP_Initialize() = 0;
+ virtual NPError NPP_New( NPMIMEType pluginType, NPP instance,
+ uint16 mode, int16 argc,
+ char* argn[], char* argv[],
+ NPSavedData *saved ) = 0;
+ virtual NPError NPP_NewStream( NPP instance, NPMIMEType type,
+ NPStream* stream,
+ NPBool seekable, uint16* stype ) = 0;
+ virtual void NPP_Print( NPP instance, NPPrint* platformPrint ) = 0;
+ virtual NPError NPP_SetWindow( NPP instance, NPWindow* window ) = 0;
+ virtual void NPP_Shutdown() = 0;
+ virtual void NPP_StreamAsFile( NPP instance, NPStream* stream,
+ const char* fname ) = 0;
+ virtual void NPP_URLNotify( NPP instance, const char* url,
+ NPReason reason, void* notifyData ) = 0;
+ virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset,
+ int32 len, void* buffer ) = 0;
+ virtual int32 NPP_WriteReady( NPP instance, NPStream* stream ) = 0;
+ virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void* value ) = 0;
+ virtual NPError NPP_SetValue( NPP instance, NPNVariable variable,
+ void *value) = 0;
+};
+
+#endif
diff --git a/extensions/source/plugin/inc/plugin/plctrl.hxx b/extensions/source/plugin/inc/plugin/plctrl.hxx
new file mode 100644
index 000000000..223097dac
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/plctrl.hxx
@@ -0,0 +1,276 @@
+/*************************************************************************
+ *
+ * $RCSfile: plctrl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __PLCTRL_HXX
+#define __PLCTRL_HXX
+
+#include <tools/debug.hxx>
+
+#include <cppuhelper/weak.hxx>
+#include <plugin/multiplx.hxx>
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HPP_
+#include <com/sun/star/beans/PropertyValues.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HPP_
+#include <com/sun/star/beans/PropertyState.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XFASTPROPERTYSET_HPP_
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XVETOABLECHANGELISTENER_HPP_
+#include <com/sun/star/beans/XVetoableChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
+#include <com/sun/star/beans/XPropertyState.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATECHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTIESCHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HPP_
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HPP_
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATECHANGEEVENT_HPP_
+#include <com/sun/star/beans/PropertyStateChangeEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINERPEER_HPP_
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLWINDOWPEER_HPP_
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROLMODEL_HPP_
+#include <com/sun/star/awt/XControlModel.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XUNOCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XUnoControlContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
+#include <com/sun/star/awt/XControlContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_VCLWINDOWPEERATTRIBUTE_HPP_
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XVCLCONTAINER_HPP_
+#include <com/sun/star/awt/XVclContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
+#include <com/sun/star/awt/XControl.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XTOPWINDOW_HPP_
+#include <com/sun/star/awt/XTopWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
+#include <com/sun/star/awt/PosSize.hpp>
+#endif
+
+#include <cppuhelper/implbase5.hxx>
+
+#include <list>
+
+using namespace com::sun::star::uno;
+
+class SystemChildWindow;
+
+//==================================================================================================
+class PluginControl_Impl : public ::cppu::WeakAggImplHelper5<
+ ::com::sun::star::awt::XControl,
+ ::com::sun::star::awt::XControlModel,
+ ::com::sun::star::awt::XWindow,
+ ::com::sun::star::awt::XFocusListener,
+ ::com::sun::star::awt::XView >
+{
+public:
+ // ::com::sun::star::awt::XControl
+ virtual void SAL_CALL setContext( const Reference< XInterface > & xContext ) throw( RuntimeException )
+ { _xContext = xContext; }
+ virtual Reference< XInterface > SAL_CALL getContext() throw( RuntimeException )
+ { return _xContext; }
+
+ virtual sal_Bool SAL_CALL setModel( const Reference< ::com::sun::star::awt::XControlModel > & Model ) throw( RuntimeException )
+ { DBG_ERROR( "### setModel() illegal on plugincontrol!" ); return sal_False; }
+ virtual Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel() throw( RuntimeException )
+ { return (::com::sun::star::awt::XControlModel*)this; }
+
+ virtual Reference< ::com::sun::star::awt::XView > SAL_CALL getView() throw( RuntimeException )
+ { return (::com::sun::star::awt::XView*)this; }
+
+ virtual sal_Bool SAL_CALL isTransparent() throw( RuntimeException )
+ { return sal_False; }
+
+ virtual void SAL_CALL setDesignMode( sal_Bool bOn ) throw( RuntimeException );
+ virtual sal_Bool SAL_CALL isDesignMode() throw( RuntimeException )
+ { return _bInDesignMode; }
+
+ virtual void SAL_CALL createPeer( const Reference< ::com::sun::star::awt::XToolkit > & xToolkit, const Reference< ::com::sun::star::awt::XWindowPeer > & Parent) throw( RuntimeException );
+ virtual Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getPeer() throw( RuntimeException )
+ { return _xPeer; }
+
+ // ::com::sun::star::awt::XWindow
+ virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw( RuntimeException );
+ virtual void SAL_CALL setEnable( sal_Bool bEnable ) throw( RuntimeException );
+ virtual void SAL_CALL setFocus(void) throw( RuntimeException );
+
+ virtual void SAL_CALL setPosSize( sal_Int32 nX_, sal_Int32 nY_, sal_Int32 nWidth_, sal_Int32 nHeight_, sal_Int16 nFlags ) throw( RuntimeException );
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize(void) throw( RuntimeException );
+
+ virtual void SAL_CALL addWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removeWindowListener( const Reference< ::com::sun::star::awt::XWindowListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL addFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removeFocusListener( const Reference< ::com::sun::star::awt::XFocusListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL addKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removeKeyListener( const Reference< ::com::sun::star::awt::XKeyListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL addMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removeMouseListener( const Reference< ::com::sun::star::awt::XMouseListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL addMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removeMouseMotionListener( const Reference< ::com::sun::star::awt::XMouseMotionListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL addPaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removePaintListener( const Reference< ::com::sun::star::awt::XPaintListener > & l ) throw( RuntimeException );
+
+ // ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject & rSource ) throw( RuntimeException );
+ // ::com::sun::star::awt::XFocusListener
+ virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent & rEvt ) throw( RuntimeException );
+ virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent & rEvt ) throw( RuntimeException );
+
+ // ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL addEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l ) throw( RuntimeException );
+ virtual void SAL_CALL removeEventListener( const Reference< ::com::sun::star::lang::XEventListener > & l ) throw( RuntimeException );
+
+ virtual void SAL_CALL dispose() throw( RuntimeException );
+
+ // ::com::sun::star::awt::XView
+ virtual sal_Bool SAL_CALL setGraphics( const Reference< ::com::sun::star::awt::XGraphics > & aDevice ) throw( RuntimeException )
+ { return sal_False; }
+ virtual Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics(void) throw( RuntimeException )
+ { return Reference< ::com::sun::star::awt::XGraphics > (); }
+
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize(void) throw( RuntimeException )
+ { return ::com::sun::star::awt::Size(_nWidth, _nHeight); }
+
+ virtual void SAL_CALL draw( sal_Int32 x, sal_Int32 y ) throw( RuntimeException );
+ virtual void SAL_CALL setZoom( float ZoomX, float ZoomY ) throw( RuntimeException );
+
+public:
+ PluginControl_Impl();
+ virtual ~PluginControl_Impl();
+
+ MRCListenerMultiplexerHelper* getMultiplexer();
+
+protected:
+ void releasePeer();
+
+protected:
+ ::std::list< Reference< ::com::sun::star::lang::XEventListener > > _aDisposeListeners;
+ MRCListenerMultiplexerHelper* _pMultiplexer;
+
+ Reference< XInterface > _xContext;
+
+ sal_Int32 _nX;
+ sal_Int32 _nY;
+ sal_Int32 _nWidth;
+ sal_Int32 _nHeight;
+ sal_Int16 _nFlags;
+
+ sal_Bool _bVisible;
+ sal_Bool _bInDesignMode;
+ sal_Bool _bEnable;
+
+ SystemChildWindow* _pSysChild;
+ Reference< ::com::sun::star::awt::XWindowPeer > _xPeer;
+ Reference< ::com::sun::star::awt::XWindow > _xPeerWindow;
+
+ Reference< ::com::sun::star::awt::XWindow > _xParentWindow;
+ Reference< ::com::sun::star::awt::XWindowPeer > _xParentPeer;
+};
+
+#endif
+
+
diff --git a/extensions/source/plugin/inc/plugin/unx/sysplug.hxx b/extensions/source/plugin/inc/plugin/unx/sysplug.hxx
new file mode 100644
index 000000000..db7a8ea95
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/unx/sysplug.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: sysplug.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __PLUGIN_INC_UNXPLUG_HXX
+#define __PLUGIN_INC_UNXPLUG_HXX
+
+#include <cstdio>
+
+#include <prex.h>
+#define XP_UNIX
+#include <npsdk/npupp.h>
+#include <npsdk/npapi.h>
+#include <postx.h>
+
+#include <plugin/plcom.hxx>
+#include <vcl/sysdata.hxx>
+
+class UnxPluginComm : public PluginComm
+{
+private:
+ void* m_pLibrary;
+ NPPluginFuncs m_aFuncs;
+ BOOL m_bInit;
+public:
+ UnxPluginComm( const ::rtl::OString& library );
+ virtual ~UnxPluginComm();
+
+ virtual NPError NPP_Destroy( NPP instance, NPSavedData** save );
+ virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream,
+ NPError reason );
+ virtual void* NPP_GetJavaClass();
+ virtual NPError NPP_Initialize();
+ virtual NPError NPP_New( NPMIMEType pluginType, NPP instance,
+ uint16 mode, int16 argc,
+ char* argn[], char* argv[], NPSavedData *saved );
+ virtual NPError NPP_NewStream( NPP instance, NPMIMEType type,
+ NPStream* stream,
+ NPBool seekable, uint16* stype );
+ virtual void NPP_Print( NPP instance, NPPrint* platformPrint );
+ virtual NPError NPP_SetWindow( NPP instance, NPWindow* window );
+ virtual void NPP_Shutdown();
+ virtual void NPP_StreamAsFile( NPP instance, NPStream* stream,
+ const char* fname );
+ virtual void NPP_URLNotify( NPP instance, const char* url, NPReason reason,
+ void* notifyData );
+ virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset,
+ int32 len, void* buffer );
+ virtual int32 NPP_WriteReady( NPP instance, NPStream* stream );
+ virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void* value );
+ virtual NPError NPP_SetValue( NPP instance, NPNVariable variable,
+ void *value);
+};
+
+#endif
diff --git a/extensions/source/plugin/inc/plugin/win/sysplug.hxx b/extensions/source/plugin/inc/plugin/win/sysplug.hxx
new file mode 100644
index 000000000..71d74ff4b
--- /dev/null
+++ b/extensions/source/plugin/inc/plugin/win/sysplug.hxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * $RCSfile: sysplug.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef __PLUGIN_INC_WINPLUG_HXX
+#define __PLUGIN_INC_WINPLUG_HXX
+
+#if _MSC_VER >= 1200
+#include <tools/prewin.h>
+#else
+#include <tools/presys.h>
+#endif
+#if STLPORT_VERSION < 321
+#include <list.h>
+#include <map.h>
+#include <algo.h>
+#include <function.h>
+#endif
+#include <windows.h>
+#include <tchar.h>
+#include <winbase.h>
+#if _MSC_VER >= 1200
+#include <tools/postwin.h>
+#else
+#include <tools/postsys.h>
+#endif
+#if STLPORT_VERSION >= 321
+#include <stl/list>
+#include <stl/map>
+#include <stl/algorithm>
+#endif
+
+#pragma pack( push, 8 )
+#include <npsdk/npapi.h>
+#include <npsdk/npupp.h>
+#pragma pack( pop, 8 )
+
+#include <plugin/plcom.hxx>
+
+
+//==================================================================================================
+class PluginComm_Impl
+ : public PluginComm
+{
+public:
+ PluginComm_Impl( const rtl::OUString& rMIME, const rtl::OUString& rName, HWND hWnd );
+ virtual ~PluginComm_Impl();
+
+public:
+ virtual NPError NPP_Destroy( NPP instance, NPSavedData** save );
+ virtual NPError NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason );
+ virtual void * NPP_GetJavaClass();
+ virtual NPError NPP_Initialize();
+ virtual NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
+ char* argn[], char* argv[], NPSavedData *saved );
+ virtual NPError NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream,
+ NPBool seekable, uint16* stype );
+ virtual void NPP_Print( NPP instance, NPPrint* platformPrint );
+ virtual NPError NPP_SetWindow( NPP instance, NPWindow* window );
+ virtual void NPP_Shutdown();
+ virtual void NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname );
+ virtual void NPP_URLNotify( NPP instance, const char* url,
+ NPReason reason, void* notifyData );
+ virtual int32 NPP_Write( NPP instance, NPStream* stream, int32 offset,
+ int32 len, void* buffer );
+ virtual int32 NPP_WriteReady( NPP instance, NPStream* stream );
+ virtual NPError NPP_GetValue( NPP instance, NPPVariable variable, void *ret_alue );
+ virtual NPError NPP_SetValue( NPP instance, NPNVariable variable, void *ret_alue );
+
+private:
+ BOOL retrieveFunction( TCHAR* pName, void** ppFunc ) const;
+
+private:
+ HINSTANCE _plDLL;
+
+ NPPluginFuncs _NPPfuncs;
+};
+
+
+#endif
+
+
diff --git a/extensions/source/plugin/unx/makefile.mk b/extensions/source/plugin/unx/makefile.mk
new file mode 100644
index 000000000..58a4c2353
--- /dev/null
+++ b/extensions/source/plugin/unx/makefile.mk
@@ -0,0 +1,84 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..$/..
+
+PRJNAME=plugin
+TARGET=plunx
+TARGETTYPE=CUI
+
+.INCLUDE : ..$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES=\
+ $(SLO)$/sysplug.obj \
+ $(SLO)$/unxmgr.obj
+
+
+APP1DEF= $(MISC)$/$(TARGET).def
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.INCLUDE : ..$/util$/target.pmk
diff --git a/extensions/source/plugin/unx/sysplug.cxx b/extensions/source/plugin/unx/sysplug.cxx
new file mode 100644
index 000000000..7cec283fe
--- /dev/null
+++ b/extensions/source/plugin/unx/sysplug.cxx
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * $RCSfile: sysplug.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string> // workaround for SUNPRO workshop include conflicts
+
+#include <plugin/impl.hxx>
+
+#include <dlfcn.h>
+
+extern NPNetscapeFuncs aNPNFuncs;
+
+UnxPluginComm::UnxPluginComm( const ::rtl::OString& library ) :
+ PluginComm( library ),
+ m_pLibrary( NULL ),
+ m_bInit( FALSE )
+{
+ m_pLibrary = dlopen( library.getStr(), RTLD_NOW );
+
+ // initialize plugin function table
+ memset( &m_aFuncs, 0, sizeof( m_aFuncs ) );
+ m_aFuncs.size = sizeof( m_aFuncs );
+ m_aFuncs.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
+
+ if( m_pLibrary )
+ {
+ NPError (*initFunc)(NPNetscapeFuncs*, NPPluginFuncs* );
+ NPError (*initPlugin)();
+
+ initFunc = (NPError(*)(NPNetscapeFuncs*,NPPluginFuncs*))dlsym( m_pLibrary, "NP_Initialize" );
+ initPlugin = (NPError(*)())dlsym( m_pLibrary, "NPP_Initialize" );
+#ifdef DEBUG
+ if( ! initFunc )
+ fprintf( stderr, "could not get Symbol NP_Initialize\n" );
+ if( ! initPlugin )
+ fprintf( stderr, "could not get Symbol NPP_Initialize\n" );
+#endif
+ if( initFunc && initPlugin )
+ {
+ NPError aErr = initFunc( &aNPNFuncs, &m_aFuncs );
+#ifdef DEBUG
+ fprintf( stderr, "NP_Initialize returns %d\n", aErr );
+#endif
+ if( aErr )
+ {
+ aErr = initPlugin();
+#ifdef DEBUG
+ fprintf( stderr, "NPP_Initialize returns %d\n", aErr );
+#endif
+ }
+
+ m_aFuncs.newp = (NPP_NewUPP)dlsym( m_pLibrary, "NPP_New" );
+ m_aFuncs.destroy = (NPP_DestroyUPP)dlsym( m_pLibrary, "NPP_Destroy" );
+ m_aFuncs.setwindow = (NPP_SetWindowUPP)dlsym( m_pLibrary, "NPP_SetWindow" );
+ m_aFuncs.newstream = (NPP_NewStreamUPP)dlsym( m_pLibrary, "NPP_NewStream" );
+ m_aFuncs.destroystream = (NPP_DestroyStreamUPP)dlsym( m_pLibrary, "NPP_DestroyStream" );
+ m_aFuncs.asfile = (NPP_StreamAsFileUPP)dlsym( m_pLibrary, "NPP_StreamAsFile" );
+ m_aFuncs.writeready = (NPP_WriteReadyUPP)dlsym( m_pLibrary, "NPP_WriteReady" );
+ m_aFuncs.write = (NPP_WriteUPP)dlsym( m_pLibrary, "NPP_Write" );
+ m_aFuncs.print = (NPP_PrintUPP)dlsym( m_pLibrary, "NPP_Print" );
+ m_aFuncs.event = NULL;
+ m_aFuncs.javaClass = NULL;
+ m_aFuncs.urlnotify = (NPP_URLNotifyUPP)dlsym( m_pLibrary, "NPP_URLNotify" );
+ m_aFuncs.getvalue =(NPP_GetValueUPP)dlsym( m_pLibrary, "NPP_GetValue" );
+ m_aFuncs.setvalue =(NPP_SetValueUPP)dlsym( m_pLibrary, "NPP_SetValue" );
+
+ m_bInit = TRUE;
+ }
+ }
+ if( ! m_bInit )
+ {
+ dlclose( m_pLibrary );
+ m_pLibrary = NULL;
+ }
+}
+
+UnxPluginComm::~UnxPluginComm()
+{
+ if( m_bInit && m_pLibrary )
+ {
+ NPP_ShutdownUPP pFunc = (NPP_ShutdownUPP)dlsym( m_pLibrary,"NPP_Shutdown");
+ if( pFunc)
+ pFunc();
+ dlclose( m_pLibrary );
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_Destroy( NPP instance, NPSavedData** save )
+{
+ DBG_ASSERT( m_aFuncs.destroy, "### NPP_Destroy(): null pointer in NPP functions table!" );
+ return (m_aFuncs.destroy
+ ? m_aFuncs.destroy( instance, save )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason )
+{
+ DBG_ASSERT( m_aFuncs.destroystream, "### NPP_DestroyStream(): null pointer in NPP functions table!" );
+ return (m_aFuncs.destroystream
+ ? m_aFuncs.destroystream( instance, stream, reason )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
+ char* argn[], char* argv[], NPSavedData *saved )
+{
+ DBG_ASSERT( m_aFuncs.newp, "### NPP_New(): null pointer in NPP functions table!" );
+ return (m_aFuncs.newp
+ ? m_aFuncs.newp( pluginType, instance, mode, argc, argn, argv, saved )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream,
+ NPBool seekable, uint16* stype )
+{
+ DBG_ASSERT( m_aFuncs.newstream, "### NPP_NewStream(): null pointer in NPP functions table!" );
+ return (m_aFuncs.newstream
+ ? m_aFuncs.newstream( instance, type, stream, seekable, stype )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+void UnxPluginComm::NPP_Print( NPP instance, NPPrint* platformPrint )
+{
+ DBG_ASSERT( m_aFuncs.print, "### NPP_Print(): null pointer in NPP functions table!" );
+ if (m_aFuncs.print)
+ m_aFuncs.print( instance, platformPrint );
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_SetWindow( NPP instance, NPWindow* window )
+{
+ DBG_ASSERT( m_aFuncs.setwindow, "### NPP_SetWindow(): null pointer in NPP functions table!" );
+ return (m_aFuncs.setwindow
+ ? m_aFuncs.setwindow( instance, window )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+void UnxPluginComm::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname )
+{
+ DBG_ASSERT( m_aFuncs.asfile, "### NPP_StreamAsFile(): null pointer in NPP functions table!" );
+ if (m_aFuncs.asfile)
+ m_aFuncs.asfile( instance, stream, fname );
+}
+
+//--------------------------------------------------------------------------------------------------
+void UnxPluginComm::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData )
+{
+ DBG_ASSERT( m_aFuncs.urlnotify, "### NPP_URLNotify(): null pointer in NPP functions table!" );
+ if (m_aFuncs.urlnotify)
+ m_aFuncs.urlnotify( instance, url, reason, notifyData );
+}
+
+//--------------------------------------------------------------------------------------------------
+int32 UnxPluginComm::NPP_Write( NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer )
+{
+ DBG_ASSERT( m_aFuncs.write, "### NPP_Write(): null pointer in NPP functions table!" );
+ return (m_aFuncs.write
+ ? m_aFuncs.write( instance, stream, offset, len, buffer )
+ : 0);
+}
+
+//--------------------------------------------------------------------------------------------------
+int32 UnxPluginComm::NPP_WriteReady( NPP instance, NPStream* stream )
+{
+ DBG_ASSERT( m_aFuncs.writeready, "### NPP_WriteReady(): null pointer in NPP functions table!" );
+ return (m_aFuncs.writeready
+ ? m_aFuncs.writeready( instance, stream )
+ : 0);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_GetValue( NPP instance, NPPVariable variable, void *ret_alue )
+{
+ DBG_ASSERT( m_aFuncs.getvalue, "### NPP_GetValue(): null pointer in NPP functions table!" );
+ return (m_aFuncs.getvalue
+ ? m_aFuncs.getvalue( instance, variable, ret_alue )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_SetValue( NPP instance, NPNVariable variable, void *ret_alue )
+{
+ DBG_ASSERT( m_aFuncs.setvalue, "### NPP_SetValue(): null pointer in NPP functions table!" );
+ return (m_aFuncs.setvalue
+ ? m_aFuncs.setvalue( instance, variable, ret_alue )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+void* UnxPluginComm::NPP_GetJavaClass()
+{
+ DBG_ERROR( "no java class available!" );
+ return 0;
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError UnxPluginComm::NPP_Initialize()
+{
+ return NPERR_NO_ERROR;
+}
+
+//--------------------------------------------------------------------------------------------------
+void UnxPluginComm::NPP_Shutdown()
+{
+}
+
diff --git a/extensions/source/plugin/unx/unxmgr.cxx b/extensions/source/plugin/unx/unxmgr.cxx
new file mode 100644
index 000000000..9ec12f898
--- /dev/null
+++ b/extensions/source/plugin/unx/unxmgr.cxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * $RCSfile: unxmgr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifdef SOLARIS
+#include <limits>
+#endif
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <sys/stat.h>
+#include <dlfcn.h>
+
+#include <vcl/svapp.hxx>
+#include <plugin/impl.hxx>
+
+#include <dirent.h>
+
+// Unix specific implementation
+static ::com::sun::star::plugin::PluginDescription** CheckPlugin( const ByteString& rPath, int& rDescriptions )
+{
+ ::com::sun::star::plugin::PluginDescription** pRet = NULL;
+ rDescriptions = 0;
+
+ struct stat aStat;
+ if( stat( rPath.GetBuffer(), &aStat ) )
+ return NULL;
+ void *pLib = dlopen( rPath.GetBuffer(), RTLD_LAZY );
+ if( ! pLib )
+ return NULL;
+
+ char*(*pNP_GetMIMEDescription)() = (char*(*)())
+ dlsym( pLib, "NP_GetMIMEDescription" );
+ if( pNP_GetMIMEDescription )
+ {
+ ByteString aMIME = pNP_GetMIMEDescription();
+ char cTok = ';';
+ if( aMIME.GetTokenCount( ';' ) > 2 )
+ cTok = ';';
+ if( aMIME.GetTokenCount( ':' ) > 2 )
+ cTok = ':';
+ ByteString aExtension = aMIME.GetToken( 1, cTok );
+ int nExtensions = aExtension.GetTokenCount( ',' );
+ pRet = new ::com::sun::star::plugin::PluginDescription*[ nExtensions ];
+ for( int i = 0; i < nExtensions; i++ )
+ {
+ pRet[i] = new ::com::sun::star::plugin::PluginDescription;
+ pRet[i]->PluginName = String( rPath, gsl_getSystemTextEncoding() );
+ pRet[i]->Mimetype = String( aMIME.GetToken( 0, cTok ), gsl_getSystemTextEncoding() );
+ String aExt( RTL_CONSTASCII_USTRINGPARAM( "*." ) );
+ aExt += String( aExtension.GetToken( i, ',' ).EraseLeadingChars().EraseTrailingChars(), gsl_getSystemTextEncoding() );
+ pRet[i]->Extension = aExt;
+ pRet[i]->Description= String( aMIME.GetToken( 2, cTok ), gsl_getSystemTextEncoding() );
+ }
+ rDescriptions = nExtensions;
+ }
+ // some libraries register atexit handlers when loaded
+ // (e.g. g++ made libraries register global destructors)
+ // not closing them does prevent them to be called when already unloaded
+// dlclose( pLib );
+ return pRet;
+}
+
+Sequence< ::com::sun::star::plugin::PluginDescription > XPluginManager_Impl::getPluginDescriptions()
+{
+ static Sequence< ::com::sun::star::plugin::PluginDescription > aDescriptions;
+ static BOOL bHavePlugins = FALSE;
+ if( ! bHavePlugins )
+ {
+ NAMESPACE_STD(list)< ::com::sun::star::plugin::PluginDescription* > aPlugins;
+ int i;
+
+ // unix: search for plugins in /usr/lib/netscape/plugins,
+ // ~/.netscape/plugins und NPX_PLUGIN_PATH
+ // additionally: search in PluginsPath
+
+ const char* pEnv = getenv( "HOME" );
+
+ String aSearchPath( RTL_CONSTASCII_USTRINGPARAM( "/usr/lib/netscape/plugins:" ) );
+ aSearchPath += String( pEnv ? pEnv : "", gsl_getSystemTextEncoding() );
+ aSearchPath += String( RTL_CONSTASCII_USTRINGPARAM( "/.netscape/plugins:" ) );
+ pEnv = getenv( "NPX_PLUGIN_PATH" );
+ aSearchPath += String( pEnv ? pEnv : "", gsl_getSystemTextEncoding() );
+
+ const Sequence< ::rtl::OUString >& rPaths = PluginManager::getAdditionalSearchPaths();
+ for( i = 0; i < rPaths.getLength(); i++ )
+ {
+ aSearchPath += ':';
+ aSearchPath += String( rPaths.getConstArray()[i] );
+ }
+
+
+ int nPaths = aSearchPath.GetTokenCount( ':' );
+ for( i = 0; i < nPaths; i++ )
+ {
+ ByteString aPath( aSearchPath.GetToken( i, ':' ), gsl_getSystemTextEncoding() );
+ if( aPath.Len() )
+ {
+ DIR* pDIR = opendir( aPath.GetBuffer() );
+ struct dirent aEntry;
+ struct dirent* pEntry;
+
+ while( pDIR && readdir_r( pDIR, &aEntry, &pEntry ) )
+ {
+ struct stat aStat;
+ ByteString aFile( aPath );
+ aFile += '/';
+ aFile += aEntry.d_name;
+ if( ! stat( aFile.GetBuffer(), &aStat ) &&
+ S_ISREG( aStat.st_mode ) &&
+ ! strncmp( aEntry.d_name, "libnullplugin", 13 )
+ )
+ {
+ int nStructs;
+ ::com::sun::star::plugin::PluginDescription** pStructs =
+ CheckPlugin( aFile, nStructs );
+ if( pStructs )
+ {
+ for( int i = 0; i < nStructs; i++ )
+ aPlugins.push_back( pStructs[i] );
+ delete pStructs;
+ }
+ }
+ }
+ }
+ }
+ aDescriptions = Sequence< ::com::sun::star::plugin::PluginDescription >( aPlugins.size() );
+ NAMESPACE_STD(list)< ::com::sun::star::plugin::PluginDescription* >::iterator iter;
+ for( iter = aPlugins.begin(), i=0; iter != aPlugins.end(); ++iter ,i++ )
+ {
+ aDescriptions.getArray()[ i ] = **iter;
+ delete *iter;
+ }
+ aPlugins.clear();
+ bHavePlugins = TRUE;
+ }
+ return aDescriptions;
+}
+
diff --git a/extensions/source/plugin/util/makefile.mk b/extensions/source/plugin/util/makefile.mk
new file mode 100644
index 000000000..53daf359d
--- /dev/null
+++ b/extensions/source/plugin/util/makefile.mk
@@ -0,0 +1,125 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..$/..
+
+PRJNAME=extensions
+TARGET=pl
+USE_DEFFILE=TRUE
+GEN_HID=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+LIB1TARGET = $(SLB)$/plall.lib
+LIB1FILES = \
+ $(SLB)$/plbase.lib \
+ $(SHL1LINKLIB)
+
+SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
+
+.IF "$(GUI)" == "UNX"
+SHL1LINKLIB = $(SLB)$/plunx.lib
+.ENDIF
+
+.IF "$(GUI)" == "WNT"
+SHL1LINKLIB = $(SLB)$/plwin.lib
+SHL1OWNLIB = \
+ version.lib \
+ ole32.lib \
+ advapi32.lib
+.ENDIF
+
+.IF "$(GUI)" == "OS2"
+SHL1LINKLIB = $(SLB)$/plos2.lib
+.ENDIF
+
+SHL1STDLIBS=\
+ $(SHL1OWNLIB) \
+ $(VCLLIB) \
+ $(TOOLSLIB) \
+ $(TKLIB) \
+ $(VOSLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+#SHL1DEPN= $(SLB)/sfx.lib $(L)$/itools.lib $(L)$/ivcl.lib
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1IMPLIB = i$(TARGET)
+
+SHL1LIBS = $(LIB1TARGET)
+
+
+DEF1NAME =$(SHL1TARGET)
+DEF1EXPORTFILE= exports.dxp
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
+
diff --git a/extensions/source/plugin/util/makefile.pmk b/extensions/source/plugin/util/makefile.pmk
new file mode 100644
index 000000000..3bec8dfc9
--- /dev/null
+++ b/extensions/source/plugin/util/makefile.pmk
@@ -0,0 +1,69 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.pmk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:51 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PDBTARGET=pl
+NOUNODOC=true
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+
diff --git a/extensions/source/plugin/win/makefile.mk b/extensions/source/plugin/win/makefile.mk
new file mode 100644
index 000000000..5764e096a
--- /dev/null
+++ b/extensions/source/plugin/win/makefile.mk
@@ -0,0 +1,96 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=plugin
+TARGET=plwin
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+.IF "$(GUI)" == "WNT"
+
+.INCLUDE : ..$/util$/makefile.pmk
+
+# --- Types -------------------------------------
+
+UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)
+INCPRE+=$(UNOUCROUT)
+
+# --- Types -------------------------------------
+
+SLOFILES = $(SLO)$/winmgr.obj \
+ $(SLO)$/sysplug.obj
+
+#SRCFILES = app.src
+
+.ENDIF
+# ------------------------------------------------------------------
+
+
+.INCLUDE : target.mk
+.INCLUDE : ..$/util$/target.pmk
+
+
diff --git a/extensions/source/plugin/win/sysplug.cxx b/extensions/source/plugin/win/sysplug.cxx
new file mode 100644
index 000000000..8287302ee
--- /dev/null
+++ b/extensions/source/plugin/win/sysplug.cxx
@@ -0,0 +1,300 @@
+/*************************************************************************
+ *
+ * $RCSfile: sysplug.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <plugin/impl.hxx>
+
+#ifdef WNT
+#if _MSC_VER >= 1200
+#include <tools/prewin.h>
+#else
+#include <tools/presys.h>
+#endif
+#endif
+#if STLPORT_VERSION < 321
+#include <stl/map.h>
+#endif
+#include <windows.h>
+#include <string.h>
+#include <tchar.h>
+#include <winreg.h>
+#include <winbase.h>
+#include <objbase.h>
+#ifdef WNT
+#if _MSC_VER >= 1200
+#include <tools/postwin.h>
+#else
+#include <tools/postsys.h>
+#endif
+#endif
+#if STLPORT_VERSION >= 321
+#include <stl/list>
+#include <stl/map>
+#include <stl/algorithm>
+#endif
+
+extern NPNetscapeFuncs aNPNFuncs;
+
+#include <tools/debug.hxx>
+
+using namespace rtl;
+
+//--------------------------------------------------------------------------------------------------
+PluginComm_Impl::PluginComm_Impl( const OUString& rMIME, const OUString& rName, HWND hWnd )
+ : PluginComm( OUStringToOString( rName, RTL_TEXTENCODING_MS_1252 ) )
+{
+ // initialize plugin function table
+ memset( &_NPPfuncs, 0, sizeof( _NPPfuncs ) );
+#ifdef UNICODE
+ _plDLL = ::LoadLibrary( rName.getStr() );
+#else
+ OString aStr( OUStringToOString( rName, RTL_TEXTENCODING_MS_1252 ) );
+ _plDLL = ::LoadLibrary( aStr.getStr() );
+#endif
+ DBG_ASSERT( _plDLL, "### loading plugin dll failed!" );
+
+ NPError nErr;
+ NPError (WINAPI * pEntry)( NPPluginFuncs* );
+ if (_plDLL && retrieveFunction( _T("NP_GetEntryPoints"), (void**)&pEntry ))
+ {
+ _NPPfuncs.size = sizeof( _NPPfuncs );
+ _NPPfuncs.version = 0;
+ nErr = (*pEntry)( &_NPPfuncs );
+
+ DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_GetEntryPoints() failed!" );
+ DBG_ASSERT( (_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR,
+ "### version failure!" );
+
+ NPError (WINAPI * pInit)( NPNetscapeFuncs* );
+ if (nErr == NPERR_NO_ERROR &&
+ (_NPPfuncs.version >> 8) >= NP_VERSION_MAJOR &&
+ (retrieveFunction( _T("NP_Initialize"), (void**)&pInit ) ||
+ retrieveFunction( _T("NP_PluginInit"), (void**)&pInit )))
+ {
+ nErr = (*pInit)( &aNPNFuncs );
+ DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_Initialize() failed!" );
+
+// WIN obsolete: called by NP_Initialize()
+// nErr = NPP_Initialize();
+// DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NPP_Initialize() failed!" );
+ }
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+PluginComm_Impl::~PluginComm_Impl()
+{
+ if (_plDLL)
+ {
+// NPP_Shutdown();
+
+ NPError (WINAPI * pShutdown)();
+ if (retrieveFunction( _T("NP_Shutdown"), (void**)&pShutdown ))
+ {
+ NPError nErr = (*pShutdown)();
+ DBG_ASSERT( nErr == NPERR_NO_ERROR, "### NP_Shutdown() failed!" );
+ }
+
+ BOOL bRet = ::FreeLibrary( _plDLL );
+ DBG_ASSERT( bRet, "### unloading plugin dll failed!" );
+ _plDLL = NULL;
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+BOOL PluginComm_Impl::retrieveFunction( TCHAR* pName, void** ppFunc ) const
+{
+ if( ! _plDLL )
+ return FALSE;
+
+ *ppFunc = (void*)::GetProcAddress( _plDLL, pName );
+
+ return (*ppFunc != NULL);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_Destroy( NPP instance, NPSavedData** save )
+{
+ DBG_ASSERT( _NPPfuncs.destroy, "### NPP_Destroy(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.destroy
+ ? (*_NPPfuncs.destroy)( instance, save )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_DestroyStream( NPP instance, NPStream* stream, NPError reason )
+{
+ DBG_ASSERT( _NPPfuncs.destroystream, "### NPP_DestroyStream(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.destroystream
+ ? (*_NPPfuncs.destroystream)( instance, stream, reason )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
+ char* argn[], char* argv[], NPSavedData *saved )
+{
+ DBG_ASSERT( _NPPfuncs.newp, "### NPP_New(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.newp
+ ? (*_NPPfuncs.newp)( pluginType, instance, mode, argc, argn, argv, saved )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_NewStream( NPP instance, NPMIMEType type, NPStream* stream,
+ NPBool seekable, uint16* stype )
+{
+ DBG_ASSERT( _NPPfuncs.newstream, "### NPP_NewStream(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.newstream
+ ? (*_NPPfuncs.newstream)( instance, type, stream, seekable, stype )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+void PluginComm_Impl::NPP_Print( NPP instance, NPPrint* platformPrint )
+{
+ DBG_ASSERT( _NPPfuncs.print, "### NPP_Print(): null pointer in NPP functions table!" );
+ if (_NPPfuncs.print)
+ (*_NPPfuncs.print)( instance, platformPrint );
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_SetWindow( NPP instance, NPWindow* window )
+{
+ DBG_ASSERT( _NPPfuncs.setwindow, "### NPP_SetWindow(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.setwindow
+ ? (*_NPPfuncs.setwindow)( instance, window )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+void PluginComm_Impl::NPP_StreamAsFile( NPP instance, NPStream* stream, const char* fname )
+{
+ DBG_ASSERT( _NPPfuncs.asfile, "### NPP_StreamAsFile(): null pointer in NPP functions table!" );
+ if (_NPPfuncs.asfile)
+ (*_NPPfuncs.asfile)( instance, stream, fname );
+}
+
+//--------------------------------------------------------------------------------------------------
+void PluginComm_Impl::NPP_URLNotify( NPP instance, const char* url, NPReason reason, void* notifyData )
+{
+ DBG_ASSERT( _NPPfuncs.urlnotify, "### NPP_URLNotify(): null pointer in NPP functions table!" );
+ if (_NPPfuncs.urlnotify)
+ (*_NPPfuncs.urlnotify)( instance, url, reason, notifyData );
+}
+
+//--------------------------------------------------------------------------------------------------
+int32 PluginComm_Impl::NPP_Write( NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer )
+{
+ DBG_ASSERT( _NPPfuncs.write, "### NPP_Write(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.write
+ ? (*_NPPfuncs.write)( instance, stream, offset, len, buffer )
+ : 0);
+}
+
+//--------------------------------------------------------------------------------------------------
+int32 PluginComm_Impl::NPP_WriteReady( NPP instance, NPStream* stream )
+{
+ DBG_ASSERT( _NPPfuncs.writeready, "### NPP_WriteReady(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.writeready
+ ? (*_NPPfuncs.writeready)( instance, stream )
+ : 0);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_GetValue( NPP instance, NPPVariable variable, void *ret_alue )
+{
+ DBG_ASSERT( _NPPfuncs.getvalue, "### NPP_GetValue(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.getvalue
+ ? (*_NPPfuncs.getvalue)( instance, variable, ret_alue )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_SetValue( NPP instance, NPNVariable variable, void *ret_alue )
+{
+ DBG_ASSERT( _NPPfuncs.setvalue, "### NPP_SetValue(): null pointer in NPP functions table!" );
+ return (_NPPfuncs.setvalue
+ ? (*_NPPfuncs.setvalue)( instance, variable, ret_alue )
+ : NPERR_GENERIC_ERROR);
+}
+
+//--------------------------------------------------------------------------------------------------
+void * PluginComm_Impl::NPP_GetJavaClass()
+{
+ DBG_ERROR( "no java class available!" );
+ return 0;
+}
+
+//--------------------------------------------------------------------------------------------------
+NPError PluginComm_Impl::NPP_Initialize()
+{
+ return NPERR_NO_ERROR;
+}
+
+//--------------------------------------------------------------------------------------------------
+void PluginComm_Impl::NPP_Shutdown()
+{
+ NPP_ShutdownUPP pFunc;
+ if (retrieveFunction( _T("NPP_Shutdown"), (void**)&pFunc ))
+ (*pFunc)();
+}
+
+
diff --git a/extensions/source/plugin/win/winmgr.cxx b/extensions/source/plugin/win/winmgr.cxx
new file mode 100644
index 000000000..5a64d0785
--- /dev/null
+++ b/extensions/source/plugin/win/winmgr.cxx
@@ -0,0 +1,392 @@
+/*************************************************************************
+ *
+ * $RCSfile: winmgr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <vcl/svapp.hxx>
+#include <tools/fsys.hxx>
+#include <osl/mutex.hxx>
+
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <plugin/impl.hxx>
+
+#ifdef WNT
+#if _MSC_VER >= 1200
+#include <tools/prewin.h>
+#else
+#include <tools/presys.h>
+#endif
+#endif
+#include <windows.h>
+#include <string.h>
+#include <tchar.h>
+#include <winreg.h>
+#include <winbase.h>
+#include <objbase.h>
+#ifdef WNT
+#if _MSC_VER >= 1200
+#include <tools/postwin.h>
+#else
+#include <tools/postsys.h>
+#endif
+#endif
+#if STLPORT_VERSION >= 321
+#include <stl/list>
+#include <stl/map>
+#include <stl/algorithm>
+#else
+#include <stl/map.h>
+#endif
+
+using namespace rtl;
+using namespace std;
+using namespace osl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::plugin;
+
+typedef map< OString, OUString, less< OString > > PluginLocationMap;
+
+
+//__________________________________________________________________________________________________
+static void addPluginsFromPath( const TCHAR * pPluginsPath, PluginLocationMap & rPlugins )
+{
+ // append dll name pattern we are looking for
+ TCHAR arPluginsPath[MAX_PATH];
+ arPluginsPath[0] = 0;
+
+#ifdef UNICODE
+ if (::rtl_ustr_indexOfStr( pPluginsPath, L"%programfiles%" ) == 0)
+ {
+ const char * p = ::getenv( "ProgramFiles" );
+ if (p)
+ {
+ OUString aStr( OUString::createFromAscii( p ) );
+ ::lstrcpy( arPluginsPath, aStr.getStr() );
+ pPluginsPath += 14;
+ }
+ }
+#else
+ if (::rtl_str_indexOfStr( pPluginsPath, "%programfiles%" ) == 0)
+ {
+ const char * p = ::getenv( "ProgramFiles" );
+ if (p)
+ {
+ ::lstrcpy( arPluginsPath, p );
+ pPluginsPath += 14;
+ }
+ }
+#endif
+ ::lstrcat( arPluginsPath, pPluginsPath );
+ ::lstrcat( arPluginsPath, _T("\\") );
+
+ TCHAR arPluginsPattern[MAX_PATH];
+ ::lstrcpy( arPluginsPattern, arPluginsPath );
+ ::lstrcat( arPluginsPattern, _T("NP*.DLL") );
+
+ WIN32_FIND_DATA aFindData;
+ HANDLE hFind = ::FindFirstFile( arPluginsPattern, &aFindData );
+
+ while (hFind != INVALID_HANDLE_VALUE)
+ {
+#ifdef UNICODE
+ OString aStr( OUStringToOString( aFindData.cFileName, RTL_TEXTENCODING_MS_1252 ) );
+ OString aName( aStr ); // cAsE?
+#else
+ OString aName( aFindData.cFileName );
+#endif
+ aName.toLowerCase();
+
+ // no netscape default plugin anymore...
+ // and no double plugin dlls
+ if (!aName.equals( "npnul32.dll" ) && rPlugins.find( aName ) == rPlugins.end())
+ {
+ TCHAR arComplete[MAX_PATH];
+ ::lstrcpy( arComplete, arPluginsPath );
+ ::lstrcat( arComplete, aFindData.cFileName );
+
+#ifdef UNICODE
+ rPlugins[aName] = OUString( arComplete );
+#else
+ OUString aStr( OStringToOUString( arComplete, RTL_TEXTENCODING_MS_1252 ) );
+ rPlugins[aName] = OUString( aStr.getStr() );
+#endif
+ }
+
+ if (! ::FindNextFile( hFind, &aFindData ))
+ break;
+ }
+
+ if (hFind != INVALID_HANDLE_VALUE)
+ ::FindClose( hFind );
+}
+//__________________________________________________________________________________________________
+static void addPluginsFromPath( const OUString & rPath, PluginLocationMap & rPlugins )
+{
+ TCHAR arPluginsPath[MAX_PATH];
+ DWORD dwPluginsPathSize = sizeof(arPluginsPath);
+
+#ifdef UNICODE
+ ::lstrcpy( arPluginsPath, rPath.getStr() );
+#else
+ OString aStr( OUStringToOString( rPath, RTL_TEXTENCODING_MS_1252 ) );
+ ::strcpy( arPluginsPath, aStr.getStr() );
+#endif
+
+ addPluginsFromPath( arPluginsPath, rPlugins );
+}
+
+
+//__________________________________________________________________________________________________
+static void add_IE_Plugins( PluginLocationMap & rPlugins )
+{
+ HKEY hKey;
+ TCHAR arCurrent[MAX_PATH];
+ DWORD dwType, dwCurrentSize = sizeof(arCurrent);
+
+ if (::RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\IE4\\SETUP"),
+ 0, KEY_READ, &hKey ) == ERROR_SUCCESS)
+ {
+ if (::RegQueryValueEx( hKey, _T("Path"), NULL, &dwType,
+ (LPBYTE)arCurrent, &dwCurrentSize ) == ERROR_SUCCESS &&
+ (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
+ {
+ // add \\Plugins
+ ::lstrcat( arCurrent, _T("\\Plugins") );
+
+ addPluginsFromPath( arCurrent, rPlugins );
+ }
+ ::RegCloseKey( hKey );
+ }
+}
+
+//__________________________________________________________________________________________________
+static void add_NS_Plugins( PluginLocationMap & rPlugins )
+{
+ HKEY hKey1, hKey2;
+ TCHAR arCurrent[MAX_PATH];
+ DWORD dwType, dwCurrentSize = sizeof(arCurrent);
+
+ if (::RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("Software\\Netscape\\Netscape Navigator"),
+ 0, KEY_READ, &hKey1 ) == ERROR_SUCCESS)
+ {
+ if (::RegQueryValueEx( hKey1, _T("CurrentVersion"), NULL, &dwType,
+ (LPBYTE)arCurrent, &dwCurrentSize ) == ERROR_SUCCESS &&
+ (dwType == REG_SZ || dwType == REG_EXPAND_SZ) &&
+ ::RegOpenKeyEx( hKey1, ::lstrcat( arCurrent, _T("\\Main") ),
+ 0, KEY_READ, &hKey2 ) == ERROR_SUCCESS)
+ {
+ dwCurrentSize = sizeof(arCurrent);
+ if (::RegQueryValueEx( hKey2, _T("Plugins Directory"), NULL, &dwType,
+ (LPBYTE)arCurrent, &dwCurrentSize ) == ERROR_SUCCESS &&
+ (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
+ {
+ addPluginsFromPath( arCurrent, rPlugins );
+ }
+ ::RegCloseKey( hKey2 );
+ }
+ ::RegCloseKey( hKey1 );
+ }
+}
+
+//__________________________________________________________________________________________________
+static void add_SO_Plugins( PluginLocationMap & rPlugins )
+{
+ const Sequence< OUString > & rPaths = PluginManager::getAdditionalSearchPaths();
+
+ const OUString * pPaths = rPaths.getConstArray();
+ for ( UINT32 nPos = rPaths.getLength(); nPos--; )
+ {
+ addPluginsFromPath( pPaths[nPos], rPlugins );
+ }
+}
+
+//__________________________________________________________________________________________________
+Sequence< PluginDescription > XPluginManager_Impl::getPluginDescriptions(void) throw()
+{
+ Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
+ static Sequence<PluginDescription > s_aDescriptions( 0 );
+ static s_bInit = FALSE;
+
+ if (! s_bInit)
+ {
+ // collect all distinct plugin dlls
+ PluginLocationMap aPlugins;
+ add_SO_Plugins( aPlugins );
+ add_NS_Plugins( aPlugins );
+ add_IE_Plugins( aPlugins );
+
+ // collect mime types of plugin dlls
+ for ( PluginLocationMap::iterator iPos( aPlugins.begin() );
+ iPos != aPlugins.end();
+ ++iPos )
+ {
+ TCHAR arFileName[MAX_PATH];
+ DWORD dwDummy, dwSize;
+
+ // DLL name
+ OUString aName( (*iPos).second.getStr() );
+
+#ifdef UNICODE
+ ::lstrcpy( arFileName, aName.getStr() );
+#else
+ OString aStr( OUStringToOString( aName, RTL_TEXTENCODING_MS_1252 ) );
+ ::strcpy( arFileName, aStr.getStr() );
+#endif
+ dwSize = ::GetFileVersionInfoSize( arFileName, &dwDummy );
+
+ char * pVersionData = NULL;
+ if (dwSize && (pVersionData = new char[dwSize]) &&
+ ::GetFileVersionInfo( arFileName, 0, dwSize, pVersionData ))
+ {
+ // optional comment
+ OUString aComment;
+
+ TCHAR * pInfo, * pInfo2;
+ UINT nSize;
+ if (::VerQueryValue( pVersionData, _T("\\StringFileInfo\\040904E4\\ProductName"),
+ (void**)&pInfo, &nSize ) && pInfo)
+ {
+#ifdef UNICODE
+ aComment.operator=( pInfo );
+#else
+ aComment.operator=( OStringToOUString( OString(pInfo), RTL_TEXTENCODING_MS_1252 ) );
+#endif
+ }
+
+ // mandatory mime type and file extensions
+ if (::VerQueryValue( pVersionData, _T("\\StringFileInfo\\040904E4\\MIMEType"),
+ (void**)&pInfo, &nSize ) && pInfo &&
+ ::VerQueryValue( pVersionData, _T("\\StringFileInfo\\040904E4\\FileExtents"),
+ (void**)&pInfo2, &nSize ) && pInfo2)
+ {
+#ifdef UNICODE
+ OUString aExt( pInfo2 );
+ OUString aMIME( pInfo );
+#else
+ OString aStr2( pInfo2 );
+ OString aExt( aStr2 );
+ OString aStr( pInfo );
+ OString aMIME( aStr );
+#endif
+ aMIME.trim();
+
+ USHORT nToken = aExt.getTokenCount( '|' );
+ USHORT nMToken = aMIME.getTokenCount( '|' );
+ if (nToken != nMToken)
+ {
+ DBG_ERROR( "### mime type count differ to extension count!" );
+ nToken = (nToken > nMToken ? nMToken : nToken);
+ }
+
+ UINT32 nStart = s_aDescriptions.getLength();
+ s_aDescriptions.realloc( nStart + nToken );
+ PluginDescription* pDescriptions = s_aDescriptions.getArray();
+ // for every MIME Type
+ for ( ; nToken--; )
+ {
+ PluginDescription & rDescr = pDescriptions[nStart+nToken];
+ rDescr.PluginName = aName;
+ rDescr.Description = aComment;
+ rDescr.Mimetype = OStringToOUString( aMIME.getToken( nToken, '|' ), RTL_TEXTENCODING_MS_1252 );
+
+ OUString aExtToken( OStringToOUString( aExt.getToken( nToken, '|' ), RTL_TEXTENCODING_MS_1252 ) );
+ USHORT nPos = 0, nLen = aExtToken.getLength();
+ OUString aExtensions( OUString::createFromAscii( nLen ? "*." : "*.*" ) );
+
+ for ( ; nPos < nLen; ++nPos )
+ {
+ sal_Unicode c = aExtToken[nPos];
+ switch (c)
+ {
+ case ',':
+ case ';':
+ aExtensions += OUString::createFromAscii( ";*." );
+ case ' ':
+ break;
+ case '*':
+ if (nPos < (nLen-1) && aExtToken[ nPos+1 ] == '.')
+ {
+ ++nPos;
+ break;
+ }
+ default:
+ aExtensions += OUString( &c, 1 );
+ }
+ }
+ rDescr.Extension = aExtensions;
+ }
+ }
+#if DEBUG
+ else
+ DBG_ERROR( "### cannot get MIME type or extensions!" );
+#endif
+ }
+ if (pVersionData)
+ delete[] pVersionData;
+ }
+
+ s_bInit = TRUE;
+ }
+ return s_aDescriptions;
+}
+
+
diff --git a/extensions/source/resource/exports.dxp b/extensions/source/resource/exports.dxp
new file mode 100644
index 000000000..9e59e9403
--- /dev/null
+++ b/extensions/source/resource/exports.dxp
@@ -0,0 +1,3 @@
+component_writeInfo
+component_getImplementationEnvironment
+component_getFactory
diff --git a/extensions/source/resource/makefile.mk b/extensions/source/resource/makefile.mk
new file mode 100644
index 000000000..5d38e76d5
--- /dev/null
+++ b/extensions/source/resource/makefile.mk
@@ -0,0 +1,133 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=extensions
+TARGET=res
+LIBTARGET=NO
+USE_LDUMP2=TRUE
+USE_DEFFILE=TRUE
+# NEW
+NO_BSYMBOLIC=TRUE
+# END NEW
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/resource.obj
+
+EXCEPTIONSFILES= $(SLO)$/resource.obj
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1OBJFILES= $(EXCEPTIONSFILES)
+
+SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
+
+# $(UNOLIB) \
+# NEW \
+# $(CPPULIB) \
+# $(CPPUHELPERLIB) \
+# END NEW \
+
+SHL1STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(VCLLIB) \
+ $(TOOLSLIB)
+
+SHL1DEPN=
+SHL1IMPLIB= ires
+SHL1LIBS= $(LIB1TARGET)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+# NEW
+UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
+
+UNOTYPES=\
+ com.sun.star.uno.XWeak \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XTypeProvider \
+ com.sun.star.lang.XServiceInfo \
+ com.sun.star.reflection.InvocationTargetException \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.script.XInvocation \
+ com.sun.star.script.XTypeConverter \
+ com.sun.star.beans.XExactName
+# END NEW
+
+DEF1NAME= $(SHL1TARGET)
+DEF1EXPORTFILE= exports.dxp
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
diff --git a/extensions/source/resource/resource.cxx b/extensions/source/resource/resource.cxx
new file mode 100644
index 000000000..c09102d77
--- /dev/null
+++ b/extensions/source/resource/resource.cxx
@@ -0,0 +1,583 @@
+/*************************************************************************
+ *
+ * $RCSfile: resource.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <vos/mutex.hxx>
+//#include <usr/ustring.hxx>
+//#include <usr/factoryhlp.hxx>
+//#include <usr/weak.hxx>
+
+//#include <smart/com/sun/star/lang/XServiceInfo.hxx>
+//#include <smart/com/sun/star/script/XInvocation.hxx>
+//#include <smart/com/sun/star/script/XTypeConverter.hxx>
+//#include <smart/com/sun/star/beans/XExactName.hxx>
+
+// Changes from ...Ref to Reference< ... >, USR_QUERY -> UNO_QUERY, THROWS( ... ) -> throw( ... ),
+// UsrAny -> Any, (BOOL -> sal_BOOL, ...), OUString -> OUString, put SAL_CALL infront of each interface method,
+// UsrSystemException -> RuntimeException, const is removed from each interface method
+// are done without comment
+/**** NEW ****/
+#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
+#include <cppuhelper/factory.hxx> // helper for factories
+#include <cppuhelper/implbase3.hxx> // helper for implementations
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <com/sun/star/script/XTypeConverter.hpp>
+#include <com/sun/star/reflection/InvocationTargetException.hpp>
+#include <com/sun/star/beans/XExactName.hpp>
+
+/**** END NEW ****/
+
+#include <tools/resmgr.hxx>
+#include <tools/rcid.h>
+#include <vcl/svapp.hxx>
+
+#include <rtl/ustring.hxx>
+
+#ifndef _VOS_NO_NAMESPACE
+using namespace vos;
+//using namespace usr;
+using namespace rtl;
+/**** NEW ****/
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+using namespace com::sun::star::script;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::reflection;
+/**** END NEW ****/
+#endif
+
+
+//------------------------------------------------------------------------
+//------------------------------------------------------------------------
+//------------------------------------------------------------------------
+//class ResourceService : public XInvocation
+// , public XExactName
+// , public XServiceInfo
+// , public OWeakObject
+
+/**** NEW ****/
+class ResourceService : public cppu::WeakImplHelper3< XInvocation, XExactName, XServiceInfo >
+/**** END NEW ****/
+{
+public:
+ ResourceService( const Reference< XMultiServiceFactory > & );
+ ~ResourceService();
+
+ // XInterface
+ //BOOL queryInterface( Uik aUik, Reference< XInterface > & rOut );
+ //void acquire() { OWeakObject::acquire(); }
+ //void release() { OWeakObject::release(); }
+ //void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+ // XIdlClassProvider
+ //Sequence< Reference< XIdlClass > > getIdlClasses(void);
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName() throw();
+ BOOL SAL_CALL supportsService(const OUString& ServiceName) throw();
+ Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw();
+
+ static Sequence< OUString > getSupportedServiceNames_Static(void) throw();
+ static OUString getImplementationName_Static() throw()
+ {
+ return OUString::createFromAscii("com.sun.star.comp.extensions.ResourceService");
+ }
+
+ // XExactName
+ OUString SAL_CALL getExactName( const OUString & ApproximateName );
+
+ // XInvokation
+ Reference< XIntrospectionAccess > SAL_CALL getIntrospection(void) throw(RuntimeException);
+ Any SAL_CALL invoke(const OUString& FunctionName, const Sequence< Any >& Params, Sequence< INT16 >& OutParamIndex, Sequence< Any >& OutParam) throw(IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException);
+ void SAL_CALL setValue(const OUString& PropertyName, const Any& Value) throw(UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException);
+ Any SAL_CALL getValue(const OUString& PropertyName) throw(UnknownPropertyException, RuntimeException);
+ BOOL SAL_CALL hasMethod(const OUString& Name) throw(RuntimeException);
+ BOOL SAL_CALL hasProperty(const OUString& Name) throw(RuntimeException);
+private:
+ Reference< XTypeConverter > getTypeConverter() const;
+ Reference< XInvocation > getDefaultInvocation() const;
+ //Reference< XIdlClass > getStaticIdlClass();
+
+ Reference< XMultiServiceFactory > xSMgr;
+ Reference< XInvocation > xDefaultInvocation;
+ Reference< XTypeConverter > xTypeConverter;
+ OUString aFileName;
+ ResMgr * pResMgr;
+};
+
+
+ResourceService::ResourceService( const Reference< XMultiServiceFactory > & rSMgr )
+ : xSMgr( rSMgr )
+ , pResMgr( NULL )
+{
+}
+
+//-----------------------------------------------------------------------------
+ResourceService::~ResourceService()
+{
+ delete pResMgr;
+}
+
+//-----------------------------------------------------------------------------
+Reference< XInterface > SAL_CALL ResourceService_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ) throw(Exception)
+{
+ Reference< XInterface > xService = (cppu::OWeakObject*)new ResourceService( rSMgr );
+ return xService;
+}
+
+//*************************************************************************
+// DLLImplementationLoader::getStaticIdlClass()
+//
+//Reference< XIdlClass > ResourceService::getStaticIdlClass()
+//{
+// // Global Method, must be guarded (multithreading)
+// OGuard aGuard( OMutex::getGlobalMutex() );
+// {
+// // use the standard class implementation of the usr library
+// static Reference< XIdlClass > xClass =
+// createStandardClass( getImplementationName_Static(),
+// OWeakObject::getStaticIdlClass(), 2,
+// XInvocation_Reference< get >lection(),
+// XExactName_getReflection(),
+// XServiceInfo_getReflection()
+// );
+// return xClass;
+// }
+//}
+
+// Methoden von XInterface
+//BOOL ResourceService::queryInterface( Uik aUik, Reference< XInterface > & rOut )
+//{
+// if( aUik == XInvocation::getSmartUik() )
+// rOut = (XInvocation*)this;
+// else if( aUik == XExactName::getSmartUik() )
+// rOut = (XExactName*)this;
+// else if( aUik == XServiceInfo::getSmartUik() )
+// rOut = (XServiceInfo *)this;
+// else
+// OWeakObject::queryInterface( aUik, rOut );
+// return rOut.is();
+//}
+//
+// XIdlClassProvider
+//Sequence< XIdlClassRef > ResourceService::getIdlClasses()
+//{
+// XIdlClassRef x = getStaticIdlClass();
+// return Sequence< XIdlClassRef >( &x, 1 );
+//}
+
+
+// XServiceInfo
+OUString ResourceService::getImplementationName() throw()
+{
+ return getImplementationName_Static();
+}
+
+// XServiceInfo
+BOOL SAL_CALL ResourceService::supportsService(const OUString& ServiceName) throw()
+{
+ Sequence< OUString > aSNL = getSupportedServiceNames();
+ const OUString * pArray = aSNL.getConstArray();
+ for( INT32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return TRUE;
+ return FALSE;
+}
+
+// XServiceInfo
+Sequence< OUString > SAL_CALL ResourceService::getSupportedServiceNames(void) throw()
+{
+ return getSupportedServiceNames_Static();
+}
+
+// ResourceService
+Sequence< OUString > ResourceService::getSupportedServiceNames_Static(void) throw()
+{
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray()[0] = OUString::createFromAscii("com.sun.star.resource.VclStringResourceLoader");
+ return aSNS;
+}
+
+// ResourceService
+Reference< XTypeConverter > ResourceService::getTypeConverter() const
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ if( xSMgr.is() )
+ {
+ Reference< XTypeConverter > xConv( xSMgr->createInstance( OUString::createFromAscii("com.sun.star.script.Converter" )), UNO_QUERY );
+ ((ResourceService*)this)->xTypeConverter = xConv;
+ }
+ return xTypeConverter;
+}
+
+// ResourceService
+Reference< XInvocation > ResourceService::getDefaultInvocation() const
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ /* führt zur Zeit noch zu einer rekursion
+ if( xSMgr.is() )
+ {
+ Reference< XSingleServiceFactory > xFact( xSMgr->createInstance( OUString::createFromAscii("com.sun.star.script.Invocation") ), UNO_QUERY );
+ if( xFact.is() )
+ {
+ Sequence< Any > aArgs( 1 );
+ Reference< XInterface > xThis( *this );
+ aArgs.getArray()[0].set( &xThis, XInterface_Reference< get >lection() );
+ Reference< XInvokation > xI( xFact->createInstanceWithArguments( aArgs ), UNO_QUERY );
+ ((ResourceService*)this)->xDefaultInvocation = xI;
+ }
+ }
+ */
+ return xDefaultInvocation;
+}
+
+// XExactName
+OUString SAL_CALL ResourceService::getExactName( const OUString & ApproximateName )
+{
+ OUString aName( ApproximateName );
+ aName = aName.toLowerCase();
+ if( aName == OUString::createFromAscii("filename") )
+ return OUString::createFromAscii("FileName");
+ else if( aName == OUString::createFromAscii("getstring" ))
+ return OUString::createFromAscii("getString");
+ else if( aName == OUString::createFromAscii("hasstring") )
+ return OUString::createFromAscii("hasString");
+ Reference< XExactName > xEN( getDefaultInvocation(), UNO_QUERY );
+ if( xEN.is() )
+ return xEN->getExactName( ApproximateName );
+ return OUString();
+}
+
+// XInvokation
+Reference< XIntrospectionAccess > SAL_CALL ResourceService::getIntrospection(void)
+ throw(RuntimeException)
+{
+ Reference< XInvocation > xI = getDefaultInvocation();
+ if( xI.is() )
+ return xI->getIntrospection();
+ return Reference< XIntrospectionAccess >();
+}
+
+// XInvokation
+Any SAL_CALL ResourceService::invoke
+(
+ const OUString& FunctionName,
+ const Sequence< Any >& Params,
+ Sequence< INT16 >& OutParamIndex,
+ Sequence< Any >& OutParam
+)
+ throw(IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException)
+{
+ if( FunctionName == OUString::createFromAscii("getString") || FunctionName == OUString::createFromAscii("hasString" ))
+ {
+ if( Params.getLength() != 1 )
+ throw IllegalArgumentException();
+ INT32 nId;
+ /**** NEW ****/
+ if( !(Params.getConstArray()[0] >>= nId) )
+ /**** END NEW ****/
+ //if( Params.getConstArray()[0].getReflection()->getTypeClass() == TypeClass_LONG )
+ // nId = Params.getConstArray()[0].getINT32();
+ //else
+ {
+ Reference< XTypeConverter > xC = getTypeConverter();
+ if( xC.is() )
+ {
+ /**** NEW ****/
+ xC->convertToSimpleType( Params.getConstArray()[0], TypeClass_LONG ) >>= nId;
+ /**** END NEW ****/
+ //nId = xC->convertToSimpleType( Params.getConstArray()[0], TypeClass_LONG ).getINT32();
+ }
+ else
+ throw CannotConvertException();
+ }
+ if( nId > 0xFFFF || nId < 0 )
+ throw IllegalArgumentException();
+
+ OGuard aGuard( Application::GetSolarMutex() );
+ if( FunctionName == OUString::createFromAscii("getString" ))
+ {
+ if( !pResMgr )
+ throw IllegalArgumentException();
+ ResId aId( (USHORT)nId, pResMgr );
+ aId.SetRT( RSC_STRING );
+ if( pResMgr->IsAvailable( aId ) )
+ {
+ String aStr( aId );
+ /**** NEW ****/
+// return makeAny( StringToOUString( aStr, CHARSET_SYSTEM ) );
+ return makeAny( OUString( aStr ) );
+ /**** END NEW ****/
+ //return Any( StringToOWString( aStr, CHARSET_SYSTEM ) );
+ }
+ else
+ throw IllegalArgumentException();
+ }
+ else //if( FunctionName == OUString::createFromAscii("hasString") )
+ {
+ sal_Bool bRet = sal_False;
+ if( pResMgr )
+ {
+ ResId aId( (USHORT)nId, pResMgr );
+ aId.SetRT( RSC_STRING );
+ bRet = pResMgr->IsAvailable( aId );
+ }
+ //return UsrAny( bRet );
+ /**** NEW ****/
+ return Any( &bRet, getBooleanCppuType() );
+ /**** END NEW ****/
+ }
+ }
+ else
+ {
+ Reference< XInvocation > xI = getDefaultInvocation();
+ if( xI.is() )
+ return xI->invoke( FunctionName, Params, OutParamIndex, OutParam );
+ else
+ throw IllegalArgumentException();
+ }
+ return Any();
+}
+
+// XInvokation
+void SAL_CALL ResourceService::setValue(const OUString& PropertyName, const Any& Value)
+ throw(UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException)
+{
+ if( PropertyName == OUString::createFromAscii("FileName") )
+ {
+ OUString aName;
+ //if( Value.getReflection()->getTypeClass() == TypeClass_STRING )
+ // aName = Value.getString();
+ //else
+ /**** NEW ****/
+ if( !(Value >>= aName) )
+ /**** END NEW ****/
+ {
+ Reference< XTypeConverter > xC = getTypeConverter();
+ if( xC.is() )
+ xC->convertToSimpleType( Value, TypeClass_STRING ) >>= aName;
+ //aName = xC->convertToSimpleType( Value, TypeClass_STRING ).getString();
+ else
+ throw CannotConvertException();
+ }
+
+ OGuard aGuard( Application::GetSolarMutex() );
+ aName = aName + OUString( OUString::valueOf( (INT32)SUPD ).getStr() );
+// ResMgr * pRM = ResMgr::CreateResMgr( OUStringToString( aName, CHARSET_SYSTEM ) );
+ String aTmpString( aName );
+ ByteString a( aTmpString, gsl_getSystemTextEncoding() );
+ ResMgr * pRM = ResMgr::CreateResMgr( a.GetBuffer() );
+ if( !pRM )
+ throw InvocationTargetException();
+ if( pResMgr )
+ delete pResMgr;
+ pResMgr = pRM;
+ aFileName = aName;
+ }
+ else
+ {
+ Reference< XInvocation > xI = getDefaultInvocation();
+ if( xI.is() )
+ xI->setValue( PropertyName, Value );
+ else
+ throw UnknownPropertyException();
+ }
+}
+
+// XInvokation
+Any SAL_CALL ResourceService::getValue(const OUString& PropertyName)
+ throw(UnknownPropertyException, RuntimeException)
+{
+ OGuard aGuard( Application::GetSolarMutex() );
+ if( PropertyName == OUString::createFromAscii("FileName" ))
+ return makeAny( aFileName );
+ else
+ {
+ Reference< XInvocation > xI = getDefaultInvocation();
+ if( xI.is() )
+ return xI->getValue( PropertyName );
+ else
+ throw UnknownPropertyException();
+ }
+ return Any();
+}
+
+// XInvokation
+BOOL SAL_CALL ResourceService::hasMethod(const OUString& Name)
+ throw(RuntimeException)
+{
+ if( Name == OUString::createFromAscii("getString") || Name == OUString::createFromAscii("hasString") )
+ return TRUE;
+ else
+ {
+ Reference< XInvocation > xI = getDefaultInvocation();
+ if( xI.is() )
+ return xI->hasMethod( Name );
+ else
+ return FALSE;
+ }
+}
+
+// XInvokation
+BOOL SAL_CALL ResourceService::hasProperty(const OUString& Name)
+ throw(RuntimeException)
+{
+ if( Name == OUString::createFromAscii("FileName") )
+ return TRUE;
+ else
+ {
+ Reference< XInvocation > xI = getDefaultInvocation();
+ if( xI.is() )
+ return xI->hasProperty( Name );
+ else
+ return FALSE;
+ }
+}
+
+
+extern "C" {
+
+// NEW: return the environment type name of the c++ compiler
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+//BOOL EXTERN_SERVICE_CALLTYPE exService_writeRegEntry(
+// const UNO_INTERFACE(XRegistryKey)* xUnoKey)
+sal_Bool SAL_CALL component_writeInfo( void * /*pServiceManager*/, XRegistryKey * pRegistryKey )
+{
+ //XRegistryKeyRef pRegistryKey;
+ //uno2smart(pRegistryKey, *xUnoKey);
+ /**** NEW ****/
+ try
+ {
+ Reference< XRegistryKey > xNewKey =
+ /**** END NEW ****/
+ pRegistryKey->createKey(
+ OUString::createFromAscii( "/" ) + ResourceService::getImplementationName_Static() + OUString::createFromAscii( "/UNO/SERVICES" ) );
+ Sequence< OUString > aServices = ResourceService::getSupportedServiceNames_Static();
+ for( INT32 i = 0; i < aServices.getLength(); i++ )
+ xNewKey->createKey( aServices.getConstArray()[i]);
+
+ return sal_True;
+ /**** NEW ****/
+ }
+ catch (Exception &)
+ {
+ // not allowed to throw an exception over the c function.
+ //OSL_ENSHURE( sal_False, "Exception cannot register component!" );
+ return sal_False;
+ }
+ /**** END NEW ****/
+
+}
+
+//UNO_INTERFACE(XInterface) EXTERN_SERVICE_CALLTYPE exService_getFactory
+//(
+// const sal_Unicode* pImplName,
+// const UNO_INTERFACE(XMultiServiceFactory)* pServiceManager,
+// const UNO_INTERFACE(XRegistryKey)*
+//)
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, void * /*pRegistryKey*/ )
+{
+ //UNO_INTERFACE(XInterface) xUnoRet = {0, 0};
+ //XInterfaceRef xRet;
+ //XMultiServiceFactoryRef xSMgr;
+ //OUString aImplementationName(pImplName);
+ //uno2smart(xSMgr, *xUnoFact);
+ //if (OUString(pImplName) == ResourceService::getpImplName_Static() )
+ //{
+ // xRet = createSingleFactory( pServiceManager, pImplName,
+ // ResourceService_CreateInstance,
+ // ResourceService::getSupportedServiceNames_Static() );
+ //}
+ //
+ //if (xRet.is())
+ //{
+ // smart2uno(xRet, xUnoRet);
+ //}
+ //return xUnoRet;
+
+ /**** NEW ****/
+ void * pRet = 0;
+ if (!ResourceService::getImplementationName_Static().compareToAscii( pImplName ) )
+ {
+ // create the factory
+ Reference< XSingleServiceFactory > xFactory =
+ cppu::createSingleFactory(
+ pServiceManager, ResourceService::getImplementationName_Static(),
+ ResourceService_CreateInstance,
+ ResourceService::getSupportedServiceNames_Static() );
+ // acquire, because we return an interface pointer instead of a reference
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ return pRet;
+ /**** END NEW ****/
+}
+
+}
+
diff --git a/extensions/source/scanner/exports.dxp b/extensions/source/scanner/exports.dxp
new file mode 100644
index 000000000..9630d7e06
--- /dev/null
+++ b/extensions/source/scanner/exports.dxp
@@ -0,0 +1,3 @@
+component_getImplementationEnvironment
+component_writeInfo
+component_getFactory
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
new file mode 100644
index 000000000..437575339
--- /dev/null
+++ b/extensions/source/scanner/grid.cxx
@@ -0,0 +1,642 @@
+/*************************************************************************
+ *
+ * $RCSfile: grid.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <grid.hrc>
+#include <cstdio>
+#include <cmath>
+#include <grid.hxx>
+
+ResId SaneResId( ULONG );
+
+/***********************************************************************
+ *
+ * GridWindow
+ *
+ ***********************************************************************/
+
+// ---------------------------------------------------------------------
+
+GridWindow::GridWindow(
+ double* pXValues, double* pYValues, int nValues,
+ Window* pParent, BOOL bCutValues ) :
+ ModalDialog( pParent, SaneResId( GRID_DIALOG ) ),
+ m_aOKButton( this, SaneResId( GRID_DIALOG_OK_BTN ) ),
+ m_aCancelButton( this, SaneResId( GRID_DIALOG_CANCEL_BTN ) ),
+ m_aResetTypeBox( this, SaneResId( GRID_DIALOG_TYPE_BOX ) ),
+ m_aResetButton( this, SaneResId( GRID_DIALOG_RESET_BTN ) ),
+ m_aGridArea( 50, 15, 100, 100 ),
+ m_pXValues( pXValues ),
+ m_pOrigYValues( pYValues ),
+ m_nValues( nValues ),
+ m_pNewYValues( NULL ),
+ m_aIAOManager( this ),
+ m_pLeftMarker( NULL ),
+ m_pRightMarker( NULL ),
+ m_pDragMarker( NULL ),
+ m_aMarkerBitmap( Bitmap( SaneResId( GRID_DIALOG_HANDLE_BMP ) ),
+ Color( 255, 255, 255 ) ),
+ m_bCutValues( bCutValues )
+{
+ USHORT nPos = m_aResetTypeBox.InsertEntry( String( SaneResId( RESET_TYPE_LINEAR_ASCENDING ) ) );
+ m_aResetTypeBox.SetEntryData( nPos, (void *)RESET_TYPE_LINEAR_ASCENDING );
+
+ nPos = m_aResetTypeBox.InsertEntry( String( SaneResId( RESET_TYPE_LINEAR_DESCENDING ) ) );
+ m_aResetTypeBox.SetEntryData( nPos, (void *)RESET_TYPE_LINEAR_DESCENDING );
+
+ nPos = m_aResetTypeBox.InsertEntry( String( SaneResId( RESET_TYPE_RESET ) ) );
+ m_aResetTypeBox.SetEntryData( nPos, (void *)RESET_TYPE_RESET );
+
+ nPos = m_aResetTypeBox.InsertEntry( String( SaneResId( RESET_TYPE_EXPONENTIAL ) ) );
+ m_aResetTypeBox.SetEntryData( nPos, (void *)RESET_TYPE_EXPONENTIAL );
+
+ m_aResetTypeBox.SelectEntryPos( 0 );
+
+ m_aResetButton.SetClickHdl( LINK( this, GridWindow, ClickButtonHdl ) );
+
+ SetMapMode( MapMode( MAP_PIXEL ) );
+ Size aSize = GetOutputSizePixel();
+ Size aBtnSize = m_aOKButton.GetOutputSizePixel();
+ m_aGridArea.setWidth( aSize.Width() - aBtnSize.Width() - 80 );
+ m_aGridArea.setHeight( aSize.Height() - 40 );
+
+ if( m_pOrigYValues && m_nValues )
+ {
+ m_pNewYValues = new double[ m_nValues ];
+ memcpy( m_pNewYValues, m_pOrigYValues, sizeof( double ) * m_nValues );
+ }
+
+ setBoundings( 0, 0, 1023, 1023 );
+ computeExtremes();
+
+ m_pLeftMarker = new B2dIAOBitmapExReference(
+ &m_aIAOManager,
+ transform( findMinX(), findMinY() ),
+ &m_aMarkerBitmap,
+ m_aMarkerBitmap.GetSizePixel().Width()/2,
+ m_aMarkerBitmap.GetSizePixel().Height()/2 );
+ m_pLeftMarker->SetHittable( TRUE );
+ m_pRightMarker = new B2dIAOBitmapExReference(
+ &m_aIAOManager,
+ transform( findMaxX(), findMaxY() ),
+ &m_aMarkerBitmap,
+ m_aMarkerBitmap.GetSizePixel().Width()/2,
+ m_aMarkerBitmap.GetSizePixel().Height()/2 );
+ m_pRightMarker->SetHittable( TRUE );
+
+ FreeResource();
+}
+
+// ---------------------------------------------------------------------
+
+GridWindow::~GridWindow()
+{
+ if( m_pNewYValues )
+ delete m_pNewYValues;
+}
+
+// ---------------------------------------------------------------------
+
+double GridWindow::findMinX()
+{
+ if( ! m_pXValues )
+ return 0.0;
+ double fMin = m_pXValues[0];
+ for( int i = 1; i < m_nValues; i++ )
+ if( m_pXValues[ i ] < fMin )
+ fMin = m_pXValues[ i ];
+ return fMin;
+}
+
+// ---------------------------------------------------------------------
+
+double GridWindow::findMinY()
+{
+ if( ! m_pNewYValues )
+ return 0.0;
+ double fMin = m_pNewYValues[0];
+ for( int i = 1; i < m_nValues; i++ )
+ if( m_pNewYValues[ i ] < fMin )
+ fMin = m_pNewYValues[ i ];
+ return fMin;
+}
+
+// ---------------------------------------------------------------------
+
+double GridWindow::findMaxX()
+{
+ if( ! m_pXValues )
+ return 0.0;
+ double fMax = m_pXValues[0];
+ for( int i = 1; i < m_nValues; i++ )
+ if( m_pXValues[ i ] > fMax )
+ fMax = m_pXValues[ i ];
+ return fMax;
+}
+
+// ---------------------------------------------------------------------
+
+double GridWindow::findMaxY()
+{
+ if( ! m_pNewYValues )
+ return 0.0;
+ double fMax = m_pNewYValues[0];
+ for( int i = 1; i < m_nValues; i++ )
+ if( m_pNewYValues[ i ] > fMax )
+ fMax = m_pNewYValues[ i ];
+ return fMax;
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::computeExtremes()
+{
+ if( m_nValues && m_pXValues && m_pOrigYValues )
+ {
+ m_fMaxX = m_fMinX = m_pXValues[0];
+ m_fMaxY = m_fMinY = m_pOrigYValues[0];
+ for( int i = 1; i < m_nValues; i++ )
+ {
+ if( m_pXValues[ i ] > m_fMaxX )
+ m_fMaxX = m_pXValues[ i ];
+ else if( m_pXValues[ i ] < m_fMinX )
+ m_fMinX = m_pXValues[ i ];
+ if( m_pOrigYValues[ i ] > m_fMaxY )
+ m_fMaxY = m_pOrigYValues[ i ];
+ else if( m_pOrigYValues[ i ] < m_fMinY )
+ m_fMinY = m_pOrigYValues[ i ];
+ }
+ setBoundings( m_fMinX, m_fMinY, m_fMaxX, m_fMaxY );
+ }
+}
+
+// ---------------------------------------------------------------------
+
+Point GridWindow::transform( double x, double y )
+{
+ Point aRet;
+
+ aRet.X() = ( x - m_fMinX ) *
+ (double)m_aGridArea.GetWidth() / ( m_fMaxX - m_fMinX )
+ + m_aGridArea.Left();
+ aRet.Y() =
+ m_aGridArea.Bottom() -
+ ( y - m_fMinY ) *
+ (double)m_aGridArea.GetHeight() / ( m_fMaxY - m_fMinY );
+ return aRet;
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::transform( const Point& rOriginal, double& x, double& y )
+{
+ x = ( rOriginal.X() - m_aGridArea.Left() ) * (m_fMaxX - m_fMinX) / (double)m_aGridArea.GetWidth() + m_fMinX;
+ y = ( m_aGridArea.Bottom() - rOriginal.Y() ) * (m_fMaxY - m_fMinY) / (double)m_aGridArea.GetHeight() + m_fMinY;
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::drawPoint( double x, double y )
+{
+ DrawPixel( transform( x, y ) );
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::drawLine( double x1, double y1, double x2, double y2 )
+{
+ DrawLine( transform( x1, y1 ), transform( x2, y2 ) );
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut )
+{
+ // get a nice chunk size like 10, 100, 25 or such
+ fChunkOut = ( fMax - fMin ) / 6.0;
+ int logchunk = (int)log10( fChunkOut );
+ int nChunk = (int)( fChunkOut / exp( (double)(logchunk-1) * M_LN10 ) );
+ if( nChunk >= 75 )
+ nChunk = 100;
+ else if( nChunk >= 35 )
+ nChunk = 50;
+ else if ( nChunk > 20 )
+ nChunk = 25;
+ else if ( nChunk >= 13 )
+ nChunk = 20;
+ else if( nChunk > 5 )
+ nChunk = 10;
+ else
+ nChunk = 5;
+ fChunkOut = (double) nChunk * exp( (double)(logchunk-1) * M_LN10 );
+ // compute whole chunks fitting into fMin
+ nChunk = (int)( fMin / fChunkOut );
+ fMinChunkOut = (double)nChunk * fChunkOut;
+ while( fMinChunkOut < fMin )
+ fMinChunkOut += fChunkOut;
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::computeNew()
+{
+ // special case: only left and right markers
+ if( m_aIAOManager.GetIAOCount() == 2 )
+ {
+ double xleft, yleft;
+ double xright, yright;
+ transform( m_pLeftMarker->GetBasePosition(), xleft, yleft );
+ transform( m_pRightMarker->GetBasePosition(), xright, yright );
+ double factor = (yright-yleft)/(xright-xleft);
+ for( int i = 0; i < m_nValues; i++ )
+ {
+ m_pNewYValues[ i ] = yleft + ( m_pXValues[ i ] - xleft )*factor;
+ }
+ return;
+ }
+
+ // X sort markers
+ int nMarkers = m_aIAOManager.GetIAOCount();
+ int nSorted = 0;
+ B2dIAObject** pList = new B2dIAObject*[ nMarkers ];
+ for( B2dIAObject* pMarker = m_aIAOManager.GetIAObjectList();
+ pMarker; pMarker = pMarker->GetNext() )
+ {
+ int n = nSorted;
+ for( int i = 0; i < nSorted; i++ )
+ {
+ if( pList[ i ]->GetBasePosition().X() > pMarker->GetBasePosition().X() )
+ {
+ for( n=nSorted; n > i; n-- )
+ pList[ n ] = pList[ n-1 ];
+ pList[ i ] = pMarker;
+ nSorted++;
+ break;
+ }
+ }
+ if( n >= nSorted )
+ pList[ nSorted++ ] = pMarker;
+ }
+
+ // get node arrays
+ double* nodex = new double[ nSorted ];
+ double* nodey = new double[ nSorted ];
+ int i;
+
+ for( i = 0; i < nSorted; i++ )
+ transform( pList[ i ]->GetBasePosition(), nodex[ i ], nodey[ i ] );
+
+ for( i = 0; i < m_nValues; i++ )
+ {
+ double x = m_pXValues[ i ];
+ m_pNewYValues[ i ] = interpolate( x, nodex, nodey, nSorted );
+ if( m_bCutValues )
+ {
+ if( m_pNewYValues[ i ] > m_fMaxY )
+ m_pNewYValues[ i ] = m_fMaxY;
+ else if( m_pNewYValues[ i ] < m_fMinY )
+ m_pNewYValues[ i ] = m_fMinY;
+ }
+ }
+
+ delete nodex;
+ delete nodey;
+ delete pList;
+}
+
+// ---------------------------------------------------------------------
+
+double GridWindow::interpolate(
+ double x,
+ double* pNodeX,
+ double* pNodeY,
+ int nNodes )
+{
+ // compute Lagrange interpolation
+ double ret = 0;
+ for( int i = 0; i < nNodes; i++ )
+ {
+ double sum = pNodeY[ i ];
+ for( int n = 0; n < nNodes; n++ )
+ {
+ if( n != i )
+ {
+ sum *= x - pNodeX[ n ];
+ sum /= pNodeX[ i ] - pNodeX[ n ];
+ }
+ }
+ ret += sum;
+ }
+ return ret;
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY )
+{
+ m_fMinX = fMinX;
+ m_fMinY = fMinY;
+ m_fMaxX = fMaxX;
+ m_fMaxY = fMaxY;
+
+ computeChunk( m_fMinX, m_fMaxX, m_fChunkX, m_fMinChunkX );
+ computeChunk( m_fMinY, m_fMaxY, m_fChunkY, m_fMinChunkY );
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::drawGrid()
+{
+ char pBuf[256];
+ SetLineColor( Color( COL_BLACK ) );
+ TextAlign aAlign = GetTextAlign();
+ // draw vertical lines
+ for( double fX = m_fMinChunkX; fX < m_fMaxX; fX += m_fChunkX )
+ {
+ drawLine( fX, m_fMinY, fX, m_fMaxY );
+ // draw tickmarks
+ Point aPt = transform( fX, m_fMinY );
+ sprintf( pBuf, "%g", fX );
+ String aMark( pBuf, gsl_getSystemTextEncoding() );
+ Size aTextSize( GetTextWidth( aMark ), GetTextHeight() );
+ aPt.X() -= aTextSize.Width()/2;
+ aPt.Y() += aTextSize.Height()/2;
+ DrawText( aPt, aMark );
+ }
+ // draw horizontal lines
+ for( double fY = m_fMinChunkY; fY < m_fMaxY; fY += m_fChunkY )
+ {
+ drawLine( m_fMinX, fY, m_fMaxX, fY );
+ // draw tickmarks
+ Point aPt = transform( m_fMinX, fY );
+ sprintf( pBuf, "%g", fY );
+ String aMark( pBuf, gsl_getSystemTextEncoding() );
+ Size aTextSize( GetTextWidth( aMark ), GetTextHeight() );
+ aPt.X() -= aTextSize.Width() + 2;
+ aPt.Y() -= aTextSize.Height()/2;
+ DrawText( aPt, aMark );
+ }
+
+ // draw boundings
+ drawLine( m_fMinX, m_fMinY, m_fMaxX, m_fMinY );
+ drawLine( m_fMinX, m_fMaxY, m_fMaxX, m_fMaxY );
+ drawLine( m_fMinX, m_fMinY, m_fMinX, m_fMaxY );
+ drawLine( m_fMaxX, m_fMinY, m_fMaxX, m_fMaxY );
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::drawOriginal()
+{
+ if( m_nValues && m_pXValues && m_pOrigYValues )
+ {
+ SetLineColor( Color( COL_RED ) );
+ for( int i = 0; i < m_nValues-1; i++ )
+ {
+ drawLine( m_pXValues[ i ], m_pOrigYValues[ i ],
+ m_pXValues[ i+1 ], m_pOrigYValues[ i+1 ] );
+ }
+ }
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::drawNew()
+{
+ if( m_nValues && m_pXValues && m_pNewYValues )
+ {
+ SetClipRegion( m_aGridArea );
+ SetLineColor( Color( COL_YELLOW ) );
+ for( int i = 0; i < m_nValues-1; i++ )
+ {
+ drawLine( m_pXValues[ i ], m_pNewYValues[ i ],
+ m_pXValues[ i+1 ], m_pNewYValues[ i+1 ] );
+ }
+ SetClipRegion();
+ }
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::Paint( const Rectangle& rRect )
+{
+ ModalDialog::Paint( rRect );
+ drawGrid();
+ drawOriginal();
+ drawNew();
+ m_aIAOManager.UpdateDisplay();
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::MouseMove( const MouseEvent& rEvt )
+{
+ if( rEvt.GetButtons() == MOUSE_LEFT && m_pDragMarker )
+ {
+ Point aPoint( rEvt.GetPosPixel() );
+ if( m_pDragMarker == m_pLeftMarker || m_pDragMarker == m_pRightMarker )
+ {
+ aPoint.X() = m_pDragMarker->GetBasePosition().X();
+ }
+ if( aPoint.Y() < m_aGridArea.Top() )
+ aPoint.Y() = m_aGridArea.Top();
+ else if( aPoint.Y() > m_aGridArea.Bottom() )
+ aPoint.Y() = m_aGridArea.Bottom();
+ // avoid flicker
+ if( aPoint != m_pDragMarker->GetBasePosition() )
+ {
+ m_pDragMarker->SetBasePosition( aPoint );
+ m_aIAOManager.UpdateDisplay();
+ }
+ }
+ ModalDialog::MouseMove( rEvt );
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::MouseButtonUp( const MouseEvent& rEvt )
+{
+ if( rEvt.GetButtons() == MOUSE_LEFT )
+ {
+ if( m_pDragMarker )
+ {
+ m_pDragMarker = NULL;
+ computeNew();
+ Invalidate( m_aGridArea );
+ Paint( m_aGridArea );
+ }
+ }
+
+ ModalDialog::MouseButtonUp( rEvt );
+}
+
+// ---------------------------------------------------------------------
+
+void GridWindow::MouseButtonDown( const MouseEvent& rEvt )
+{
+ Point aPoint( rEvt.GetPosPixel() );
+ B2dIAObject* pMarker = m_aIAOManager.GetIAObjectList();
+ while( pMarker && ! pMarker->IsHit( aPoint ) )
+ pMarker = pMarker->GetNext();
+
+ if( rEvt.GetButtons() == MOUSE_LEFT )
+ {
+ // user wants to drag a button
+ if( pMarker )
+ m_pDragMarker = (B2dIAOBitmapExReference*)pMarker;
+ }
+ else if( rEvt.GetButtons() == MOUSE_RIGHT )
+ {
+ // user wants to add/delete a button
+ if( pMarker && pMarker != m_pLeftMarker && pMarker != m_pRightMarker )
+ {
+ // delete marker under mouse
+ if( m_pDragMarker == pMarker )
+ m_pDragMarker = NULL;
+ delete pMarker;
+ }
+ else if( ! pMarker )
+ {
+ pMarker = new B2dIAOBitmapExReference(
+ &m_aIAOManager,
+ aPoint,
+ &m_aMarkerBitmap,
+ m_aMarkerBitmap.GetSizePixel().Width()/2,
+ m_aMarkerBitmap.GetSizePixel().Height()/2 );
+ pMarker->SetHittable( TRUE );
+ }
+ computeNew();
+ Invalidate( m_aGridArea );
+ Paint( m_aGridArea );
+ }
+ ModalDialog::MouseButtonDown( rEvt );
+}
+
+// ---------------------------------------------------------------------
+
+IMPL_LINK( GridWindow, ClickButtonHdl, Button*, pButton )
+{
+ if( pButton == &m_aResetButton )
+ {
+ int nType = (int)m_aResetTypeBox.GetEntryData( m_aResetTypeBox.GetSelectEntryPos() );
+ switch( nType )
+ {
+ case RESET_TYPE_LINEAR_ASCENDING:
+ {
+ for( int i = 0; i < m_nValues; i++ )
+ {
+ m_pNewYValues[ i ] = m_fMinY + (m_fMaxY-m_fMinY)/(m_fMaxX-m_fMinX)*(m_pXValues[i]-m_fMinX);
+ }
+ }
+ break;
+ case RESET_TYPE_LINEAR_DESCENDING:
+ {
+ for( int i = 0; i < m_nValues; i++ )
+ {
+ m_pNewYValues[ i ] = m_fMaxY - (m_fMaxY-m_fMinY)/(m_fMaxX-m_fMinX)*(m_pXValues[i]-m_fMinX);
+ }
+ }
+ break;
+ case RESET_TYPE_RESET:
+ {
+ if( m_pOrigYValues && m_pNewYValues && m_nValues )
+ memcpy( m_pNewYValues, m_pOrigYValues, m_nValues*sizeof(double) );
+ }
+ break;
+ case RESET_TYPE_EXPONENTIAL:
+ {
+ for( int i = 0; i < m_nValues; i++ )
+ {
+ m_pNewYValues[ i ] = m_fMinY + (m_fMaxY-m_fMinY)*(exp((m_pXValues[i]-m_fMinX)/(m_fMaxX-m_fMinX))-1.0)/(M_E-1.0);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ int nMarkers = m_aIAOManager.GetIAOCount();
+ B2dIAObject* pMarker = m_aIAOManager.GetIAObjectList();
+ for( int i = 0 ; i < nMarkers; i++, pMarker = pMarker->GetNext() )
+ {
+ // find nearest xvalue
+ double x, y;
+ transform( pMarker->GetBasePosition(), x, y );
+ int nIndex = 0;
+ double delta = fabs( x-m_pXValues[0] );
+ for( int n = 1; n < m_nValues; n++ )
+ {
+ if( delta > fabs( x - m_pXValues[ n ] ) )
+ {
+ delta = fabs( x - m_pXValues[ n ] );
+ nIndex = n;
+ }
+ }
+ if( pMarker == m_pLeftMarker )
+ pMarker->SetBasePosition( transform( m_fMinX, m_pNewYValues[ nIndex ] ) );
+ else if( pMarker == m_pRightMarker )
+ pMarker->SetBasePosition( transform( m_fMaxX, m_pNewYValues[ nIndex ] ) );
+ else
+ pMarker->SetBasePosition( transform( m_pXValues[ nIndex ], m_pNewYValues[ nIndex ] ) );
+ }
+ Invalidate( m_aGridArea );
+ Paint(Rectangle());
+ }
+ return 0;
+}
diff --git a/extensions/source/scanner/grid.hrc b/extensions/source/scanner/grid.hrc
new file mode 100644
index 000000000..1f60b0f01
--- /dev/null
+++ b/extensions/source/scanner/grid.hrc
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * $RCSfile: grid.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef GRID_HRC
+#define GRID_HRC
+
+#define GRID_DIALOG 1100
+#define GRID_DIALOG_OK_BTN 1
+#define GRID_DIALOG_CANCEL_BTN 2
+#define GRID_DIALOG_RESET_BTN 3
+#define GRID_DIALOG_TYPE_BOX 4
+#define GRID_DIALOG_HANDLE_BMP 5
+
+#define RESET_TYPE_LINEAR_ASCENDING 10
+#define RESET_TYPE_LINEAR_DESCENDING 11
+#define RESET_TYPE_RESET 12
+#define RESET_TYPE_EXPONENTIAL 13
+
+#endif
diff --git a/extensions/source/scanner/grid.hxx b/extensions/source/scanner/grid.hxx
new file mode 100644
index 000000000..92e5797a3
--- /dev/null
+++ b/extensions/source/scanner/grid.hxx
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * $RCSfile: grid.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _EXTENSIONS_SCANNER_GRID_HXX
+#define _EXTENSIONS_SCANNER_GRID_HXX
+
+#ifndef _SV_WINDOW_HXX
+#include <vcl/window.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#ifndef _SV_LSTBOX_HXX
+#include <vcl/lstbox.hxx>
+#endif
+#ifndef _SV_DIALOG_HXX
+#include <vcl/dialog.hxx>
+#endif
+#ifndef _B2D_MBASE_HXX
+#include <goodies/b2dmbase.hxx>
+#endif
+#ifndef _B2D_MPNT_HXX
+#include <goodies/b2dmbmp.hxx>
+#endif
+
+class GridWindow : public ModalDialog
+{
+ Rectangle m_aGridArea;
+
+ double m_fMinX;
+ double m_fMinY;
+ double m_fMaxX;
+ double m_fMaxY;
+
+ double m_fChunkX;
+ double m_fMinChunkX;
+ double m_fChunkY;
+ double m_fMinChunkY;
+
+ double* m_pXValues;
+ double* m_pOrigYValues;
+ int m_nValues;
+ double* m_pNewYValues;
+
+ BOOL m_bCutValues;
+
+ // stuff for handles
+ B2dIAOManager m_aIAOManager;
+ B2dIAOBitmapExReference* m_pLeftMarker;
+ B2dIAOBitmapExReference* m_pRightMarker;
+ B2dIAOBitmapExReference* m_pDragMarker;
+
+ BitmapEx m_aMarkerBitmap;
+
+ OKButton m_aOKButton;
+ CancelButton m_aCancelButton;
+
+ ListBox m_aResetTypeBox;
+ PushButton m_aResetButton;
+
+
+ Point transform( double x, double y );
+ void transform( const Point& rOriginal, double& x, double& y );
+
+ double findMinX();
+ double findMinY();
+ double findMaxX();
+ double findMaxY();
+
+ void drawGrid();
+ void drawOriginal();
+ void drawNew();
+
+ void computeExtremes();
+ void computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut );
+ void computeNew();
+ double interpolate( double x, double* pNodeX, double* pNodeY, int nNodes );
+
+ DECL_LINK( ClickButtonHdl, Button* );
+
+ virtual void MouseMove( const MouseEvent& );
+ virtual void MouseButtonDown( const MouseEvent& );
+ virtual void MouseButtonUp( const MouseEvent& );
+public:
+ GridWindow( double* pXValues, double* pYValues, int nValues,
+ Window* pParent, BOOL bCutValues = TRUE );
+ ~GridWindow();
+
+ void setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY );
+ double getMinX() { return m_fMinX; }
+ double getMinY() { return m_fMinY; }
+ double getMaxX() { return m_fMaxX; }
+ double getMaxY() { return m_fMaxY; }
+
+ int countValues() { return m_nValues; }
+ double* getXValues() { return m_pXValues; }
+ double* getOrigYValues() { return m_pOrigYValues; }
+ double* getNewYValues() { return m_pNewYValues; }
+
+ void drawPoint( double x, double y );
+ void drawLine( double x1, double y1, double x2, double y2 );
+
+ virtual void Paint( const Rectangle& rRect );
+};
+
+#endif // _EXTENSIONS_SCANNER_GRID_HXX
diff --git a/extensions/source/scanner/grid.src b/extensions/source/scanner/grid.src
new file mode 100644
index 000000000..087a43994
--- /dev/null
+++ b/extensions/source/scanner/grid.src
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * $RCSfile: grid.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <grid.hrc>
+
+ModalDialog GRID_DIALOG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 10 , 10 ) ;
+ Size = MAP_APPFONT ( 300, 200 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+
+ OKButton GRID_DIALOG_OK_BTN
+ {
+ Pos = MAP_APPFONT( 245, 5 );
+ Size = MAP_APPFONT( 50, 15 );
+ DefButton = TRUE;
+ };
+ CancelButton GRID_DIALOG_CANCEL_BTN
+ {
+ Pos = MAP_APPFONT ( 245 , 25 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ };
+ ListBox GRID_DIALOG_TYPE_BOX
+ {
+ Border = TRUE ;
+ Dropdown = TRUE ;
+ Pos = MAP_APPFONT( 245, 45 );
+ Size = MAP_APPFONT( 50, 130 );
+ };
+ PushButton GRID_DIALOG_RESET_BTN
+ {
+ Pos = MAP_APPFONT( 245, 65 );
+ Size = MAP_APPFONT( 50, 15 );
+ Text = "Setzen";
+ Text [ English ] = "Set";
+ Text[ english_us ] = "Set";
+ Text[ portuguese ] = "Definir";
+ Text[ russian ] = "Óñòàíîâèòü";
+ Text[ greek ] = "Ïñéóìüò";
+ Text[ dutch ] = "Zetten";
+ Text[ french ] = "Restaurer";
+ Text[ spanish ] = "Definir";
+ Text[ italian ] = "Imposta";
+ Text[ danish ] = "Definer";
+ Text[ swedish ] = "Definiera";
+ Text[ polish ] = "OsadŸ";
+ Text[ portuguese_brazilian ] = "Set";
+ Text[ japanese ] = "Ý’è";
+ Text[ korean ] = "ÁöÁ¤";
+ Text[ chinese_simplified ] = "É趨";
+ Text[ chinese_traditional ] = "«ü©w";
+ Text[ arabic ] = "ÊÚííä";
+ Text[ turkish ] = "Tanýmla";
+ };
+ Bitmap GRID_DIALOG_HANDLE_BMP
+ {
+ File = "handle.bmp";
+ };
+ String RESET_TYPE_LINEAR_ASCENDING
+ {
+ Text = "Linear steigend";
+ Text [ English ] = "Linear ascending";
+ Text[ english_us ] = "Linear ascending";
+ Text[ portuguese ] = "Linear crescente";
+ Text[ russian ] = "Ëèíåéíîå âîçðàñòàíèå";
+ Text[ greek ] = "ÃñáììéêÞ áýîçóç";
+ Text[ dutch ] = "Lineair stijgend";
+ Text[ french ] = "Croissance linéaire";
+ Text[ spanish ] = "Lineal ascendente";
+ Text[ italian ] = "Lineare crescente";
+ Text[ danish ] = "Lineær stigende";
+ Text[ swedish ] = "Linjärt stigande";
+ Text[ polish ] = "Wzrastaj¹ce linearnie";
+ Text[ portuguese_brazilian ] = "Linear ascending";
+ Text[ japanese ] = "‚Ü‚Á‚·‚®ã¸";
+ Text[ korean ] = "¿À¸§Â÷¼ø ¼±Çü";
+ Text[ chinese_simplified ] = "ÏßÐÔÉÏÉý";
+ Text[ chinese_traditional ] = "½u©Ê¤Wª@";
+ Text[ arabic ] = "ÎØí ÊÕÇÚÏí";
+ Text[ turkish ] = "Doðrusal artýþ";
+ };
+ String RESET_TYPE_LINEAR_DESCENDING
+ {
+ Text = "Linear fallend";
+ Text [ English ] = "Linear descending";
+ Text[ english_us ] = "Linear descending";
+ Text[ portuguese ] = "Linear decrescente";
+ Text[ russian ] = "Ëèíåéíîå óáûâàíèå";
+ Text[ greek ] = "ÃñáììéêÞ ìåßùóç";
+ Text[ dutch ] = "Lineair dalend";
+ Text[ french ] = "Décroissance linéaire";
+ Text[ spanish ] = "Lineal descendente";
+ Text[ italian ] = "Lineare descrescente";
+ Text[ danish ] = "Lineær faldende";
+ Text[ swedish ] = "Linjärt fallande";
+ Text[ polish ] = "Spadaj¹ce linearnie";
+ Text[ portuguese_brazilian ] = "Linear descending";
+ Text[ japanese ] = "‚Ü‚Á‚·‚®‰º~";
+ Text[ korean ] = "³»¸²Â÷¼ø ¼±Çü";
+ Text[ chinese_simplified ] = "ÏßÐÔϽµ";
+ Text[ chinese_traditional ] = "½u©Ê¤U­°";
+ Text[ arabic ] = "ÎØí ÊäÇÒáí";
+ Text[ turkish ] = "Doðrusal düþüþ";
+ };
+ String RESET_TYPE_RESET
+ {
+ Text = "Originalwerte";
+ Text [ English ] = "Original values";
+ Text[ english_us ] = "Original values";
+ Text[ portuguese ] = "Valores originais";
+ Text[ russian ] = "Èñõîäíûå çíà÷åíèÿ";
+ Text[ greek ] = "Áñ÷éêÝò ôéìÝò";
+ Text[ dutch ] = "Oorspronkelijke waarden";
+ Text[ french ] = "Restaurer les valeurs d'origine";
+ Text[ spanish ] = "Valores originales";
+ Text[ italian ] = "Valori originali";
+ Text[ danish ] = "Originalværdier";
+ Text[ swedish ] = "Originalvärden";
+ Text[ polish ] = "Wartoœci oryginalne";
+ Text[ portuguese_brazilian ] = "Original values";
+ Text[ japanese ] = "µØ¼ÞÅÙ’l";
+ Text[ korean ] = "¿ø·¡°ª";
+ Text[ chinese_simplified ] = "ԭʼÊýÖµ";
+ Text[ chinese_traditional ] = "­ì©l­È";
+ Text[ arabic ] = "ÇáÞíã ÇáÃÕáíÉ";
+ Text[ turkish ] = "Asýl deðerler";
+ };
+ String RESET_TYPE_EXPONENTIAL
+ {
+ Text = "Exponentiell wachsend";
+ Text [ English ] = "Exponential raise";
+ Text[ english_us ] = "Exponential increasing";
+ Text[ portuguese ] = "Exponencial crescente";
+ Text[ russian ] = "Ýêñïîíåíöèàëüíîå âîçðàñòàíèå";
+ Text[ greek ] = "ÅêèåôéêÞ áýîçóç";
+ Text[ dutch ] = "Exponentiele groei";
+ Text[ french ] = "Croissance exponentielle";
+ Text[ spanish ] = "Exponencial aumentando";
+ Text[ italian ] = "Esponenziale crescente";
+ Text[ danish ] = "Eksponentiel vækst";
+ Text[ swedish ] = "Exponentiellt växande";
+ Text[ polish ] = "Rosn¹ce wyk³adniczo";
+ Text[ portuguese_brazilian ] = "Exponential raise";
+ Text[ japanese ] = "‹}Œƒ‚É‘‚â‚·";
+ Text[ korean ] = "¿À¸§ Áö¼ö";
+ Text[ chinese_simplified ] = "Ö¸ÊýÐÍÔö³¤";
+ Text[ chinese_traditional ] = "¾­¼Æ¦¡»¼¼W";
+ Text[ arabic ] = "ÊÒÇíÏ ÃÓí";
+ Text[ turkish ] = "Üstel artýþ";
+ };
+};
diff --git a/extensions/source/scanner/makefile.mk b/extensions/source/scanner/makefile.mk
new file mode 100644
index 000000000..1e5742ecb
--- /dev/null
+++ b/extensions/source/scanner/makefile.mk
@@ -0,0 +1,147 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=extensions
+TARGET=scn
+ENABLE_EXCEPTIONS=TRUE
+PACKAGE=com$/sun$/star$/scanner
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+USE_DEFFILE=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- UnoTypes -----------------------------------------------------
+
+UNOTYPES=\
+ com.sun.star.uno.TypeClass \
+ com.sun.star.uno.XInterface \
+ com.sun.star.uno.Exception \
+ com.sun.star.uno.RuntimeException \
+ com.sun.star.uno.XWeak \
+ com.sun.star.awt.XBitmap \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.lang.EventObject \
+ com.sun.star.registry.XImplementationRegistration \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.registry.XSimpleRegistry \
+ com.sun.star.scanner.XScannerManager \
+ com.sun.star.scanner.ScannerContext \
+ com.sun.star.scanner.ScannerException
+
+# --- Files --------------------------------------------------------
+
+SLOFILES=\
+ $(SLO)$/scnserv.obj \
+ $(SLO)$/scanner.obj
+
+.IF "$(GUI)"=="WNT"
+SLOFILES+=\
+ $(SLO)$/scanwin.obj
+.ENDIF
+
+.IF "$(GUI)"=="UNX"
+SLOFILES+=\
+ $(SLO)$/sane.obj \
+ $(SLO)$/sanedlg.obj \
+ $(SLO)$/scanunx.obj \
+ $(SLO)$/grid.obj
+
+SRCFILES=\
+ sanedlg.src \
+ grid.src
+
+RESLIB1NAME=san
+RESLIB1SRSFILES= $(SRS)/scn.srs
+RESLIB1DEPN= sanedlg.src sanedlg.hrc grid.src grid.hrc
+.ENDIF
+
+SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
+SHL1STDLIBS=\
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(ONELIB) \
+ $(TOOLSLIB) \
+ $(VCLLIB) \
+ $(SVTOOLLIB) \
+ $(GOODIESLIB)
+
+.IF "$(GUI)"=="UNX"
+SHL1STDLIBS+=$(SVTOOLLIB)
+.ENDIF
+
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+SHL1IMPLIB=i$(TARGET)
+SHL1LIBS=$(SLB)$/$(TARGET).lib
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx
new file mode 100644
index 000000000..63296e32b
--- /dev/null
+++ b/extensions/source/scanner/sane.cxx
@@ -0,0 +1,979 @@
+/*************************************************************************
+ *
+ * $RCSfile: sane.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <tools/stream.hxx>
+#include <sane.hxx>
+#include <dlfcn.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
+#if defined DEBUG || defined DBG_UTIL
+#include <stdarg.h>
+#define dump_state( a, b, c, d ) fprintf( stderr, a, b, c, d );
+#else
+#define dump_state( a, b, c, d ) ;
+#endif
+inline void dbg_msg( char* pString, ... )
+{
+#if defined DEBUG || defined DBG_UTIL
+ va_list ap;
+ va_start( ap, pString );
+ vfprintf( stderr, pString, ap );
+ va_end( ap );
+#endif
+}
+
+#define FAIL_SHUTDOWN_STATE( x, y, z ) \
+ if( x != SANE_STATUS_GOOD ) \
+ { \
+ dump_state( "%s returned error %d (%s)\n", \
+ y, x, p_strstatus( x ) ); \
+ DeInit(); \
+ return z; \
+ }
+
+#define FAIL_STATE( x, y, z ) \
+ if( x != SANE_STATUS_GOOD ) \
+ { \
+ dump_state( "%s returned error %d (%s)\n", \
+ y, x, p_strstatus( x ) ); \
+ return z; \
+ }
+
+#define DUMP_STATE( x, y ) \
+ if( x != SANE_STATUS_GOOD ) \
+ { \
+ dump_state( "%s returned error %d (%s)\n", \
+ y, x, p_strstatus( x ) ); \
+ }
+
+#define CHECK_STATE( x, y ) \
+ if( x != SANE_STATUS_GOOD ) \
+ { \
+ dump_state( "%s returned error %d (%s)\n", \
+ y, x, p_strstatus( x ) ); \
+ } \
+ else
+
+int Sane::nRefCount = 0;
+void* Sane::pSaneLib = 0;
+SANE_Int Sane::nVersion = 0;
+SANE_Device** Sane::ppDevices = 0;
+int Sane::nDevices = 0;
+
+SANE_Status (*Sane::p_init)( SANE_Int*,
+ SANE_Auth_Callback ) = 0;
+void (*Sane::p_exit)() = 0;
+SANE_Status (*Sane::p_get_devices)( const SANE_Device***,
+ SANE_Bool ) = 0;
+SANE_Status (*Sane::p_open)( SANE_String_Const, SANE_Handle ) = 0;
+void (*Sane::p_close)( SANE_Handle ) = 0;
+const SANE_Option_Descriptor* (*Sane::p_get_option_descriptor)(
+ SANE_Handle, SANE_Int ) = 0;
+SANE_Status (*Sane::p_control_option)( SANE_Handle, SANE_Int,
+ SANE_Action, void*,
+ SANE_Int* ) = 0;
+SANE_Status (*Sane::p_get_parameters)( SANE_Handle,
+ SANE_Parameters* ) = 0;
+SANE_Status (*Sane::p_start)( SANE_Handle ) = 0;
+SANE_Status (*Sane::p_read)( SANE_Handle, SANE_Byte*, SANE_Int,
+ SANE_Int* ) = 0;
+void (*Sane::p_cancel)( SANE_Handle ) = 0;
+SANE_Status (*Sane::p_set_io_mode)( SANE_Handle, SANE_Bool ) = 0;
+SANE_Status (*Sane::p_get_select_fd)( SANE_Handle, SANE_Int* ) = 0;
+const SANE_String_Const (*Sane::p_strstatus)( SANE_Status ) = 0;
+
+static BOOL bSaneSymbolLoadFailed = FALSE;
+
+inline void* Sane::LoadSymbol( char* pSymbolname )
+{
+ void *pRet = dlsym( pSaneLib, pSymbolname );
+ if( ! pRet )
+ {
+ fprintf( stderr, "Could not load symbol %s: %s\n",
+ pSymbolname, dlerror() );
+ bSaneSymbolLoadFailed = TRUE;
+ }
+ return pRet;
+}
+
+SANE_Status Sane::ControlOption( int nOption, SANE_Action nAction,
+ void* pData )
+{
+ SANE_Status nStatus = SANE_STATUS_GOOD;
+ SANE_Int nInfo = 0;
+
+ nStatus = p_control_option( maHandle, (SANE_Int)nOption,
+ nAction, pData, &nInfo );
+ DUMP_STATE( nStatus, "sane_control_option" );
+#ifdef DEBUG
+ if( nStatus != SANE_STATUS_GOOD )
+ {
+ char* pAction = "Unknown";
+ switch( nAction )
+ {
+ case SANE_ACTION_GET_VALUE:
+ pAction = "SANE_ACTION_GET_VALUE";break;
+ case SANE_ACTION_SET_VALUE:
+ pAction = "SANE_ACTION_SET_VALUE";break;
+ case SANE_ACTION_SET_AUTO:
+ pAction = "SANE_ACTION_SET_AUTO";break;
+ }
+ dbg_msg( "Option: \"%s\" action: %s\n",
+ ByteString( GetOptionName( nOption ), gsl_getSystemTextEncoding() ).GetBuffer(),
+ pAction );
+ }
+#endif
+// if( nInfo & ( SANE_INFO_RELOAD_OPTIONS | SANE_INFO_RELOAD_PARAMS ) )
+ if( nInfo & SANE_INFO_RELOAD_OPTIONS )
+ ReloadOptions();
+ return nStatus;
+}
+
+Sane::Sane() :
+ maHandle( 0 ),
+ mppOptions( 0 ),
+ mnOptions( 0 ),
+ mnDevice( -1 )
+{
+ if( ! nRefCount || ! pSaneLib )
+ Init();
+ nRefCount++;
+};
+
+Sane::~Sane()
+{
+ if( IsOpen() )
+ Close();
+ nRefCount--;
+ if( ! nRefCount && pSaneLib )
+ DeInit();
+}
+
+void Sane::Init()
+{
+ pSaneLib = dlopen( "libsane.so", RTLD_LAZY );
+ if( pSaneLib )
+ {
+ bSaneSymbolLoadFailed = FALSE;
+ p_init = (SANE_Status(*)(SANE_Int*, SANE_Auth_Callback ))
+ LoadSymbol( "sane_init" );
+ p_exit = (void(*)())
+ LoadSymbol( "sane_exit" );
+ p_get_devices = (SANE_Status(*)(const SANE_Device***,
+ SANE_Bool ))
+ LoadSymbol( "sane_get_devices" );
+ p_open = (SANE_Status(*)(SANE_String_Const, SANE_Handle ))
+ LoadSymbol( "sane_open" );
+ p_close = (void(*)(SANE_Handle))
+ LoadSymbol( "sane_close" );
+ p_get_option_descriptor = (const SANE_Option_Descriptor*(*)(SANE_Handle,
+ SANE_Int))
+ LoadSymbol( "sane_get_option_descriptor" );
+ p_control_option = (SANE_Status(*)(SANE_Handle, SANE_Int,
+ SANE_Action, void*, SANE_Int*))
+ LoadSymbol( "sane_control_option" );
+ p_get_parameters = (SANE_Status(*)(SANE_Handle,SANE_Parameters*))
+ LoadSymbol( "sane_get_parameters" );
+ p_start = (SANE_Status(*)(SANE_Handle))
+ LoadSymbol( "sane_start" );
+ p_read = (SANE_Status(*)(SANE_Handle, SANE_Byte*,
+ SANE_Int, SANE_Int* ))
+ LoadSymbol( "sane_read" );
+ p_cancel = (void(*)(SANE_Handle))
+ LoadSymbol( "sane_cancel" );
+ p_set_io_mode = (SANE_Status(*)(SANE_Handle, SANE_Bool))
+ LoadSymbol( "sane_set_io_mode" );
+ p_get_select_fd = (SANE_Status(*)(SANE_Handle, SANE_Int*))
+ LoadSymbol( "sane_get_select_fd" );
+ p_strstatus = (const SANE_String_Const(*)(SANE_Status))
+ LoadSymbol( "sane_strstatus" );
+ if( bSaneSymbolLoadFailed )
+ DeInit();
+ else
+ {
+ SANE_Status nStatus = p_init( &nVersion, 0 );
+ FAIL_SHUTDOWN_STATE( nStatus, "sane_init", );
+ nStatus = p_get_devices( (const SANE_Device***)&ppDevices,
+ SANE_FALSE );
+ FAIL_SHUTDOWN_STATE( nStatus, "sane_get_devices", );
+ for( nDevices = 0 ; ppDevices[ nDevices ]; nDevices++ );
+ }
+ }
+#if defined DEBUG || defined DBG_UTIL
+ else
+ fprintf( stderr, "libsane.so could not be opened: %s\n",
+ dlerror() );
+#endif
+}
+
+void Sane::DeInit()
+{
+ if( pSaneLib )
+ {
+ p_exit();
+ dlclose( pSaneLib );
+ pSaneLib = 0;
+ }
+}
+
+void Sane::ReloadDevices()
+{
+ if( IsOpen() )
+ Close();
+ DeInit();
+ Init();
+}
+
+void Sane::ReloadOptions()
+{
+ if( ! IsOpen() )
+ return;
+
+ SANE_Option_Descriptor* pZero = (SANE_Option_Descriptor*)
+ p_get_option_descriptor( maHandle, 0 );
+ SANE_Word pOptions[2];
+ SANE_Status nStatus = p_control_option( maHandle, 0, SANE_ACTION_GET_VALUE,
+ (void*)pOptions, NULL );
+ if( nStatus != SANE_STATUS_GOOD )
+ fprintf( stderr, "Error: sane driver returned %s while reading number of options !\n", p_strstatus( nStatus ) );
+
+ mnOptions = pOptions[ 0 ];
+ if( pZero->size > sizeof( SANE_Word ) )
+ fprintf( stderr, "driver returned numer of options with larger size tha SANE_Word !!!\n" );
+ if( mppOptions )
+ delete mppOptions;
+ mppOptions = (const SANE_Option_Descriptor**)new SANE_Option_Descriptor*[ mnOptions ];
+ mppOptions[ 0 ] = (SANE_Option_Descriptor*)pZero;
+ for( int i = 1; i < mnOptions; i++ )
+ mppOptions[ i ] = (SANE_Option_Descriptor*)
+ p_get_option_descriptor( maHandle, i );
+
+ CheckConsistency( NULL, TRUE );
+
+ maReloadOptionsLink.Call( this );
+}
+
+BOOL Sane::Open( const char* name )
+{
+ int i;
+
+ SANE_Status nStatus = p_open( (SANE_String_Const)name, &maHandle );
+ FAIL_STATE( nStatus, "sane_open", FALSE );
+
+ ReloadOptions();
+
+ if( mnDevice == -1 )
+ {
+ ByteString aDevice( name );
+ for( i = 0; i < nDevices; i++ )
+ {
+ if( aDevice.Equals( ppDevices[i]->name ) )
+ {
+ mnDevice = i;
+ break;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+BOOL Sane::Open( int n )
+{
+ if( n >= 0 && n < nDevices )
+ {
+ mnDevice = n;
+ return Open( (char*)ppDevices[n]->name );
+ }
+ return FALSE;
+}
+
+void Sane::Close()
+{
+ if( maHandle )
+ {
+ p_close( maHandle );
+ delete mppOptions;
+ mppOptions = 0;
+ maHandle = 0;
+ mnDevice = -1;
+ }
+}
+
+void Sane::Stop()
+{
+ if( maHandle )
+ {
+ int nDevice = mnDevice;
+ Close();
+ Open( nDevice );
+ }
+}
+
+int Sane::GetOptionByName( const char* rName )
+{
+ int i;
+ ByteString aOption( rName );
+ for( i = 0; i < mnOptions; i++ )
+ {
+ if( mppOptions[i]->name && aOption.Equals( mppOptions[i]->name ) )
+ return i;
+ }
+ return -1;
+}
+
+BOOL Sane::GetOptionValue( int n, BOOL& rRet )
+{
+ if( ! maHandle || mppOptions[n]->type != SANE_TYPE_BOOL )
+ return FALSE;
+ SANE_Word nRet;
+ SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, &nRet );
+ if( nStatus != SANE_STATUS_GOOD )
+ return FALSE;
+
+ rRet = nRet;
+ return TRUE;
+}
+
+BOOL Sane::GetOptionValue( int n, ByteString& rRet )
+{
+ BOOL bSuccess = FALSE;
+ if( ! maHandle || mppOptions[n]->type != SANE_TYPE_STRING )
+ return FALSE;
+ char* pRet = new char[mppOptions[n]->size+1];
+ SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pRet );
+ if( nStatus == SANE_STATUS_GOOD )
+ {
+ bSuccess = TRUE;
+ rRet = pRet;
+ }
+ delete pRet;
+ return bSuccess;
+}
+
+BOOL Sane::GetOptionValue( int n, double& rRet, int nElement )
+{
+ BOOL bSuccess = FALSE;
+
+ if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT &&
+ mppOptions[n]->type != SANE_TYPE_FIXED ) )
+ return FALSE;
+
+ SANE_Word* pRet = new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)];
+ SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pRet );
+ if( nStatus == SANE_STATUS_GOOD )
+ {
+ bSuccess = TRUE;
+ if( mppOptions[n]->type == SANE_TYPE_INT )
+ rRet = (double)pRet[ nElement ];
+ else
+ rRet = SANE_UNFIX( pRet[nElement] );
+ }
+ delete pRet;
+ return bSuccess;
+}
+
+BOOL Sane::GetOptionValue( int n, double* pSet )
+{
+ if( ! maHandle || ! ( mppOptions[n]->type == SANE_TYPE_FIXED ||
+ mppOptions[n]->type == SANE_TYPE_INT ) )
+ return FALSE;
+
+ SANE_Word* pFixedSet = new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)];
+ SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pFixedSet );
+ if( nStatus != SANE_STATUS_GOOD )
+ {
+ delete pFixedSet;
+ return FALSE;
+ }
+ for( int i = 0; i <mppOptions[n]->size/sizeof(SANE_Word); i++ )
+ {
+ if( mppOptions[n]->type == SANE_TYPE_FIXED )
+ pSet[i] = SANE_UNFIX( pFixedSet[i] );
+ else
+ pSet[i] = (double) pFixedSet[i];
+ }
+ delete pFixedSet;
+ return TRUE;
+}
+
+BOOL Sane::SetOptionValue( int n, BOOL bSet )
+{
+ if( ! maHandle || mppOptions[n]->type != SANE_TYPE_BOOL )
+ return FALSE;
+ SANE_Word nRet = bSet ? SANE_TRUE : SANE_FALSE;
+ SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, &nRet );
+ if( nStatus != SANE_STATUS_GOOD )
+ return FALSE;
+ return TRUE;
+}
+
+BOOL Sane::SetOptionValue( int n, const String& rSet )
+{
+ if( ! maHandle || mppOptions[n]->type != SANE_TYPE_STRING )
+ return FALSE;
+ ByteString aSet( rSet, gsl_getSystemTextEncoding() );
+ SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, (void*)aSet.GetBuffer() );
+ if( nStatus != SANE_STATUS_GOOD )
+ return FALSE;
+ return TRUE;
+}
+
+BOOL Sane::SetOptionValue( int n, double fSet, int nElement )
+{
+ BOOL bSuccess = FALSE;
+
+ if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT &&
+ mppOptions[n]->type != SANE_TYPE_FIXED ) )
+ return FALSE;
+
+ SANE_Status nStatus;
+ if( mppOptions[n]->size/sizeof(SANE_Word) > 1 )
+ {
+ SANE_Word* pSet = new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)];
+ nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pSet );
+ if( nStatus == SANE_STATUS_GOOD )
+ {
+ pSet[nElement] = mppOptions[n]->type == SANE_TYPE_INT ?
+ (SANE_Word)fSet : SANE_FIX( fSet );
+ nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, pSet );
+ }
+ delete pSet;
+ }
+ else
+ {
+ SANE_Word nSetTo =
+ mppOptions[n]->type == SANE_TYPE_INT ?
+ nSetTo = (SANE_Word)fSet : nSetTo = SANE_FIX( fSet );
+
+ nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, &nSetTo );
+ if( nStatus == SANE_STATUS_GOOD )
+ bSuccess = TRUE;
+ }
+ return bSuccess;
+}
+
+BOOL Sane::SetOptionValue( int n, double* pSet )
+{
+ if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT &&
+ mppOptions[n]->type != SANE_TYPE_FIXED ) )
+ return FALSE;
+ SANE_Word* pFixedSet = new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)];
+ for( int i = 0; i <mppOptions[n]->size/sizeof(SANE_Word); i++ )
+ {
+ if( mppOptions[n]->type == SANE_TYPE_FIXED )
+ pFixedSet[i] = SANE_FIX( pSet[i] );
+ else
+ pFixedSet[i] = (SANE_Word)pSet[i];
+ }
+ SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, pFixedSet );
+ delete pFixedSet;
+ if( nStatus != SANE_STATUS_GOOD )
+ return FALSE;
+ return TRUE;
+}
+
+enum FrameStyleType {
+ FrameStyle_BW, FrameStyle_Gray, FrameStyle_RGB, FrameStyle_Separated
+};
+
+#define BYTE_BUFFER_SIZE 32768
+
+static inline UINT8 _ReadValue( FILE* fp, int depth )
+{
+ if( depth == 16 )
+ {
+ UINT16 nWord;
+ // data always come in native byte order !
+ // 16 bits is not really supported by backends as of now
+ // e.g. UMAX Astra 1200S delivers 16 bit but in BIGENDIAN
+ // against SANE documentation (xscanimage gets the same result
+ // as we do
+ fread( &nWord, 1, 2, fp );
+ return (UINT8)( nWord / 256 );
+ }
+ UINT8 nByte;
+ fread( &nByte, 1, 1, fp );
+ return nByte;
+}
+
+BOOL Sane::CheckConsistency( const char* pMes, BOOL bInit )
+{
+ static SANE_Option_Descriptor** pDescArray = NULL;
+ static SANE_Option_Descriptor* pZero = NULL;
+
+ if( bInit )
+ {
+ pDescArray = (SANE_Option_Descriptor**)mppOptions;
+ if( mppOptions )
+ pZero = (SANE_Option_Descriptor*)mppOptions[0];
+ return TRUE;
+ }
+
+ BOOL bConsistent = TRUE;
+
+ if( pDescArray != mppOptions )
+ bConsistent = FALSE;
+ if( pZero != mppOptions[0] )
+ bConsistent = FALSE;
+
+ if( ! bConsistent )
+ dbg_msg( "Sane is not consistent. (%s)\n", pMes );
+
+ return bConsistent;
+}
+
+BOOL Sane::Start( BitmapTransporter& rBitmap )
+{
+ int nStream = 0, nLine = 0, i = 0;
+ SANE_Parameters aParams;
+ FrameStyleType eType = FrameStyle_Gray;
+ BOOL bSuccess = TRUE;
+ BOOL bWidthSet = FALSE;
+
+ if( ! maHandle )
+ return FALSE;
+
+ BYTE* pBuffer = NULL;
+
+ SANE_Status nStatus = SANE_STATUS_GOOD;
+
+ rBitmap.lock();
+ SvMemoryStream& aConverter = rBitmap.getStream();
+ aConverter.Seek( 0 );
+ aConverter.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+
+ // write bitmap stream header
+ aConverter << 'B' << 'M';
+ aConverter << (ULONG) 0;
+ aConverter << (ULONG) 0;
+ aConverter << (ULONG) 60;
+
+ // write BITMAPINFOHEADER
+ aConverter << (UINT32)40;
+ aConverter << (UINT32)0; // fill in width later
+ aConverter << (UINT32)0; // fill in height later
+ aConverter << (UINT16)1;
+ // create header for 24 bits
+ // correct later if necessary
+ aConverter << (UINT16)24;
+ aConverter << (UINT32)0;
+ aConverter << (UINT32)0;
+ aConverter << (UINT32)0;
+ aConverter << (UINT32)0;
+ aConverter << (UINT32)0;
+ aConverter << (UINT32)0;
+
+ for( nStream=0; nStream < 3 && bSuccess ; nStream++ )
+ {
+ nStatus = p_start( maHandle );
+ DUMP_STATE( nStatus, "sane_start" );
+ CheckConsistency( "sane_start" );
+ if( nStatus == SANE_STATUS_GOOD )
+ {
+ nStatus = p_get_parameters( maHandle, &aParams );
+ DUMP_STATE( nStatus, "sane_get_parameters" );
+ CheckConsistency( "sane_get_parameters" );
+#if defined DEBUG || defined DBG_UTIL
+ char* ppFormats[] = { "SANE_FRAME_GRAY", "SANE_FRAME_RGB",
+ "SANE_FRAME_RED", "SANE_FRAME_GREEN",
+ "SANE_FRAME_BLUE", "Unknown !!!" };
+ fprintf( stderr, "Parameters for frame %d:\n", nStream );
+ if( aParams.format < 0 || aParams.format > 4 )
+ aParams.format = (SANE_Frame)5;
+ fprintf( stderr, "format: %s\n", ppFormats[ (int)aParams.format ] );
+ fprintf( stderr, "last_frame: %s\n", aParams.last_frame ? "TRUE" : "FALSE" );
+ fprintf( stderr, "depth: %d\n", (int)aParams.depth );
+ fprintf( stderr, "pixels_per_line: %d\n", (int)aParams.pixels_per_line );
+ fprintf( stderr, "bytes_per_line: %d\n", (int)aParams.bytes_per_line );
+#endif
+ if( ! pBuffer )
+ {
+ pBuffer = new BYTE[ BYTE_BUFFER_SIZE < 4*aParams.bytes_per_line ? 4*aParams.bytes_per_line : BYTE_BUFFER_SIZE ];
+ }
+
+ if( aParams.last_frame )
+ nStream=3;
+
+ switch( aParams.format )
+ {
+ case SANE_FRAME_GRAY:
+ eType = FrameStyle_Gray;
+ if( aParams.depth == 1 )
+ eType = FrameStyle_BW;
+ break;
+ case SANE_FRAME_RGB:
+ eType = FrameStyle_RGB;
+ break;
+ case SANE_FRAME_RED:
+ case SANE_FRAME_GREEN:
+ case SANE_FRAME_BLUE:
+ eType = FrameStyle_Separated;
+ break;
+ default:
+ fprintf( stderr, "Warning: unknown frame style !!!\n" );
+ }
+
+ BOOL bSynchronousRead = TRUE;
+
+ // should be fail safe, but ... ??
+ nStatus = p_set_io_mode( maHandle, SANE_FALSE );
+ CheckConsistency( "sane_set_io_mode" );
+ if( nStatus != SANE_STATUS_GOOD )
+ {
+ bSynchronousRead = FALSE;
+ nStatus = p_set_io_mode( maHandle, SANE_TRUE );
+ CheckConsistency( "sane_set_io_mode" );
+#if defined DEBUG || defined DBG_UTIL
+ if( nStatus != SANE_STATUS_GOOD )
+ // what ?!?
+ fprintf( stderr, "Sane::Start: driver is confused\n" );
+#endif
+ }
+
+ SANE_Int nLen=0;
+ SANE_Int fd = 0;
+
+ if( ! bSynchronousRead )
+ {
+ nStatus = p_get_select_fd( maHandle, &fd );
+ DUMP_STATE( nStatus, "sane_get_select_fd" );
+ CheckConsistency( "sane_get_select_fd" );
+ if( nStatus != SANE_STATUS_GOOD )
+ bSynchronousRead = TRUE;
+ }
+ FILE* pFrame = tmpfile();
+ if( ! pFrame )
+ {
+ bSuccess = FALSE;
+ break;
+ }
+ do {
+ if( ! bSynchronousRead )
+ {
+ fd_set fdset;
+ struct timeval tv;
+
+ FD_ZERO( &fdset );
+ FD_SET( (int)fd, &fdset );
+ tv.tv_sec = 5;
+ tv.tv_usec = 0;
+ if( select( fd+1, &fdset, NULL, NULL, &tv ) == 0 )
+ fprintf( stderr, "Timout on sane_read descriptor\n" );
+ }
+ nLen = 0;
+ nStatus = p_read( maHandle, pBuffer, BYTE_BUFFER_SIZE, &nLen );
+ CheckConsistency( "sane_read" );
+ if( nLen && ( nStatus == SANE_STATUS_GOOD ||
+ nStatus == SANE_STATUS_EOF ) )
+ {
+ fwrite( pBuffer, 1, nLen, pFrame );
+ }
+ else
+ DUMP_STATE( nStatus, "sane_read" );
+ } while( nStatus == SANE_STATUS_GOOD );
+ if( nStatus != SANE_STATUS_EOF )
+ {
+ fclose( pFrame );
+ bSuccess = FALSE;
+ break;
+ }
+
+ int nFrameLength = ftell( pFrame );
+ fseek( pFrame, 0, SEEK_SET );
+ UINT32 nWidth = (UINT32) aParams.pixels_per_line;
+ UINT32 nHeight = (UINT32) (nFrameLength / aParams.bytes_per_line);
+ if( ! bWidthSet )
+ {
+#ifdef DEBUG
+ fprintf( stderr, "set dimensions to %d, %d\n", nWidth, nHeight );
+#endif
+ aConverter.Seek( 18 );
+ aConverter << nWidth;
+ aConverter << nHeight;
+ bWidthSet = TRUE;
+ }
+ aConverter.Seek(60);
+
+ if( eType == FrameStyle_BW )
+ {
+ aConverter.Seek( 10 );
+ aConverter << (ULONG)64;
+ aConverter.Seek( 28 );
+ aConverter << (UINT16) 1;
+ aConverter.Seek( 54 );
+ // write color table
+ aConverter << (UINT32)0;
+ aConverter << (UINT16)0xffff;
+ aConverter << (UINT8)0xff;
+ aConverter << (UINT8)0;
+ aConverter.Seek( 64 );
+ }
+ else if( eType == FrameStyle_Gray )
+ {
+ aConverter.Seek( 10 );
+ aConverter << (ULONG)1084;
+ aConverter.Seek( 28 );
+ aConverter << (UINT16) 8;
+ aConverter.Seek( 54 );
+ // write color table
+ for( nLine = 0; nLine < 256; nLine++ )
+ {
+ aConverter << (UINT8)nLine;
+ aConverter << (UINT8)nLine;
+ aConverter << (UINT8)nLine;
+ aConverter << (UINT8)0;
+ }
+ aConverter.Seek( 1084 );
+ }
+
+ for( nLine = nHeight-1;
+ nLine >= 0; nLine-- )
+ {
+ fseek( pFrame, nLine * aParams.bytes_per_line, SEEK_SET );
+ if( eType == FrameStyle_BW ||
+ ( eType == FrameStyle_Gray && aParams.depth == 8 )
+ )
+ {
+ fread( pBuffer, 1, aParams.bytes_per_line, pFrame );
+ aConverter.Write( pBuffer, aParams.bytes_per_line );
+ }
+ else if( eType == FrameStyle_Gray )
+ {
+ for( i = 0; i < (aParams.pixels_per_line); i++ )
+ {
+ UINT8 nGray = _ReadValue( pFrame, aParams.depth );
+ aConverter << nGray;
+ }
+ }
+ else if( eType == FrameStyle_RGB )
+ {
+ for( i = 0; i < (aParams.pixels_per_line); i++ )
+ {
+ UINT8 nRed, nGreen, nBlue;
+ nRed = _ReadValue( pFrame, aParams.depth );
+ nGreen = _ReadValue( pFrame, aParams.depth );
+ nBlue = _ReadValue( pFrame, aParams.depth );
+ aConverter << nBlue;
+ aConverter << nGreen;
+ aConverter << nRed;
+ }
+ }
+ else if( eType == FrameStyle_Separated )
+ {
+ for( i = 0; i < (aParams.pixels_per_line); i++ )
+ {
+ UINT8 nValue = _ReadValue( pFrame, aParams.depth );
+ switch( aParams.format )
+ {
+ case SANE_FRAME_RED:
+ aConverter.SeekRel( 2 );
+ aConverter << nValue;
+ break;
+ case SANE_FRAME_GREEN:
+ aConverter.SeekRel( 1 );
+ aConverter << nValue;
+ aConverter.SeekRel( 1 );
+ break;
+ case SANE_FRAME_BLUE:
+ aConverter << nValue;
+ aConverter.SeekRel( 2 );
+ break;
+ }
+ }
+ }
+ int nGap = aConverter.Tell() & 3;
+ if( nGap )
+ aConverter.SeekRel( 4-nGap );
+ }
+ fclose( pFrame ); // deletes tmpfile
+ if( eType != FrameStyle_Separated )
+ break;
+ }
+ else
+ bSuccess = FALSE;
+ }
+ // get stream length
+ aConverter.Seek( STREAM_SEEK_TO_END );
+ int nPos = aConverter.Tell();
+
+ aConverter.Seek( 2 );
+ aConverter << (ULONG) nPos+1;
+ aConverter.Seek( 0 );
+
+ rBitmap.unlock();
+
+ if( bSuccess )
+ {
+ // only cancel a successful operation
+ // sane disrupts memory else
+ p_cancel( maHandle );
+ CheckConsistency( "sane_cancel" );
+ }
+ if( pBuffer )
+ delete pBuffer;
+
+ ReloadOptions();
+
+
+ dbg_msg( "Sane::Start returns with %s\n", bSuccess ? "TRUE" : "FALSE" );
+
+ return bSuccess;
+}
+
+int Sane::GetRange( int n, double*& rpDouble )
+{
+ if( mppOptions[n]->constraint_type != SANE_CONSTRAINT_RANGE &&
+ mppOptions[n]->constraint_type != SANE_CONSTRAINT_WORD_LIST )
+ {
+ return -1;
+ }
+
+ rpDouble = 0;
+ int nItems, i;
+ BOOL bIsFixed = mppOptions[n]->type == SANE_TYPE_FIXED ? TRUE : FALSE;
+
+ dbg_msg( "Sane::GetRange of option %s ", mppOptions[n]->name );
+ if(mppOptions[n]->constraint_type == SANE_CONSTRAINT_RANGE )
+ {
+ double fMin, fMax, fQuant;
+ if( bIsFixed )
+ {
+ fMin = SANE_UNFIX( mppOptions[n]->constraint.range->min );
+ fMax = SANE_UNFIX( mppOptions[n]->constraint.range->max );
+ fQuant = SANE_UNFIX( mppOptions[n]->constraint.range->quant );
+ }
+ else
+ {
+ fMin = (double)mppOptions[n]->constraint.range->min;
+ fMax = (double)mppOptions[n]->constraint.range->max;
+ fQuant = (double)mppOptions[n]->constraint.range->quant;
+ }
+ if( fQuant != 0.0 )
+ {
+ dbg_msg( "quantum range [ %lg ; %lg ; %lg ]\n",
+ fMin, fQuant, fMax );
+ nItems = (int)((fMax - fMin)/fQuant)+1;
+ rpDouble = new double[ nItems ];
+ double fValue = fMin;
+ for( i = 0; i < nItems; i++, fValue += fQuant )
+ rpDouble[i] = fValue;
+ rpDouble[ nItems-1 ] = fMax;
+ return nItems;
+ }
+ else
+ {
+ dbg_msg( "normal range [ %lg %lg ]\n",
+ fMin, fMax );
+ rpDouble = new double[2];
+ rpDouble[0] = fMin;
+ rpDouble[1] = fMax;
+ return 0;
+ }
+ }
+ else
+ {
+ nItems = mppOptions[n]->constraint.word_list[0];
+ rpDouble = new double[nItems];
+ for( i=0; i<nItems; i++ )
+ {
+ rpDouble[i] = bIsFixed ?
+ SANE_UNFIX( mppOptions[n]->constraint.word_list[i+1] ) :
+ (double)mppOptions[n]->constraint.word_list[i+1];
+ }
+ dbg_msg( "worlist [ %lg ... %lg ]\n",
+ rpDouble[ 0 ], rpDouble[ nItems-1 ] );
+ return nItems;
+ }
+
+ return -1;
+}
+
+static char *ppUnits[] = {
+ "",
+ "[Pixel]",
+ "[Bit]",
+ "[mm]",
+ "[DPI]",
+ "[%]",
+ "[usec]"
+};
+
+String Sane::GetOptionUnitName( int n )
+{
+ String aText;
+ SANE_Unit nUnit = mppOptions[n]->unit;
+ if( nUnit < 0 || nUnit > sizeof( ppUnits )/sizeof( ppUnits[0] ) )
+ aText = String::CreateFromAscii( "[unknown units]" );
+ else
+ aText = String( ppUnits[ nUnit ], gsl_getSystemTextEncoding() );
+ return aText;
+}
+
+BOOL Sane::ActivateButtonOption( int n )
+{
+ SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, NULL );
+ if( nStatus != SANE_STATUS_GOOD )
+ return FALSE;
+ return TRUE;
+}
diff --git a/extensions/source/scanner/sane.hxx b/extensions/source/scanner/sane.hxx
new file mode 100644
index 000000000..885de6d2f
--- /dev/null
+++ b/extensions/source/scanner/sane.hxx
@@ -0,0 +1,232 @@
+/*************************************************************************
+ *
+ * $RCSfile: sane.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SANE_HXX
+#define _SANE_HXX
+
+#include <tools/string.hxx>
+#include <vcl/bitmap.hxx>
+#include <sane/sane.h>
+#include <scanner.hxx>
+
+// ---------------------
+// - BitmapTransporter -
+// ---------------------
+
+class BitmapTransporter : public OWeakObject, AWT::XBitmap
+{
+ SvMemoryStream m_aStream;
+ vos::OMutex m_aProtector;
+
+public:
+
+ BitmapTransporter() {}
+ virtual ~BitmapTransporter() {}
+
+
+ // XInterface
+ virtual ANY SAL_CALL queryInterface( const Type & rType ) throw( RuntimeException );
+ virtual void SAL_CALL acquire() throw( RuntimeException ) { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() throw( RuntimeException ) { OWeakObject::release(); }
+
+ virtual AWT::Size SAL_CALL getSize();
+ virtual SEQ( sal_Int8 ) SAL_CALL getDIB();
+ virtual SEQ( sal_Int8 ) SAL_CALL getMaskDIB() { return SEQ( sal_Int8 )(); }
+
+ // Misc
+ void lock() { m_aProtector.acquire(); }
+ void unlock() { m_aProtector.release(); }
+ SvMemoryStream& getStream() { return m_aStream; }
+};
+
+// --------
+// - Sane -
+// --------
+
+class Sane
+{
+private:
+ static int nRefCount;
+ static void* pSaneLib;
+
+ static SANE_Status (*p_init)( SANE_Int*,
+ SANE_Auth_Callback );
+ static void (*p_exit)();
+ static SANE_Status (*p_get_devices)( const SANE_Device***,
+ SANE_Bool );
+ static SANE_Status (*p_open)( SANE_String_Const, SANE_Handle );
+ static void (*p_close)( SANE_Handle );
+ static const SANE_Option_Descriptor* (*p_get_option_descriptor)(
+ SANE_Handle, SANE_Int );
+ static SANE_Status (*p_control_option)( SANE_Handle, SANE_Int,
+ SANE_Action, void*,
+ SANE_Int* );
+ static SANE_Status (*p_get_parameters)( SANE_Handle,
+ SANE_Parameters* );
+ static SANE_Status (*p_start)( SANE_Handle );
+ static SANE_Status (*p_read)( SANE_Handle, SANE_Byte*, SANE_Int,
+ SANE_Int* );
+ static void (*p_cancel)( SANE_Handle );
+ static SANE_Status (*p_set_io_mode)( SANE_Handle, SANE_Bool );
+ static SANE_Status (*p_get_select_fd)( SANE_Handle, SANE_Int* );
+ static const SANE_String_Const (*p_strstatus)( SANE_Status );
+
+ static SANE_Int nVersion;
+ static SANE_Device** ppDevices;
+ static int nDevices;
+
+ const SANE_Option_Descriptor** mppOptions;
+ int mnOptions;
+ int mnDevice;
+ SANE_Handle maHandle;
+
+ Link maReloadOptionsLink;
+
+ inline void* LoadSymbol( char* );
+ void Init();
+ void DeInit();
+ void Stop();
+
+ SANE_Status ControlOption( int, SANE_Action, void* );
+
+ BOOL CheckConsistency( const char*, BOOL bInit = FALSE );
+
+public:
+ Sane();
+ ~Sane();
+
+ static BOOL IsSane()
+ { return pSaneLib ? TRUE : FALSE; }
+ BOOL IsOpen()
+ { return maHandle ? TRUE : FALSE; }
+ static int CountDevices()
+ { return nDevices; }
+ static String GetName( int n )
+ { return String( ppDevices[n]->name, gsl_getSystemTextEncoding() ); }
+ static String GetVendor( int n )
+ { return String( ppDevices[n]->vendor, gsl_getSystemTextEncoding() ); }
+ static String GetModel( int n )
+ { return String( ppDevices[n]->model, gsl_getSystemTextEncoding() ); }
+ static String GetType( int n )
+ { return String( ppDevices[n]->type, gsl_getSystemTextEncoding() ); }
+
+ String GetOptionName( int n )
+ { return String( (char*)mppOptions[n]->name, gsl_getSystemTextEncoding() ); }
+ String GetOptionTitle( int n )
+ { return String( (char*)mppOptions[n]->title, gsl_getSystemTextEncoding() ); }
+ SANE_Value_Type GetOptionType( int n )
+ { return mppOptions[n]->type; }
+ SANE_Unit GetOptionUnit( int n )
+ { return mppOptions[n]->unit; }
+ String GetOptionUnitName( int n );
+ SANE_Int GetOptionCap( int n )
+ { return mppOptions[n]->cap; }
+ SANE_Constraint_Type GetOptionConstraintType( int n )
+ { return mppOptions[n]->constraint_type; }
+ const char** GetStringConstraint( int n )
+ { return (const char**)mppOptions[n]->constraint.string_list; }
+ int GetRange( int, double*& );
+
+ inline int GetOptionElements( int n );
+ int GetOptionByName( const char* );
+ BOOL GetOptionValue( int, BOOL& );
+ BOOL GetOptionValue( int, ByteString& );
+ BOOL GetOptionValue( int, double&, int nElement = 0 );
+ BOOL GetOptionValue( int, double* );
+
+ BOOL SetOptionValue( int, BOOL );
+ BOOL SetOptionValue( int, const String& );
+ BOOL SetOptionValue( int, double, int nElement = 0 );
+ BOOL SetOptionValue( int, double* );
+
+ BOOL ActivateButtonOption( int );
+
+ int CountOptions() { return mnOptions; }
+ int GetDeviceNumber() { return mnDevice; }
+
+ BOOL Open( const char* );
+ BOOL Open( int );
+ void Close();
+ void ReloadDevices();
+ void ReloadOptions();
+
+ BOOL Start( BitmapTransporter& );
+
+ inline Link SetReloadOptionsHdl( const Link& rLink );
+};
+
+inline int Sane::GetOptionElements( int n )
+{
+ if( mppOptions[n]->type == SANE_TYPE_FIXED ||
+ mppOptions[n]->type == SANE_TYPE_INT )
+ {
+ return mppOptions[n]->size/sizeof( SANE_Word );
+ }
+ return 1;
+}
+
+inline Link Sane::SetReloadOptionsHdl( const Link& rLink )
+{
+ Link aRet = maReloadOptionsLink;
+ maReloadOptionsLink = rLink;
+ return aRet;
+}
+
+#endif
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
new file mode 100644
index 000000000..e929c42c7
--- /dev/null
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -0,0 +1,1364 @@
+/*************************************************************************
+ *
+ * $RCSfile: sanedlg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <vcl/config.hxx>
+#include <vcl/msgbox.hxx>
+#include <sanedlg.hxx>
+#include <sanedlg.hrc>
+#include <grid.hxx>
+
+#define USE_SAVE_STATE
+#undef SAVE_ALL_STATES
+
+ResId SaneResId( ULONG nID )
+{
+ static ResMgr* pResMgr = ResMgr::CreateResMgr( "san" MAKE_NUMSTR(SUPD) );
+ return ResId( nID, pResMgr );
+}
+
+SaneDlg::SaneDlg( Window* pParent, Sane& rSane ) :
+ ModalDialog( pParent, SaneResId( RID_SANE_DIALOG ) ),
+ mrSane( rSane ),
+ mpRange( 0 ),
+ maMapMode( MAP_APPFONT ),
+ mbIsDragging( FALSE ),
+ mbDragDrawn( FALSE ),
+ maOKButton( this, SaneResId( RID_SCAN_OK ) ),
+ maCancelButton( this, SaneResId( RID_SCAN_CANCEL ) ),
+ maPreviewButton( this, SaneResId( RID_PREVIEW_BTN ) ),
+ maDeviceInfoButton( this, SaneResId( RID_DEVICEINFO_BTN ) ),
+ maPreviewBox( this, SaneResId( RID_PREVIEW_BOX ) ),
+ maAreaBox( this, SaneResId( RID_SCANAREA_BOX ) ),
+ maDeviceBoxTxt( this, SaneResId( RID_DEVICE_BOX_TXT ) ),
+ maScanLeftTxt( this, SaneResId( RID_SCAN_LEFT_TXT ) ),
+ maScanTopTxt( this, SaneResId( RID_SCAN_TOP_TXT ) ),
+ maRightTxt( this, SaneResId( RID_SCAN_RIGHT_TXT ) ),
+ maBottomTxt( this, SaneResId( RID_SCAN_BOTTOM_TXT ) ),
+ maReslTxt( this, SaneResId( RID_SCAN_RESOLUTION_TXT ) ),
+ maOptionTitle( this, SaneResId( RID_SCAN_OPTIONTITLE_TXT ) ),
+ maOptionsTxt( this, SaneResId( RID_SCAN_OPTION_TXT ) ),
+ maOptionDescTxt( this, SaneResId( RID_SCAN_OPTION_DESC_TXT ) ),
+ maVectorTxt( this, SaneResId( RID_SCAN_NUMERIC_VECTOR_TXT ) ),
+ maLeftField( this, SaneResId( RID_SCAN_LEFT_BOX ) ),
+ maTopField( this, SaneResId( RID_SCAN_TOP_BOX ) ),
+ maRightField( this, SaneResId( RID_SCAN_RIGHT_BOX ) ),
+ maBottomField( this, SaneResId( RID_SCAN_BOTTOM_BOX ) ),
+ maDeviceBox( this, SaneResId( RID_DEVICE_BOX ) ),
+ maOptionBox( this, SaneResId( RID_SCAN_OPTION_BOX ) ),
+ maReslBox( this, SaneResId( RID_SCAN_RESOLUTION_BOX ) ),
+ maBoolCheckBox( this, SaneResId( RID_SCAN_BOOL_OPTION_BOX ) ),
+ maStringEdit( this, SaneResId( RID_SCAN_STRING_OPTION_EDT ) ),
+ maQuantumRangeBox( this, SaneResId( RID_SCAN_QUANTUM_RANGE_BOX ) ),
+ maStringRangeBox( this, SaneResId( RID_SCAN_STRING_RANGE_BOX ) ),
+ maNumericEdit( this, SaneResId( RID_SCAN_NUMERIC_OPTION_EDT ) ),
+ maButtonOption( this, SaneResId( RID_SCAN_BUTTON_OPTION_BTN ) ),
+ maVectorBox( this, SaneResId( RID_SCAN_NUMERIC_VECTOR_BOX ) ),
+ maAdvancedBox( this, SaneResId( RID_SCAN_ADVANCED_BOX ) ),
+ maAdvancedTxt( this, SaneResId( RID_SCAN_ADVANCED_TXT ) )
+{
+ if( Sane::IsSane() )
+ {
+ InitDevices(); // opens first sane device
+ DisableOption();
+ InitFields();
+ }
+
+ maDeviceInfoButton.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) );
+ maPreviewButton.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) );
+ maButtonOption.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) );
+ maDeviceBox.SetSelectHdl( LINK( this, SaneDlg, SelectHdl ) );
+ maOptionBox.SetSelectHdl( LINK( this, SaneDlg, OptionsBoxSelectHdl ) );
+ maOKButton.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) );
+ maCancelButton.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) );
+ maBoolCheckBox.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) );
+ maStringEdit.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) );
+ maNumericEdit.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) );
+ maVectorBox.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) );
+ maReslBox.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) );
+ maStringRangeBox.SetSelectHdl( LINK( this, SaneDlg, SelectHdl ) );
+ maQuantumRangeBox.SetSelectHdl( LINK( this, SaneDlg, SelectHdl ) );
+ maLeftField.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) );
+ maRightField.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) );
+ maTopField.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) );
+ maBottomField.SetModifyHdl( LINK( this, SaneDlg, ModifyHdl ) );
+ maAdvancedBox.SetClickHdl( LINK( this, SaneDlg, ClickBtnHdl ) );
+
+ maOldLink = mrSane.SetReloadOptionsHdl( LINK( this, SaneDlg, ReloadSaneOptionsHdl ) );
+
+ maOptionBox.SetNodeBitmaps(
+ Bitmap( SaneResId( RID_SCAN_BITMAP_PLUS ) ),
+ Bitmap( SaneResId( RID_SCAN_BITMAP_MINUS ) )
+ );
+ maOptionBox.SetWindowBits( WB_HASLINES |
+ WB_HASBUTTONS |
+ WB_NOINITIALSELECTION |
+ WB_HASBUTTONSATROOT |
+ WB_HASLINESATROOT
+ );
+ FreeResource();
+}
+
+SaneDlg::~SaneDlg()
+{
+}
+
+short SaneDlg::Execute()
+{
+ if( ! Sane::IsSane() )
+ {
+ ErrorBox aErrorBox( NULL, WB_OK | WB_DEF_OK,
+ String( SaneResId( RID_SANE_NOSANELIB_TXT ) ) );
+ aErrorBox.Execute();
+ return FALSE;
+ }
+ LoadState();
+ return ModalDialog::Execute();
+}
+
+void SaneDlg::InitDevices()
+{
+ if( ! Sane::IsSane() )
+ return;
+
+ if( mrSane.IsOpen() )
+ mrSane.Close();
+ mrSane.ReloadDevices();
+ maDeviceBox.Clear();
+ for( int i = 0; i < Sane::CountDevices(); i++ )
+ maDeviceBox.InsertEntry( Sane::GetName( i ) );
+ if( Sane::CountDevices() )
+ {
+ mrSane.Open( 0 );
+ maDeviceBox.SelectEntry( Sane::GetName( 0 ) );
+
+ }
+}
+
+void SaneDlg::InitFields()
+{
+ if( ! Sane::IsSane() )
+ return;
+
+ int nOption, i, n, nValue;
+ double fValue;
+ BOOL bSuccess = FALSE;
+ char *ppSpecialOptions[] = {
+ "resolution",
+ "tl-x",
+ "tl-y",
+ "br-x",
+ "br-y",
+ "preview"
+ };
+
+ maReslBox.Clear();
+ maMinTopLeft = Point( 0, 0 );
+ maMaxBottomRight = Point( PREVIEW_WIDTH, PREVIEW_HEIGHT );
+
+ if( ! mrSane.IsOpen() )
+ return;
+
+ // set Resolution
+ nOption = mrSane.GetOptionByName( "resolution" );
+ if( nOption != -1 )
+ {
+ double fRes;
+
+ bSuccess = mrSane.GetOptionValue( nOption, fRes );
+ if( bSuccess )
+ {
+ maReslBox.Enable( TRUE );
+
+ maReslBox.SetValue( (long)fRes );
+ double *pDouble = NULL;
+ nValue = mrSane.GetRange( nOption, pDouble );
+ if( nValue > -1 )
+ {
+ if( nValue )
+ {
+ maReslBox.SetMin( (long)pDouble[0] );
+ maReslBox.SetMax( (long)pDouble[ nValue-1 ] );
+ for( i=0; i<nValue; i++ )
+ {
+ if( i == 0 || i == nValue-1 || ! ( ((int)pDouble[i]) % 20) )
+ maReslBox.InsertValue( (long)pDouble[i] );
+ }
+ }
+ else
+ {
+ maReslBox.SetMin( (long)pDouble[0] );
+ maReslBox.SetMax( (long)pDouble[1] );
+ maReslBox.InsertValue( (long)pDouble[0] );
+ maReslBox.InsertValue( (long)pDouble[1] );
+ }
+ if( pDouble )
+ delete pDouble;
+ }
+ else
+ maReslBox.Enable( FALSE );
+ }
+ }
+ else
+ maReslBox.Enable( FALSE );
+
+ // set scan area
+ for( i = 0; i < 4; i++ )
+ {
+ char *pOptionName;
+ MetricField* pField;
+ switch( i )
+ {
+ case 0:
+ pOptionName = "tl-x";
+ pField = &maLeftField;
+ break;
+ case 1:
+ pOptionName = "tl-y";
+ pField = &maTopField;
+ break;
+ case 2:
+ pOptionName = "br-x";
+ pField = &maRightField;
+ break;
+ case 3:
+ pOptionName = "br-y";
+ pField = &maBottomField;
+ }
+ nOption = mrSane.GetOptionByName( pOptionName );
+ bSuccess = FALSE;
+ if( nOption != -1 )
+ {
+ bSuccess = mrSane.GetOptionValue( nOption, fValue, 0 );
+ if( bSuccess )
+ {
+ if( mrSane.GetOptionUnit( nOption ) == SANE_UNIT_MM )
+ {
+ pField->SetUnit( FUNIT_MM );
+ pField->SetValue( (int)fValue, FUNIT_MM );
+ }
+ else // SANE_UNIT_PIXEL
+ {
+ pField->SetValue( (int)fValue, FUNIT_CUSTOM );
+ pField->SetCustomUnitText( String::CreateFromAscii( "Pixel" ) );
+ }
+ switch( i ) {
+ case 0: maTopLeft.X() = (int)fValue;break;
+ case 1: maTopLeft.Y() = (int)fValue;break;
+ case 2: maBottomRight.X() = (int)fValue;break;
+ case 3: maBottomRight.Y() = (int)fValue;break;
+ }
+ }
+ double *pDouble = NULL;
+ nValue = mrSane.GetRange( nOption, pDouble );
+ if( nValue > -1 )
+ {
+ if( pDouble )
+ {
+ pField->SetMin( (long)pDouble[0] );
+ if( nValue )
+ pField->SetMax( (long)pDouble[ nValue-1 ] );
+ else
+ pField->SetMax( (long)pDouble[ 1 ] );
+ delete pDouble;
+ }
+ switch( i ) {
+ case 0: maMinTopLeft.X() = pField->GetMin();break;
+ case 1: maMinTopLeft.Y() = pField->GetMin();break;
+ case 2: maMaxBottomRight.X() = pField->GetMax();break;
+ case 3: maMaxBottomRight.Y() = pField->GetMax();break;
+ }
+ }
+ else
+ {
+ switch( i ) {
+ case 0: maMinTopLeft.X() = (int)fValue;break;
+ case 1: maMinTopLeft.Y() = (int)fValue;break;
+ case 2: maMaxBottomRight.X() = (int)fValue;break;
+ case 3: maMaxBottomRight.Y() = (int)fValue;break;
+ }
+ }
+ pField->Enable( TRUE );
+ }
+ else
+ pField->Enable( FALSE );
+ }
+ maTopLeft = GetPixelPos( maTopLeft );
+ maBottomRight = GetPixelPos( maBottomRight );
+ maPreviewRect = Rectangle( maTopLeft,
+ Size( maBottomRight.X() - maTopLeft.X(),
+ maBottomRight.Y() - maTopLeft.Y() )
+ );
+ // fill OptionBox
+ maOptionBox.Clear();
+ SvLBoxEntry* pParentEntry = 0;
+ BOOL bGroupRejected = FALSE;
+ for( i = 1; i < mrSane.CountOptions(); i++ )
+ {
+ String aOption=mrSane.GetOptionName( i );
+ BOOL bInsertAdvanced =
+ mrSane.GetOptionCap( i ) & SANE_CAP_ADVANCED &&
+ ! maAdvancedBox.IsChecked() ? FALSE : TRUE;
+ if( mrSane.GetOptionType( i ) == SANE_TYPE_GROUP )
+ {
+ if( bInsertAdvanced )
+ {
+ aOption = mrSane.GetOptionTitle( i );
+ pParentEntry = maOptionBox.InsertEntry( aOption );
+ bGroupRejected = FALSE;
+ }
+ else
+ bGroupRejected = TRUE;
+ }
+ else if( aOption.Len() &&
+ ! ( mrSane.GetOptionCap( i ) &
+ (
+ SANE_CAP_HARD_SELECT |
+ SANE_CAP_INACTIVE
+ ) ) &&
+ bInsertAdvanced && ! bGroupRejected )
+ {
+ BOOL bIsSpecial = FALSE;
+ for( n = 0; !bIsSpecial &&
+ n < sizeof(ppSpecialOptions)/sizeof(ppSpecialOptions[0]); n++ )
+ {
+ if( aOption.EqualsAscii( ppSpecialOptions[n] ) )
+ bIsSpecial=TRUE;
+ }
+ if( ! bIsSpecial )
+ {
+ if( pParentEntry )
+ maOptionBox.InsertEntry( aOption, pParentEntry );
+ else
+ maOptionBox.InsertEntry( aOption );
+ }
+ }
+ }
+}
+
+IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton )
+{
+ if( mrSane.IsOpen() )
+ {
+ if( pButton == &maDeviceInfoButton )
+ {
+ String aString( SaneResId( RID_SANE_DEVICEINFO_TXT ) );
+ String aSR( RTL_CONSTASCII_USTRINGPARAM( "%s" ) );
+ aString.SearchAndReplace( aSR, Sane::GetName( mrSane.GetDeviceNumber() ) );
+ aString.SearchAndReplace( aSR, Sane::GetVendor( mrSane.GetDeviceNumber() ) );
+ aString.SearchAndReplace( aSR, Sane::GetModel( mrSane.GetDeviceNumber() ) );
+ aString.SearchAndReplace( aSR, Sane::GetType( mrSane.GetDeviceNumber() ) );
+ InfoBox aInfoBox( this, aString );
+ aInfoBox.Execute();
+ }
+ else if( pButton == &maPreviewButton )
+ AcquirePreview();
+ else if( pButton == &maBoolCheckBox )
+ {
+ mrSane.SetOptionValue( mnCurrentOption,
+ maBoolCheckBox.IsChecked() ?
+ (BOOL)TRUE : (BOOL)FALSE );
+ }
+ else if( pButton == &maButtonOption )
+ {
+ mrSane.ActivateButtonOption( mnCurrentOption );
+ }
+ else if( pButton == &maAdvancedBox )
+ {
+ ReloadSaneOptionsHdl( NULL );
+ }
+ }
+ if( pButton == &maOKButton )
+ {
+ double fRes = (double)maReslBox.GetValue();
+ SetAdjustedNumericalValue( "resolution", fRes );
+ mrSane.SetReloadOptionsHdl( maOldLink );
+ UpdateScanArea( TRUE );
+ SaveState();
+ EndDialog( mrSane.IsOpen() ? 1 : 0 );
+ }
+ else if( pButton == &maCancelButton )
+ {
+ mrSane.SetReloadOptionsHdl( maOldLink );
+ mrSane.Close();
+ EndDialog( 0 );
+ }
+ return 0;
+}
+
+IMPL_LINK( SaneDlg, SelectHdl, ListBox*, pListBox )
+{
+ if( pListBox == &maDeviceBox && Sane::IsSane() && Sane::CountDevices() )
+ {
+ String aNewDevice = maDeviceBox.GetSelectEntry();
+ int nNumber;
+ if( aNewDevice.Equals( Sane::GetName( nNumber = mrSane.GetDeviceNumber() ) ) )
+ {
+ mrSane.Close();
+ mrSane.Open( nNumber );
+ InitFields();
+ }
+ }
+ if( mrSane.IsOpen() )
+ {
+ if( pListBox == &maQuantumRangeBox )
+ {
+ ByteString aValue( maQuantumRangeBox.GetSelectEntry(), gsl_getSystemTextEncoding() );
+ double fValue = atof( aValue.GetBuffer() );
+ mrSane.SetOptionValue( mnCurrentOption, fValue, mnCurrentElement );
+ }
+ else if( pListBox == &maStringRangeBox )
+ {
+ mrSane.SetOptionValue( mnCurrentOption, maStringRangeBox.GetSelectEntry() );
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK( SaneDlg, OptionsBoxSelectHdl, SvTreeListBox*, pBox )
+{
+ if( pBox == &maOptionBox && Sane::IsSane() )
+ {
+ String aOption =
+ maOptionBox.GetEntryText( maOptionBox.FirstSelected() );
+ int nOption = mrSane.GetOptionByName( ByteString( aOption, gsl_getSystemTextEncoding() ).GetBuffer() );
+ if( nOption != -1 && nOption != mnCurrentOption )
+ {
+ DisableOption();
+ mnCurrentOption = nOption;
+ maOptionTitle.SetText( mrSane.GetOptionTitle( mnCurrentOption ) );
+ SANE_Value_Type nType = mrSane.GetOptionType( mnCurrentOption );
+ SANE_Constraint_Type nConstraint;
+ switch( nType )
+ {
+ case SANE_TYPE_BOOL: EstablishBoolOption();break;
+ case SANE_TYPE_STRING:
+ nConstraint = mrSane.GetOptionConstraintType( mnCurrentOption );
+ if( nConstraint == SANE_CONSTRAINT_STRING_LIST )
+ EstablishStringRange();
+ else
+ EstablishStringOption();
+ break;
+ case SANE_TYPE_FIXED:
+ case SANE_TYPE_INT:
+ {
+ nConstraint = mrSane.GetOptionConstraintType( mnCurrentOption );
+ mnCurrentElement = 0;
+ if( nConstraint == SANE_CONSTRAINT_RANGE ||
+ nConstraint == SANE_CONSTRAINT_WORD_LIST )
+ EstablishQuantumRange();
+ else
+ {
+ mfMin = mfMax = 0.0;
+ EstablishNumericOption();
+ }
+ int nElements = mrSane.GetOptionElements( mnCurrentOption );
+ if( nElements > 1 )
+ {
+ if( nElements <= 10 )
+ {
+ maVectorBox.SetValue( 1 );
+ maVectorBox.SetMin( 1 );
+ maVectorBox.SetMax(
+ mrSane.GetOptionElements( mnCurrentOption ) );
+ maVectorBox.Show( TRUE );
+ maVectorTxt.Show( TRUE );
+ }
+ else
+ {
+ double* x = new double[ nElements ];
+ double* y = new double[ nElements ];
+ for( int i = 0; i < nElements; i++ )
+ {
+ x[ i ] = (double)i;
+ mrSane.GetOptionValue( mnCurrentOption, x[i], i );
+ }
+ GridWindow aGrid( x, y, nElements, this );
+ aGrid.SetText( mrSane.GetOptionName( mnCurrentOption ) );
+ aGrid.setBoundings( 0, mfMin, nElements, mfMax );
+ aGrid.Execute();
+
+ delete x;
+ delete y;
+ }
+ }
+ }
+ break;
+ case SANE_TYPE_BUTTON:
+ EstablishButtonOption();
+ break;
+ default: break;
+ }
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK( SaneDlg, ModifyHdl, Edit*, pEdit )
+{
+ if( mrSane.IsOpen() )
+ {
+ if( pEdit == &maStringEdit )
+ {
+ mrSane.SetOptionValue( mnCurrentOption, maStringEdit.GetText() );
+ }
+ else if( pEdit == &maReslBox )
+ {
+ double fRes = (double)maReslBox.GetValue();
+ int nOption = mrSane.GetOptionByName( "resolution" );
+ if( nOption != -1 )
+ {
+ double* pDouble = NULL;
+ int nValues = mrSane.GetRange( nOption, pDouble );
+ if( nValues > 0 )
+ {
+ int i;
+ for( i = 0; i < nValues; i++ )
+ {
+ if( fRes == pDouble[i] )
+ break;
+ }
+ if( i >= nValues )
+ fRes = pDouble[0];
+ }
+ else if( nValues == 0 )
+ {
+ if( fRes < pDouble[ 0 ] )
+ fRes = pDouble[ 0 ];
+ if( fRes > pDouble[ 1 ] )
+ fRes = pDouble[ 1 ];
+ }
+ maReslBox.SetValue( (ULONG)fRes );
+ }
+ }
+ else if( pEdit == &maNumericEdit )
+ {
+ double fValue;
+ char pBuf[256];
+ ByteString aContents( maNumericEdit.GetText(), gsl_getSystemTextEncoding() );
+ fValue = atof( aContents.GetBuffer() );
+ if( mfMin != mfMax && ( fValue < mfMin || fValue > mfMax ) )
+ {
+ if( fValue < mfMin )
+ fValue = mfMin;
+ else if( fValue > mfMax )
+ fValue = mfMax;
+ sprintf( pBuf, "%g", fValue );
+ maNumericEdit.SetText( String( pBuf, gsl_getSystemTextEncoding() ) );
+ }
+ mrSane.SetOptionValue( mnCurrentOption, fValue, mnCurrentElement );
+ }
+ else if( pEdit == &maVectorBox )
+ {
+ char pBuf[256];
+ mnCurrentElement = maVectorBox.GetValue()-1;
+ double fValue;
+ mrSane.GetOptionValue( mnCurrentOption, fValue, mnCurrentElement );
+ sprintf( pBuf, "%g", fValue );
+ String aValue( pBuf, gsl_getSystemTextEncoding() );
+ maNumericEdit.SetText( aValue );
+ maQuantumRangeBox.SelectEntry( aValue );
+ }
+ else if( pEdit == &maTopField )
+ {
+ Point aPoint( 0, maTopField.GetValue() );
+ aPoint = GetPixelPos( aPoint );
+ maTopLeft.Y() = aPoint.Y();
+ DrawDrag();
+ }
+ else if( pEdit == &maLeftField )
+ {
+ Point aPoint( maLeftField.GetValue(), 0 );
+ aPoint = GetPixelPos( aPoint );
+ maTopLeft.X() = aPoint.X();
+ DrawDrag();
+ }
+ else if( pEdit == &maBottomField )
+ {
+ Point aPoint( 0, maBottomField.GetValue() );
+ aPoint = GetPixelPos( aPoint );
+ maBottomRight.Y() = aPoint.Y();
+ DrawDrag();
+ }
+ else if( pEdit == &maRightField )
+ {
+ Point aPoint( maRightField.GetValue(), 0 );
+ aPoint = GetPixelPos( aPoint );
+ maBottomRight.X() = aPoint.X();
+ DrawDrag();
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK( SaneDlg, ReloadSaneOptionsHdl, Sane*, pSane )
+{
+ mnCurrentOption = -1;
+ mnCurrentElement = 0;
+ DisableOption();
+ InitFields();
+ Rectangle aDummyRect( Point( 0, 0 ), GetSizePixel() );
+ Paint( aDummyRect );
+ return 0;
+}
+
+void SaneDlg::AcquirePreview()
+{
+ if( ! mrSane.IsOpen() )
+ return;
+
+ UpdateScanArea( TRUE );
+ // set small resolution for preview
+ double fResl = (double)maReslBox.GetValue();
+ SetAdjustedNumericalValue( "resolution", 30.0 );
+
+ int nOption = mrSane.GetOptionByName( "preview" );
+ if( nOption == -1 )
+ {
+ String aString( SaneResId( RID_SANE_NORESOLUTIONOPTION_TXT ) );
+ WarningBox aBox( this, WB_OK_CANCEL | WB_DEF_OK, aString );
+ if( aBox.Execute() == RET_CANCEL )
+ return;
+ }
+ else
+ mrSane.SetOptionValue( nOption, (BOOL)TRUE );
+
+ BitmapTransporter aTransporter;
+ if( ! mrSane.Start( aTransporter ) )
+ {
+ ErrorBox aErrorBox( this, WB_OK | WB_DEF_OK,
+ String( SaneResId( RID_SANE_SCANERROR_TXT ) ) );
+ aErrorBox.Execute();
+ }
+ else
+ {
+#ifdef DEBUG
+ aTransporter.getStream().Seek( STREAM_SEEK_TO_END );
+ fprintf( stderr, "Previewbitmapstream contains %d bytes\n", aTransporter.getStream().Tell() );
+#endif
+ aTransporter.getStream().Seek( STREAM_SEEK_TO_BEGIN );
+ maPreviewBitmap.Read( aTransporter.getStream(), TRUE );
+ }
+
+ SetAdjustedNumericalValue( "resolution", fResl );
+ maReslBox.SetValue( (ULONG)fResl );
+
+ maPreviewRect = Rectangle( maTopLeft,
+ Size( maBottomRight.X() - maTopLeft.X(),
+ maBottomRight.Y() - maTopLeft.Y() )
+ );
+ Paint( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
+}
+
+void SaneDlg::Paint( const Rectangle& rRect )
+{
+ SetMapMode( maMapMode );
+ SetFillColor( Color( COL_WHITE ) );
+ SetLineColor( Color( COL_WHITE ) );
+ DrawRect( Rectangle( Point( PREVIEW_UPPER_LEFT, PREVIEW_UPPER_TOP ),
+ Size( PREVIEW_WIDTH, PREVIEW_HEIGHT ) ) );
+ SetMapMode( MapMode( MAP_PIXEL ) );
+ // check for sane values
+ DrawBitmap( maPreviewRect.TopLeft(), maPreviewRect.GetSize(),
+ maPreviewBitmap );
+
+ mbDragDrawn = FALSE;
+ DrawDrag();
+
+ ModalDialog::Paint( rRect );
+}
+
+void SaneDlg::DisableOption()
+{
+ maBoolCheckBox.Show( FALSE );
+ maStringEdit.Show( FALSE );
+ maNumericEdit.Show( FALSE );
+ maQuantumRangeBox.Show( FALSE );
+ maStringRangeBox.Show( FALSE );
+ maButtonOption.Show( FALSE );
+ maVectorBox.Show( FALSE );
+ maVectorTxt.Show( FALSE );
+ maOptionDescTxt.Show( FALSE );
+}
+
+void SaneDlg::EstablishBoolOption()
+{
+ BOOL bSuccess, bValue;
+
+ bSuccess = mrSane.GetOptionValue( mnCurrentOption, bValue );
+ if( bSuccess )
+ {
+ maOptionDescTxt.SetText( mrSane.GetOptionName( mnCurrentOption ) );
+ maOptionDescTxt.Show( TRUE );
+ maBoolCheckBox.Check( bValue );
+ maBoolCheckBox.Show( TRUE );
+ }
+}
+
+void SaneDlg::EstablishStringOption()
+{
+ BOOL bSuccess;
+ ByteString aValue;
+
+ bSuccess = mrSane.GetOptionValue( mnCurrentOption, aValue );
+ if( bSuccess )
+ {
+ maOptionDescTxt.SetText( mrSane.GetOptionName( mnCurrentOption ) );
+ maOptionDescTxt.Show( TRUE );
+ maStringEdit.SetText( String( aValue, gsl_getSystemTextEncoding() ) );
+ maStringEdit.Show( TRUE );
+ }
+}
+
+void SaneDlg::EstablishStringRange()
+{
+ const char** ppStrings = mrSane.GetStringConstraint( mnCurrentOption );
+ maStringRangeBox.Clear();
+ for( int i = 0; ppStrings[i] != 0; i++ )
+ maStringRangeBox.InsertEntry( String( ppStrings[i], gsl_getSystemTextEncoding() ) );
+ ByteString aValue;
+ mrSane.GetOptionValue( mnCurrentOption, aValue );
+ maStringRangeBox.SelectEntry( String( aValue, gsl_getSystemTextEncoding() ) );
+ maStringRangeBox.Show( TRUE );
+ maOptionDescTxt.SetText( mrSane.GetOptionName( mnCurrentOption ) );
+ maOptionDescTxt.Show( TRUE );
+}
+
+void SaneDlg::EstablishQuantumRange()
+{
+ if( mpRange )
+ {
+ delete mpRange;
+ mpRange = 0;
+ }
+ int nValues = mrSane.GetRange( mnCurrentOption, mpRange );
+ if( nValues == 0 )
+ {
+ mfMin = mpRange[ 0 ];
+ mfMax = mpRange[ 1 ];
+ delete mpRange;
+ mpRange = 0;
+ EstablishNumericOption();
+ }
+ else if( nValues > 0 )
+ {
+ char pBuf[ 256 ];
+ maQuantumRangeBox.Clear();
+ mfMin = mpRange[ 0 ];
+ mfMax = mpRange[ nValues-1 ];
+ for( int i = 0; i < nValues; i++ )
+ {
+ sprintf( pBuf, "%g", mpRange[ i ] );
+ maQuantumRangeBox.InsertEntry( String( pBuf, gsl_getSystemTextEncoding() ) );
+ }
+ double fValue;
+ if( mrSane.GetOptionValue( mnCurrentOption, fValue, mnCurrentElement ) )
+ {
+ sprintf( pBuf, "%g", fValue );
+ maQuantumRangeBox.SelectEntry( String( pBuf, gsl_getSystemTextEncoding() ) );
+ }
+ maQuantumRangeBox.Show( TRUE );
+ String aText( mrSane.GetOptionName( mnCurrentOption ) );
+ aText += ' ';
+ aText += mrSane.GetOptionUnitName( mnCurrentOption );
+ maOptionDescTxt.SetText( aText );
+ maOptionDescTxt.Show( TRUE );
+ }
+}
+
+void SaneDlg::EstablishNumericOption()
+{
+ BOOL bSuccess;
+ double fValue;
+
+ bSuccess = mrSane.GetOptionValue( mnCurrentOption, fValue );
+ if( ! bSuccess )
+ return;
+
+ char pBuf[256];
+ String aText( mrSane.GetOptionName( mnCurrentOption ) );
+ aText += ' ';
+ aText += mrSane.GetOptionUnitName( mnCurrentOption );
+ if( mfMin != mfMax )
+ {
+ sprintf( pBuf, " < %g ; %g >", mfMin, mfMax );
+ aText += String( pBuf, gsl_getSystemTextEncoding() );
+ }
+ maOptionDescTxt.SetText( aText );
+ maOptionDescTxt.Show( TRUE );
+ sprintf( pBuf, "%g", fValue );
+ maNumericEdit.SetText( String( pBuf, gsl_getSystemTextEncoding() ) );
+ maNumericEdit.Show( TRUE );
+}
+
+void SaneDlg::EstablishButtonOption()
+{
+ maOptionDescTxt.SetText( mrSane.GetOptionName( mnCurrentOption ) );
+ maOptionDescTxt.Show( TRUE );
+ maButtonOption.Show( TRUE );
+}
+
+#define RECT_SIZE_PIX 7
+
+void SaneDlg::MouseMove( const MouseEvent& rMEvt )
+{
+ if( mbIsDragging )
+ {
+ Point aMousePos = rMEvt.GetPosPixel();
+ // move into valid area
+ Point aLogicPos = GetLogicPos( aMousePos );
+ aMousePos = GetPixelPos( aLogicPos );
+ switch( meDragDirection )
+ {
+ case TopLeft: maTopLeft = aMousePos; break;
+ case Top: maTopLeft.Y() = aMousePos.Y(); break;
+ case TopRight:
+ maTopLeft.Y() = aMousePos.Y();
+ maBottomRight.X() = aMousePos.X();
+ break;
+ case Right: maBottomRight.X() = aMousePos.X(); break;
+ case BottomRight: maBottomRight = aMousePos; break;
+ case Bottom: maBottomRight.Y() = aMousePos.Y(); break;
+ case BottomLeft:
+ maTopLeft.X() = aMousePos.X();
+ maBottomRight.Y() = aMousePos.Y();
+ break;
+ case Left: maTopLeft.X() = aMousePos.X(); break;
+ default: break;
+ }
+ int nSwap;
+ if( maTopLeft.X() > maBottomRight.X() )
+ {
+ nSwap = maTopLeft.X();
+ maTopLeft.X() = maBottomRight.X();
+ maBottomRight.X() = nSwap;
+ }
+ if( maTopLeft.Y() > maBottomRight.Y() )
+ {
+ nSwap = maTopLeft.Y();
+ maTopLeft.Y() = maBottomRight.Y();
+ maBottomRight.Y() = nSwap;
+ }
+ DrawDrag();
+ UpdateScanArea( FALSE );
+ }
+ ModalDialog::MouseMove( rMEvt );
+}
+
+void SaneDlg::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ Point aMousePixel = rMEvt.GetPosPixel();
+
+ if( ! mbIsDragging )
+ {
+ int nMiddleX = ( maBottomRight.X() - maTopLeft.X() ) / 2 - RECT_SIZE_PIX/2 + maTopLeft.X();
+ int nMiddleY = ( maBottomRight.Y() - maTopLeft.Y() ) / 2 - RECT_SIZE_PIX/2 + maTopLeft.Y();
+ if( aMousePixel.Y() >= maTopLeft.Y() &&
+ aMousePixel.Y() < maTopLeft.Y() + RECT_SIZE_PIX )
+ {
+ if( aMousePixel.X() >= maTopLeft.X() &&
+ aMousePixel.X() < maTopLeft.X() + RECT_SIZE_PIX )
+ {
+ meDragDirection = TopLeft;
+ aMousePixel = maTopLeft;
+ mbIsDragging = TRUE;
+ }
+ else if( aMousePixel.X() >= nMiddleX &&
+ aMousePixel.X() < nMiddleX + RECT_SIZE_PIX )
+ {
+ meDragDirection = Top;
+ aMousePixel.Y() = maTopLeft.Y();
+ mbIsDragging = TRUE;
+ }
+ else if( aMousePixel.X() > maBottomRight.X() - RECT_SIZE_PIX &&
+ aMousePixel.X() <= maBottomRight.X() )
+ {
+ meDragDirection = TopRight;
+ aMousePixel = Point( maBottomRight.X(), maTopLeft.Y() );
+ mbIsDragging = TRUE;
+ }
+ }
+ else if( aMousePixel.Y() >= nMiddleY &&
+ aMousePixel.Y() < nMiddleY + RECT_SIZE_PIX )
+ {
+ if( aMousePixel.X() >= maTopLeft.X() &&
+ aMousePixel.X() < maTopLeft.X() + RECT_SIZE_PIX )
+ {
+ meDragDirection = Left;
+ aMousePixel.X() = maTopLeft.X();
+ mbIsDragging = TRUE;
+ }
+ else if( aMousePixel.X() > maBottomRight.X() - RECT_SIZE_PIX &&
+ aMousePixel.X() <= maBottomRight.X() )
+ {
+ meDragDirection = Right;
+ aMousePixel.X() = maBottomRight.X();
+ mbIsDragging = TRUE;
+ }
+ }
+ else if( aMousePixel.Y() <= maBottomRight.Y() &&
+ aMousePixel.Y() > maBottomRight.Y() - RECT_SIZE_PIX )
+ {
+ if( aMousePixel.X() >= maTopLeft.X() &&
+ aMousePixel.X() < maTopLeft.X() + RECT_SIZE_PIX )
+ {
+ meDragDirection = BottomLeft;
+ aMousePixel = Point( maTopLeft.X(), maBottomRight.Y() );
+ mbIsDragging = TRUE;
+ }
+ else if( aMousePixel.X() >= nMiddleX &&
+ aMousePixel.X() < nMiddleX + RECT_SIZE_PIX )
+ {
+ meDragDirection = Bottom;
+ aMousePixel.Y() = maBottomRight.Y();
+ mbIsDragging = TRUE;
+ }
+ else if( aMousePixel.X() > maBottomRight.X() - RECT_SIZE_PIX &&
+ aMousePixel.X() <= maBottomRight.X() )
+ {
+ meDragDirection = BottomRight;
+ aMousePixel = maBottomRight;
+ mbIsDragging = TRUE;
+ }
+ }
+ }
+ if( mbIsDragging )
+ {
+ SetPointerPosPixel( aMousePixel );
+ DrawDrag();
+ }
+ ModalDialog::MouseButtonDown( rMEvt );
+}
+
+void SaneDlg::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if( mbIsDragging )
+ {
+ UpdateScanArea( TRUE );
+ }
+ mbIsDragging = FALSE;
+
+ ModalDialog::MouseButtonUp( rMEvt );
+}
+
+void SaneDlg::DrawRectangles( Point& rUL, Point& rBR )
+{
+ int nMiddleX, nMiddleY;
+ Point aBL, aUR;
+
+ aUR = Point( rBR.X(), rUL.Y() );
+ aBL = Point( rUL.X(), rBR.Y() );
+ nMiddleX = ( rBR.X() - rUL.X() ) / 2 + rUL.X();
+ nMiddleY = ( rBR.Y() - rUL.Y() ) / 2 + rUL.Y();
+
+ DrawLine( rUL, aBL );
+ DrawLine( aBL, rBR );
+ DrawLine( rBR, aUR );
+ DrawLine( aUR, rUL );
+ DrawRect( Rectangle( rUL, Size( RECT_SIZE_PIX,RECT_SIZE_PIX ) ) );
+ DrawRect( Rectangle( aBL, Size( RECT_SIZE_PIX, -RECT_SIZE_PIX ) ) );
+ DrawRect( Rectangle( rBR, Size( -RECT_SIZE_PIX, -RECT_SIZE_PIX ) ) );
+ DrawRect( Rectangle( aUR, Size( -RECT_SIZE_PIX, RECT_SIZE_PIX ) ) );
+ DrawRect( Rectangle( Point( nMiddleX - RECT_SIZE_PIX/2, rUL.Y() ), Size( RECT_SIZE_PIX, RECT_SIZE_PIX ) ) );
+ DrawRect( Rectangle( Point( nMiddleX - RECT_SIZE_PIX/2, rBR.Y() ), Size( RECT_SIZE_PIX, -RECT_SIZE_PIX ) ) );
+ DrawRect( Rectangle( Point( rUL.X(), nMiddleY - RECT_SIZE_PIX/2 ), Size( RECT_SIZE_PIX, RECT_SIZE_PIX ) ) );
+ DrawRect( Rectangle( Point( rBR.X(), nMiddleY - RECT_SIZE_PIX/2 ), Size( -RECT_SIZE_PIX, RECT_SIZE_PIX ) ) );
+}
+
+void SaneDlg::DrawDrag()
+{
+ static Point aLastUL, aLastBR;
+
+ RasterOp eROP = GetRasterOp();
+ SetRasterOp( ROP_INVERT );
+ SetMapMode( MapMode( MAP_PIXEL ) );
+
+ if( mbDragDrawn )
+ DrawRectangles( aLastUL, aLastBR );
+
+ aLastUL = maTopLeft;
+ aLastBR = maBottomRight;
+ DrawRectangles( maTopLeft, maBottomRight );
+
+ mbDragDrawn = TRUE;
+ SetRasterOp( eROP );
+ SetMapMode( maMapMode );
+}
+
+Point SaneDlg::GetPixelPos( const Point& rIn )
+{
+ Point aConvert(
+ ( ( rIn.X() * PREVIEW_WIDTH ) /
+ ( maMaxBottomRight.X() - maMinTopLeft.X() ) )
+ + PREVIEW_UPPER_LEFT,
+ ( ( rIn.Y() * PREVIEW_HEIGHT )
+ / ( maMaxBottomRight.Y() - maMinTopLeft.Y() ) )
+ + PREVIEW_UPPER_TOP );
+
+ return LogicToPixel( aConvert, maMapMode );
+}
+
+Point SaneDlg::GetLogicPos( const Point& rIn )
+{
+ Point aConvert = PixelToLogic( rIn, maMapMode );
+ aConvert.X() -= PREVIEW_UPPER_LEFT;
+ aConvert.Y() -= PREVIEW_UPPER_TOP;
+ if( aConvert.X() < 0 )
+ aConvert.X() = 0;
+ if( aConvert.X() >= PREVIEW_WIDTH )
+ aConvert.X() = PREVIEW_WIDTH-1;
+ if( aConvert.Y() < 0 )
+ aConvert.Y() = 0;
+ if( aConvert.Y() >= PREVIEW_HEIGHT )
+ aConvert.Y() = PREVIEW_HEIGHT-1;
+
+ aConvert.X() *= ( maMaxBottomRight.X() - maMinTopLeft.X() );
+ aConvert.X() /= PREVIEW_WIDTH;
+ aConvert.Y() *= ( maMaxBottomRight.Y() - maMinTopLeft.Y() );
+ aConvert.Y() /= PREVIEW_HEIGHT;
+ return aConvert;
+}
+
+void SaneDlg::UpdateScanArea( BOOL bSend )
+{
+ Point aUL = GetLogicPos( maTopLeft );
+ Point aBR = GetLogicPos( maBottomRight );
+
+ maLeftField.SetValue( aUL.X() );
+ maTopField.SetValue( aUL.Y() );
+ maRightField.SetValue( aBR.X() );
+ maBottomField.SetValue( aBR.Y() );
+
+ if( ! bSend )
+ return;
+
+ if( mrSane.IsOpen() )
+ {
+ SetAdjustedNumericalValue( "tl-x", (double)aUL.X() );
+ SetAdjustedNumericalValue( "tl-y", (double)aUL.Y() );
+ SetAdjustedNumericalValue( "br-x", (double)aBR.X() );
+ SetAdjustedNumericalValue( "br-y", (double)aBR.Y() );
+ }
+}
+
+BOOL SaneDlg::LoadState()
+{
+#ifdef USE_SAVE_STATE
+ int i;
+
+ if( ! Sane::IsSane() )
+ return FALSE;
+
+ const char* pEnv = getenv("HOME");
+ String aFileName( pEnv ? pEnv : "", gsl_getSystemTextEncoding() );
+ aFileName += String( RTL_CONSTASCII_USTRINGPARAM( "/.so_sane_state" ) );
+ Config aConfig( aFileName );
+ if( ! aConfig.HasGroup( "SANE" ) )
+ return FALSE;
+
+ aConfig.SetGroup( "SANE" );
+ ByteString aString = aConfig.ReadKey( "SO_LastSaneDevice" );
+ for( i = 0; i < Sane::CountDevices() && ! aString.Equals( ByteString( Sane::GetName( i ), gsl_getSystemTextEncoding() ) ); i++ ) ;
+ if( i == Sane::CountDevices() )
+ return FALSE;
+
+ mrSane.Close();
+ mrSane.Open( aString.GetBuffer() );
+
+ DisableOption();
+ InitFields();
+
+ if( mrSane.IsOpen() )
+ {
+ int iMax = aConfig.GetKeyCount();
+ for( i = 0; i < iMax; i++ )
+ {
+ aString = aConfig.GetKeyName( i );
+ ByteString aValue = aConfig.ReadKey( i );
+ int nOption = mrSane.GetOptionByName( aString.GetBuffer() );
+ if( nOption != -1 )
+ {
+ if( aValue.CompareTo( "BOOL=", 5 ) == COMPARE_EQUAL )
+ {
+ aValue.Erase( 0, 5 );
+ BOOL aBOOL = (BOOL)aValue.ToInt32();
+ mrSane.SetOptionValue( nOption, aBOOL );
+ }
+ else if( aValue.CompareTo( "STRING=", 7 ) == COMPARE_EQUAL )
+ {
+ aValue.Erase( 0, 7 );
+ mrSane.SetOptionValue( nOption, String( aValue, gsl_getSystemTextEncoding() ) );
+ }
+ else if( aValue.CompareTo( "NUMERIC=", 8 ) == COMPARE_EQUAL )
+ {
+ aValue.Erase( 0, 8 );
+ int nMax = aValue.GetTokenCount( ':' );
+ double fValue=0.0;
+ for( int n = 0; n < nMax ; n++ )
+ {
+ ByteString aSub = aValue.GetToken( n, ':' );
+ sscanf( aSub.GetBuffer(), "%lg", &fValue );
+ SetAdjustedNumericalValue( aString.GetBuffer(), fValue, n );
+ }
+ }
+ }
+ }
+ }
+
+ DisableOption();
+ InitFields();
+
+ return TRUE;
+#else
+ return FALSE;
+#endif
+}
+
+void SaneDlg::SaveState()
+{
+#ifdef USE_SAVE_STATE
+ if( ! Sane::IsSane() )
+ return;
+
+ const char* pEnv = getenv( "HOME" );
+ String aFileName( pEnv ? pEnv : "", gsl_getSystemTextEncoding() );
+ aFileName.AppendAscii( "/.so_sane_state" );
+
+ Config aConfig( aFileName );
+ aConfig.DeleteGroup( "SANE" );
+ aConfig.SetGroup( "SANE" );
+ aConfig.WriteKey( "SO_LastSANEDevice", ByteString( maDeviceBox.GetSelectEntry(), RTL_TEXTENCODING_UTF8 ) );
+
+#ifdef SAVE_ALL_STATES
+ for( int i = 1; i < mrSane.CountOptions(); i++ )
+ {
+ String aOption=mrSane.GetOptionName( i );
+ SANE_Value_Type nType = mrSane.GetOptionType( i );
+ switch( nType )
+ {
+ case SANE_TYPE_BOOL:
+ {
+ BOOL bValue;
+ if( mrSane.GetOptionValue( i, bValue ) )
+ {
+ ByteString aString( "BOOL=" );
+ aString += (ULONG)bValue;
+ aConfig.WriteKey( aOption, aString );
+ }
+ }
+ break;
+ case SANE_TYPE_STRING:
+ {
+ String aString( "STRING=" );
+ String aValue;
+ if( mrSane.GetOptionValue( i, aValue ) )
+ {
+ aString += aValue;
+ aConfig.WriteKey( aOption, aString );
+ }
+ }
+ break;
+ case SANE_TYPE_FIXED:
+ case SANE_TYPE_INT:
+ {
+ String aString( "NUMERIC=" );
+ double fValue;
+ char buf[256];
+ for( int n = 0; n < mrSane.GetOptionElements( i ); n++ )
+ {
+ if( ! mrSane.GetOptionValue( i, fValue, n ) )
+ break;
+ if( n > 0 )
+ aString += ":";
+ sprintf( buf, "%lg", fValue );
+ aString += buf;
+ }
+ if( n >= mrSane.GetOptionElements( i ) )
+ aConfig.WriteKey( aOption, aString );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+#else
+ static char* pSaveOptions[] = {
+ "resolution",
+ "tl-x",
+ "tl-y",
+ "br-x",
+ "br-y"
+ };
+ for( int i = 0;
+ i < (sizeof(pSaveOptions)/sizeof(pSaveOptions[0]));
+ i++ )
+ {
+ ByteString aOption = pSaveOptions[i];
+ int nOption = mrSane.GetOptionByName( pSaveOptions[i] );
+ if( nOption > -1 )
+ {
+ SANE_Value_Type nType = mrSane.GetOptionType( nOption );
+ switch( nType )
+ {
+ case SANE_TYPE_BOOL:
+ {
+ BOOL bValue;
+ if( mrSane.GetOptionValue( nOption, bValue ) )
+ {
+ ByteString aString( "BOOL=" );
+ aString += (ULONG)bValue;
+ aConfig.WriteKey( aOption, aString );
+ }
+ }
+ break;
+ case SANE_TYPE_STRING:
+ {
+ ByteString aString( "STRING=" );
+ ByteString aValue;
+ if( mrSane.GetOptionValue( nOption, aValue ) )
+ {
+ aString += aValue;
+ aConfig.WriteKey( aOption, aString );
+ }
+ }
+ break;
+ case SANE_TYPE_FIXED:
+ case SANE_TYPE_INT:
+ {
+ ByteString aString( "NUMERIC=" );
+ double fValue;
+ char buf[256];
+ for( int n = 0; n < mrSane.GetOptionElements( nOption ); n++ )
+ {
+ if( ! mrSane.GetOptionValue( nOption, fValue, n ) )
+ break;
+ if( n > 0 )
+ aString += ":";
+ sprintf( buf, "%lg", fValue );
+ aString += buf;
+ }
+ if( n >= mrSane.GetOptionElements( nOption ) )
+ aConfig.WriteKey( aOption, aString );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+#endif
+#endif
+}
+
+BOOL SaneDlg::SetAdjustedNumericalValue(
+ const char* pOption,
+ double fValue,
+ int nElement )
+{
+ int nOption;
+ if( ! Sane::IsSane() || ! mrSane.IsOpen() || ( nOption = mrSane.GetOptionByName( pOption ) ) == -1 )
+ return FALSE;
+
+ if( nElement < 0 || nElement >= mrSane.GetOptionElements( nOption ) )
+ return FALSE;
+
+ double* pValues = NULL;
+ int nValues;
+ if( ( nValues = mrSane.GetRange( nOption, pValues ) ) < 0 )
+ return FALSE;
+
+#ifdef DEBUG
+ fprintf( stderr, "SaneDlg::SetAdjustedNumericalValue( \"%s\", %lg ) ",
+ pOption, fValue );
+#endif
+
+ if( nValues )
+ {
+ int nNearest = 0;
+ double fNearest = 1e6;
+ for( int i = 0; i < nValues; i++ )
+ {
+ if( fabs( fValue - pValues[ i ] ) < fNearest )
+ {
+ fNearest = fabs( fValue - pValues[ i ] );
+ nNearest = i;
+ }
+ }
+ fValue = pValues[ nNearest ];
+ }
+ else
+ {
+ if( fValue < pValues[0] )
+ fValue = pValues[0];
+ if( fValue > pValues[1] )
+ fValue = pValues[1];
+ }
+ delete pValues;
+ mrSane.SetOptionValue( nOption, fValue, nElement );
+#ifdef DEBUG
+ fprintf( stderr, "yields %lg\n", fValue );
+#endif
+
+
+ return TRUE;
+}
diff --git a/extensions/source/scanner/sanedlg.hrc b/extensions/source/scanner/sanedlg.hrc
new file mode 100644
index 000000000..521fc00df
--- /dev/null
+++ b/extensions/source/scanner/sanedlg.hrc
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * $RCSfile: sanedlg.hrc,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SVT_SANEDLG_HRC
+#define _SVT_SANEDLG_HRC
+
+#define RID_SANE_DIALOG 1000
+#define RID_SCAN_OK 1
+#define RID_SCAN_CANCEL 2
+#define RID_DEVICEINFO_BTN 3
+#define RID_PREVIEW_BOX 4
+#define RID_DEVICE_BOX_TXT 5
+#define RID_DEVICE_BOX 6
+#define RID_SCANAREA_BOX 7
+#define RID_SCAN_LEFT_TXT 8
+#define RID_SCAN_LEFT_BOX 9
+#define RID_SCAN_TOP_BOX 10
+#define RID_SCAN_TOP_TXT 11
+#define RID_SCAN_RIGHT_TXT 12
+#define RID_SCAN_RIGHT_BOX 13
+#define RID_SCAN_BOTTOM_TXT 14
+#define RID_SCAN_BOTTOM_BOX 15
+#define RID_SCAN_RESOLUTION_TXT 16
+#define RID_SCAN_RESOLUTION_BOX 17
+#define RID_PREVIEW_BTN 18
+#define RID_SCAN_OPTION_BOX 19
+#define RID_SCAN_OPTIONTITLE_TXT 20
+#define RID_SCAN_OPTION_DESC_TXT 21
+#define RID_SCAN_BOOL_OPTION_BOX 22
+#define RID_SCAN_OPTION_TXT 23
+#define RID_SCAN_STRING_OPTION_EDT 24
+#define RID_SCAN_QUANTUM_RANGE_BOX 25
+#define RID_SCAN_STRING_RANGE_BOX 26
+#define RID_SCAN_NUMERIC_OPTION_EDT 27
+#define RID_SCAN_BUTTON_OPTION_BTN 28
+#define RID_SCAN_NUMERIC_VECTOR_BOX 29
+#define RID_SCAN_NUMERIC_VECTOR_TXT 30
+#define RID_SCAN_BITMAP_PLUS 31
+#define RID_SCAN_BITMAP_MINUS 32
+#define RID_SCAN_ADVANCED_BOX 33
+#define RID_SCAN_ADVANCED_TXT 34
+
+#define RID_SANE_DEVICEINFO_TXT 1001
+#define RID_SANE_SCANERROR_TXT 1002
+#define RID_SANE_NORESOLUTIONOPTION_TXT 1003
+#define RID_SANE_NOSANELIB_TXT 1004
+
+#define SCAN_AREA_TOP 17
+#define SCAN_AREA_LEFT 8
+#define PREVIEW_UPPER_LEFT SCAN_AREA_LEFT
+#define PREVIEW_UPPER_TOP SCAN_AREA_TOP + 80
+#define PREVIEW_WIDTH 113
+#define PREVIEW_HEIGHT 160
+#define PREVIEW_BOTTOM PREVIEW_UPPER_TOP + PREVIEW_HEIGHT
+#define PREVIEW_RIGHT PREVIEW_UPPER_LEFT + PREVIEW_WIDTH
+#define SECOND_COLUMN PREVIEW_WIDTH + 20
+#define THIRD_COLUMN SECOND_COLUMN + 135
+
+#endif
diff --git a/extensions/source/scanner/sanedlg.hxx b/extensions/source/scanner/sanedlg.hxx
new file mode 100644
index 000000000..195b46188
--- /dev/null
+++ b/extensions/source/scanner/sanedlg.hxx
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * $RCSfile: sanedlg.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SVT_SANEDLG_HXX
+#define _SVT_SANEDLG_HXX
+
+#ifndef _SV_DIALOG_HXX
+#include <vcl/dialog.hxx>
+#endif
+#ifndef _SV_CONFIG_HXX
+#include <vcl/config.hxx>
+#endif
+#ifndef _SV_LSTBOX_HXX
+#include <vcl/lstbox.hxx>
+#endif
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#ifndef _SV_FIXED_HXX
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _SV_GROUP_HXX
+#include <vcl/group.hxx>
+#endif
+#ifndef _SV_FIELD_HXX
+#include <vcl/field.hxx>
+#endif
+#ifndef _SV_EDIT_HXX
+#include <vcl/edit.hxx>
+#endif
+#include <svtools/svtreebx.hxx>
+
+#include <sane.hxx>
+
+class SaneDlg : public ModalDialog
+{
+private:
+ enum DragDirection { TopLeft, Top, TopRight, Right, BottomRight, Bottom,
+ BottomLeft, Left };
+
+ Sane& mrSane;
+ Bitmap maPreviewBitmap;
+ Rectangle maPreviewRect;
+ Point maTopLeft, maBottomRight;
+ Point maMinTopLeft, maMaxBottomRight;
+ BOOL mbIsDragging;
+ int mnDragMode;
+ BOOL mbDragDrawn;
+ DragDirection meDragDirection;
+
+ MapMode maMapMode;
+
+ Link maOldLink;
+
+ OKButton maOKButton;
+ CancelButton maCancelButton;
+ PushButton maDeviceInfoButton;
+ PushButton maPreviewButton;
+ PushButton maButtonOption;
+
+ FixedText maOptionsTxt;
+ FixedText maOptionTitle;
+ FixedText maOptionDescTxt;
+ FixedText maVectorTxt;
+
+ FixedText maScanLeftTxt;
+ MetricField maLeftField;
+ FixedText maScanTopTxt;
+ MetricField maTopField;
+ FixedText maRightTxt;
+ MetricField maRightField;
+ FixedText maBottomTxt;
+ MetricField maBottomField;
+
+ FixedText maDeviceBoxTxt;
+ ListBox maDeviceBox;
+ FixedText maReslTxt;
+ NumericBox maReslBox;
+ FixedText maAdvancedTxt;
+ CheckBox maAdvancedBox;
+
+ NumericField maVectorBox;
+ ListBox maQuantumRangeBox;
+ ListBox maStringRangeBox;
+
+ GroupBox maPreviewBox;
+ GroupBox maAreaBox;
+
+ CheckBox maBoolCheckBox;
+
+ Edit maStringEdit;
+ Edit maNumericEdit;
+
+ SvTreeListBox maOptionBox;
+
+ int mnCurrentOption;
+ int mnCurrentElement;
+ double* mpRange;
+ double mfMin, mfMax;
+
+ DECL_LINK( ClickBtnHdl, Button* );
+ DECL_LINK( SelectHdl, ListBox* );
+ DECL_LINK( ModifyHdl, Edit* );
+ DECL_LINK( ReloadSaneOptionsHdl, Sane* );
+ DECL_LINK( OptionsBoxSelectHdl, SvTreeListBox* );
+
+ void SaveState();
+ BOOL LoadState();
+
+ void InitDevices();
+ void InitFields();
+ void AcquirePreview();
+ void DisableOption();
+ void EstablishBoolOption();
+ void EstablishStringOption();
+ void EstablishStringRange();
+ void EstablishQuantumRange();
+ void EstablishNumericOption();
+ void EstablishButtonOption();
+
+ void DrawRectangles( Point&, Point& );
+ void DrawDrag();
+ Point GetPixelPos( const Point& );
+ Point GetLogicPos( const Point& );
+ void UpdateScanArea( BOOL );
+
+ // helper
+ BOOL SetAdjustedNumericalValue( const char* pOption, double fValue, int nElement = 0 );
+
+ virtual void Paint( const Rectangle& );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+public:
+ SaneDlg( Window*, Sane& );
+ ~SaneDlg();
+
+ virtual short Execute();
+};
+
+
+#endif
diff --git a/extensions/source/scanner/sanedlg.src b/extensions/source/scanner/sanedlg.src
new file mode 100644
index 000000000..3b864e693
--- /dev/null
+++ b/extensions/source/scanner/sanedlg.src
@@ -0,0 +1,700 @@
+/*************************************************************************
+ *
+ * $RCSfile: sanedlg.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <sanedlg.hrc>
+ModalDialog RID_SANE_DIALOG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 10 , 10 ) ;
+ Size = MAP_APPFONT ( THIRD_COLUMN + 60 , 268 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text = "Scanner" ;
+ Text [ English ] = "Scanner" ;
+ OKButton RID_SCAN_OK
+ {
+ Pos = MAP_APPFONT ( THIRD_COLUMN , 6 ) ;
+ Size = MAP_APPFONT ( 55 , 14 ) ;
+ DefButton = TRUE;
+ };
+ CancelButton RID_SCAN_CANCEL
+ {
+ Pos = MAP_APPFONT ( THIRD_COLUMN , 25 ) ;
+ Size = MAP_APPFONT ( 55 , 14 ) ;
+ };
+ PushButton RID_DEVICEINFO_BTN
+ {
+ Pos = MAP_APPFONT ( THIRD_COLUMN , 44 ) ;
+ Size = MAP_APPFONT ( 55 , 22 ) ;
+ Text = "Geräte-\n~information" ;
+ Text [ English ] = "Device ~info" ;
+ Text [ english_us ] = "About\n Dev~ice" ;
+ Text [ portuguese_brazilian ] = "Gerõteinformation" ;
+ Text [ swedish ] = "Apparat\n~information" ;
+ Text [ danish ] = "Information\n om enheden" ;
+ Text [ italian ] = "Informazione\napparecchiatura" ;
+ Text [ spanish ] = "Información sobre\n ~dispositivo" ;
+ Text [ french ] = "Information sur le ~périphérique" ;
+ Text [ dutch ] = "Info over\n~apparaat" ;
+ Text [ portuguese ] = "~Informação sobre\nperiféricos" ;
+ Text[ chinese_simplified ] = "É豸\nÐÅÏ¢(~I)";
+ Text[ russian ] = "Èíôîðìàöèÿ îá\nóñòðîéñòâå";
+ Text[ polish ] = "Informacja \no urz¹dzeniu";
+ Text[ japanese ] = "ÃÞÊÞ²½\nî•ñ(~I)";
+ Text[ chinese_traditional ] = "³]³Æ»¡©ú¸ê®Æ(~I)";
+ Text[ arabic ] = "ãÚáæãÇÊ\nÇáÌåÇÒ";
+ Text[ dutch ] = "Info over\n~apparaat";
+ Text[ chinese_simplified ] = "É豸\nÐÅÏ¢(~I)";
+ Text[ greek ] = "Ðëçñïöïñßåò\nóõóêåõÞò";
+ Text[ korean ] = "ÀåÄ¡ Á¤º¸(~I)";
+ Text[ turkish ] = "Cihaz hakkýnda";
+ };
+ PushButton RID_PREVIEW_BTN
+ {
+ Pos = MAP_APPFONT ( THIRD_COLUMN , 71 ) ;
+ Size = MAP_APPFONT ( 55 , 22 ) ;
+ Text = "~Vorschau\nerstellen" ;
+ Text [ English ] = "Acquire\npre~view" ;
+ Text [ english_us ] = "Create\nPreview" ;
+ Text [ portuguese_brazilian ] = "Vorschau\nerstellen" ;
+ Text [ swedish ] = "S~kapa\nförhandsvisning" ;
+ Text [ danish ] = "Opret\neksempel" ;
+ Text [ italian ] = "Crea\nanteprima" ;
+ Text [ spanish ] = "Crear\n~Previsualización" ;
+ Text [ french ] = "Créer\nun ~aperçu" ;
+ Text [ dutch ] = "~Voorbeeld\nmaken" ;
+ Text [ portuguese ] = "Criar\n~previsualização" ;
+ Text[ chinese_simplified ] = "Éú³É\nÔ¤ÊÓ";
+ Text[ russian ] = "Ñîçäàòü\n ïðîñìîòð";
+ Text[ polish ] = "Utwórz\n podgl¹d";
+ Text[ japanese ] = "ÌßÚËÞ­°\nì¬";
+ Text[ chinese_traditional ] = "¥Í¦¨\n¹wµø";
+ Text[ arabic ] = "ÅäÔÇÁ\nãÚÇíäÉ";
+ Text[ dutch ] = "~Voorbeeld\nmaken";
+ Text[ chinese_simplified ] = "Éú³É\nÔ¤ÊÓ";
+ Text[ greek ] = "Äçìéïõñãßá\nðñïåðéóêüðçóçò";
+ Text[ korean ] = "¹Ì¸® º¸±â\nÀÛ¼º";
+ Text[ turkish ] = "Önizleme\noluþtur";
+ Text[ language_user1 ] = " ";
+ };
+ GroupBox RID_PREVIEW_BOX
+ {
+ Pos = MAP_APPFONT ( PREVIEW_UPPER_LEFT - 5 , PREVIEW_UPPER_TOP - 8 ) ;
+ Size = MAP_APPFONT ( PREVIEW_WIDTH + 10 , PREVIEW_HEIGHT + 14 ) ;
+ Text = "Vorschau" ;
+ Text [ English ] = "Preview" ;
+ Text [ portuguese ] = "Previsualizar" ;
+ Text [ english_us ] = "Preview" ;
+ Text [ portuguese_brazilian ] = "Vorschau" ;
+ Text [ swedish ] = "Förhandsvisning" ;
+ Text [ danish ] = "Eksempel" ;
+ Text [ italian ] = "Anteprima" ;
+ Text [ spanish ] = "Previsualización" ;
+ Text [ french ] = "Aperçu" ;
+ Text [ dutch ] = "Voorbeeld" ;
+ Text[ chinese_simplified ] = "Ô¤ÊÓ";
+ Text[ russian ] = "Ïðîñìîòð";
+ Text[ polish ] = "Podgl¹d";
+ Text[ japanese ] = "ÌßÚËÞ­°";
+ Text[ chinese_traditional ] = "¹wµø";
+ Text[ arabic ] = "ãÚÇíäÉ";
+ Text[ dutch ] = "Voorbeeld";
+ Text[ chinese_simplified ] = "Ô¤ÊÓ";
+ Text[ greek ] = "Ðñïåðéóêüðçóç";
+ Text[ korean ] = "¹Ì¸® º¸±â";
+ Text[ turkish ] = "Önizleme";
+ };
+ GroupBox RID_SCANAREA_BOX
+ {
+ Pos = MAP_APPFONT ( SCAN_AREA_LEFT - 5 , SCAN_AREA_TOP - 12 ) ;
+ Size = MAP_APPFONT ( PREVIEW_WIDTH + 10 , 78 ) ;
+ Text = "Scanbereich" ;
+ Text [ English ] = "Scan area" ;
+ Text [ english_us ] = "Scan area" ;
+ Text [ portuguese_brazilian ] = "Scanbereich" ;
+ Text [ swedish ] = "Skanningsområde" ;
+ Text [ danish ] = "Scanområde" ;
+ Text [ italian ] = "Area di scansione" ;
+ Text [ spanish ] = "Área de escaneado" ;
+ Text [ french ] = "Zone à scanner" ;
+ Text [ dutch ] = "Scanbereik" ;
+ Text [ portuguese ] = "Área de digitalização" ;
+ Text[ chinese_simplified ] = "ɨÃèÇøÓò";
+ Text[ russian ] = "Îáëàñòü ñêàíèðîâàíèÿ";
+ Text[ polish ] = "Obszar skanowania";
+ Text[ japanese ] = "½·¬Ý”͈Í";
+ Text[ chinese_traditional ] = "±½´y°Ï°ì";
+ Text[ arabic ] = "äØÇÞ ÇáãÓÍ ÇáÖæÆí";
+ Text[ dutch ] = "Scanbereik";
+ Text[ chinese_simplified ] = "ɨÃèÇøÓò";
+ Text[ greek ] = "Ðåñéï÷Þ óÜñùóçò";
+ Text[ korean ] = "½ºÄµ ¿µ¿ª";
+ Text[ turkish ] = "Tarama alaný";
+ };
+ FixedText RID_SCAN_LEFT_TXT
+ {
+ Pos = MAP_APPFONT ( SCAN_AREA_LEFT , SCAN_AREA_TOP ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text = "~Links:" ;
+ Text [ English ] = "~Left:" ;
+ Text [ portuguese ] = "~Esquerda:" ;
+ Text [ english_us ] = "Left:" ;
+ Text [ portuguese_brazilian ] = "Links:" ;
+ Text [ swedish ] = "~Vänster:" ;
+ Text [ danish ] = "Venstre:" ;
+ Text [ italian ] = "A ~sinistra:" ;
+ Text [ spanish ] = "I~zquierda:" ;
+ Text [ french ] = "À gauche :" ;
+ Text [ dutch ] = "~Links:" ;
+ Text[ chinese_simplified ] = "×ó:";
+ Text[ russian ] = "Ñëåâà:";
+ Text[ polish ] = "Z lewej:";
+ Text[ japanese ] = "¶:";
+ Text[ chinese_traditional ] = "¥ª¡G";
+ Text[ arabic ] = "íÓÇÑ:";
+ Text[ dutch ] = "~Links:";
+ Text[ chinese_simplified ] = "×ó:";
+ Text[ greek ] = "ÁñéóôåñÜ:";
+ Text[ korean ] = "¿ÞÂÊ:";
+ Text[ turkish ] = "Sol:";
+ };
+ MetricField RID_SCAN_LEFT_BOX
+ {
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( SCAN_AREA_LEFT + 50 , SCAN_AREA_TOP - 2 ) ;
+ Size = MAP_APPFONT ( PREVIEW_WIDTH - 50 , 12 ) ;
+ };
+ FixedText RID_SCAN_TOP_TXT
+ {
+ Pos = MAP_APPFONT ( SCAN_AREA_LEFT , SCAN_AREA_TOP + 17 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text = "~Oben:" ;
+ Text [ English ] = "~Top:" ;
+ Text [ english_us ] = "Top:" ;
+ Text [ portuguese_brazilian ] = "Oben:" ;
+ Text [ swedish ] = "Öv~erst:" ;
+ Text [ danish ] = "Top:" ;
+ Text [ italian ] = "In ~alto:" ;
+ Text [ spanish ] = "~Arriba:" ;
+ Text [ french ] = "En haut :" ;
+ Text [ dutch ] = "~Boven:" ;
+ Text [ portuguese ] = "Em ~cima:" ;
+ Text[ chinese_simplified ] = "ÉÏ:";
+ Text[ russian ] = "Ñâåðõó:";
+ Text[ polish ] = "W górze:";
+ Text[ japanese ] = "ã:";
+ Text[ chinese_traditional ] = "¤W¡G";
+ Text[ arabic ] = "ÃÚáì:";
+ Text[ dutch ] = "~Boven:";
+ Text[ chinese_simplified ] = "ÉÏ:";
+ Text[ greek ] = "ÐÜíù:";
+ Text[ korean ] = "ˤ:";
+ Text[ turkish ] = "Üst:";
+ Text[ language_user1 ] = " ";
+ };
+ MetricField RID_SCAN_TOP_BOX
+ {
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( SCAN_AREA_LEFT + 50 , SCAN_AREA_TOP + 15 ) ;
+ Size = MAP_APPFONT ( PREVIEW_WIDTH - 50 , 12 ) ;
+ };
+ FixedText RID_SCAN_RIGHT_TXT
+ {
+ Pos = MAP_APPFONT ( SCAN_AREA_LEFT , SCAN_AREA_TOP + 34 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text = "~Rechts:" ;
+ Text [ English ] = "~Right:" ;
+ Text [ english_us ] = "Right:" ;
+ Text [ portuguese_brazilian ] = "Rechts:" ;
+ Text [ swedish ] = "~Höger:" ;
+ Text [ danish ] = "Højre:" ;
+ Text [ italian ] = "A ~destra:" ;
+ Text [ spanish ] = "~Derecha:" ;
+ Text [ french ] = "À droite :" ;
+ Text [ dutch ] = "~Rechts:" ;
+ Text [ portuguese ] = "~Direita:" ;
+ Text[ chinese_simplified ] = "ÓÒ:";
+ Text[ russian ] = "Ñïðàâà:";
+ Text[ polish ] = "Z prawej:";
+ Text[ japanese ] = "‰E:";
+ Text[ chinese_traditional ] = "¥k¡G";
+ Text[ arabic ] = "íãíä:";
+ Text[ dutch ] = "~Rechts:";
+ Text[ chinese_simplified ] = "ÓÒ:";
+ Text[ greek ] = "ÄåîéÜ:";
+ Text[ korean ] = "¿À¸¥ÂÊ:";
+ Text[ turkish ] = "Sað:";
+ Text[ language_user1 ] = " ";
+ };
+ MetricField RID_SCAN_RIGHT_BOX
+ {
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( SCAN_AREA_LEFT + 50 , SCAN_AREA_TOP + 32 ) ;
+ Size = MAP_APPFONT ( PREVIEW_WIDTH - 50 , 12 ) ;
+ };
+ FixedText RID_SCAN_BOTTOM_TXT
+ {
+ Pos = MAP_APPFONT ( SCAN_AREA_LEFT , SCAN_AREA_TOP + 51 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text = "~Unten:" ;
+ Text [ English ] = "~Bottom:" ;
+ Text [ english_us ] = "Bottom:" ;
+ Text [ portuguese_brazilian ] = "Unten:" ;
+ Text [ swedish ] = "~Underst:" ;
+ Text [ danish ] = "Bund:" ;
+ Text [ italian ] = "In ~basso:" ;
+ Text [ spanish ] = "~Abajo:" ;
+ Text [ french ] = "En bas :" ;
+ Text [ dutch ] = "~Beneden:" ;
+ Text [ portuguese ] = "Em ~baixo:" ;
+ Text[ chinese_simplified ] = "ÏÂ:";
+ Text[ russian ] = "Ñíèçó:";
+ Text[ polish ] = "W dole:";
+ Text[ japanese ] = "‰º:";
+ Text[ chinese_traditional ] = "¤U¡G";
+ Text[ arabic ] = "ÃÓÝá:";
+ Text[ dutch ] = "~Beneden:";
+ Text[ chinese_simplified ] = "ÏÂ:";
+ Text[ greek ] = "ÊÜôù:";
+ Text[ korean ] = "¾Æ·¡:";
+ Text[ turkish ] = "Alt:";
+ };
+ MetricField RID_SCAN_BOTTOM_BOX
+ {
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( SCAN_AREA_LEFT + 50 , SCAN_AREA_TOP + 49 ) ;
+ Size = MAP_APPFONT ( PREVIEW_WIDTH - 50 , 12 ) ;
+ };
+ FixedText RID_DEVICE_BOX_TXT
+ {
+ Pos = MAP_APPFONT ( SECOND_COLUMN , 8 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text = "Verwendetes ~Gerät:" ;
+ Text [ English ] = "~Scanning device:" ;
+ Text [ english_us ] = "Device used:" ;
+ Text [ portuguese_brazilian ] = "Verwendetes Gerõt:" ;
+ Text [ swedish ] = "A~nvänd enhet:" ;
+ Text [ danish ] = "Brugt enhed:" ;
+ Text [ italian ] = "Apparecchiatura usata:" ;
+ Text [ spanish ] = "Dispositivo ~utilizado:" ;
+ Text [ french ] = "Périphérique utilisé :" ;
+ Text [ dutch ] = "~Gebruikte apparatuur:" ;
+ Text [ portuguese ] = "~Periférico usado:" ;
+ Text[ chinese_simplified ] = "ʹÓõÄÉ豸:";
+ Text[ russian ] = "Èñïîëüçóåìîå óñòðîéñòâî:";
+ Text[ polish ] = "Zastosowane urz¹dzenie:";
+ Text[ japanese ] = "Žg—p’†‚ÌÃÞÊÞ²½:";
+ Text[ chinese_traditional ] = "¨Ï¥Îªº³]³Æ¡G";
+ Text[ arabic ] = "ÇáÌåÇÒ ÇáãÓÊÎÏã:";
+ Text[ dutch ] = "~Gebruikte apparatuur:";
+ Text[ chinese_simplified ] = "ʹÓõÄÉ豸:";
+ Text[ greek ] = "×ñçóéìïðïéïýçìåíç óõóêåõÞ:";
+ Text[ korean ] = "»ç¿ëÇÑ ÀåÄ¡:";
+ Text[ turkish ] = "Kullanýlan cihaz:";
+ };
+ ListBox RID_DEVICE_BOX
+ {
+ Border = TRUE ;
+ Dropdown = TRUE ;
+ Sort = TRUE ;
+ Pos = MAP_APPFONT ( SECOND_COLUMN + 70 , 6 ) ;
+ Size = MAP_APPFONT ( 60 , 80 ) ;
+ };
+ FixedText RID_SCAN_RESOLUTION_TXT
+ {
+ Pos = MAP_APPFONT ( SECOND_COLUMN , 25 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text = "Auflösung [~DPI]" ;
+ Text [ English ] = "Resolution [~DPI]:" ;
+ Text [ english_us ] = "Resolution [~DPI]" ;
+ Text [ portuguese_brazilian ] = "Aufl÷sung [DPI]:" ;
+ Text [ swedish ] = "Upplösning [~DPI]:" ;
+ Text [ danish ] = "Opløsning [~DPI]:" ;
+ Text [ italian ] = "Risoluzione [~DPI]:" ;
+ Text [ spanish ] = "Resolución [~DPI]:" ;
+ Text [ french ] = "Résolution [~DPI]" ;
+ Text [ dutch ] = "Resolutie [~DPI]:" ;
+ Text [ portuguese ] = "Resolução [~DPI]:" ;
+ Text[ chinese_simplified ] = "·Ö±æÂÊ[DPI]";
+ Text[ russian ] = "Ðàçðåøåíèå [DPI]:";
+ Text[ polish ] = "RozdzielczoϾ [~DPI]:";
+ Text[ japanese ] = "‰ð‘œ [DPI]";
+ Text[ greek ] = "ÁíÜëõóç [~DPI]:";
+ Text[ korean ] = "ÇØ»óµµ [DPI]:(~D)";
+ Text[ chinese_traditional ] = "¸ÑªR«× [~DPI]";
+ Text[ arabic ] = "ÇÓÊÈÇäÉ [~DPI]";
+ Text[ turkish ] = "Çözünürlük [~DPI]";
+ };
+ NumericBox RID_SCAN_RESOLUTION_BOX
+ {
+ Dropdown = TRUE ;
+ Pos = MAP_APPFONT ( SECOND_COLUMN + 70 , 23 ) ;
+ Size = MAP_APPFONT ( 60 , 80 ) ;
+ };
+ FixedText RID_SCAN_ADVANCED_TXT
+ {
+ Pos = MAP_APPFONT ( SECOND_COLUMN , 40 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text = "Er~weiterte Optionen anzeigen" ;
+ Text [ English ] = "Sho~w advanced options" ;
+ Text [ portuguese ] = "Mostrar opções a~vançadas" ;
+ Text [ english_us ] = "Show advanced options" ;
+ Text [ portuguese_brazilian ] = "Erweiterte Optionen anzeigen" ;
+ Text [ swedish ] = "Vi~sa utökade alternativ" ;
+ Text [ danish ] = "Vis avancerede funktioner" ;
+ Text [ italian ] = "Mostra opzioni avanzate" ;
+ Text [ spanish ] = "Mostrar otras ~opciones" ;
+ Text [ french ] = "Afficher les options avancées" ;
+ Text [ dutch ] = "~Verdere opties weergeven" ;
+ Text[ chinese_simplified ] = "ÏÔʾ¸ß¼¶Ñ¡Ïî";
+ Text[ russian ] = "Ïîêàçàòü ðàñøèðåííûå ïàðàìåòðû";
+ Text[ polish ] = "Poka¿ opcje zaawansowane";
+ Text[ japanese ] = "Ú×µÌß¼®Ý‚Ì•\\Ž¦";
+ Text[ chinese_traditional ] = "Åã¥Ü¶i¶¥¿ï¶µ";
+ Text[ arabic ] = "ÅÙåÇÑ ÇáÎíÇÑÇÊ ÇáãÊÞÏãÉ";
+ Text[ dutch ] = "~Verdere opties weergeven";
+ Text[ chinese_simplified ] = "ÏÔʾ¸ß¼¶Ñ¡Ïî";
+ Text[ greek ] = "ÅìöÜíéóç åðéðëÝïí åðéëïãþí";
+ Text[ korean ] = "È®ÀåµÈ ¿É¼Ç Ç¥½Ã";
+ Text[ turkish ] = "Ek seçenekleri görüntüle";
+ };
+ CheckBox RID_SCAN_ADVANCED_BOX
+ {
+ Check = FALSE ;
+ Pos = MAP_APPFONT ( SECOND_COLUMN + 120 , 40 ) ;
+ Size = MAP_APPFONT ( 8 , 8 ) ;
+ };
+ FixedText RID_SCAN_OPTION_TXT
+ {
+ Pos = MAP_APPFONT ( SECOND_COLUMN , 54 ) ;
+ Size = MAP_APPFONT ( 130 , 8 ) ;
+ Text = "Optionen:" ;
+ Text [ English ] = "Options:" ;
+ Text [ portuguese ] = "Opções:" ;
+ Text [ english_us ] = "Options:" ;
+ Text [ portuguese_brazilian ] = "Optionen:" ;
+ Text [ swedish ] = "Alternativ:" ;
+ Text [ danish ] = "Indstillinger:" ;
+ Text [ italian ] = "Opzioni:" ;
+ Text [ spanish ] = "Opciones:" ;
+ Text [ french ] = "Options :" ;
+ Text [ dutch ] = "Opties:" ;
+ Text[ chinese_simplified ] = "Ñ¡Ïî:";
+ Text[ russian ] = "Ïàðàìåòðû:";
+ Text[ polish ] = "Opcje:";
+ Text[ japanese ] = "µÌß¼®Ý:";
+ Text[ chinese_traditional ] = "¿ï¶µ¡G";
+ Text[ arabic ] = "ÇáÎíÇÑÇÊ:";
+ Text[ dutch ] = "Opties:";
+ Text[ chinese_simplified ] = "Ñ¡Ïî:";
+ Text[ greek ] = "ÅðéëïãÝò:";
+ Text[ korean ] = "¿É¼Ç:";
+ Text[ turkish ] = "Seçenekler:";
+ Text[ language_user1 ] = " ";
+ };
+ Control RID_SCAN_OPTION_BOX
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( SECOND_COLUMN , 63 ) ;
+ Size = MAP_APPFONT ( 130 , 102 ) ;
+ };
+ FixedText RID_SCAN_OPTIONTITLE_TXT
+ {
+ WordBreak = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( SECOND_COLUMN , 170 ) ;
+ Size = MAP_APPFONT ( 130 , 50 ) ;
+ };
+ FixedText RID_SCAN_OPTION_DESC_TXT
+ {
+ Pos = MAP_APPFONT ( SECOND_COLUMN , 225 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ };
+ CheckBox RID_SCAN_BOOL_OPTION_BOX
+ {
+ Pos = MAP_APPFONT ( SECOND_COLUMN + 120 , 225 ) ;
+ Size = MAP_APPFONT ( 8 , 8 ) ;
+ };
+ Edit RID_SCAN_STRING_OPTION_EDT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( SECOND_COLUMN , 234 ) ;
+ Size = MAP_APPFONT ( 130 , 12 ) ;
+ };
+ ListBox RID_SCAN_QUANTUM_RANGE_BOX
+ {
+ Border = TRUE ;
+ Dropdown = TRUE ;
+ Pos = MAP_APPFONT ( SECOND_COLUMN , 234 ) ;
+ Size = MAP_APPFONT ( 130 , 80 ) ;
+ };
+ ListBox RID_SCAN_STRING_RANGE_BOX
+ {
+ Border = TRUE ;
+ Dropdown = TRUE ;
+ Pos = MAP_APPFONT ( SECOND_COLUMN , 234 ) ;
+ Size = MAP_APPFONT ( 130 , 80 ) ;
+ };
+ Edit RID_SCAN_NUMERIC_OPTION_EDT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( SECOND_COLUMN , 234 ) ;
+ Size = MAP_APPFONT ( 130 , 12 ) ;
+ };
+ FixedText RID_SCAN_NUMERIC_VECTOR_TXT
+ {
+ Pos = MAP_APPFONT ( SECOND_COLUMN , 253 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text = "Vektorelement" ;
+ Text [ English ] = "Element of vector" ;
+ Text [ english_us ] = "Vector element" ;
+ Text [ portuguese_brazilian ] = "Vektorelement" ;
+ Text [ swedish ] = "Vektorelement" ;
+ Text [ danish ] = "Vektorelement" ;
+ Text [ italian ] = "Elemento vettoriale" ;
+ Text [ spanish ] = "Elemento vectorial" ;
+ Text [ french ] = "Élément vectoriel" ;
+ Text [ dutch ] = "Vectorelement" ;
+ Text [ portuguese ] = "Elemento vectorial" ;
+ Text[ chinese_simplified ] = "ʸÁ¿Í¼¼þ";
+ Text[ russian ] = "Âåêòîðíûé ýëåìåíò";
+ Text[ polish ] = "Element wektorowy";
+ Text[ japanese ] = "ÍÞ¸À—v‘f";
+ Text[ chinese_traditional ] = "¦V¶q¹Ï¥ó";
+ Text[ arabic ] = "ÚäÕÑ Vector";
+ Text[ dutch ] = "Vectorelement";
+ Text[ chinese_simplified ] = "ʸÁ¿Í¼¼þ";
+ Text[ greek ] = "Óôïé÷åßï äéáíýóìáôïò";
+ Text[ korean ] = "º¤ÅÍ ¿ä¼Ò";
+ Text[ turkish ] = "Vektör öðesi";
+ };
+ NumericField RID_SCAN_NUMERIC_VECTOR_BOX
+ {
+ Border = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ Pos = MAP_APPFONT ( SECOND_COLUMN + 90 , 251 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ };
+ PushButton RID_SCAN_BUTTON_OPTION_BTN
+ {
+ Pos = MAP_APPFONT ( SECOND_COLUMN , 234 ) ;
+ Size = MAP_APPFONT ( 130 , 14 ) ;
+ Text = "Setzen" ;
+ Text [ English ] = "Set" ;
+ Text [ english_us ] = "Set" ;
+ Text [ portuguese_brazilian ] = "Setzen" ;
+ Text [ swedish ] = "Definiera" ;
+ Text [ danish ] = "Definer" ;
+ Text [ italian ] = "Imposta" ;
+ Text [ spanish ] = "Definir" ;
+ Text [ french ] = "Appliquer" ;
+ Text [ dutch ] = "Overnemen" ;
+ Text [ portuguese ] = "Definir" ;
+ Text[ chinese_simplified ] = "É趨";
+ Text[ russian ] = "Óñòàíîâèòü";
+ Text[ polish ] = "OsadŸ";
+ Text[ japanese ] = "Ý’è";
+ Text[ chinese_traditional ] = "³]©w";
+ Text[ arabic ] = "ÊÚííä";
+ Text[ dutch ] = "Overnemen";
+ Text[ chinese_simplified ] = "É趨";
+ Text[ greek ] = "Ïñéóìüò";
+ Text[ korean ] = "¼³Á¤";
+ Text[ turkish ] = "Tanýmla";
+ };
+ Bitmap RID_SCAN_BITMAP_PLUS
+ {
+ File = "plus.bmp" ;
+ };
+ Bitmap RID_SCAN_BITMAP_MINUS
+ {
+ File = "minus.bmp" ;
+ };
+ Text [ english_us ] = "Scanner" ;
+ Text [ portuguese_brazilian ] = "Scanner" ;
+ Text [ swedish ] = "Skanner" ;
+ Text [ danish ] = "Scanner" ;
+ Text [ italian ] = "Scanner" ;
+ Text [ spanish ] = "Escáner" ;
+ Text [ french ] = "Scanner" ;
+ Text [ dutch ] = "Scanner" ;
+ Text [ portuguese ] = "Digitalizador" ;
+ Text[ chinese_simplified ] = "ɨÃè»ú";
+ Text[ russian ] = "Ñêàíåð";
+ Text[ polish ] = "Skaner";
+ Text[ japanese ] = "½·¬Å°";
+ Text[ chinese_traditional ] = "±½´y»ö";
+ Text[ arabic ] = "ãÇÓÍÉ ÖæÆíÉ";
+ Text[ dutch ] = "Scanner";
+ Text[ chinese_simplified ] = "ɨÃè»ú";
+ Text[ greek ] = "ÓáñùôÞò";
+ Text[ korean ] = "½ºÄ³³Ê";
+ Text[ turkish ] = "Tarayýcý";
+};
+String RID_SANE_DEVICEINFO_TXT
+{
+ Text = "Gerät: %s\nHersteller: %s\nModell: %s\nTyp: %s" ;
+ Text [ English ] = "Device: %s\nVendor: %s\nModel: %s\nType: %s" ;
+ Text [ english_us ] = "Device: %s\nVendor: %s\nModel: %s\nType: %s" ;
+ Text [ portuguese_brazilian ] = "Gerõt: %s\nHersteller: %s\nModell: %s\nTyp: %s" ;
+ Text [ swedish ] = "Enhet: %s\nTillverkare: %s\nModell: %s\nTyp: %s" ;
+ Text [ danish ] = "Enhed: %s\nForhandler: %s\nModel: %s\nType: %s" ;
+ Text [ italian ] = "Apparecchiatura: %s\nProduttore: %s\nModello: %s\nTipo: %s" ;
+ Text [ spanish ] = "Dispositivo: %s\nFabricante: %s\nModelo: %s\nTipo: %s" ;
+ Text [ french ] = "Périphérique : %s\nFabricant : %s\nModèle : %s\nType : %s" ;
+ Text [ dutch ] = "Apparaat: %s\nProducent: %s\nModel: %s\nType: %s" ;
+ Text [ portuguese ] = "Periférico: %s\nFabricante: %s\nModelo: %s\nTipo: %s" ;
+ Text[ chinese_simplified ] = "É豸: %s\nÖÆÔìÉÌ: %s\nÐͺÅ: %s\nÀàÐÍ: %s";
+ Text[ russian ] = "Óñòðîéñòâî: %s\nÈçãîòîâèòåëü: %s\nÌîäåëü: %s\nÒèï: %s";
+ Text[ polish ] = "Urz¹dzenie: %s\nProducent: %s\nModel: %s\nTyp: %s";
+ Text[ japanese ] = "ÃÞÊÞ²½: %s\n»‘¢Œ³: %s\nÓÃÞÙ: %s\nÀ²Ìß: %s";
+ Text[ chinese_traditional ] = "³]³Æ¡G%s\n»s³y°Ó¡G%s\n«¬¸¹¡G%s\nÃþ«¬¡G%s";
+ Text[ arabic ] = "ÇáÌåÇÒ: \n%sÇáãäÊÌ: \n%sÇáØÑÇÒ: %s\nÇáäæÚ: %s";
+ Text[ dutch ] = "Apparaat: %s\nProducent: %s\nModel: %s\nType: %s";
+ Text[ chinese_simplified ] = "É豸: %s\nÖÆÔìÉÌ: %s\nÐͺÅ: %s\nÀàÐÍ: %s";
+ Text[ greek ] = "ÓõóêåõÞ: %s\nÊáôáóêåõáóôÞò: %s\nÌïíôÝëï: %s\nÔýðïò: %s";
+ Text[ korean ] = "ÀåÄ¡: %s\nÁ¦Á¶¾÷ü: %s\n¸ðµ¨: %s\nÀ¯Çü: %s";
+ Text[ turkish ] = "Cihaz: %s\nÜretici: %s\nModel: %s\nTip: %s";
+};
+String RID_SANE_SCANERROR_TXT
+{
+ Text = "Während des Scans ist ein Fehler aufgetreten." ;
+ Text [ English ] = "An error occured during scanning." ;
+ Text [ portuguese ] = "Surgiu um erro durante a digitalização." ;
+ Text [ english_us ] = "An error occurred while scanning." ;
+ Text [ portuguese_brazilian ] = "Wõhrend des Scans ist ein Fehler aufgetreten." ;
+ Text [ swedish ] = "Ett fel uppstod när Du skannade." ;
+ Text [ danish ] = "Der opstod en fejl under scanning." ;
+ Text [ italian ] = "Durante la scansione si è verificato un errore." ;
+ Text [ spanish ] = "Se ha producido un error durante el escaneado." ;
+ Text [ french ] = "Une erreur s'est produite durant la digitalisation." ;
+ Text [ dutch ] = "Tijdens het scannen is er een fout opgetreden." ;
+ Text[ chinese_simplified ] = "ÔÚɨÃèʱ·¢Éú´íÎó¡£";
+ Text[ russian ] = "Âî âðåìÿ ñêàíèðîâàíèÿ ïðîèçîøëà îøèáêà.";
+ Text[ polish ] = "Podczas skanowania wyst¹pi³ b³¹d.";
+ Text[ japanese ] = "½·¬Ý’†‚É´×°”­¶¡";
+ Text[ chinese_traditional ] = "¦b±½´y®Éµo¥Í¤@­Ó¿ù»~¡C";
+ Text[ arabic ] = "ÍÏË ÎØà ÃËäÇÁ ÚãáíÉ ÇáãÓÍ ÇáÖæÆí.";
+ Text[ dutch ] = "Tijdens het scannen is er een fout opgetreden.";
+ Text[ chinese_simplified ] = "ÔÚɨÃèʱ·¢Éú´íÎó¡£";
+ Text[ greek ] = "ÐáñïõóéÜóôçêå óöÜëìá êáôÜ ôçí óÜñùóç.";
+ Text[ korean ] = "½ºÄµÇÒ ¶§ ¿À·ù°¡ ¹ß»ýÇß½À´Ï´Ù.";
+ Text[ turkish ] = "Tarama sýrasýnda hata oluþtu.";
+};
+String RID_SANE_NORESOLUTIONOPTION_TXT
+{
+ Text = "Das Gerät ist nicht auf die Erzeugung einer Vorschau eingerichtet. Statt dessen wird als Vorschau ein normaler Scan verwendet. Dieser kann deutlich länger dauern." ;
+ Text [ English ] = "The device does not offer a preview option. Therefore the preview will be acquired by a normal scan which can consume considerable time." ;
+ Text [ portuguese ] = "O aparelho não oferece a possibilidade da previsualização. Por esta razão, será usada uma digitalização normal como previsualização. Isto poderá levar algum tempo." ;
+ Text [ english_us ] = "The device does not offer a preview option. Therefore, a normal scan will be used as a preview instead. This may take a considerable amount of time." ;
+ Text [ portuguese_brazilian ] = "Das Gerõt ist nicht auf die Erzeugung einer Vorschau eingerichtet. Statt dessen wird als Vorschau ein normaler Scan verwendet. Dieser kann deutlich lõnger dauern." ;
+ Text [ swedish ] = "Enheten är inte inställd för att skapa en förhandsvisning. I stället används en vanlig skanning som förhandsvisning. Detta kan ta betydligt längre tid." ;
+ Text [ danish ] = "Enheden er ikke indstillet til at kunne oprette eksempler. Istedet bruges et almindelig scan som eksempel. Dette kan komme til at vare betydelig længere tid." ;
+ Text [ italian ] = "L'apparecchiatura non è impostata per la creazione di un'anteprima. Al suo posto viene usata come anteprima una normale scansione. Ciò può richiedere molto più tempo." ;
+ Text [ spanish ] = "El dispositivo no está preparado para ofrecer opción de previsualización. En lugar de esta se utilizará un escaneado normal, que puede tardar considerablemente más." ;
+ Text [ french ] = "Le périphérique utilisé ne permet pas de créer un aperçu. Il permet uniquement une digitalisation normale en guise d'aperçu, ce qui peut durer nettement plus longtemps." ;
+ Text [ dutch ] = "Het apparaat is niet ingesteld op het maken van een voorbeeld. In plaats daarvan wordt gebruik gemaakt van een normale scan als voorbeeld. Dit kan beduidend langer duren." ;
+ Text[ chinese_simplified ] = "Õâ¸öÉ豸ûÓÐÔ¤ÊÓ¹¦ÄÜ¡£²ÉÓÃÆÕͨµÄɨÃ跽ʽԤÊÓ¿ÉÄÜÐèÒª½Ï³¤µÄʱ¼ä¡£";
+ Text[ russian ] = "Óñòðîéñòâî íå íàñòðîåíî íà ñîçäàíèå ïðåäâàðèòåëüíîãî ïðîñìîòðà. Âìåñòî ýòîãî èñïîëüçóåòñÿ â êà÷åñòâå ïðåäâàðèòåëüíîãî ïðîñìîòðà îáû÷íîå ñêàíèðîâàíèå. Ýòîò ïðîöåññ ïðîäëèòñÿ çíà÷èòåëüíî äîëüøå.";
+ Text[ polish ] = "To urz¹dzenie nie mo¿e utworzyæ podgl¹du. Zamiast tego zostanie zastosowany jako podgl¹d normalny tryb przegl¹du. To mo¿e trochê d³u¿ej potrwaæ.";
+ Text[ japanese ] = "‚±‚ÌÃÞÊÞ²½‚ÍÌßÚËÞ­°‚Ì쬂ɂ͓K‚µ‚Ä‚¢‚Ü‚¹‚ñB‚»‚Ì‚©‚í‚è‚É•’ʂ̽·¬Ý‚ªÌßÚËÞ­°‚Æ‚µ‚ÄŽg—p‚³‚ê‚Ü‚·‚ªAŽžŠÔ‚ª‚©‚©‚è‚Ü‚·B";
+ Text[ chinese_traditional ] = "³o­Ó³]³Æ¨S¦³³]©w¹wµø¥\\¯à¡C¦]¦¹±Ä¥Î´¶³qªº±½´y¤è¦¡¹wµø·|»Ý­n¸ûªøªº®É¶¡¡C";
+ Text[ arabic ] = "ÇáÌåÇÒ ÛíÑ ãõÚÏ áÅäÔÇÁ ãÚÇíäÉ. ÈÏáÇð ãä åÐÇ¡ ÓæÝ íÊã ÇÓÊÎÏÇã ãÓÍ ÚÇÏí ßãÚÇíäÉ. íãßä Ãä íÓÊÛÑÞ Ðáß ÝÊÑÉ ÃØæá ÈßËíÑ.";
+ Text[ dutch ] = "Het apparaat is niet ingesteld op het maken van een voorbeeld. In plaats daarvan wordt gebruik gemaakt van een normale scan als voorbeeld. Dit kan beduidend langer duren.";
+ Text[ chinese_simplified ] = "Õâ¸öÉ豸ûÓÐÔ¤ÊÓ¹¦ÄÜ¡£²ÉÓÃÆÕͨµÄɨÃ跽ʽԤÊÓ¿ÉÄÜÐèÒª½Ï³¤µÄʱ¼ä¡£";
+ Text[ greek ] = "Ç óõóêåõÞ äåí Ý÷åé ñõèìéóôåß ãéá ôçí åìöÜíéóç ðñïåðéóêüðçóçò. Áíôß áõôïý ÷ñçóéìïðïéåßôáé ìéá êáíïíéêÞ óÜñùóç. Ç äéáäéêáóßá áõôÞ ìðïñåß íá áñãÞóåé ðåñéóóüôåñï.";
+ Text[ korean ] = "ÀåÄ¡°¡ ¹Ì¸® º¸±â ¿É¼ÇÀ» Á¦°øÇÏÁö ¾Ê½À´Ï´Ù. ±× ´ë½Å º¸Åë ½ºÄµÀÌ ¹Ì¸® º¸±â·Î ÀÌ¿ëµÉ °ÍÀÔ´Ï´Ù. ÀÌ ½ºÄµÀº ½Ã°£ÀÌ ÈξÀ ´õ ¿À·¡ °É¸± ¼ö ÀÖ½À´Ï´Ù.";
+ Text[ turkish ] = "Cihaz önizleme iþlevine desteklemiyor. Bunun yerine önizleme olarak normal bir tarama görüntüsü kullanýlacak. Bu iþlem daha fazla zaman alabilir.";
+};
+String RID_SANE_NOSANELIB_TXT
+{
+ Text = "Das SANE Interface konnte nicht initialisiert werden. Es kann kein Scanvorgang stattfinden." ;
+ Text [ English ] = "The SANE interface could not be initialized. Scanning is not possible." ;
+ Text [ portuguese ] = "Impossível inicializar a interface SANE. Impossível iniciar o processo de digitalização." ;
+ Text [ english_us ] = "The SANE interface could not be initialized. Scanning is not possible." ;
+ Text [ portuguese_brazilian ] = "Das SANE Interface konnte nicht initialisiert werden. Es kann kein Scanvorgang stattfinden." ;
+ Text [ swedish ] = "SANE-gränssnittet kunde inte initialiseras. Det är inte möjligt att skanna." ;
+ Text [ danish ] = "Det var ikke muligt at initialisere SANE-grænsefladen. Scanning er ikke mulig." ;
+ Text [ italian ] = "Non è stato possibile inizializzare l'interfaccia SANE. Non è possibile eseguire lo scanning." ;
+ Text [ spanish ] = "La interfaz SANE no se pudo inicializar. No se puede realizar ningún proceso de digitalización." ;
+ Text [ french ] = "L'interface SANE n'a pas pu être initialisée. Impossible de scanner." ;
+ Text [ dutch ] = "Het SANE interface kon niet worden geïnitialiseerd. Scannen is niet mogelijk." ;
+ Text[ chinese_simplified ] = "ÎÞ·¨³õʼ»¯ SANE ½çÃæ¡£ÎÞ·¨Ö´ÐÐɨÃè×÷Òµ¡£";
+ Text[ russian ] = "Èíòåðôåéñ SANE íå óäåòñÿ èíèöèàëèçèðîâàòü. Ïðîöåññ ñêàíèðîâàíèÿ íåâîçìîæåí.";
+ Text[ polish ] = "Interfejsu SANE nie mo¿na zainincjowaæ. Skanowanie niemo¿liwe.";
+ Text[ japanese ] = "‚±‚ÌSANE²ÝÀ°Ìª²½‚͉Šú‰»‚Å‚«‚Ü‚¹‚ñB½·¬ÝŽÀs‚Í•s‰Â”\\‚Å‚·B";
+ Text[ chinese_traditional ] = "µLªkªì©l¤Æ SANE ¬É­±¡CµLªk°õ¦æ±½´y§@·~¡C";
+ Text[ arabic ] = "ÊÚÐÑ ÊËÈíÊ ÇáæÇÌåÉ SANE. áåÐÇ ÝÅäå ãä ÛíÑ Çáããßä ÅÌÑÇÁ ÚãáíÉ ÇáãÓÍ ÇáÖæÆí.";
+ Text[ dutch ] = "Het SANE interface kon niet worden geïnitialiseerd. Scannen is niet mogelijk.";
+ Text[ chinese_simplified ] = "ÎÞ·¨³õʼ»¯ SANE ½çÃæ¡£ÎÞ·¨Ö´ÐÐɨÃè×÷Òµ¡£";
+ Text[ greek ] = "Äåí Þôáí äõíáôüí íá ãßíåé áíáãíþñéóç ôçò äéáóýíäåóçò SANE. Áäýíáôïí íá ãßíåé óÜñùóç.";
+ Text[ korean ] = "SANE ÀÎÅÍÆäÀ̽º¸¦ ÃʱâÈ­ÇÏÁö ¸øÇØ ½ºÄµ°úÁ¤À» ÁøÇàÇÒ ¼ö ¾ø½À´Ï´Ù.";
+ Text[ turkish ] = "SANE arabirimi baþlatýlamadý. Tarama iþlemi yürütülemez.";
+};
diff --git a/extensions/source/scanner/scanner.cxx b/extensions/source/scanner/scanner.cxx
new file mode 100644
index 000000000..461ce4e3a
--- /dev/null
+++ b/extensions/source/scanner/scanner.cxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * $RCSfile: scanner.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <scanner.hxx>
+
+// ------------------
+// - ScannerManager -
+// ------------------
+
+REF( XInterface ) SAL_CALL ScannerManager_CreateInstance( const REF( com::sun::star::lang::XMultiServiceFactory )& rxFactory ) throw ( Exception )
+{
+ return *( new ScannerManager() );
+}
+
+// -----------------------------------------------------------------------------
+
+ScannerManager::ScannerManager() :
+ mpData( NULL )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+ScannerManager::~ScannerManager()
+{
+ DestroyData();
+}
+
+// -----------------------------------------------------------------------------
+
+ANY SAL_CALL ScannerManager::queryInterface( const Type& rType ) throw( RuntimeException )
+{
+ const ANY aRet( cppu::queryInterface( rType,
+ static_cast< XScannerManager* >( this ),
+ static_cast< AWT::XBitmap* >( this ) ) );
+
+ return( aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ) );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ScannerManager::acquire() throw( RuntimeException )
+{
+ OWeakObject::acquire();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ScannerManager::release() throw( RuntimeException )
+{
+ OWeakObject::release();
+}
+
+// -----------------------------------------------------------------------------
+
+SEQ( sal_Int8 ) SAL_CALL ScannerManager::getMaskDIB()
+{
+ return SEQ( sal_Int8 )();
+}
+
+// -----------------------------------------------------------------------------
+
+OUString ScannerManager::getImplementationName() throw ()
+{
+ return getImplementationName_Static();
+}
+
+// -----------------------------------------------------------------------------
+
+OUString ScannerManager::getImplementationName_Static() throw()
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.scanner.ScannerManager" ) );
+}
+
+// -----------------------------------------------------------------------------
+
+SEQ( OUString ) ScannerManager::getSupportedServiceNames() throw ()
+{
+ return getSupportedServiceNames_Static();
+}
+
+// -----------------------------------------------------------------------------
+
+SEQ( OUString ) ScannerManager::getSupportedServiceNames_Static() throw ()
+{
+ SEQ( OUString ) aSNS( 1 );
+
+ aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.scanner.ScannerManager" ) );
+
+ return aSNS;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ScannerManager::supportsService( const OUString& ServiceName ) throw ()
+{
+ SEQ( OUString ) aSNL( getSupportedServiceNames() );
+ const OUString* pArray = aSNL.getConstArray();
+
+ for( INT32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == ServiceName )
+ return TRUE;
+
+ return FALSE;
+}
diff --git a/extensions/source/scanner/scanner.hxx b/extensions/source/scanner/scanner.hxx
new file mode 100644
index 000000000..9f9f59159
--- /dev/null
+++ b/extensions/source/scanner/scanner.hxx
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * $RCSfile: scanner.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _EXT_SCANNER_HXX
+#define _EXT_SCANNER_HXX
+
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef __RTL_USTRING_
+#include <rtl/ustring>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
+#include <com/sun/star/uno/Sequence.h>
+#endif
+#ifndef __COM_SUN_STAR_AWT_XBITMAP_HPP
+#include <com/sun/star/awt/XBitmap.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
+#include <com/sun/star/lang/XEventListener.hpp>
+#endif
+#ifndef __COM_SUN_STAR_LANG_EVENTOBJECT_HPP
+#include <com/sun/star/lang/EventObject.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCANNER_XSCANNERMANAGER_HPP_
+#include <com/sun/star/scanner/XScannerManager.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SCANNER_SCANNEREXCEPTION_HPP_
+#include <com/sun/star/scanner/ScannerException.hpp>
+#endif
+
+using namespace rtl;
+using namespace cppu;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::scanner;
+
+// -----------
+// - Defines -
+// -----------
+
+#define REF( _def_Obj ) Reference< _def_Obj >
+#define SEQ( _def_Obj ) Sequence< _def_Obj >
+#define ANY Any
+#define AWT com::sun::star::awt
+
+// ------------------
+// - ScannerManager -
+// ------------------
+
+class ScannerManager : public OWeakObject, XScannerManager, AWT::XBitmap
+{
+protected:
+
+ vos::OMutex maProtector;
+ void* mpData;
+
+ void DestroyData();
+
+public:
+
+ ScannerManager();
+ virtual ~ScannerManager();
+
+ // XInterface
+ virtual ANY SAL_CALL queryInterface( const Type & rType ) throw( RuntimeException );
+ virtual void SAL_CALL acquire() throw( RuntimeException );
+ virtual void SAL_CALL release() throw( RuntimeException );
+
+ // XScannerManager
+ virtual SEQ( ScannerContext ) SAL_CALL getAvailableScanners();
+ virtual BOOL SAL_CALL configureScanner( ScannerContext& scanner_context ) throw( ScannerException );
+ virtual void SAL_CALL startScan( const ScannerContext& scanner_context, const REF( com::sun::star::lang::XEventListener )& rxListener ) throw( ScannerException );
+ virtual ScanError SAL_CALL getError( const ScannerContext& scanner_context ) throw( ScannerException );
+ virtual REF( AWT::XBitmap ) SAL_CALL getBitmap( const ScannerContext& scanner_context ) throw( ScannerException );
+
+ // XBitmap
+ virtual AWT::Size SAL_CALL getSize();
+ virtual SEQ( sal_Int8 ) SAL_CALL getDIB();
+ virtual SEQ( sal_Int8 ) SAL_CALL getMaskDIB();
+
+ // Misc
+ OUString getImplementationName() throw();
+ static OUString getImplementationName_Static() throw();
+ Sequence< OUString > getSupportedServiceNames() throw();
+ static Sequence< OUString > getSupportedServiceNames_Static() throw();
+ BOOL supportsService( const OUString& ServiceName ) throw();
+
+ void Lock() { maProtector.acquire(); }
+ void Unlock() { maProtector.release(); }
+
+ void* GetData() const { return mpData; }
+ void SetData( void* pData ) { DestroyData(); mpData = pData; }
+};
+
+// -----------------------------------------------------------------------------
+
+REF( XInterface ) SAL_CALL ScannerManager_CreateInstance( const REF( com::sun::star::lang::XMultiServiceFactory )& rxFactory ) throw( Exception );
+
+#endif
diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx
new file mode 100644
index 000000000..28832e1c3
--- /dev/null
+++ b/extensions/source/scanner/scanunx.cxx
@@ -0,0 +1,305 @@
+/*************************************************************************
+ *
+ * $RCSfile: scanunx.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <scanner.hxx>
+#include <sanedlg.hxx>
+#include <vos/thread.hxx>
+#include <tools/list.hxx>
+
+// -----------------------------------------------------------------------------
+
+ANY SAL_CALL BitmapTransporter::queryInterface( const Type& rType ) throw( RuntimeException )
+{
+ const ANY aRet( cppu::queryInterface( rType, static_cast< AWT::XBitmap* >( this ) ) );
+
+ return( aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ) );
+}
+
+// -----------------------------------------------------------------------------
+
+AWT::Size BitmapTransporter::getSize()
+{
+ vos::OGuard aGuard( m_aProtector );
+ int nPreviousPos = m_aStream.Tell();
+ AWT::Size aRet;
+
+ // ensure that there is at least a header
+ m_aStream.Seek( STREAM_SEEK_TO_END );
+ int nLen = m_aStream.Tell();
+ if( nLen > 15 )
+ {
+ m_aStream.Seek( 4 );
+ m_aStream >> aRet.Width >> aRet.Height;
+ }
+ else
+ aRet.Width = aRet.Height = 0;
+
+ m_aStream.Seek( nPreviousPos );
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+SEQ( sal_Int8 ) BitmapTransporter::getDIB()
+{
+ vos::OGuard aGuard( m_aProtector );
+ int nPreviousPos = m_aStream.Tell();
+
+ // create return value
+ m_aStream.Seek( STREAM_SEEK_TO_END );
+ int nBytes = m_aStream.Tell();
+ m_aStream.Seek( 0 );
+
+ SEQ( sal_Int8 ) aValue( nBytes );
+ m_aStream.Read( aValue.getArray(), nBytes );
+ m_aStream.Seek( nPreviousPos );
+
+ return aValue;
+}
+
+// --------------
+// - SaneHolder -
+// --------------
+
+struct SaneHolder
+{
+ Sane m_aSane;
+ REF( AWT::XBitmap ) m_xBitmap;
+ vos::OMutex m_aProtector;
+ ScanError m_nError;
+};
+
+DECLARE_LIST( SaneHolderList, SaneHolder* );
+
+static SaneHolderList allSanes;
+static vos::OMutex aSaneProtector;
+
+// -----------------
+// - ScannerThread -
+// -----------------
+
+class ScannerThread : public vos::OThread
+{
+ SaneHolder* m_pHolder;
+ REF( com::sun::star::lang::XEventListener ) m_xListener;
+ ScannerManager* m_pManager; // just for the disposing call
+
+ virtual void run();
+ virtual void onTerminated() { delete this; }
+public:
+ ScannerThread( SaneHolder* pHolder,
+ const REF( com::sun::star::lang::XEventListener )& listener,
+ ScannerManager* pManager )
+ : m_pHolder( pHolder ), m_xListener( listener ), m_pManager( pManager ) {}
+ virtual ~ScannerThread() {}
+};
+
+// -----------------------------------------------------------------------------
+
+void ScannerThread::run()
+{
+ vos::OGuard aGuard( m_pHolder->m_aProtector );
+ REF( XInterface ) aIf( static_cast< OWeakObject* >( new BitmapTransporter ) );
+
+ m_pHolder->m_xBitmap = REF( AWT::XBitmap )( aIf, UNO_QUERY );
+
+ if( m_pHolder->m_aSane.IsOpen() )
+ {
+ int nOption = m_pHolder->m_aSane.GetOptionByName( "preview" );
+ if( nOption != -1 )
+ m_pHolder->m_aSane.SetOptionValue( nOption, (BOOL)FALSE );
+
+ m_pHolder->m_nError =
+ m_pHolder->m_aSane.Start( *(BitmapTransporter*)&m_pHolder->m_xBitmap ) ?
+ ScanError_ScanErrorNone : ScanError_ScanCanceled;
+ }
+ else
+ m_pHolder->m_nError = ScanError_ScannerNotAvailable;
+
+ m_xListener->disposing( com::sun::star::lang::EventObject( REF( XInterface )( static_cast< OWeakObject* >( m_pManager ) ) ) );
+}
+
+// ------------------
+// - ScannerManager -
+// ------------------
+
+void ScannerManager::DestroyData()
+{
+ // unused
+}
+
+// -----------------------------------------------------------------------------
+
+AWT::Size ScannerManager::getSize()
+{
+ AWT::Size aRet;
+ aRet.Width = aRet.Height = 0;
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+SEQ( sal_Int8 ) ScannerManager::getDIB()
+{
+ return SEQ( sal_Int8 )();
+}
+
+// -----------------------------------------------------------------------------
+
+SEQ( ScannerContext ) ScannerManager::getAvailableScanners()
+{
+ vos::OGuard aGuard( aSaneProtector );
+
+ if( ! allSanes.Count() )
+ {
+ SaneHolder* pSaneHolder = new SaneHolder;
+ pSaneHolder->m_nError = ScanError_ScanErrorNone;
+ if( Sane::IsSane() )
+ allSanes.Insert( pSaneHolder );
+ else
+ delete pSaneHolder;
+ }
+
+ if( Sane::IsSane() )
+ {
+ SEQ( ScannerContext ) aRet(1);
+ aRet.getArray()[0].ScannerName = ::rtl::OUString::createFromAscii( "SANE" );
+ aRet.getArray()[0].InternalData = 0;
+ return aRet;
+ }
+
+ return SEQ( ScannerContext )();
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ScannerManager::configureScanner( ScannerContext& scanner_context ) throw( ScannerException )
+{
+ vos::OGuard aGuard( aSaneProtector );
+
+ if( scanner_context.InternalData < 0 || scanner_context.InternalData >= allSanes.Count() )
+ throw ScannerException(
+ ::rtl::OUString::createFromAscii( "Scanner does not exist" ),
+ REF( XScannerManager )( this ),
+ ScanError_InvalidContext
+ );
+ SaneDlg aDlg( NULL, allSanes.GetObject( scanner_context.InternalData )->m_aSane );
+ return (BOOL)aDlg.Execute();
+}
+
+// -----------------------------------------------------------------------------
+
+void ScannerManager::startScan( const ScannerContext& scanner_context,
+ const REF( com::sun::star::lang::XEventListener )& listener ) throw( ScannerException )
+{
+ vos::OGuard aGuard( aSaneProtector );
+
+ if( scanner_context.InternalData < 0 || scanner_context.InternalData >= allSanes.Count() )
+ throw ScannerException(
+ ::rtl::OUString::createFromAscii( "Scanner does not exist" ),
+ REF( XScannerManager )( this ),
+ ScanError_InvalidContext
+ );
+ SaneHolder* pHolder = allSanes.GetObject( scanner_context.InternalData );
+
+ ScannerThread* pThread = new ScannerThread( pHolder, listener, this );
+ pThread->create();
+}
+
+// -----------------------------------------------------------------------------
+
+ScanError ScannerManager::getError( const ScannerContext& scanner_context ) throw( ScannerException )
+{
+ vos::OGuard aGuard( aSaneProtector );
+
+ if( scanner_context.InternalData < 0 || scanner_context.InternalData >= allSanes.Count() )
+ throw ScannerException(
+ ::rtl::OUString::createFromAscii( "Scanner does not exist" ),
+ REF( XScannerManager )( this ),
+ ScanError_InvalidContext
+ );
+
+ SaneHolder* pHolder = allSanes.GetObject( scanner_context.InternalData );
+
+ return pHolder->m_nError;
+}
+
+// -----------------------------------------------------------------------------
+
+REF( AWT::XBitmap ) ScannerManager::getBitmap( const ScannerContext& scanner_context ) throw( ScannerException )
+{
+ vos::OGuard aGuard( aSaneProtector );
+
+ if( scanner_context.InternalData < 0 || scanner_context.InternalData >= allSanes.Count() )
+ throw ScannerException(
+ ::rtl::OUString::createFromAscii( "Scanner does not exist" ),
+ REF( XScannerManager )( this ),
+ ScanError_InvalidContext
+ );
+ SaneHolder* pHolder = allSanes.GetObject( scanner_context.InternalData );
+
+ vos::OGuard aProtGuard( pHolder->m_aProtector );
+
+ REF( AWT::XBitmap ) xRet( pHolder->m_xBitmap );
+ pHolder->m_xBitmap = REF( AWT::XBitmap )();
+
+ return xRet;
+}
diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx
new file mode 100644
index 000000000..5eef9ba68
--- /dev/null
+++ b/extensions/source/scanner/scanwin.cxx
@@ -0,0 +1,852 @@
+/*************************************************************************
+ *
+ * $RCSfile: scanwin.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <math.h>
+#include <tools/svwin.h>
+#include <tools/stream.hxx>
+#include <vos/mutex.hxx>
+#include <vos/module.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/sysdata.hxx>
+#include <vcl/salbtype.hxx>
+#include "scanner.hxx"
+#include "twain/twain.h"
+
+// -----------
+// - Defines -
+// -----------
+
+#define TWAIN_SELECT 0x00000001UL
+#define TWAIN_ACQUIRE 0x00000002UL
+#define TWAIN_TERMINATE 0xFFFFFFFFUL
+
+#define TWAIN_EVENT_NONE 0x00000000UL
+#define TWAIN_EVENT_QUIT 0x00000001UL
+#define TWAIN_EVENT_SCANNING 0x00000002UL
+#define TWAIN_EVENT_XFER 0x00000004UL
+
+#define PFUNC (*pDSM)
+#define PTWAINMSG MSG*
+#define FIXTODOUBLE( nFix ) ((double)nFix.Whole+(double)nFix.Frac/65536.)
+#define FIXTOLONG( nFix ) ((long)floor(FIXTODOUBLE(nFix)+0.5))
+
+#if defined WIN
+#define TWAIN_LIBNAME "TWAIN.DLL"
+#define TWAIN_FUNCNAME "DSM_Entry"
+#elif defined WNT
+#define TWAIN_LIBNAME "TWAIN_32.DLL"
+#define TWAIN_FUNCNAME "DSM_Entry"
+#endif
+
+// --------------
+// - TwainState -
+// --------------
+
+enum TwainState
+{
+ TWAIN_STATE_NONE = 0,
+ TWAIN_STATE_SCANNING = 1,
+ TWAIN_STATE_DONE = 2,
+ TWAIN_STATE_CANCELED = 3
+};
+
+// ------------
+// - ImpTwain -
+// ------------
+
+class ImpTwain
+{
+ ScannerManager* mpMgr;
+ TW_IDENTITY aAppIdent;
+ TW_IDENTITY aSrcIdent;
+ Link aNotifyLink;
+ DSMENTRYPROC pDSM;
+ NAMESPACE_VOS( OModule )* pMod;
+ ULONG nCurState;
+
+ void ImplCreate();
+ void ImplOpenSourceManager();
+ void ImplOpenSource();
+ BOOL ImplEnableSource();
+ void ImplXfer();
+ void ImplFallback( ULONG nEvent );
+
+ DECL_LINK( ImplFallbackHdl, void* );
+ DECL_LINK( ImplDestroyHdl, void* );
+
+public:
+
+ HWND hTwainWnd;
+ HHOOK hTwainHook;
+
+ BOOL ImplHandleMsg( void* pMsg );
+
+public:
+
+ ImpTwain( ScannerManager* pMgr, const Link& rNotifyLink );
+ ~ImpTwain();
+
+ void Destroy();
+
+ BOOL SelectSource();
+ BOOL InitXfer();
+};
+
+// ---------
+// - Procs -
+// ---------
+
+static ImpTwain* pImpTwainInstance = NULL;
+
+// -------------------------------------------------------------------------
+
+LRESULT CALLBACK TwainWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 )
+{
+ return DefWindowProc( hWnd, nMsg, nPar1, nPar2 );
+}
+
+// -------------------------------------------------------------------------
+
+LRESULT CALLBACK TwainMsgProc( int nCode, WPARAM wParam, LPARAM lParam )
+{
+ MSG* pMsg = (MSG*) lParam;
+
+ if( ( nCode < 0 ) ||
+ ( pImpTwainInstance->hTwainWnd != pMsg->hwnd ) ||
+ !pImpTwainInstance->ImplHandleMsg( (void*) lParam ) )
+ {
+ return CallNextHookEx( pImpTwainInstance->hTwainHook, nCode, wParam, lParam );
+ }
+ else
+ {
+ pMsg->message = WM_USER;
+ pMsg->lParam = 0;
+
+ return 0;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+ImpTwain::ImpTwain( ScannerManager* pMgr, const Link& rNotifyLink ) :
+ mpMgr ( pMgr ),
+ aNotifyLink ( rNotifyLink ),
+ pDSM ( NULL ),
+ pMod ( NULL ),
+ hTwainWnd ( 0 ),
+ hTwainHook ( 0 ),
+ nCurState ( 1 )
+{
+ pImpTwainInstance = this;
+
+ aAppIdent.Id = 0;
+ aAppIdent.Version.MajorNum = 1;
+ aAppIdent.Version.MinorNum = 0;
+ aAppIdent.Version.Language = TWLG_USA;
+ aAppIdent.Version.Country = TWCY_USA;
+ aAppIdent.ProtocolMajor = TWON_PROTOCOLMAJOR;
+ aAppIdent.ProtocolMinor = TWON_PROTOCOLMINOR;
+ aAppIdent.SupportedGroups = DG_IMAGE | DG_CONTROL;
+ strcpy( aAppIdent.Version.Info, "StarOffice" );
+ strcpy( aAppIdent.Manufacturer, "Sun Microsystems");
+ strcpy( aAppIdent.ProductFamily,"Office");
+ strcpy( aAppIdent.ProductName, "StarOffice");
+
+ HWND hParentWnd = HWND_DESKTOP;
+ WNDCLASS aWc = { 0, &TwainWndProc, 0, sizeof( WNDCLASS ), GetModuleHandle( NULL ),
+ NULL, NULL, NULL, NULL, "TwainClass" };
+
+ RegisterClass( &aWc );
+ hTwainWnd = CreateWindowEx( WS_EX_TOPMOST, aWc.lpszClassName, "TWAIN", 0, 0, 0, 0, 0, hParentWnd, NULL, aWc.hInstance, 0 );
+ hTwainHook = SetWindowsHookEx( WH_GETMESSAGE, &TwainMsgProc, NULL, GetCurrentThreadId() );
+}
+
+// -----------------------------------------------------------------------------
+
+ImpTwain::~ImpTwain()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void ImpTwain::Destroy()
+{
+ ImplFallback( TWAIN_EVENT_NONE );
+ Application::PostUserEvent( LINK( this, ImpTwain, ImplDestroyHdl ), NULL );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImpTwain::SelectSource()
+{
+ TW_UINT16 nRet = TWRC_FAILURE;
+
+ ImplOpenSourceManager();
+
+ if( 3 == nCurState )
+ {
+ TW_IDENTITY aIdent;
+
+ aIdent.Id = 0, aIdent.ProductName[ 0 ] = '\0';
+ aNotifyLink.Call( (void*) TWAIN_EVENT_SCANNING );
+ nRet = PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_USERSELECT, &aIdent );
+ }
+
+ ImplFallback( TWAIN_EVENT_QUIT );
+
+ return( nRet == TWRC_SUCCESS || nRet == TWRC_CANCEL );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImpTwain::InitXfer()
+{
+ BOOL bRet = FALSE;
+
+ ImplOpenSourceManager();
+
+ if( 3 == nCurState )
+ {
+ ImplOpenSource();
+
+ if( 4 == nCurState )
+ bRet = ImplEnableSource();
+ }
+
+ if( !bRet )
+ ImplFallback( TWAIN_EVENT_QUIT );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImpTwain::ImplOpenSourceManager()
+{
+ if( 1 == nCurState )
+ {
+ pMod = new ::vos::OModule( ::rtl::OUString() );
+
+ if( pMod->load( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( TWAIN_LIBNAME ) ) ) )
+ {
+ nCurState = 2;
+
+ if( ( ( pDSM = (DSMENTRYPROC) pMod->getSymbol( String( RTL_CONSTASCII_USTRINGPARAM( TWAIN_FUNCNAME ) ) ) ) != NULL ) &&
+ ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_PARENT, MSG_OPENDSM, &hTwainWnd ) == TWRC_SUCCESS ) )
+ {
+ nCurState = 3;
+ }
+ }
+ else
+ {
+ delete pMod;
+ pMod = NULL;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void ImpTwain::ImplOpenSource()
+{
+ if( 3 == nCurState )
+ {
+ if( ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_GETDEFAULT, &aSrcIdent ) == TWRC_SUCCESS ) &&
+ ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_OPENDS, &aSrcIdent ) == TWRC_SUCCESS ) )
+ {
+ TW_CAPABILITY aCap = { CAP_XFERCOUNT, TWON_ONEVALUE, GlobalAlloc( GHND, sizeof( TW_ONEVALUE ) ) };
+ TW_ONEVALUE* pVal = (TW_ONEVALUE*) GlobalLock( aCap.hContainer );
+
+ pVal->ItemType = TWTY_INT16, pVal->Item = 1;
+ GlobalUnlock( aCap.hContainer );
+ PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_CAPABILITY, MSG_SET, &aCap );
+ GlobalFree( aCap.hContainer );
+ nCurState = 4;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImpTwain::ImplEnableSource()
+{
+ BOOL bRet = FALSE;
+
+ if( 4 == nCurState )
+ {
+ TW_USERINTERFACE aUI = { TRUE, TRUE, hTwainWnd };
+
+ aNotifyLink.Call( (void*) TWAIN_EVENT_SCANNING );
+ nCurState = 5;
+
+ if( PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_USERINTERFACE, MSG_ENABLEDS, &aUI ) == TWRC_SUCCESS )
+ bRet = TRUE;
+ else
+ nCurState = 4;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImpTwain::ImplHandleMsg( void* pMsg )
+{
+ TW_UINT16 nRet;
+ PTWAINMSG pMess = (PTWAINMSG) pMsg;
+ TW_EVENT aEvt = { pMess, MSG_NULL };
+
+ nRet = PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_EVENT, MSG_PROCESSEVENT, &aEvt );
+
+ if( aEvt.TWMessage != MSG_NULL )
+ {
+ switch( aEvt.TWMessage )
+ {
+ case MSG_XFERREADY:
+ {
+ ULONG nEvent = TWAIN_EVENT_QUIT;
+
+ if( 5 == nCurState )
+ {
+ nCurState = 6;
+ ImplXfer();
+
+ if( mpMgr && mpMgr->GetData() )
+ nEvent = TWAIN_EVENT_XFER;
+ }
+
+ ImplFallback( nEvent );
+ }
+ break;
+
+ case MSG_CLOSEDSREQ:
+ ImplFallback( TWAIN_EVENT_QUIT );
+ break;
+
+ default:
+ break;
+ }
+ }
+ else
+ nRet = TWRC_NOTDSEVENT;
+
+ return( TWRC_DSEVENT == nRet );
+}
+
+// -----------------------------------------------------------------------------
+
+void ImpTwain::ImplXfer()
+{
+ if( nCurState == 6 )
+ {
+ TW_IMAGEINFO aInfo;
+ TW_UINT32 hDIB = 0;
+ long nWidth, nHeight, nXRes, nYRes;
+
+ if( PFUNC( &aAppIdent, &aSrcIdent, DG_IMAGE, DAT_IMAGEINFO, MSG_GET, &aInfo ) == TWRC_SUCCESS )
+ {
+ nWidth = aInfo.ImageWidth;
+ nHeight = aInfo.ImageLength;
+ nXRes = FIXTOLONG( aInfo.XResolution );
+ nYRes = FIXTOLONG( aInfo.YResolution );
+ }
+ else
+ nWidth = nHeight = nXRes = nYRes = -1L;
+
+ switch( PFUNC( &aAppIdent, &aSrcIdent, DG_IMAGE, DAT_IMAGENATIVEXFER, MSG_GET, &hDIB ) )
+ {
+ case( TWRC_CANCEL ):
+ nCurState = 7;
+ break;
+
+ case( TWRC_XFERDONE ):
+ {
+ if( mpMgr && hDIB )
+ {
+ if( ( nXRes != -1 ) && ( nYRes != - 1 ) && ( nWidth != - 1 ) && ( nHeight != - 1 ) )
+ {
+ // set resolution of bitmap
+ BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) GlobalLock( (HGLOBAL) hDIB );
+ static const double fFactor = 100.0 / 2.54;
+
+ pBIH->biXPelsPerMeter = FRound( fFactor * nXRes );
+ pBIH->biYPelsPerMeter = FRound( fFactor * nYRes );
+
+ GlobalUnlock( (HGLOBAL) hDIB );
+ }
+
+ mpMgr->SetData( (void*)(long) hDIB );
+ }
+ else
+ GlobalFree( (HGLOBAL) hDIB );
+
+ nCurState = 7;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void ImpTwain::ImplFallback( ULONG nEvent )
+{
+ Application::PostUserEvent( LINK( this, ImpTwain, ImplFallbackHdl ), (void*) nEvent );
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( ImpTwain, ImplFallbackHdl, void*, pData )
+{
+ const ULONG nEvent = (ULONG) pData;
+ BOOL bFallback = TRUE;
+
+ switch( nCurState )
+ {
+ case( 7 ):
+ case( 6 ):
+ {
+ TW_PENDINGXFERS aXfers;
+
+ if( PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_PENDINGXFERS, MSG_ENDXFER, &aXfers ) == TWRC_SUCCESS )
+ {
+ if( aXfers.Count != 0 )
+ PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_PENDINGXFERS, MSG_RESET, &aXfers );
+ }
+
+ nCurState = 5;
+ }
+ break;
+
+ case( 5 ):
+ {
+ TW_USERINTERFACE aUI = { TRUE, TRUE, hTwainWnd };
+
+ PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_USERINTERFACE, MSG_DISABLEDS, &aUI );
+ nCurState = 4;
+ }
+ break;
+
+ case( 4 ):
+ {
+ PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_CLOSEDS, &aSrcIdent );
+ nCurState = 3;
+ }
+ break;
+
+ case( 3 ):
+ {
+ PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_PARENT, MSG_CLOSEDSM, &hTwainWnd );
+ nCurState = 2;
+ }
+ break;
+
+ case( 2 ):
+ {
+ delete pMod;
+ pMod = NULL;
+ nCurState = 1;
+ }
+ break;
+
+ default:
+ {
+ if( nEvent != TWAIN_EVENT_NONE )
+ aNotifyLink.Call( (void*) nEvent );
+
+ bFallback = FALSE;
+ }
+ break;
+ }
+
+ if( bFallback )
+ ImplFallback( nEvent );
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( ImpTwain, ImplDestroyHdl, void*, p )
+{
+ if( hTwainWnd )
+ DestroyWindow( hTwainWnd );
+
+ if( hTwainHook )
+ UnhookWindowsHookEx( hTwainHook );
+
+ delete this;
+ pImpTwainInstance = NULL;
+
+ return 0L;
+}
+
+// ---------
+// - Twain -
+// ---------
+
+class Twain
+{
+ ScannerManager* mpMgr;
+ REF( com::sun::star::lang::XEventListener ) mxListener;
+ ImpTwain* mpImpTwain;
+ TwainState meState;
+
+ DECL_LINK( ImpNotifyHdl, ImpTwain* );
+
+public:
+
+ Twain();
+ ~Twain();
+
+ BOOL SelectSource();
+ BOOL PerformTransfer( ScannerManager* pMgr,
+ const REF( com::sun::star::lang::XEventListener )& rxListener );
+
+ TwainState GetState() const { return meState; }
+};
+
+// ------------------------------------------------------------------------
+
+Twain::Twain() :
+ mpMgr ( NULL ),
+ mpImpTwain ( NULL ),
+ meState ( TWAIN_STATE_NONE )
+{
+}
+
+// ------------------------------------------------------------------------
+
+Twain::~Twain()
+{
+ if( mpImpTwain )
+ mpImpTwain->Destroy();
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Twain::SelectSource()
+{
+ BOOL bRet;
+
+ if( !mpImpTwain )
+ {
+ meState = TWAIN_STATE_NONE;
+ mpImpTwain = new ImpTwain( mpMgr, LINK( this, Twain, ImpNotifyHdl ) );
+ bRet = mpImpTwain->SelectSource();
+ }
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+BOOL Twain::PerformTransfer( ScannerManager* pMgr, const REF( com::sun::star::lang::XEventListener )& rxListener )
+{
+ BOOL bRet;
+
+ if( pMgr && !mpImpTwain )
+ {
+ mpMgr = pMgr;
+ mxListener = rxListener;
+ meState = TWAIN_STATE_NONE;
+ mpImpTwain = new ImpTwain( mpMgr, LINK( this, Twain, ImpNotifyHdl ) );
+ bRet = mpImpTwain->InitXfer();
+ }
+ else
+ bRet = FALSE;
+
+ return bRet;
+}
+
+// ------------------------------------------------------------------------
+
+IMPL_LINK( Twain, ImpNotifyHdl, ImpTwain*, nEvent )
+{
+ switch( (ULONG)(void*) nEvent )
+ {
+ case( TWAIN_EVENT_SCANNING ):
+ meState = TWAIN_STATE_SCANNING;
+ break;
+
+ case( TWAIN_EVENT_QUIT ):
+ {
+ if( meState != TWAIN_STATE_DONE )
+ meState = TWAIN_STATE_CANCELED;
+
+ mpImpTwain->Destroy();
+ mpImpTwain = NULL;
+
+ if( mpMgr && mxListener.is() )
+ mxListener->disposing( com::sun::star::lang::EventObject( REF( XInterface )( static_cast< OWeakObject* >( mpMgr ) ) ) );
+
+ mxListener = REF( com::sun::star::lang::XEventListener )();
+ }
+ break;
+
+ case( TWAIN_EVENT_XFER ):
+ {
+ if( mpImpTwain )
+ {
+ meState = ( ( mpMgr && mpMgr->GetData() ) ? TWAIN_STATE_DONE : TWAIN_STATE_CANCELED );
+
+ mpImpTwain->Destroy();
+ mpImpTwain = NULL;
+
+ if( mpMgr && mxListener.is() )
+ mxListener->disposing( com::sun::star::lang::EventObject( REF( XInterface )( static_cast< OWeakObject* >( mpMgr ) ) ) );
+ }
+
+ mxListener = REF( com::sun::star::lang::XEventListener )();
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return 0L;
+}
+
+// -----------
+// - statics -
+// -----------
+
+static Twain aTwain;
+
+// ------------------
+// - ScannerManager -
+// ------------------
+
+void ScannerManager::DestroyData()
+{
+ if( mpData )
+ {
+ GlobalFree( (HGLOBAL)(long) mpData );
+ mpData = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+AWT::Size ScannerManager::getSize()
+{
+ AWT::Size aRet;
+ HGLOBAL hDIB = (HGLOBAL)(long) mpData;
+
+ if( hDIB )
+ {
+ BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) GlobalLock( hDIB );
+
+ if( pBIH )
+ {
+ aRet.Width = pBIH->biWidth;
+ aRet.Height = pBIH->biHeight;
+ }
+ else
+ aRet.Width = aRet.Height = 0;
+
+ GlobalUnlock( hDIB );
+ }
+ else
+ aRet.Width = aRet.Height = 0;
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+SEQ( sal_Int8 ) ScannerManager::getDIB()
+{
+ SEQ( sal_Int8 ) aRet;
+
+ if( mpData )
+ {
+ HGLOBAL hDIB = (HGLOBAL)(long) mpData;
+ const sal_uInt32 nDIBSize = GlobalSize( hDIB );
+ sal_uInt32 nSize = sizeof( BITMAPFILEHEADER) + nDIBSize;
+ BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) GlobalLock( hDIB );
+
+ if( pBIH )
+ {
+ sal_uInt32 nColEntries;
+
+ switch( pBIH->biBitCount )
+ {
+ case( 1 ):
+ case( 4 ):
+ case( 8 ):
+ nColEntries = pBIH->biClrUsed ? pBIH->biClrUsed : ( 1 << pBIH->biBitCount );
+ break;
+
+ case( 24 ):
+ nColEntries = pBIH->biClrUsed ? pBIH->biClrUsed : 0;
+ break;
+
+ case( 16 ):
+ case( 32 ):
+ {
+ nColEntries = pBIH->biClrUsed;
+
+ if( pBIH->biCompression == BI_BITFIELDS )
+ nColEntries += 3;
+ }
+ break;
+
+ default:
+ nColEntries = 0;
+ break;
+ }
+
+ aRet = SEQ( sal_Int8 )( sizeof( BITMAPFILEHEADER ) + nDIBSize );
+
+ sal_Int8* pBuf = aRet.getArray();
+ SvMemoryStream* pMemStm = new SvMemoryStream( (char*) pBuf, sizeof( BITMAPFILEHEADER ), STREAM_WRITE );
+
+ *pMemStm << 'B' << 'M' << (sal_uInt32) 0 << (sal_uInt32) 0;
+ *pMemStm << (sal_uInt32) ( sizeof( BITMAPFILEHEADER ) + pBIH->biSize + ( nColEntries * sizeof( RGBQUAD ) ) );
+
+ delete pMemStm;
+ HMEMCPY( pBuf + sizeof( BITMAPFILEHEADER ), pBIH, nDIBSize );
+ }
+
+ GlobalUnlock( hDIB );
+ DestroyData();
+ }
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+SEQ( ScannerContext ) SAL_CALL ScannerManager::getAvailableScanners()
+{
+ vos::OGuard aGuard( maProtector );
+ SEQ( ScannerContext ) aRet( 1 );
+
+ aRet.getArray()[0].ScannerName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TWAIN" ) );
+ aRet.getArray()[0].InternalData = 0;
+
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL SAL_CALL ScannerManager::configureScanner( ScannerContext& rContext ) throw( ScannerException )
+{
+ vos::OGuard aGuard( maProtector );
+ REF( XScannerManager ) xThis( this );
+
+ if( rContext.InternalData != 0 || rContext.ScannerName != ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TWAIN" ) ) )
+ throw ScannerException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Scanner does not exist" ) ), xThis, ScanError_InvalidContext );
+
+ DestroyData();
+
+ return aTwain.SelectSource();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL ScannerManager::startScan( const ScannerContext& rContext, const REF( com::sun::star::lang::XEventListener )& rxListener ) throw( ScannerException )
+{
+ vos::OGuard aGuard( maProtector );
+ REF( XScannerManager ) xThis( this );
+
+ if( rContext.InternalData != 0 || rContext.ScannerName != ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TWAIN" ) ) )
+ throw ScannerException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Scanner does not exist" ) ), xThis, ScanError_InvalidContext );
+
+ DestroyData();
+
+ aTwain.PerformTransfer( this, rxListener );
+}
+
+// -----------------------------------------------------------------------------
+
+ScanError SAL_CALL ScannerManager::getError( const ScannerContext& rContext ) throw( ScannerException )
+{
+ vos::OGuard aGuard( maProtector );
+ ScanError eError;
+ REF( XScannerManager ) xThis( this );
+
+ if( rContext.InternalData != 0 || rContext.ScannerName != ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TWAIN" ) ) )
+ throw ScannerException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Scanner does not exist" ) ), xThis, ScanError_InvalidContext );
+
+ if( aTwain.GetState() == TWAIN_STATE_CANCELED )
+ eError = ScanError_ScanCanceled;
+ else
+ eError = ScanError_ScanErrorNone;
+
+ return eError;
+}
+
+// -----------------------------------------------------------------------------
+
+REF( AWT::XBitmap ) SAL_CALL ScannerManager::getBitmap( const ScannerContext& rContext ) throw( ScannerException )
+{
+ vos::OGuard aGuard( maProtector );
+ return REF( AWT::XBitmap )( this );
+}
diff --git a/extensions/source/scanner/scnserv.cxx b/extensions/source/scanner/scnserv.cxx
new file mode 100644
index 000000000..c89560916
--- /dev/null
+++ b/extensions/source/scanner/scnserv.cxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * $RCSfile: scnserv.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#include <cppuhelper/factory.hxx>
+#include <uno/mapping.hxx>
+#include "scanner.hxx"
+
+#include <com/sun/star/registry/XRegistryKey.hpp>
+
+using namespace com::sun::star::registry;
+
+// ------------------------------------------
+// - component_getImplementationEnvironment -
+// ------------------------------------------
+
+extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+// -----------------------
+// - component_writeInfo -
+// -----------------------
+
+extern "C" sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
+{
+ sal_Bool bRet = sal_False;
+
+ if( pRegistryKey )
+ {
+ try
+ {
+ ::rtl::OUString aImplName( '/' );
+
+ aImplName += ScannerManager::getImplementationName_Static();
+ aImplName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES/" ) );
+ aImplName += ScannerManager::getImplementationName_Static();
+
+ REF( XRegistryKey ) xNewKey1( static_cast< XRegistryKey* >( pRegistryKey )->createKey( aImplName ) );
+
+ bRet = sal_True;
+ }
+ catch( InvalidRegistryException& )
+ {
+ OSL_ENSHURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------
+// - component_getFactory -
+// ------------------------
+
+extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
+{
+ REF( ::com::sun::star::lang::XSingleServiceFactory ) xFactory;
+ void* pRet = 0;
+
+ if( ::rtl::OUString::createFromAscii( pImplName ) == ScannerManager::getImplementationName_Static() )
+ {
+ xFactory = REF( ::com::sun::star::lang::XSingleServiceFactory )( ::cppu::createSingleFactory(
+ static_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager ),
+ ScannerManager::getImplementationName_Static(),
+ ScannerManager_CreateInstance,
+ ScannerManager::getSupportedServiceNames_Static() ) );
+ }
+
+ if( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+}
diff --git a/extensions/source/scanner/twain.cxx b/extensions/source/scanner/twain.cxx
new file mode 100644
index 000000000..d5b2a0465
--- /dev/null
+++ b/extensions/source/scanner/twain.cxx
@@ -0,0 +1,563 @@
+/*************************************************************************
+ *
+ * $RCSfile: twain.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <string.h>
+#include <math.h>
+
+#if defined( WNT ) || defined (WIN)
+#include <tools/svwin.h>
+#endif
+#ifdef OS2
+#include <tools/svpm.h>
+#endif // OS2
+#include <vos/module.hxx>
+#include <tools/stream.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/sysdata.hxx>
+#include "twain.hxx"
+
+// -----------
+// - Defines -
+// -----------
+
+#define PFUNC (*pDSM)
+#define FIXTODOUBLE( nFix ) ((double)nFix.Whole+(double)nFix.Frac/65536.)
+#define FIXTOLONG( nFix ) ((long)floor(FIXTODOUBLE(nFix)+0.5))
+
+#if defined WIN
+#define TWAIN_LIBNAME "TWAIN.DLL"
+#define TWAIN_FUNCNAME "DSM_Entry"
+#elif defined WNT
+#define TWAIN_LIBNAME "TWAIN_32.DLL"
+#define TWAIN_FUNCNAME "DSM_Entry"
+#elif defined OS2
+#define TWAIN_LIBNAME "twain"
+#define TWAIN_FUNCNAME "DSM_ENTRY"
+#endif
+
+// -----------
+// - Statics -
+// -----------
+
+static ImpTwain* pImpTwainInstance = NULL;
+
+// ---------
+// - Procs -
+// ---------
+
+#ifdef OS2
+
+ #define PTWAINMSG QMSG*
+
+ MRESULT EXPENTRY TwainWndProc( HWND hWnd, ULONG nMsg, MPARAM nParam1, MPARAM nParam2 )
+ {
+ return (MRESULT) TRUE;
+ }
+
+
+#else // OS2
+
+ #define PTWAINMSG MSG*
+
+ // -------------------------------------------------------------------------
+
+ LRESULT CALLBACK TwainWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 )
+ {
+ return DefWindowProc( hWnd, nMsg, nPar1, nPar2 );
+ }
+
+ // -------------------------------------------------------------------------
+
+ LRESULT CALLBACK TwainMsgProc( int nCode, WPARAM wParam, LPARAM lParam )
+ {
+ MSG* pMsg = (MSG*) lParam;
+
+ if( ( nCode < 0 ) ||
+ ( pImpTwainInstance->hTwainWnd != pMsg->hwnd ) ||
+ !pImpTwainInstance->ImplHandleMsg( (void*) lParam ) )
+ {
+ return CallNextHookEx( pImpTwainInstance->hTwainHook, nCode, wParam, lParam );
+ }
+ else
+ {
+ pMsg->message = WM_USER;
+ pMsg->lParam = 0;
+
+ return 0;
+ }
+ }
+
+#endif // OS2
+
+// ------------
+// - ImpTwain -
+// ------------
+
+ImpTwain::ImpTwain( const Link& rNotifyLink ) :
+ aNotifyLink ( rNotifyLink ),
+ pDSM ( NULL ),
+ pMod ( NULL ),
+ hTwainWnd ( 0 ),
+ hTwainHook ( 0 ),
+ nCurState ( 1 )
+{
+ pImpTwainInstance = this;
+
+ aAppIdent.Id = 0;
+ aAppIdent.Version.MajorNum = 1;
+ aAppIdent.Version.MinorNum = 0;
+ aAppIdent.Version.Language = TWLG_USA;
+ aAppIdent.Version.Country = TWCY_USA;
+ aAppIdent.ProtocolMajor = TWON_PROTOCOLMAJOR;
+ aAppIdent.ProtocolMinor = TWON_PROTOCOLMINOR;
+ aAppIdent.SupportedGroups = DG_IMAGE | DG_CONTROL;
+ strcpy( aAppIdent.Version.Info, "StarOffice" );
+ strcpy( aAppIdent.Manufacturer, "Sun Microsystems");
+ strcpy( aAppIdent.ProductFamily,"Office");
+ strcpy( aAppIdent.ProductName, "StarOffice");
+
+#ifdef OS2
+
+ hAB = Sysdepen::GethAB();
+ ImplFallback( TWAIN_EVENT_QUIT );
+ // hTwainWnd = WinCreateWindow( HWND_DESKTOP, WC_FRAME, "dummy", 0, 0, 0, 0, 0, HWND_DESKTOP, HWND_BOTTOM, 0, 0, 0 );
+
+#else
+
+ HWND hParentWnd = HWND_DESKTOP;
+ WNDCLASS aWc = { 0, &TwainWndProc, 0, sizeof( WNDCLASS ), GetModuleHandle( NULL ),
+ NULL, NULL, NULL, NULL, "TwainClass" };
+
+ RegisterClass( &aWc );
+ hTwainWnd = CreateWindowEx( WS_EX_TOPMOST, aWc.lpszClassName, "TWAIN", 0, 0, 0, 0, 0, hParentWnd, NULL, aWc.hInstance, 0 );
+ hTwainHook = SetWindowsHookEx( WH_GETMESSAGE, &TwainMsgProc, NULL, GetCurrentThreadId() );
+
+#endif
+}
+
+// -----------------------------------------------------------------------------
+
+ImpTwain::~ImpTwain()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void ImpTwain::Destroy()
+{
+ ImplFallback( TWAIN_EVENT_NONE );
+ Application::PostUserEvent( LINK( this, ImpTwain, ImplDestroyHdl ), NULL );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImpTwain::SelectSource()
+{
+ TW_UINT16 nRet = TWRC_FAILURE;
+
+ if( !!aBitmap )
+ aBitmap = Bitmap();
+
+ ImplOpenSourceManager();
+
+ if( 3 == nCurState )
+ {
+ TW_IDENTITY aIdent;
+
+ aIdent.Id = 0, aIdent.ProductName[ 0 ] = '\0';
+ aNotifyLink.Call( (void*) TWAIN_EVENT_SCANNING );
+ nRet = PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_USERSELECT, &aIdent );
+ }
+
+ ImplFallback( TWAIN_EVENT_QUIT );
+
+ return( nRet == TWRC_SUCCESS || nRet == TWRC_CANCEL );
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImpTwain::InitXfer()
+{
+ BOOL bRet = FALSE;
+
+ if( !!aBitmap )
+ aBitmap = Bitmap();
+
+ ImplOpenSourceManager();
+
+ if( 3 == nCurState )
+ {
+ ImplOpenSource();
+
+ if( 4 == nCurState )
+ bRet = ImplEnableSource();
+ }
+
+ if( !bRet )
+ ImplFallback( TWAIN_EVENT_QUIT );
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Bitmap ImpTwain::GetXferBitmap()
+{
+ Bitmap aRet( aBitmap );
+ aBitmap = Bitmap();
+ return aRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void ImpTwain::ImplOpenSourceManager()
+{
+ if( 1 == nCurState )
+ {
+ pMod = new NAMESPACE_VOS( OModule )();
+
+ if( pMod->load( TWAIN_LIBNAME ) )
+ {
+ nCurState = 2;
+
+ if( ( ( pDSM = (DSMENTRYPROC) pMod->getSymbol( TWAIN_FUNCNAME ) ) != NULL ) &&
+ ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_PARENT, MSG_OPENDSM, &hTwainWnd ) == TWRC_SUCCESS ) )
+ {
+ nCurState = 3;
+ }
+ }
+ else
+ {
+ delete pMod;
+ pMod = NULL;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void ImpTwain::ImplOpenSource()
+{
+ if( 3 == nCurState )
+ {
+ if( ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_GETDEFAULT, &aSrcIdent ) == TWRC_SUCCESS ) &&
+ ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_OPENDS, &aSrcIdent ) == TWRC_SUCCESS ) )
+ {
+#ifdef OS2
+
+ // negotiate capabilities
+
+#else
+
+ TW_CAPABILITY aCap = { CAP_XFERCOUNT, TWON_ONEVALUE, GlobalAlloc( GHND, sizeof( TW_ONEVALUE ) ) };
+ TW_ONEVALUE* pVal = (TW_ONEVALUE*) GlobalLock( aCap.hContainer );
+
+ pVal->ItemType = TWTY_INT16, pVal->Item = 1;
+ GlobalUnlock( aCap.hContainer );
+ PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_CAPABILITY, MSG_SET, &aCap );
+ GlobalFree( aCap.hContainer );
+#endif
+
+ nCurState = 4;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImpTwain::ImplEnableSource()
+{
+ BOOL bRet = FALSE;
+
+ if( 4 == nCurState )
+ {
+ TW_USERINTERFACE aUI = { TRUE, TRUE, hTwainWnd };
+
+ aNotifyLink.Call( (void*) TWAIN_EVENT_SCANNING );
+ nCurState = 5;
+
+ if( PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_USERINTERFACE, MSG_ENABLEDS, &aUI ) == TWRC_SUCCESS )
+ bRet = TRUE;
+ else
+ nCurState = 4;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL ImpTwain::ImplHandleMsg( void* pMsg )
+{
+ TW_UINT16 nRet;
+ PTWAINMSG pMess = (PTWAINMSG) pMsg;
+ TW_EVENT aEvt = { pMess, MSG_NULL };
+
+ nRet = PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_EVENT, MSG_PROCESSEVENT, &aEvt );
+
+ if( aEvt.TWMessage != MSG_NULL )
+ {
+ switch( aEvt.TWMessage )
+ {
+ case MSG_XFERREADY:
+ {
+ ULONG nEvent = TWAIN_EVENT_QUIT;
+
+ if( 5 == nCurState )
+ {
+ nCurState = 6;
+ ImplXfer();
+
+ if( !!aBitmap )
+ nEvent = TWAIN_EVENT_XFER;
+ }
+
+ ImplFallback( nEvent );
+ }
+ break;
+
+ case MSG_CLOSEDSREQ:
+ ImplFallback( TWAIN_EVENT_QUIT );
+ break;
+
+ default:
+ break;
+ }
+ }
+ else
+ nRet = TWRC_NOTDSEVENT;
+
+ return( TWRC_DSEVENT == nRet );
+}
+
+// -----------------------------------------------------------------------------
+
+void ImpTwain::ImplXfer()
+{
+ if( nCurState == 6 )
+ {
+ TW_IMAGEINFO aInfo;
+ TW_UINT32 hDIB = 0;
+ long nWidth = aInfo.ImageWidth;
+ long nHeight = aInfo.ImageLength;
+ long nXRes = FIXTOLONG( aInfo.XResolution );
+ long nYRes = FIXTOLONG( aInfo.YResolution );
+
+ if( PFUNC( &aAppIdent, &aSrcIdent, DG_IMAGE, DAT_IMAGEINFO, MSG_GET, &aInfo ) == TWRC_SUCCESS )
+ {
+ nWidth = aInfo.ImageWidth;
+ nHeight = aInfo.ImageLength;
+ nXRes = FIXTOLONG( aInfo.XResolution );
+ nYRes = FIXTOLONG( aInfo.YResolution );
+ }
+ else
+ nWidth = nHeight = nXRes = nYRes = -1L;
+
+ switch( PFUNC( &aAppIdent, &aSrcIdent, DG_IMAGE, DAT_IMAGENATIVEXFER, MSG_GET, &hDIB ) )
+ {
+ case( TWRC_CANCEL ):
+ nCurState = 7;
+ break;
+
+ case( TWRC_XFERDONE ):
+ {
+#ifdef OS2
+
+ // get OS/2-Bitmap
+
+#else // OS2
+ const ULONG nSize = GlobalSize( (HGLOBAL) hDIB );
+ char* pBuf = (char*) GlobalLock( (HGLOBAL) hDIB );
+
+ if( pBuf )
+ {
+ SvMemoryStream aMemStm;
+ aMemStm.SetBuffer( pBuf, nSize, FALSE, nSize );
+ aBitmap.Read( aMemStm, FALSE );
+ GlobalUnlock( (HGLOBAL) hDIB );
+ }
+
+ GlobalFree( (HGLOBAL) hDIB );
+#endif // OS2
+
+ // set resolution of bitmap if neccessary
+ if ( ( nXRes != -1 ) && ( nYRes != - 1 ) && ( nWidth != - 1 ) && ( nHeight != - 1 ) )
+ {
+ const MapMode aMapMode( MAP_100TH_INCH, Point(), Fraction( 100, nXRes ), Fraction( 100, nYRes ) );
+ aBitmap.SetPrefMapMode( aMapMode );
+ aBitmap.SetPrefSize( Size( nWidth, nHeight ) );
+ }
+
+ nCurState = 7;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void ImpTwain::ImplFallback( ULONG nEvent )
+{
+ Application::PostUserEvent( LINK( this, ImpTwain, ImplFallbackHdl ), (void*) nEvent );
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( ImpTwain, ImplFallbackHdl, void*, pData )
+{
+ const ULONG nEvent = (ULONG) pData;
+ BOOL bFallback = TRUE;
+
+ switch( nCurState )
+ {
+ case( 7 ):
+ case( 6 ):
+ {
+ TW_PENDINGXFERS aXfers;
+
+ if( PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_PENDINGXFERS, MSG_ENDXFER, &aXfers ) == TWRC_SUCCESS )
+ {
+ if( aXfers.Count != 0 )
+ PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_PENDINGXFERS, MSG_RESET, &aXfers );
+ }
+
+ nCurState = 5;
+ }
+ break;
+
+ case( 5 ):
+ {
+ TW_USERINTERFACE aUI = { TRUE, TRUE, hTwainWnd };
+
+ PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_USERINTERFACE, MSG_DISABLEDS, &aUI );
+ nCurState = 4;
+ }
+ break;
+
+ case( 4 ):
+ {
+ PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_CLOSEDS, &aSrcIdent );
+ nCurState = 3;
+ }
+ break;
+
+ case( 3 ):
+ {
+ PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_PARENT, MSG_CLOSEDSM, &hTwainWnd );
+ nCurState = 2;
+ }
+ break;
+
+ case( 2 ):
+ {
+ delete pMod;
+ pMod = NULL;
+ nCurState = 1;
+ }
+ break;
+
+ default:
+ {
+ if( nEvent != TWAIN_EVENT_NONE )
+ aNotifyLink.Call( (void*) nEvent );
+
+ bFallback = FALSE;
+ }
+ break;
+ }
+
+ if( bFallback )
+ ImplFallback( nEvent );
+
+ return 0L;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( ImpTwain, ImplDestroyHdl, void*, p )
+{
+#ifdef OS2
+
+ if( hWndTwain )
+ WinDestroyWindow( hWndTwain );
+
+ // unset hook
+
+#else
+
+ if( hTwainWnd )
+ DestroyWindow( hTwainWnd );
+
+ if( hTwainHook )
+ UnhookWindowsHookEx( hTwainHook );
+
+#endif
+
+ delete this;
+ pImpTwainInstance = NULL;
+
+ return 0L;
+}
diff --git a/extensions/source/scanner/twain.hxx b/extensions/source/scanner/twain.hxx
new file mode 100644
index 000000000..da486a042
--- /dev/null
+++ b/extensions/source/scanner/twain.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * $RCSfile: twain.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TWAIN_HXX
+#define _TWAIN_HXX
+
+#include <vos/module.hxx>
+#include <vcl/bitmap.hxx>
+#include "twain/twain.h"
+
+
+// -----------
+// - Defines -
+// -----------
+
+#define TWAIN_SELECT 0x00000001UL
+#define TWAIN_ACQUIRE 0x00000002UL
+#define TWAIN_TERMINATE 0xFFFFFFFFUL
+
+#define TWAIN_EVENT_NONE 0x00000000UL
+#define TWAIN_EVENT_QUIT 0x00000001UL
+#define TWAIN_EVENT_SCANNING 0x00000002UL
+#define TWAIN_EVENT_XFER 0x00000004UL
+
+// ------------
+// - ImpTwain -
+// ------------
+
+class ImpTwain
+{
+ TW_IDENTITY aAppIdent;
+ TW_IDENTITY aSrcIdent;
+ Link aNotifyLink;
+ Bitmap aBitmap;
+ DSMENTRYPROC pDSM;
+ NAMESPACE_VOS( OModule )* pMod;
+ ULONG nCurState;
+
+ void ImplCreate();
+ void ImplOpenSourceManager();
+ void ImplOpenSource();
+ BOOL ImplEnableSource();
+ void ImplXfer();
+ void ImplFallback( ULONG nEvent );
+
+ DECL_LINK( ImplFallbackHdl, void* );
+ DECL_LINK( ImplDestroyHdl, void* );
+
+public:
+
+ BOOL ImplHandleMsg( void* pMsg );
+
+#ifdef OS2
+ HAB hAB;
+ HWND hTwainWnd;
+ long hTwainHook;
+#else
+ HWND hTwainWnd;
+ HHOOK hTwainHook;
+#endif
+
+public:
+
+ ImpTwain( const Link& rNotifyLink );
+ ~ImpTwain();
+
+ void Destroy();
+
+ BOOL SelectSource();
+ BOOL InitXfer();
+ Bitmap GetXferBitmap();
+};
+
+#endif // _TWAIN_HXX
diff --git a/extensions/source/svg/makefile.mk b/extensions/source/svg/makefile.mk
new file mode 100644
index 000000000..9ea4ee0bd
--- /dev/null
+++ b/extensions/source/svg/makefile.mk
@@ -0,0 +1,134 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:53 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=extensions
+TARGET=svg
+
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Types -------------------------------------
+
+UNOTYPES=\
+ com.sun.star.uno.RuntimeException \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.uno.XInterface \
+ com.sun.star.uno.XWeak \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.io.XInputStream \
+ com.sun.star.io.XOutputStream \
+ com.sun.star.lang.XComponent \
+ com.sun.star.lang.XInitialization \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.loader.XImplementationLoader \
+ com.sun.star.registry.XImplementationRegistration \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.registry.XSimpleRegistry \
+ com.sun.star.xml.sax.XDocumentHandler \
+ com.sun.star.xml.sax.XExtendedDocumentHandler \
+ com.sun.star.svg.XSVGPrinter \
+ com.sun.star.svg.XSVGWriter
+
+# --- Files -------------------------------------
+
+CXXFILES= svgprinter.cxx \
+ svguno.cxx \
+ svgaction.cxx \
+ svgwriter.cxx
+
+SLOFILES= $(SLO)$/svgprinter.obj \
+ $(SLO)$/svguno.obj \
+ $(SLO)$/svgwriter.obj \
+ $(SLO)$/svgaction.obj
+
+# --- Library -----------------------------------
+
+SHL1TARGET=$(TARGET)$(UPD)$(DLLPOSTFIX)
+SHL1STDLIBS=\
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(VCLLIB) \
+ $(SVLLIB) \
+ $(ONELIB) \
+ $(TOOLSLIB) \
+ $(XMLOFFLIB)
+
+SHL1DEPN=
+SHL1IMPLIB= i$(SHL1TARGET)
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
diff --git a/extensions/source/svg/svgaction.cxx b/extensions/source/svg/svgaction.cxx
new file mode 100644
index 000000000..08752bd84
--- /dev/null
+++ b/extensions/source/svg/svgaction.cxx
@@ -0,0 +1,1412 @@
+/*************************************************************************
+ *
+ * $RCSfile: svgaction.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "svgaction.hxx"
+#include <vcl/virdev.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <vcl/metric.hxx>
+
+// -----------
+// - Defines -
+// -----------
+
+// #define _SVG_WRITE_TSPAN
+// #define _SVG_WRITE_STRIKEOUT
+
+// -----------
+// - statics -
+// -----------
+
+static const char aXMLElemSVG[] = "svg";
+static const char aXMLElemG[] = "g";
+static const char aXMLElemDefs[] = "defs";
+static const char aXMLElemClipPath[] = "clipPath";
+static const char aXMLElemLine[] = "line";
+static const char aXMLElemRect[] = "rect";
+static const char aXMLElemEllipse[] = "ellipse";
+static const char aXMLElemPath[] = "path";
+static const char aXMLElemPolygon[] = "polygon";
+static const char aXMLElemPolyLine[] = "polyline";
+static const char aXMLElemText[] = "text";
+static const char aXMLElemTSpan[] = "tspan";
+static const char aXMLElemImage[] = "image";
+
+static const char aXMLAttrTransform[] = "transform";
+static const char aXMLAttrStyle[] = "style";
+static const char aXMLAttrId[] = "id";
+
+static const char aXMLAttrD[] = "d";
+static const char aXMLAttrX[] = "x";
+static const char aXMLAttrY[] = "y";
+static const char aXMLAttrX1[] = "x1";
+static const char aXMLAttrY1[] = "y1";
+static const char aXMLAttrX2[] = "x2";
+static const char aXMLAttrY2[] = "y2";
+static const char aXMLAttrCX[] = "cx";
+static const char aXMLAttrCY[] = "cy";
+static const char aXMLAttrRX[] = "rx";
+static const char aXMLAttrRY[] = "ry";
+static const char aXMLAttrWidth[] = "width";
+static const char aXMLAttrHeight[] = "height";
+static const char aXMLAttrPoints[] = "points";
+static const char aXMLAttrXLinkHRef[] = "xlink:href";
+
+static const sal_Unicode pBase64[] =
+{
+ //0 1 2 3 4 5 6 7
+ 'A','B','C','D','E','F','G','H', // 0
+ 'I','J','K','L','M','N','O','P', // 1
+ 'Q','R','S','T','U','V','W','X', // 2
+ 'Y','Z','a','b','c','d','e','f', // 3
+ 'g','h','i','j','k','l','m','n', // 4
+ 'o','p','q','r','s','t','u','v', // 5
+ 'w','x','y','z','0','1','2','3', // 6
+ '4','5','6','7','8','9','+','/' // 7
+};
+
+// --------------
+// - FastString -
+// --------------
+
+FastString::FastString( sal_uInt32 nInitLen, sal_uInt32 nIncrement ) :
+ mnBufLen( nInitLen ),
+ mnCurLen( 0 ),
+ mnBufInc( nIncrement ),
+ mpBuffer( new sal_Unicode[ nInitLen * sizeof( sal_Unicode ) ] ),
+ mnPartPos( 0 )
+{
+ DBG_ASSERT( nInitLen, "invalid initial length" );
+ DBG_ASSERT( nIncrement, "invalid increment" );
+}
+
+// -----------------------------------------------------------------------------
+
+FastString::FastString( sal_Char* pBufferForBase64Encoding, sal_uInt32 nBufLen ) :
+ mnBufInc( 2048 ),
+ mnPartPos( 0 )
+{
+ DBG_ASSERT( pBufferForBase64Encoding && nBufLen, "invalid arguments" );
+
+ const sal_uInt32 nQuadCount = nBufLen / 3;
+ const sal_uInt32 nRest = nBufLen % 3;
+
+ if( nQuadCount || nRest )
+ {
+ mnBufLen = mnCurLen = ( ( nQuadCount + ( nRest ? 1 : 0 ) ) << 2 );
+ mpBuffer = new sal_Unicode[ mnBufLen * sizeof( sal_Unicode ) ];
+
+ sal_Char* pTmpSrc = pBufferForBase64Encoding;
+ sal_Unicode* pTmpDst = mpBuffer;
+
+ for( sal_uInt32 i = 0, nCharCount = 0; i < nQuadCount; i++ )
+ {
+ const sal_Int32 nA = *pTmpSrc++;
+ const sal_Int32 nB = *pTmpSrc++;
+ const sal_Int32 nC = *pTmpSrc++;
+
+ *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
+ *pTmpDst++ = pBase64[ ( ( nA << 4 ) & 0x30 ) + ( ( nB >> 4 ) & 0xf ) ];
+ *pTmpDst++ = pBase64[ ( ( nB << 2 ) & 0x3c ) + ( ( nC >> 6 ) & 0x3 ) ];
+ *pTmpDst++ = pBase64[ nC & 0x3f ];
+ }
+
+ if( 1 == nRest )
+ {
+ const sal_Int32 nA = *pTmpSrc;
+
+ *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
+ *pTmpDst++ = pBase64[ ( nA << 4 ) & 0x30 ];
+ *pTmpDst++ = '=';
+ *pTmpDst = '=';
+ }
+ else if( 2 == nRest )
+ {
+ const sal_Int32 nA = *pTmpSrc++;
+ const sal_Int32 nB = *pTmpSrc;
+
+ *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
+ *pTmpDst++ = pBase64[ ( ( nA << 4 ) & 0x30 ) + ( ( nB >> 4 ) & 0xf ) ];
+ *pTmpDst++ = pBase64[ ( nB << 2 ) & 0x3c ];
+ *pTmpDst = '=';
+ }
+ }
+ else
+ {
+ mpBuffer = new sal_Unicode[ ( mnBufLen = 1 ) * sizeof( sal_Unicode ) ];
+ mnCurLen = 0;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+FastString::~FastString()
+{
+ delete[] mpBuffer;
+}
+
+// -----------------------------------------------------------------------------
+
+FastString& FastString::operator+=( const NMSP_RTL::OUString& rStr )
+{
+ if( rStr.getLength() )
+ {
+ if( ( mnCurLen + rStr.getLength() ) > mnBufLen )
+ {
+ const sal_uInt32 nNewBufLen = ( mnBufLen + ( ( ( mnCurLen + rStr.getLength() ) - mnBufLen ) / mnBufInc + 1 ) * mnBufInc );
+ sal_Unicode* pNewBuffer = new sal_Unicode[ nNewBufLen * sizeof( sal_Unicode ) ];
+
+ HMEMCPY( pNewBuffer, mpBuffer, mnBufLen * sizeof( sal_Unicode ) );
+ delete[] mpBuffer;
+ mpBuffer = pNewBuffer;
+ mnBufLen = nNewBufLen;
+ }
+
+ HMEMCPY( mpBuffer + mnCurLen, rStr.getStr(), rStr.getLength() * sizeof( sal_Unicode ) );
+ mnCurLen += rStr.getLength();
+
+ if( maString.getLength() )
+ maString = NMSP_RTL::OUString();
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------------
+
+const NMSP_RTL::OUString& FastString::GetString() const
+{
+ if( !maString.getLength() && mnCurLen )
+ ( (FastString*) this )->maString = NMSP_RTL::OUString( mpBuffer, mnCurLen );
+
+ return maString;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool FastString::GetFirstPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString )
+{
+ const sal_uInt32 nLength = Min( mnCurLen, nPartLen );
+
+ mnPartPos = 0;
+
+ if( nLength )
+ {
+ rPartString = NMSP_RTL::OUString( mpBuffer, nLength );
+ mnPartPos = nLength;
+ }
+
+ return( rPartString.getLength() > 0 );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool FastString::GetNextPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString )
+{
+ if( mnPartPos < mnCurLen )
+ {
+ const sal_uInt32 nLength = Min( mnCurLen - mnPartPos, nPartLen );
+ rPartString = NMSP_RTL::OUString( mpBuffer + mnPartPos, nLength );
+ mnPartPos += nLength;
+ }
+ else
+ rPartString = NMSP_RTL::OUString();
+
+ return( rPartString.getLength() > 0 );
+}
+
+// ----------------------
+// - SVGAttributeWriter -
+// ----------------------
+
+SVGAttributeWriter::SVGAttributeWriter( SVGActionWriter& rParent, SvXMLExport& rExport ) :
+ mrParent( rParent ),
+ mrExport( rExport ),
+ mpElemFont( NULL ),
+ mpElemPaint( NULL )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SVGAttributeWriter::~SVGAttributeWriter()
+{
+ delete mpElemPaint;
+ delete mpElemFont;
+}
+
+// -----------------------------------------------------------------------------
+
+NMSP_RTL::OUString SVGAttributeWriter::GetFontStyle( const Font& rFont )
+{
+ FastString aStyle;
+
+ // font family
+ aStyle += B2UCONST( "font-family:" );
+ aStyle += NMSP_RTL::OUString( UniString( rFont.GetName() ) );
+
+ // font size
+ const Size aFontSize( mrParent.GetVDev().LogicToLogic( Size( 0, rFont.GetHeight() ), mrParent.GetVDev().GetMapMode(), MAP_POINT ) );
+
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "font-size:" );
+ aStyle += NMSP_RTL::OUString::valueOf( aFontSize.Height() );
+
+ if( !mrParent.HasDoublePoints() )
+ aStyle += B2UCONST( "pt" );
+
+ // font style
+ if( rFont.GetItalic() != ITALIC_NONE )
+ {
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "font-style:" );
+
+ if( rFont.GetItalic() == ITALIC_OBLIQUE )
+ aStyle += B2UCONST( "oblique" );
+ else
+ aStyle += B2UCONST( "italic" );
+ }
+
+ // font weight
+ sal_Int32 nFontWeight;
+
+ switch( rFont.GetWeight() )
+ {
+ case WEIGHT_THIN: nFontWeight = 100; break;
+ case WEIGHT_ULTRALIGHT: nFontWeight = 200; break;
+ case WEIGHT_LIGHT: nFontWeight = 300; break;
+ case WEIGHT_SEMILIGHT: nFontWeight = 400; break;
+ case WEIGHT_NORMAL: nFontWeight = 400; break;
+ case WEIGHT_MEDIUM: nFontWeight = 500; break;
+ case WEIGHT_SEMIBOLD: nFontWeight = 600; break;
+ case WEIGHT_BOLD: nFontWeight = 700; break;
+ case WEIGHT_ULTRABOLD: nFontWeight = 800; break;
+ case WEIGHT_BLACK: nFontWeight = 900; break;
+ default: nFontWeight = 400; break;
+ }
+
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "font-weight:" );
+ aStyle += NMSP_RTL::OUString::valueOf( nFontWeight );
+
+ // !!!
+ // font-variant
+ // font-stretch
+ // font-size-adjust
+
+#ifdef _SVG_WRITE_STRIKEOUT
+
+ if( rFont.GetUnderline() != UNDERLINE_NONE || rFont.GetStrikeout() != STRIKEOUT_NONE )
+ {
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "text-decoration:" );
+
+ if( rFont.GetUnderline() != UNDERLINE_NONE )
+ aStyle += B2UCONST( " underline" );
+
+ if( rFont.GetStrikeout() != STRIKEOUT_NONE )
+ aStyle += B2UCONST( " line-trough" );
+ }
+
+#else // _SVG_WRITE_STRIKEOUT
+
+ if( rFont.GetUnderline() != UNDERLINE_NONE )
+ {
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "text-decoration:" );
+ aStyle += B2UCONST( "underline" );
+ }
+
+#endif // _SVG_WRITE_STRIKEOUT
+
+ return aStyle.GetString();
+}
+
+// -----------------------------------------------------------------------------
+
+NMSP_RTL::OUString SVGAttributeWriter::GetPaintStyle( const Color& rLineColor, const Color& rFillColor )
+{
+ FastString aStyle;
+
+ // line color
+ aStyle += B2UCONST( "stroke:" );
+
+ if( rLineColor.GetTransparency() == 255 )
+ aStyle += B2UCONST( "none" );
+ else
+ {
+ // line color value in rgb
+ aStyle += B2UCONST( "rgb(" );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetRed() );
+ aStyle += B2UCONST( "," );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetGreen() );
+ aStyle += B2UCONST( "," );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetBlue() );
+ aStyle += B2UCONST( ")" );
+
+ // line color opacity in percent if neccessary
+ if( rLineColor.GetTransparency() )
+ {
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "stroke-opacity:" );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) ( ( 255 - (double) rLineColor.GetTransparency() ) / 2.55 ) );
+ aStyle += B2UCONST( "%" );
+ }
+ }
+
+ // fill color
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "fill:" );
+
+ if( rFillColor.GetTransparency() == 255 )
+ aStyle += B2UCONST( "none" );
+ else
+ {
+ // fill color value in rgb
+ aStyle += B2UCONST( "rgb(" );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetRed() );
+ aStyle += B2UCONST( "," );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetGreen() );
+ aStyle += B2UCONST( "," );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetBlue() );
+ aStyle += B2UCONST( ")" );
+
+ // fill color opacity in percent if neccessary
+ if( rFillColor.GetTransparency() )
+ {
+ aStyle += B2UCONST( ";" );
+ aStyle += B2UCONST( "fill-opacity:" );
+ aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) ( ( 255 - (double) rFillColor.GetTransparency() ) / 2.55 ) );
+ aStyle += B2UCONST( "%" );
+ }
+ }
+
+ return aStyle.GetString();
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGAttributeWriter::SetFontAttr( const Font& rFont )
+{
+ if( !mpElemFont || ( rFont != maCurFont ) )
+ {
+ delete mpElemPaint, mpElemPaint = NULL;
+ delete mpElemFont;
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, GetFontStyle( maCurFont = rFont ) );
+ mpElemFont = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGAttributeWriter::SetPaintAttr( const Color& rLineColor, const Color& rFillColor )
+{
+ if( !mpElemPaint || ( rLineColor != maCurLineColor ) || ( rFillColor != maCurFillColor ) )
+ {
+ delete mpElemPaint;
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, GetPaintStyle( maCurLineColor = rLineColor, maCurFillColor = rFillColor ) );
+ mpElemPaint = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE );
+ }
+}
+
+// -------------------
+// - SVGActionWriter -
+// -------------------
+
+SVGActionWriter::SVGActionWriter( SvXMLExport& rExport, const GDIMetaFile& rMtf,
+ VirtualDevice* pParentVDev, sal_Bool bWriteDoublePoints ) :
+ mrExport( rExport ),
+ mrMtf( rMtf ),
+ mpContext( NULL ),
+ mbClipAttrChanged( sal_False ),
+ mnCurClipId( 1 ),
+ mbDoublePoints( bWriteDoublePoints )
+{
+ if( pParentVDev )
+ {
+ mpVDev = pParentVDev;
+ mbDestroyVDev = sal_False;
+ maTargetMapMode = mpVDev->GetMapMode();
+ }
+ else
+ {
+ mpVDev = new VirtualDevice;
+ mpVDev->EnableOutput( sal_False );
+ mbDestroyVDev = sal_True;
+ maTargetMapMode = MAP_100TH_MM;
+ }
+
+ mpVDev->Push();
+ mpVDev->SetMapMode( mrMtf.GetPrefMapMode() );
+ ImplWriteActions( mrMtf );
+ mpVDev->Pop();
+}
+
+// -----------------------------------------------------------------------------
+
+SVGActionWriter::~SVGActionWriter()
+{
+ DBG_ASSERT( !mpContext, "Not all contexts are closed" );
+
+ if( mbDestroyVDev )
+ delete mpVDev;
+}
+
+// -----------------------------------------------------------------------------
+
+long SVGActionWriter::ImplMap( sal_Int32 nVal ) const
+{
+ return ImplMap( Size( nVal, nVal ) ).Width();
+}
+
+// -----------------------------------------------------------------------------
+
+Point SVGActionWriter::ImplMap( const Point& rPt ) const
+{
+ return mpVDev->LogicToLogic( rPt, mpVDev->GetMapMode(), maTargetMapMode );
+}
+
+// -----------------------------------------------------------------------------
+
+Size SVGActionWriter::ImplMap( const Size& rSz ) const
+{
+ return mpVDev->LogicToLogic( rSz, mpVDev->GetMapMode(), maTargetMapMode );
+}
+
+// -----------------------------------------------------------------------------
+
+NMSP_RTL::OUString SVGActionWriter::GetValueString( sal_Int32 nVal, sal_Bool bDoublePoints )
+{
+ if( !bDoublePoints )
+ return NMSP_RTL::OUString::valueOf( nVal );
+ else
+ {
+ const double fPoints = nVal * 72.0 / 2540.0;
+ const sal_Int32 nInt = (sal_Int32) fPoints;
+
+ return( ( NMSP_RTL::OUString::valueOf( nInt ) +=
+ NMSP_RTL::OUString::valueOf( (sal_Unicode) '.' ) ) +=
+ NMSP_RTL::OUString::valueOf( labs( (sal_Int32) ( ( fPoints - nInt ) * 100.0 ) ) ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor,
+ const NMSP_RTL::OUString* pStyle )
+{
+ const Point aPt1( ImplMap( rPt1 ) );
+ const Point aPt2( ImplMap( rPt2 ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX1, GetValueString( aPt1.X(), mbDoublePoints ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY1, GetValueString( aPt1.Y(), mbDoublePoints ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX2, GetValueString( aPt2.X(), mbDoublePoints ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY2, GetValueString( aPt2.Y(), mbDoublePoints ) );
+
+ // add additional style if requested
+ if( pStyle )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
+
+ if( pLineColor )
+ {
+ // !!! mrExport.AddAttribute( XML_NAMESPACE_NONE, ... )
+ DBG_ERROR( "SVGActionWriter::ImplWriteLine: Line color not implemented" );
+ }
+
+ {
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemLine, TRUE, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteRect( const Rectangle& rRect, long nRadX, long nRadY,
+ const NMSP_RTL::OUString* pStyle )
+{
+ const Rectangle aRect( ImplMap( rRect ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aRect.Left(), mbDoublePoints ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aRect.Top(), mbDoublePoints ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, GetValueString( aRect.GetWidth(), mbDoublePoints ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, GetValueString( aRect.GetHeight(), mbDoublePoints ) );
+
+ if( nRadX )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRX, GetValueString( ImplMap( nRadX ), mbDoublePoints ) );
+
+ if( nRadY )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRY, GetValueString( ImplMap( nRadY ), mbDoublePoints ) );
+
+ // add additional style if requested
+ if( pStyle )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
+
+ {
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemRect, TRUE, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteEllipse( const Point& rCenter, long nRadX, long nRadY,
+ const NMSP_RTL::OUString* pStyle )
+{
+ const Point aCenter( ImplMap( rCenter ) );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCX, GetValueString( aCenter.X(), mbDoublePoints ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCY, GetValueString( aCenter.Y(), mbDoublePoints ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRX, GetValueString( ImplMap( nRadX ), mbDoublePoints ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRY, GetValueString( ImplMap( nRadY ), mbDoublePoints ) );
+
+ // add additional style if requested
+ if( pStyle )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
+
+ {
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemEllipse, TRUE, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWritePolygon( const Polygon& rPoly, sal_Bool bLineOnly,
+ const NMSP_RTL::OUString* pStyle )
+{
+ if( rPoly.GetSize() )
+ {
+ FastString aStyle;
+ FastString aPoints;
+ USHORT i = 0, nSize = rPoly.GetSize();
+ const NMSP_RTL::OUString aBlank( B2UCONST( " " ) );
+
+ // points
+ while( i < nSize )
+ {
+ const Point aPolyPoint( ImplMap( rPoly[ i ] ) );
+
+ aPoints += GetValueString( aPolyPoint.X(), mbDoublePoints );
+ aPoints += B2UCONST( "," );
+ aPoints += GetValueString( aPolyPoint.Y(), mbDoublePoints );
+
+ if( ++i < nSize )
+ aPoints += aBlank;
+ }
+
+ // style
+ if( bLineOnly )
+ {
+ aStyle += B2UCONST( "fill:none" );
+
+ if( pStyle )
+ {
+ aStyle += B2UCONST( ";" );
+ aStyle += *pStyle;
+ }
+ }
+ else if( pStyle )
+ aStyle += *pStyle;
+
+ // add point attribute
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrPoints, aPoints.GetString() );
+
+ // add style attribute
+ if( aStyle.GetLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aStyle.GetString() );
+
+ {
+ // write polyline/polygon element
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, bLineOnly ? aXMLElemPolyLine : aXMLElemPolygon, TRUE, TRUE );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bLineOnly,
+ const NMSP_RTL::OUString* pStyle )
+{
+ if( rPolyPoly.Count() )
+ {
+ if( rPolyPoly.Count() == 1 )
+ ImplWritePolygon( rPolyPoly[ 0 ], bLineOnly, pStyle );
+ else if( bLineOnly )
+ {
+ for( long i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ )
+ ImplWritePolygon( rPolyPoly[ i ], sal_False, pStyle );
+ }
+ else
+ {
+ FastString aPathData;
+ const NMSP_RTL::OUString aBlank( B2UCONST( " " ) );
+ const NMSP_RTL::OUString aComma( B2UCONST( "," ) );
+ Point aPolyPoint;
+
+ for( long i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ )
+ {
+ const Polygon& rPoly = rPolyPoly[ i ];
+ USHORT n = 1, nSize = rPoly.GetSize();
+
+ if( nSize > 1 )
+ {
+ aPathData += B2UCONST( "M " );
+ aPathData += GetValueString( ( aPolyPoint = ImplMap( rPoly[ 0 ] ) ).X(), mbDoublePoints );
+ aPathData += aComma;
+ aPathData += GetValueString( aPolyPoint.Y(), mbDoublePoints );
+ aPathData += B2UCONST( " L " );
+
+ while( n < nSize )
+ {
+ aPathData += GetValueString( ( aPolyPoint = ImplMap( rPoly[ n ] ) ).X(), mbDoublePoints );
+ aPathData += aComma;
+ aPathData += GetValueString( aPolyPoint.Y(), mbDoublePoints );
+
+ if( ++n < nSize )
+ aPathData += aBlank;
+ }
+
+ aPathData += B2UCONST( " Z" );
+
+ if( i < ( nCount - 1 ) )
+ aPathData += aBlank;
+ }
+ }
+
+ // add style attribute
+ if( pStyle && pStyle->getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
+
+ // add path data attribute
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrD, aPathData.GetString() );
+
+ {
+ // write polyline/polygon element
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemPath, TRUE, TRUE );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient,
+ const NMSP_RTL::OUString* pStyle )
+{
+ if( rPolyPoly.Count() )
+ {
+ SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE );
+ FastString aClipId;
+ FastString aClipStyle;
+
+ aClipId += B2UCONST( "clip" );
+ aClipId += NMSP_RTL::OUString::valueOf( ImplGetNextClipId() );
+
+ {
+ SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, TRUE, TRUE );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aClipId.GetString() );
+
+ {
+ SvXMLElementExport aElemClipPath( mrExport, XML_NAMESPACE_NONE, aXMLElemClipPath, TRUE, TRUE );
+ ImplWritePolyPolygon( rPolyPoly, sal_False );
+ }
+ }
+
+ // create new context with clippath set
+ aClipStyle += B2UCONST( "clip-path:URL(#" );
+ aClipStyle += aClipId.GetString();
+ aClipStyle += B2UCONST( ")" );
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aClipStyle.GetString() );
+
+ {
+ GDIMetaFile aTmpMtf;
+ SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, TRUE, TRUE );
+
+ mpVDev->AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf );
+ ImplWriteActions( aTmpMtf, pStyle );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
+ const long* pDXArray, long nWidth,
+ const NMSP_RTL::OUString* pStyle )
+{
+ String aText( rText ); aText.EraseLeadingChars( ' ' );
+ UINT32 nLen = aText.Len(), i;
+
+ if( nLen )
+ {
+ Size aNormSize;
+ long* pOwnArray;
+ long* pDX;
+
+ // get text sizes
+ if( pDXArray )
+ {
+ pOwnArray = NULL;
+#ifdef _SVG_UNO3
+ aNormSize = Size( mpVDev->GetTextWidth( aText ), 0 );
+#else
+ aNormSize = mpVDev->GetTextSize( aText );
+#endif
+ pDX = (long*) pDXArray;
+ }
+ else
+ {
+ pOwnArray = new long[ nLen ];
+#ifdef _SVG_UNO3
+ aNormSize = Size( mpVDev->GetTextArray( aText, pOwnArray ), 0 );
+#else
+ aNormSize = mpVDev->GetTextArray( aText, pOwnArray );
+#endif
+ pDX = pOwnArray;
+ }
+
+ if( nLen > 1 )
+ {
+#ifdef _SVG_UNO3
+ aNormSize.Width() = pDX[ nLen - 2 ] + mpVDev->GetTextWidth( aText.GetChar( nLen - 1 ) );
+#else
+ aNormSize.Width() = pDX[ nLen - 2 ] + mpVDev->GetTextSize( aText[ (USHORT) ( nLen - 1 ) ] ).Width();
+#endif
+
+ if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) )
+ {
+ const double fFactor = (double) nWidth / aNormSize.Width();
+
+ for( i = 0; i < ( nLen - 1 ); i++ )
+ pDX[ i ] = FRound( pDX[ i ] * fFactor );
+ }
+ }
+
+ FastString aStyle;
+ const Font& rFont = mpVDev->GetFont();
+ const FontMetric aMetric( mpVDev->GetFontMetric() );
+ Point aBaseLinePos( rPos );
+
+ // leading whitespaces erased? => adjust position
+ if( nLen < rText.Len() )
+ {
+#ifdef _SVG_UNO3
+ aBaseLinePos.X() += mpVDev->GetTextWidth( ' ' ) * ( rText.Len() - nLen );
+#else
+ aBaseLinePos.X() += mpVDev->GetTextSize( ' ' ).Width() * ( rText.Len() - nLen );
+#endif
+ }
+
+ // always adjust text position to match baseline alignment
+ switch( rFont.GetAlign() )
+ {
+ case( ALIGN_TOP ):
+ aBaseLinePos.Y() += aMetric.GetAscent();
+ break;
+
+ case( ALIGN_BOTTOM ):
+ aBaseLinePos.Y() -= aMetric.GetDescent();
+ break;
+
+ default:
+ break;
+ }
+
+ // get mapped text position
+ const Point aPt( ImplMap( aBaseLinePos ) );
+
+ // add additional style if requested
+ if( pStyle && pStyle->getLength() )
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
+
+ // write text element
+#ifdef _SVG_WRITE_TSPAN
+ if( pDXArray )
+ {
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, TRUE, TRUE );
+ FastString aTSpanX;
+ const NMSP_RTL::OUString aSpace( ' ' );
+ long i, nX, nCount;
+
+ aTSpanX += GetValueString( aPt.X(), mbDoublePoints );
+ aTSpanX += aSpace;
+
+ for( i = 0, nX = aPt.X(), nCount = ( nLen - 1 ); i < nCount; )
+ {
+ aTSpanX += GetValueString( aPt.X() + pDX[ i++ ], mbDoublePoints );
+ aTSpanX += aSpace;
+ }
+
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, aTSpanX.GetString() );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y(), mbDoublePoints ) );
+
+ {
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTSpan, TRUE, TRUE );
+ mrExport.GetDocHandler()->characters( NMSP_RTL::OUString( UniString( aText ) ) );
+ }
+ }
+ else
+#endif // _SVG_WRITE_TSPAN
+ {
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aPt.X(), mbDoublePoints ) );
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y(), mbDoublePoints ) );
+
+ SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, TRUE, TRUE );
+ mrExport.GetDocHandler()->characters( NMSP_RTL::OUString( UniString( aText ) ) );
+ }
+#ifndef _SVG_WRITE_STRIKEOUT
+
+ // write strikeout if neccessary
+ if( rFont.GetStrikeout() )
+ {
+ const long nYStrikeoutPos = aBaseLinePos.Y() - FRound( aMetric.GetAscent() * 0.26 );
+ const long nStrikeoutHeight = Max( (long) FRound( aMetric.GetLineHeight() * 0.05 ), (long) 1 );
+ Polygon aPoly( 4 );
+
+ aPoly[ 0 ].X() = aBaseLinePos.X(); aPoly[ 0 ].Y() = nYStrikeoutPos - ( nStrikeoutHeight >> 1 );
+ aPoly[ 1 ].X() = aBaseLinePos.X() + aNormSize.Width() - 1; aPoly[ 1 ].Y() = aPoly[ 0 ].Y();
+ aPoly[ 2 ].X() = aPoly[ 1 ].X(); aPoly[ 2 ].Y() = aPoly[ 0 ].Y() + nStrikeoutHeight - 1;
+ aPoly[ 3 ].X() = aPoly[ 0 ].X(); aPoly[ 3 ].Y() = aPoly[ 2 ].Y();
+
+ ImplWritePolygon( aPoly, FALSE );
+ }
+
+#endif // _SVG_WRITE_STRIKEOUT
+
+ delete[] pOwnArray;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
+ const Point& rPt, const Size& rSz,
+ const Point& rSrcPt, const Size& rSrcSz,
+ const NMSP_RTL::OUString* pStyle )
+{
+ if( !!rBmpEx )
+ {
+ BitmapEx aBmpEx( rBmpEx );
+ Point aPoint = Point();
+ const Rectangle aBmpRect( aPoint, rBmpEx.GetSizePixel() );
+ const Rectangle aSrcRect( rSrcPt, rSrcSz );
+
+ if( aSrcRect != aBmpRect )
+ aBmpEx.Crop( aSrcRect );
+
+ if( !!aBmpEx )
+ {
+ SvMemoryStream aOStm( 65535, 65535 );
+
+ if( GraphicConverter::Export( aOStm, rBmpEx, CVT_PNG ) == ERRCODE_NONE )
+ {
+ const Point aPt( ImplMap( rPt ) );
+ const Size aSz( ImplMap( rSz ) );
+ FastString aImageData( (sal_Char*) aOStm.GetData(), aOStm.Tell() );
+#ifndef _SVG_UNO3
+ XExtendedDocumentHandlerRef xExtDocHandler( mrExport.GetDocHandler(), USR_QUERY );
+#else
+ REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( mrExport.GetDocHandler(), NMSP_UNO::UNO_QUERY );
+#endif
+
+ if( xExtDocHandler.is() )
+ {
+ static const sal_uInt32 nPartLen = 64;
+ const NMSP_RTL::OUString aSpace( ' ' );
+ const NMSP_RTL::OUString aLineFeed( NMSP_RTL::OUString::valueOf( (sal_Unicode) 0x0a ) );
+ NMSP_RTL::OUString aString;
+ NMSP_RTL::OUString aImageString;
+
+ aString = aLineFeed;
+ aString += B2UCONST( "<" );
+ aString += NMSP_RTL::OUString::createFromAscii( aXMLElemImage );
+ aString += aSpace;
+
+ aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrX );
+ aString += B2UCONST( "=\"" );
+ aString += GetValueString( aPt.X(), mbDoublePoints );
+ aString += B2UCONST( "\" " );
+
+ aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrY );
+ aString += B2UCONST( "=\"" );
+ aString += GetValueString( aPt.Y(), mbDoublePoints );
+ aString += B2UCONST( "\" " );
+
+ aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrWidth );
+ aString += B2UCONST( "=\"" );
+ aString += GetValueString( aSz.Width(), mbDoublePoints );
+ aString += B2UCONST( "\" " );
+
+ aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrHeight );
+ aString += B2UCONST( "=\"" );
+ aString += GetValueString( aSz.Height(), mbDoublePoints );
+ aString += B2UCONST( "\" " );
+
+ aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrXLinkHRef );
+ aString += B2UCONST( "=\"data:image/png;base64," );
+
+ if( aImageData.GetFirstPartString( nPartLen, aImageString ) )
+ {
+ xExtDocHandler->unknown( aString += aImageString );
+
+ while( aImageData.GetNextPartString( nPartLen, aImageString ) )
+ {
+ xExtDocHandler->unknown( aLineFeed );
+ xExtDocHandler->unknown( aImageString );
+ }
+ }
+
+ xExtDocHandler->unknown( B2UCONST( "\"/>" ) );
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, const NMSP_RTL::OUString* pStyle )
+{
+ ImplAcquireContext();
+
+ for( ULONG i = 0, nCount = rMtf.GetActionCount(); i < nCount; i++ )
+ {
+ const MetaAction* pAction = rMtf.GetAction( i );
+ const USHORT nType = pAction->GetType();
+
+ switch( nType )
+ {
+ case( META_PIXEL_ACTION ):
+ {
+ const MetaPixelAction* pA = (const MetaPixelAction*) pAction;
+
+ mpContext->SetPaintAttr( pA->GetColor(), pA->GetColor() );
+ ImplWriteLine( pA->GetPoint(), pA->GetPoint(), &pA->GetColor(), pStyle );
+ }
+ break;
+
+ case( META_POINT_ACTION ):
+ {
+ const MetaPointAction* pA = (const MetaPointAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor() );
+ ImplWriteLine( pA->GetPoint(), pA->GetPoint(), NULL, pStyle );
+ }
+ break;
+
+ case( META_LINE_ACTION ):
+ {
+ const MetaLineAction* pA = (const MetaLineAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor() );
+ ImplWriteLine( pA->GetStartPoint(), pA->GetEndPoint(), NULL, pStyle );
+ }
+ break;
+
+ case( META_RECT_ACTION ):
+ {
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteRect( ( (const MetaRectAction*) pAction )->GetRect(), 0, 0, pStyle );
+ }
+ break;
+
+ case( META_ROUNDRECT_ACTION ):
+ {
+ const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteRect( pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound(), pStyle );
+ }
+ break;
+
+ case( META_ELLIPSE_ACTION ):
+ {
+ const MetaEllipseAction* pA = (const MetaEllipseAction*) pAction;
+ const Rectangle& rRect = pA->GetRect();
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteEllipse( rRect.Center(), rRect.GetWidth() >> 1, rRect.GetHeight() >> 1, pStyle );
+ }
+ break;
+
+ case( META_ARC_ACTION ):
+ case( META_PIE_ACTION ):
+ case( META_CHORD_ACTION ):
+ case( META_POLYGON_ACTION ):
+ {
+ Polygon aPoly;
+
+ switch( nType )
+ {
+ case( META_ARC_ACTION ):
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pAction;
+ aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_ARC );
+ }
+ break;
+
+ case( META_PIE_ACTION ):
+ {
+ const MetaPieAction* pA = (const MetaPieAction*) pAction;
+ aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_PIE );
+ }
+ break;
+
+ case( META_CHORD_ACTION ):
+ {
+ const MetaChordAction* pA = (const MetaChordAction*) pAction;
+ aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_CHORD );
+ }
+ break;
+
+ case( META_POLYGON_ACTION ):
+ aPoly = ( (const MetaPolygonAction*) pAction )->GetPolygon();
+ break;
+ }
+
+ if( aPoly.GetSize() )
+ {
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWritePolygon( aPoly, sal_False, pStyle );
+ }
+ }
+ break;
+
+ case( META_POLYLINE_ACTION ):
+ {
+ const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction;
+ const Polygon& rPoly = pA->GetPolygon();
+
+ if( rPoly.GetSize() )
+ {
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWritePolygon( rPoly, sal_True, pStyle );
+ }
+ }
+ break;
+
+ case( META_POLYPOLYGON_ACTION ):
+ {
+ const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pAction;
+ const PolyPolygon& rPolyPoly = pA->GetPolyPolygon();
+
+ if( rPolyPoly.Count() )
+ {
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWritePolyPolygon( rPolyPoly, sal_False, pStyle );
+ }
+ }
+ break;
+
+ case( META_GRADIENT_ACTION ):
+ {
+ const MetaGradientAction* pA = (const MetaGradientAction*) pAction;
+ GDIMetaFile aTmpMtf;
+
+ mpVDev->AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
+ ImplWriteActions( aTmpMtf, pStyle );
+ }
+ break;
+
+ case( META_GRADIENTEX_ACTION ):
+ {
+ const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction;
+ ImplWriteGradientEx( pA->GetPolyPolygon(), pA->GetGradient(), pStyle );
+ }
+ break;
+
+ case META_HATCH_ACTION:
+ {
+ const MetaHatchAction* pA = (const MetaHatchAction*) pAction;
+ GDIMetaFile aTmpMtf;
+
+ mpVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
+ ImplWriteActions( aTmpMtf, pStyle );
+ }
+ break;
+
+ case( META_TRANSPARENT_ACTION ):
+ {
+ // !!!
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ DBG_ERROR( "META_TRANSPARENT_ACTION not supported" );
+ }
+ break;
+
+ case( META_FLOATTRANSPARENT_ACTION ):
+ {
+ // !!!
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ DBG_ERROR( "META_FLOATTRANSPARENT_ACTION not supported" );
+ }
+ break;
+
+ case( META_EPS_ACTION ):
+ {
+ const MetaEPSAction* pA = (const MetaEPSAction*) pAction;
+ const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() );
+ sal_Bool bFound = sal_False;
+
+ for( ULONG i = 0, nCount = aGDIMetaFile.GetActionCount(); ( i < nCount ) && !bFound; i++ )
+ {
+ const MetaAction* pSubstAct = aGDIMetaFile.GetAction( i );
+
+ if( pSubstAct->GetType() == META_BMPSCALE_ACTION )
+ {
+ bFound = sal_True;
+ const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*) pAction;
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pBmpScaleAction->GetBitmap(),
+ pBmpScaleAction->GetPoint(), pBmpScaleAction->GetSize(),
+ Point(), pBmpScaleAction->GetBitmap().GetSizePixel(), pStyle );
+ }
+ }
+ }
+ break;
+
+ case( META_COMMENT_ACTION ):
+ {
+ const MetaCommentAction* pA = (const MetaCommentAction*) pAction;
+ String aSkipComment;
+
+#ifndef _SVG_UNO3
+ if( pA->GetComment().ICompare( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
+#else
+ if( pA->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
+#endif
+ {
+ const MetaGradientExAction* pGradAction = NULL;
+ sal_Bool bDone = sal_False;
+
+ while( !bDone && ( ++i < nCount ) )
+ {
+ pAction = rMtf.GetAction( i );
+
+ if( pAction->GetType() == META_GRADIENTEX_ACTION )
+ pGradAction = (const MetaGradientExAction*) pAction;
+ else if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
+#ifndef _SVG_UNO3
+ ( ( (const MetaCommentAction*) pAction )->GetComment().ICompare( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) )
+
+#else
+ ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) )
+#endif
+ {
+ bDone = sal_True;
+ }
+ }
+
+ if( pGradAction )
+ ImplWriteGradientEx( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), pStyle );
+ }
+ }
+ break;
+
+ case( META_BMP_ACTION ):
+ {
+ const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pA->GetBitmap(),
+ pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmap().GetSizePixel() ),
+ Point(), pA->GetBitmap().GetSizePixel(), pStyle );
+ }
+ break;
+
+ case( META_BMPSCALE_ACTION ):
+ {
+ const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pA->GetBitmap(),
+ pA->GetPoint(), pA->GetSize(),
+ Point(), pA->GetBitmap().GetSizePixel(), pStyle );
+ }
+ break;
+
+ case( META_BMPSCALEPART_ACTION ):
+ {
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pA->GetBitmap(),
+ pA->GetDestPoint(), pA->GetDestSize(),
+ pA->GetSrcPoint(), pA->GetSrcSize(), pStyle );
+ }
+ break;
+
+ case( META_BMPEX_ACTION ):
+ {
+ const MetaBmpExAction* pA = (const MetaBmpExAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pA->GetBitmapEx(),
+ pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmapEx().GetSizePixel() ),
+ Point(), pA->GetBitmapEx().GetSizePixel(), pStyle );
+ }
+ break;
+
+ case( META_BMPEXSCALE_ACTION ):
+ {
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pA->GetBitmapEx(),
+ pA->GetPoint(), pA->GetSize(),
+ Point(), pA->GetBitmapEx().GetSizePixel(), pStyle );
+ }
+ break;
+
+ case( META_BMPEXSCALEPART_ACTION ):
+ {
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction;
+
+ mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
+ ImplWriteBmp( pA->GetBitmapEx(),
+ pA->GetDestPoint(), pA->GetDestSize(),
+ pA->GetSrcPoint(), pA->GetSrcSize(), pStyle );
+ }
+ break;
+
+ case( META_TEXT_ACTION ):
+ {
+ const MetaTextAction* pA = (const MetaTextAction*) pAction;
+
+ mpContext->SetFontAttr( mpVDev->GetFont() );
+ mpContext->SetPaintAttr( COL_TRANSPARENT, mpVDev->GetFont().GetColor() );
+ ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), NULL, 0, pStyle );
+ }
+ break;
+
+ case( META_TEXTRECT_ACTION ):
+ {
+ const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction;
+
+ mpContext->SetFontAttr( mpVDev->GetFont() );
+ mpContext->SetPaintAttr( COL_TRANSPARENT, mpVDev->GetFont().GetColor() );
+ ImplWriteText( pA->GetRect().TopLeft(), pA->GetText(), NULL, 0, pStyle );
+ }
+ break;
+
+ case( META_TEXTARRAY_ACTION ):
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction;
+ const Point aPos( ImplMap( pA->GetPoint() ) );
+
+ mpContext->SetFontAttr( mpVDev->GetFont() );
+ mpContext->SetPaintAttr( COL_TRANSPARENT, mpVDev->GetFont().GetColor() );
+ ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), pA->GetDXArray(), 0, pStyle );
+ }
+ break;
+
+ case( META_STRETCHTEXT_ACTION ):
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pAction;
+
+ mpContext->SetFontAttr( mpVDev->GetFont() );
+ mpContext->SetPaintAttr( COL_TRANSPARENT, mpVDev->GetFont().GetColor() );
+ ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), NULL, pA->GetWidth(), pStyle );
+ }
+ break;
+
+ case( META_CLIPREGION_ACTION ):
+ case( META_ISECTRECTCLIPREGION_ACTION ):
+ case( META_ISECTREGIONCLIPREGION_ACTION ):
+ case( META_MOVECLIPREGION_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( mpVDev );
+ mbClipAttrChanged = sal_True;
+ }
+ break;
+
+ case( META_REFPOINT_ACTION ):
+ case( META_MAPMODE_ACTION ):
+ case( META_LINECOLOR_ACTION ):
+ case( META_FILLCOLOR_ACTION ):
+ case( META_TEXTLINECOLOR_ACTION ):
+ case( META_TEXTFILLCOLOR_ACTION ):
+ case( META_TEXTCOLOR_ACTION ):
+ case( META_TEXTALIGN_ACTION ):
+ case( META_FONT_ACTION ):
+ case( META_PUSH_ACTION ):
+ case( META_POP_ACTION ):
+ {
+ ( (MetaAction*) pAction )->Execute( mpVDev );
+ }
+ break;
+
+ case( META_RASTEROP_ACTION ):
+ case( META_MASK_ACTION ):
+ case( META_MASKSCALE_ACTION ):
+ case( META_MASKSCALEPART_ACTION ):
+ case( META_WALLPAPER_ACTION ):
+ case( META_TEXTLINE_ACTION ):
+ {
+ // !!! >>> we don't want to support these actions
+ }
+ break;
+
+ default:
+ DBG_ERROR( "SVGActionWriter::ImplWriteActions: unsupported MetaAction #" );
+ break;
+ }
+ }
+
+ ImplReleaseContext();
+}
diff --git a/extensions/source/svg/svgaction.hxx b/extensions/source/svg/svgaction.hxx
new file mode 100644
index 000000000..5d94c5763
--- /dev/null
+++ b/extensions/source/svg/svgaction.hxx
@@ -0,0 +1,196 @@
+/*************************************************************************
+ *
+ * $RCSfile: svgaction.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVGACTION_HXX
+#define _SVGACTION_HXX
+
+#include "svgcom.hxx"
+
+// --------------
+// - FastString -
+// --------------
+
+class FastString
+{
+private:
+
+ NMSP_RTL::OUString maString;
+ sal_Unicode* mpBuffer;
+ sal_uInt32 mnBufLen;
+ sal_uInt32 mnCurLen;
+ sal_uInt32 mnBufInc;
+ sal_uInt32 mnPartPos;
+
+public:
+
+ FastString( sal_uInt32 nInitLen = 2048, sal_uInt32 nIncrement = 2048 );
+ FastString( sal_Char* pBufferForBase64Encoding, sal_uInt32 nBufLen );
+ ~FastString();
+
+ FastString& operator+=( const NMSP_RTL::OUString& rStr );
+
+ const NMSP_RTL::OUString& GetString() const;
+ sal_Bool GetFirstPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString );
+ sal_Bool GetNextPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString );
+
+ sal_uInt32 GetLength() const { return mnCurLen; }
+ void Clear() { mnCurLen = 0, maString = NMSP_RTL::OUString(); }
+};
+
+// ----------------------
+// - SVGAttributeWriter -
+// ----------------------
+
+class SVGActionWriter;
+
+class SVGAttributeWriter
+{
+private:
+
+ Font maCurFont;
+ Color maCurLineColor;
+ Color maCurFillColor;
+ SVGActionWriter& mrParent;
+ SvXMLExport& mrExport;
+ SvXMLElementExport* mpElemFont;
+ SvXMLElementExport* mpElemPaint;
+
+ SVGAttributeWriter();
+
+public:
+
+ SVGAttributeWriter( SVGActionWriter& rParent, SvXMLExport& rExport );
+ virtual ~SVGAttributeWriter();
+
+ NMSP_RTL::OUString GetFontStyle( const Font& rFont );
+ NMSP_RTL::OUString GetPaintStyle( const Color& rLineColor, const Color& rFillColor );
+
+ void SetFontAttr( const Font& rFont );
+ void SetPaintAttr( const Color& rLineColor, const Color& rFillColor );
+};
+
+// -------------------
+// - SVGActionWriter -
+// -------------------
+
+class SVGAttributeWriter;
+class SvXMLExport;
+class GDIMetaFile;
+
+class SVGActionWriter
+{
+private:
+
+ Stack maContextStack;
+ SvXMLExport& mrExport;
+ const GDIMetaFile& mrMtf;
+ SVGAttributeWriter* mpContext;
+ VirtualDevice* mpVDev;
+ MapMode maTargetMapMode;
+ sal_Int32 mnCurClipId;
+ sal_Bool mbDestroyVDev;
+ sal_Bool mbPaintAttrChanged;
+ sal_Bool mbFontAttrChanged;
+ sal_Bool mbClipAttrChanged;
+ sal_Bool mbDoublePoints;
+
+ SVGAttributeWriter* ImplAcquireContext() { maContextStack.Push( mpContext = new SVGAttributeWriter( *this, mrExport ) ); return mpContext; }
+ void ImplReleaseContext() { delete (SVGAttributeWriter*) maContextStack.Pop(); mpContext = (SVGAttributeWriter*) maContextStack.Top(); }
+
+ long ImplMap( sal_Int32 nVal ) const;
+ Point ImplMap( const Point& rPt ) const;
+ Size ImplMap( const Size& rSz ) const;
+ inline Rectangle ImplMap( const Rectangle& rRect ) const { return Rectangle( ImplMap( rRect.TopLeft() ), ImplMap( rRect.GetSize() ) ); }
+
+ void ImplWriteLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor = NULL, const NMSP_RTL::OUString* pStyle = NULL );
+ void ImplWriteRect( const Rectangle& rRect, long nRadX = 0, long nRadY = 0, const NMSP_RTL::OUString* pStyle = NULL );
+ void ImplWriteEllipse( const Point& rCenter, long nRadX, long nRadY, const NMSP_RTL::OUString* pStyle = NULL );
+ void ImplWritePolygon( const Polygon& rPoly, sal_Bool bLineOnly, const NMSP_RTL::OUString* pStyle = NULL );
+ void ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bLineOnly, const NMSP_RTL::OUString* pStyle = NULL );
+ void ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient, const NMSP_RTL::OUString* pStyle = NULL );
+ void ImplWriteText( const Point& rPos, const String& rText, const long* pDXArray, long nWidth, const NMSP_RTL::OUString* pStyle = NULL );
+ void ImplWriteBmp( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz, const NMSP_RTL::OUString* pStyle = NULL );
+
+ void ImplCheckFontAttributes();
+ void ImplCheckPaintAttributes();
+
+ void ImplWriteActions( const GDIMetaFile& rMtf, const NMSP_RTL::OUString* pStyle = NULL );
+
+ sal_Int32 ImplGetNextClipId() { return mnCurClipId++; }
+
+ SVGActionWriter();
+
+public:
+
+ static NMSP_RTL::OUString GetValueString( sal_Int32 nVal, sal_Bool bDoublePoints );
+
+public:
+
+ SVGActionWriter( SvXMLExport& rExport, const GDIMetaFile& rMtf,
+ VirtualDevice* pParentVDev = NULL,
+ sal_Bool bWriteDoublePoints = sal_False );
+ virtual ~SVGActionWriter();
+
+ const VirtualDevice& GetVDev() const { return *mpVDev; }
+ BOOL HasDoublePoints() const { return mbDoublePoints; }
+};
+
+#endif
diff --git a/extensions/source/svg/svgcom.hxx b/extensions/source/svg/svgcom.hxx
new file mode 100644
index 000000000..e10f3a64f
--- /dev/null
+++ b/extensions/source/svg/svgcom.hxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * $RCSfile: svgcom.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVGCOM_HXX
+#define _SVGCOM_HXX
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef __RTL_USTRING_
+#include <rtl/ustring>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+#ifndef _STACK_HXX
+#include <tools/stack.hxx>
+#endif
+#ifndef _SALBTYPE_HXX
+#include <vcl/salbtype.hxx>
+#endif
+#ifndef _GDIMTF_HXX
+#include <vcl/gdimtf.hxx>
+#endif
+#ifndef _METAACT_HXX
+#include <vcl/metaact.hxx>
+#endif
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/svg/XSVGWriter.hpp>
+#include <com/sun/star/svg/XSVGPrinter.hpp>
+
+#ifndef _XMLOFF_XMLEXP_HXX
+#include <xmloff/xmlexp.hxx>
+#endif
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include <xmloff/nmspmap.hxx>
+#endif
+
+// -----------------------------------------------------------------------------
+
+#if SUPD >= 583
+#define _SVG_UNO3 1
+#else
+#undef _SVG_UNO3
+#endif
+
+// -----------------------------------------------------------------------------
+
+#define NMSP_CPPU cppu
+#define NMSP_RTL rtl
+#define NMSP_UNO com::sun::star::uno
+#define NMSP_LANG com::sun::star::lang
+#define NMSP_SAX com::sun::star::xml::sax
+#define NMSP_SVG com::sun::star::svg
+#define NMSP_REGISTRY com::sun::star::registry
+
+
+#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj >
+#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj >
+#define ANY NMSP_UNO::Any
+#ifdef _SVG_UNO3
+#define B2UCONST( _def_pChar ) (NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar )))
+#else
+#define B2UCONST( _def_pChar ) (NMSP_RTL::OUString::createFromAscii(_def_pChar))
+#endif
+
+#endif // _SYNCCOM_HXX
diff --git a/extensions/source/svg/svgprinter.cxx b/extensions/source/svg/svgprinter.cxx
new file mode 100644
index 000000000..4e1c99e2f
--- /dev/null
+++ b/extensions/source/svg/svgprinter.cxx
@@ -0,0 +1,364 @@
+/*************************************************************************
+ *
+ * $RCSfile: svgprinter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _RMPRINTER_EXT
+
+#include "svgprinter.hxx"
+#include "svgaction.hxx"
+#include <uno/mapping.hxx>
+#include <vcl/print.hxx>
+#include <vcl/virdev.hxx>
+
+static const char aXMLElemSVG[] = "svg";
+static const char aXMLElemMetaSVG[] = "staroffice:svgElementMeta";
+static const char aXMLElemDesc[] = "desc";
+static const char aXMLElemMeta[] = "metadata";
+static const char aXMLElemRect[] = "rect";
+
+static const char aXMLAttrMetaSVGOuter[] = "isOuterElement";
+static const char aXMLAttrMetaSVGPage[] = "isPageElement";
+static const char aXMLAttrViewBox[] = "viewBox";
+static const char aXMLAttrX[] = "x";
+static const char aXMLAttrY[] = "y";
+static const char aXMLAttrWidth[] = "width";
+static const char aXMLAttrHeight[] = "height";
+
+// ----------------
+// - SVGMtfExport -
+// ----------------
+
+class SVGPrinterExport : public SvXMLExport
+{
+private:
+
+ Printer maPrinter;
+ VirtualDevice* mpVDev;
+ SvXMLElementExport* mpOuterElement;
+ sal_uInt32 mnPage;
+
+ SVGPrinterExport();
+
+ SvXMLElementExport* ImplCreateSVGElement( const JobSetup& rSetup, Size& rOutputSize );
+ void ImplWriteMetaAttr( sal_Bool bOuter, sal_Bool bPage );
+
+protected:
+
+ virtual void _ExportMeta() {}
+ virtual void _ExportStyles( BOOL bUsed ) {}
+ virtual void _ExportAutoStyles() {}
+ virtual void _ExportContent() {}
+ virtual void _ExportMasterStyles() {}
+ virtual ULONG exportDoc( const char *pClass = 0 ) { return 0; }
+
+public:
+
+#ifndef _SVG_UNO3
+ SVGPrinterExport( const XDocumentHandlerRef rxHandler, const JobSetup& rSetup,
+ const NMSP_RTL::OUString& rJobName, sal_uInt32 nCopies, sal_Bool bCollate );
+#else
+ SVGPrinterExport( const REF( NMSP_SAX::XDocumentHandler )& rxHandler, const JobSetup& rSetup,
+ const NMSP_RTL::OUString& rJobName, sal_uInt32 nCopies, sal_Bool bCollate );
+#endif
+ virtual ~SVGPrinterExport();
+
+ virtual void writePage( const JobSetup& rJobSetup, const GDIMetaFile& rMtf );
+};
+
+// -----------------------------------------------------------------------------
+
+#ifndef _SVG_UNO3
+SVGPrinterExport::SVGPrinterExport( const XDocumentHandlerRef rxHandler, const JobSetup& rSetup,
+ const NMSP_RTL::OUString& rJobName, sal_uInt32 nCopies, sal_Bool bCollate ) :
+#else
+SVGPrinterExport::SVGPrinterExport( const REF( NMSP_SAX::XDocumentHandler )& rxHandler, const JobSetup& rSetup,
+ const NMSP_RTL::OUString& rJobName, sal_uInt32 nCopies, sal_Bool bCollate ) :
+#endif
+ SvXMLExport( NMSP_RTL::OUString(), rxHandler ),
+ mpVDev( NULL ),
+ mnPage( 0 )
+{
+ maPrinter.SetJobSetup( rSetup );
+
+ GetDocHandler()->startDocument();
+
+#ifndef _SVG_UNO3
+ XExtendedDocumentHandlerRef xExtDocHandler( GetDocHandler(), USR_QUERY );
+#else
+ REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( GetDocHandler(), NMSP_UNO::UNO_QUERY );
+#endif
+
+ if( xExtDocHandler.is() )
+ {
+ NMSP_RTL::OUString aString;
+ const NMSP_RTL::OUString aLineFeed( NMSP_RTL::OUString::valueOf( (sal_Unicode) 0x0a ) );
+
+ // intro
+ xExtDocHandler->unknown( ( aString = B2UCONST( "<!DOCTYPE svg SYSTEM \"svg-19990812.dtd\" [" ) ) += aLineFeed );
+ xExtDocHandler->unknown( ( aString = B2UCONST( "<!ELEMENT metadata (#PCDATA | staroffice:svgElementMeta)*> " ) += aLineFeed ) );
+ xExtDocHandler->unknown( ( aString = B2UCONST( "<!ELEMENT staroffice:svgElementMeta ANY> " ) += aLineFeed ) );
+ xExtDocHandler->unknown( ( aString = B2UCONST( "<!ATTLIST staroffice:svgElementMeta " ) += aLineFeed ) );
+
+ // ATTLIST
+ xExtDocHandler->unknown( ( aString = B2UCONST( "isOuterElement (true | false) \"false\" " ) += aLineFeed ) );
+ xExtDocHandler->unknown( ( aString = B2UCONST( "isPageElement (true | false) \"true\"" ) += aLineFeed ) );
+
+ // end of intro
+ xExtDocHandler->unknown( ( aString = B2UCONST( ">" ) += aLineFeed ) );
+ xExtDocHandler->unknown( ( aString = B2UCONST( "]>" ) ) );
+ }
+
+ // create outer element
+ Size aOutputSize;
+
+ mpOuterElement = ImplCreateSVGElement( rSetup, aOutputSize );
+
+ // write description
+ SvXMLElementExport* pDescElem = new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemDesc, TRUE, TRUE );
+ NMSP_RTL::OUString aDesc( B2UCONST( "document name: " ) );
+
+ GetDocHandler()->characters( aDesc += rJobName );
+ delete pDescElem;
+
+ // write meta attributes
+ ImplWriteMetaAttr( TRUE, FALSE );
+}
+
+// -----------------------------------------------------------------------------
+
+SVGPrinterExport::~SVGPrinterExport()
+{
+ delete mpOuterElement;
+ GetDocHandler()->endDocument();
+ delete mpVDev;
+}
+
+// -----------------------------------------------------------------------------
+
+SvXMLElementExport* SVGPrinterExport::ImplCreateSVGElement( const JobSetup& rSetup, Size& rOutputSize )
+{
+ NMSP_RTL::OUString aAttr;
+
+ delete mpVDev;
+ mpVDev = new VirtualDevice;
+ mpVDev->EnableOutput( FALSE );
+ mpVDev->SetMapMode( MAP_100TH_MM );
+ maPrinter.SetJobSetup( rSetup );
+
+ rOutputSize = maPrinter.PixelToLogic( maPrinter.GetOutputSizePixel(), mpVDev->GetMapMode() );
+
+ aAttr = SVGActionWriter::GetValueString( rOutputSize.Width(), sal_True );
+ AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, aAttr );
+
+ aAttr = SVGActionWriter::GetValueString( rOutputSize.Height(), sal_True );
+ AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, aAttr );
+
+ aAttr = B2UCONST( "0.0 0.0 " );
+ aAttr += SVGActionWriter::GetValueString( rOutputSize.Width(), sal_True );
+ aAttr += B2UCONST( " " );
+ aAttr += SVGActionWriter::GetValueString( rOutputSize.Height(), sal_True );
+ AddAttribute( XML_NAMESPACE_NONE, aXMLAttrViewBox, aAttr );
+
+ return( new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemSVG, TRUE, TRUE ) );
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGPrinterExport::ImplWriteMetaAttr( sal_Bool bOuter, sal_Bool bPage )
+{
+ SvXMLElementExport aMetaData( *this, XML_NAMESPACE_NONE, aXMLElemMeta, TRUE, TRUE );
+ NMSP_RTL::OUString aAttr;
+
+ aAttr = bOuter ? B2UCONST( "true" ) : B2UCONST( "false" );
+ AddAttribute( XML_NAMESPACE_NONE, aXMLAttrMetaSVGOuter, aAttr );
+
+ aAttr = bPage ? B2UCONST( "true" ) : B2UCONST( "false" );
+ AddAttribute( XML_NAMESPACE_NONE, aXMLAttrMetaSVGPage, aAttr );
+
+ {
+ delete( new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemMetaSVG, TRUE, TRUE ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGPrinterExport::writePage( const JobSetup& rSetup, const GDIMetaFile& rMtf )
+{
+ Size aOutputSize;
+ NMSP_RTL::OUString aAttr;
+ SvXMLElementExport* pPageElem = ImplCreateSVGElement( rSetup, aOutputSize );
+
+ // write description
+ SvXMLElementExport* pDescElem = new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemDesc, TRUE, TRUE );
+ NMSP_RTL::OUString aDesc( B2UCONST( "page: " ) );
+
+ GetDocHandler()->characters( aDesc += NMSP_RTL::OUString::valueOf( (sal_Int32) ++mnPage ) );
+ delete pDescElem;
+
+ // write meta attributes
+ ImplWriteMetaAttr( FALSE, TRUE );
+
+ // write dummy rect element
+ aAttr = B2UCONST( "0.0" );
+ AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, aAttr );
+ AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, aAttr );
+
+ aAttr = SVGActionWriter::GetValueString( aOutputSize.Width(), sal_True );
+ AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, aAttr );
+
+ aAttr = SVGActionWriter::GetValueString( aOutputSize.Height(), sal_True );
+ AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, aAttr );
+
+ delete( new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemRect, TRUE, TRUE ) );
+ delete( new SVGActionWriter( *this, rMtf, mpVDev, TRUE ) );
+
+ delete pPageElem;
+}
+
+// --------------
+// - SVGPrinter -
+// --------------
+
+SVGPrinter::SVGPrinter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) :
+ mxFact( rxMgr ),
+ mpWriter( NULL )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SVGPrinter::~SVGPrinter()
+{
+ delete mpWriter;
+}
+
+// -----------------------------------------------------------------------------
+
+
+ANY SAL_CALL SVGPrinter::queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException )
+{
+ const ANY aRet( NMSP_CPPU::queryInterface( rType, static_cast< NMSP_SVG::XSVGPrinter* >( this ) ) );
+
+ return( aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ) );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGPrinter::acquire() throw( NMSP_UNO::RuntimeException )
+{
+ OWeakObject::acquire();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGPrinter::release() throw( NMSP_UNO::RuntimeException )
+{
+ OWeakObject::release();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SAL_CALL SVGPrinter::startJob( const REF( NMSP_SAX::XDocumentHandler )& rxHandler,
+ const SEQ( sal_Int8 )& rJobSetupSeq,
+ const NMSP_RTL::OUString& rJobName,
+ sal_uInt32 nCopies, sal_Bool bCollate ) throw( NMSP_UNO::RuntimeException )
+{
+ const sal_Bool bRet = ( mpWriter == NULL );
+
+ if( bRet )
+ {
+ SvMemoryStream aMemStm( (char*) rJobSetupSeq.getConstArray(), rJobSetupSeq.getLength(), STREAM_READ );
+ JobSetup aJobSetup;
+
+ aMemStm.SetCompressMode( COMPRESSMODE_FULL );
+ aMemStm >> aJobSetup;
+
+#ifndef _SVG_UNO3
+ NMSP_UNO::Mapping ecpptosmart( CPPU_CURRENT_LANGUAGE_BINDING_NAME, "smart" );
+ XDocumentHandlerRef xDocumentHandler( (XDocumentHandler*) ecpptosmart.mapInterface( rxHandler.get(), getCppuType( &rxHandler ) ) );
+ xDocumentHandler->release();
+#else
+ const REF( NMSP_SAX::XDocumentHandler ) xDocumentHandler( rxHandler );
+#endif
+
+ mpWriter = new SVGPrinterExport( xDocumentHandler, aJobSetup, rJobName, nCopies, bCollate );
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGPrinter::printPage( const SEQ( sal_Int8 )& rPrintPage ) throw( NMSP_UNO::RuntimeException )
+{
+ SvMemoryStream aMemStm( (char*) rPrintPage.getConstArray(), rPrintPage.getLength(), STREAM_READ );
+ PrinterPage aPage;
+
+ aMemStm.SetCompressMode( COMPRESSMODE_FULL );
+ aMemStm >> aPage;
+ mpWriter->writePage( aPage.GetJobSetup(), *aPage.GetGDIMetaFile() );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGPrinter::endJob() throw( NMSP_UNO::RuntimeException )
+{
+ delete mpWriter, mpWriter = NULL;
+}
diff --git a/extensions/source/svg/svgprinter.hxx b/extensions/source/svg/svgprinter.hxx
new file mode 100644
index 000000000..9673f48db
--- /dev/null
+++ b/extensions/source/svg/svgprinter.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * $RCSfile: svgprinter.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVGPRINTER_HXX
+#define _SVGPRINTER_HXX
+
+#include "svgcom.hxx"
+
+// -------------
+// - SVGWriter -
+// -------------
+
+class SVGPrinterExport;
+
+class SVGPrinter : public NMSP_CPPU::OWeakObject, NMSP_SVG::XSVGPrinter
+{
+private:
+
+ REF( NMSP_LANG::XMultiServiceFactory ) mxFact;
+ SVGPrinterExport* mpWriter;
+
+ SVGPrinter();
+
+public:
+
+ SVGPrinter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr );
+ virtual ~SVGPrinter();
+
+ // XInterface
+ virtual ANY SAL_CALL queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException );
+ virtual void SAL_CALL acquire() throw( NMSP_UNO::RuntimeException );
+ virtual void SAL_CALL release() throw( NMSP_UNO::RuntimeException );
+
+ // XSVGPrinter
+ virtual sal_Bool SAL_CALL startJob( const REF( NMSP_SAX::XDocumentHandler )& rxHandler,
+ const SEQ( sal_Int8 )& rJobSetup,
+ const NMSP_RTL::OUString& rJobName,
+ sal_uInt32 nCopies, sal_Bool bCollate ) throw( NMSP_UNO::RuntimeException );
+ virtual void SAL_CALL printPage( const SEQ( sal_Int8 )& rPrintPage ) throw( NMSP_UNO::RuntimeException );
+ virtual void SAL_CALL endJob() throw( NMSP_UNO::RuntimeException );
+};
+
+#endif
diff --git a/extensions/source/svg/svguno.cxx b/extensions/source/svg/svguno.cxx
new file mode 100644
index 000000000..c0264f866
--- /dev/null
+++ b/extensions/source/svg/svguno.cxx
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * $RCSfile: svguno.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "svgcom.hxx"
+#include "svgwriter.hxx"
+#include "svgprinter.hxx"
+
+#include <cppuhelper/factory.hxx>
+#include <uno/mapping.hxx>
+
+// -------------------
+// - factory methods -
+// -------------------
+
+#if SUPD>=590
+static REF( NMSP_UNO::XInterface ) SAL_CALL create_SVGWriter( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
+#else
+static REF( NMSP_UNO::XInterface ) create_SVGWriter( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
+#endif
+{
+ return REF( NMSP_UNO::XInterface )( *new SVGWriter( rxFact ) );
+}
+
+// -----------------------------------------------------------------------------
+
+#if SUPD>=590
+static REF( NMSP_UNO::XInterface ) SAL_CALL create_SVGPrinter( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
+#else
+static REF( NMSP_UNO::XInterface ) create_SVGPrinter( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
+#endif
+{
+ return REF( NMSP_UNO::XInterface )( *new SVGPrinter( rxFact ) );
+}
+
+// ------------------------------------------
+// - component_getImplementationEnvironment -
+// ------------------------------------------
+
+extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+// -----------------------
+// - component_writeInfo -
+// -----------------------
+
+extern "C" sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
+{
+ sal_Bool bRet = sal_False;
+
+ if( pRegistryKey )
+ {
+ try
+ {
+ REF( NMSP_REGISTRY::XRegistryKey ) xNewKey1(
+ static_cast< NMSP_REGISTRY::XRegistryKey* >( pRegistryKey )->createKey(
+ B2UCONST( "/com.sun.star.comp.extensions.SVGWriter/UNO/SERVICES/com.sun.star.svg.SVGWriter" ) ) );
+ REF( NMSP_REGISTRY::XRegistryKey ) xNewKey2(
+ static_cast< NMSP_REGISTRY::XRegistryKey* >( pRegistryKey )->createKey(
+ B2UCONST( "/com.sun.star.comp.extensions.SVGPrinter/UNO/SERVICES/com.sun.star.svg.SVGPrinter" ) ) );
+
+ bRet = sal_True;
+ }
+ catch( NMSP_REGISTRY::InvalidRegistryException& )
+ {
+ OSL_ENSHURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------
+// - component_getFactory -
+// ------------------------
+
+extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
+{
+ REF( NMSP_LANG::XSingleServiceFactory ) xFactory;
+ void* pRet = 0;
+
+ if( rtl_str_compare( pImplName, "com.sun.star.comp.extensions.SVGWriter" ) == 0 )
+ {
+ const NMSP_RTL::OUString aServiceName( B2UCONST( "com.sun.star.svg.SVGWriter" ) );
+
+ xFactory = REF( NMSP_LANG::XSingleServiceFactory )( NMSP_CPPU::createSingleFactory(
+ reinterpret_cast< NMSP_LANG::XMultiServiceFactory* >( pServiceManager ),
+ B2UCONST( "com.sun.star.comp.extensions.SVGWriter" ),
+ create_SVGWriter, SEQ( NMSP_RTL::OUString )( &aServiceName, 1 ) ) );
+ }
+ else if( rtl_str_compare( pImplName, "com.sun.star.comp.extensions.SVGPrinter" ) == 0 )
+ {
+ const NMSP_RTL::OUString aServiceName( B2UCONST( "com.sun.star.svg.SVGPrinter" ) );
+
+ xFactory = REF( NMSP_LANG::XSingleServiceFactory )( NMSP_CPPU::createSingleFactory(
+ reinterpret_cast< NMSP_LANG::XMultiServiceFactory* >( pServiceManager ),
+ B2UCONST( "com.sun.star.comp.extensions.SVGPrinter" ),
+ create_SVGPrinter, SEQ( NMSP_RTL::OUString )( &aServiceName, 1 ) ) );
+ }
+
+ if( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+}
diff --git a/extensions/source/svg/svgwriter.cxx b/extensions/source/svg/svgwriter.cxx
new file mode 100644
index 000000000..4b7c49eed
--- /dev/null
+++ b/extensions/source/svg/svgwriter.cxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * $RCSfile: svgwriter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "svgwriter.hxx"
+#include "svgaction.hxx"
+#include <uno/mapping.hxx>
+
+// ----------------
+// - SVGMtfExport -
+// ----------------
+
+class SVGMtfExport : public SvXMLExport
+{
+private:
+
+ SVGMtfExport();
+
+protected:
+
+ virtual void _ExportMeta() {}
+ virtual void _ExportStyles( BOOL bUsed ) {}
+ virtual void _ExportAutoStyles() {}
+ virtual void _ExportContent() {}
+ virtual void _ExportMasterStyles() {}
+ virtual ULONG exportDoc( const char *pClass = 0 ) { return 0; }
+
+public:
+
+#ifndef _SVG_UNO3
+ SVGMtfExport( XDocumentHandlerRef& rXHandler );
+#else
+ SVGMtfExport( const REF( NMSP_SAX::XDocumentHandler )& rxHandler );
+#endif
+ virtual ~SVGMtfExport();
+
+ virtual void writeMtf( const GDIMetaFile& rMtf );
+};
+
+// -----------------------------------------------------------------------------
+
+#ifndef _SVG_UNO3
+SVGMtfExport::SVGMtfExport( XDocumentHandlerRef& rxHandler ) :
+#else
+SVGMtfExport::SVGMtfExport( const REF( NMSP_SAX::XDocumentHandler )& rxHandler ) :
+#endif
+ SvXMLExport( NMSP_RTL::OUString(), rxHandler )
+{
+ GetDocHandler()->startDocument();
+}
+
+// -----------------------------------------------------------------------------
+
+SVGMtfExport::~SVGMtfExport()
+{
+ GetDocHandler()->endDocument();
+}
+
+// -----------------------------------------------------------------------------
+
+void SVGMtfExport::writeMtf( const GDIMetaFile& rMtf )
+{
+ const Size aSize( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_MM ) );
+ NMSP_RTL::OUString aAttr;
+#ifndef _SVG_UNO3
+ XExtendedDocumentHandlerRef xExtDocHandler( GetDocHandler(), USR_QUERY );
+#else
+ REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( GetDocHandler(), NMSP_UNO::UNO_QUERY );
+#endif
+
+ if( xExtDocHandler.is() )
+ xExtDocHandler->unknown( B2UCONST( "<!DOCTYPE svg SYSTEM \"svg-19990812.dtd\">" ) );
+
+ aAttr = NMSP_RTL::OUString::valueOf( aSize.Width() );
+ aAttr += B2UCONST( "mm" );
+ AddAttribute( XML_NAMESPACE_NONE, "width", aAttr );
+
+ aAttr = NMSP_RTL::OUString::valueOf( aSize.Height() );
+ aAttr += B2UCONST( "mm" );
+ AddAttribute( XML_NAMESPACE_NONE, "height", aAttr );
+
+ aAttr = B2UCONST( "0 0 " );
+ aAttr += NMSP_RTL::OUString::valueOf( aSize.Width() * 100L );
+ aAttr += B2UCONST( " " );
+ aAttr += NMSP_RTL::OUString::valueOf( aSize.Height() * 100L );
+ AddAttribute( XML_NAMESPACE_NONE, "viewBox", aAttr );
+
+ {
+ SvXMLElementExport aSVG( *this, XML_NAMESPACE_NONE, "svg", TRUE, TRUE );
+ SVGActionWriter* pWriter = new SVGActionWriter( *this, rMtf );
+
+ delete pWriter;
+ }
+}
+
+// -------------
+// - SVGWriter -
+// -------------
+
+SVGWriter::SVGWriter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) :
+ mxFact( rxMgr )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+SVGWriter::~SVGWriter()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+
+ANY SAL_CALL SVGWriter::queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException )
+{
+ const ANY aRet( NMSP_CPPU::queryInterface( rType, static_cast< NMSP_SVG::XSVGWriter* >( this ) ) );
+
+ return( aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ) );
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGWriter::acquire() throw( NMSP_UNO::RuntimeException )
+{
+ OWeakObject::acquire();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGWriter::release() throw( NMSP_UNO::RuntimeException )
+{
+ OWeakObject::release();
+}
+
+// -----------------------------------------------------------------------------
+
+void SAL_CALL SVGWriter::write( const REF( NMSP_SAX::XDocumentHandler )& rxDocHandler,
+ const SEQ( sal_Int8 )& rMtfSeq ) throw( NMSP_UNO::RuntimeException )
+{
+ SvMemoryStream aMemStm( (char*) rMtfSeq.getConstArray(), rMtfSeq.getLength(), STREAM_READ );
+ GDIMetaFile aMtf;
+
+ aMemStm.SetCompressMode( COMPRESSMODE_FULL );
+ aMemStm >> aMtf;
+
+#ifndef _SVG_UNO3
+ NMSP_UNO::Mapping ecpptosmart( CPPU_CURRENT_LANGUAGE_BINDING_NAME, "smart" );
+ XDocumentHandlerRef xDocumentHandler( (XDocumentHandler*)ecpptosmart.mapInterface( rxDocHandler.get(), getCppuType(&rxDocHandler)) );
+ xDocumentHandler->release();
+#else
+ const REF( NMSP_SAX::XDocumentHandler ) xDocumentHandler( rxDocHandler );
+#endif
+
+ SVGMtfExport* pWriter = new SVGMtfExport( xDocumentHandler );
+ pWriter->writeMtf( aMtf );
+ delete pWriter;
+}
diff --git a/extensions/source/svg/svgwriter.hxx b/extensions/source/svg/svgwriter.hxx
new file mode 100644
index 000000000..1f04366e5
--- /dev/null
+++ b/extensions/source/svg/svgwriter.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * $RCSfile: svgwriter.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SVGWRITER_HXX
+#define _SVGWRITER_HXX
+
+#include "svgcom.hxx"
+
+// -------------
+// - SVGWriter -
+// -------------
+
+class SVGWriter : public NMSP_CPPU::OWeakObject, NMSP_SVG::XSVGWriter
+{
+private:
+
+ REF( NMSP_LANG::XMultiServiceFactory ) mxFact;
+
+ SVGWriter();
+
+public:
+
+ SVGWriter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr );
+ virtual ~SVGWriter();
+
+ // XInterface
+ virtual ANY SAL_CALL queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException );
+ virtual void SAL_CALL acquire() throw( NMSP_UNO::RuntimeException );
+ virtual void SAL_CALL release() throw( NMSP_UNO::RuntimeException );
+
+ // XSVGWriter
+ virtual void SAL_CALL write( const REF( NMSP_SAX::XDocumentHandler )& rxDocHandler,
+ const SEQ( sal_Int8 )& rMtfSeq ) throw( NMSP_UNO::RuntimeException );
+};
+
+#endif
diff --git a/extensions/source/xmlextract/makefile.mk b/extensions/source/xmlextract/makefile.mk
new file mode 100644
index 000000000..1cd16b971
--- /dev/null
+++ b/extensions/source/xmlextract/makefile.mk
@@ -0,0 +1,125 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:54 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=extensions
+TARGET=xmx
+
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Types -------------------------------------
+
+UNOTYPES=\
+ com.sun.star.uno.RuntimeException \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.uno.XInterface \
+ com.sun.star.uno.XWeak \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.io.XInputStream \
+ com.sun.star.lang.XComponent \
+ com.sun.star.lang.XInitialization \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.loader.XImplementationLoader \
+ com.sun.star.registry.XImplementationRegistration \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.registry.XSimpleRegistry \
+ com.sun.star.io.XXMLExtractor
+
+# --- Files -------------------------------------
+
+SLOFILES= $(SLO)$/xmxuno.obj \
+ $(SLO)$/xmxtrct.obj
+
+# --- Library -----------------------------------
+
+SHL1TARGET=$(TARGET)$(UPD)$(DLLPOSTFIX)
+SHL1STDLIBS=\
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(UNOTOOLSLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(VCLLIB) \
+ $(SVLLIB) \
+ $(ONELIB) \
+ $(SO2LIB) \
+ $(SOTLIB) \
+ $(TOOLSLIB)
+
+SHL1DEPN=
+SHL1IMPLIB= i$(SHL1TARGET)
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
diff --git a/extensions/source/xmlextract/xmxcom.hxx b/extensions/source/xmlextract/xmxcom.hxx
new file mode 100644
index 000000000..2b2b3dbdd
--- /dev/null
+++ b/extensions/source/xmlextract/xmxcom.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmxcom.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMXCOM_HXX
+#define _XMXCOM_HXX
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef __RTL_USTRING_
+#include <rtl/ustring>
+#endif
+#ifndef _DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _STREAM_HXX
+#include <tools/stream.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XXMLExtractor.hpp>
+
+// -----------------------------------------------------------------------------
+
+#define NMSP_CPPU ::cppu
+#define NMSP_RTL ::rtl
+#define NMSP_UNO ::com::sun::star::uno
+#define NMSP_LANG ::com::sun::star::lang
+#define NMSP_IO ::com::sun::star::io
+#define NMSP_REGISTRY ::com::sun::star::registry
+
+
+#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj >
+#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj >
+#define ANY NMSP_UNO::Any
+#define B2UCONST( _def_pChar ) (NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar )))
+
+#endif // _XMXCOM_HXX
diff --git a/extensions/source/xmlextract/xmxtrct.cxx b/extensions/source/xmlextract/xmxtrct.cxx
new file mode 100644
index 000000000..0fccb11ed
--- /dev/null
+++ b/extensions/source/xmlextract/xmxtrct.cxx
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmxtrct.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "xmxtrct.hxx"
+
+#include <rtl/memory.h>
+#include <tools/zcodec.hxx>
+#include <unotools/streamhelper.hxx>
+#include <so3/svstor.hxx>
+
+// ----------------
+// - XMXLockBytes -
+// ----------------
+
+class XMXLockBytes : public SvLockBytes
+{
+ REF( NMSP_IO::XInputStream ) mxIStm;
+ SEQ( sal_Int8 ) maSeq;
+
+ XMXLockBytes();
+
+public:
+
+ XMXLockBytes( const REF( NMSP_IO::XInputStream )& rxIStm );
+ virtual ~XMXLockBytes();
+
+ virtual ErrCode ReadAt( sal_uInt32 nPos, void* pBuffer, sal_uInt32 nCount, sal_uInt32* pRead ) const;
+ virtual ErrCode WriteAt( sal_uInt32 nPos, const void* pBuffer, sal_uInt32 nCount, sal_uInt32* pWritten );
+ virtual ErrCode Flush() const;
+ virtual ErrCode SetSize( sal_uInt32 nSize );
+ virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const;
+};
+
+// ------------------------------------------------------------------------
+
+XMXLockBytes::XMXLockBytes( const REF( NMSP_IO::XInputStream )& rxIStm ) :
+ mxIStm( rxIStm )
+{
+ if( mxIStm.is() )
+ {
+ const sal_uInt32 nBytesToRead = 65535;
+ sal_uInt32 nRead;
+
+ do
+ {
+ SEQ( sal_Int8 ) aReadSeq;
+
+ nRead = mxIStm->readSomeBytes( aReadSeq, nBytesToRead );
+
+ if( nRead )
+ {
+ const sal_uInt32 nOldLength = maSeq.getLength();
+ maSeq.realloc( nOldLength + nRead );
+ rtl_copyMemory( maSeq.getArray() + nOldLength, aReadSeq.getConstArray(), aReadSeq.getLength() );
+ }
+ }
+ while( nBytesToRead == nRead );
+ }
+}
+
+// ------------------------------------------------------------------------
+
+XMXLockBytes::~XMXLockBytes()
+{
+}
+
+// ------------------------------------------------------------------------
+
+ErrCode XMXLockBytes::ReadAt( sal_uInt32 nPos, void* pBuffer, sal_uInt32 nCount, sal_uInt32* pRead ) const
+{
+ const sal_uInt32 nSeqLen = maSeq.getLength();
+ ErrCode nErr = ERRCODE_NONE;
+
+ if( nPos < nSeqLen )
+ {
+ if( ( nPos + nCount ) > nSeqLen )
+ nCount = nSeqLen - nPos;
+
+ rtl_copyMemory( pBuffer, maSeq.getConstArray() + nPos, nCount );
+ *pRead = nCount;
+ }
+ else
+ *pRead = 0UL;
+
+ return nErr;
+}
+
+// ------------------------------------------------------------------------
+
+ErrCode XMXLockBytes::WriteAt( sal_uInt32 nPos, const void* pBuffer, sal_uInt32 nCount, sal_uInt32* pWritten )
+{
+ return ERRCODE_IO_CANTWRITE;
+}
+
+// ------------------------------------------------------------------------
+
+ErrCode XMXLockBytes::Flush() const
+{
+ return ERRCODE_NONE;
+}
+
+// ------------------------------------------------------------------------
+
+ErrCode XMXLockBytes::SetSize( sal_uInt32 nSize )
+{
+ return ERRCODE_IO_CANTWRITE;
+}
+
+// ------------------------------------------------------------------------
+
+ErrCode XMXLockBytes::Stat( SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag ) const
+{
+ pStat->nSize = maSeq.getLength();
+ return ERRCODE_NONE;
+}
+
+// ----------------
+// - XMLExtractor -
+// ----------------
+
+XMLExtractor::XMLExtractor( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) :
+ mxFact( rxMgr )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+XMLExtractor::~XMLExtractor()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+REF( NMSP_IO::XInputStream ) SAL_CALL XMLExtractor::extract( const REF( NMSP_IO::XInputStream )& rxIStm ) throw( NMSP_UNO::RuntimeException )
+{
+ REF( NMSP_IO::XInputStream ) xRet;
+
+ if( rxIStm.is() )
+ {
+ SvStream aIStm( new XMXLockBytes( rxIStm ) );
+ SvStorageRef aStorage( new SvStorage( aIStm ) );
+ const String aStmName( String::CreateFromAscii( "XMLFormat" ) );
+
+ if( !aStorage->GetError() && aStorage->IsStream( aStmName ))
+ {
+ SvStorageStreamRef xStream( aStorage->OpenStream( aStmName ) );
+
+ if( xStream.Is() )
+ {
+ SvMemoryStream* pMemStm = new SvMemoryStream( 65535, 65535 );
+ ZCodec aCodec;
+
+ aCodec.BeginCompression( ZCODEC_BEST_COMPRESSION );
+ aCodec.Decompress( *xStream, *pMemStm );
+ aCodec.EndCompression();
+
+ xRet = new ::utl::OInputStreamHelper( new SvLockBytes( pMemStm, TRUE ), 65535 );
+ }
+ }
+ }
+
+ return xRet;
+}
diff --git a/extensions/source/xmlextract/xmxtrct.hxx b/extensions/source/xmlextract/xmxtrct.hxx
new file mode 100644
index 000000000..9ae4e17cd
--- /dev/null
+++ b/extensions/source/xmlextract/xmxtrct.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmxtrct.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMXTRCT_HXX
+#define _XMXTRCT_HXX
+
+#include "xmxcom.hxx"
+
+// ----------------
+// - XMLExtractor -
+// ----------------
+
+class XMLExtractor : public ::cppu::WeakImplHelper1< NMSP_IO::XXMLExtractor >
+{
+private:
+
+ REF( NMSP_LANG::XMultiServiceFactory ) mxFact;
+
+ XMLExtractor();
+
+public:
+
+ XMLExtractor( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr );
+ virtual ~XMLExtractor();
+
+ // XXMLExtractor
+ virtual REF( NMSP_IO::XInputStream ) SAL_CALL extract( const REF( NMSP_IO::XInputStream )& rxIStm ) throw( NMSP_UNO::RuntimeException );
+};
+
+#endif
diff --git a/extensions/source/xmlextract/xmxuno.cxx b/extensions/source/xmlextract/xmxuno.cxx
new file mode 100644
index 000000000..8eb366893
--- /dev/null
+++ b/extensions/source/xmlextract/xmxuno.cxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmxuno.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "xmxcom.hxx"
+#include "xmxtrct.hxx"
+#include <osl/diagnose.h>
+#include <cppuhelper/factory.hxx>
+#include <uno/mapping.hxx>
+
+// -------------------
+// - factory methods -
+// -------------------
+
+static REF( NMSP_UNO::XInterface ) SAL_CALL create_XMLExtractor( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
+{
+ return REF( NMSP_UNO::XInterface )( *new XMLExtractor( rxFact ) );
+}
+
+extern "C"
+{
+//==================================================================================================
+void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+//==================================================================================================
+sal_Bool SAL_CALL component_writeInfo(
+ void * pServiceManager, void * pRegistryKey )
+{
+ if (pRegistryKey)
+ {
+ try
+ {
+ REF( NMSP_REGISTRY::XRegistryKey ) xNewKey(
+ reinterpret_cast< NMSP_REGISTRY::XRegistryKey * >( pRegistryKey )->createKey(
+ NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM("/com.sun.star.comp.io.XMLExtractor/UNO/SERVICES/com.sun.star.io.XMLExtractor") ) ) );
+
+ return sal_True;
+ }
+ catch (NMSP_REGISTRY::InvalidRegistryException &)
+ {
+ OSL_ENSHURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+}
+//==================================================================================================
+void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ void * pRet = 0;
+
+ if (rtl_str_compare( pImplName, "com.sun.star.comp.io.XMLExtractor" ) == 0)
+ {
+ NMSP_RTL::OUString aServiceName( B2UCONST( "com.sum.star.io.XMLExtractor" ) );
+
+ REF( NMSP_LANG::XSingleServiceFactory ) xFactory( NMSP_CPPU::createSingleFactory(
+ reinterpret_cast< NMSP_LANG::XMultiServiceFactory * >( pServiceManager ),
+ NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.io.XMLExtractor") ),
+ create_XMLExtractor,
+ SEQ( NMSP_RTL::OUString )( &aServiceName, 1 ) ) );
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
+}
diff --git a/extensions/stardiv/fontest/fontest.idl b/extensions/stardiv/fontest/fontest.idl
new file mode 100644
index 000000000..dbe84d018
--- /dev/null
+++ b/extensions/stardiv/fontest/fontest.idl
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * $RCSfile: fontest.idl,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _EXTENSIONS_FONTEST_IDL
+#define _EXTENSIONS_FONTEST_IDL
+
+
+#include <uno/intrface.idl>
+#include <stardiv/uno/beans/propset.idl>
+#include <stardiv/uno/lang/ulexcp.idl>
+
+module stardiv
+{
+
+ module extensions
+ {
+
+ module fontest
+ {
+
+/** a flag called "surpressed" changes the action of check and checkWithDialog
+ @author Berndt Reinhold
+ @see stardiv::uno::XInterface
+ */
+ [ uik(BF6D5A72-B53B-11d2-A17B00A0-243D2A0B), ident("FonTest", 1.0) ]
+ interface XFonTest: stardiv::uno::XInterface
+ {
+ /** Checks if "StarMath" and "StarBats" fonts are installed.
+ <P>
+ @param bForce: If TRUE check the fonts even if surpressed.
+ Otherwise check the fonts only if not surpressed.
+ @see resetSurpressed
+ @returns TRUE if the fonts are available. Also TRUE if surpressed
+ is TRUE and bForce is FALSE. Otherwise return FALSE.
+ </P>
+ */
+ boolean check([in] boolean bForce);
+
+ /** Same as check but additional shows a dialog if result is FALSE.
+ <P>
+ @param bForce: same as in check
+ @see check
+ @see resetSurpressed
+ </P>
+ */
+ boolean checkWithDialog([in] boolean bForce);
+
+ /** Shows a dialog if the font "StarBats" or "StarMath" is missing.
+ <P>
+ The dialog shows which font(s) is/are missing and have a checkbox,
+ that represents the state of the flag surpressed. This dialog is
+ the only way to set the flag surpressed to TRUE. This method is
+ not affected by the value of the flag surpressed.
+ @see resetSurpressed
+ </P>
+ */
+ boolean executeDialog();
+
+ /** Set flag surpressed to FALSE
+ <P>
+ The flag surpressed is stored in the registry. If surpressed is
+ FALSE the methods check and checkWithDialog ignores the parameter
+ bForce. if surpressed is TRUE check and checkWithDialog only
+ perform any action if their parameter bForce is TRUE. otherwise
+ they simply return TRUE.
+ </P>
+ */
+ void resetSurpressed();
+ };
+
+/*-------------- services -------------------------------------------
+ This service is the implementation of the interface XFonTest.
+ @version 1.0
+ @author Berndt Reinhold
+ */
+
+ service FonTestService
+ {
+ interface XFonTest;
+ };
+
+//-------------------------------------------------------------------
+
+ }; // fontest
+ }; // extensions
+}; // stardiv
+
+#endif
diff --git a/extensions/stardiv/fontest/makefile.mk b/extensions/stardiv/fontest/makefile.mk
new file mode 100644
index 000000000..78d6afa65
--- /dev/null
+++ b/extensions/stardiv/fontest/makefile.mk
@@ -0,0 +1,83 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:54 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+prjpch=
+
+PRJ=..$/..
+
+PRJNAME=extensions
+TARGET=fontestidl
+IDLMAP=stardiv$/usrmap.idl
+PACKAGE=stardiv$/fontest
+ENABLE_EXCEPTIONS=TRUE
+
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# ------------------------------------------------------------------
+IDLFILES= fontest.idl
+
+# ------------------------------------------------------------------
+.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
diff --git a/extensions/stardiv/oinstchk/makefile.mk b/extensions/stardiv/oinstchk/makefile.mk
new file mode 100644
index 000000000..f7ec30431
--- /dev/null
+++ b/extensions/stardiv/oinstchk/makefile.mk
@@ -0,0 +1,82 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:54 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+prjpch=
+
+PRJ=..$/..
+
+PRJNAME=extensions
+TARGET=oinstchkidl
+IDLMAP=stardiv$/usrmap.idl
+PACKAGE=stardiv$/oinstchk
+ENABLE_EXCEPTIONS=TRUE
+
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# ------------------------------------------------------------------
+IDLFILES= oinstchk.idl
+
+# ------------------------------------------------------------------
+.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
diff --git a/extensions/stardiv/oinstchk/oinstchk.idl b/extensions/stardiv/oinstchk/oinstchk.idl
new file mode 100644
index 000000000..3d77a31b9
--- /dev/null
+++ b/extensions/stardiv/oinstchk/oinstchk.idl
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * $RCSfile: oinstchk.idl,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:54 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _INSTALLATION_OINSTCHK_IDL
+#define _INSTALLATION_OINSTCHK_IDL
+
+
+#include <uno/intrface.idl>
+#include <stardiv/uno/beans/propset.idl>
+#include <stardiv/uno/lang/ulexcp.idl>
+
+module stardiv
+{
+
+ module installation
+ {
+
+/** a flag called "surpressed" changes the action of check and checkWithDialog
+ @author Berndt Reinhold
+ @see stardiv::uno::XInterface
+ */
+
+ [ uik(BF6D5A72-B53B-11d2-A17B00A0-243D2A0B), ident("OInstChk", 1.0) ]
+ interface XOInstChk: stardiv::uno::XInterface
+ {
+ /** Checks if "StarMath" and "StarBats" fonts are installed.
+ <P>
+ @param bForce: If TRUE check the fonts even if surpressed.
+ Otherwise check the fonts only if not surpressed.
+ @see resetSurpressed
+ @returns TRUE if the fonts are available. Also TRUE if surpressed
+ is TRUE and bForce is FALSE. Otherwise return FALSE.
+ </P>
+ */
+ boolean check([in] boolean bForce);
+
+ /** Same as check but additional shows a dialog if result is FALSE.
+ <P>
+ @param bForce: same as in check
+ @see check
+ @see resetSurpressed
+ </P>
+ */
+ boolean checkWithDialog([in] boolean bForce);
+
+ /** Shows a dialog if the font "StarBats" or "StarMath" is missing.
+ <P>
+ The dialog shows which font(s) is/are missing and have a checkbox,
+ that represents the state of the flag surpressed. This dialog is
+ the only way to set the flag surpressed to TRUE. This method is
+ not affected by the value of the flag surpressed.
+ @see resetSurpressed
+ </P>
+ */
+ boolean executeDialog();
+
+ /** Set flag surpressed to FALSE
+ <P>
+ The flag surpressed is stored in the registry. If surpressed is
+ FALSE the methods check and checkWithDialog ignores the parameter
+ bForce. if surpressed is TRUE check and checkWithDialog only
+ perform any action if their parameter bForce is TRUE. otherwise
+ they simply return TRUE.
+ </P>
+ */
+ void resetSurpressed();
+ };
+
+/*-------------- services -------------------------------------------
+ This service is the implementation of the interface XOInstChk.
+ @version 1.0
+ @author Berndt Reinhold
+ */
+
+ service OInstChkService
+ {
+ interface XOInstChk;
+ };
+
+//-------------------------------------------------------------------
+
+ }; // installation
+}; // stardiv
+
+#endif
diff --git a/extensions/stardiv/pgp/makefile.mk b/extensions/stardiv/pgp/makefile.mk
new file mode 100644
index 000000000..561a1fdf1
--- /dev/null
+++ b/extensions/stardiv/pgp/makefile.mk
@@ -0,0 +1,88 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:54 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+prjpch=
+
+PRJ=..$/..
+
+PRJNAME=extensions
+TARGET=pgpidl
+IDLMAP=stardiv$/usrmap.idl
+PACKAGE=stardiv$/extensions$/pgp
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+#javauno=
+
+# --- Files --------------------------------------------------------
+
+JARFILES+= usr.jar
+IDLFILES= pgp.idl
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.cpp b/extensions/test/ole/AxTestComponents/AxTestComponents.cpp
new file mode 100644
index 000000000..58d088a01
--- /dev/null
+++ b/extensions/test/ole/AxTestComponents/AxTestComponents.cpp
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * $RCSfile: AxTestComponents.cpp,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+// Note: Proxy/Stub Information
+// To build a separate proxy/stub DLL,
+// run nmake -f AxTestComponentsps.mk in the project directory.
+
+#include "stdafx.h"
+#include "resource.h"
+#include <initguid.h>
+#include "AxTestComponents.h"
+
+#include "AxTestComponents_i.c"
+#include "Basic.h"
+
+
+CComModule _Module;
+
+BEGIN_OBJECT_MAP(ObjectMap)
+OBJECT_ENTRY(CLSID_Basic, CBasic)
+END_OBJECT_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// DLL Entry Point
+
+extern "C"
+BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
+{
+ if (dwReason == DLL_PROCESS_ATTACH)
+ {
+ _Module.Init(ObjectMap, hInstance, &LIBID_AXTESTCOMPONENTSLib);
+ DisableThreadLibraryCalls(hInstance);
+ }
+ else if (dwReason == DLL_PROCESS_DETACH)
+ _Module.Term();
+ return TRUE; // ok
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Used to determine whether the DLL can be unloaded by OLE
+
+STDAPI DllCanUnloadNow(void)
+{
+ return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Returns a class factory to create an object of the requested type
+
+STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
+{
+ return _Module.GetClassObject(rclsid, riid, ppv);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// DllRegisterServer - Adds entries to the system registry
+
+STDAPI DllRegisterServer(void)
+{
+ // registers object, typelib and all interfaces in typelib
+ return _Module.RegisterServer(TRUE);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// DllUnregisterServer - Removes entries from the system registry
+
+STDAPI DllUnregisterServer(void)
+{
+ return _Module.UnregisterServer(TRUE);
+}
+
+
diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.def b/extensions/test/ole/AxTestComponents/AxTestComponents.def
new file mode 100644
index 000000000..6c19f0c53
--- /dev/null
+++ b/extensions/test/ole/AxTestComponents/AxTestComponents.def
@@ -0,0 +1,9 @@
+; AxTestComponents.def : Declares the module parameters.
+
+LIBRARY "AxTestComponents.DLL"
+
+EXPORTS
+ DllCanUnloadNow @1 PRIVATE
+ DllGetClassObject @2 PRIVATE
+ DllRegisterServer @3 PRIVATE
+ DllUnregisterServer @4 PRIVATE
diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.dsp b/extensions/test/ole/AxTestComponents/AxTestComponents.dsp
new file mode 100644
index 000000000..77c14a7dd
--- /dev/null
+++ b/extensions/test/ole/AxTestComponents/AxTestComponents.dsp
@@ -0,0 +1,323 @@
+# Microsoft Developer Studio Project File - Name="AxTestComponents" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=AxTestComponents - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "AxTestComponents.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "AxTestComponents.mak" CFG="AxTestComponents - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "AxTestComponents - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "AxTestComponents - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "AxTestComponents - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "AxTestComponents - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "AxTestComponents - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "AxTestComponents - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "AxTestComponents - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# Begin Custom Build - Performing registration
+OutDir=.\Debug
+TargetPath=.\Debug\AxTestComponents.dll
+InputPath=.\Debug\AxTestComponents.dll
+SOURCE="$(InputPath)"
+
+"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ regsvr32 /s /c "$(TargetPath)"
+ echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Unicode Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "DebugU"
+# PROP BASE Intermediate_Dir "DebugU"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "DebugU"
+# PROP Intermediate_Dir "DebugU"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# Begin Custom Build - Performing registration
+OutDir=.\DebugU
+TargetPath=.\DebugU\AxTestComponents.dll
+InputPath=.\DebugU\AxTestComponents.dll
+SOURCE="$(InputPath)"
+
+"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ if "%OS%"=="" goto NOTNT
+ if not "%OS%"=="Windows_NT" goto NOTNT
+ regsvr32 /s /c "$(TargetPath)"
+ echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
+ goto end
+ :NOTNT
+ echo Warning : Cannot register Unicode DLL on Windows 95
+ :end
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Release MinSize"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ReleaseMinSize"
+# PROP BASE Intermediate_Dir "ReleaseMinSize"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ReleaseMinSize"
+# PROP Intermediate_Dir "ReleaseMinSize"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# Begin Custom Build - Performing registration
+OutDir=.\ReleaseMinSize
+TargetPath=.\ReleaseMinSize\AxTestComponents.dll
+InputPath=.\ReleaseMinSize\AxTestComponents.dll
+SOURCE="$(InputPath)"
+
+"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ regsvr32 /s /c "$(TargetPath)"
+ echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Release MinDependency"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ReleaseMinDependency"
+# PROP BASE Intermediate_Dir "ReleaseMinDependency"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ReleaseMinDependency"
+# PROP Intermediate_Dir "ReleaseMinDependency"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# Begin Custom Build - Performing registration
+OutDir=.\ReleaseMinDependency
+TargetPath=.\ReleaseMinDependency\AxTestComponents.dll
+InputPath=.\ReleaseMinDependency\AxTestComponents.dll
+SOURCE="$(InputPath)"
+
+"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ regsvr32 /s /c "$(TargetPath)"
+ echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Unicode Release MinSize"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ReleaseUMinSize"
+# PROP BASE Intermediate_Dir "ReleaseUMinSize"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ReleaseUMinSize"
+# PROP Intermediate_Dir "ReleaseUMinSize"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# Begin Custom Build - Performing registration
+OutDir=.\ReleaseUMinSize
+TargetPath=.\ReleaseUMinSize\AxTestComponents.dll
+InputPath=.\ReleaseUMinSize\AxTestComponents.dll
+SOURCE="$(InputPath)"
+
+"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ if "%OS%"=="" goto NOTNT
+ if not "%OS%"=="Windows_NT" goto NOTNT
+ regsvr32 /s /c "$(TargetPath)"
+ echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
+ goto end
+ :NOTNT
+ echo Warning : Cannot register Unicode DLL on Windows 95
+ :end
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "AxTestComponents - Win32 Unicode Release MinDependency"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ReleaseUMinDependency"
+# PROP BASE Intermediate_Dir "ReleaseUMinDependency"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ReleaseUMinDependency"
+# PROP Intermediate_Dir "ReleaseUMinDependency"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# Begin Custom Build - Performing registration
+OutDir=.\ReleaseUMinDependency
+TargetPath=.\ReleaseUMinDependency\AxTestComponents.dll
+InputPath=.\ReleaseUMinDependency\AxTestComponents.dll
+SOURCE="$(InputPath)"
+
+"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ if "%OS%"=="" goto NOTNT
+ if not "%OS%"=="Windows_NT" goto NOTNT
+ regsvr32 /s /c "$(TargetPath)"
+ echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
+ goto end
+ :NOTNT
+ echo Warning : Cannot register Unicode DLL on Windows 95
+ :end
+
+# End Custom Build
+
+!ENDIF
+
+# Begin Target
+
+# Name "AxTestComponents - Win32 Debug"
+# Name "AxTestComponents - Win32 Unicode Debug"
+# Name "AxTestComponents - Win32 Release MinSize"
+# Name "AxTestComponents - Win32 Release MinDependency"
+# Name "AxTestComponents - Win32 Unicode Release MinSize"
+# Name "AxTestComponents - Win32 Unicode Release MinDependency"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\AxTestComponents.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\AxTestComponents.def
+# End Source File
+# Begin Source File
+
+SOURCE=.\AxTestComponents.idl
+# ADD MTL /tlb ".\AxTestComponents.tlb" /h "AxTestComponents.h" /iid "AxTestComponents_i.c" /Oicf
+# End Source File
+# Begin Source File
+
+SOURCE=.\AxTestComponents.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\Basic.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.cpp
+# ADD CPP /Yc"stdafx.h"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Basic.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Basic.rgs
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.idl b/extensions/test/ole/AxTestComponents/AxTestComponents.idl
new file mode 100644
index 000000000..3885bc19f
--- /dev/null
+++ b/extensions/test/ole/AxTestComponents/AxTestComponents.idl
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * $RCSfile: AxTestComponents.idl,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// AxTestComponents.idl : IDL source for AxTestComponents.dll
+//
+
+// This file will be processed by the MIDL tool to
+// produce the type library (AxTestComponents.tlb) and marshalling code.
+
+import "oaidl.idl";
+import "ocidl.idl";
+ [
+ object,
+ uuid(BFE10EBD-8584-11D4-8335-005004526AB4),
+ dual,
+ helpstring("IBasic Interface"),
+ pointer_default(unique)
+ ]
+ interface IBasic : IDispatch
+ {
+ [id(1), helpstring("method inByte")] HRESULT inByte([in] unsigned char val);
+ [id(2), helpstring("method inShort")] HRESULT inShort([in] short val);
+ [id(3), helpstring("method inLong")] HRESULT inLong([in] long val);
+ [id(4), helpstring("method inString")] HRESULT inString([in] BSTR val);
+ [id(5), helpstring("method inFloat")] HRESULT inFloat([in] float val);
+ [id(6), helpstring("method inDouble")] HRESULT inDouble([in] double val);
+ [id(7), helpstring("method inVariant")] HRESULT inVariant([in] VARIANT val);
+ [id(8), helpstring("method inArray")] HRESULT inArray([in] SAFEARRAY(VARIANT) val);
+ [id(9), helpstring("method inObject")] HRESULT inObject([in] IDispatch* val);
+ [id(12), helpstring("method inoutByte")] HRESULT inoutByte([in,out] unsigned char* val);
+ [id(13), helpstring("method inoutShort")] HRESULT inoutShort([in,out] short* val);
+ [id(14), helpstring("method inoutLong")] HRESULT inoutLong([in,out] long * val);
+ [id(15), helpstring("method inoutString")] HRESULT inoutString([in, out] BSTR* val);
+ [id(16), helpstring("method inoutFloat")] HRESULT inoutFloat([in,out] float * val);
+ [id(17), helpstring("method inoutDouble")] HRESULT inoutDouble([in,out] double * val);
+ [id(18), helpstring("method inoutVariant")] HRESULT inoutVariant([in,out] VARIANT * val);
+ [id(19), helpstring("method inoutArray")] HRESULT inoutArray([in,out] SAFEARRAY(VARIANT) * val);
+ [id(20), helpstring("method inoutObject")] HRESULT inoutObject([in,out] IDispatch** val);
+ [id(23), helpstring("method outByte")] HRESULT outByte([out] unsigned char* val);
+ [id(24), helpstring("method outShort")] HRESULT outShort([out] short* val);
+ [id(25), helpstring("method outLong")] HRESULT outLong([out] long* val);
+ [id(26), helpstring("method outString")] HRESULT outString([out] BSTR* val);
+ [id(27), helpstring("method outFloat")] HRESULT outFloat([out] float* val);
+ [id(28), helpstring("method outDouble")] HRESULT outDouble([out] double* val);
+ [id(29), helpstring("method outVariant")] HRESULT outVariant([out] VARIANT* val);
+ [id(30), helpstring("method outArray")] HRESULT outArray([out] SAFEARRAY(VARIANT) * val);
+ [id(31), helpstring("method outObject")] HRESULT outObject([out] IDispatch** val);
+ [propget, id(34), helpstring("property prpByte")] HRESULT prpByte([out, retval] unsigned char *pVal);
+ [propput, id(34), helpstring("property prpByte")] HRESULT prpByte([in] unsigned char newVal);
+ [propget, id(35), helpstring("property prpShort")] HRESULT prpShort([out, retval] short *pVal);
+ [propput, id(35), helpstring("property prpShort")] HRESULT prpShort([in] short newVal);
+ [propget, id(36), helpstring("property prpLong")] HRESULT prpLong([out, retval] long *pVal);
+ [propput, id(36), helpstring("property prpLong")] HRESULT prpLong([in] long newVal);
+ [propget, id(37), helpstring("property prpString")] HRESULT prpString([out, retval] BSTR *pVal);
+ [propput, id(37), helpstring("property prpString")] HRESULT prpString([in] BSTR newVal);
+ [propget, id(38), helpstring("property prpFloat")] HRESULT prpFloat([out, retval] float *pVal);
+ [propput, id(38), helpstring("property prpFloat")] HRESULT prpFloat([in] float newVal);
+ [propget, id(39), helpstring("property prpDouble")] HRESULT prpDouble([out, retval] double *pVal);
+ [propput, id(39), helpstring("property prpDouble")] HRESULT prpDouble([in] double newVal);
+ [propget, id(40), helpstring("property prpVariant")] HRESULT prpVariant([out, retval] VARIANT *pVal);
+ [propput, id(40), helpstring("property prpVariant")] HRESULT prpVariant([in] VARIANT newVal);
+ [propget, id(41), helpstring("property prpArray")] HRESULT prpArray([out, retval]SAFEARRAY(VARIANT) *pVal);
+ [propput, id(41), helpstring("property prpArray")] HRESULT prpArray([in] SAFEARRAY(VARIANT) newVal);
+ [propget, id(42), helpstring("property prpObject")] HRESULT prpObject([out, retval] IDispatch* *pVal);
+ [propput, id(42), helpstring("property prpObject")] HRESULT prpObject([in] IDispatch* newVal);
+ [id(43), helpstring("method mixed1")] HRESULT mixed1(
+ [in] unsigned char aChar,
+ [out] unsigned char *outChar,
+ [in, out] unsigned char* inoutChar,
+ [in] VARIANT var,
+ [out] VARIANT* outVar,
+ [in,out] VARIANT* inoutVar,
+ [in] SAFEARRAY(VARIANT) ar,
+ [out] SAFEARRAY(VARIANT)* outAr,
+ [in,out] SAFEARRAY(VARIANT)* inoutAr,
+ [in] IDispatch *disp,
+ [out] IDispatch** outDisp,
+ [in,out] IDispatch** inoutDisp);
+ [id(44), helpstring("method inSequenceLong")] HRESULT inSequenceLong([in] SAFEARRAY(long) ar);
+
+ };
+
+[
+ uuid(BFE10EB1-8584-11D4-8335-005004526AB4),
+ version(1.0),
+ helpstring("AxTestComponents 1.0 Type Library")
+]
+library AXTESTCOMPONENTSLib
+{
+ importlib("stdole32.tlb");
+ importlib("stdole2.tlb");
+
+ [
+ uuid(BFE10EBE-8584-11D4-8335-005004526AB4),
+ helpstring("Basic Class")
+ ]
+ coclass Basic
+ {
+ [default] interface IBasic;
+ };
+};
diff --git a/extensions/test/ole/AxTestComponents/AxTestComponents.rc b/extensions/test/ole/AxTestComponents/AxTestComponents.rc
new file mode 100644
index 000000000..4224fae2f
--- /dev/null
+++ b/extensions/test/ole/AxTestComponents/AxTestComponents.rc
@@ -0,0 +1,198 @@
+/*************************************************************************
+*
+* $RCSfile: AxTestComponents.rc,v $
+*
+* $Revision: 1.1.1.1 $
+*
+* last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+*
+* The Contents of this file are made available subject to the terms of
+* either of the following licenses
+*
+* - GNU Lesser General Public License Version 2.1
+* - Sun Industry Standards Source License Version 1.1
+*
+* Sun Microsystems Inc., October, 2000
+*
+* GNU Lesser General Public License Version 2.1
+* =============================================
+* Copyright 2000 by Sun Microsystems, Inc.
+* 901 San Antonio Road, Palo Alto, CA 94303, USA
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License version 2.1, as published by the Free Software Foundation.
+*
+* This library 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 for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+* MA 02111-1307 USA
+*
+*
+* Sun Industry Standards Source License Version 1.1
+* =================================================
+* The contents of this file are subject to the Sun Industry Standards
+* Source License Version 1.1 (the "License"); You may not use this file
+* except in compliance with the License. You may obtain a copy of the
+* License at http://www.openoffice.org/license.html.
+*
+* Software provided under this License is provided on an "AS IS" basis,
+* WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+* WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+* See the License for the specific provisions governing your rights and
+* obligations concerning the Software.
+*
+* The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+*
+* Copyright: 2000 by Sun Microsystems, Inc.
+*
+* All Rights Reserved.
+*
+* Contributor(s): _______________________________________
+*
+*
+*
+**************************************************************************/
+
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// German (Germany) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
+#ifdef _WIN32
+LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// REGISTRY
+//
+
+IDR_BASIC REGISTRY DISCARDABLE "Basic.rgs"
+#endif // German (Germany) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""winres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "1 TYPELIB ""AxTestComponents.tlb""\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "CompanyName", "\0"
+ VALUE "FileDescription", "AxTestComponents Module\0"
+ VALUE "FileVersion", "1, 0, 0, 1\0"
+ VALUE "InternalName", "AxTestComponents\0"
+ VALUE "LegalCopyright", "Copyright 2000\0"
+ VALUE "OriginalFilename", "AxTestComponents.DLL\0"
+ VALUE "ProductName", "AxTestComponents Module\0"
+ VALUE "ProductVersion", "1, 0, 0, 1\0"
+ VALUE "OLESelfRegister", "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_PROJNAME "AxTestComponents"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+1 TYPELIB "AxTestComponents.tlb"
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/extensions/test/ole/AxTestComponents/Basic.cpp b/extensions/test/ole/AxTestComponents/Basic.cpp
new file mode 100644
index 000000000..737f8a459
--- /dev/null
+++ b/extensions/test/ole/AxTestComponents/Basic.cpp
@@ -0,0 +1,523 @@
+/*************************************************************************
+ *
+ * $RCSfile: Basic.cpp,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "stdafx.h"
+#include "AxTestComponents.h"
+#include "Basic.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CBasic
+
+
+STDMETHODIMP CBasic::inByte(unsigned char val)
+{
+ USES_CONVERSION;
+ char buf[256];
+ sprintf( buf, "inByte: value= %d", val);
+ MessageBox( NULL, _T(A2T(buf)), _T("AxTestComponents.Basic"), MB_OK);
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inShort(short val)
+{
+ USES_CONVERSION;
+ char buf[256];
+ sprintf( buf, "inByte: value= %d", val);
+ MessageBox( NULL, _T(A2T(buf)), _T("AxTestComponents.Basic"), MB_OK);
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inLong(long val)
+{
+ USES_CONVERSION;
+ char buf[256];
+ sprintf( buf, "inLong: value= %d", val);
+ MessageBox( NULL, _T(A2T(buf)), _T("AxTestComponents.Basic"), MB_OK);
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inString(BSTR val)
+{
+ USES_CONVERSION;
+ char buf[256];
+ sprintf( buf, "inString: value= %S", val);
+ MessageBox( NULL, _T(A2T(buf)), _T("AxTestComponents.Basic"), MB_OK);
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inFloat(float val)
+{
+ USES_CONVERSION;
+ char buf[256];
+ sprintf( buf, "inFloat: value= %f", val);
+ MessageBox( NULL, _T(A2T(buf)), _T("AxTestComponents.Basic"), MB_OK);
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inDouble(double val)
+{
+ USES_CONVERSION;
+ char buf[256];
+ sprintf( buf, "inDouble: value= %g", val);
+ MessageBox( NULL, _T(A2T(buf)), _T("AxTestComponents.Basic"), MB_OK);
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inVariant(VARIANT val)
+{
+ USES_CONVERSION;
+ CComVariant var;
+ VariantCopyInd( &var, &val);
+ if( var.vt == VT_BSTR)
+ {
+ char buf[256];
+ sprintf( buf, "inVariant: value= %S", var.bstrVal);
+ MessageBox( NULL, _T(A2T(buf)), _T("AxTestComponents.Basic"), MB_OK);
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inArray(LPSAFEARRAY val)
+{
+ HRESULT hr= S_OK;
+ long lbound= 0;
+
+ long ubound= 0;
+ hr= SafeArrayGetLBound( val, 1, &lbound);
+ hr= SafeArrayGetUBound( val, 1, &ubound);
+ long length= ubound - lbound +1;
+
+ CComVariant varElement;
+ char buf[4096];
+ ZeroMemory( buf, 10);
+ for( long i= 0; i < length ; i++)
+ {
+ varElement.Clear();
+ hr= SafeArrayGetElement( val, &i, &varElement);
+
+ if( varElement.vt == VT_BSTR)
+ { char bufTmp[256];
+ sprintf( bufTmp, " %d string: = %S \n", i, varElement.bstrVal);
+ strcat( buf, bufTmp);
+ }
+ }
+ MessageBox( NULL, _T(A2T(buf)), _T("AxTestComponents.Basic"), MB_OK);
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inObject(IDispatch *val)
+{
+ // We expect the object to be an AxTestComponent.Basic object
+ // with the property prpString set.
+ HRESULT hr= S_OK;
+ USES_CONVERSION;
+ char buf[256];
+ CComDispatchDriver disp( val);
+ CComBSTR bstr;
+ if( disp)
+ {
+ CComVariant var;
+ hr= disp.GetPropertyByName(L"prpString", &var);
+ if( var.vt== VT_BSTR)
+ bstr= var.bstrVal;
+ }
+ sprintf( buf, "inObject: value= %S", bstr.m_str);
+ MessageBox( NULL, _T(A2T(buf)), _T("AxTestComponents.Basic"), MB_OK);
+
+ return S_OK;
+}
+
+
+
+STDMETHODIMP CBasic::inoutByte(unsigned char* val)
+{
+ *val+= 1;
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inoutShort(short *val)
+{
+ *val+= 1;
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inoutLong(long *val)
+{
+ *val+= 1;
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inoutString(BSTR *val)
+{
+ MessageBoxW( NULL, *val, L"AxTestComponents.Basic", MB_OK);
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inoutFloat(float *val)
+{
+ *val+= 1;
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inoutDouble(double *val)
+{
+ *val+= 1;
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inoutVariant(VARIANT *val)
+{
+ if( val->vt & VT_BSTR)
+ {
+ MessageBoxW( NULL, val->bstrVal, L"AxTestComponents.Basic", MB_OK);
+ SysFreeString( val->bstrVal);
+ val->bstrVal= SysAllocString(L" a string from AxTestComponents.Basic");
+ }
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inoutArray(LPSAFEARRAY *val)
+{
+ inArray(*val);
+ SafeArrayDestroy(*val);
+ outArray( val);
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::inoutObject(IDispatch **val)
+{
+ inObject( *val);
+ outObject( val);
+ return S_OK;
+}
+
+
+
+STDMETHODIMP CBasic::outByte(unsigned char *val)
+{
+ *val= 111;
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::outShort(short *val)
+{
+ *val= 1111;
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::outLong(long *val)
+{
+ *val= 111111;
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::outString(BSTR *val)
+{
+ *val= SysAllocString(L" a string as out value");
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::outFloat(float *val)
+{
+ *val= 3.14;
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::outDouble(double *val)
+{
+ *val= 3.145;
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::outVariant(VARIANT *val)
+{
+ val->vt = VT_BSTR;
+ val->bstrVal= SysAllocString(L"This is a string in a VARIANT");
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::outArray(LPSAFEARRAY *val)
+{
+ HRESULT hr= S_OK;
+ SAFEARRAY* ar= SafeArrayCreateVector( VT_VARIANT, 0, 3);
+ CComVariant arStrings[3]; //BSTR arStrings[3];
+ arStrings[0].bstrVal= SysAllocString(L" out string 0");
+ arStrings[0].vt= VT_BSTR;
+ arStrings[1].bstrVal= SysAllocString( L"out string 1");
+ arStrings[1].vt= VT_BSTR;
+ arStrings[2].bstrVal= SysAllocString( L" outstring 2");
+ arStrings[2].vt= VT_BSTR;
+ for( long i= 0; i < 3; i++)
+ {
+ SafeArrayPutElement( ar, &i, (void*) &arStrings[i]);
+ }
+ *val= ar;
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::outObject(IDispatch* *val)
+{
+ HRESULT hr= S_OK;
+ CComPtr< IUnknown > spUnk;
+ hr= spUnk.CoCreateInstance(L"AxTestComponents.Basic");
+ CComDispatchDriver disp( spUnk);
+ CComVariant varVal( L"This is the property prp String");
+ hr= disp.PutPropertyByName( L"prpString", &varVal);
+ *val= disp;
+ (*val)->AddRef();
+ return S_OK;
+}
+
+
+
+
+STDMETHODIMP CBasic::get_prpByte(unsigned char *pVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::put_prpByte(unsigned char newVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::get_prpShort(short *pVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::put_prpShort(short newVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::get_prpLong(long *pVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::put_prpLong(long newVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::get_prpString(BSTR *pVal)
+{
+ m_bstrPrpString.CopyTo( pVal );
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::put_prpString(BSTR newVal)
+{
+ m_bstrPrpString= newVal;
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::get_prpFloat(float *pVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::put_prpFloat(float newVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::get_prpDouble(double *pVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::put_prpDouble(double newVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::get_prpVariant(VARIANT *pVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::put_prpVariant(VARIANT newVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::get_prpArray(LPSAFEARRAY *pVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::put_prpArray(LPSAFEARRAY newVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::get_prpObject(IDispatch **pVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::put_prpObject(IDispatch *newVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CBasic::mixed1(
+ /* [in] */ unsigned char aChar,
+ /* [out] */ unsigned char __RPC_FAR *outChar,
+ /* [out][in] */ unsigned char __RPC_FAR *inoutChar,
+ /* [in] */ VARIANT var,
+ /* [out] */ VARIANT __RPC_FAR *outVar,
+ /* [out][in] */ VARIANT __RPC_FAR *inoutVar,
+ /* [in] */ SAFEARRAY __RPC_FAR * ar,
+ /* [out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *outAr,
+ /* [out][in] */ SAFEARRAY __RPC_FAR * __RPC_FAR *inoutAr,
+ /* [in] */ IDispatch __RPC_FAR *disp,
+ /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *outDisp,
+ /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *inoutDisp)
+{
+ HRESULT hr= S_OK;
+ inByte( aChar);
+ outByte( outChar);
+ inoutByte( inoutChar);
+ inVariant( var);
+ outVariant( outVar);
+ inoutVariant( inoutVar);
+ inArray( ar);
+ outArray( outAr);
+ inoutArray( inoutAr);
+ inObject( disp);
+ outObject( outDisp);
+ inoutObject( inoutDisp);
+ return hr;
+}
+
+
+
+
+// VT_UI1
+
+STDMETHODIMP CBasic::inSequenceLong(LPSAFEARRAY val)
+{
+ HRESULT hr= S_OK;
+ long lbound=0;
+ long ubound= 0;
+ hr= SafeArrayGetLBound( val, 1, &lbound);
+ hr= SafeArrayGetUBound( val, 1, &ubound);
+ long length= ubound - lbound +1;
+
+ CComVariant varElement;
+ char buf[4096];
+ ZeroMemory( buf, 10);
+ for( long i= 0; i < length ; i++)
+ {
+ varElement.Clear();
+ hr= SafeArrayGetElement( val, &i, &varElement);
+
+ if( varElement.vt == VT_BSTR)
+ { char bufTmp[256];
+ sprintf( bufTmp, " %d string: = %d \n", i, varElement.lVal);
+ strcat( buf, bufTmp);
+ }
+ }
+ MessageBox( NULL, _T(A2T(buf)), _T("AxTestComponents.Basic"), MB_OK);
+
+ return S_OK;
+}
diff --git a/extensions/test/ole/AxTestComponents/Basic.h b/extensions/test/ole/AxTestComponents/Basic.h
new file mode 100644
index 000000000..babb2d8b3
--- /dev/null
+++ b/extensions/test/ole/AxTestComponents/Basic.h
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * $RCSfile: Basic.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// Basic.h : Declaration of the CBasic
+
+#ifndef __BASIC_H_
+#define __BASIC_H_
+
+#include "resource.h" // main symbols
+
+/////////////////////////////////////////////////////////////////////////////
+// CBasic
+class ATL_NO_VTABLE CBasic :
+ public CComObjectRootEx<CComSingleThreadModel>,
+ public CComCoClass<CBasic, &CLSID_Basic>,
+ public IDispatchImpl<IBasic, &IID_IBasic, &LIBID_AXTESTCOMPONENTSLib>
+{
+public:
+ CBasic()
+ {
+ }
+
+DECLARE_REGISTRY_RESOURCEID(IDR_BASIC)
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+BEGIN_COM_MAP(CBasic)
+ COM_INTERFACE_ENTRY(IBasic)
+ COM_INTERFACE_ENTRY(IDispatch)
+END_COM_MAP()
+
+// IBasic
+public:
+ STDMETHOD(inSequenceLong)(LPSAFEARRAY ar);
+ STDMETHOD(mixed1)(
+ /* [in] */ unsigned char aChar,
+ /* [out] */ unsigned char __RPC_FAR *outChar,
+ /* [out][in] */ unsigned char __RPC_FAR *inoutChar,
+ /* [in] */ VARIANT var,
+ /* [out] */ VARIANT __RPC_FAR *outVar,
+ /* [out][in] */ VARIANT __RPC_FAR *inoutVar,
+ /* [in] */ SAFEARRAY __RPC_FAR * ar,
+ /* [out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *outAr,
+ /* [out][in] */ SAFEARRAY __RPC_FAR * __RPC_FAR *inoutAr,
+ /* [in] */ IDispatch __RPC_FAR *disp,
+ /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *outDisp,
+ /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *inoutDisp) ;
+
+ STDMETHOD(get_prpObject)(/*[out, retval]*/ IDispatch* *pVal);
+ STDMETHOD(put_prpObject)(/*[in]*/ IDispatch* newVal);
+ STDMETHOD(get_prpArray)(/*[out, retval]*/ LPSAFEARRAY *pVal);
+ STDMETHOD(put_prpArray)(/*[in]*/ LPSAFEARRAY newVal);
+ STDMETHOD(get_prpVariant)(/*[out, retval]*/ VARIANT *pVal);
+ STDMETHOD(put_prpVariant)(/*[in]*/ VARIANT newVal);
+ STDMETHOD(get_prpDouble)(/*[out, retval]*/ double *pVal);
+ STDMETHOD(put_prpDouble)(/*[in]*/ double newVal);
+ STDMETHOD(get_prpFloat)(/*[out, retval]*/ float *pVal);
+ STDMETHOD(put_prpFloat)(/*[in]*/ float newVal);
+ STDMETHOD(get_prpString)(/*[out, retval]*/ BSTR *pVal);
+ STDMETHOD(put_prpString)(/*[in]*/ BSTR newVal);
+ STDMETHOD(get_prpLong)(/*[out, retval]*/ long *pVal);
+ STDMETHOD(put_prpLong)(/*[in]*/ long newVal);
+ STDMETHOD(get_prpShort)(/*[out, retval]*/ short *pVal);
+ STDMETHOD(put_prpShort)(/*[in]*/ short newVal);
+ STDMETHOD(get_prpByte)(/*[out, retval]*/ unsigned char *pVal);
+ STDMETHOD(put_prpByte)(/*[in]*/ unsigned char newVal);
+
+ STDMETHOD(outObject)(/*[out]*/ IDispatch* *val);
+ STDMETHOD(outArray)(/*[out]*/ LPSAFEARRAY * val);
+ STDMETHOD(outVariant)(/*[out]*/ VARIANT* val);
+ STDMETHOD(outDouble)(/*[out]*/ double* val);
+ STDMETHOD(outFloat)(/*[out]*/ float* val);
+ STDMETHOD(outString)(/*[out]*/ BSTR* val);
+ STDMETHOD(outLong)(/*[out]*/ long* val);
+ STDMETHOD(outShort)(/*[out]*/ short* val);
+ STDMETHOD(outByte)(/*[out]*/ unsigned char* val);
+
+ STDMETHOD(inoutObject)(/*[in,out]*/ IDispatch* *val);
+ STDMETHOD(inoutArray)(/*[in,out]*/ LPSAFEARRAY * val);
+ STDMETHOD(inoutVariant)(/*[in,out]*/ VARIANT * val);
+ STDMETHOD(inoutDouble)(/*[in,out]*/ double * val);
+ STDMETHOD(inoutFloat)(/*[in,out]*/ float * val);
+ STDMETHOD(inoutString)(/*[in, out]*/ BSTR* val);
+ STDMETHOD(inoutLong)(/*[in,out]*/ long * val);
+ STDMETHOD(inoutShort)(/*[in,out]*/ short* val);
+ STDMETHOD(inoutByte)(/*[in,out]*/ unsigned char* val);
+
+ STDMETHOD(inObject)(/*[in]*/ IDispatch* val);
+ STDMETHOD(inArray)(/*[in]*/ LPSAFEARRAY val);
+ STDMETHOD(inVariant)(/*[in]*/ VARIANT val);
+ STDMETHOD(inDouble)(/*[in]*/ double val);
+ STDMETHOD(inFloat)(/*[in]*/ float val);
+ STDMETHOD(inString)(/*[in]*/ BSTR val);
+ STDMETHOD(inLong)(/*[in]*/ long val);
+ STDMETHOD(inShort)(/*[in]*/ short val);
+ STDMETHOD(inByte)(/*[in]*/ unsigned char val);
+
+
+ CComBSTR m_bstrPrpString;
+};
+
+#endif //__BASIC_H_
+
diff --git a/extensions/test/ole/AxTestComponents/Basic.rgs b/extensions/test/ole/AxTestComponents/Basic.rgs
new file mode 100644
index 000000000..97dee4860
--- /dev/null
+++ b/extensions/test/ole/AxTestComponents/Basic.rgs
@@ -0,0 +1,26 @@
+HKCR
+{
+ AxTestComponents.Basic.1 = s 'Basic Class'
+ {
+ CLSID = s '{BFE10EBE-8584-11D4-8335-005004526AB4}'
+ }
+ AxTestComponents.Basic = s 'Basic Class'
+ {
+ CLSID = s '{BFE10EBE-8584-11D4-8335-005004526AB4}'
+ CurVer = s 'AxTestComponents.Basic.1'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {BFE10EBE-8584-11D4-8335-005004526AB4} = s 'Basic Class'
+ {
+ ProgID = s 'AxTestComponents.Basic.1'
+ VersionIndependentProgID = s 'AxTestComponents.Basic'
+ ForceRemove 'Programmable'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Apartment'
+ }
+ 'TypeLib' = s '{BFE10EB1-8584-11D4-8335-005004526AB4}'
+ }
+ }
+}
diff --git a/extensions/test/ole/AxTestComponents/StdAfx.cpp b/extensions/test/ole/AxTestComponents/StdAfx.cpp
new file mode 100644
index 000000000..537d9fdc9
--- /dev/null
+++ b/extensions/test/ole/AxTestComponents/StdAfx.cpp
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * $RCSfile: StdAfx.cpp,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include "stdafx.h"
+
+#ifdef _ATL_STATIC_REGISTRY
+#include <statreg.h>
+#include <statreg.cpp>
+#endif
+
+#include <atlimpl.cpp>
diff --git a/extensions/test/ole/AxTestComponents/StdAfx.h b/extensions/test/ole/AxTestComponents/StdAfx.h
new file mode 100644
index 000000000..3bfa08622
--- /dev/null
+++ b/extensions/test/ole/AxTestComponents/StdAfx.h
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * $RCSfile: StdAfx.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#if !defined(AFX_STDAFX_H__BFE10EB4_8584_11D4_8335_005004526AB4__INCLUDED_)
+#define AFX_STDAFX_H__BFE10EB4_8584_11D4_8335_005004526AB4__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define STRICT
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0400
+#endif
+#define _ATL_APARTMENT_THREADED
+
+#include <atlbase.h>
+//You may derive a class from CComModule and use it if you want to override
+//something, but do not change the name of _Module
+extern CComModule _Module;
+#include <atlcom.h>
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__BFE10EB4_8584_11D4_8335_005004526AB4__INCLUDED)
diff --git a/extensions/test/ole/AxTestComponents/resource.h b/extensions/test/ole/AxTestComponents/resource.h
new file mode 100644
index 000000000..b124b37d9
--- /dev/null
+++ b/extensions/test/ole/AxTestComponents/resource.h
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: resource.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by AxTestComponents.rc
+//
+#define IDS_PROJNAME 100
+#define IDR_BASIC 101
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 201
+#define _APS_NEXT_COMMAND_VALUE 32768
+#define _APS_NEXT_CONTROL_VALUE 201
+#define _APS_NEXT_SYMED_VALUE 102
+#endif
+#endif
diff --git a/extensions/test/ole/JScriptNewStyle.htm b/extensions/test/ole/JScriptNewStyle.htm
new file mode 100644
index 000000000..d2b061d75
--- /dev/null
+++ b/extensions/test/ole/JScriptNewStyle.htm
@@ -0,0 +1,1039 @@
+<HTML>
+<HEAD>
+<META NAME="GENERATOR" Content="Microsoft Developer Studio">
+<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
+<TITLE>Document Title</TITLE>
+</HEAD>
+<BODY id=theBody>
+
+<script language="JScript">
+function callOleTest( id)
+{
+ var factory= new ActiveXObject("com.sun.star.ServiceManager");
+ var oletest= factory.createInstance("oletest.OleTest");
+// alert(oletest);
+
+ var arr= new Array( 1, 2, 3, 4, 0);
+ var arrDouble= new Array( 1.2345, 12.345, 123,45, 1234.5, 12345);
+ var arrBool= new Array( 1, 0, 2, 0, 3);
+ var arrChar= new Array( '1', 'A', "1", "A", ' ', 55, 56);
+ var arrString= new Array("hamburger","cheeseburger", "chicken nuggets", "chicken wings" , "pizza");
+ var arrAny= new Array( 100, 100.1235,"hallo");
+ var arrSeq= new Array( arr, arr, arr);
+ var arrSeq2= new Array( arrSeq, arrSeq, arrSeq)
+
+// var ob= new Object();
+// ob.value= "A JScript object";
+// var arrObject= new Array( ob, ob, ob);
+
+
+ var arrout1= new Array();
+ var arrout2= new Array();
+ var arrout3= new Array();
+
+ var ret, i;
+ var sfarray, sfarray1, sfarray2, sfarray3;
+ var value= oletest._GetValueObject();
+ var outValue= oletest._GetValueObject();
+ outValue.InitOutParam();
+ var outValue2= oletest._GetValueObject();
+ outValue2.InitOutParam();
+ var outValue3= oletest._GetValueObject();
+ outValue3.InitOutParam();
+
+ var inoutValue= oletest._GetValueObject();
+// inoutValue.InitInOutParam();
+
+ switch( id)
+ {
+ // Array in-params
+ case 1:
+ value.Set("[]byte", arr)
+ ret= oletest.methodByte( value);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arr.toString() + "<br>");
+ document.writeln( "Returns a Sequence&lt BYTE &gt <br>" + sfarray.toArray()) ; break;
+
+ case 2:
+ value.Set("[]double", arrDouble)
+ ret= oletest.methodDouble( value);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arrDouble.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt double &gt <br>" + sfarray.toArray()) ; break;
+
+ case 3:
+ value.Set("[]boolean", arrBool)
+ ret= oletest.methodBool( value);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arrBool.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt BOOL &gt <br>" + sfarray.toArray()) ; break;
+
+ case 4:
+ value.Set("[]short", arr)
+ ret= oletest.methodShort( value);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arr.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt SHORT &gt <br>" + sfarray.toArray()) ; break;
+
+ case 5:
+ value.Set("[]unsigned short", arr)
+ ret= oletest.methodUShort( value);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arr.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt unsigned SHORT &gt <br>" + sfarray.toArray()) ; break;
+
+ case 6:
+ value.Set("[]long", arr)
+ ret= oletest.methodLong( value);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arr.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt LONG &gt <br>" + sfarray.toArray()) ; break;
+
+ case 7:
+ value.Set("[]unsigned long", arr)
+ ret= oletest.methodULong( value);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arr.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt unsigned LONG &gt <br>" + sfarray.toArray()) ; break;
+
+ case 8:
+ value.Set("[]char", arrChar)
+ ret= oletest.methodChar( value);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arrChar.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt wchar_t &gt <br>" + sfarray.toArray()) ; break;
+
+ case 9:
+ value.Set("[]string", arrString)
+ ret= oletest.methodString( value);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arrString.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt UString &gt <br>" + sfarray.toArray()) ; break;
+
+ case 10:
+ value.Set("[]any", arrAny)
+ ret= oletest.methodAny( value);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arrAny.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt UsrAny &gt <br>" + sfarray.toArray() ) ; break;
+
+ case 11:
+ var allArray= new Array();
+ for(var i= 0; i <3; i++)
+ {
+ var value1= oletest._GetValueObject();
+ value1.Set("[]long", arr);
+ allArray[i]= value1;
+ }
+
+ value.Set("[][]long", allArray);
+
+ ret= oletest.methodSequence( value);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arrSeq.toString() +"<br>");
+ document.writeln("Returns a Sequence&lt Sequence &lt long &gt&gt <br>") ;
+ var arr1= new Array();
+ arr1= sfarray.toArray();
+ for( i=0; i < arr1.length; i++)
+ {
+ sfarray2= new VBArray( arr1[i]);
+ var arr2= new Array();
+ arr2= sfarray2.toArray();
+ document.writeln( arr2.toString() + "<br>" );
+ }
+ break;
+
+ case 12:
+ var array1= new Array();
+ for(var i= 0; i <3; i++)
+ {
+ var array2 = new Array();
+ for( var j= 0; j < 3; j++)
+ {
+ var value2= oletest._GetValueObject();
+ value2.Set("[]long", arr);
+ array2[j]= value2;
+ }
+
+ var value1= oletest._GetValueObject();
+ value1.Set("[][]long", array2)
+ array1[i]= value1;
+ }
+ var valueAll= oletest._GetValueObject();
+ valueAll.Set("[][][]long",array1);
+
+ ret= oletest.methodSequence2( valueAll);
+ document.writeln( "Param: " + arrSeq2.toString() +"<br>");
+ sfarray1= new VBArray( ret);
+ arr1= sfarray1.toArray();
+ for( i=0; i < arr1.length; i++)
+ {
+ sfarray2= new VBArray( arr1[i]);
+ arr2= sfarray2.toArray();
+
+ for ( j=0; j < arr2.length; j++)
+ {
+ sfarray3= new VBArray( arr2[j]);
+ arr3= sfarray3.toArray();
+ document.write( i+ " ");
+ document.writeln(j + ": "+ arr3.toString() + "<br>" );
+ }
+
+ }
+ break;
+
+ case 13:
+
+ var ar= new Array();
+ for( i=0; i< 3; i++)
+ {
+ var ob= new Object();
+ var valueObject= oletest._GetValueObject();
+ ob.value= "A JScript object!";
+ valueObject.Set("com.sun.star.uno.XInterface", ob);
+// valueObject.Set("long", 5);
+ ar[i]= valueObject;
+ }
+ value.Set("[]com.sun.star.uno.XInterface", ar);
+// value.Set("[]long", ar);
+
+ ret = oletest.methodXInterface( value);
+ sfarray= new VBArray( ret);
+ var arRet= sfarray.toArray();
+
+ document.writeln( "Params : Array containing objects ")
+ for( index in ar)
+ {
+ document.writeln( "object " + index + ": " + ar[index].Get().value +" ");
+ }
+ document.writeln( "<br>" ) ;
+ document.writeln("Return: <br>");
+ for( index in arRet)
+ {
+ document.writeln( "object " + index + ": " + arRet[index].value + " ");
+ }
+ break;
+
+
+
+
+ // Properties: setting and getting values
+ case 200:
+ value.Set("[]byte", arr)
+ oletest.AttrByte = value;
+ ret= oletest.AttrByte;
+ sfarray= new VBArray( ret);
+ document.writeln("Setting AttrByte: " + arr.toString() + "<p>");
+ document.writeln("Getting AttrByte: " + sfarray.toArray()); break;
+
+ case 201:
+ value.Set("[]double", arrDouble)
+ oletest.AttrDouble= value;
+ ret= oletest.AttrDouble;
+ sfarray= new VBArray( ret);
+ document.writeln("Setting AttrDouble: " + arrDouble.toString() + "<p>");
+ document.writeln("Getting AttrDouble: " + sfarray.toArray()); break;
+
+ case 202:
+ value.Set("[]boolean", arrBool)
+ oletest.AttrBool= value;
+ ret= oletest.AttrBool;
+ sfarray= new VBArray( ret);
+ document.writeln("Setting AttrBool: " + arrBool.toString() + "<p>");
+ document.writeln("Getting AttrBool: " + sfarray.toArray()); break;
+
+ case 203:
+ value.Set("[]short", arr)
+ oletest.AttrShort= value;
+ ret= oletest.AttrShort;
+ sfarray= new VBArray( ret);
+ document.writeln("Setting AttrShort: " + arr.toString() + "<p>");
+ document.writeln("Getting AttrShort: " + sfarray.toArray()); break;
+
+ case 204:
+ value.Set("[]unsigned short", arr)
+ oletest.AttrUShort= value;
+ ret= oletest.AttrUShort;
+ sfarray= new VBArray( ret);
+ document.writeln("Setting AttrUShort: " + arr.toString() + "<p>");
+ document.writeln("Getting AttrUShort: " + sfarray.toArray()); break;
+
+ case 205:
+ value.Set("[]long", arr)
+ oletest.AttrLong= value;
+ ret= oletest.AttrLong;
+ sfarray= new VBArray( ret);
+ document.writeln("Setting AttrLong: " + arr.toString() + "<p>");
+ document.writeln("Getting AttrLong: " + sfarray.toArray()); break;
+
+ case 206:
+ value.Set("[]unsigned long", arr)
+ oletest.AttrULong= value;
+ ret= oletest.AttrULong;
+ sfarray= new VBArray( ret);
+ document.writeln("Setting AttrULong: " + arr.toString() + "<p>");
+ document.writeln("Getting AttrULong: " + sfarray.toArray()); break;
+
+ case 207:
+ value.Set("[]char", arrChar)
+ oletest.AttrChar= value;
+ ret= oletest.AttrChar;
+ sfarray= new VBArray( ret);
+ document.writeln("Setting AttrChar: " + arrChar.toString() + "<p>");
+ document.writeln("Getting AttrChar: " + sfarray.toArray()); break;
+
+ case 208:
+ value.Set("[]string", arrString)
+ oletest.AttrString= value;
+ ret= oletest.AttrString;
+ sfarray= new VBArray( ret);
+ document.writeln("Setting AttrString: " + arrString.toString() + "<p>");
+ document.writeln("Getting AttrString: " + sfarray.toArray()); break;
+
+ case 209:
+ value.Set("[]any", arrAny)
+ oletest.AttrAny= value;
+ ret= oletest.AttrAny;
+ sfarray= new VBArray( ret);
+ document.writeln("Setting AttrAny: " + arrAny.toString() + "<p>");
+ document.writeln("Getting AttrAny: " + sfarray.toArray()); break;
+
+ case 210:
+ var allArray= new Array();
+ for(var i= 0; i <3; i++)
+ {
+ var value1= oletest._GetValueObject();
+ value1.Set("[]long", arr);
+ allArray[i]= value1;
+ }
+
+ value.Set("[][]long", allArray);
+
+ oletest.AttrSequence= value;
+ ret= oletest.AttrSequence;
+ sfarray= new VBArray( ret);
+
+ document.writeln( "Param: " + arrSeq.toString() +"<br>");
+ document.writeln("Returns a Sequence&lt Sequence &lt long &gt&gt <br>") ;
+ var arr1= new Array();
+ arr1= sfarray.toArray();
+ for( i=0; i < arr1.length; i++)
+ {
+ sfarray2= new VBArray( arr1[i]);
+ var arr2= new Array();
+ arr2= sfarray2.toArray();
+ document.writeln( arr2.toString() + "<br>" );
+ }
+ break;
+
+ case 211:
+ var array1= new Array();
+ for(var i= 0; i <3; i++)
+ {
+ var array2 = new Array();
+ for( var j= 0; j < 3; j++)
+ {
+ var value2= oletest._GetValueObject();
+ value2.Set("[]long", arr);
+ array2[j]= value2;
+ }
+
+ var value1= oletest._GetValueObject();
+ value1.Set("[][]long", array2)
+ array1[i]= value1;
+ }
+ var valueAll= oletest._GetValueObject();
+ valueAll.Set("[][][]long",array1);
+
+ oletest.AttrSequence2= valueAll;
+ ret= oletest.AttrSequence2;
+ sfarray1= new VBArray( ret);
+ arr1= sfarray1.toArray();
+ for( i=0; i < arr1.length; i++)
+ {
+ sfarray2= new VBArray( arr1[i]);
+ arr2= sfarray2.toArray();
+
+ for ( j=0; j < arr2.length; j++)
+ {
+ sfarray3= new VBArray( arr2[j]);
+ arr3= sfarray3.toArray();
+ document.write( i+ " ");
+ document.writeln(j + ": "+ arr3.toString() + "<br>" );
+ }
+
+ }
+ break;
+
+ case 212:
+ var ar= new Array();
+ for( i=0; i< 3; i++)
+ {
+ var ob= new Object();
+ var valueObject= oletest._GetValueObject();
+ ob.value= "A JScript object!";
+ valueObject.Set("com.sun.star.uno.XInterface", ob);
+ ar[i]= valueObject;
+ }
+ value.Set("[]com.sun.star.uno.XInterface", ar);
+
+ oletest.AttrXInterface= value;
+ ret= oletest.AttrXInterface;
+ sfarray= new VBArray( ret);
+ var arRet= sfarray.toArray();
+
+ document.writeln( "Params : Array containing objects ")
+ for( index in ar)
+ {
+ document.writeln( "object " + index + ": " + ar[index].Get().value +" ");
+ }
+ document.writeln( "<br>" ) ;
+ document.writeln("Return: <br>");
+ for( index in arRet)
+ {
+ document.writeln( "object " + index + ": " + arRet[index].value + " ");
+ }
+
+ break;
+
+ // Out-parameter ------------------------------------------------------------
+ case (2000):
+
+ oletest.testout_methodByte( outValue );
+ alert("byte: " + outValue.Get() ); break;
+ case (2001):
+ oletest.testout_methodDouble( outValue );
+ alert( "double: " + outValue.Get() ); break;
+ case (2002):
+ oletest.testout_methodBool( outValue );
+ alert( "boolean: " + outValue.Get() ); break;
+ case (2003):
+ oletest.testout_methodShort( outValue );
+ alert( "short: " + outValue.Get() ); break;
+ case (2004):
+ oletest.testout_methodUShort( outValue );
+ alert( "unsigned short: " + outValue.Get() ); break;
+ case (2005):
+ oletest.testout_methodLong( outValue );
+ alert( "long: " + outValue.Get() ); break;
+ case (2006):
+ oletest.testout_methodULong( outValue );
+ alert( "unsigned long: " + outValue.Get() ); break;
+ case (2007):
+ oletest.testout_methodChar( outValue );
+ alert( "char: " + outValue.Get() ); break;
+ case (2008):
+ oletest.testout_methodString( outValue );
+ alert( "string: " + outValue.Get()); break;
+ case (2009):
+ oletest.testout_methodAny( outValue );
+ alert( "any: " + outValue.Get() ); break;
+ case (2010):
+ oletest.testout_methodSequence( outValue );
+ var sfarray= new VBArray( outValue.Get());
+ arr= sfarray.toArray();
+ document.writeln("use the browser's back arrow to go to the previous page <p>");
+ document.writeln( arr.toString());
+ break;
+ case (2011):
+ oletest.testout_methodSequence2( outValue );
+ var sfarray= new VBArray( outValue.Get());
+ arr= sfarray.toArray();
+ var i;
+ for( i=0; i < arr.length; i++)
+ {
+ var sfarray= new VBArray( arr[i]);
+ var arr2= new Array();
+ arr2= sfarray.toArray();
+ document.writeln( arr2.toString() + "<br>" );
+ }
+ break;
+ case (2012):
+ oletest.testout_methodMulParams1( outValue, outValue2 );
+ document.writeln( "int : " + outValue.Get() + " int :" + outValue2.Get()); break;
+ case (2013):
+ oletest.testout_methodMulParams2( outValue, outValue2, outValue3 );
+ document.writeln( "int: " + outValue.Get() + " int: " + outValue2.Get() + " string: " + outValue3.Get() ); break;
+ case (2014):
+ oletest.testout_methodMulParams3( "hallo", outValue );
+ document.writeln( "string: " + outValue.Get() ); break;
+ case (2015):
+ oletest.testout_methodXInterface( outValue );
+ var out= outValue.Get();
+ document.writeln( "string: " + out.AttrAny2); break;
+
+ // INOUT - Parameter -------------------------------------------------------------------------------
+ // The in value has to be placed on index 0 of the passed in array
+ case (500):
+ inoutValue.InitInOutParam("byte", 100);
+ oletest.testinout_methodByte( inoutValue );
+ alert("byte: " + inoutValue.Get() ); break;
+ case (501):
+ inoutValue.InitInOutParam("double", 3.14);
+ oletest.testinout_methodDouble( inoutValue );
+ alert( "double: " + inoutValue.Get() ); break;
+ case (502):
+ inoutValue.InitInOutParam("boolean", false);
+ oletest.testinout_methodBool( inoutValue );
+ alert( "boolean: " + inoutValue.Get() ); break;
+ case (503):
+ inoutValue.InitInOutParam( "short", 200);
+ oletest.testinout_methodShort( inoutValue );
+ alert( "short: " + inoutValue.Get() ); break;
+ case (504):
+ inoutValue.InitInOutParam("unsigned short", 300);
+ oletest.testinout_methodUShort( inoutValue );
+ alert( "unsigned short: " + inoutValue.Get() ); break;
+ case (505):
+ inoutValue.InitInOutParam("long", 400);
+ oletest.testinout_methodLong( inoutValue );
+ alert( "long: " + inoutValue.Get() ); break;
+ case (506):
+ inoutValue.InitInOutParam( "unsigned long", 500);
+ oletest.testinout_methodULong( inoutValue );
+ alert( "unsigned long: " + inoutValue.Get() ); break;
+ case (507):
+ inoutValue.InitInOutParam( "char", "A");
+ oletest.testinout_methodChar( inoutValue );
+ alert( "char: " + inoutValue.Get() ); break;
+ case (508):
+ inoutValue.InitInOutParam("string", "I am a string");
+ oletest.testinout_methodString( inoutValue );
+ alert( "string: " + inoutValue.Get() ); break;
+ case (509):
+ inoutValue.InitInOutParam("[]long", arr);
+ oletest.testinout_methodAny( inoutValue ); // the method simply returns the argument
+ sfarray= new VBArray( inoutValue.Get());
+ arr= sfarray.toArray();
+ alert( "any: " + arr.toString() ); break;
+ case (510):
+ inoutValue.InitInOutParam("[]long", arr);
+ oletest.testinout_methodSequence( inoutValue );
+ var sfarray= new VBArray( inoutValue.Get());
+ arr= sfarray.toArray();
+ document.writeln("use the browser's back arrow to go to the previous page <p>");
+ document.writeln( arr.toString());
+ break;
+ case (511):
+ inoutValue.InitInOutParam( "[][]long", arrSeq);
+ oletest.testinout_methodSequence2( inoutValue );
+ var sfarray= new VBArray( inoutValue.Get());
+ arr= sfarray.toArray();
+ var i;
+ for( i=0; i < arr.length; i++)
+ {
+ var sfarray= new VBArray( arr[i]);
+ var arr2= new Array();
+ arr2= sfarray.toArray();
+ document.writeln( arr2.toString() + "<br>" );
+ }
+ break;
+ case 512:
+ var ob= new Object();
+ ob.value= "this is a string";
+ inoutValue.InitInOutParam( "com.sun.star.script.XInvocation", ob);
+ oletest.testinout_methodXInterface( inoutValue);
+ document.write("Out value: " + inoutValue.Get().value );
+ break;
+
+
+
+
+
+ // Test ANY
+ // Methods
+ case 1000:
+ i= 100;
+ ret= oletest.methodAnyTest1( i);
+ document.writeln( "in: " + i + " ret: " + ret);
+ break;
+ case 1001:
+ i= 3.14;
+ ret= oletest.methodAnyTest1( i);
+ document.writeln( "in: " + i + " ret: " + ret);
+ break;
+ case 1002:
+ i= "Hallo"
+ ret= oletest.methodAnyTest1( i);
+ document.writeln( "in: " + i + " ret: " + ret);
+ break;
+ case 1003:
+ i= arr;
+ ret= oletest.methodAnyTest1( i);
+ sfarray= new VBArray( ret);
+ document.writeln( "in: " + i + " ret: " + sfarray.toArray());
+ break;
+ case 1004:
+ var obj= new Object();
+ obj[1]= "This is index 0";
+ ret= oletest.methodAnyTest1( obj);
+ document.writeln( "in: " + obj + " ret: " + ret);
+ break;
+
+
+ // Test ANY property
+ case 1010:
+ i= 100;
+ oletest.AttrAny2= i;
+ ret= oletest.AttrAny2;
+ document.writeln( "set: " + i + " get: " + ret);
+ break;
+ case 1011:
+ i= 3.14;
+ oletest.AttrAny2= i;
+ ret= oletest.AttrAny2;
+ document.writeln( "set: " + i + " get: " + ret);
+ break;
+ case 1012:
+ i= "Hallo"
+ oletest.AttrAny2= i;
+ ret= oletest.AttrAny2;
+ document.writeln( "set: " + i + " get: " + ret);
+ break;
+ case 1013:
+ i= arr;
+ oletest.AttrAny2= i;
+ ret= oletest.AttrAny2;
+ sfarray= new VBArray( ret);
+ document.writeln( "set: " + i + " get: " + sfarray.toArray());
+ break;
+ case 1014:
+ var obj= new Object();
+ obj[1]= "This is index 0";
+ oletest.AttrAny2= obj;
+ ret= oletest.AttrAny2;
+ document.writeln( "set: " + obj + " get: " + ret);
+ break;
+
+
+ case 2100:
+ alert("2100");
+ var ret= oletest.retMethodByte();
+ var sfarray= VBArray( ret);
+ document.writeln( sfarray.toArray() );
+ break;
+
+
+// case 5000:
+// oletest.other_methodAnyIn("hallo");
+
+
+
+ }
+
+}
+
+function funcOut( out)
+{
+ out["du"]= 0xffff;
+}
+
+</script>
+
+<script language="VBScript">
+
+sub callBasic(id)
+
+ Dim factory
+ Set factory= GetObject("", "com.sun.star.ServiceManager")
+
+ Set oletest= factory.createInstance("oletest.OleTest")
+
+
+ arrInt= Array(1,2,3,4,5)
+ arrInt2= Array( -1, -2, 127, 128, 0)
+ arrDouble= Array(1.1, 2.2, 3.3, 4.4, 5.5)
+ arrBool= Array(0,1,0,2,0)
+ arrLong= Array( &Hff, &Hffff, &Hffffff, &Hffffffff)
+ arrString= Array("Chicken Wings", "Cheeseburger", "Hamburger")
+ arrChar= Array("a",65, "M")
+ arrAny= Array("Mickey", 3.14, 100, "A")
+
+ Dim arrDim2Int(1,1)
+ For i= 0 To 1
+ For j= 0 To 1
+ arrDim2Int(i,j) = i*2 + j
+ Next
+ Next
+
+ Dim arrDim3Int(1,1,1)
+ For i= 0 To 1
+ For j= 0 To 1
+ For k=0 To 1
+ arrDim3Int(i,j,k) = i*2 + j*2 + k
+ Next
+ Next
+ Next
+
+
+ select case id
+ case 0
+ document.writeln "param: "
+ printArray arrInt
+ ret= oletest.methodByte(arrInt)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 1
+ document.writeln "param: "
+ printArray arrDouble
+ ret= oletest.methodDouble(arrDouble)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 2
+ document.writeln "param: "
+ printArray arrBool
+ ret= oletest.methodBool(arrBool)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 3
+ document.writeln "param: "
+ printArray arrInt2
+ ret= oletest.methodShort(arrInt2)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 4
+ document.writeln "param: "
+ printArray arrInt
+ ret= oletest.methodUShort(arrInt)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 5
+ document.writeln "param: "
+ printArray arrLong
+ ret= oletest.methodLong(arrLong)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 6
+ document.writeln "param: "
+ printArray arrInt
+ ret= oletest.methodULong(arrInt)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 7
+ document.writeln "param: "
+ printArray arrString
+ ret= oletest.methodString(arrString)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 8
+ document.writeln "param: "
+ printArray arrChar
+ ret= oletest.methodChar(arrChar)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 9
+ document.writeln "param: "
+ printArray arrAny
+ ret= oletest.methodAny(arrAny)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 10
+ document.writeln "param: "
+ printArray2 arrDim2Int
+ ret= oletest.methodSequence(arrDim2Int)
+ document.writeln "<br> return value: "
+ for each val in ret
+ document.write "<br> array: "
+ for each val2 in val
+ document.write val2
+ next
+ next
+
+ // In Out Parameter --------------------------------------------------
+ case 100
+ a= 100
+ document.write "param: " & CStr( a) & "<br>"
+ oletest.testinout_methodByte a
+ document.write a
+ case 101
+ a= 1.11
+ document.write "param: " & CStr( a) & "<br>"
+ oletest.testinout_methodDouble a
+ document.write a
+ case 102
+ a= 5
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodBool a
+ document.write a
+ case 103
+ a= -10
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodShort a
+ document.write a
+ case 104
+ a= 128
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodUShort a
+ document.write a
+ case 105
+ a= 65556
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodLong a
+ document.write a
+ case 106
+ a= 65556
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodULong a
+ document.write a
+ case 107
+ a= "ein test string"
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodString a
+ document.write a
+ case 108
+ a= "W"
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodChar a
+ document.write a
+ case 109
+ a= "Ein String im Any"
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.other_methodAnyIn a
+ document.write a
+// Attributes -----------------------------------------------------------------
+ case 200
+ document.write "set: "
+ printArray arrInt
+ oletest.AttrByte= arrInt
+ b= oletest.AttrByte
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 201
+ document.write "set: "
+ printArray arrDouble
+ oletest.AttrDouble= arrDouble
+ b= oletest.AttrDouble
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 202
+ document.write "set: "
+ printArray arrBool :
+ oletest.AttrBool= arrBool
+ b= oletest.AttrBool
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 203
+ document.write "set: "
+ printArray arrInt2 :
+ oletest.AttrShort= arrInt2
+ b= oletest.AttrShort
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 204
+ document.write "set: "
+ printArray arrInt
+ oletest.AttrUShort= arrInt
+ b= oletest.AttrUShort
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 205
+ document.write "set: "
+ printArray arrInt2
+ oletest.AttrLong= arrInt2
+ b= oletest.AttrLong
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 206
+ document.write "set: "
+ printArray arrInt
+ oletest.AttrULong= arrInt
+ b= oletest.AttrULong
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 207
+ document.write "set: "
+ printArray arrString
+ oletest.AttrString= arrString
+ b= oletest.AttrString
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 208
+ document.write "set: "
+ printArray arrChar
+ oletest.AttrChar= arrChar
+ b= oletest.AttrChar
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 209
+ document.write "set: "
+ printArray arrAny
+ oletest.AttrAny= arrAny
+ b= oletest.AttrAny
+ call printArrayEx( "<br> get: ", "<br>", b)
+
+ case 210
+ document.write "set: <br>"
+ printArray2 arrDim2Int :
+ oletest.AttrSequence= arrDim2Int
+ ret= oletest.AttrSequence
+ document.write "get: "
+ for each val in ret
+ document.write "<br> array: "
+ for each val2 in val
+ document.write val2
+ next
+ next
+
+ end select
+end sub
+sub printArray( arr)
+ document.write "array: "
+ For Each val In arr
+ document.write CStr(val) & " "
+ Next
+end sub
+
+// print a 2 dimensional Array
+
+sub printArray2( arr)
+ elements1= UBound( arr, 1) - LBound( arr, 1) +1
+ elements2= UBound( arr, 2) - LBound( arr, 2) +1
+
+ For i=0 To elements1 -1
+ document.write( "array " & CStr( i) & ": " )
+ For j=0 To elements2 -1
+ document.write CStr( arr(i,j))
+ Next
+ document.write( "<br>")
+ Next
+end sub
+
+sub printArrayEx( pre, post, array)
+ document.write pre
+ printArray array
+ document.write post
+end sub
+</script>
+
+<div id=out> </div>
+
+<!-- Insert HTML here -->
+
+<h2> JScript with _GetValueObject </h2>
+Tests Array/Sequence conversion.<br>
+All methods receive a Sequence as Parameter. The element type of the Sequence is written on the buttons.
+<br>
+<button onclick='callOleTest( 1)'>byte</Button>
+<button onclick='callOleTest( 2)'>double</Button>
+<button onclick='callOleTest( 3)'>boolean</Button>
+<button onclick='callOleTest( 4)'>short</Button>
+<button onclick='callOleTest( 5)'>unsigned short</Button>
+<button onclick='callOleTest( 6)'>long</Button>
+<button onclick='callOleTest( 7)'>unsigned long</Button>
+<button onclick='callOleTest( 8)'>char</Button>
+<button onclick='callOleTest( 10)'>any</Button>
+<button onclick='callOleTest( 11)'>sequence&ltlong&gt </Button>
+<button onclick='callOleTest( 12)'>sequence&ltsequence&ltlong&gt &gt </Button>
+<button onclick='callOleTest( 13)'>XInterface</Button>
+<p>
+
+<p>
+Out Parameter <br>
+<button onclick='callOleTest( 2000)'>byte </Button>
+<button onclick='callOleTest( 2001)'>double</Button>
+<button onclick='callOleTest( 2002)'>boolean</Button>
+<button onclick='callOleTest( 2003)'>short</Button>
+<button onclick='callOleTest( 2004)'>unsigned short</Button>
+<button onclick='callOleTest( 2005)'>long</Button>
+<button onclick='callOleTest( 2006)'>unsigned long</Button>
+<button onclick='callOleTest( 2007)'>char</Button>
+<button onclick='callOleTest( 2008)'>string</Button>
+<button onclick='callOleTest( 2009)'>any</Button>
+<button onclick='callOleTest( 2010)'>sequence&ltlong&gt </Button>
+<button onclick='callOleTest( 2011)'>sequence&ltsequence&ltlong&gt &gt </Button>
+<button onclick='callOleTest( 2012)'>2 out </Button>
+<button onclick='callOleTest( 2013)'>3 out </Button>
+<button onclick='callOleTest( 2014)'>1 in & 1 out </Button>
+<button onclick='callOleTest( 2015)'>XInterface </Button>
+
+<p>
+In Out Parameter <br>
+<button onclick='callOleTest( 500)'>byte </Button>
+<button onclick='callOleTest( 501)'>double</Button>
+<button onclick='callOleTest( 502)'>boolean</Button>
+<button onclick='callOleTest( 503)'>short</Button>
+<button onclick='callOleTest( 504)'>unsigned short</Button>
+<button onclick='callOleTest( 505)'>long</Button>
+<button onclick='callOleTest( 506)'>unsigned long</Button>
+<button onclick='callOleTest( 507)'>char</Button>
+<button onclick='callOleTest( 508)'>string</Button>
+<button onclick='callOleTest( 509)'>any</Button>
+<button onclick='callOleTest( 510)'>sequence&ltlong&gt </Button>
+<button onclick='callOleTest( 511)'>sequence&ltsequence&ltlong&gt &gt </Button>
+<button onclick='callOleTest( 512)'>XInterface </Button>
+<p>
+
+Tests Array/Sequence conversion with Attributes. All params are of type Sequence and
+ the element type of the Sequence is written on the buttons. <br>
+<button onclick='callOleTest( 200)'>byte </Button>
+<button onclick='callOleTest( 201)'>double</Button>
+<button onclick='callOleTest( 202)'>boolean</Button>
+<button onclick='callOleTest( 203)'>short</Button>
+<button onclick='callOleTest( 204)'>unsigned short</Button>
+<button onclick='callOleTest( 205)'>long</Button>
+<button onclick='callOleTest( 206)'>unsigned long</Button>
+<button onclick='callOleTest( 207)'>char</Button>
+<button onclick='callOleTest( 208)'>string</Button>
+<button onclick='callOleTest( 209)'>any</Button>
+<button onclick='callOleTest( 210)'>sequence&ltlong&gt </Button>
+<button onclick='callOleTest( 211)'>sequence&ltsequence&ltlong&gt &gt </Button>
+<button onclick='callOleTest( 212)'>XInterface </Button>
+<p>
+
+<!--
+Test of Any parameter in a method. Any contains:<br>
+<button onclick='callOleTest( 1000)'>integer </Button>
+<button onclick='callOleTest( 1001)'>double </Button>
+<button onclick='callOleTest( 1002)'>string</Button>
+<button onclick='callOleTest( 1003)'>array</Button>
+<button onclick='callOleTest( 1004)'>object</Button>
+<p>
+Test of Any parameter in a property. Any contains:<br>
+<button onclick='callOleTest( 1010)'>integer </Button>
+<button onclick='callOleTest( 1011)'>double </Button>
+<button onclick='callOleTest( 1012)'>string</Button>
+<button onclick='callOleTest( 1013)'>array</Button>
+<button onclick='callOleTest( 1014)'>object</Button>
+<p>
+<p>
+
+
+<h2> Visual Basic Tests </h2>
+Test array /Sequence conversion and return value<br>
+Template: <b> Sequence &lt type &gt method( Sequence&lt type &gt ) </b> <br>
+<!--<font color= red>Multi dimensional arrays are not processed by VBSript</font> <br> -->
+<!--
+<button onclick='callBasic(0)'>byte</button>
+<button onclick='callBasic(1)'>double</button>
+<button onclick='callBasic(2)'>boolean</button>
+<button onclick='callBasic(3)'>short</button>
+<button onclick='callBasic(4)'>u short</button>
+<button onclick='callBasic(5)'>long</button>
+<button onclick='callBasic(6)'>u long</button>
+<button onclick='callBasic(7)'>string</button>
+<button onclick='callBasic(8)'>char</button>
+<button onclick='callBasic(9)'>any</button> <br>
+<button onclick='callBasic(10)'>Seq &lt int &gt</button> <br>
+
+
+Out parameter <br>
+Template: <b> void method( Sequence &lt type &gt ) </b> <br>
+<button onclick='callBasic(100)'>byte</button>
+<button onclick='callBasic(101)'>double</button>
+<button onclick='callBasic(102)'>boolean</button>
+<button onclick='callBasic(103)'>short</button>
+<button onclick='callBasic(104)'>u short</button>
+<button onclick='callBasic(105)'>long</button>
+<button onclick='callBasic(106)'>u long</button>
+<button onclick='callBasic(107)'>string</button>
+<button onclick='callBasic(108)'>char</button>
+<button onclick='callBasic(109)'>any</button> <br>
+
+Tests Array/Sequence conversion with <b>Attributes</b>. All params are of type Sequence and
+ the element type of the Sequence is written on the buttons. <br>
+<button onclick='callBasic( 200)'>byte </Button>
+<button onclick='callBasic( 201)'>double</Button>
+<button onclick='callBasic( 202)'>boolean</Button>
+<button onclick='callBasic( 203)'>short</Button>
+<button onclick='callBasic( 204)'>unsigned short</Button>
+<button onclick='callBasic( 205)'>long</Button>
+<button onclick='callBasic( 206)'>unsigned long</Button>
+<button onclick='callBasic( 207)'>string</Button>
+<button onclick='callBasic( 208)'>char</Button>
+<button onclick='callBasic( 209)'>any</Button>
+<button onclick='callBasic( 210)'>sequence&ltlong&gt </Button>
+
+-->
+
+
diff --git a/extensions/test/ole/OleClient/clientTest.cxx b/extensions/test/ole/OleClient/clientTest.cxx
new file mode 100644
index 000000000..dc6e04fb9
--- /dev/null
+++ b/extensions/test/ole/OleClient/clientTest.cxx
@@ -0,0 +1,536 @@
+/*************************************************************************
+ *
+ * $RCSfile: clientTest.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <windows.h>
+#include <comdef.h>
+#include <tchar.h>
+#include <atlbase.h>
+extern CComModule _Module;
+#include<atlcom.h>
+#include<atlimpl.cpp>
+
+#include <com/sun/star/bridge/ModelDependent.hpp>
+#include <com/sun/star/bridge/XBridgeSupplier2.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <oletest/XCallback.hpp>
+#include <rtl/process.h>
+#include <com/sun/star/uno/Reference.h>
+#include <cppuhelper/servicefactory.hxx>
+#include <rtl/string.h>
+#pragma hdrstop
+
+
+CComModule _Module;
+BEGIN_OBJECT_MAP(ObjectMap)
+END_OBJECT_MAP()
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::script;
+using namespace cppu;
+using namespace rtl;
+HRESULT doTest();
+HRESULT doTest2( Reference<XInvocation> &);
+Reference<XInvocation> getComObject(OUString& );
+
+HRESULT InitializeParameter();
+void printResultVariantArray( VARIANT & var);
+void printVariant( VARIANT & var);
+
+
+Reference< XMultiServiceFactory > objectFactory;
+
+
+int __cdecl _tmain( int argc, _TCHAR * argv[] )
+{
+ HRESULT hr;
+ if( FAILED( hr=CoInitialize(NULL)))
+ {
+ _tprintf(_T("CoInitialize failed \n"));
+ return -1;
+ }
+
+
+ _Module.Init( ObjectMap, GetModuleHandle( NULL));
+
+ if( FAILED(hr=doTest()))
+ {
+ _com_error err( hr);
+ const TCHAR * errMsg= err.ErrorMessage();
+ MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR);
+ }
+
+
+ _Module.Term();
+ CoUninitialize();
+ return 0;
+}
+
+
+Reference<XInvocation> getComObject( OUString progId)
+{
+ HRESULT hr= S_OK;
+ Reference< XInvocation > ret;
+// Reference<XMultiServiceFactory> fac;
+ if( ! objectFactory.is())
+ {
+ Reference< XMultiServiceFactory > mgr= createRegistryServiceFactory( OUString(L"applicat.rdb"));
+ Reference< XInterface > xInt= mgr->createInstance( OUString(L"com.sun.star.bridge.OleObjectFactory"));
+ objectFactory= Reference<XMultiServiceFactory>::query( xInt);
+ }
+
+ if( objectFactory.is())
+ {
+ Reference<XInterface> xIntAx= objectFactory->createInstance( progId.getStr());
+ if( xIntAx.is() )
+ {
+ Reference< XInvocation > xInv( xIntAx, UNO_QUERY);
+ ret= xInv;
+ }
+ }
+// CComPtr<IUnknown> spUnkMgr;
+// Reference< XInvocation > ret;
+// Reference< XMultiServiceFactory > mgr= createRegistryServiceFactory( OUString(L"applicat.rdb"));
+// Reference< XInterface > xInt= mgr->createInstance(OUString(L"com.sun.star.bridge.OleObjectFactory"));
+// Reference< XMultiServiceFactory > fac( xInt, UNO_QUERY);
+ return ret;
+}
+
+HRESULT doTest()
+{
+ HRESULT hr= S_OK;
+ USES_CONVERSION;
+ Reference<XInvocation> inv= getComObject( L"AxTestComponents.Basic");
+ Sequence< sal_Int16> seqIndices;
+ Sequence<Any> seqOut;
+
+ Any aAny;
+ Any anyOut;
+ char buff[256];
+
+ //###################################################################################
+ // in parameter
+ //###################################################################################
+// aAny <<= ( sal_Int8) 127;
+// inv->invoke( OUString(L"inByte"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+//
+// aAny <<= ( sal_Int16) 0xffff;
+// inv->invoke( OUString(L"inShort"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+
+// aAny <<= ( sal_Int32) 1234567;
+// inv->invoke( OUString(L"inLong"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+//
+// aAny <<= OUString(L" this is clientTest.exe");
+// inv->invoke( OUString(L"inString"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+//
+// aAny <<= ( float) 3.14;
+// inv->invoke( OUString(L"inFloat"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+//
+// aAny <<= ( double) 3.145;
+// inv->invoke( OUString(L"inDouble"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+//
+// aAny <<= OUString( L" A string in an any");
+// inv->invoke( OUString(L"inVariant"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+//
+// OUString arStr[]= {L"string0", L"string1", L"string2"};
+// Sequence<OUString> seq( arStr, 3);
+// Any arAny[1];
+// arAny[0] <<= seq;
+// inv->invoke( OUString(L"inArray"), Sequence< Any > ( arAny, 1), seqIndices, seqOut);
+
+// Reference < XInvocation > inv2= getComObject(L"AxTestComponents.Basic");
+// Any anyVal;
+// anyVal <<= OUString(L"this is the value of prpString");
+// inv2->setValue( OUString(L"prpString"), anyVal);
+// aAny <<= inv2;
+// inv->invoke( OUString(L"inObject"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+// //###################################################################################
+// // out parameter
+// //###################################################################################
+ // outByte
+// aAny= Any();
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// inv->invoke( OUString(L"outByte"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// sprintf( buff, " out Byte: %d", *( char*)anyOut.getValue());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+//
+// // outShort
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// inv->invoke( OUString(L"outShort"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// sprintf( buff, " out Short: %d", *( sal_Int16*)anyOut.getValue());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+//
+// // outLong
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// inv->invoke( OUString(L"outLong"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// sprintf( buff, " out Long: %d", *( sal_Int32*)anyOut.getValue());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+//
+// // outString
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// inv->invoke( OUString(L"outString"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// sprintf( buff, " out String: %S", (*( OUString*)anyOut.getValue()).getStr());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+//
+// // outFloat
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// inv->invoke( OUString(L"outFloat"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// sprintf( buff, " out float: %f", *( float*)anyOut.getValue());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+//
+// // outDouble
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// inv->invoke( OUString(L"outDouble"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// sprintf( buff, " out double: %g", *( double*)anyOut.getValue());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+
+ // outVariant
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// inv->invoke( OUString(L"outVariant"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// if( anyOut.getValueTypeClass() == TypeClass_STRING)
+// {
+// OUString s;
+// anyOut >>= s;
+// sprintf( buff, " out string ( variant): %S", s.getStr());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+// }
+//
+// // outArray
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// inv->invoke( OUString(L"outArray"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// Sequence<Any> seqOutValue;
+// anyOut >>= seqOutValue;
+//
+// // we assume that the Sequence contains Anys of strings
+// OUString usMessage;
+// for( int i=0; i < seqOutValue.getLength(); i++)
+// {
+// OUString stemp;
+// if( seqOutValue[i] >>= stemp)
+// {
+// usMessage += OUString(L"\n");
+// usMessage += stemp;
+// }
+// }
+// MessageBox( NULL, W2T( usMessage.getStr()), _T("Test Program"), MB_OK);
+//
+// // outObject
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// inv->invoke( OUString(L"outObject"), Sequence< Any > ( &aAny, 1 ), seqIndices, seqOut);
+// Reference<XInvocation> invOut;
+// if( seqOut[0]>>=invOut)
+// {
+// Any val= invOut->getValue( L"prpString");
+//
+// if( val.getValueTypeClass() == TypeClass_STRING)
+// {
+// OUString s;
+// val>>=s;
+// MessageBox( NULL,W2T( s.getStr()), _T("Test Program"), MB_OK);
+// }
+// }
+
+// //###################################################################################
+// // in/out parameter
+// //###################################################################################
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// aAny <<= ( sal_Int8) 127;
+// inv->invoke( OUString(L"inoutByte"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// sprintf( buff, " in out Byte: %d", *( char*)anyOut.getValue());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+
+ // in out short
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// aAny <<= ( sal_Int16) 1111;
+// inv->invoke( OUString(L"inoutShort"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// sprintf( buff, " in out Short: %d", *( sal_Int16*)anyOut.getValue());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+//
+// //in out long
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// aAny <<= ( sal_Int32) 111111;
+// inv->invoke( OUString(L"inoutLong"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// sprintf( buff, "inout Long: %d", *( sal_Int32*)anyOut.getValue());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+//
+// //in out string
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// aAny <<= OUString(L" this is clientTest.exe");
+// inv->invoke( OUString(L"inoutString"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// sprintf( buff, " inout String: %S", (*( OUString*)anyOut.getValue()).getStr());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+//
+// //in out float
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// aAny <<= ( float) 3.14;
+// inv->invoke( OUString(L"inoutFloat"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// sprintf( buff, " inout float: %f", *( float*)anyOut.getValue());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+//
+// // in out double
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// aAny <<= ( double) 3.145;
+// inv->invoke( OUString(L"inoutDouble"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// sprintf( buff, " inout double: %g", *( double*)anyOut.getValue());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+//
+// // in out VARIANT
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// aAny <<= OUString( L" A string in an any");
+// inv->invoke( OUString(L"inoutVariant"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+// anyOut <<= seqOut[0];
+// if( anyOut.getValueTypeClass() == TypeClass_STRING)
+// {
+// OUString s;
+// anyOut >>= s;
+// sprintf( buff, " in out string ( variant): %S", s.getStr());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+// }
+
+// // in out Array
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// OUString arStr2[]= {L"string0", L"string1", L"string2"};
+// Sequence<OUString> seq2( arStr2, 3);
+// Any arAny2[1];
+// arAny2[0] <<= seq2;
+// inv->invoke( OUString(L"inoutArray"), Sequence< Any > ( arAny2, 1), seqIndices, seqOut);
+// Sequence<Any> seqOutValue2;
+// seqOut[0]>>= seqOutValue2;
+//
+// // we assume that the Sequence contains Anys of strings
+// OUString usMessage2;
+// for(int i2=0; i2 < seqOutValue2.getLength(); i2++)
+// {
+// OUString stemp;
+// if( seqOutValue2[i2] >>= stemp)
+// {
+// usMessage2 += OUString(L"\n");
+// usMessage2 += stemp;
+// }
+// }
+// MessageBox( NULL, W2T( usMessage2.getStr()), _T("Test Program"), MB_OK);
+
+//
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// Reference < XInvocation > inv3= getComObject(L"AxTestComponents.Basic");
+// Any anyVal2;
+// anyVal2 <<= OUString(L"this is the value of prpString");
+// inv3->setValue( OUString(L"prpString"), anyVal2);
+// aAny <<= inv3;
+// inv->invoke( OUString(L"inoutObject"), Sequence< Any > ( &aAny, 1), seqIndices, seqOut);
+// Reference<XInvocation> invOut2;
+// if( seqOut[0]>>=invOut2)
+// {
+// Any val= invOut2->getValue( L"prpString");
+//
+// if( val.getValueTypeClass() == TypeClass_STRING)
+// {
+// OUString s;
+// val>>=s;
+// MessageBox( NULL,W2T( s.getStr()), _T("Test Program"), MB_OK);
+// }
+// }
+
+ //###################################################################################
+ // mixed parameter
+ //###################################################################################
+// // mixed1
+// seqIndices.realloc( 0);
+// seqOut.realloc(0);
+// Sequence< Any > params(12);
+// sal_Int8 aByte=111;
+// OUString aString(L" a string in a VARIANT");
+// Any param[12];
+// param[0] <<= aByte;
+// param[2] <<= aByte; //in out
+// param[3] <<= aString; // in String
+// param[5] <<= aString; // in out string
+//
+// OUString arStr3[]= {L"string0", L"string1", L"string2"};
+// Sequence<OUString> seq3( arStr3,3);
+// param[6] <<= seq3; // in Array
+// param[8] <<= seq3; // in ou Array
+//
+// Reference < XInvocation > inv4= getComObject(L"AxTestComponents.Basic");
+// Any anyVal3;
+// anyVal3 <<= OUString(L"this is the value of prpString");
+// inv4->setValue( OUString(L"prpString"), anyVal3);
+// param[9] <<= inv4; // in dispatch
+// param[11] <<= inv4;
+// inv->invoke( OUString(L"mixed1"), Sequence< Any > ( param, 12),seqIndices, seqOut);
+//
+// for( int i3=0; i3<seqOut.getLength();i3++)
+// {
+// Any any;
+// any <<= seqOut[i3];
+//
+// }
+// sal_Int8 outChar= *( char*)seqOut[0].getValue();
+// sal_Int8 inoutChar= *( char*)seqOut[1].getValue();
+// sprintf( buff, " out Byte: %d \n in out Byte %d", outChar, inoutChar );
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+//
+// OUString outString( *(OUString*)seqOut[2].getValue());
+// OUString inoutString( *(OUString*)seqOut[3].getValue());
+// sprintf( buff, "out string: %S \n in out string: %S", outString.getStr(), inoutString.getStr());
+// MessageBox( NULL, A2T( buff), _T("Test Program"), MB_OK);
+//
+// Sequence< Any > outSeq;
+// seqOut[4] >>= outSeq;
+// OUString usMessage3;
+// for(int i4=0; i4 < outSeq.getLength(); i4++)
+// {
+// OUString stemp;
+// if( outSeq[i4] >>= stemp)
+// {
+// usMessage3 += OUString(L"\n");
+// usMessage3 += stemp;
+// }
+// }
+// MessageBox( NULL, W2T( usMessage3.getStr()), _T("Test Program. out Sequence"), MB_OK);
+//
+// seqOut[5] >>= outSeq;
+// OUString usMessage4;
+// for(int i5=0; i5 < outSeq.getLength(); i5++)
+// {
+// OUString stemp;
+// if( outSeq[i5] >>= stemp)
+// {
+// usMessage4 += OUString(L"\n");
+// usMessage4 += stemp;
+// }
+// }
+// MessageBox( NULL, W2T( usMessage3.getStr()), _T("Test Program. in out Sequence"), MB_OK);
+//
+// Reference<XInvocation> invOut3;
+// seqOut[6] >>= invOut3;
+// if( seqOut[0]>>=invOut3)
+// {
+// Any val= invOut3->getValue( L"prpString");
+//
+// if( val.getValueTypeClass() == TypeClass_STRING)
+// {
+// OUString s;
+// val>>=s;
+// MessageBox( NULL,W2T( s.getStr()), _T("Test Program, out object"), MB_OK);
+// }
+// }
+//
+// Reference<XInvocation> invOut4;
+// seqOut[6] >>= invOut4;
+// if( seqOut[0]>>=invOut4)
+// {
+// Any val= invOut4->getValue( L"prpString");
+//
+// if( val.getValueTypeClass() == TypeClass_STRING)
+// {
+// OUString s;
+// val>>=s;
+// MessageBox( NULL,W2T( s.getStr()), _T("Test Program, in out object"), MB_OK);
+// }
+// }
+
+ //###################################################################################
+ // Sequences
+ //###################################################################################
+
+ seqIndices.realloc( 0);
+ seqOut.realloc(0);
+ sal_Int32 arLong[]={ 1,2,3};
+ Any seqLongAny;
+ seqLongAny<<= Sequence<sal_Int32>( arLong, 3);
+ inv->invoke( OUString(L"inSequenceLong"),Sequence< Any > ( &seqLongAny, 1), seqIndices, seqOut);
+
+ return hr;
+}
diff --git a/extensions/test/ole/OleClient/makefile.mk b/extensions/test/ole/OleClient/makefile.mk
new file mode 100644
index 000000000..a6b74362e
--- /dev/null
+++ b/extensions/test/ole/OleClient/makefile.mk
@@ -0,0 +1,128 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/
+
+PRJNAME=extensions
+TARGET=clientTest
+TARGETTYPE=CUI
+LIBTARGET=NO
+
+#USE_DEFFILE= TRUE
+NO_BSYMBOLIC= TRUE
+ENABLE_EXCEPTIONS=TRUE
+BOOTSTRAP_SERVICE=FALSE
+
+# --- Settings ---
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files ---
+
+UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
+
+
+UNOUCROUT= $(OUT)$/inc
+INCPRE+= $(OUT)$/inc -I$(SOLARINCDIR)$/external$/atl
+
+
+UNOTYPES= com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.script.XInvocation \
+ oletest.XCallback
+
+
+
+.IF "$(depend)" != ""
+
+.ENDIF # depend
+
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJ)$/clientTest.obj
+LIBCMT=msvcrtd.lib
+
+
+APP1STDLIBS= \
+ $(SALLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ user32.lib \
+ kernel32.lib \
+ ole32.lib \
+ oleaut32.lib \
+ uuid.lib \
+ comdlg32.lib
+
+
+
+.IF "$(GUI)"=="WNT"
+APP1STDLIBS += $(LIBCIMT)
+.ENDIF
+
+APP1DEF= $(MISC)\$(APP1TARGET).def
+
+# --- Targets ---
+
+.INCLUDE : target.mk
+
diff --git a/extensions/test/ole/OleClient/readme.txt b/extensions/test/ole/OleClient/readme.txt
new file mode 100644
index 000000000..aff1ce948
--- /dev/null
+++ b/extensions/test/ole/OleClient/readme.txt
@@ -0,0 +1,7 @@
+The program tests the OleClient service which enables to use COM components
+through XInvocation.
+
+Requirements:
+
+applicat.rdb has to be next to the executable.
+COM component: XCallback_Impl.Simple ( extensions/test/ole/unotocomcalls/XCallback_Impl ) \ No newline at end of file
diff --git a/extensions/test/ole/OleConverterVar1/convTest.cxx b/extensions/test/ole/OleConverterVar1/convTest.cxx
new file mode 100644
index 000000000..4f61b3eaf
--- /dev/null
+++ b/extensions/test/ole/OleConverterVar1/convTest.cxx
@@ -0,0 +1,678 @@
+/*************************************************************************
+ *
+ * $RCSfile: convTest.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <windows.h>
+#include <comdef.h>
+#include <tchar.h>
+#include <atlbase.h>
+extern CComModule _Module;
+#include<atlcom.h>
+#include<atlimpl.cpp>
+
+#include <com/sun/star/bridge/ModelDependent.hpp>
+#include <com/sun/star/bridge/XBridgeSupplier2.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <oletest/XTestSequence.hpp>
+#include <rtl/process.h>
+#include <com/sun/star/uno/Reference.h>
+#include <cppuhelper/servicefactory.hxx>
+#include <rtl/string.h>
+#pragma hdrstop
+
+
+CComModule _Module;
+BEGIN_OBJECT_MAP(ObjectMap)
+END_OBJECT_MAP()
+
+#include "smartarray.h"
+using namespace com::sun::star::bridge;
+using namespace com::sun::star::bridge::ModelDependent;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::uno;
+using namespace oletest;
+using namespace cppu;
+using namespace rtl;
+HRESULT doTest();
+HRESULT InitializeParameter();
+void printResultVariantArray( VARIANT & var);
+void printVariant( VARIANT & var);
+
+
+
+
+int __cdecl _tmain( int argc, _TCHAR * argv[] )
+{
+ HRESULT hr;
+ if( FAILED( hr=CoInitialize(NULL)))
+ {
+ _tprintf(_T("CoInitialize failed \n"));
+ return -1;
+ }
+
+
+ _Module.Init( ObjectMap, GetModuleHandle( NULL));
+
+ if( FAILED(hr=doTest()))
+ {
+ _com_error err( hr);
+ const TCHAR * errMsg= err.ErrorMessage();
+ MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR);
+ }
+
+
+ _Module.Term();
+ CoUninitialize();
+ return 0;
+}
+char _c[]={ 1,2,3,4,5};
+short _short[]={0xffff, 1, 11 ,111, 1111 };
+unsigned short _ushort[]={0xffff, 1, 11 ,111, 1111 };
+long _long[]= { 0xffffffff, 11, 111 ,1111, 1111 };
+unsigned long _ulong[]= { 0xffffffff, 11, 111 ,1111, 1111 };
+float _float[]= { 12345., 1234.5, 123.45, 12.345, 1.2345};
+double _double[]= {12345, 1234.5, 123.45, 12.345, 1.2345};
+
+CComVariant _variant[]= {L"variant 1", L"variant2", L"variant3"};
+wchar_t _wchar[]= {L'1', L'2', L'3', L'A', L' '};
+BSTR _bstr[]={L"Ich", L"bin", L"ein", L"Hamburger", L"Jung"};
+SmartArray<char> arByte( _c, 5, VT_I1);
+SmartArray< short> arShort( _short, 5, VT_I2);
+//SmartArray< unsigned short> arUShort( _ushort, 5, VT_UI2);
+SmartArray< long> arLong( _long, 5, VT_I4);
+//SmartArray< unsigned long> arULong( _ulong, 5, VT_UI4);
+//SmartArray< float> arFloat( _float, 5, VT_R4 );
+SmartArray< double> arDouble( _double, 5, VT_R8 );
+//SmartArray< unsigned short> arWChar( _wchar, 5, VT_UI2 );
+SmartArray< wchar_t* > arString( _bstr, 5, VT_BSTR);
+SmartArray< VARIANT > arVariant( _variant, 3, VT_VARIANT);
+
+
+HRESULT doTest()
+{
+ HRESULT hr;
+ USES_CONVERSION;
+ CComPtr<IUnknown> spUnkMgr;
+
+ Reference< XMultiServiceFactory > mgr= createRegistryServiceFactory( OUString(L"applicat.rdb"));
+ Reference< XInterface > xIntSupplier= mgr->createInstance(OUString(L"com.sun.star.bridge.OleBridgeSupplierVar1"));
+ Reference< XBridgeSupplier2 > xSuppl( xIntSupplier, UNO_QUERY);
+ Reference <XInterface> xOletest= mgr->createInstance( OUString(L"oletest.OleTest"));
+ Any any;
+ any <<= xOletest;
+ sal_uInt8 arId[16];
+ rtl_getGlobalProcessId( arId);
+ Any target= xSuppl->createBridge( any, Sequence<sal_Int8>( (sal_Int8*)arId, 16), UNO, OLE);
+ CComDispatchDriver oletest;
+ if (target.getValueTypeClass() == getCppuType((sal_uInt32*) 0).getTypeClass())
+ {
+ VARIANT* pVariant = *(VARIANT**)target.getValue();
+
+ oletest= pVariant->pdispVal;
+
+ VariantClear(pVariant);
+ CoTaskMemFree(pVariant);
+ }
+
+ CComVariant varRet;
+ CComVariant varParam1;
+ CComVariant varParam2;
+ CComVariant varParam3;
+ CComVariant varParam4;
+
+ long value= 100;
+ varParam1.vt= VT_I1 | VT_BYREF;
+ varParam1.plVal= &value;
+
+ // Testing the caching of DISPIDs and the process of aquiring member information
+ // on demand in IDispatch::Invoke
+ // Step through the corresponding IDispatch implementation of the ole bridge
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodByte"), &varParam1, &varRet);
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodByte"), &varParam1, &varRet);
+ // Name ok but different case
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"Testinout_methodByte"), &varParam1, &varRet);
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"Testinout_methodByte"), &varParam1, &varRet);
+ // not existing member
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"Testinout"), &varParam1, &varRet);
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"Testinout"), &varParam1, &varRet);
+
+ // Property
+ varParam1.vt= VT_ARRAY | VT_I1;
+ varParam1.parray= (SAFEARRAY*)arByte;
+ hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varParam1);
+ hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varParam1);
+ // Name ok but different case
+ hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"attrByte"), &varParam1);
+ hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"attrByte"), &varParam1);
+ // not existing member
+ hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"attr"), &varParam1);
+ hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"attr"), &varParam1);
+
+ // PropertyGet
+ hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varRet);
+
+ hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"attrByte"), &varRet);
+ hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"attrByte"), &varRet);
+ //not existing member
+ hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"attrBy"), &varRet);
+ hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"attrBy"), &varRet);
+
+ DISPID dispid;
+ LPOLESTR method= L"methodByte";
+ hr = oletest.p->GetIDsOfNames(IID_NULL, &method, 1, LOCALE_USER_DEFAULT, &dispid);
+
+
+ CComVariant arg[1];
+ arg[0].vt= VT_ARRAY | VT_I1;
+ arg[0].parray= (SAFEARRAY*)arByte;
+ DISPPARAMS params={ arg,0,1,0};
+
+ hr = oletest.p->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT,
+ DISPATCH_METHOD | DISPATCH_PROPERTYPUT, &params, &varRet, NULL, NULL);
+
+ hr = oletest.p->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT,
+ DISPATCH_METHOD | DISPATCH_PROPERTYPUT, &params, &varRet, NULL, NULL);
+
+ // different case
+ LPOLESTR method2= L"MEthodByte";
+ hr = oletest.p->GetIDsOfNames(IID_NULL, &method2, 1, LOCALE_USER_DEFAULT, &dispid);
+
+ hr = oletest.p->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT,
+ DISPATCH_METHOD | DISPATCH_PROPERTYPUT, &params, &varRet, NULL, NULL);
+
+ hr = oletest.p->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT,
+ DISPATCH_METHOD | DISPATCH_PROPERTYPUT, &params, &varRet, NULL, NULL);
+
+ LPOLESTR attrib= L"AttrByte";
+ hr = oletest.p->GetIDsOfNames(IID_NULL, &attrib, 1, LOCALE_USER_DEFAULT, &dispid);
+
+ hr = oletest.p->Invoke( dispid, IID_NULL, LOCALE_USER_DEFAULT,
+ DISPATCH_METHOD | DISPATCH_PROPERTYPUTREF, &params, &varRet, NULL, NULL);
+
+ hr = oletest.p->Invoke( dispid, IID_NULL, LOCALE_USER_DEFAULT,
+ DISPATCH_METHOD | DISPATCH_PROPERTYGET, &params, &varRet, NULL, NULL);
+
+
+
+ CComVariant varByteArray;
+ varByteArray.vt= VT_ARRAY | VT_I1;
+ varByteArray.parray= (SAFEARRAY*)arByte;
+ CComVariant varShortArray;
+ varShortArray.vt= VT_ARRAY | VT_I2;
+ varShortArray.parray= (SAFEARRAY*)arShort;
+ CComVariant varLongArray;
+ varLongArray.vt= VT_ARRAY | VT_I4;
+ varLongArray.parray= (SAFEARRAY*)arLong;
+ CComVariant varDoubleArray;
+ varDoubleArray.vt= VT_ARRAY | VT_R8;
+ varDoubleArray.parray= (SAFEARRAY*)arDouble;
+ CComVariant varStringArray;
+ varStringArray.vt= VT_ARRAY | VT_BSTR;
+ varStringArray.parray= (SAFEARRAY*)arString;
+ CComVariant varArray;
+ varArray.vt= VT_ARRAY | VT_VARIANT;
+ varArray.parray= (SAFEARRAY*)arVariant;
+
+ FONTDESC fd={ sizeof( fd), L"ARIAL", 10, FW_NORMAL, 0, 0, 0, 0};
+
+
+ CComPtr< IUnknown > unk1;
+ CComPtr< IUnknown > unk2;
+ CComPtr< IUnknown > unk3;
+
+ IUnknown* _unknown[3];
+ hr= OleCreateFontIndirect( &fd, __uuidof( IUnknown), (void**)&unk1.p);
+ hr= OleCreateFontIndirect( &fd, __uuidof( IUnknown), (void**)&unk2.p);
+ hr= OleCreateFontIndirect( &fd, __uuidof( IUnknown), (void**)&unk3.p);
+ _unknown[0]= unk1;
+ _unknown[1]= unk2;
+ _unknown[2]= unk3;
+ SmartArray<IUnknown*> arUnknown( _unknown, 3, VT_UNKNOWN);
+
+ CComVariant varUnkArray;
+ varUnkArray.vt= VT_ARRAY | VT_UNKNOWN;
+ varUnkArray.parray= (SAFEARRAY*)arUnknown;
+
+ // preparing out parameter;
+ char byteOut;
+ CComVariant varOutByte; //###
+ varOutByte.vt= VT_BYREF | VT_UI1;
+ V_I1REF(&varOutByte)= &byteOut;
+ short shortOut;
+ CComVariant varOutShort; //###
+ varOutShort.vt= VT_BYREF | VT_I2;
+ V_I2REF( &varOutShort)= &shortOut;
+ long longOut;
+ CComVariant varOutLong; //###
+ varOutLong.vt= VT_BYREF | VT_I4;
+ V_I4REF( &varOutLong)= &longOut;
+ double doubleOut;
+ CComVariant varOutDouble; //###
+ varOutDouble.vt= VT_BYREF | VT_R8;
+ V_R8REF( &varOutDouble)= &doubleOut;
+ BSTR bstrOut= NULL;
+ CComVariant varOutString; //###
+ varOutString.vt= VT_BYREF | VT_BSTR;
+ V_BSTRREF(&varOutString)= &bstrOut;
+ CComVariant variantOut;
+ CComVariant varOutAny; //###
+ varOutAny.vt= VT_BYREF | VT_VARIANT;
+ V_VARIANTREF(&varOutAny)= &variantOut;
+
+ CComPtr<IDispatch> dispOut;
+ CComVariant varOutXInterface; //###
+ varOutXInterface.vt= VT_BYREF |VT_DISPATCH;
+ V_DISPATCHREF(&varOutXInterface)= &dispOut.p;
+
+ // In Parameter ( all of type Sequence ###########################################################
+ OutputDebugString( _T("In parameter of type Sequence ###########################################\n"
+ "The functions return the Sequence parameter \n\n"));
+
+ OutputDebugStringA("methodByte | Params: \n");
+ printVariant( varByteArray);
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodByte"), &varByteArray, &varRet);
+ OutputDebugStringA("methodByte | return value \n");
+ printVariant( varRet);
+
+ OutputDebugStringA("methodShort | Params: \n");
+ printVariant( varShortArray);
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodShort"), &varShortArray, &varRet);
+ OutputDebugStringA("methodShort | return value \n");
+ printVariant( varRet);
+
+ OutputDebugStringA("methodLong | Params: \n");
+ printVariant( varLongArray);
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodLong"), &varLongArray, &varRet);
+ OutputDebugStringA("methodLong | return value \n");
+ printVariant( varRet);
+
+ OutputDebugStringA("methodDouble | Params: \n");
+ printVariant( varDoubleArray);
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodDouble"), &varDoubleArray, &varRet);
+ OutputDebugStringA("methodDouble | return value \n");
+ printVariant( varRet);
+
+ OutputDebugStringA("methodString | Params: \n");
+ printVariant( varStringArray);
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodString"), &varStringArray, &varRet);
+ OutputDebugStringA("methodString | return value \n");
+ printVariant( varRet);
+
+ OutputDebugStringA("methodAny | Params: \n");
+ printVariant( varArray);
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodAny"), &varArray, &varRet);
+ OutputDebugStringA("methodAny | return value \n");
+ printVariant( varRet);
+
+ OutputDebugStringA("methodXInterface | Params: \n");
+ printVariant( varUnkArray);
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"methodXInterface"), &varUnkArray, &varRet);
+ OutputDebugStringA("methodAny | return value \n");
+ printVariant( varRet);
+
+ // Out Parameter ###########################################################################
+ OutputDebugString( _T("Out parameter ###########################################\n\n"));
+
+ OutputDebugString(_T("testout_methodByte \n"));
+ hr= oletest.InvokeN(static_cast<LPCOLESTR>(L"testout_methodByte"), &varOutByte, 1, &varRet);
+ OutputDebugString(_T("testout_methodByte | out value: \n"));
+ printVariant( varOutByte);
+
+ OutputDebugString(_T("testout_methodShort \n"));
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodShort"), &varOutShort, &varRet);
+ OutputDebugString(_T("testout_methodShort | out value: \n"));
+ printVariant( varOutShort);
+
+ OutputDebugString(_T("testout_methodLong \n"));
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodLong"), &varOutLong, &varRet);
+ OutputDebugString(_T("testout_methodLong | out value: \n"));
+ printVariant( varOutLong);
+
+ OutputDebugString(_T("testout_methodDouble \n"));
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodDouble"), &varOutDouble, &varRet);
+ OutputDebugString(_T("testout_methodDouble | out value: \n"));
+ printVariant( varOutDouble);
+
+ OutputDebugString(_T("testout_methodString \n"));
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodString"), &varOutString, &varRet);
+ OutputDebugString(_T("testout_methodString | out value: \n"));
+ printVariant( varOutString);
+
+ OutputDebugString(_T("testout_methodAny \n"));
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodAny"), &varOutAny, &varRet);
+ OutputDebugString(_T("methodAny | out value: \n"));
+ printVariant( varOutAny);
+
+ OutputDebugString(_T("testout_methodXInterface \n"));
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodXInterface"), &varOutXInterface, &varRet);
+ OutputDebugString(_T("methodAny | out value: \n"));
+ printVariant( varOutXInterface);
+ CComDispatchDriver outDisp( *varOutXInterface.ppdispVal);
+ CComVariant varAttr3;
+ outDisp.GetPropertyByName(L"AttrAny2", &varAttr3);
+ ATLTRACE("property OleTest.AttrAny2: %s", W2T(varAttr3.bstrVal));
+
+ OutputDebugString(_T("testout_methodMulParams1 ( 2 out Parameter) \n"));
+ long longOut2=0;
+ CComVariant _params[2];
+ longOut=0;
+ _params[0]= varOutLong;
+ _params[1].vt= VT_BYREF | VT_I4;
+ V_I4REF(& _params[1])= &longOut2;
+ hr= oletest.InvokeN( static_cast<LPCOLESTR>(L"testout_methodMulParams1"), (VARIANT*)&_params, 2);
+ OutputDebugString(_T("testout_methodMulParams1 | out values: \n"));
+ printVariant( _params[1]);
+ printVariant( _params[0]);
+
+ OutputDebugString(_T("testout_methodMulParams2 ( 3 out Parameter) \n"));
+ CComVariant _params2[3];
+ _params2[2]= varOutLong;
+ _params2[1].vt= VT_BYREF | VT_I4;
+ V_I4REF(& _params2[1])= &longOut2;
+ _params2[0]= varOutString;
+ hr= oletest.InvokeN( static_cast<LPCOLESTR>( L"testout_methodMulParams2"), (VARIANT*)&_params2, 3);
+ OutputDebugString(_T("testout_methodMulParams2 | out values: \n"));
+ printVariant( _params2[2]);
+ printVariant( _params2[1]);
+ printVariant( _params2[0]);
+
+ OutputDebugString(_T("testout_methodMulParams3 ( 1 in and 1 out Parameter) \n"));
+ CComVariant _params3[2];
+ _params3[1]= CComBSTR(L" In string");
+ _params3[0]= varOutString;
+ hr= oletest.InvokeN( static_cast<LPCOLESTR>( L"testout_methodMulParams3"), (VARIANT*)&_params3, 2);
+ OutputDebugString(_T("testout_methodMulParams3 | out values: \n"));
+ printVariant( _params3[1]);
+ printVariant( _params3[0]);
+
+ //In Out Parameter ###########################################################################
+ OutputDebugString( _T("In Out parameter ###########################################\n\n"));
+
+ *V_I1REF(&varOutByte)= 5;
+ ATLTRACE(_T("testinout_methodByte | in value: %d \n"), *V_I1REF(&varOutByte));
+ hr= oletest.InvokeN(static_cast<LPCOLESTR>(L"testinout_methodByte"), &varOutByte, 1, &varRet);
+ OutputDebugString(_T("testinout_methodByte | out value: \n"));
+ printVariant( varOutByte);
+
+ OutputDebugString(_T("testinout_methodShort | in value= 1000 \n"));
+ *V_UI2REF(&varOutShort)= 1000;
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodShort"), &varOutShort, &varRet);
+ OutputDebugString(_T("testinout_methodShort | out value: \n"));
+ printVariant( varOutShort);
+
+ OutputDebugString(_T("testinout_methodLong | in value= 10000 \n"));
+ *V_UI4REF(&varOutLong)= 10000;
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodLong"), &varOutLong, &varRet);
+ OutputDebugString(_T("testinout_methodLong | out value: \n"));
+ printVariant( varOutLong);
+
+ *V_R8REF(&varOutDouble)= 3.14;
+ ATLTRACE(_T("testinou_methodDouble in value: %f \n"),*V_R8REF(&varOutDouble));
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodDouble"), &varOutDouble, &varRet);
+ OutputDebugString(_T("testinout_methodDouble | out value: \n"));
+ printVariant( varOutDouble);
+
+ SysFreeString( *V_BSTRREF(&varOutString));
+ *V_BSTRREF(&varOutString)= SysAllocString( L"this is a in string");
+ ATLTRACE(_T("testinout_methodString | value: %s \n"), W2T(*V_BSTRREF(&varOutString)));
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodString"), &varOutString, &varRet);
+ OutputDebugString(_T("testinout_methodString | out value: \n"));
+ printVariant( varOutString);
+
+ CComVariant var1(CComBSTR(L" this is a string in a VARIANT"));
+ CComVariant outVar1;
+ outVar1.vt= VT_BYREF | VT_VARIANT;
+ outVar1.pvarVal= &var1;
+ ATLTRACE(_T("testinout_methodAny | parameter: %s\n"), W2T(var1.bstrVal));
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodAny"), &varOutAny, &varRet);
+ OutputDebugString(_T("testinout_methodAny | out value: \n"));
+ printVariant( varOutAny);
+
+ CComPtr< IUnknown > objectIn = unk1;
+ CComVariant varOutIFace;
+ varOutIFace.vt= VT_BYREF | VT_UNKNOWN;
+ varOutIFace.ppunkVal= &objectIn.p;
+ (*varOutIFace.ppunkVal)->AddRef();
+ OutputDebugString(_T("testinout_methodXInterface | in value: \n"));
+ printVariant(varOutIFace);
+ hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodXInterface"), &varOutIFace, &varRet);
+ OutputDebugString(_T("testinout_methodXInterface | out value: \n"));
+ printVariant( varOutIFace);
+
+ // Properties ######################################################################
+ OutputDebugString( _T(" Properties ###########################################\n\n"));
+
+ OutputDebugString(_T("set property \"AttrByte\" | value"));
+ CComVariant propArByte;
+ propArByte.vt= VT_ARRAY | VT_I1;
+ varParam1.parray= (SAFEARRAY*)arByte;
+ printVariant( varParam1);
+ hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varParam1);
+ OutputDebugString(_T("get property \"AttrByte\" | value:"));
+ varRet.Clear();
+ hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varRet);
+ printVariant( varRet);
+
+
+
+ return S_OK;
+
+
+}
+
+
+void printVariant( VARIANT & _var)
+{
+ HRESULT hr;
+ USES_CONVERSION;
+ CComVariant var;
+ hr= VariantCopyInd( &var, &_var);
+ if( var.vt & VT_ARRAY)
+ {
+ VARTYPE type= var.vt ^ VT_ARRAY;
+ SAFEARRAY * sarray= var.parray;
+ long lbound;
+ long ubound;
+ hr= SafeArrayGetLBound( sarray, 1, &lbound);
+ hr= SafeArrayGetUBound( sarray, 1, &ubound);
+ long count= ubound - lbound + 1;
+ char charValue;
+ BYTE byteValue;
+ short shortValue;
+ long longValue;
+ double doubleValue;
+ IUnknown* unkValue;
+ BSTR bstrValue;
+ OutputDebugString( _T("# Array \n"));
+ for( long i= 0; i < count; i++)
+ {
+// CComVariant variantValue;
+ TCHAR *buf[256];
+ wsprintf( (TCHAR*)buf, _T("%d : "), i);
+ OutputDebugString( (TCHAR*)buf);
+ VARIANT varTemp;
+ VariantInit( &varTemp);
+ VARIANT variantValue;
+ VariantInit( &variantValue);
+ switch( type)
+ {
+ case VT_UI1:
+ hr= SafeArrayGetElement( sarray, &i, &byteValue);
+ varTemp.vt= VT_UI1;
+ V_UI1( &varTemp)= byteValue;
+ printVariant( varTemp);
+ break;
+ case VT_I1:
+ hr= SafeArrayGetElement( sarray, &i, &charValue);
+ varTemp.vt= VT_I1;
+ V_I1( &varTemp)= charValue;
+ printVariant( varTemp);
+ break;
+ case VT_I2:
+ hr= SafeArrayGetElement( sarray, &i, &shortValue);
+ varTemp.vt= VT_I2;
+ V_I2( &varTemp)= shortValue;
+ printVariant( varTemp);
+ break;
+
+ case VT_UI2:
+ case VT_I4:
+ hr= SafeArrayGetElement( sarray, &i, &longValue);
+ varTemp.vt= VT_I4;
+ V_I4( &varTemp)= longValue;
+ printVariant( varTemp);
+ break;
+ case VT_R8:
+ hr= SafeArrayGetElement( sarray, &i, &doubleValue);
+ varTemp.vt= VT_R8;
+ V_R8( &varTemp)= doubleValue;
+ printVariant( varTemp);
+ break;
+ case VT_BSTR:
+ hr= SafeArrayGetElement( sarray, &i, &bstrValue);
+ varTemp.vt= VT_BSTR;
+ varTemp.bstrVal= bstrValue;
+ printVariant( varTemp);
+ break;
+ case VT_VARIANT:
+ hr= SafeArrayGetElement( sarray, &i, &varTemp);
+ printVariant( varTemp);
+ break;
+
+ case VT_UNKNOWN:
+ hr= SafeArrayGetElement( sarray, &i, &unkValue);
+ varTemp.vt= VT_UNKNOWN;
+ varTemp.punkVal= unkValue;
+ printVariant( varTemp);
+ break;
+ }
+
+ VariantClear( &varTemp);
+ VariantClear( &variantValue);
+ }
+
+ }
+ else
+ {
+ TCHAR buf[256];
+ switch (var.vt)
+ {
+ case VT_I1: wsprintf( (TCHAR*)buf, _T(" VT_I1: %d \n"), V_I1( &var) );
+ break;
+ case VT_UI1: wsprintf( (TCHAR*)buf, _T(" VT_UI1: %d \n"), V_I1( &var) );
+ break;
+
+ case VT_I2: wsprintf( (TCHAR*)buf, _T(" VT_I2: %d \n"), V_I2( &var) );
+ break;
+ case VT_I4: wsprintf( (TCHAR*)buf, _T(" VT_I4: %d \n"), V_I4( &var) );
+ break;
+ case VT_R8:
+ {
+
+// int decimal, sign;
+// char *buffer;
+// int precision = 14;
+// double source = 3.1415926535;
+
+// buffer = _ecvt( V_R8(&var), precision, &decimal, &sign );
+ sprintf( (TCHAR*)buf, _T(" VT_R8: %f \n"),V_R8( &var) );
+ break;
+ }
+ case VT_UNKNOWN:
+ // The object implement IFont
+ {
+ CComDispatchDriver disp( var.punkVal);
+ CComVariant ret;
+ hr= disp.GetPropertyByName( static_cast<LPCOLESTR>(L"Name"), &ret);
+ wsprintf( (TCHAR*)buf, _T(" VT_UNKNOWN: property \"Name\": %s \n"), W2T(ret.bstrVal));
+ break;
+ }
+ case VT_DISPATCH:
+ // The object implement IFont
+ {
+ CComDispatchDriver disp( var.punkVal);
+ CComVariant ret;
+ if( SUCCEEDED( hr= disp.GetPropertyByName( static_cast<LPCOLESTR>(L"Name"), &ret)))
+ wsprintf( (TCHAR*)buf, _T(" VT_DISPATCH: property \"Name\": %s \n"), W2T(ret.bstrVal));
+ else
+ wsprintf( (TCHAR*)buf, _T(" VT_DISPATCH \n"));
+
+ break;
+ }
+
+
+ case VT_BSTR:
+ {
+ TCHAR* str= W2T( var.bstrVal);
+ wsprintf( (TCHAR*)buf, _T(" VT_BSTR: %s \n"), str);
+ }
+ break;
+ default:
+ wsprintf( (TCHAR*)buf, _T("\n"));
+
+ }
+
+ OutputDebugString( (TCHAR*) buf);
+ }
+
+ return;
+
+}
+
diff --git a/extensions/test/ole/OleConverterVar1/makefile.mk b/extensions/test/ole/OleConverterVar1/makefile.mk
new file mode 100644
index 000000000..e7d8fbd9c
--- /dev/null
+++ b/extensions/test/ole/OleConverterVar1/makefile.mk
@@ -0,0 +1,136 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/
+
+PRJNAME=extensions
+TARGET=convTest
+TARGETTYPE=CUI
+LIBTARGET=NO
+
+#USE_DEFFILE= TRUE
+NO_BSYMBOLIC= TRUE
+ENABLE_EXCEPTIONS=TRUE
+BOOTSTRAP_SERVICE=FALSE
+
+# --- Settings ---
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files ---
+
+UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
+
+.IF "$(BOOTSTRAP_SERVICE)" == "TRUE"
+UNOUCROUT= $(OUT)$/inc$/comprehensive
+INCPRE+= $(OUT)$/inc$/comprehensive
+CPPUMAKERFLAGS += -C
+.ELSE
+UNOUCROUT= $(OUT)$/inc
+INCPRE+= $(OUT)$/inc -I$(SOLARINCDIR)$/3rdparty$/atl
+.ENDIF
+
+UNOTYPES= com.sun.star.bridge.ModelDependent \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.bridge.XBridgeSupplier2
+
+
+
+.IF "$(depend)" != ""
+
+.ENDIF # depend
+
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJ)$/convTest.obj
+LIBCMT=msvcrtd.lib
+
+
+APP1STDLIBS= \
+ $(SALLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ user32.lib \
+ kernel32.lib \
+ ole32.lib \
+ oleaut32.lib \
+ uuid.lib \
+ comdlg32.lib
+
+
+
+#gdi32.lib winspool.lib advapi32.lib shell32.lib odbc32.lib odbccp32.lib
+
+
+.IF "$(GUI)"=="WNT"
+APP1STDLIBS += $(LIBCIMT)
+APP2STDLIBS += $(LIBCIMT)
+.ENDIF
+
+APP1DEF= $(MISC)\$(APP1TARGET).def
+
+# --- Targets ---
+
+.INCLUDE : target.mk
+
diff --git a/extensions/test/ole/OleConverterVar1/readme.txt b/extensions/test/ole/OleConverterVar1/readme.txt
new file mode 100644
index 000000000..104fb1808
--- /dev/null
+++ b/extensions/test/ole/OleConverterVar1/readme.txt
@@ -0,0 +1,2 @@
+The program test the Service com.sun.star.bridge.OleBridgeSupplierVar1.
+While running in debug mode it writes infos to the debug - output. \ No newline at end of file
diff --git a/extensions/test/ole/OleConverterVar1/smartarray.h b/extensions/test/ole/OleConverterVar1/smartarray.h
new file mode 100644
index 000000000..f32e9c31a
--- /dev/null
+++ b/extensions/test/ole/OleConverterVar1/smartarray.h
@@ -0,0 +1,267 @@
+/*************************************************************************
+ *
+ * $RCSfile: smartarray.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _SMARTARRAY_H
+#define _SMARTARRAY_H
+
+
+template< class sourceType>
+class SmartArray
+{
+ SAFEARRAY *m_array;
+public:
+
+ SmartArray( sourceType * parParams, int count, VARTYPE destVartype): m_array(NULL)
+ {
+ HRESULT hr= S_OK;
+ SAFEARRAYBOUND rgsabound[1];
+ rgsabound[0].cElements= count;
+ rgsabound[0].lLbound= 0;
+ m_array= SafeArrayCreate( destVartype, 1, rgsabound);
+ SafeArrayLock( m_array);
+
+ void* pData;
+ if( m_array && (SUCCEEDED( SafeArrayAccessData( m_array, (void**)&pData)) ) )
+ {
+
+ for( int i=0; i< count; i++)
+ {
+ CComVariant varSource( parParams[i]);
+ switch (destVartype)
+ {
+ case VT_I1:
+ {
+ char* p= (char*) pData;
+ if( SUCCEEDED( hr= varSource.ChangeType( destVartype)))
+ p[i]= V_I1( &varSource);
+ break;
+ }
+ case VT_I2:
+ {
+ short* p= (short*) pData;
+ if( SUCCEEDED( hr=varSource.ChangeType( destVartype)))
+ p[i]= V_I2( &varSource);
+ break;
+ }
+ case VT_UI2:
+ {
+ unsigned short* p= (unsigned short*) pData;
+ if( SUCCEEDED( hr=varSource.ChangeType( destVartype)))
+ p[i]= V_UI2( &varSource);
+ break;
+ }
+ case VT_I4:
+ {
+ long* p= (long*)pData;
+ if( SUCCEEDED( hr=varSource.ChangeType( destVartype)))
+ p[i]= V_I4( &varSource);
+ break;
+ }
+ case VT_UI4:
+ {
+ unsigned long* p= (unsigned long*)pData;
+ if( SUCCEEDED( hr=varSource.ChangeType( destVartype)))
+ p[i]= V_UI4( &varSource);
+ break;
+ }
+ case VT_R4:
+ {
+ float* p= (float*)pData;
+ if( SUCCEEDED( hr=varSource.ChangeType( destVartype)))
+ p[i]= V_R4( &varSource);
+ break;
+ }
+ case VT_R8:
+ {
+ double* p= (double*)pData;
+ if( SUCCEEDED( hr=varSource.ChangeType( destVartype)))
+ p[i]= V_R8( &varSource);
+ break;
+ }
+ case VT_BOOL:
+ {
+ VARIANT_BOOL* p= (VARIANT_BOOL*)pData;
+ if( SUCCEEDED( hr=varSource.ChangeType( destVartype)))
+ p[i]= V_BOOL( &varSource);
+ break;
+ }
+ case VT_BSTR:
+ {
+ BSTR* pBstr= ( BSTR*)pData;
+ if( SUCCEEDED( hr=varSource.ChangeType( destVartype)))
+ pBstr[i]= SysAllocString(V_BSTR( &varSource));
+ break;
+ }
+ case VT_VARIANT:
+ {
+ VARIANT *pVariant= (VARIANT*)pData;
+ hr= VariantCopy( &pVariant[i], &varSource); break;
+ }
+// case VT_UNKNOWN:
+// {
+// long* pUnk= (long*)pData;
+// pUnk[i]= reinterpret_cast<long>(parParams[i]);
+// ((IUnknown*)pUnk[i])->AddRef(); break;
+// }
+// case VT_DISPATCH:
+// {
+// long* pDisp= (long*)pData;
+// pDisp[i]= (long)parParams[i];
+// ((IDispatch*)pDisp[i])->AddRef(); break;
+// }
+ default:
+ hr= E_FAIL;
+ }
+ }
+ if( FAILED( hr))
+ {
+ SafeArrayDestroy( m_array);
+ m_array= NULL;
+ }
+ }
+ SafeArrayUnaccessData( m_array);
+ }
+ ~SmartArray(){
+ SafeArrayUnlock( m_array);
+ SafeArrayDestroy( m_array );
+ }
+
+ operator bool (){ return m_array == NULL ? false : true; }
+
+ operator SAFEARRAY* (){ return m_array;}
+
+};
+
+template<>
+class SmartArray<IUnknown*>
+{
+ SAFEARRAY *m_array;
+public:
+
+ SmartArray( sourceType * parParams, int count, VARTYPE destVartype);
+// {
+// ATLTRACE("SmartArray<IUnknown>");
+// HRESULT hr= S_OK;
+// SAFEARRAYBOUND rgsabound[1];
+// rgsabound[0].cElements= count;
+// rgsabound[0].lLbound= 0;
+// m_array= SafeArrayCreateVector( VT_UNKNOWN, 0, count);
+// SafeArrayLock( m_array);
+//
+// IUnknown* *pData;
+// if( m_array && (SUCCEEDED( SafeArrayAccessData( m_array, (void**)&pData)) ) )
+// {
+//
+// for( int i=0; i< count; i++)
+// {
+// CComVariant varSource( parParams[i]);
+// switch (destVartype)
+// {
+//
+// case VT_UNKNOWN:
+// {
+// pData[i]= parParams[i];
+// pData[i]->AddRef();
+// }
+// default:
+// hr= E_FAIL;
+// }
+// }
+// if( FAILED( hr))
+// {
+// SafeArrayDestroy( m_array);
+// m_array= NULL;
+// }
+// }
+// SafeArrayUnaccessData( m_array);
+// }
+ ~SmartArray(){
+ SafeArrayUnlock( m_array);
+ SafeArrayDestroy( m_array );
+ }
+
+ operator bool (){ return m_array == NULL ? false : true; }
+
+ operator SAFEARRAY* (){ return m_array;}
+
+};
+
+template <> SmartArray <IUnknown*>::SmartArray(sourceType * parParams, int count, VARTYPE destVartype):m_array(NULL)
+{
+ ATLTRACE("SmartArray<IUnknown>");
+ HRESULT hr= S_OK;
+ SAFEARRAYBOUND rgsabound[1];
+ rgsabound[0].cElements= count;
+ rgsabound[0].lLbound= 0;
+ m_array= SafeArrayCreateVector( VT_UNKNOWN, 0, count);
+ SafeArrayLock( m_array);
+
+ IUnknown* *pData;
+ if( m_array && (SUCCEEDED( SafeArrayAccessData( m_array, (void**)&pData)) ) )
+ {
+ for( int i=0; i< count; i++)
+ {
+ pData[i]= parParams[i];
+ pData[i]->AddRef();
+ }
+ }
+ SafeArrayUnaccessData( m_array);
+};
+#endif
diff --git a/extensions/test/ole/OleTest.htm b/extensions/test/ole/OleTest.htm
new file mode 100644
index 000000000..d59392eb9
--- /dev/null
+++ b/extensions/test/ole/OleTest.htm
@@ -0,0 +1,943 @@
+<HTML>
+<HEAD>
+<META NAME="GENERATOR" Content="Microsoft Developer Studio">
+<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
+<TITLE>Document Title</TITLE>
+</HEAD>
+<BODY id=theBody>
+
+<script language="JScript">
+function callOleTest( id)
+{
+ var factory= new ActiveXObject("com.sun.star.ServiceManager");
+ var oletest= factory.createInstance("oletest.OleTest");
+// alert(oletest);
+
+ var arr= new Array( 1, 2, 3, 4, 0);
+ var arrDouble= new Array( 1.2345, 12.345, 123,45, 1234.5, 12345);
+ var arrBool= new Array( 1, 0, 2, 0, 3);
+ var arrChar= new Array( '1', 'A', "1", "A", ' ', 55, 56);
+ var arrString= new Array("hamburger","cheeseburger", "chicken nuggets", "chicken wings" , "pizza");
+ var arrAny= new Array( 100, 100.1235,"hallo");
+ var arrSeq= new Array( arr, arr, arr);
+ var arrSeq2= new Array( arrSeq, arrSeq, arrSeq)
+
+
+ var arrout1= new Array();
+ var arrout2= new Array();
+ var arrout3= new Array();
+
+ var ret, i;
+ var sfarray, sfarray1, sfarray2, sfarray3;
+ switch( id)
+ {
+ // Array in-params
+ case 1: ret= oletest.methodByte( arr);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arr.toString() + "<br>");
+ document.writeln( "Returns a Sequence&lt BYTE &gt <br>" + sfarray.toArray()) ; break;
+
+ case 2: ret= oletest.methodDouble( arrDouble);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arrDouble.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt double &gt <br>" + sfarray.toArray()) ; break;
+
+ case 3: ret= oletest.methodBool( arrBool);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arrBool.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt BOOL &gt <br>" + sfarray.toArray()) ; break;
+
+ case 4: ret= oletest.methodShort( arr);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arr.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt SHORT &gt <br>" + sfarray.toArray()) ; break;
+
+ case 5: ret= oletest.methodUShort( arr);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arr.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt unsigned SHORT &gt <br>" + sfarray.toArray()) ; break;
+
+ case 6: ret= oletest.methodLong( arr);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arr.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt LONG &gt <br>" + sfarray.toArray()) ; break;
+
+ case 7: ret= oletest.methodULong( arr);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arr.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt unsigned LONG &gt <br>" + sfarray.toArray()) ; break;
+
+ case 8: ret= oletest.methodChar( arrChar);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arrChar.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt wchar_t &gt <br>" + sfarray.toArray()) ; break;
+
+ case 9: ret= oletest.methodString( arrString);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arrString.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt UString &gt <br>" + sfarray.toArray()) ; break;
+
+ case 10: ret= oletest.methodAny( arrAny);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arrAny.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt UsrAny &gt <br>" + sfarray.toArray() ) ; break;
+
+ case 11: ret= oletest.methodSequence( arrSeq);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arrSeq.toString() +"<br>");
+ document.writeln("Returns a Sequence&lt Sequence &lt long &gt&gt <br>") ;
+ var arr1= new Array();
+ arr1= sfarray.toArray();
+ for( i=0; i < arr1.length; i++)
+ {
+ sfarray2= new VBArray( arr1[i]);
+ var arr2= new Array();
+ arr2= sfarray2.toArray();
+ document.writeln( arr2.toString() + "<br>" );
+ }
+ break;
+
+ case 12: ret= oletest.methodSequence2( arrSeq2);
+ document.writeln( "Param: " + arrSeq2.toString() +"<br>");
+ sfarray1= new VBArray( ret);
+ arr1= sfarray1.toArray();
+ for( i=0; i < arr1.length; i++)
+ {
+ sfarray2= new VBArray( arr1[i]);
+ arr2= sfarray2.toArray();
+
+ for ( j=0; j < arr2.length; j++)
+ {
+ sfarray3= new VBArray( arr2[j]);
+ arr3= sfarray3.toArray();
+ document.write( i+ " ");
+ document.writeln(j + ": "+ arr3.toString() + "<br>" );
+ }
+
+ }
+ break;
+
+ case 13:
+ var ar= new Array();
+ for( i=0; i< 3; i++)
+ {
+ var ob= new Object();
+ ob.value= "A JScript object!";
+ ar[i]= ob;
+ }
+
+ ret = oletest.methodXInterface( ar);
+ sfarray= new VBArray( ret);
+ var arRet= sfarray.toArray();
+
+ document.writeln( "Params : Array containing objects ")
+ for( index in ar)
+ {
+ document.writeln( "object " + index + ": " + ar[index].value +" ");
+ }
+ document.writeln( "<br>" ) ;
+ document.writeln("Return: <br>");
+ for( index in arRet)
+ {
+ document.writeln( "object " + index + ": " + arRet[index].value + " ");
+ }
+ break;
+
+ case 14: ret= oletest.methodFloat( arrDouble);
+ sfarray= new VBArray( ret);
+ document.writeln( "Param: " + arrDouble.toString() +"<br>");
+ document.writeln( "Returns a Sequence&lt float&gt <br>" + sfarray.toArray()) ; break;
+
+
+
+
+
+
+ // Properties: setting and getting values
+ case 200: oletest.AttrByte = arr;
+ ret= oletest.AttrByte;
+ document.writeln("Setting AttrByte: " + arr.toString() + "<p>");
+ document.writeln("Getting AttrByte: " + arr.toString()); break;
+
+ case 201: oletest.AttrDouble= arrDouble;
+ ret= oletest.AttrDouble;
+ document.writeln("Setting AttrDouble: " + arrDouble.toString() + "<p>");
+ document.writeln("Getting AttrDouble: " + arrDouble.toString()); break;
+
+ case 202: oletest.AttrBool= arrBool;
+ ret= oletest.AttrBool;
+ document.writeln("Setting AttrBool: " + arrBool.toString() + "<p>");
+ document.writeln("Getting AttrBool: " + arrBool.toString()); break;
+
+ case 203: oletest.AttrShort= arr;
+ ret= oletest.AttrShort;
+ document.writeln("Setting AttrShort: " + arr.toString() + "<p>");
+ document.writeln("Getting AttrShort: " + arr.toString()); break;
+
+ case 204: oletest.AttrUShort= arr;
+ ret= oletest.AttrUShort;
+ document.writeln("Setting AttrUShort: " + arr.toString() + "<p>");
+ document.writeln("Getting AttrUShort: " + arr.toString()); break;
+
+ case 205: oletest.AttrLong= arr;
+ ret= oletest.AttrLong;
+ document.writeln("Setting AttrLong: " + arr.toString() + "<p>");
+ document.writeln("Getting AttrLong: " + arr.toString()); break;
+
+ case 206: oletest.AttrULong= arr;
+ ret= oletest.AttrULong;
+ document.writeln("Setting AttrULong: " + arr.toString() + "<p>");
+ document.writeln("Getting AttrULong: " + arr.toString()); break;
+
+ case 207: oletest.AttrChar= arrChar;
+ ret= oletest.AttrChar;
+ document.writeln("Setting AttrChar: " + arrChar.toString() + "<p>");
+ document.writeln("Getting AttrChar: " + arrChar.toString()); break;
+
+ case 208: oletest.AttrString= arrString;
+ ret= oletest.AttrString;
+ document.writeln("Setting AttrString: " + arrString.toString() + "<p>");
+ document.writeln("Getting AttrString: " + arrString.toString()); break;
+
+ case 209: oletest.AttrAny= arrAny;
+ ret= oletest.AttrAny;
+ document.writeln("Setting AttrAny: " + arrAny.toString() + "<p>");
+ document.writeln("Getting AttrAny: " + arrAny.toString()); break;
+
+ case 210: oletest.AttrSequence= arrSeq;
+ ret= oletest.AttrSequence;
+ document.writeln("Setting AttrSequence: " + arrSeq.toString() + "<p>");
+ document.writeln("Getting AttrSequence: " + arrSeq.toString()); break;
+
+ case 211: oletest.AttrSequence2= arrSeq2;
+ ret= oletest.AttrSequence2;
+ document.writeln("Setting AttrSequence2: " + arrSeq2.toString() + "<p>");
+ document.writeln("Getting AttrSequence2: " + arrSeq2.toString()); break;
+
+ case 212: oletest.AttrFloat= arrDouble;
+ ret= oletest.AttrFloat;
+ document.writeln("Setting AttrFloat: " + arrDouble.toString() + "<p>");
+ document.writeln("Getting AttrFloat: " + arrDouble.toString()); break;
+
+
+
+ // Out-parameter ------------------------------------------------------------
+ case (2000):
+ oletest.testout_methodByte( arrout1 );
+ alert("byte: " + arrout1[0] ); break;
+ case (2001):
+ oletest.testout_methodDouble( arrout1 );
+ alert( "double: " + arrout1[0] ); break;
+ case (2002):
+ oletest.testout_methodBool( arrout1 );
+ alert( "boolean: " + arrout1[0] ); break;
+ case (2003):
+ oletest.testout_methodShort( arrout1 );
+ alert( "short: " + arrout1[0] ); break;
+ case (2004):
+ oletest.testout_methodUShort( arrout1 );
+ alert( "unsigned short: " + arrout1[0] ); break;
+ case (2005):
+ oletest.testout_methodLong( arrout1 );
+ alert( "long: " + arrout1[0] ); break;
+ case (2006):
+ oletest.testout_methodULong( arrout1 );
+ alert( "unsigned long: " + arrout1[0] ); break;
+ case (2007):
+ oletest.testout_methodChar( arrout1 );
+ alert( "char: " + arrout1[0] ); break;
+ case (2008):
+ oletest.testout_methodString( arrout1 );
+ alert( "string: " + arrout1[0] ); break;
+ case (2009):
+ oletest.testout_methodAny( arrout1 );
+ alert( "any: " + arrout1[0] ); break;
+ case (2010):
+ oletest.testout_methodSequence( arrout1 );
+ var sfarray= new VBArray( arrout1[0]);
+ arr= sfarray.toArray();
+ document.writeln("use the browser's back arrow to go to the previous page <p>");
+ document.writeln( arr.toString());
+ break;
+ case (2011):
+ oletest.testout_methodSequence2( arrout1 );
+ var sfarray= new VBArray( arrout1[0]);
+ arr= sfarray.toArray();
+ var i;
+ for( i=0; i < arr.length; i++)
+ {
+ var sfarray= new VBArray( arr[i]);
+ var arr2= new Array();
+ arr2= sfarray.toArray();
+ document.writeln( arr2.toString() + "<br>" );
+ }
+ break;
+ case (2012):
+ oletest.testout_methodMulParams1( arrout1, arrout2 );
+ document.writeln( "int : " + arrout1[0] + " int :" + arrout2[0] ); break;
+ case (2013):
+ oletest.testout_methodMulParams2( arrout1, arrout2, arrout3 );
+ document.writeln( "int: " + arrout1[0] + " int: " + arrout2[0] + " string: " + arrout3[0] ); break;
+ case (2014):
+ oletest.testout_methodMulParams3( "hallo", arrout1 );
+ document.writeln( "string: " + arrout1[0] ); break;
+ case (2015):
+ oletest.testout_methodXInterface( arrout1 );
+ document.writeln( "string: " + arrout1[0].AttrAny2); break;
+ case (2016):
+ oletest.testout_methodFloat( arrout1 );
+ alert( "float: " + arrout1[0] ); break;
+ case (2017):
+ var in1= 3.14;
+ var in2= 1111;
+ var in3= -2222;
+ oletest.testout_methodMulParams4( in1, arrout1, in2, arrout2, in3 );
+ document.write("param1 [in] float: " + in1 + " param2 [out] float: " + arrout1[0] +
+ " param3 [in] long: " + in2 + " param4 [out] long: " + arrout2[0] +
+ " param5 [in] long: " + in3);
+ break;
+
+
+ // INOUT - Parameter -------------------------------------------------------------------------------
+ // The in value has to be placed on index 0 of the passed in array
+ case (500):
+ arrout1[0]= 100;
+ oletest.testinout_methodByte( arrout1 );
+ alert("byte: " + arrout1[0] ); break;
+ case (501):
+ arrout1[0]= 3.14;
+ oletest.testinout_methodDouble( arrout1 );
+ alert( "double: " + arrout1[0] ); break;
+ case (502):
+ arrout1[0]= false;
+ oletest.testinout_methodBool( arrout1 );
+ alert( "boolean: " + arrout1[0] ); break;
+ case (503):
+ arrout1[0]= 200;
+ oletest.testinout_methodShort( arrout1 );
+ alert( "short: " + arrout1[0] ); break;
+ case (504):
+ arrout1[0]= 300;
+ oletest.testinout_methodUShort( arrout1 );
+ alert( "unsigned short: " + arrout1[0] ); break;
+ case (505):
+ arrout1[0]= 400;
+ oletest.testinout_methodLong( arrout1 );
+ alert( "long: " + arrout1[0] ); break;
+ case (506):
+ arrout1[0]= 500;
+ oletest.testinout_methodULong( arrout1 );
+ alert( "unsigned long: " + arrout1[0] ); break;
+ case (507):
+ arrout1[0]= "A";
+ oletest.testinout_methodChar( arrout1 );
+ alert( "char: " + arrout1[0] ); break;
+ case (508):
+ arrout1[0]= "I am a string";
+ oletest.testinout_methodString( arrout1 );
+ alert( "string: " + arrout1[0] ); break;
+ case (509):
+ arrout1[0]= arr;
+ oletest.testinout_methodAny( arrout1 ); // the method simply returns the argument
+ sfarray= new VBArray( arrout1[0]);
+ arr= sfarray.toArray();
+ alert( "any: " + arr.toString() ); break;
+ case (510):
+ arrout1[0]= arr;
+ oletest.testinout_methodSequence( arrout1 );
+ var sfarray= new VBArray( arrout1[0]);
+ arr= sfarray.toArray();
+ document.writeln("use the browser's back arrow to go to the previous page <p>");
+ document.writeln( arr.toString());
+ break;
+ case (511):
+ arrout1[0]= arrSeq;
+ oletest.testinout_methodSequence2( arrout1 );
+ var sfarray= new VBArray( arrout1[0]);
+ arr= sfarray.toArray();
+ var i;
+ for( i=0; i < arr.length; i++)
+ {
+ var sfarray= new VBArray( arr[i]);
+ var arr2= new Array();
+ arr2= sfarray.toArray();
+ document.writeln( arr2.toString() + "<br>" );
+ }
+ break;
+ case 512:
+ var ob= new Object();
+ ob.value= "this is a string";
+
+ arrout1[0]= ob;
+ alert (arrout1[0].value);
+ oletest.testinout_methodXInterface( arrout1);
+ var outValue= arrout1[0];
+ for ( key in outValue)
+ {
+ document.write( outValue[key] );
+ }
+ document.write("Out value: " + outValue );
+ document.write("Out 1 value: " + arrout1[1]);
+ break;
+
+// var ob= new Object();
+// ob.value= "this is a string";
+// inoutValue.Set( "object", ob);
+// oletest.testinout_methodXInterface( inoutValue);
+// document.write("Out value: " + inoutValue.Get().value );
+// break;
+
+ case (513):
+ arrout1[0]= 3.14;
+ oletest.testinout_methodFloat( arrout1 );
+ alert( "float: " + arrout1[0] ); break;
+
+
+
+ // Test ANY
+ // Methods
+ case 1000:
+ i= 100;
+ ret= oletest.methodAnyTest1( i);
+ document.writeln( "in: " + i + " ret: " + ret);
+ break;
+ case 1001:
+ i= 3.14;
+ ret= oletest.methodAnyTest1( i);
+ document.writeln( "in: " + i + " ret: " + ret);
+ break;
+ case 1002:
+ i= "Hallo"
+ ret= oletest.methodAnyTest1( i);
+ document.writeln( "in: " + i + " ret: " + ret);
+ break;
+ case 1003:
+ i= arr;
+ ret= oletest.methodAnyTest1( i);
+ sfarray= new VBArray( ret);
+ document.writeln( "in: " + i + " ret: " + sfarray.toArray());
+ break;
+ case 1004:
+ var obj= new Object();
+ obj[1]= "This is index 0";
+ ret= oletest.methodAnyTest1( obj);
+ document.writeln( "in: " + obj + " ret: " + ret);
+ break;
+
+
+ // Test ANY property
+ case 1010:
+ i= 100;
+ oletest.AttrAny2= i;
+ ret= oletest.AttrAny2;
+ document.writeln( "set: " + i + " get: " + ret);
+ break;
+ case 1011:
+ i= 3.14;
+ oletest.AttrAny2= i;
+ ret= oletest.AttrAny2;
+ document.writeln( "set: " + i + " get: " + ret);
+ break;
+ case 1012:
+ i= "Hallo"
+ oletest.AttrAny2= i;
+ ret= oletest.AttrAny2;
+ document.writeln( "set: " + i + " get: " + ret);
+ break;
+ case 1013:
+ i= arr;
+ oletest.AttrAny2= i;
+ ret= oletest.AttrAny2;
+ sfarray= new VBArray( ret);
+ document.writeln( "set: " + i + " get: " + sfarray.toArray());
+ break;
+ case 1014:
+ var obj= new Object();
+ obj[1]= "This is index 0";
+ oletest.AttrAny2= obj;
+ ret= oletest.AttrAny2;
+ document.writeln( "set: " + obj + " get: " + ret);
+ break;
+
+ case 1020:
+ var val= 3.14;
+ oletest.in_float( val);
+ break;
+
+ case 2100:
+ alert("2100");
+ var ret= oletest.retMethodByte();
+ var sfarray= VBArray( ret);
+ document.writeln( sfarray.toArray() );
+ break;
+
+
+
+ }
+
+}
+
+function funcOut( out)
+{
+ out["du"]= 0xffff;
+}
+
+</script>
+
+<script language="VBScript">
+
+sub callBasic(id)
+
+ Dim factory
+ Set factory= GetObject("", "com.sun.star.ServiceManager")
+
+ Set oletest= factory.createInstance("oletest.OleTest")
+
+
+ arrInt= Array(1,2,3,4,5)
+ arrInt2= Array( -1, -2, 127, 128, 0)
+ arrDouble= Array(1.1, 2.2, 3.3, 4.4, 5.5)
+ arrBool= Array(0,1,0,2,0)
+ arrLong= Array( &Hff, &Hffff, &Hffffff, &Hffffffff)
+ arrString= Array("Chicken Wings", "Cheeseburger", "Hamburger")
+ arrChar= Array("a",65, "M")
+ arrAny= Array("Mickey", 3.14, 100, "A")
+
+ Dim arrDim2Int(1,1)
+ For i= 0 To 1
+ For j= 0 To 1
+ arrDim2Int(i,j) = i*2 + j
+ Next
+ Next
+
+ Dim arrDim3Int(1,1,1)
+ For i= 0 To 1
+ For j= 0 To 1
+ For k=0 To 1
+ arrDim3Int(i,j,k) = i*2 + j*2 + k
+ Next
+ Next
+ Next
+
+
+ select case id
+ case 0
+ document.writeln "param: "
+ printArray arrInt
+ ret= oletest.methodByte(arrInt)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 1
+ document.writeln "param: "
+ printArray arrDouble
+ ret= oletest.methodDouble(arrDouble)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 2
+ document.writeln "param: "
+ printArray arrBool
+ ret= oletest.methodBool(arrBool)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 3
+ document.writeln "param: "
+ printArray arrInt2
+ ret= oletest.methodShort(arrInt2)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 4
+ document.writeln "param: "
+ printArray arrInt
+ ret= oletest.methodUShort(arrInt)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 5
+ document.writeln "param: "
+ printArray arrLong
+ ret= oletest.methodLong(arrLong)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 6
+ document.writeln "param: "
+ printArray arrInt
+ ret= oletest.methodULong(arrInt)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 7
+ document.writeln "param: "
+ printArray arrString
+ ret= oletest.methodString(arrString)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 8
+ document.writeln "param: "
+ printArray arrChar
+ ret= oletest.methodChar(arrChar)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 9
+ document.writeln "param: "
+ printArray arrAny
+ ret= oletest.methodAny(arrAny)
+ document.writeln "<br> return value: "
+ printArray ret
+ case 10
+ document.writeln "param: "
+ printArray2 arrDim2Int
+ ret= oletest.methodSequence(arrDim2Int)
+ document.writeln "<br> return value: "
+ for each val in ret
+ document.write "<br> array: "
+ for each val2 in val
+ document.write val2
+ next
+ next
+
+ // Out Parameter
+ case 150
+ dim rOut
+ oletest.testout_methodByte rOut
+ MsgBox rOut
+// void testout_methodFloat( [out] float rOut);
+// void testout_methodDouble( [out] double rOut);
+// void testout_methodBool( [out] boolean rOut);
+// void testout_methodShort( [out] short rOut);
+// void testout_methodUShort( [out] unsigned short rOut);
+// void testout_methodLong( [out] long rOut);
+// void testout_methodULong( [out] unsigned long rOut);
+
+
+ // In Out Parameter --------------------------------------------------
+ case 100
+ a= 100
+ document.write "param: " & CStr( a) & "<br>"
+ oletest.testinout_methodByte a
+ document.write a
+ case 101
+ a= 1.11
+ document.write "param: " & CStr( a) & "<br>"
+ oletest.testinout_methodDouble a
+ document.write a
+ case 102
+ a= 5
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodBool a
+ document.write a
+ case 103
+ a= -10
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodShort a
+ document.write a
+ case 104
+ a= 128
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodUShort a
+ document.write a
+ case 105
+ a= 65556
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodLong a
+ document.write a
+ case 106
+ a= 65556
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodULong a
+ document.write a
+ case 107
+ a= "ein test string"
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodString a
+ document.write a
+ case 108
+ a= "W"
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testinout_methodChar a
+ document.write a
+ case 109
+ a= "Ein String im Any"
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.other_methodAnyIn a
+ document.write a
+
+ case 150
+ dim a
+ document.write "param: "& CStr( a) & "<br>"
+ oletest.testout_methodByte( a)
+ document.write a
+// Attributes -----------------------------------------------------------------
+ case 200
+ document.write "set: "
+ printArray arrInt
+ oletest.AttrByte= arrInt
+ b= oletest.AttrByte
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 201
+ document.write "set: "
+ printArray arrDouble
+ oletest.AttrDouble= arrDouble
+ b= oletest.AttrDouble
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 202
+ document.write "set: "
+ printArray arrBool :
+ oletest.AttrBool= arrBool
+ b= oletest.AttrBool
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 203
+ document.write "set: "
+ printArray arrInt2 :
+ oletest.AttrShort= arrInt2
+ b= oletest.AttrShort
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 204
+ document.write "set: "
+ printArray arrInt
+ oletest.AttrUShort= arrInt
+ b= oletest.AttrUShort
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 205
+ document.write "set: "
+ printArray arrInt2
+ oletest.AttrLong= arrInt2
+ b= oletest.AttrLong
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 206
+ document.write "set: "
+ printArray arrInt
+ oletest.AttrULong= arrInt
+ b= oletest.AttrULong
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 207
+ document.write "set: "
+ printArray arrString
+ oletest.AttrString= arrString
+ b= oletest.AttrString
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 208
+ document.write "set: "
+ printArray arrChar
+ oletest.AttrChar= arrChar
+ b= oletest.AttrChar
+ call printArrayEx( "<br> get: ", "<br>", b)
+ case 209
+ document.write "set: "
+ printArray arrAny
+ oletest.AttrAny= arrAny
+ b= oletest.AttrAny
+ call printArrayEx( "<br> get: ", "<br>", b)
+
+ case 210
+ document.write "set: <br>"
+ printArray2 arrDim2Int :
+ oletest.AttrSequence= arrDim2Int
+ ret= oletest.AttrSequence
+ document.write "get: "
+ for each val in ret
+ document.write "<br> array: "
+ for each val2 in val
+ document.write val2
+ next
+ next
+
+ case 300
+ dim aByte
+ aByte= 100
+ call oletest.testinout_methodByte( aByte)
+ MsgBox aByte
+
+ end select
+end sub
+sub printArray( arr)
+ document.write "array: "
+ For Each val In arr
+ document.write CStr(val) & " "
+ Next
+end sub
+
+// print a 2 dimensional Array
+
+sub printArray2( arr)
+ elements1= UBound( arr, 1) - LBound( arr, 1) +1
+ elements2= UBound( arr, 2) - LBound( arr, 2) +1
+
+ For i=0 To elements1 -1
+ document.write( "array " & CStr( i) & ": " )
+ For j=0 To elements2 -1
+ document.write CStr( arr(i,j))
+ Next
+ document.write( "<br>")
+ Next
+end sub
+
+sub printArrayEx( pre, post, array)
+ document.write pre
+ printArray array
+ document.write post
+end sub
+</script>
+
+<div id=out> </div>
+
+<!-- Insert HTML here -->
+
+<h2> JScript </h2>
+Tests Array/Sequence conversion.<br>
+All methods receive a Sequence as Parameter. The element type of the Sequence is written on the buttons.
+<br>
+<button onclick='callOleTest( 1)'>byte</Button>
+<button onclick='callOleTest( 14)'>float</Button>
+<button onclick='callOleTest( 2)'>double</Button>
+<button onclick='callOleTest( 3)'>boolean</Button>
+<button onclick='callOleTest( 4)'>short</Button>
+<button onclick='callOleTest( 5)'>unsigned short</Button>
+<button onclick='callOleTest( 6)'>long</Button>
+<button onclick='callOleTest( 7)'>unsigned long</Button>
+<button onclick='callOleTest( 8)'>char</Button>
+<button onclick='callOleTest( 9)'>string</Button>
+<button onclick='callOleTest( 10)'>any</Button>
+<button onclick='callOleTest( 11)'>sequence&ltlong&gt </Button>
+<button onclick='callOleTest( 12)'>sequence&ltsequence&ltlong&gt &gt </Button>
+<button onclick='callOleTest( 13)'>XInterface</Button>
+
+<p>
+
+<p>
+Out Parameter <br>
+<button onclick='callOleTest( 2000)'>byte </Button>
+<button onclick='callOleTest( 2016)'>float</Button>
+<button onclick='callOleTest( 2001)'>double</Button>
+<button onclick='callOleTest( 2002)'>boolean</Button>
+<button onclick='callOleTest( 2003)'>short</Button>
+<button onclick='callOleTest( 2004)'>unsigned short</Button>
+<button onclick='callOleTest( 2005)'>long</Button>
+<button onclick='callOleTest( 2006)'>unsigned long</Button>
+<button onclick='callOleTest( 2007)'>char</Button>
+<button onclick='callOleTest( 2008)'>string</Button>
+<button onclick='callOleTest( 2009)'>any</Button>
+<button onclick='callOleTest( 2010)'>sequence&ltlong&gt </Button>
+<button onclick='callOleTest( 2011)'>sequence&ltsequence&ltlong&gt &gt </Button>
+<button onclick='callOleTest( 2012)'>2 out </Button>
+<button onclick='callOleTest( 2013)'>3 out </Button>
+<button onclick='callOleTest( 2014)'>1 in & 1 out </Button>
+<button onclick='callOleTest( 2015)'>XInterface </Button>
+<button onclick='callOleTest( 2017)'>mixed out and in </Button>
+
+
+<p>
+In Out Parameter <br>
+<button onclick='callOleTest( 500)'>byte </Button>
+<button onclick='callOleTest( 513)'>float</Button>
+<button onclick='callOleTest( 501)'>double</Button>
+<button onclick='callOleTest( 502)'>boolean</Button>
+<button onclick='callOleTest( 503)'>short</Button>
+<button onclick='callOleTest( 504)'>unsigned short</Button>
+<button onclick='callOleTest( 505)'>long</Button>
+<button onclick='callOleTest( 506)'>unsigned long</Button>
+<button onclick='callOleTest( 507)'>char</Button>
+<button onclick='callOleTest( 508)'>string</Button>
+<button onclick='callOleTest( 509)'>any</Button>
+<button onclick='callOleTest( 510)'>sequence&ltlong&gt </Button>
+<button onclick='callOleTest( 511)'>sequence&ltsequence&ltlong&gt &gt </Button>
+<button onclick='callOleTest( 512)'>XInterface </Button>
+<p>
+
+Tests Array/Sequence conversion with Attributes. All params are of type Sequence and
+ the element type of the Sequence is written on the buttons. <br>
+<button onclick='callOleTest( 200)'>byte </Button>
+<button onclick='callOleTest( 212)'>float</Button>
+<button onclick='callOleTest( 201)'>double</Button>
+<button onclick='callOleTest( 202)'>boolean</Button>
+<button onclick='callOleTest( 203)'>short</Button>
+<button onclick='callOleTest( 204)'>unsigned short</Button>
+<button onclick='callOleTest( 205)'>long</Button>
+<button onclick='callOleTest( 206)'>unsigned long</Button>
+<button onclick='callOleTest( 207)'>char</Button>
+<button onclick='callOleTest( 208)'>string</Button>
+<button onclick='callOleTest( 209)'>any</Button>
+<button onclick='callOleTest( 210)'>sequence&ltlong&gt </Button>
+<button onclick='callOleTest( 211)'>sequence&ltsequence&ltlong&gt &gt </Button>
+<p>
+
+Test of Any parameter in a method. Any contains:<br>
+<button onclick='callOleTest( 1000)'>integer </Button>
+<button onclick='callOleTest( 1001)'>double </Button>
+<button onclick='callOleTest( 1002)'>string</Button>
+<button onclick='callOleTest( 1003)'>array</Button>
+<button onclick='callOleTest( 1004)'>object</Button>
+<p>
+Test of Any parameter in a property. Any contains:<br>
+<button onclick='callOleTest( 1010)'>integer </Button>
+<button onclick='callOleTest( 1011)'>double </Button>
+<button onclick='callOleTest( 1012)'>string</Button>
+<button onclick='callOleTest( 1013)'>array</Button>
+<button onclick='callOleTest( 1014)'>object</Button>
+<P>
+<button onclick='callOleTest( 1020)'>[in] float </Button>
+
+
+
+<p>
+
+
+<h2> Visual Basic Tests </h2>
+Test array /Sequence conversion and return value<br>
+Template: <b> Sequence &lt type &gt method( Sequence&lt type &gt ) </b> <br>
+<!--<font color= red>Multi dimensional arrays are not processed by VBSript</font> <br> -->
+<button onclick='callBasic(0)'>byte</button>
+<button onclick='callBasic(1)'>double</button>
+<button onclick='callBasic(2)'>boolean</button>
+<button onclick='callBasic(3)'>short</button>
+<button onclick='callBasic(4)'>u short</button>
+<button onclick='callBasic(5)'>long</button>
+<button onclick='callBasic(6)'>u long</button>
+<button onclick='callBasic(7)'>string</button>
+<button onclick='callBasic(8)'>char</button>
+<button onclick='callBasic(9)'>any</button> <br>
+<button onclick='callBasic(10)'>Seq &lt int &gt</button> <br>
+
+
+IN/Out parameter <br>
+Template: <b> void method( Sequence &lt type &gt ) </b> <br>
+<button onclick='callBasic(100)'>byte</button>
+<button onclick='callBasic(101)'>double</button>
+<button onclick='callBasic(102)'>boolean</button>
+<button onclick='callBasic(103)'>short</button>
+<button onclick='callBasic(104)'>u short</button>
+<button onclick='callBasic(105)'>long</button>
+<button onclick='callBasic(106)'>u long</button>
+<button onclick='callBasic(107)'>string</button>
+<button onclick='callBasic(108)'>char</button>
+<button onclick='callBasic(109)'>any</button> <br>
+
+Simple out parameter<br>
+<button onclick='callBasic(150)'>byte</button>
+<!--<button onclick='callBasic(151)'>double</button>
+<button onclick='callBasic(152)'>boolean</button>
+<button onclick='callBasic(153)'>short</button>
+<button onclick='callBasic(155)'>long</button>
+<button onclick='callBasic(157)'>string</button>
+<button onclick='callBasic(158)'>char</button>
+<button onclick='callBasic(159)'>any</button> <br>
+//-->
+<br>
+
+
+Tests Array/Sequence conversion with <b>Attributes</b>. All params are of type Sequence and
+ the element type of the Sequence is written on the buttons. <br>
+<button onclick='callBasic( 200)'>byte </Button>
+<button onclick='callBasic( 201)'>double</Button>
+<button onclick='callBasic( 202)'>boolean</Button>
+<button onclick='callBasic( 203)'>short</Button>
+<button onclick='callBasic( 204)'>unsigned short</Button>
+<button onclick='callBasic( 205)'>long</Button>
+<button onclick='callBasic( 206)'>unsigned long</Button>
+<button onclick='callBasic( 207)'>string</Button>
+<button onclick='callBasic( 208)'>char</Button>
+<button onclick='callBasic( 209)'>any</Button>
+<button onclick='callBasic( 210)'>sequence&ltlong&gt </Button> <br>
+
+In Out parameter <br>
+<button onclick='callBasic( 300)'>byte</Button>
+
+
+
diff --git a/extensions/test/ole/callUnoToJava.htm b/extensions/test/ole/callUnoToJava.htm
new file mode 100644
index 000000000..c5ceabf15
--- /dev/null
+++ b/extensions/test/ole/callUnoToJava.htm
@@ -0,0 +1,516 @@
+<HTML>
+<HEAD>
+<META NAME="GENERATOR" Content="Microsoft Developer Studio">
+<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
+<TITLE>Document Title</TITLE>
+</HEAD>
+<BODY id=theBody>
+
+<script language="JScript">
+function callOleTest( id)
+{
+ var factory= new ActiveXObject("com.sun.star.ServiceManager");
+ var oletest= factory.createInstance("oletest.OleTest");
+// alert(oletest);
+
+ switch( id)
+ {
+ case 1: // Test simple call of JScript object function from UNO
+ oletest.testInterface( new XCallback_Impl, 1);
+ break;
+
+ case 2:
+ // return value is the parameter object
+ oletest.testInterface( new XCallback_Impl, 2);
+ break;
+ //##################################################
+ // OUT parameter
+ //##################################################
+ case 3: // Test out parameter of type interface
+ oletest.testInterface( new XCallback_Impl, 3);
+ break;
+ case 4: // Test out parameter of type struct
+ oletest.testInterface( new XCallback_Impl, 4);
+ break;
+ case 5: // Test out parameter of type enum
+ oletest.testInterface( new XCallback_Impl, 5);
+ break;
+ case 6: // Test out parameter of type sequence<any>
+ oletest.testInterface( new XCallback_Impl, 6);
+ break;
+ case 7: // Test out parameter of type any
+ oletest.testInterface( new XCallback_Impl, 7);
+ break;
+ case 8: // Test out parameter of type bool
+ oletest.testInterface( new XCallback_Impl, 8);
+ break;
+ case 9: // Test out parameter of type char
+ oletest.testInterface( new XCallback_Impl, 9);
+ break;
+ case 10: // Test out parameter of type string
+ oletest.testInterface( new XCallback_Impl, 10);
+ break;
+ case 11: // Test out parameter of type float
+ oletest.testInterface( new XCallback_Impl, 11);
+ break;
+ case 12: // Test out parameter of type double
+ oletest.testInterface( new XCallback_Impl, 12);
+ break;
+ case 13: // Test out parameter of type byte
+ oletest.testInterface( new XCallback_Impl, 13);
+ break;
+ case 14: // Test out parameter of type short
+ oletest.testInterface( new XCallback_Impl, 14);
+ break;
+ case 15: // Test out parameter of type long
+ oletest.testInterface( new XCallback_Impl, 15);
+ break;
+ case 30: // outValuesMixed
+ oletest.testInterface( new XCallback_Impl, 30);
+ break;
+ case 31: // outValuesAll
+ oletest.testInterface( new XCallback_Impl, 31);
+ break;
+ //##################################################
+ // IN/OUT parameter
+ //##################################################
+
+ case 100: // inoutInterface
+ oletest.testInterface( new XCallback_Impl, 100);
+ break;
+ case 101: // inoutStruct
+ oletest.testInterface( new XCallback_Impl, 101);
+ break;
+ case 102: // inoutEnum
+ oletest.testInterface( new XCallback_Impl, 102);
+ break;
+ case 103: // inoutSeqAny
+ oletest.testInterface( new XCallback_Impl, 103);
+ break;
+ case 104: // inoutAny
+ oletest.testInterface( new XCallback_Impl, 104);
+ break;
+ case 105: // inoutBool
+ oletest.testInterface( new XCallback_Impl, 105);
+ break;
+ case 106: // inoutChar
+ oletest.testInterface( new XCallback_Impl, 106);
+ break;
+ case 107: // inoutString
+ oletest.testInterface( new XCallback_Impl, 107);
+ break;
+ case 108: // inoutFloat
+ oletest.testInterface( new XCallback_Impl, 108);
+ break;
+ case 109: // inoutDouble
+ oletest.testInterface( new XCallback_Impl, 109);
+ break;
+ case 110: // inoutByte
+ oletest.testInterface( new XCallback_Impl, 110);
+ break;
+ case 111: // inoutShort
+ oletest.testInterface( new XCallback_Impl, 111);
+ break;
+ case 112: // inoutLong
+ oletest.testInterface( new XCallback_Impl, 112);
+ break;
+ case 120: // inoutValuesAll
+ oletest.testInterface( new XCallback_Impl, 120);
+ break;
+ case 200: // inValues
+ oletest.testInterface( new XCallback_Impl, 200);
+ break;
+
+ case 1000:
+ oletest.testInterface2(new MultiInterface(), 0);
+ break;
+ }
+
+}
+
+
+
+// The class --------------------------------------------
+
+function XCallback_Impl()
+{
+
+ // XCallback
+ this._environment= "JScript";
+
+ this.func1= XCallback_Impl_func1;
+ this.returnInterface= XCallback_Impl_returnInterface;
+ // #################################################
+ // OUT parameter
+ //###################################################
+ this.outInterface= XCallback_Impl_outInterface;
+ this.outStruct= XCallback_Impl_outStruct;
+ this.outEnum= XCallback_Impl_outEnum;
+ this.outSeqAny= XCallback_Impl_outSeqAny;
+ this.outAny= XCallback_Impl_outAny;
+ this.outBool= XCallback_Impl_outBool;
+ this.outChar= XCallback_Impl_outChar;
+ this.outString= XCallback_Impl_outString;
+ this.outFloat= XCallback_Impl_outFloat;
+ this.outDouble= XCallback_Impl_outDouble;
+ this.outByte= XCallback_Impl_outByte;
+ this.outShort= XCallback_Impl_outShort;
+ this.outLong= XCallback_Impl_outLong;
+ this.outValuesMixed= XCallback_Impl_outValuesMixed;
+ this.outValuesAll= XCallback_Impl_outValuesAll;
+ // #################################################
+ // IN/ OUT parameter
+ //###################################################
+ this.inoutInterface= XCallback_Impl_inoutInterface;
+ this.inoutStruct= XCallback_Impl_inoutStruct;
+ this.inoutEnum= XCallback_Impl_inoutEnum;
+ this.inoutSeqAny= XCallback_Impl_inoutSeqAny;
+ this.inoutAny= XCallback_Impl_inoutAny;
+ this.inoutBool= XCallback_Impl_inoutBool;
+ this.inoutChar= XCallback_Impl_inoutChar;
+ this.inoutString= XCallback_Impl_inoutString;
+ this.inoutFloat= XCallback_Impl_inoutFloat;
+ this.inoutDouble= XCallback_Impl_inoutDouble;
+ this.inoutByte= XCallback_Impl_inoutByte;
+ this.inoutShort= XCallback_Impl_inoutShort;
+ this.inoutLong= XCallback_Impl_inoutLong;
+ this.inoutValuesAll= XCallback_Impl_inoutValuesAll;
+ // #################################################
+ // IN parameter
+ //##################################################
+ this.inValues= XCallback_Impl_inValues;
+
+}
+
+
+function XCallback_Impl_func1()
+{
+ alert("XCallback_Impl_func1");
+}
+function XCallback_Impl_returnInterface()
+{
+ alert("XCallback::returnInterface called");
+ return new XSimple_Impl();
+}
+
+function XCallback_Impl_outInterface( outVal)
+{
+ outVal[0]= new XSimple_Impl();
+}
+
+function XCallback_Impl_outLong( outVal)
+{
+ alert("outLong");
+}
+function XCallback_Impl_outStruct( outVal)
+{
+ var factory= new ActiveXObject("com.sun.star.ServiceManager");
+ var starCoreReflection = factory.createInstance("com.sun.star.reflection.CoreReflection");
+ var structClass = starCoreReflection.forName("oletest.SimpleStruct");
+ var outParam= new Array();
+ structClass.createObject(outParam);
+ var aStruct= outParam[0];
+ aStruct.message= "a Struct created in JScript";
+ outVal[0]= aStruct;
+
+}
+function XCallback_Impl_outEnum( outVal)
+{
+ outVal[0]= 2;
+}
+function XCallback_Impl_outSeqAny( outVal)
+{
+ var ar= new Array(1,2,3);
+ outVal[0]= ar;
+}
+function XCallback_Impl_outAny( outVal)
+{
+ outVal[0]= "this is an Any";
+}
+function XCallback_Impl_outBool( outVal)
+{
+ outVal[0]= true;
+}
+function XCallback_Impl_outChar( outVal)
+{
+ outVal[0]= "a";
+}
+function XCallback_Impl_outString( outVal)
+{
+ outVal[0]= "This string was created in JScript";
+}
+function XCallback_Impl_outFloat( outVal)
+{
+ outVal[0]= 3.14;
+}
+function XCallback_Impl_outDouble( outVal)
+{
+ outVal[0]= 3.145;
+}
+function XCallback_Impl_outByte( outVal)
+{
+ outVal[0]= 100;
+}
+function XCallback_Impl_outShort( outVal)
+{
+ outVal[0]= 1000;
+}
+function XCallback_Impl_outLong( outVal)
+{
+ outVal[0]= 1000000;
+}
+function XCallback_Impl_outValuesMixed( inLong, outLong, inString)
+{
+ alert("inVal long: " + inLong +" inString:" + inString);
+ outLong[0]= inLong + 1;
+}
+function XCallback_Impl_outValuesAll( xSimple, aSimpleStruct, aSimpleEnum, seqAny, aAny, aBool,
+ aChar, aString, aFloat, aDouble, aByte, aShort, aLong)
+{
+ this.outInterface( xSimple);
+ this.outStruct( aSimpleStruct);
+ this.outEnum( aSimpleEnum);
+ this.outSeqAny( seqAny);
+ this.outAny( aAny);
+ this.outBool( aBool);
+ this.outChar( aChar);
+ this.outString( aString);
+ this.outFloat( aFloat);
+ this.outDouble( aDouble);
+ this.outByte( aByte);
+ this.outShort( aShort);
+ this.outLong( aLong);
+}
+
+function XCallback_Impl_inoutInterface( val)
+{
+ val[0].func("calling on in parameter");
+ val[0]= new XSimple_Impl();
+}
+function XCallback_Impl_inoutStruct( val)
+{
+ alert( val[0].message);
+ val[0].message= "property message changed in JScript";
+}
+function XCallback_Impl_inoutEnum(val)
+{
+ alert("enum value +" + val);
+ val[0]= 2;
+}
+function XCallback_Impl_inoutSeqAny( val)
+{
+ var vbar = new VBArray(val[0]);
+ var seq= vbar.toArray();
+ alert( seq[0] +" "+seq[1] +" " +seq[2]);
+ val[0]= new Array("jscript1", "jscript2","jscript3");
+}
+function XCallback_Impl_inoutAny(val)
+{
+ alert( "JScript in any: " + val[0]);
+ val[0]= "a string from JScript";
+}
+function XCallback_Impl_inoutBool(val)
+{
+ alert( "JScript in bool: " + val[0]);
+ val[0]= true;
+}
+function XCallback_Impl_inoutChar(val)
+{
+ alert( "JScript in char: " + val[0]);
+ val[0]= 'b';
+}
+function XCallback_Impl_inoutString(val)
+{
+ alert( "JScript in string: " + val[0]);
+ val[0]= " a JScript string";
+}
+function XCallback_Impl_inoutFloat(val)
+{
+ alert( "JScript in float: " + val[0]);
+ val[0]= 4.14;
+}
+function XCallback_Impl_inoutDouble(val)
+{
+ alert( "JScript in double: " + val[0]);
+ val[0]= 4.145;
+}
+
+function XCallback_Impl_inoutByte(val)
+{
+ alert( "JScript in byte: " + val[0]);
+ val[0]= 100;
+}
+function XCallback_Impl_inoutShort(val)
+{
+ alert( "JScript in short: " + val[0]);
+ val[0]= 1000;
+}
+function XCallback_Impl_inoutLong(val)
+{
+ alert( "JScript in long: " + val[0]);
+ val[0]= 100000;
+}
+function XCallback_Impl_inoutValuesAll(aXSimple, aStruct, aEnum, aSeq,
+ aAny, aBool, aChar, aString, aFloat, aDouble,
+ aByte, aShort, aLong )
+{
+ this.inoutInterface( aXSimple);
+ this.inoutStruct( aStruct);
+ this.inoutEnum( aEnum);
+ this.inoutSeqAny( aSeq);
+ this.inoutAny( aAny);
+ this.inoutBool( aBool);
+ this.inoutChar( aChar);
+ this.inoutString( aString);
+ this.inoutFloat( aFloat);
+ this.inoutDouble( aDouble);
+ this.inoutByte( aByte);
+ this.inoutShort( aShort);
+ this.inoutLong( aLong);
+}
+
+function XCallback_Impl_inValues( aChar, aLong, aString)
+{
+ alert( "char : " + aChar + " long: " + aLong + " string: " + aString);
+}
+
+
+//################################################################
+// class MultiInterface implements XSimple, XSimple2, XSimple3
+//################################################################
+function MultiInterface()
+{
+ this._environment= "JScript";
+ this._implementedInterfaces= new Array( "oletest.XSimple", "oletest.XSimple2", "oletest.XSimple3");
+ // XSimple ---------------
+ this.getName= MultiInterface_getName;
+ this.func= MultiInterface_func;
+ this.func2= MultiInterface_func2;
+ this.func3= MultiInterface_func3;
+ // XSimple2
+ this.getName2= MultiInterface_getName2;
+ // XSimple3
+ this.getName3= MultiInterface_getName3;
+}
+
+
+function MultiInterface_getName()
+{
+ return "JScript XSimple called";
+}
+function MultiInterface_func( message)
+{
+ alert("JScript object (XSimple)-- " + message);
+}
+
+function MultiInterface_getName2()
+{
+ return "JScript XSimple2 called";
+}
+function MultiInterface_func2( message)
+{
+ alert("JScript object (XSimple2) -- " + message);
+}
+
+function MultiInterface_getName3()
+{
+ return "JScript XSimple3 called";
+}
+function MultiInterface_func3( message)
+{
+ alert("JScript object (XSimple3) -- " + message);
+}
+
+
+
+
+//XCallback_Impl_outValuesMixed( val1, outval, val2)
+//{
+//}
+//XCallback_Impl_outValuesAll( xSimple, aSimpleStruct, aSimpleEnum, seqAny, aAny, aBool,
+// aChar, aString, aFloat, aDouble, aByte, aShort, aLong, aUShort, aULong)
+//{
+//
+//}
+
+
+
+// class XSimple_Impl----------------------------------------------------------------------
+function XSimple_Impl()
+{
+ //XSimple
+ this.func= XSimple_Impl_func;
+}
+function XSimple_Impl_func( message)
+{
+ alert( "XSimple called." + message);
+}
+
+
+</script>
+
+
+
+<h2> Object in JScript</h2>
+
+This test passes a XCallback to an UNO function of the UNO test control.
+XCallback is implemented by the JScript class XCallback_Impl. The function
+XCallback::func1 is then called from the UNO test control.
+<br>
+<button onclick='callOleTest( 1)'>go</Button>
+<br>
+On the UNO object the function testInterface is called which takes
+a XCallback as parameter. XCallback is implemented in a JScript object.The function
+returns a XSimple Interface. Then the UNO object calls XSimple::notify. This test shall
+verify the correct conversion of the return value( IDispatch JScript object) to an XSimple object.<br>
+<button onclick='callOleTest( 2)'>go</Button>
+<br>
+<h1> out parameter </h1>
+The a JScript object of class XCallback_Impl is passed to the UNO OleTest Control as parameter.
+According to the buttons the OleTest object calls a function on XCallback_Impl that has appropriate type
+as out parameter.<br>
+<button onclick='callOleTest( 3)'>interface</Button>
+<button onclick='callOleTest( 4)'>struct</Button>
+<button onclick='callOleTest( 5)'>enum</Button>
+<button onclick='callOleTest( 6)'>sequence&lt;any&gt;</Button>
+<button onclick='callOleTest( 7)'>any</Button>
+<button onclick='callOleTest( 8)'>bool</Button>
+<button onclick='callOleTest( 9)'>char</Button>
+<button onclick='callOleTest( 10)'>string</Button>
+<button onclick='callOleTest( 11)'>float</Button>
+<button onclick='callOleTest( 12)'>double</Button>
+<button onclick='callOleTest( 13)'>byte</Button>
+<button onclick='callOleTest( 14)'>short</Button>
+<button onclick='callOleTest( 15)'>long</Button>
+<br>
+Other test with out parameters <br>
+<button onclick='callOleTest( 30)'>outValuesMixed</Button>
+<button onclick='callOleTest( 31)'>outValuesAll</Button>
+<h1> in out parameter </h1>
+<button onclick='callOleTest( 100)'>interface</Button>
+<button onclick='callOleTest( 101)'>struct</Button>
+<button onclick='callOleTest( 102)'>enum</Button>
+<button onclick='callOleTest( 103)'>seqence&lt;any&gt;</Button>
+<button onclick='callOleTest( 104)'>any</Button>
+<button onclick='callOleTest( 105)'>bool</Button>
+<button onclick='callOleTest( 106)'>char</Button>
+<button onclick='callOleTest( 107)'>string</Button>
+<button onclick='callOleTest( 108)'>float</Button>
+<button onclick='callOleTest( 109)'>double</Button>
+<button onclick='callOleTest( 110)'>byte</Button>
+<button onclick='callOleTest( 111)'>short</Button>
+<button onclick='callOleTest( 112)'>long</Button>
+<br>
+Other tests with inout parameters <br>
+<button onclick='callOleTest( 120)'>inoutValuesAll</Button>
+<h1>in parameters </h1>
+<button onclick='callOleTest( 200)'>inValues</Button>
+
+<h1> JScript object implements several interfaces </h1>
+<button onclick='callOleTest( 1000)'>go</Button>
+
+
+</body>
+</html>
+
+
diff --git a/extensions/test/ole/cpnt/cpnt.cxx b/extensions/test/ole/cpnt/cpnt.cxx
new file mode 100644
index 000000000..f569866c6
--- /dev/null
+++ b/extensions/test/ole/cpnt/cpnt.cxx
@@ -0,0 +1,1545 @@
+/*************************************************************************
+ *
+ * $RCSfile: cpnt.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <windows.h>
+#include <atlbase.h>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <osl/diagnose.h>
+#include <uno/environment.h>
+#include <cppuhelper/factory.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <com/sun/star/reflection/XIdlReflection.hpp>
+
+
+#include <cppuhelper/implbase5.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <rtl/ustring>
+#include <com/sun/star/uno/Reference.hxx>
+#include <oletest/XTestSequence.hpp>
+#include <oletest/XTestStruct.hpp>
+#include <oletest/XTestOther.hpp>
+#include <oletest/XTestInterfaces.hpp>
+#include <oletest/XSimple.hpp>
+#include <oletest/XSimple2.hpp>
+#include <oletest/XSimple3.hpp>
+
+#include <com/sun/star/beans/Property.hpp>
+using namespace cppu;
+using namespace osl;
+using namespace oletest;
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::registry;
+using namespace com::sun::star::script;
+using namespace com::sun::star::reflection;
+
+#define IMPL_NAME L"oletest.OleTestImpl" // oletest.OleTestImpl in applicat.rdb
+#define SERVICE_NAME L"oletest.OleTest"
+#define KEY1 L"/oletest.OleTestImpl/UNO/SERVICES"
+#define KEY2 L"oletest.OleTest"
+
+class OComponent : public WeakImplHelper5<
+ XTestSequence, XTestStruct, XTestOther, XTestInterfaces, XSimple>
+{
+ sal_Int32 m_arrayConstructor;
+ Reference<XMultiServiceFactory> m_rFactory;
+
+ Sequence<sal_Int8> m_seqByte;
+ Sequence<float> m_seqFloat;
+ Sequence<double> m_seqDouble;
+ Sequence<sal_Bool> m_seqBool;
+ Sequence<sal_Int16> m_seqShort;
+ Sequence<sal_uInt16> m_seqUShort;
+ Sequence<sal_Int32> m_seqLong;
+ Sequence<sal_uInt32> m_seqULong;
+ Sequence<sal_Unicode> m_seqChar;
+ Sequence<OUString> m_seqString;
+ Sequence<Any> m_seqAny;
+ Sequence<Sequence< sal_Int32> > m_seq1;
+ Sequence<Sequence< Sequence< sal_Int32> > > m_seq2;
+ Any m_any;
+ Sequence<Reference< XInterface > > m_seqxInterface;
+public:
+ OComponent( const Reference<XMultiServiceFactory> & rFactory ) :
+ m_rFactory( rFactory ), m_arrayConstructor(0) {}
+ ~OComponent();
+
+public: // refcounting
+// sal_Bool queryInterface( Uik aUik, XInterfaceRef & rOut );
+// void acquire() { OWeakObject::acquire(); }
+// void release() { OWeakObject::release(); }
+// void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+public: // XTestSequence
+ virtual Sequence<sal_Int8> SAL_CALL methodByte(const Sequence< sal_Int8 >& aSeq) throw( RuntimeException );
+ virtual Sequence<float> SAL_CALL methodFloat(const Sequence< float >& aSeq) throw( RuntimeException );
+ virtual Sequence< double > SAL_CALL methodDouble(const Sequence< double >& aSeq) throw( RuntimeException);
+ virtual Sequence< sal_Bool > SAL_CALL methodBool(const Sequence< sal_Bool >& aSeq) throw( RuntimeException );
+ virtual Sequence< sal_Int16 > SAL_CALL methodShort(const Sequence< sal_Int16 >& aSeq) throw( RuntimeException );
+ virtual Sequence< sal_uInt16 > SAL_CALL methodUShort(const Sequence< sal_uInt16 >& aSeq) throw( RuntimeException );
+ virtual Sequence< sal_Int32 > SAL_CALL methodLong(const Sequence< sal_Int32 >& aSeq) throw( RuntimeException) ;
+ virtual Sequence< sal_uInt32 > SAL_CALL methodULong(const Sequence< sal_uInt32 >& aSeq) throw( RuntimeException );
+ virtual Sequence< OUString > SAL_CALL methodString(const Sequence< OUString >& aSeq) throw( RuntimeException );
+ virtual Sequence< sal_Unicode > SAL_CALL methodChar(const Sequence< sal_Unicode >& aSeq) throw( RuntimeException );
+ virtual Sequence< Any > SAL_CALL methodAny(const Sequence< Any >& aSeq) throw( RuntimeException );
+ virtual Sequence< Reference< XInterface > > SAL_CALL methodXInterface( const Sequence< Reference< XInterface > >& aSeq ) throw(RuntimeException) ;
+ virtual Sequence< Sequence< sal_Int32 > > SAL_CALL methodSequence(const Sequence< Sequence< sal_Int32 > >& aSeq) throw( RuntimeException );
+ virtual Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL methodSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq) throw( RuntimeException );
+
+ virtual Sequence< sal_Int8 > SAL_CALL getAttrByte(void) throw( RuntimeException );
+ virtual void SAL_CALL setAttrByte(const Sequence< sal_Int8 >& AttrByte_) throw( RuntimeException );
+ virtual Sequence< float > SAL_CALL getAttrFloat(void) throw( RuntimeException) ;
+ virtual void SAL_CALL setAttrFloat(const Sequence< float >& AttrFloat_) throw( RuntimeException );
+ virtual Sequence< double > SAL_CALL getAttrDouble(void) throw( RuntimeException) ;
+ virtual void SAL_CALL setAttrDouble(const Sequence< double >& AttrDouble_) throw( RuntimeException );
+ virtual Sequence< sal_Bool > SAL_CALL getAttrBool(void) throw( RuntimeException );
+ virtual void SAL_CALL setAttrBool(const Sequence< sal_Bool >& AttrBool_) throw( RuntimeException );
+ virtual Sequence< sal_Int16 > SAL_CALL getAttrShort(void) throw( RuntimeException );
+ virtual void SAL_CALL setAttrShort(const Sequence< sal_Int16 >& AttrShort_) throw( RuntimeException );
+ virtual Sequence< sal_uInt16 > SAL_CALL getAttrUShort(void) throw( RuntimeException );
+ virtual void SAL_CALL setAttrUShort(const Sequence< sal_uInt16 >& AttrUShort_) throw( RuntimeException );
+ virtual Sequence< sal_Int32 > SAL_CALL getAttrLong(void) throw( RuntimeException );
+ virtual void SAL_CALL setAttrLong(const Sequence< sal_Int32 >& AttrLong_) throw( RuntimeException );
+ virtual Sequence< sal_uInt32 > SAL_CALL getAttrULong(void) throw( RuntimeException );
+ virtual void SAL_CALL setAttrULong(const Sequence< sal_uInt32 >& AttrULong_) throw( RuntimeException );
+ virtual Sequence< OUString > SAL_CALL getAttrString(void) throw(RuntimeException );
+ virtual void SAL_CALL setAttrString(const Sequence< OUString >& AttrString_) throw( RuntimeException );
+ virtual Sequence< sal_Unicode > SAL_CALL getAttrChar(void) throw( RuntimeException );
+ virtual void SAL_CALL setAttrChar(const Sequence< sal_Unicode >& AttrChar_) throw( RuntimeException );
+ virtual Sequence< Any > SAL_CALL getAttrAny(void) throw( RuntimeException );
+ virtual void SAL_CALL setAttrAny(const Sequence< Any >& AttrAny_) throw( RuntimeException );
+ virtual Sequence< Sequence< sal_Int32 > > SAL_CALL getAttrSequence(void) throw( RuntimeException );
+ virtual void SAL_CALL setAttrSequence(const Sequence< Sequence< sal_Int32 > >& AttrSequence_) throw( RuntimeException );
+ virtual Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL getAttrSequence2(void) throw( RuntimeException );
+ virtual void SAL_CALL setAttrSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& AttrSequence2_) throw ( RuntimeException );
+ virtual Sequence< Reference< XInterface > > SAL_CALL getAttrXInterface() throw(RuntimeException);
+ virtual void SAL_CALL setAttrXInterface( const Sequence< Reference< XInterface > >& _attrxinterface ) throw(RuntimeException);
+
+ virtual void SAL_CALL testout_methodByte(sal_Int8& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodFloat(float& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodDouble(double& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodBool(sal_Bool& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodShort(sal_Int16& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodUShort(sal_uInt16& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodLong(sal_Int32& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodULong(sal_uInt32& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodString(OUString& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodChar(sal_Unicode& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodAny(Any& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException );
+ virtual void SAL_CALL testout_methodMulParams4( float in1, float& out1, sal_Int32 in2, sal_Int32& out2, sal_Int32 in3 ) throw(RuntimeException);
+ virtual void SAL_CALL testout_methodXInterface( Reference< XInterface >& rOut ) throw(RuntimeException);
+
+ virtual void SAL_CALL testinout_methodByte(sal_Int8& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testinout_methodFloat(float& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testinout_methodDouble(double& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testinout_methodBool(sal_Bool& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testinout_methodShort(sal_Int16& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testinout_methodUShort(sal_uInt16& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testinout_methodLong(sal_Int32& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testinout_methodULong(sal_uInt32& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testinout_methodString(OUString& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testinout_methodChar(sal_Unicode& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testinout_methodAny(Any& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testinout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testinout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException );
+ virtual void SAL_CALL testinout_methodXInterface( Reference< XInvocation >& rOut ) throw(RuntimeException);
+ virtual Any SAL_CALL methodAnyTest1(const Any& rIn) throw( RuntimeException ) ;
+ virtual Any SAL_CALL getAttrAny2(void) throw( RuntimeException ) ;
+ virtual void SAL_CALL setAttrAny2(const Any& AttrAny2_) throw( RuntimeException ) ;
+
+
+ // XTestStruct
+ virtual void SAL_CALL methodStruct(const Property& aProp) throw( RuntimeException );
+
+ virtual Property SAL_CALL retMethodStruct(void) throw( RuntimeException );
+
+ virtual Property SAL_CALL getAttrStruct(void) throw( RuntimeException );
+ virtual void SAL_CALL setAttrStruct(const Property& AttrStruct_) throw( RuntimeException );
+
+ // XTestOther
+ virtual void SAL_CALL other_methodAnyIn(const Any& rAny) throw( RuntimeException );
+ virtual void SAL_CALL other_methodAnyOut(Any& rAny) throw( RuntimeException );
+ virtual Any SAL_CALL other_methodAnyRet(void) throw( RuntimeException );
+ virtual void SAL_CALL in_float( float val) throw ( RuntimeException);
+
+ // XTestOutParameters ------------------------------------------------------------------------
+ virtual void SAL_CALL out_test(sal_Int8 rIn) throw( RuntimeException );
+
+ virtual void SAL_CALL out_methodByte(sal_Int8& rOut) throw( RuntimeException );
+ virtual void SAL_CALL out_methodFloat(float& rOut) throw( RuntimeException );
+ virtual void SAL_CALL out_methodDouble(double& rOut) throw( RuntimeException );
+ virtual void SAL_CALL out_methodBool(sal_Bool& rOut) throw( RuntimeException );
+ virtual void SAL_CALL out_methodShort(sal_Int16& rOut) throw( RuntimeException );
+ virtual void SAL_CALL out_methodUShort(sal_uInt16& rOut) throw( RuntimeException );
+ virtual void SAL_CALL out_methodLong(sal_Int32& rOut) throw( RuntimeException );
+ virtual void SAL_CALL out_methodULong(sal_uInt32& rOut) throw( RuntimeException );
+ virtual void SAL_CALL out_methodString(OUString& rOut) throw( RuntimeException );
+ virtual void SAL_CALL out_methodChar(sal_Unicode& rOut) throw( RuntimeException );
+ virtual void SAL_CALL out_methodAny(Any& rOut) throw( RuntimeException );
+ virtual void SAL_CALL out_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException );
+ virtual void SAL_CALL out_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException );
+ virtual void SAL_CALL out_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException );
+ virtual void SAL_CALL out_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException );
+ virtual void SAL_CALL out_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException );
+
+ // XTestInterfaces --------------------------------------------------------------------------
+ virtual void SAL_CALL testInterface( const Reference< XCallback >& xCallback, sal_Int32 mode ) throw(RuntimeException);
+ virtual void SAL_CALL testInterface2( const Reference< XSimple >& xSimple, sal_Int32 mode ) throw(RuntimeException);
+ // XSimple --------------------------------------------------------------------------
+ void SAL_CALL func( const OUString &message) throw(::com::sun::star::uno::RuntimeException);
+ OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+
+OComponent::~OComponent()
+{
+}
+
+
+// Funktions ==============================================================================
+
+Reference<XInterface> SAL_CALL OComponent_CreateInstance( const Reference<XMultiServiceFactory> & rSMgr ) throw(RuntimeException)
+{
+ Reference<XInterface> xService = *new OComponent( rSMgr );
+ return xService;
+}
+
+Sequence<OUString> OComponent_getSupportedServiceNames(void)
+{
+ Sequence<OUString> aRet(1);
+ aRet.getArray()[0] = SERVICE_NAME;//ODataInputStream_getImplementationName();
+
+ return aRet;
+}
+
+
+extern "C" sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey )
+{
+ if(pRegistryKey)
+ {
+ try
+ {
+ Reference<XRegistryKey> xNewKey =
+ reinterpret_cast<XRegistryKey*>( pRegistryKey)->createKey(KEY1);
+ xNewKey->createKey( KEY2);
+ return sal_True;
+
+ }
+ catch(InvalidRegistryException &)
+ {
+ OSL_ENSHURE( sal_False, "### InvalidRegistryException!\n");
+ }
+ }
+ return sal_False;
+}
+
+extern "C" void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
+{
+ static void * pRet= NULL;
+ if( ! pRet)
+ {
+ OUString aImplName( OUString::createFromAscii( pImplName ) );
+ if (pServiceManager && aImplName.equals( IMPL_NAME ))
+ {
+ Reference<XMultiServiceFactory> xMulFac(
+ reinterpret_cast< XMultiServiceFactory*>(pServiceManager));
+
+ Sequence<OUString> seqServiceNames;
+ Reference<XSingleServiceFactory> xFactory = createOneInstanceFactory( xMulFac, SERVICE_NAME,
+ OComponent_CreateInstance, seqServiceNames);
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+ }
+ return pRet;
+}
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+
+// XTestSequence ============================================================================
+Sequence<sal_Int8> SAL_CALL OComponent::methodByte(const Sequence< sal_Int8 >& aSeq) throw( RuntimeException )
+{
+ sal_Int8 _x;
+ for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
+ _x= aSeq.getConstArray()[i];
+ }
+ return aSeq;
+}
+Sequence<float> SAL_CALL OComponent::methodFloat(const Sequence< float>& aSeq) throw( RuntimeException )
+{
+ float _x;
+ for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
+ _x= aSeq.getConstArray()[i];
+ }
+ return aSeq;
+}
+Sequence<double> SAL_CALL OComponent::methodDouble(const Sequence< double >& aSeq) throw( RuntimeException)
+{
+ double _x;
+ for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
+ _x= aSeq.getConstArray()[i];
+ }
+ return aSeq;
+}
+Sequence< sal_Bool > SAL_CALL OComponent::methodBool(const Sequence< sal_Bool >& aSeq) throw( RuntimeException)
+{
+ sal_Bool _x;
+ for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
+ _x= aSeq.getConstArray()[i];
+ }
+ return aSeq;
+}
+Sequence< sal_Int16 > SAL_CALL OComponent::methodShort(const Sequence< sal_Int16 >& aSeq) throw( RuntimeException )
+{
+ sal_Int16 _x;
+ for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
+ _x= aSeq.getConstArray()[i];
+ }
+ return aSeq;
+}
+Sequence< sal_uInt16 > SAL_CALL OComponent::methodUShort(const Sequence< sal_uInt16 >& aSeq) throw( RuntimeException )
+{
+ sal_uInt16 _x;
+ for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
+ _x= aSeq.getConstArray()[i];
+ }
+ return aSeq;
+}
+Sequence< sal_Int32 > SAL_CALL OComponent::methodLong(const Sequence< sal_Int32 >& aSeq) throw( RuntimeException)
+{
+ sal_Int32 _x;
+ for( sal_Int16 i= 0; i < aSeq.getLength(); i++) {
+ _x= aSeq.getConstArray()[i];
+ }
+ return aSeq;
+}
+Sequence< sal_uInt32 > SAL_CALL OComponent::methodULong(const Sequence< sal_uInt32 >& aSeq) throw( RuntimeException)
+{
+ sal_uInt32 _x;
+ for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
+ _x= aSeq.getConstArray()[i];
+ }
+ return aSeq;
+}
+Sequence< OUString > SAL_CALL OComponent::methodString(const Sequence< OUString >& aSeq) throw( RuntimeException)
+{
+ OUString _x;
+ for( sal_Int16 i= 0; i < aSeq.getLength(); i++) {
+ _x= aSeq.getConstArray()[i];
+ }
+ return aSeq;
+}
+Sequence< sal_Unicode > SAL_CALL OComponent::methodChar(const Sequence< sal_Unicode >& aSeq) throw( RuntimeException)
+{
+ sal_Unicode _x;
+ for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
+ _x= aSeq.getConstArray()[i];
+ }
+ return aSeq;
+}
+Sequence< Any > SAL_CALL OComponent::methodAny(const Sequence< Any >& aSeq) throw( RuntimeException)
+{
+ Any _x;
+ for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
+ _x= aSeq.getConstArray()[i];
+ TypeClass _t= _x.getValueTypeClass();
+ if( _t== TypeClass_STRING)
+ OUString s(* (rtl_uString**)_x.getValue());
+ }
+ return aSeq;
+
+}
+//Sequence< Reference< XInterface> > SAL_CALL methodXInterface ( const Sequence< Reference < XInterface> >& aSeq)
+// throw (RuntimeException)
+Sequence< Reference< XInterface > > SAL_CALL OComponent::methodXInterface( const Sequence< Reference< XInterface > >& aSeq ) throw(RuntimeException)
+{
+ return aSeq;
+}
+
+Sequence< Sequence< sal_Int32 > > SAL_CALL OComponent::methodSequence(const Sequence< Sequence< sal_Int32 > >& aSeq) throw( RuntimeException)
+{
+ sal_Int32 value;
+ for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
+ const Sequence<sal_Int32>& rseq2= aSeq.getConstArray()[i];
+ for (sal_Int16 j= 0; j < rseq2.getLength(); j++){
+ value= rseq2.getConstArray()[j];
+ }
+ }
+ return aSeq;
+}
+Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL OComponent::methodSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq)
+ throw( RuntimeException )
+{
+ sal_Int32 value;
+ sal_Int32 len= aSeq.getLength();
+ for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
+ const Sequence< Sequence<sal_Int32> >& rseq2= aSeq.getConstArray()[i];
+ len= rseq2.getLength();
+
+ for (sal_Int16 j= 0; j < rseq2.getLength(); j++){
+ const Sequence<sal_Int32> & rseq3= rseq2.getConstArray()[j];
+ len= rseq3.getLength();
+
+ for (sal_Int16 k= 0; k < rseq3.getLength(); k++)
+ value= rseq3.getConstArray()[k];
+ }
+ }
+ return aSeq;
+}
+
+
+
+//---------------------------------------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL OComponent::getAttrByte(void) throw( RuntimeException)
+{
+ return m_seqByte;
+}
+void SAL_CALL OComponent::setAttrByte(const Sequence< sal_Int8 >& AttrByte_) throw( RuntimeException )
+{
+ m_seqByte= AttrByte_;
+}
+Sequence< float > SAL_CALL OComponent::getAttrFloat(void) throw( RuntimeException )
+{
+ return m_seqFloat;
+}
+void SAL_CALL OComponent::setAttrFloat(const Sequence< float >& AttrFloat_) throw( RuntimeException )
+{
+ m_seqFloat= AttrFloat_;
+}
+
+Sequence< double > SAL_CALL OComponent::getAttrDouble(void) throw( RuntimeException )
+{
+ return m_seqDouble;
+}
+void SAL_CALL OComponent::setAttrDouble(const Sequence< double >& AttrDouble_) throw( RuntimeException )
+{
+ m_seqDouble= AttrDouble_;
+}
+
+Sequence< sal_Bool > SAL_CALL OComponent::getAttrBool(void) throw( RuntimeException)
+{
+ return m_seqBool;
+}
+
+void SAL_CALL OComponent::setAttrBool(const Sequence< sal_Bool >& AttrBool_) throw (RuntimeException )
+{
+ m_seqBool= AttrBool_;
+}
+
+Sequence< sal_Int16 > SAL_CALL OComponent::getAttrShort(void) throw( RuntimeException)
+{
+ return m_seqShort;
+}
+void SAL_CALL OComponent::setAttrShort(const Sequence< sal_Int16 >& AttrShort_) throw( RuntimeException )
+{
+ m_seqShort= AttrShort_;
+}
+
+Sequence< sal_uInt16 > SAL_CALL OComponent::getAttrUShort(void) throw( RuntimeException )
+{
+ return m_seqUShort;
+}
+void SAL_CALL OComponent::setAttrUShort(const Sequence< sal_uInt16 >& AttrUShort_) throw( RuntimeException )
+{
+ m_seqUShort= AttrUShort_;
+}
+
+Sequence< sal_Int32 > SAL_CALL OComponent::getAttrLong(void) throw( RuntimeException)
+{
+ return m_seqLong;
+}
+void SAL_CALL OComponent::setAttrLong(const Sequence< sal_Int32 >& AttrLong_) throw( RuntimeException )
+{
+ m_seqLong= AttrLong_;
+}
+
+Sequence< sal_uInt32 > SAL_CALL OComponent::getAttrULong(void) throw( RuntimeException )
+{
+ return m_seqULong;
+}
+void SAL_CALL OComponent::setAttrULong(const Sequence< sal_uInt32 >& AttrULong_) throw( RuntimeException )
+{
+ m_seqULong= AttrULong_;
+}
+
+Sequence< OUString > SAL_CALL OComponent::getAttrString(void) throw( RuntimeException )
+{
+ return m_seqString;
+}
+void SAL_CALL OComponent::setAttrString(const Sequence< OUString >& AttrString_) throw( RuntimeException )
+{
+ m_seqString= AttrString_;
+}
+
+Sequence< sal_Unicode > SAL_CALL OComponent::getAttrChar(void) throw( RuntimeException )
+{
+ return m_seqChar;
+}
+void SAL_CALL OComponent::setAttrChar(const Sequence< sal_Unicode >& AttrChar_) throw( RuntimeException)
+{
+ m_seqChar= AttrChar_;
+}
+
+Sequence< Any > SAL_CALL OComponent::getAttrAny(void) throw( RuntimeException)
+{
+ return m_seqAny;
+}
+void SAL_CALL OComponent::setAttrAny(const Sequence< Any >& AttrAny_) throw( RuntimeException )
+{
+ m_seqAny= AttrAny_;
+}
+
+Sequence< Sequence< sal_Int32 > > SAL_CALL OComponent::getAttrSequence(void) throw( RuntimeException)
+{
+ return m_seq1;
+}
+void SAL_CALL OComponent::setAttrSequence(const Sequence< Sequence< sal_Int32 > >& AttrSequence) throw(RuntimeException )
+{
+ sal_Int32 x= 0;
+ for( sal_Int32 i=0; i < AttrSequence.getLength(); i++)
+ {
+ Sequence< sal_Int32 > seq= AttrSequence[i];
+
+ for ( sal_Int32 j=0; j < seq.getLength(); j++)
+ {
+ x= seq[j];
+ }
+ }
+
+ m_seq1= AttrSequence;
+}
+
+Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL OComponent::getAttrSequence2(void) throw( RuntimeException )
+{
+ return m_seq2;
+}
+void SAL_CALL OComponent::setAttrSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& AttrSequence2_)
+ throw( RuntimeException )
+{
+ m_seq2= AttrSequence2_;
+}
+
+Sequence< Reference< XInterface > > SAL_CALL OComponent::getAttrXInterface() throw(RuntimeException)
+{
+ return m_seqxInterface;
+}
+void SAL_CALL OComponent::setAttrXInterface( const Sequence< Reference< XInterface > >& _attrxinterface ) throw(RuntimeException)
+{
+ m_seqxInterface= _attrxinterface;
+}
+
+// ----------------------------------------------------------------------------
+
+void SAL_CALL OComponent::testout_methodByte(sal_Int8& rOut) throw( RuntimeException )
+{
+ rOut= 111;
+}
+void SAL_CALL OComponent::testout_methodFloat(float& rOut) throw( RuntimeException )
+{
+ rOut= 3.14;
+}
+void SAL_CALL OComponent::testout_methodDouble(double& rOut) throw( RuntimeException )
+{
+ rOut= 3.14;
+}
+
+void SAL_CALL OComponent::testout_methodBool(sal_Bool& rOut) throw( RuntimeException )
+{
+ rOut= sal_True;
+}
+void SAL_CALL OComponent::testout_methodShort(sal_Int16& rOut) throw( RuntimeException )
+{
+ rOut= 222;
+}
+void SAL_CALL OComponent::testout_methodUShort(sal_uInt16& rOut) throw( RuntimeException )
+{
+ rOut= 333;
+}
+void SAL_CALL OComponent::testout_methodLong(sal_Int32& rOut) throw( RuntimeException )
+{
+ rOut = 444;
+}
+void SAL_CALL OComponent::testout_methodULong(sal_uInt32& rOut) throw( RuntimeException )
+{
+ rOut= 555;
+}
+void SAL_CALL OComponent::testout_methodString(OUString& rOut) throw( RuntimeException )
+{
+ rOut= L"a little string";
+}
+void SAL_CALL OComponent::testout_methodChar(sal_Unicode& rOut) throw( RuntimeException )
+{
+ rOut= 'A';
+}
+void SAL_CALL OComponent::testout_methodAny(Any& rOut) throw( RuntimeException)
+{
+ rOut <<= OUString(L"I am a string in an any");
+}
+void SAL_CALL OComponent::testout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException)
+{
+ rOut.realloc(10);
+ for( sal_Int16 i= 0; i < rOut.getLength(); i++) rOut.getArray()[i]= i;
+}
+void SAL_CALL OComponent::testout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException )
+{
+ rOut.realloc( 10);
+ for( sal_Int16 i= 0; i < rOut.getLength(); i++){
+ Sequence<sal_Int32>& rseq2= rOut.getArray()[i];
+ rseq2.realloc( 10);
+ for (sal_Int16 j= 0; j < rseq2.getLength(); j++){
+ rseq2.getArray()[j]= j;
+ }
+ }
+}
+void SAL_CALL OComponent::testout_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException )
+{
+ rout1= 999;
+ rout2= 1111;
+}
+void SAL_CALL OComponent::testout_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException )
+{
+ rout1= 1111;
+ rout2= 1222;
+ rout3= L" another string";
+}
+void SAL_CALL OComponent::testout_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException )
+{
+ sout= L"Out Hallo!";
+}
+void SAL_CALL OComponent::testout_methodMulParams4( float in1, float& out1, sal_Int32 in2, sal_Int32& out2, sal_Int32 in3 ) throw(RuntimeException)
+{
+ out1= in1 + 1;
+ out2= in2 + 1;
+}
+
+void SAL_CALL OComponent::testout_methodXInterface( Reference< XInterface >& rOut ) throw(RuntimeException)
+{
+ OUString string( L"Property Any");
+ m_any <<= string;
+ rOut= (XInterface*) static_cast<XTestSequence*>(this);
+}
+
+// INOUT
+void SAL_CALL OComponent::testinout_methodByte(sal_Int8& rOut) throw( RuntimeException )
+{
+ rOut += 1;
+}
+void SAL_CALL OComponent::testinout_methodFloat(float& rOut) throw( RuntimeException )
+{
+ rOut += 1;
+}
+
+void SAL_CALL OComponent::testinout_methodDouble(double& rOut) throw( RuntimeException )
+{
+ rOut += 1;
+}
+void SAL_CALL OComponent::testinout_methodBool(sal_Bool& rOut) throw( RuntimeException )
+{
+ rOut= rOut== sal_True ? sal_False : sal_True;
+}
+void SAL_CALL OComponent::testinout_methodShort(sal_Int16& rOut) throw( RuntimeException )
+{
+ rOut += 1;
+}
+void SAL_CALL OComponent::testinout_methodUShort(sal_uInt16& rOut) throw( RuntimeException )
+{
+ rOut += 1;
+}
+void SAL_CALL OComponent::testinout_methodLong(sal_Int32& rOut) throw( RuntimeException )
+{
+ rOut += 1;
+}
+void SAL_CALL OComponent::testinout_methodULong(sal_uInt32& rOut) throw( RuntimeException )
+{
+ rOut += 1;
+}
+void SAL_CALL OComponent::testinout_methodString(OUString& rOut) throw( RuntimeException )
+{
+ rOut= rOut + L" out string";
+}
+void SAL_CALL OComponent::testinout_methodChar(sal_Unicode& rOut) throw( RuntimeException)
+{
+ rOut += 1;
+}
+void SAL_CALL OComponent::testinout_methodAny(Any& rOut) throw( RuntimeException)
+{
+ TypeClass t= rOut.getValueTypeClass();
+}
+void SAL_CALL OComponent::testinout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException)
+{
+ for ( sal_Int32 i=0; i < rOut.getLength(); i++)
+ {
+ rOut.getArray()[i] += 1;
+ }
+}
+void SAL_CALL OComponent::testinout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException )
+{
+ for( sal_Int32 i=0; i < rOut.getLength(); i++)
+ {
+ Sequence< sal_Int32 >& seq= rOut.getArray()[i];
+
+ for ( sal_Int32 j=0; j < seq.getLength(); j++)
+ {
+ seq.getArray()[j] += seq.getArray()[j];
+ }
+ }
+}
+
+// The parameter should implement XInvocation and a Property "value"
+void SAL_CALL OComponent::testinout_methodXInterface( Reference< XInvocation >& rOut ) throw(RuntimeException)
+{
+ Any any;
+ any= rOut->getValue( OUString( L"value"));
+ OUString _s;
+ any >>= _s;
+ OUString string(L" this string was written in the UNO component to the inout pararmeter");
+ any <<= string;
+ rOut->setValue( OUString(L"value"), any);
+}
+Any SAL_CALL OComponent::methodAnyTest1(const Any& rIn) throw( RuntimeException )
+{
+ return rIn;
+}
+Any SAL_CALL OComponent::getAttrAny2(void) throw( RuntimeException )
+{
+ return m_any;
+}
+void SAL_CALL OComponent::setAttrAny2(const Any& AttrAny2_) throw( RuntimeException )
+{
+ m_any= AttrAny2_;
+}
+
+
+
+// XTestStruct =======================================================================================
+
+void SAL_CALL OComponent::methodStruct(const Property& aProp) throw( RuntimeException )
+{
+}
+
+Property SAL_CALL OComponent::retMethodStruct(void) throw( RuntimeException )
+{
+ Property a(L"OleTest_Property", 255, getCppuType( (Reference<XInterface>*)0), PropertyAttribute::MAYBEVOID |
+ PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED |
+ PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY |
+ PropertyAttribute::MAYBEAMBIGUOUS | PropertyAttribute::MAYBEDEFAULT );
+ return a;
+}
+
+Property SAL_CALL OComponent::getAttrStruct(void) throw( RuntimeException)
+{
+ Property a(L"OleTest_Property", 255, getCppuType( (Reference<XInterface>*)0), PropertyAttribute::MAYBEVOID |
+ PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED |
+ PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY |
+ PropertyAttribute::MAYBEAMBIGUOUS | PropertyAttribute::MAYBEDEFAULT );
+ return a;
+
+}
+
+void SAL_CALL OComponent::setAttrStruct(const Property& AttrStruct_) throw( RuntimeException )
+{}
+
+// XTestOther ==================================================================================
+void SAL_CALL OComponent::other_methodAnyIn(const Any& rAny) throw( RuntimeException )
+{
+}
+void SAL_CALL OComponent::other_methodAnyOut(Any& rAny) throw( RuntimeException )
+{
+ rAny <<= OUString(L"Ein Any");
+}
+
+Any SAL_CALL OComponent::other_methodAnyRet(void) throw(RuntimeException )
+{
+ Any a;
+ a <<= OUString(L"Ein Any");
+ return a;
+}
+void SAL_CALL OComponent::in_float( float val) throw ( RuntimeException)
+{
+ char buff[256];
+ sprintf( buff, "parameter : %f", val);
+ MessageBox( NULL, _T(buff), _T("OleTest"), MB_OK);
+}
+
+// XTestOutParameters ============================================================================
+void SAL_CALL OComponent::out_test(sal_Int8 rIn) throw( RuntimeException )
+{
+}
+
+void SAL_CALL OComponent::out_methodByte(sal_Int8& rOut) throw( RuntimeException )
+{
+ rOut= 100;
+}
+void SAL_CALL OComponent::out_methodDouble(double& rOut) throw( RuntimeException )
+{
+ rOut= 3.14;
+}
+void SAL_CALL OComponent::out_methodFloat(float& rOut) throw( RuntimeException )
+{
+ rOut= 3.14;
+}
+void SAL_CALL OComponent::out_methodBool(sal_Bool& rOut) throw( RuntimeException )
+{
+ rOut= sal_True;
+}
+void SAL_CALL OComponent::out_methodShort(sal_Int16& rOut) throw( RuntimeException )
+{
+ rOut= -100;
+}
+void SAL_CALL OComponent::out_methodUShort(sal_uInt16& rOut) throw( RuntimeException )
+{
+ rOut= 100;
+}
+void SAL_CALL OComponent::out_methodLong(sal_Int32& rOut) throw( RuntimeException )
+{
+ rOut= -100;
+}
+
+void SAL_CALL OComponent::out_methodULong(sal_uInt32& rOut) throw( RuntimeException )
+{
+ rOut= 100;
+}
+void SAL_CALL OComponent::out_methodString(OUString& rOut) throw( RuntimeException )
+{
+ rOut= L"I'm a string";
+}
+void SAL_CALL OComponent::out_methodChar(sal_Unicode& rOut) throw( RuntimeException )
+{
+ rOut= 'A';
+}
+void SAL_CALL OComponent::out_methodAny(Any& rOut) throw( RuntimeException)
+{
+ Any a;
+ a <<= OUString( L"Hi");
+ rOut= a;
+}
+void SAL_CALL OComponent::out_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException )
+{
+ Sequence< sal_Int32 > aseq(10);
+ for( sal_Int16 i= 0; i < aseq.getLength(); i++) aseq.getArray()[i]= i;
+ rOut= aseq;
+}
+void SAL_CALL OComponent::out_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException )
+{
+ rOut= Sequence< Sequence< sal_Int32 > >();
+}
+void SAL_CALL OComponent::out_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException )
+{
+ rout1= 111;
+ rout2= 222;
+}
+void SAL_CALL OComponent::out_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException )
+{
+ rout1= 111;
+ rout2= 222;
+ rout3= L"this is a neet little string";
+}
+void SAL_CALL OComponent::out_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException )
+{
+ sout= L"this is a neet little string";
+}
+
+// XTestInterfaces -------------------------------------------------------------------------------------
+void SAL_CALL OComponent::testInterface( const Reference< XCallback >& xCallback, sal_Int32 mode ) throw(RuntimeException)
+{
+ USES_CONVERSION;
+ sal_Int32 i=0;
+ OUString aString;
+ char buff[1024];
+
+ Reference<XSimple> xSimple;
+ SimpleStruct aSimpleStruct;
+ SimpleEnum aSimpleEnum;
+ Sequence<Any> seqAny;
+ Sequence< sal_Int8 > seqByte;
+ Any outAny;
+ sal_Bool aBool;
+ sal_Unicode aChar;
+ float aFloat;
+ double aDouble;
+ sal_Int8 aByte;
+ sal_Int16 aShort;
+ sal_Int32 aLong;
+ sal_uInt16 aUShort;
+ sal_uInt32 aULong;
+
+ switch( mode)
+ {
+ case 1:
+ xCallback->func1(); break;
+ case 2:
+ xSimple= xCallback->returnInterface();
+ xSimple->func(L"XCallback::returnInterface");
+ break;
+
+
+ case 3:
+ xCallback->outInterface( xSimple);
+ sprintf( buff, "XCallback::outInterface, value: %x", xSimple.get());
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ xSimple->func(L"XCallback::outInterface works");
+ break;
+ case 4:
+ xCallback->outStruct( aSimpleStruct);
+ sprintf( buff,"XCallback::outStruct, SimpleStruct::message: %s", OLE2A( aSimpleStruct.message));
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ break;
+ case 5:
+ xCallback->outEnum( aSimpleEnum);
+ sprintf( buff,"XCallback::outEnum, SimpleEnum: %d", aSimpleEnum);
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ break;
+ case 6:
+ xCallback->outSeqAny( seqAny);
+ sprintf( buff,"XCallback::outSeqAny, length: %d )", seqAny.getLength());
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ for( i=0; i < seqAny.getLength(); i++)
+ {
+ Any any= seqAny[i];
+ if( any.getValueTypeClass() == TypeClass_STRING)
+ {
+ any >>= aString;
+ OutputDebugStringW( aString);
+ }
+
+ }
+ break;
+ case 7:
+ xCallback->outAny( outAny);
+ if( outAny.getValueTypeClass() == TypeClass_STRING)
+ outAny >>= aString;
+ sprintf( buff,"XCallback::outAny, Any : %s", W2A( aString));
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ break;
+ case 8:
+ xCallback->outBool( aBool);
+ sprintf( buff,"XCallback::outBool, value: %d", aBool);
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ break;
+ case 9:
+ xCallback->outChar( aChar);
+ sprintf( buff,"XCallback::outChar, value: %C", aChar);
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ break;
+ case 10:
+ xCallback->outString( aString);
+ sprintf( buff,"XCallback::outString, value: %s", W2A( aString));
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ break;
+ case 11:
+ xCallback->outFloat( aFloat);
+ sprintf( buff,"XCallback::outFloat, value: %f", aFloat);
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ break;
+ case 12:
+ xCallback->outDouble( aDouble);
+ sprintf( buff,"XCallback::outDouble, value: %f", aDouble);
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ break;
+ case 13:
+ xCallback->outByte( aByte);
+ sprintf( buff,"XCallback::outByte, value: %d", aByte);
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ break;
+ case 14:
+ xCallback->outShort( aShort);
+ sprintf( buff,"XCallback::outShort, value: %d", aShort);
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ break;
+ case 15:
+ xCallback->outLong( aLong);
+ sprintf( buff,"XCallback::outLong, value: %d", aLong);
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ break;
+ case 18:
+ case 19:
+ case 30:
+ {
+
+ long outLong= 0;
+ xCallback->outValuesMixed( 1111, outLong, OUString( L"in string") );
+
+ sprintf( buff, "oletest.testInterface: outValue: %d", outLong);
+ MessageBox( NULL, A2T(buff), _T("OleTest"), MB_OK);
+ break;
+ }
+
+ case 31:
+ {
+ Reference< XSimple > xSimple;
+ SimpleStruct aSimpleStruct;
+ SimpleEnum aSimpleEnum;
+ Sequence<Any> seqAny;
+ Any aAny;
+ sal_Bool aBool;
+ sal_Unicode aChar;
+ OUString aString;
+ float aFloat;
+ double aDouble;
+ sal_Int8 aByte;
+ sal_Int16 aShort;
+ sal_Int32 aLong;
+ sal_uInt16 aUShort;
+ sal_uInt32 aULong;
+ xCallback->outValuesAll( xSimple, aSimpleStruct, aSimpleEnum, seqAny, aAny, aBool,
+ aChar, aString,
+ aFloat, aDouble,
+ aByte,
+ aShort, aLong);
+
+ MessageBox( NULL, _T("XCallback::outValuesAll returned"), _T("OleTest::testInterface"), MB_OK);
+ break;
+ }
+ case 32:
+ {
+
+ xCallback->outSeqByte( seqByte);
+ sprintf( buff,"XCallback::outSeqAny, length: %d )", seqAny.getLength());
+ MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
+ for( i=0; i < seqAny.getLength(); i++)
+ {
+ Any any= seqAny[i];
+ if( any.getValueTypeClass() == TypeClass_STRING)
+ {
+ any >>= aString;
+ OutputDebugStringW( aString);
+ }
+ }
+ break;
+ }
+ // ############################################################################
+ // IN OUT parameter
+ // ############################################################################
+ case 100:
+ {
+ Reference<XSimple> xSimple= static_cast<XSimple*>(this);
+ xCallback->inoutInterface( xSimple);
+ xSimple->func(L"XSimple called from OleTest");
+ break;
+ }
+ case 101:
+ {
+ Reference<XIdlReflection> xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY);
+ if( xRefl.is())
+ {
+ Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct");
+ Any any;
+ if( xClass.is())
+ xClass->createObject( any);
+
+ if( any.getValueTypeClass() == TypeClass_STRUCT)
+ {
+ SimpleStruct* pStruct= ( SimpleStruct*) any.getValue();
+ pStruct->message= OUString::createFromAscii("This struct was created in OleTest");
+
+ SimpleStruct aStruct;
+ any >>= aStruct;
+ xCallback->inoutStruct( aStruct);
+ // a Struct should now contain a different message
+ MessageBox( NULL, W2T(aStruct.message), _T("OleTest in out parameter"), MB_OK);
+ }
+
+ }
+ break;
+ }
+ case 102:
+ {
+ SimpleEnum aEnum= SimpleEnum_B;
+ xCallback->inoutEnum( aEnum);
+ char buff[1024];
+ sprintf( buff, "Enum: %d", aEnum);
+ MessageBox( NULL, A2T(buff), _T("OleTest in out parameter"), MB_OK);
+ break;
+ }
+ case 103:
+ {
+ Any arAny[3];
+ arAny[0] <<= OUString( L"string 0");
+ arAny[1] <<= OUString( L"string 1");
+ arAny[2] <<= OUString( L"string 2");
+
+ Sequence< Any >seqAny( arAny, 3);
+ xCallback->inoutSeqAny( seqAny);
+ char buff[1023];
+ sprintf( buff, "Sequence length: %d", seqAny.getLength());
+ MessageBox( NULL,A2T(buff) , _T("OleTest in out parameter"), MB_OK);
+
+ for( int i=0; i < seqAny.getLength(); i++)
+ {
+ Any any;
+ any <<= seqAny[i];
+ if(any.getValueTypeClass() == TypeClass_STRING)
+ {
+ OUString str;
+ any >>= str;
+
+ }
+ }
+
+ break;
+ }
+ case 104:
+ {
+ Any any;
+ OUString s(L" OleTest");
+ any <<= s;
+ xCallback->inoutAny(any);
+ if( any.getValueTypeClass() == TypeClass_STRING)
+ {
+ OUString s= *( rtl_uString**) any.getValue();
+ MessageBox( NULL, W2T( s), _T("OleTest: inout value any"), MB_OK);
+ }
+ break;
+ }
+ case 105:
+ {
+ sal_Bool b= sal_True;
+ xCallback->inoutBool( b);
+ char buff[1024];
+ sprintf( buff, "out value bool: %d", b);
+ MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
+ break;
+ }
+ case 106:
+ {
+ sal_Unicode uc= L'A';
+ xCallback->inoutChar( uc);
+ char buff[1024];
+ sprintf( buff, "out value sal_Unicode: %C", uc);
+ MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
+ break;
+ }
+ case 107:
+ {
+ OUString s(L"OleTest");
+ xCallback->inoutString( s);
+ char buff[1024];
+ sprintf( buff, "out value string: %S", s.getStr());
+ MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
+ break;
+ }
+ case 108:
+ {
+ float f= 3.14;
+ xCallback->inoutFloat(f);
+ char buff[1024];
+ sprintf( buff, "out value float: %f", f);
+ MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
+ break;
+ }
+ case 109:
+ {
+ double f= 3.145;
+ xCallback->inoutDouble( f);
+ char buff[1024];
+ sprintf( buff, "out value double: %g", f);
+ MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
+ break;
+ }
+ case 110:
+ {
+ sal_Int8 aByte= 0xf;
+ xCallback->inoutByte( aByte);
+ char buff[1024];
+ sprintf( buff, "out value sal_Int8: %d", aByte);
+ MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
+ break;
+ }
+ case 111:
+ {
+ sal_Int16 aShort= 0xff;
+ xCallback->inoutShort( aShort);
+ char buff[1024];
+ sprintf( buff, "out value sal_Int16: %d", aShort);
+ MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
+ break;
+ }
+ case 112:
+ {
+ sal_Int32 aLong= 0xfffe;
+ xCallback->inoutLong( aLong);
+ char buff[1024];
+ sprintf( buff, "out value sal_Int32: %d", aLong);
+ MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
+ break;
+ }
+ case 120:
+ {
+ Reference<XSimple> aXSimple= static_cast<XSimple*>(this);
+
+ SimpleStruct aStruct;
+ Reference<XIdlReflection> xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY);
+ if( xRefl.is())
+ {
+ Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct");
+ Any any;
+ if( xClass.is())
+ xClass->createObject( any);
+
+ if( any.getValueTypeClass() == TypeClass_STRUCT)
+ {
+ SimpleStruct* pStruct= ( SimpleStruct*) any.getValue();
+ pStruct->message= OUString::createFromAscii("This struct was created in OleTest");
+ any >>= aStruct;
+ }
+ }
+
+ SimpleEnum aEnum= SimpleEnum_B;
+
+ Sequence< Any > aSeq;
+ Any arAny[3];
+ arAny[0] <<= OUString( L"string 0");
+ arAny[1] <<= OUString( L"string 1");
+ arAny[2] <<= OUString( L"string 2");
+ aSeq = Sequence< Any >( arAny, 3);
+
+ Any aAny;
+ OUString s(L" OleTest");
+ aAny <<= s;
+
+ sal_Bool aBool= sal_True;
+ sal_Unicode aChar= L'A';
+ OUString aString( L"OleTest");
+ float aFloat=3.14;
+ double aDouble= 3.145;
+ sal_Int8 aByte= 0xf;
+ sal_Int16 aShort= 0xff;
+ sal_Int32 aLong= 0xffe;
+
+ xCallback->inoutValuesAll( aXSimple, aStruct, aEnum, aSeq,
+ aAny, aBool, aChar, aString, aFloat, aDouble,
+ aByte, aShort, aLong );
+
+ aXSimple->func(L"XSimple called from OleTest");
+ MessageBox( NULL, W2T(aStruct.message), _T("OleTest"), MB_OK);
+
+ for( int i=0; i < aSeq.getLength(); i++)
+ {
+ Any any;
+ any <<= aSeq[i];
+ if(any.getValueTypeClass() == TypeClass_STRING)
+ {
+ OUString str;
+ any >>= str;
+
+ }
+ }
+ break;
+ }
+
+ // ############################################################################
+ // IN parameter
+ // ############################################################################
+
+ case 200:
+
+ xCallback->inValues( L'a', 0xffffL, OUString(L" a string from OleTest"));
+ break;
+ case 201:
+ {
+ sal_Int8 arbyte[3]= { 1,2,3};
+ Sequence< sal_Int8 > seq( arbyte, 3);
+ xCallback->inSeqByte( seq);
+ break;
+ }
+
+ // ############################################################################
+ // Call a COM object that has not been passed as parameter to a UNO component and
+ // hence no type information are available in the COM wrapper
+ // ############################################################################
+ case 300:
+ {
+ Reference<XInterface> xIntFact = m_rFactory->createInstance(L"com.sun.star.bridge.OleObjectFactory");
+
+ Reference<XMultiServiceFactory> oleFact(xIntFact, UNO_QUERY);
+
+ Reference<XInterface> xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback");
+ Reference<XInvocation> xInv( xIntCallback, UNO_QUERY);
+//Any SAL_CALL invoke( const OUString& aFunctionName, const Sequence<Any >& aParams,Sequence< sal_Int16 >& aOutParamIndex,
+// Sequence<Any >& aOutParam );
+ Sequence<sal_Int16> seqIndizes;
+ Sequence<Any> seqOutParams;
+ xInv->invoke( OUString( L"outValuesAll"), Sequence<Any>(), seqIndizes, seqOutParams);
+
+// void outValuesAll( [out] oletest::XSimple outInterface,
+// [out] SimpleStruct outStruct ,
+// [out] SimpleEnum outEnum,
+// [out] sequence<any> outSeqAny,
+// [out] any outAny,
+// [out] boolean outBool,
+// [out] char outChar,
+// [out] string outString,
+// [out] float outFloat,
+// [out] double outDouble,
+// [out] byte outByte,
+// [out] short outShort,
+// [out] long outLong);
+ if( seqOutParams.getLength() == 12)
+ {
+ Reference<XSimple> xSimple= *(XSimple**)seqOutParams[0].getValue();
+ xSimple->func( L"Call from OleTest on XSimple");
+ SimpleStruct aStruct;
+ seqOutParams[1] >>= aStruct;
+ SimpleEnum aEnum= *(SimpleEnum*)seqOutParams[2].getValue();
+
+ Sequence<Any> seqAny;
+ seqOutParams[3] >>= seqAny;
+ for( int i=0; i<seqAny.getLength(); i++)
+ {
+ OUString _s;
+ seqAny[i] >>= _s;
+ }
+
+ Any _any= *(Any*)seqOutParams[4].getValue();
+ sal_Bool _bool= *(sal_Bool*)seqOutParams[5].getValue();
+ sal_Unicode _char= *( sal_Unicode*) seqOutParams[6].getValue();
+ OUString _str= *( rtl_uString**)seqOutParams[7].getValue();
+
+ float _f= *( float*)seqOutParams[8].getValue();
+ double _d= *( double*) seqOutParams[9].getValue();
+ sal_Int8 _byte= *( sal_Int8*) seqOutParams[10].getValue();
+ sal_Int16 _short= *( sal_Int16*) seqOutParams[11].getValue();
+
+ sal_Int32 _long= *( sal_Int32*) seqOutParams[12].getValue();
+
+ }
+ break;
+ }
+ case 301:
+ // in / out parameter
+ {
+ Reference<XInterface> xIntFact = m_rFactory->createInstance(L"com.sun.star.bridge.OleObjectFactory");
+
+ Reference<XMultiServiceFactory> oleFact(xIntFact, UNO_QUERY);
+
+ Reference<XInterface> xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback");
+ Reference<XInvocation> xInv( xIntCallback, UNO_QUERY);
+ Sequence<sal_Int16> seqIndizes;
+ Sequence<Any> seqOutParams;
+
+
+ Any arAny[13];
+ Reference<XSimple> xSimple= static_cast<XSimple*>( this);
+
+ arAny[0] <<= xSimple;
+ SimpleStruct aStruct;
+ Reference<XIdlReflection> xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY);
+ if( xRefl.is())
+ {
+ Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct");
+ Any any;
+ if( xClass.is())
+ xClass->createObject( any);
+
+ if( any.getValueTypeClass() == TypeClass_STRUCT)
+ {
+ SimpleStruct* pStruct= ( SimpleStruct*) any.getValue();
+ pStruct->message= OUString::createFromAscii("This struct was created in OleTest");
+ any >>= aStruct;
+ }
+ }
+ arAny[1] <<= aStruct;
+ arAny[2] <<= SimpleEnum_C;
+
+ Any arSeqAny[3];
+ arSeqAny[0] <<= OUString( L"string 0");
+ arSeqAny[1] <<= OUString( L"string 1");
+ arSeqAny[2] <<= OUString( L"string 2");
+
+ arAny[3] <<= Sequence< Any >( arAny, 3);
+
+ OUString str(L" Ein Any param");
+ arAny[4] <<= str;
+ arAny[5] <<= sal_False;
+ arAny[6] <<= L'B';
+ OUString stringParam(L" a string parameter");
+ arAny[7] <<= stringParam;
+ float _float= 3.14;
+ arAny[8] <<= _float;
+ double _double= 3.145;
+ arAny[9] <<= _double;
+ sal_Int8 _byte= 0xff;
+ arAny[10] <<= _byte;
+ sal_Int16 _short= 0xffff;
+ arAny[11] <<= _short;
+ sal_Int32 _long= 0xffffffff;
+ arAny[12] <<= _long;
+//
+ Sequence<Any> params( arAny, 13);
+
+ xInv->invoke( OUString( L"inoutValuesAll"), params, seqIndizes, seqOutParams);
+
+ if( seqOutParams.getLength() == 12)
+ {
+ Reference<XSimple> xSimple= *(XSimple**)seqOutParams[0].getValue();
+ xSimple->func( L"Call from OleTest on XSimple");
+ SimpleStruct aStruct;
+ seqOutParams[1] >>= aStruct;
+ SimpleEnum aEnum= *(SimpleEnum*)seqOutParams[2].getValue();
+
+ Sequence<Any> seqAny;
+ seqOutParams[3] >>= seqAny;
+ for( int i=0; i<seqAny.getLength(); i++)
+ {
+ OUString _s;
+ seqAny[i] >>= _s;
+ }
+
+ Any _any= *(Any*)seqOutParams[4].getValue();
+ sal_Bool _bool= *(sal_Bool*)seqOutParams[5].getValue();
+ sal_Unicode _char= *( sal_Unicode*) seqOutParams[6].getValue();
+ OUString _str= *( rtl_uString**)seqOutParams[7].getValue();
+
+ float _f= *( float*)seqOutParams[8].getValue();
+ double _d= *( double*) seqOutParams[9].getValue();
+ sal_Int8 _byte= *( sal_Int8*) seqOutParams[10].getValue();
+ sal_Int16 _short= *( sal_Int16*) seqOutParams[11].getValue();
+
+ sal_Int32 _long= *( sal_Int32*) seqOutParams[12].getValue();
+
+ }
+ break;
+ }
+ case 303:
+ // in parameter
+// void inValues( [in] char aChar, [in] long aLong, [in] string aString);
+ {
+ Reference<XInterface> xIntFact = m_rFactory->createInstance(L"com.sun.star.bridge.OleObjectFactory");
+
+ Reference<XMultiServiceFactory> oleFact(xIntFact, UNO_QUERY);
+
+ Reference<XInterface> xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback");
+ Reference<XInvocation> xInv( xIntCallback, UNO_QUERY);
+ Sequence<sal_Int16> seqIndizes;
+ Sequence<Any> seqOutParams;
+
+ Any arAny[3];
+ sal_Unicode aChar=L'a';
+ arAny[0] <<= aChar;
+ sal_Int32 aLong= 0xffffffff;
+ arAny[1] <<= aLong;
+ OUString aString(L" a string parameter");
+ arAny[2] <<= aString;
+
+ xInv->invoke( OUString( L"inValues"), Sequence<Any>(arAny,3), seqIndizes, seqOutParams);
+
+ break;
+ }
+
+
+
+
+ }
+
+}
+
+// XSimple --------------------------------------------------------------------------
+void SAL_CALL OComponent::func( const OUString &message)throw(::com::sun::star::uno::RuntimeException)
+{
+ USES_CONVERSION;
+
+ MessageBox( NULL, W2T( message.getStr()), _T("OleTest: XSimple::func"), MB_OK);
+}
+// XSimple --------------------------------------------------------------------------
+OUString SAL_CALL OComponent::getName()throw(::com::sun::star::uno::RuntimeException)
+{
+ return L"XSimple";
+}
+void SAL_CALL OComponent::testInterface2( const Reference< XSimple >& xSimple, sal_Int32 mode ) throw(RuntimeException)
+{
+ switch( mode)
+ {
+ case 0:
+ {
+ xSimple->func( L"OleTest is calling XSimple");
+ Reference<XSimple2> xSimple2( xSimple, UNO_QUERY);
+ if( xSimple2.is())
+ xSimple2->func2( L"OleTest is calling XSimple2");
+ Reference<XSimple3> xSimple3( xSimple, UNO_QUERY);
+ if( xSimple3.is())
+ xSimple3->func3( L"OleTest is calling XSimple3");
+
+ break;
+ }
+ }
+}
diff --git a/extensions/test/ole/cpnt/exports.dxp b/extensions/test/ole/cpnt/exports.dxp
new file mode 100644
index 000000000..a265aeec0
--- /dev/null
+++ b/extensions/test/ole/cpnt/exports.dxp
@@ -0,0 +1,3 @@
+component_writeInfo
+component_getFactory
+component_getImplementationEnvironment \ No newline at end of file
diff --git a/extensions/test/ole/cpnt/makefile.mk b/extensions/test/ole/cpnt/makefile.mk
new file mode 100644
index 000000000..b53519118
--- /dev/null
+++ b/extensions/test/ole/cpnt/makefile.mk
@@ -0,0 +1,146 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..$/..
+
+PRJNAME= extensions
+TARGET= oletest
+#LIBTARGET= NO
+#TARGETTYPE= CUI
+ENABLE_EXCEPTIONS=TRUE
+NO_BSYMBOLIC= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/cpnt.obj
+
+UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb $(BIN)$/oletest.rdb
+UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb $(BIN)$/oletest.rdb
+
+UNOUCROUT= $(OUT)$/inc
+INCPRE+= $(OUT)$/inc -I$(SOLARINCDIR)$/external$/atl
+#INCPRE+= -I$(SOLARINCDIR)$/external$/atl
+LIBCMT=msvcrtd.lib
+
+UNOTYPES= oletest.XTestSequence oletest.XTestStruct \
+ oletest.XTestOther \
+ oletest.XTestInterfaces \
+ oletest.XSimple \
+ oletest.XSimple2 \
+ oletest.XSimple3 \
+ com.sun.star.beans.PropertyAttribute \
+ com.sun.star.uno.XAggregation \
+ com.sun.star.lang.XTypeProvider \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.registry.XRegistryKey \
+ com.sun.star.script.XInvocation \
+ com.sun.star.reflection.XIdlReflection
+
+
+SHL1TARGET= $(TARGET)
+
+SHL1STDLIBS= \
+ $(SALLIB) \
+ $(VOSLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB)
+
+SHL1DEPN=
+SHL1IMPLIB= i$(TARGET)
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1EXPORTFILE= exports.dxp
+
+
+ALLIDLFILES:= ..$/idl$/oletest.idl
+
+# --- Targets ------------------------------------------------------
+
+.IF "$(depend)" == ""
+ALL : $(BIN)$/oletest.rdb \
+ ALLTAR
+
+.ELSE
+ALL: ALLDEP
+.ENDIF
+
+.INCLUDE : target.mk
+
+
+
+$(BIN)$/oletest.rdb: $(ALLIDLFILES)
+ +unoidl -I$(PRJ) -I$(SOLARIDLDIR) -Burd -OH$(BIN) $?
+ +regmerge $@ /UCR $(BIN)$/{$(?:f:s/.idl/.urd/)}
+ touch $@
+
+#unoheader: $(BIN)$/testcppu.rdb
+# +cppumaker -BUCR $(CPPUMAKERFLAGS) -O$(UNOUCROUT) $(TYPES) $(BIN)$/testcppu.rdb
+
diff --git a/extensions/test/ole/cpnt/readme.txt b/extensions/test/ole/cpnt/readme.txt
new file mode 100644
index 000000000..62a12a1ef
--- /dev/null
+++ b/extensions/test/ole/cpnt/readme.txt
@@ -0,0 +1,5 @@
+cpnt.cxx contains a uno component that is uses to test the olebridge
+within a JavaScript context.
+In particular it has functions using out, in/out and sequence parameter
+that have to be specifically treated in JScript because they are represented
+by IDispatch objects. \ No newline at end of file
diff --git a/extensions/test/ole/cpptest/StdAfx.cpp b/extensions/test/ole/cpptest/StdAfx.cpp
new file mode 100644
index 000000000..aee6573a1
--- /dev/null
+++ b/extensions/test/ole/cpptest/StdAfx.cpp
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * $RCSfile: StdAfx.cpp,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// stdafx.cpp : source file that includes just the standard includes
+// cpptest.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/extensions/test/ole/cpptest/StdAfx.h b/extensions/test/ole/cpptest/StdAfx.h
new file mode 100644
index 000000000..a838fba37
--- /dev/null
+++ b/extensions/test/ole/cpptest/StdAfx.h
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * $RCSfile: StdAfx.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__84C60723_E38E_11D3_82FC_005004526AB4__INCLUDED_)
+#define AFX_STDAFX_H__84C60723_E38E_11D3_82FC_005004526AB4__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+#include <comdef.h>
+#include <tchar.h>
+#include<atlbase.h>
+extern CComModule _Module;
+#include<atlcom.h>
+#include<atlimpl.cpp>
+
+
+// TODO: reference additional headers your program requires here
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__84C60723_E38E_11D3_82FC_005004526AB4__INCLUDED_)
diff --git a/extensions/test/ole/cpptest/cpptest.cpp b/extensions/test/ole/cpptest/cpptest.cpp
new file mode 100644
index 000000000..d1c300677
--- /dev/null
+++ b/extensions/test/ole/cpptest/cpptest.cpp
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * $RCSfile: cpptest.cpp,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// cpptest.cpp : Defines the entry point for the console application.
+//
+
+#include "stdafx.h"
+
+CComModule _Module;
+BEGIN_OBJECT_MAP(ObjectMap)
+END_OBJECT_MAP()
+
+
+HRESULT doTest();
+
+int main(int argc, char* argv[])
+{
+ HRESULT hr;
+ if( FAILED( hr=CoInitialize(NULL)))
+ {
+ _tprintf(_T("CoInitialize failed \n"));
+ return -1;
+ }
+
+
+ _Module.Init( ObjectMap, GetModuleHandle( NULL));
+
+ if( FAILED(hr=doTest()))
+ {
+ _com_error err( hr);
+ const TCHAR * errMsg= err.ErrorMessage();
+ MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR);
+ }
+
+
+ _Module.Term();
+ CoUninitialize();
+ return 0;
+}
+
+HRESULT doTest()
+{
+ HRESULT hr;
+ CComPtr<IUnknown> spUnkMgr;
+
+
+// GUID idOffice= {0x3ECF78F0,0xB149,0x11D2,{0x8E,0xBE,0x00,0x10,0x5A,0xD8,0x48,0xAF}};
+// IUnknown * pUnk;
+// hr= CoCreateInstance( idOffice, NULL, CLSCTX_ALL, __uuidof(IUnknown), (void**) &pUnk);
+
+ if( FAILED(hr= spUnkMgr.CoCreateInstance(L"stardiv.uno.ServiceManager")))
+ return hr;
+
+ return S_OK;
+
+}
diff --git a/extensions/test/ole/cpptest/cpptest.dsp b/extensions/test/ole/cpptest/cpptest.dsp
new file mode 100644
index 000000000..4e0641850
--- /dev/null
+++ b/extensions/test/ole/cpptest/cpptest.dsp
@@ -0,0 +1,113 @@
+# Microsoft Developer Studio Project File - Name="cpptest" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=cpptest - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "cpptest.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "cpptest.mak" CFG="cpptest - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "cpptest - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "cpptest - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "cpptest - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "cpptest - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "cpptest - Win32 Release"
+# Name "cpptest - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\cpptest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.cpp
+# ADD CPP /Yc"stdafx.h"
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\StdAfx.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Source File
+
+SOURCE=.\ReadMe.txt
+# End Source File
+# End Target
+# End Project
diff --git a/extensions/test/ole/cpptest/cpptest.dsw b/extensions/test/ole/cpptest/cpptest.dsw
new file mode 100644
index 000000000..0cea1c2d0
--- /dev/null
+++ b/extensions/test/ole/cpptest/cpptest.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "cpptest"=.\cpptest.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/extensions/test/ole/idl/oletest.idl b/extensions/test/ole/idl/oletest.idl
new file mode 100644
index 000000000..6dc32ab41
--- /dev/null
+++ b/extensions/test/ole/idl/oletest.idl
@@ -0,0 +1,309 @@
+/*************************************************************************
+ *
+ * $RCSfile: oletest.idl,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//#include <stardiv/uno/interface.idl>
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/script/XInvocation.idl>
+//#include <stardiv/uno/beans/propset.idl>
+#include <com/sun/star/beans/XPropertySet.idl>
+
+/*=============================================================================
+
+ $Source: /cvs/Archiv/one/stardiv/one/chart/xcenum.idl,v 1.6 1999/04/26 10:42
+
+ status: proofreading done
+
+ (c) Copyright 1998-1999, Star Office Entwicklungs GmbH, Hamburg
+
+=============================================================================*/
+
+module oletest
+{
+
+[ uik(8DE309C0-8310-11d3-9EEC0050-04526AB4), ident("XTestSequence", 1.0) ]
+interface XTestSequence: com::sun::star::uno::XInterface
+{
+ sequence<byte> methodByte( [in] sequence<byte> aSeq );
+ sequence<float> methodFloat( [in] sequence<float> aSeq);
+ sequence<double> methodDouble( [in] sequence<double> aSeq);
+ sequence<boolean> methodBool( [in] sequence<boolean> aSeq);
+ sequence<short> methodShort( [in] sequence<short> aSeq);
+ sequence<unsigned short> methodUShort( [in] sequence<unsigned short> aSeq);
+ sequence<long> methodLong( [in] sequence<long> aSeq);
+ sequence<unsigned long> methodULong( [in] sequence<unsigned long> aSeq);
+ sequence<string> methodString( [in] sequence<string> aSeq);
+ sequence<char> methodChar( [in] sequence<char> aSeq);
+ sequence<any> methodAny ( [in] sequence<any> aSeq);
+ sequence<com::sun::star::uno::XInterface> methodXInterface ( [in] sequence<com::sun::star::uno::XInterface> aSeq);
+ sequence< sequence <long> > methodSequence( [in] sequence< sequence< long > > aSeq);
+ sequence< sequence <sequence <long> > > methodSequence2( [in] sequence< sequence< sequence<long> > > aSeq);
+
+ [attribute] sequence<byte> AttrByte;
+ [attribute] sequence<float> AttrFloat;
+ [attribute] sequence<double> AttrDouble;
+ [attribute] sequence<boolean> AttrBool;
+ [attribute] sequence<short> AttrShort;
+ [attribute] sequence<unsigned short> AttrUShort;
+ [attribute] sequence<long> AttrLong;
+ [attribute] sequence<unsigned long> AttrULong;
+ [attribute] sequence<string> AttrString;
+ [attribute] sequence<char> AttrChar;
+ [attribute] sequence<any> AttrAny;
+ [attribute] sequence< sequence<long> > AttrSequence;
+ [attribute] sequence< sequence< sequence <long> > > AttrSequence2;
+ [attribute] sequence< com::sun::star::uno::XInterface > AttrXInterface;
+
+ void testout_methodByte( [out] byte rOut );
+ void testout_methodFloat( [out] float rOut);
+ void testout_methodDouble( [out] double rOut);
+ void testout_methodBool( [out] boolean rOut);
+ void testout_methodShort( [out] short rOut);
+ void testout_methodUShort( [out] unsigned short rOut);
+ void testout_methodLong( [out] long rOut);
+ void testout_methodULong( [out] unsigned long rOut);
+ void testout_methodString( [out] string rOut);
+ void testout_methodChar( [out] char rOut);
+ void testout_methodAny ( [out] any rOut);
+ void testout_methodSequence( [out] sequence< long > rOut);
+ void testout_methodSequence2( [out] sequence < sequence< long > > rOut);
+ void testout_methodXInterface( [out] com::sun::star::uno::XInterface rOut);
+
+ void testout_methodMulParams1( [out] long rout1, [out] long rout2);
+ void testout_methodMulParams2( [out] long rout1, [out] long rout2, [out] string rout3);
+ void testout_methodMulParams3( [in] string sin, [out] string sout);
+ void testout_methodMulParams4( [in] float in1, [out] float out1, [in] long in2, [out] long out2, [in] long in3);
+
+ void testinout_methodByte( [inout] byte rOut );
+ void testinout_methodFloat( [inout] float rOut);
+ void testinout_methodDouble( [inout] double rOut);
+ void testinout_methodBool( [inout] boolean rOut);
+ void testinout_methodShort( [inout] short rOut);
+ void testinout_methodUShort( [inout] unsigned short rOut);
+ void testinout_methodLong( [inout] long rOut);
+ void testinout_methodULong( [inout] unsigned long rOut);
+ void testinout_methodString( [inout] string rOut);
+ void testinout_methodChar( [inout] char rOut);
+ void testinout_methodAny ( [inout] any rOut);
+ void testinout_methodSequence( [inout] sequence< long > rOut);
+ void testinout_methodSequence2( [inout] sequence < sequence< long > > rOut);
+ void testinout_methodXInterface( [inout] com::sun::star::script::XInvocation rOut);
+
+ any methodAnyTest1( [in] any rIn);
+ [attribute] any AttrAny2;
+
+};
+[uik(EBEF02B0-8C41-11d3-9EF90050-04526AB4), ident("XTestStruct", 1.0)]
+interface XTestStruct: com::sun::star::uno::XInterface
+{
+// Method taking structs as arguments
+ void methodStruct( [in] com::sun::star::beans::Property aProp);
+// Methods returning structs
+ com::sun::star::beans::Property retMethodStruct();
+// Attributes as structs
+ [attribute] com::sun::star::beans::Property AttrStruct;
+};
+
+[uik(E5087290-95E9-11d3-9F070050-04526AB4), ident("XTestOutParameters", 1.0)]
+interface XTestOutParameters: com::sun::star::uno::XInterface
+{
+ void out_methodByte( [out] byte rOut );
+ void out_methodDouble( [out] double rOut);
+ void out_methodBool( [out] boolean rOut);
+ void out_methodShort( [out] short rOut);
+ void out_methodUShort( [out] unsigned short rOut);
+ void out_methodLong( [out] long rOut);
+ void out_methodULong( [out] unsigned long rOut);
+ void out_methodString( [out] string rOut);
+ void out_methodChar( [out] char rOut);
+ void out_methodAny ( [out] any rOut);
+ void out_methodSequence( [out] sequence< long > rOut);
+ void out_methodSequence2( [out] sequence < sequence< long > > rOut);
+
+ void out_methodMulParams1( [out] long rout1, [out] long rout2);
+ void out_methodMulParams2( [out] long rout1, [out] long rout2, [out] string rout3);
+ void out_methodMulParams3( [in] string sin, [out] string sout);
+
+
+};
+
+struct SimpleStruct
+{
+ string message;
+};
+
+enum SimpleEnum
+{
+ A,
+ B,
+ C
+};
+
+[uik(57F9DDE0-9293-11d3-9F000050-04526AB4), ident("XTestOthers", 1.0)]
+interface XTestOther: com::sun::star::uno::XInterface
+{
+ // Any test
+ void other_methodAnyIn( [in] any rAny);
+ void other_methodAnyOut( [out] any rAny);
+ any other_methodAnyRet();
+ void in_float( [in] float val);
+};
+
+
+[uik(67E59870-6EA4-11d4-832F0050-04526AB4), ident("XSimple", 1.0)]
+interface XSimple: com::sun::star::uno::XInterface
+{
+ void func( [in] string message);
+ string getName();
+};
+[uik(29828AB0-79A0-11d4-83330050-04526AB4), ident("XSimple2", 1.0)]
+interface XSimple2: com::sun::star::uno::XInterface
+{
+ void func2( [in] string message);
+ string getName2();
+};
+[uik(29828AB1-79A0-11d4-83330050-04526AB4), ident("XSimple3", 1.0)]
+interface XSimple3: com::sun::star::uno::XInterface
+{
+ void func3( [in] string message);
+ string getName3();
+};
+
+[uik(4405B9E0-6D39-11d4-832F0050-04526AB4), ident("XTestOthers", 1.0)]
+interface XCallback: com::sun::star::uno::XInterface
+{
+ void func1();
+ oletest::XSimple returnInterface();
+ void outInterface( [out] oletest::XSimple outInterface);
+ void outStruct( [out] oletest::SimpleStruct outStruct);
+ void outEnum( [out] oletest::SimpleEnum outEnum);
+ void outSeqAny( [out] sequence<any> outSeqAny);
+ void outSeqByte( [out] sequence<byte> outVal);
+ void outAny( [out] any outAny);
+ void outBool( [out] boolean outBool);
+ void outChar( [out] char outChar);
+ void outString( [out] string outString);
+ void outFloat( [out] float outFloat);
+ void outDouble( [out] double outDouble);
+ void outByte( [out] byte outByte);
+ void outShort( [out] short outShort);
+ void outLong( [out] long outLong);
+ void outValuesMixed( [in] long lval, [out] long outval, [in] string sval);
+ void outValuesAll( [out] oletest::XSimple outInterface,
+ [out] SimpleStruct outStruct ,
+ [out] SimpleEnum outEnum,
+ [out] sequence<any> outSeqAny,
+ [out] any outAny,
+ [out] boolean outBool,
+ [out] char outChar,
+ [out] string outString,
+ [out] float outFloat,
+ [out] double outDouble,
+ [out] byte outByte,
+ [out] short outShort,
+ [out] long outLong);
+// IN OUT parameters
+ void inoutInterface( [inout] oletest::XSimple inoutVal);
+ void inoutStruct( [inout] oletest::SimpleStruct inoutVal);
+ void inoutEnum( [inout] oletest::SimpleEnum inoutVal);
+ void inoutSeqAny( [inout] sequence<any> inoutVal);
+ void inoutAny( [inout] any inoutVal);
+ void inoutBool( [inout] boolean inoutVal);
+ void inoutChar( [inout] char inoutVal);
+ void inoutString( [inout] string inoutVal);
+ void inoutFloat( [inout] float inoutVal);
+ void inoutDouble( [inout] double inoutVal);
+ void inoutByte( [inout] byte inoutVal);
+ void inoutShort( [inout] short inoutVal);
+ void inoutLong( [inout] long inoutVal);
+
+ void inoutValuesAll( [inout] oletest::XSimple aXSimple,
+ [inout] oletest::SimpleStruct aStruct,
+ [inout] oletest::SimpleEnum aEnum,
+ [inout] sequence<any> aSeq,
+ [inout] any aAny,
+ [inout] boolean aBool,
+ [inout] char aChar,
+ [inout] string aString,
+ [inout] float aFloat,
+ [inout] double aDouble,
+ [inout] byte aByte,
+ [inout] short aShort,
+ [inout] long aLong);
+
+ // IN parameter
+
+ void inValues( [in] char aChar, [in] long aLong, [in] string aString);
+ void inSeqByte( [in] sequence<byte> val);
+
+
+
+};
+
+
+[uik(259159C0-6D38-11d4-832F0050-04526AB4), ident("XTestOthers", 1.0)]
+interface XTestInterfaces: com::sun::star::uno::XInterface
+{
+ // Any test
+ void testInterface( [in] oletest::XCallback xCallback, [in] long mode);
+ void testInterface2( [in] oletest::XSimple xSimple, [in] long mode);
+};
+
+}; // oletest
+
diff --git a/extensions/test/ole/unoTocomCalls/Test/StdAfx.cpp b/extensions/test/ole/unoTocomCalls/Test/StdAfx.cpp
new file mode 100644
index 000000000..3a6809b2b
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/Test/StdAfx.cpp
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * $RCSfile: StdAfx.cpp,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// stdafx.cpp : source file that includes just the standard includes
+// Test.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/extensions/test/ole/unoTocomCalls/Test/StdAfx.h b/extensions/test/ole/unoTocomCalls/Test/StdAfx.h
new file mode 100644
index 000000000..b6705c3e0
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/Test/StdAfx.h
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * $RCSfile: StdAfx.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__180FF568_6F5C_11D4_8330_005004526AB4__INCLUDED_)
+#define AFX_STDAFX_H__180FF568_6F5C_11D4_8330_005004526AB4__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+#include <stdio.h>
+#include <windows.h>
+#include <comdef.h>
+#include <tchar.h>
+#include <atlbase.h>
+extern CComModule _Module;
+#include<atlcom.h>
+#include<atlimpl.cpp>
+
+// TODO: reference additional headers your program requires here
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__180FF568_6F5C_11D4_8330_005004526AB4__INCLUDED_)
diff --git a/extensions/test/ole/unoTocomCalls/Test/Test.cpp b/extensions/test/ole/unoTocomCalls/Test/Test.cpp
new file mode 100644
index 000000000..927d02330
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/Test/Test.cpp
@@ -0,0 +1,277 @@
+/*************************************************************************
+ *
+ * $RCSfile: Test.cpp,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// Test.cpp : Defines the entry point for the console application.
+//
+
+#include "stdafx.h"
+#include "../XCallback_Impl/XCallback_Impl.h"
+#include "../XCallback_Impl/XCallback_Impl_i.c"
+
+CComModule _Module;
+BEGIN_OBJECT_MAP(ObjectMap)
+END_OBJECT_MAP()
+
+HRESULT doTest();
+
+int main(int argc, char* argv[])
+{
+ HRESULT hr;
+ if( FAILED( hr=CoInitialize(NULL)))
+ {
+ _tprintf(_T("CoInitialize failed \n"));
+ return -1;
+ }
+
+
+ _Module.Init( ObjectMap, GetModuleHandle( NULL));
+
+ if( FAILED(hr=doTest()))
+ {
+ _com_error err( hr);
+ const TCHAR * errMsg= err.ErrorMessage();
+ MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR);
+ }
+
+
+ _Module.Term();
+ CoUninitialize();
+
+
+ return 0;
+}
+
+
+HRESULT doTest()
+{
+ HRESULT hr= S_OK;
+
+ CComPtr<IUnknown> spUnk;
+ hr= spUnk.CoCreateInstance(L"com.sun.star.ServiceManager");
+ if( FAILED( hr))
+ return hr;
+
+ CComDispatchDriver manager( spUnk);
+ CComVariant param( L"oletest.OleTest");
+ CComVariant retVal;
+ hr= manager.Invoke1((LPCOLESTR)L"createInstance", &param, &retVal );
+
+ CComDispatchDriver oletest( retVal.punkVal);
+
+ spUnk.Release();
+
+ hr= spUnk.CoCreateInstance(L"XCallback_Impl.Callback");
+ if( FAILED( hr))
+ return hr;
+
+ CComQIPtr<IDispatch> paramDisp(spUnk);
+
+
+ //######################################################################
+ // out parameters
+ //######################################################################
+ CComVariant param1( paramDisp);
+ CComVariant param2(1);
+ // oletest calls XCallback::func1
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::returnInterface
+ param2= 2;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outInterface
+ param2= 3;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outStruct
+ param2= 4;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outEnum
+ param2= 5;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outSeqAny
+ param2= 6;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outAny
+ param2= 7;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outBool
+ param2= 8;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outChar
+ param2= 9;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outString
+ param2= 10;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outFloat
+ param2= 11;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outDouble
+ param2= 12;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outByte
+ param2= 13;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outShort
+ param2= 14;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outLong
+ param2= 15;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outValuesMixed
+ param2= 30;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::outValuesAll
+ param2= 31;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+
+ // XCallback::outSeqByte
+ // Does not work currently because Sequences are always converted to
+ // SAFEARRAY( VARIANT)
+ // param2= 32;
+ // hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+
+ //######################################################################
+ // in / out parameters
+ //######################################################################
+ // XCallback::inoutInterface
+ param2= 100;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutStruct
+ param2= 101;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutEnum
+ param2= 102;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutSeqAny
+ param2= 103;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutAny
+ param2= 104;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutBool
+ param2= 105;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutChar
+ param2= 106;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutString
+ param2= 107;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutFloat
+ param2= 108;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutDouble
+ param2= 109;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutByte
+ param2= 110;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutShort
+ param2= 111;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutLong
+ param2= 112;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutValuesAll
+ param2=120;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ //######################################################################
+ // in parameters
+ //######################################################################
+ // XCallback::inValues
+ param2= 200;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inSeqByte
+ // Does not work currently because Sequences are always converted to
+ // SAFEARRAY( VARIANT)
+ // param2= 201;
+ // hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+
+ //######################################################################
+ // The UNO test component OleTest calls on XCallback_Impl.Callback directly
+ // that is the COM object has not been past a parameter but rather OleTest
+ // creates the COM object itself
+ //######################################################################
+ // XCallback::outValuesAll
+ // does not work currently
+ param2= 300;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutValuesAll
+ param2= 301;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ // XCallback::inoutValues
+ param2= 302;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+
+ // XCallback::inValues
+ param2= 303;
+ hr= oletest.Invoke2(L"testInterface", &param1, &param2);
+ //######################################################################
+ // Test a COM object which implements several interfaces.
+ //######################################################################
+
+ CComQIPtr<IDispatch> dispSimple;
+ hr= dispSimple.CoCreateInstance(L"XCallback_Impl.Simple");
+ CComVariant varSimple( dispSimple);
+ param2= 0;
+ hr= oletest.Invoke2(L"testInterface2", &varSimple, &param2);
+
+ return hr;
+}
+// VARIANT CComVariant VT_UNKNOWN VT_DISPATCH V_UI1 CComDispatchDriver WINAPI
diff --git a/extensions/test/ole/unoTocomCalls/Test/Test.dsp b/extensions/test/ole/unoTocomCalls/Test/Test.dsp
new file mode 100644
index 000000000..9572411e4
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/Test/Test.dsp
@@ -0,0 +1,113 @@
+# Microsoft Developer Studio Project File - Name="Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Test - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Test.mak" CFG="Test - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "Test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "Test - Win32 Release"
+# Name "Test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\StdAfx.cpp
+# ADD CPP /Yc"stdafx.h"
+# End Source File
+# Begin Source File
+
+SOURCE=.\Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\StdAfx.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Source File
+
+SOURCE=.\ReadMe.txt
+# End Source File
+# End Target
+# End Project
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Basic.rgs b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Basic.rgs
new file mode 100644
index 000000000..39011d717
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Basic.rgs
@@ -0,0 +1,26 @@
+HKCR
+{
+ XCallback_Impl.Basic.1 = s 'Basic Class'
+ {
+ CLSID = s '{A0F04CB7-8494-11D4-8335-005004526AB4}'
+ }
+ XCallback_Impl.Basic = s 'Basic Class'
+ {
+ CLSID = s '{A0F04CB7-8494-11D4-8335-005004526AB4}'
+ CurVer = s 'XCallback_Impl.Basic.1'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {A0F04CB7-8494-11D4-8335-005004526AB4} = s 'Basic Class'
+ {
+ ProgID = s 'XCallback_Impl.Basic.1'
+ VersionIndependentProgID = s 'XCallback_Impl.Basic'
+ ForceRemove 'Programmable'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Apartment'
+ }
+ 'TypeLib' = s '{180FF553-6F5C-11D4-8330-005004526AB4}'
+ }
+ }
+}
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/BasicTest.rgs b/extensions/test/ole/unoTocomCalls/XCallback_Impl/BasicTest.rgs
new file mode 100644
index 000000000..e318d41ee
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/BasicTest.rgs
@@ -0,0 +1,26 @@
+HKCR
+{
+ XCallback_Impl.BasicTest.1 = s 'BasicTest Class'
+ {
+ CLSID = s '{A0F04CBD-8494-11D4-8335-005004526AB4}'
+ }
+ XCallback_Impl.BasicTest = s 'BasicTest Class'
+ {
+ CLSID = s '{A0F04CBD-8494-11D4-8335-005004526AB4}'
+ CurVer = s 'XCallback_Impl.BasicTest.1'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {A0F04CBD-8494-11D4-8335-005004526AB4} = s 'BasicTest Class'
+ {
+ ProgID = s 'XCallback_Impl.BasicTest.1'
+ VersionIndependentProgID = s 'XCallback_Impl.BasicTest'
+ ForceRemove 'Programmable'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Apartment'
+ }
+ 'TypeLib' = s '{180FF553-6F5C-11D4-8330-005004526AB4}'
+ }
+ }
+}
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.cpp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.cpp
new file mode 100644
index 000000000..484c0074a
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.cpp
@@ -0,0 +1,517 @@
+/*************************************************************************
+ *
+ * $RCSfile: Callback.cpp,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// Callback.cpp : Implementation of CCallback
+#include "stdafx.h"
+#include "XCallback_Impl.h"
+#include "Callback.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CCallback
+
+
+STDMETHODIMP CCallback::func1()
+{
+ MessageBox( NULL, _T("Callback::func1 called"),_T(""), MB_OK);
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::returnInterface(IDispatch **ppdisp)
+{
+ if( ! ppdisp)
+ return E_POINTER;
+ CComPtr<IDispatch> spDisp;
+ spDisp.CoCreateInstance( L"XCallback_Impl.Simple");
+ *ppdisp= spDisp;
+ (*ppdisp)->AddRef();
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::outInterface(IDispatch **ppdisp)
+{
+// return S_OK;
+ if( ! ppdisp)
+ return E_POINTER;
+ CComPtr<IDispatch> spDisp;
+ spDisp.CoCreateInstance( L"XCallback_Impl.Simple");
+ *ppdisp= spDisp;
+ (*ppdisp)->AddRef();
+
+// MessageBox( NULL, _T("CCallback::outInterface"), _T(""), MB_OK);
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::outValuesMixed(long val, long *pval, BSTR string)
+{
+
+ TCHAR buff[1024];
+ *pval = val+1;
+ wsprintf( buff, _T("param1: %d, param2 out: %d, param3: %s"), val, *pval, string);
+ MessageBox( NULL, buff, _T(""), MB_OK);
+ return S_OK;
+}
+
+
+STDMETHODIMP CCallback::outValuesAll(
+ /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdisp,
+ /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppSimpleStruct,
+ /* [out] */ long __RPC_FAR *aSimpleEnum,
+ /* [out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *outSeq,
+ /* [out] */ VARIANT __RPC_FAR *varAny,
+ /* [out] */ VARIANT_BOOL __RPC_FAR *aBool,
+ /* [out] */ short __RPC_FAR *aChar,
+ /* [out] */ BSTR __RPC_FAR *aString,
+ /* [out] */ float __RPC_FAR *aFloat,
+ /* [out] */ double __RPC_FAR *aDouble,
+ /* [out] */ unsigned char __RPC_FAR *aByte,
+ /* [out] */ short __RPC_FAR *aShort,
+ /* [out] */ long __RPC_FAR *aLong)
+//)
+{
+// if( ! ppdisp || ! ppSimpleStruct || ! aSimpleEnum ||
+// ! outSeq || !varAny ||! aBool || ! aChar ||
+// ! aString || ! aFloat || ! aDouble || ! aByte ||
+// ! aShort || ! aLong || ! aUShort || ! aULong)
+// return E_POINTER;
+
+ HRESULT hr=S_OK;
+ hr= outInterface( ppdisp);
+ hr= outStruct( ppSimpleStruct);
+ hr= outEnum( aSimpleEnum);
+ hr= outSeqAny( outSeq);
+ hr= outAny( varAny);
+ hr= outBool( aBool);
+ hr= outChar( aChar);
+ hr= outString( aString);
+ hr= outFloat( aFloat);
+ hr= outDouble( aDouble);
+ hr= outByte( aByte);
+ hr= outShort( aShort);
+ hr= outLong( aLong);
+ return hr;
+}
+
+STDMETHODIMP CCallback::outStruct(IDispatch **outStruct)
+{
+// return S_OK;
+ if( !outStruct)
+ return E_POINTER;
+ HRESULT hr= E_FAIL;
+// MessageBox( NULL, _T("CCallback::outStruct"), _T(""), MB_OK);
+
+ CComPtr<IDispatch> _dispMgr;
+ if( SUCCEEDED(hr= _dispMgr.CoCreateInstance(L"com.sun.star.ServiceManager")))
+ {
+ CComDispatchDriver manager( _dispMgr);
+ CComVariant param1(L"com.sun.star.reflection.CoreReflection");
+ CComVariant varRet;
+ hr= manager.Invoke1( L"createInstance", &param1, &varRet);
+
+ CComDispatchDriver reflection( varRet.pdispVal);
+ param1= L"oletest.SimpleStruct";
+ varRet.Clear();
+ hr= reflection.Invoke1( L"forName", &param1, &varRet);
+
+ CComDispatchDriver classSimpleStruct( varRet.pdispVal);
+
+ CComPtr<IDispatch> dispStruct;
+ param1.vt= VT_DISPATCH | VT_BYREF;
+ param1.ppdispVal= &dispStruct;
+ if( SUCCEEDED( hr= classSimpleStruct.Invoke1(L"createObject", &param1)))
+ {
+ // Set the value
+ CComDispatchDriver simpleStruct( dispStruct);
+ param1=L" this is a property string";
+ hr= simpleStruct.PutPropertyByName(L"message", &param1);
+ *outStruct= dispStruct;
+ (*outStruct)->AddRef();
+ hr= S_OK;
+ }
+ }
+ return hr;
+}
+
+STDMETHODIMP CCallback::outEnum(long *outEnum)
+{
+ if( !outEnum)
+ return E_POINTER;
+ *outEnum= 1;
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::outSeqAny(LPSAFEARRAY* outSeq)
+{
+// _CrtDbgBreak();
+ SAFEARRAY* pArr= SafeArrayCreateVector( VT_VARIANT, 0, 3);
+ CComVariant var[3];
+ var[0]=L" variant 0";
+ var[1]=L" variant 1";
+ var[2]=L"variant 2";
+ for( long i=0; i<3; i++)
+ {
+ SafeArrayPutElement( pArr, &i, (void*)&var[i]);
+ }
+
+ *outSeq= pArr;
+ return S_OK;
+}
+
+// ATLASSERT //VT_EMPTY
+
+
+STDMETHODIMP CCallback::outAny(VARIANT *outAny)
+{
+ if( ! outAny)
+ return E_POINTER;
+ outAny->vt= VT_BSTR;
+ outAny->bstrVal= SysAllocString( L"This is a string in a VARIANT");
+
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::outBool(VARIANT_BOOL *outBool)
+{
+ if( ! outBool)
+ return E_POINTER;
+ *outBool= VARIANT_TRUE;
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::outChar(short *outChar)
+{
+ if( !outChar)
+ return E_POINTER;
+ *outChar= (short)L'A';
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::outString(BSTR *outString)
+{
+ if( !outString)
+ return E_POINTER;
+ *outString= SysAllocString(L"This is a BSTR");
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::outFloat(float *outFloat)
+{
+ if( !outFloat)
+ return E_POINTER;
+ *outFloat= 3.14;
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::outDouble(double *outDouble)
+{
+ if(!outDouble)
+ return E_POINTER;
+
+ *outDouble= 3.145;
+ return S_OK;
+}
+
+
+
+STDMETHODIMP CCallback::outShort(short *outShort)
+{
+ if(!outShort)
+ return E_POINTER;
+ *outShort= 0xffff;
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::outLong(long *outLong)
+{
+ if(!outLong)
+ return E_POINTER;
+ *outLong= 0xffffffff;
+ return S_OK;
+}
+
+
+
+STDMETHODIMP CCallback::outByte(unsigned char* outByte)
+{
+ if(!outByte)
+ return E_POINTER;
+ *outByte= 0xff;
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inoutInterface(IDispatch **ppdisp)
+{
+ if( !ppdisp)
+ return E_POINTER;
+ CComDispatchDriver disp( *ppdisp);
+ CComVariant param1(L"");
+ disp.Invoke1(L"func", &param1);
+
+ (*ppdisp)->Release();
+
+ CComPtr<IDispatch> outDisp;
+ outDisp.CoCreateInstance( L"XCallback_Impl.Simple");
+ *ppdisp= outDisp;
+ (*ppdisp)->AddRef();
+
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inoutStruct(IDispatch **inoutVal)
+{
+ if( !inoutVal)
+ return E_POINTER;
+ HRESULT hr= S_OK;
+ USES_CONVERSION;
+ CComVariant var;
+ CComDispatchDriver disp( *inoutVal);
+
+ hr= disp.GetPropertyByName(L"message", &var);
+ MessageBox( NULL, W2T(var.bstrVal), _T("XCallback_Impl.Callback"), MB_OK);
+
+ (*inoutVal)->Release();
+
+ CComDispatchDriver dispStruct;
+ hr= outStruct( &dispStruct.p);
+ var.Clear();
+ var= L"This struct was created in XCallback_Imp.Callback";
+ hr= dispStruct.PutPropertyByName(L"message", &var);
+
+ *inoutVal= dispStruct;
+ (*inoutVal)->AddRef();
+ return hr;
+}
+
+STDMETHODIMP CCallback::inoutEnum(long *inoutVal)
+{
+ if( !inoutVal)
+ return E_POINTER;
+ *inoutVal= *inoutVal+1;
+
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inoutSeqAny(LPSAFEARRAY *pArray)
+{
+ if( !pArray)
+ return E_POINTER;
+ HRESULT hr= S_OK;
+ long lbound=0;
+ long ubound=0;
+ hr= SafeArrayGetLBound( *pArray, 1, &lbound);
+ hr= SafeArrayGetUBound( *pArray, 1, &ubound);
+ long count= ubound - lbound + 1;
+
+ // the Array is supposet to contain variants
+ CComVariant var;
+ for( long i=0; i<count; i++)
+ {
+ var.Clear();
+ hr= SafeArrayGetElement( *pArray, &i, (void*)&var);
+ }
+
+ SafeArrayDestroy( *pArray);
+
+ outSeqAny( pArray);
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inoutAny(VARIANT *inoutVal)
+{
+ if( !inoutVal)
+ return E_POINTER;
+ USES_CONVERSION;
+ if( inoutVal->vt= VT_BSTR)
+ MessageBox( NULL, W2T( inoutVal->bstrVal), _T("XCallback_Impl.Callback"), MB_OK);
+
+ VariantClear( inoutVal);
+ inoutVal->vt= VT_BSTR;
+ inoutVal->bstrVal=SysAllocString( L" [string] XCallback_Impl.Callback inoutAny");
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inoutBool(VARIANT_BOOL *inoutVal)
+{
+ if( !inoutVal)
+ return E_POINTER;
+
+ *inoutVal= *inoutVal == VARIANT_TRUE ? VARIANT_FALSE : VARIANT_TRUE;
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inoutChar(short *inoutVal)
+{
+ if( !inoutVal)
+ return E_POINTER;
+ USES_CONVERSION;
+ char buff[256];
+ sprintf( buff, "character value: %C", *inoutVal);
+ MessageBox( NULL, A2T(buff), _T("XCallback_Impl.Callback"), MB_OK);
+ *inoutVal= L'B';
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inoutString(BSTR *inoutVal)
+{
+ if( !inoutVal)
+ return E_POINTER;
+ USES_CONVERSION;
+ MessageBox( NULL, W2T(*inoutVal), _T("XCallback_Impl.Callback"), MB_OK);
+ SysFreeString(*inoutVal);
+ *inoutVal= SysAllocString(L"a string from XCallback_Impl.Callback");
+
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inoutFloat(float *inoutVal)
+{
+ if( !inoutVal)
+ return E_POINTER;
+ *inoutVal = *inoutVal+1;
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inoutDouble(double *inoutVal)
+{
+ if( !inoutVal)
+ return E_POINTER;
+ *inoutVal= *inoutVal+1;
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inoutByte(unsigned char *inoutVal)
+{
+ if( !inoutVal)
+ return E_POINTER;
+ *inoutVal= 0xff;
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inoutShort(short *inoutVal)
+{
+ if( !inoutVal)
+ return E_POINTER;
+ *inoutVal= 0xffff;
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inoutLong(long* inoutVal)
+{
+ if( !inoutVal)
+ return E_POINTER;
+ *inoutVal= 0xffffffff;
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inoutValuesAll(
+ /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *aXSimple,
+ /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *aStruct,
+ /* [out][in] */ long __RPC_FAR *aEnum,
+ /* [out][in] */ SAFEARRAY __RPC_FAR * __RPC_FAR *aSeq,
+ /* [out][in] */ VARIANT __RPC_FAR *aAny,
+ /* [out][in] */ VARIANT_BOOL __RPC_FAR *aBool,
+ /* [out][in] */ short __RPC_FAR *aChar,
+ /* [out][in] */ BSTR __RPC_FAR *aString,
+ /* [out][in] */ float __RPC_FAR *aFloat,
+ /* [out][in] */ double __RPC_FAR *aDouble,
+ /* [out][in] */ unsigned char __RPC_FAR *aByte,
+ /* [out][in] */ short __RPC_FAR *aShort,
+ /* [out][in] */ long __RPC_FAR *aLong)
+{
+ inoutInterface( aXSimple);
+ inoutStruct( aStruct);
+ inoutEnum( aEnum);
+ inoutSeqAny( aSeq);
+ inoutAny( aAny);
+ inoutBool( aBool);
+ inoutChar( aChar);
+ inoutString( aString);
+ inoutFloat( aFloat);
+ inoutDouble( aDouble);
+ inoutByte( aByte);
+ inoutShort( aShort);
+ inoutLong( aLong);
+
+ return S_OK;
+}
+
+
+STDMETHODIMP CCallback::inValues(short aChar, long aLong, BSTR aString)
+{
+ USES_CONVERSION;
+ wchar_t _char= (wchar_t) aChar;
+ char buff[1024];
+ sprintf( buff, "Parameters: char= %C, long= %d, string= %s", _char, aLong, W2A(aString));
+ MessageBox( NULL, A2T(buff), _T("XCallback_Impl.Callback"), MB_OK);
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::outSeqByte(LPSAFEARRAY * outVal)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
+
+STDMETHODIMP CCallback::inSeqByte( LPSAFEARRAY val)
+{
+ // TODO: Add your implementation code here
+
+ return S_OK;
+}
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h
new file mode 100644
index 000000000..4a9bf025d
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.h
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * $RCSfile: Callback.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// Callback.h : Declaration of the CCallback
+
+#ifndef __CALLBACK_H_
+#define __CALLBACK_H_
+
+#include "resource.h" // main symbols
+
+/////////////////////////////////////////////////////////////////////////////
+// CCallback
+class ATL_NO_VTABLE CCallback :
+ public CComObjectRootEx<CComSingleThreadModel>,
+ public CComCoClass<CCallback, &CLSID_Callback>,
+ public IDispatchImpl<ICallback, &IID_ICallback, &LIBID_XCALLBACK_IMPLLib>
+{
+public:
+ CCallback()
+ {
+ }
+
+DECLARE_REGISTRY_RESOURCEID(IDR_CALLBACK)
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+BEGIN_COM_MAP(CCallback)
+ COM_INTERFACE_ENTRY(ICallback)
+ COM_INTERFACE_ENTRY(IDispatch)
+END_COM_MAP()
+
+// ICallback
+public:
+ STDMETHOD(inSeqByte)(/*[in]*/ LPSAFEARRAY val);
+ STDMETHOD(outSeqByte)(/*[out]*/ LPSAFEARRAY* outVal);
+ STDMETHOD(inValues)(/*[in]*/short aChar, /*[in]*/ long aLong, /*[in]*/ BSTR aString);
+ STDMETHOD(inoutLong)(/*[in,out]*/ long* inoutVal);
+ STDMETHOD(inoutShort)(/*[in,out]*/ short* inoutVal);
+ STDMETHOD(inoutByte)(/*[in,out]*/ unsigned char* inoutVal);
+ STDMETHOD(inoutDouble)(/*[in,out]*/ double* inoutVal);
+ STDMETHOD(inoutFloat)(/*[in,out]*/ float* inoutVal);
+ STDMETHOD(inoutString)(/*[in,out]*/ BSTR *inoutVal);
+ STDMETHOD(inoutChar)(/*[in,out]*/ short* inoutVal);
+ STDMETHOD(inoutBool)(/*[in,out]*/ VARIANT_BOOL * inoutVal);
+ STDMETHOD(inoutAny)(/*[in,out]*/ VARIANT* inoutVal);
+ STDMETHOD(inoutSeqAny)(/*[in,out]*/ LPSAFEARRAY* pArray);
+ STDMETHOD(inoutEnum)(/*[in,out]*/ long * inoutVal);
+ STDMETHOD(inoutStruct)(/*[in,out]*/ IDispatch** inoutVal);
+ STDMETHOD(inoutInterface)(/*[in,out]*/ IDispatch** ppdisp);
+ STDMETHOD(inoutValuesAll)(
+ /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *aXSimple,
+ /* [out][in] */ IDispatch __RPC_FAR *__RPC_FAR *aStruct,
+ /* [out][in] */ long __RPC_FAR *aEnum,
+ /* [out][in] */ SAFEARRAY __RPC_FAR * __RPC_FAR *aSeq,
+ /* [out][in] */ VARIANT __RPC_FAR *aAny,
+ /* [out][in] */ VARIANT_BOOL __RPC_FAR *aBool,
+ /* [out][in] */ short __RPC_FAR *aChar,
+ /* [out][in] */ BSTR __RPC_FAR *aString,
+ /* [out][in] */ float __RPC_FAR *aFloat,
+ /* [out][in] */ double __RPC_FAR *aDouble,
+ /* [out][in] */ unsigned char __RPC_FAR *aByte,
+ /* [out][in] */ short __RPC_FAR *aShort,
+ /* [out][in] */ long __RPC_FAR *aLong);
+
+ STDMETHOD(outByte)( unsigned char* outByte);
+ STDMETHOD(outLong)(/*[out]*/ long* outLong);
+ STDMETHOD(outShort)(/*[out]*/ short *outShort);
+ STDMETHOD(outDouble)(/*[out]*/ double* outDouble);
+ STDMETHOD(outFloat)(/*[out]*/ float* outFloat);
+ STDMETHOD(outString)(/*[out]*/ BSTR * outString);
+ STDMETHOD(outChar)(short* outChar);
+ STDMETHOD(outBool)(VARIANT_BOOL* outBool);
+ STDMETHOD(outAny)(VARIANT* outAny);
+ STDMETHOD(outSeqAny)(/*[out]*/LPSAFEARRAY* outSeq);
+ STDMETHOD(outEnum)(/*[out]*/ long* outEnum);
+ STDMETHOD(outStruct)(/*[out]*/ IDispatch** outStruct);
+ virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE outValuesAll(
+ /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdisp,
+ /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppSimpleStruct,
+ /* [out] */ long __RPC_FAR *aSimpleEnum,
+ /* [out] */ LPSAFEARRAY* outSeq,
+ /* [out] */ VARIANT __RPC_FAR *varAny,
+ /* [out] */ VARIANT_BOOL __RPC_FAR *aBool,
+ /* [out] */ short __RPC_FAR *aChar,
+ /* [out] */ BSTR __RPC_FAR *aString,
+ /* [out] */ float __RPC_FAR *aFloat,
+ /* [out] */ double __RPC_FAR *aDouble,
+ /* [out] */ unsigned char __RPC_FAR *aByte,
+ /* [out] */ short __RPC_FAR *aShort,
+ /* [out] */ long __RPC_FAR *aLong);
+// );
+//
+// STDMETHOD(outValuesAll)(
+// /*[out]*/ IDispatch** ppdisp,
+// /*[out]*/ IUnknown** ppSimpleStruct,
+// /*[out]*/ long* aSimpleEnum,
+// /*[out]*/ VARIANT* ArrayAny,
+// /*[out]*/ VARIANT* varAny,
+// /*[out]*/ VARIANT_BOOL * aBool,
+// /*[out]*/ unsigned short* aChar,
+// /*[out]*/ BSTR* aString, /*[out]*/ float* aFloat,
+// /*[out]*/ double* aDouble,
+// /*[out]*/ signed char* aByte, /*[out]*/ short* aShort, /*[out]*/long* aLong, /*[out]*/ unsigned short* aUShort, /*[out]*/ unsigned long* aULong);
+ STDMETHOD(outValuesMixed)(/*[in]*/ long val, /*[out]*/ long* pval, /*[in]*/ BSTR string);
+ STDMETHOD(outInterface)(/*[out]*/ IDispatch** ppdisp);
+ STDMETHOD(returnInterface)(/*[out, retval]*/ IDispatch** ppdisp);
+ STDMETHOD(func1)();
+};
+
+#endif //__CALLBACK_H_
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.rgs b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.rgs
new file mode 100644
index 000000000..357c2946b
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Callback.rgs
@@ -0,0 +1,26 @@
+HKCR
+{
+ XCallback_Impl.Callback.1 = s 'Callback Class'
+ {
+ CLSID = s '{180FF560-6F5C-11D4-8330-005004526AB4}'
+ }
+ XCallback_Impl.Callback = s 'Callback Class'
+ {
+ CLSID = s '{180FF560-6F5C-11D4-8330-005004526AB4}'
+ CurVer = s 'XCallback_Impl.Callback.1'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {180FF560-6F5C-11D4-8330-005004526AB4} = s 'Callback Class'
+ {
+ ProgID = s 'XCallback_Impl.Callback.1'
+ VersionIndependentProgID = s 'XCallback_Impl.Callback'
+ ForceRemove 'Programmable'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Apartment'
+ }
+ 'TypeLib' = s '{180FF553-6F5C-11D4-8330-005004526AB4}'
+ }
+ }
+}
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.cpp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.cpp
new file mode 100644
index 000000000..f848c7982
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.cpp
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * $RCSfile: Simple.cpp,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// Simple.cpp : Implementation of CSimple
+#include "stdafx.h"
+#include "XCallback_Impl.h"
+#include "Simple.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CSimple
+
+
+STDMETHODIMP CSimple::func(BSTR message)
+{
+ USES_CONVERSION;
+ MessageBox( NULL, W2T( message), _T("XCallback_Impl.Simple"), MB_OK);
+ return S_OK;
+}
+
+
+STDMETHODIMP CSimple::func2(BSTR message)
+{
+ USES_CONVERSION;
+ MessageBox( NULL, W2T( message), _T("XCallback_Impl.Simple"), MB_OK);
+ return S_OK;
+}
+
+STDMETHODIMP CSimple::func3(BSTR message)
+{
+ USES_CONVERSION;
+ MessageBox( NULL, W2T( message), _T("XCallback_Impl.Simple"), MB_OK);
+ return S_OK;
+}
+
+
+STDMETHODIMP CSimple::get__implementedInterfaces(LPSAFEARRAY *pVal)
+{
+ HRESULT hr= S_OK;
+ SAFEARRAY *pArr= SafeArrayCreateVector( VT_BSTR, 0, 3);
+ if( pArr)
+ { long index=0;
+ BSTR name1= SysAllocString(L"oletest.XSimple");
+ BSTR name2= SysAllocString(L"oletest.XSimple2");
+ BSTR name3= SysAllocString(L"oletest.XSimple3");
+
+ hr= SafeArrayPutElement( pArr, & index, name1);
+ index++;
+ hr= SafeArrayPutElement( pArr, &index, name2);
+ index++;
+ hr= SafeArrayPutElement( pArr, &index, name3);
+ *pVal= pArr;
+
+ }
+ *pVal= pArr;
+ return S_OK;
+}
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h
new file mode 100644
index 000000000..8b6a632e6
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.h
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * $RCSfile: Simple.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// Simple.h : Declaration of the CSimple
+
+#ifndef __SIMPLE_H_
+#define __SIMPLE_H_
+
+#include "resource.h" // main symbols
+
+/////////////////////////////////////////////////////////////////////////////
+// CSimple
+class ATL_NO_VTABLE CSimple :
+ public CComObjectRootEx<CComSingleThreadModel>,
+ public CComCoClass<CSimple, &CLSID_Simple>,
+ public IDispatchImpl<ISimple, &IID_ISimple, &LIBID_XCALLBACK_IMPLLib>
+{
+public:
+ CSimple()
+ {
+ }
+
+DECLARE_REGISTRY_RESOURCEID(IDR_SIMPLE)
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+BEGIN_COM_MAP(CSimple)
+ COM_INTERFACE_ENTRY(ISimple)
+ COM_INTERFACE_ENTRY(IDispatch)
+END_COM_MAP()
+
+// ISimple
+public:
+
+ STDMETHOD(get__implementedInterfaces)(/*[out, retval]*/ LPSAFEARRAY *pVal);
+ STDMETHOD(func3)(/*[in]*/ BSTR message);
+ STDMETHOD(func2)(/*[in]*/ BSTR message);
+ STDMETHOD(func)( BSTR message);
+};
+
+#endif //__SIMPLE_H_
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.rgs b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.rgs
new file mode 100644
index 000000000..9d5edbb2d
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/Simple.rgs
@@ -0,0 +1,26 @@
+HKCR
+{
+ XCallback_Impl.Simple.1 = s 'Simple Class'
+ {
+ CLSID = s '{180FF565-6F5C-11D4-8330-005004526AB4}'
+ }
+ XCallback_Impl.Simple = s 'Simple Class'
+ {
+ CLSID = s '{180FF565-6F5C-11D4-8330-005004526AB4}'
+ CurVer = s 'XCallback_Impl.Simple.1'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {180FF565-6F5C-11D4-8330-005004526AB4} = s 'Simple Class'
+ {
+ ProgID = s 'XCallback_Impl.Simple.1'
+ VersionIndependentProgID = s 'XCallback_Impl.Simple'
+ ForceRemove 'Programmable'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Apartment'
+ }
+ 'TypeLib' = s '{180FF553-6F5C-11D4-8330-005004526AB4}'
+ }
+ }
+}
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.cpp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.cpp
new file mode 100644
index 000000000..dc198a3b3
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.cpp
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * $RCSfile: StdAfx.cpp,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// stdafx.cpp : source file that includes just the standard includes
+// stdafx.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+#ifdef _ATL_STATIC_REGISTRY
+#include <statreg.h>
+#include <statreg.cpp>
+#endif
+
+#include <atlimpl.cpp>
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.h
new file mode 100644
index 000000000..7d6946580
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/StdAfx.h
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * $RCSfile: StdAfx.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#if !defined(AFX_STDAFX_H__180FF556_6F5C_11D4_8330_005004526AB4__INCLUDED_)
+#define AFX_STDAFX_H__180FF556_6F5C_11D4_8330_005004526AB4__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define STRICT
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0400
+#endif
+#define _ATL_APARTMENT_THREADED
+
+#include <stdio.h>
+#include <atlbase.h>
+//You may derive a class from CComModule and use it if you want to override
+//something, but do not change the name of _Module
+extern CComModule _Module;
+#include <atlcom.h>
+#include <stdio.h>
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__180FF556_6F5C_11D4_8330_005004526AB4__INCLUDED)
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp
new file mode 100644
index 000000000..4b02a1652
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * $RCSfile: XCallback_Impl.cpp,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// XCallback_Impl.cpp : Implementation of DLL Exports.
+
+
+// Note: Proxy/Stub Information
+// To build a separate proxy/stub DLL,
+// run nmake -f XCallback_Implps.mk in the project directory.
+
+#include "stdafx.h"
+#include "resource.h"
+#include <initguid.h>
+#include "XCallback_Impl.h"
+
+#include "XCallback_Impl_i.c"
+#include "Callback.h"
+#include "Simple.h"
+
+
+CComModule _Module;
+
+BEGIN_OBJECT_MAP(ObjectMap)
+OBJECT_ENTRY(CLSID_Callback, CCallback)
+OBJECT_ENTRY(CLSID_Simple, CSimple)
+END_OBJECT_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// DLL Entry Point
+
+extern "C"
+BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
+{
+ if (dwReason == DLL_PROCESS_ATTACH)
+ {
+ _Module.Init(ObjectMap, hInstance, &LIBID_XCALLBACK_IMPLLib);
+ DisableThreadLibraryCalls(hInstance);
+ }
+ else if (dwReason == DLL_PROCESS_DETACH)
+ _Module.Term();
+ return TRUE; // ok
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Used to determine whether the DLL can be unloaded by OLE
+
+STDAPI DllCanUnloadNow(void)
+{
+ return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Returns a class factory to create an object of the requested type
+
+STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
+{
+ return _Module.GetClassObject(rclsid, riid, ppv);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// DllRegisterServer - Adds entries to the system registry
+
+STDAPI DllRegisterServer(void)
+{
+ // registers object, typelib and all interfaces in typelib
+ return _Module.RegisterServer(TRUE);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// DllUnregisterServer - Removes entries from the system registry
+
+STDAPI DllUnregisterServer(void)
+{
+ return _Module.UnregisterServer(TRUE);
+}
+
+
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.dsp b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.dsp
new file mode 100644
index 000000000..871b32942
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.dsp
@@ -0,0 +1,335 @@
+# Microsoft Developer Studio Project File - Name="XCallback_Impl" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=XCallback_Impl - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "XCallback_Impl.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "XCallback_Impl.mak" CFG="XCallback_Impl - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "XCallback_Impl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "XCallback_Impl - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "XCallback_Impl - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "XCallback_Impl - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "XCallback_Impl - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "XCallback_Impl - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "XCallback_Impl - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /ZI /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# Begin Custom Build - Performing registration
+OutDir=.\Debug
+TargetPath=.\Debug\XCallback_Impl.dll
+InputPath=.\Debug\XCallback_Impl.dll
+SOURCE="$(InputPath)"
+
+"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ regsvr32 /s /c "$(TargetPath)"
+ echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Unicode Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "DebugU"
+# PROP BASE Intermediate_Dir "DebugU"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "DebugU"
+# PROP Intermediate_Dir "DebugU"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
+# Begin Custom Build - Performing registration
+OutDir=.\DebugU
+TargetPath=.\DebugU\XCallback_Impl.dll
+InputPath=.\DebugU\XCallback_Impl.dll
+SOURCE="$(InputPath)"
+
+"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ if "%OS%"=="" goto NOTNT
+ if not "%OS%"=="Windows_NT" goto NOTNT
+ regsvr32 /s /c "$(TargetPath)"
+ echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
+ goto end
+ :NOTNT
+ echo Warning : Cannot register Unicode DLL on Windows 95
+ :end
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Release MinSize"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ReleaseMinSize"
+# PROP BASE Intermediate_Dir "ReleaseMinSize"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ReleaseMinSize"
+# PROP Intermediate_Dir "ReleaseMinSize"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# Begin Custom Build - Performing registration
+OutDir=.\ReleaseMinSize
+TargetPath=.\ReleaseMinSize\XCallback_Impl.dll
+InputPath=.\ReleaseMinSize\XCallback_Impl.dll
+SOURCE="$(InputPath)"
+
+"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ regsvr32 /s /c "$(TargetPath)"
+ echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Release MinDependency"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ReleaseMinDependency"
+# PROP BASE Intermediate_Dir "ReleaseMinDependency"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ReleaseMinDependency"
+# PROP Intermediate_Dir "ReleaseMinDependency"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# Begin Custom Build - Performing registration
+OutDir=.\ReleaseMinDependency
+TargetPath=.\ReleaseMinDependency\XCallback_Impl.dll
+InputPath=.\ReleaseMinDependency\XCallback_Impl.dll
+SOURCE="$(InputPath)"
+
+"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ regsvr32 /s /c "$(TargetPath)"
+ echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Unicode Release MinSize"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ReleaseUMinSize"
+# PROP BASE Intermediate_Dir "ReleaseUMinSize"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ReleaseUMinSize"
+# PROP Intermediate_Dir "ReleaseUMinSize"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# Begin Custom Build - Performing registration
+OutDir=.\ReleaseUMinSize
+TargetPath=.\ReleaseUMinSize\XCallback_Impl.dll
+InputPath=.\ReleaseUMinSize\XCallback_Impl.dll
+SOURCE="$(InputPath)"
+
+"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ if "%OS%"=="" goto NOTNT
+ if not "%OS%"=="Windows_NT" goto NOTNT
+ regsvr32 /s /c "$(TargetPath)"
+ echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
+ goto end
+ :NOTNT
+ echo Warning : Cannot register Unicode DLL on Windows 95
+ :end
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "XCallback_Impl - Win32 Unicode Release MinDependency"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ReleaseUMinDependency"
+# PROP BASE Intermediate_Dir "ReleaseUMinDependency"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "ReleaseUMinDependency"
+# PROP Intermediate_Dir "ReleaseUMinDependency"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# Begin Custom Build - Performing registration
+OutDir=.\ReleaseUMinDependency
+TargetPath=.\ReleaseUMinDependency\XCallback_Impl.dll
+InputPath=.\ReleaseUMinDependency\XCallback_Impl.dll
+SOURCE="$(InputPath)"
+
+"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ if "%OS%"=="" goto NOTNT
+ if not "%OS%"=="Windows_NT" goto NOTNT
+ regsvr32 /s /c "$(TargetPath)"
+ echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
+ goto end
+ :NOTNT
+ echo Warning : Cannot register Unicode DLL on Windows 95
+ :end
+
+# End Custom Build
+
+!ENDIF
+
+# Begin Target
+
+# Name "XCallback_Impl - Win32 Debug"
+# Name "XCallback_Impl - Win32 Unicode Debug"
+# Name "XCallback_Impl - Win32 Release MinSize"
+# Name "XCallback_Impl - Win32 Release MinDependency"
+# Name "XCallback_Impl - Win32 Unicode Release MinSize"
+# Name "XCallback_Impl - Win32 Unicode Release MinDependency"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Callback.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Simple.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.cpp
+# ADD CPP /Yc"stdafx.h"
+# End Source File
+# Begin Source File
+
+SOURCE=.\XCallback_Impl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\XCallback_Impl.def
+# End Source File
+# Begin Source File
+
+SOURCE=.\XCallback_Impl.idl
+# ADD MTL /tlb ".\XCallback_Impl.tlb" /h "XCallback_Impl.h" /iid "XCallback_Impl_i.c" /Oicf
+# End Source File
+# Begin Source File
+
+SOURCE=.\XCallback_Impl.rc
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Callback.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Simple.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\StdAfx.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\Callback.rgs
+# End Source File
+# Begin Source File
+
+SOURCE=.\Simple.rgs
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.idl b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.idl
new file mode 100644
index 000000000..8d07c46bc
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.idl
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * $RCSfile: XCallback_Impl.idl,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+// XCallback_Impl.idl : IDL source for XCallback_Impl.dll
+//
+
+// This file will be processed by the MIDL tool to
+// produce the type library (XCallback_Impl.tlb) and marshalling code.
+
+import "oaidl.idl";
+import "ocidl.idl";
+ [
+ object,
+ uuid(180FF55F-6F5C-11D4-8330-005004526AB4),
+ dual,
+ helpstring("ICallback Interface"),
+ pointer_default(unique)
+ ]
+ interface ICallback : IDispatch
+ {
+ [id(1), helpstring("method func1")] HRESULT func1();
+ [id(2), helpstring("method returnInterface")] HRESULT returnInterface([out, retval] IDispatch** ppdisp);
+ [id(3), helpstring("method outInterface")] HRESULT outInterface([out] IDispatch** ppdisp);
+ [id(4), helpstring("method outValuesMixed")] HRESULT outValuesMixed([in] long val, [out] long* pval, [in] BSTR string);
+ [id(5), helpstring("method outValuesAll")] HRESULT outValuesAll([out] IDispatch** ppdisp, [out] IDispatch** ppSimpleStruct, [out] long* aSimpleEnum,
+ [out] SAFEARRAY( VARIANT)* outSeq,
+ [out] VARIANT* varAny,
+ [out] VARIANT_BOOL * aBool,
+ [out] short* aChar,
+ [out] BSTR* aString ,
+ [out] float* aFloat,
+ [out] double* aDouble,
+ [out] unsigned char* aByte,
+ [out] short* aShort,
+ [out]long* aLong);
+// );
+ [id(6), helpstring("method outStruct")] HRESULT outStruct([out] IDispatch** outStruct);
+ [id(7), helpstring("method outEnum")] HRESULT outEnum([out] long* outEnum);
+ [id(8), helpstring("method outSeqAny")] HRESULT outSeqAny([out] SAFEARRAY( VARIANT)* outSeq);
+ [id(9), helpstring("method outAny")] HRESULT outAny([out] VARIANT* outAny);
+ [id(10), helpstring("method outBool")] HRESULT outBool([out]VARIANT_BOOL* outBool);
+ [id(11), helpstring("method outChar")] HRESULT outChar([out] short* outChar);
+ [id(12), helpstring("method outString")] HRESULT outString([out] BSTR * outString);
+ [id(13), helpstring("method outFloat")] HRESULT outFloat([out] float* outFloat);
+ [id(14), helpstring("method outDouble")] HRESULT outDouble([out] double* outDouble);
+ [id(16), helpstring("method outShort")] HRESULT outShort([out] short *outShort);
+ [id(17), helpstring("method outLong")] HRESULT outLong([out] long* outLong);
+ [id(20), helpstring("method outByte")] HRESULT outByte([out] unsigned char* outByte);
+ [id(21), helpstring("method inoutInterface")] HRESULT inoutInterface([in,out] IDispatch** ppdisp);
+ [id(22), helpstring("method inoutStruct")] HRESULT inoutStruct([in,out] IDispatch** inoutVal);
+ [id(23), helpstring("method inoutEnum")] HRESULT inoutEnum([in,out] long * inoutVal);
+ [id(24), helpstring("method inoutSeqAny")] HRESULT inoutSeqAny([in,out] SAFEARRAY(VARIANT)* pArray);
+ [id(25), helpstring("method inoutAny")] HRESULT inoutAny([in,out] VARIANT* inoutVal);
+ [id(26), helpstring("method inoutBool")] HRESULT inoutBool([in,out] VARIANT_BOOL * inoutVal);
+ [id(27), helpstring("method inoutChar")] HRESULT inoutChar([in,out] short* inoutVal);
+ [id(28), helpstring("method inoutString")] HRESULT inoutString([in,out] BSTR *inoutVal);
+ [id(29), helpstring("method inoutFloat")] HRESULT inoutFloat([in,out] float* inoutVal);
+ [id(30), helpstring("method inoutDouble")] HRESULT inoutDouble([in,out] double* inoutVal);
+ [id(31), helpstring("method inoutByte")] HRESULT inoutByte([in,out] unsigned char* inoutVal);
+ [id(32), helpstring("method inoutShort")] HRESULT inoutShort([in,out] short* inoutVal);
+ [id(33), helpstring("method inoutLong")] HRESULT inoutLong([in,out] long* inoutVal);
+ [id(34), helpstring("method inoutValueAll")] HRESULT inoutValuesAll(
+ [in,out] IDispatch** aXSimple,
+ [in,out] IDispatch** aStruct,
+ [in,out] long* aEnum,
+ [in,out] SAFEARRAY( VARIANT)* aSeq,
+ [in,out] VARIANT* aAny,
+ [in,out] VARIANT_BOOL* aBool,
+ [in,out] short* aChar,
+ [in,out] BSTR* aString,
+ [in,out] float* aFloat,
+ [in,out] double* aDouble,
+ [in,out] unsigned char* aByte,
+ [in,out] short* aShort,
+ [in,out] long* aLong);
+ [id(35), helpstring("method inValues")] HRESULT inValues([in]short aChar, [in] long aLong, [in] BSTR aString);
+ [id(36), helpstring("method outSeqByte")] HRESULT outSeqByte([out] SAFEARRAY(unsigned char)* outVal);
+ [id(37), helpstring("method inSeqByte")] HRESULT inSeqByte([in] SAFEARRAY(unsigned char) val);
+
+ };
+ [
+ object,
+ uuid(180FF564-6F5C-11D4-8330-005004526AB4),
+ dual,
+ helpstring("ISimple Interface"),
+ pointer_default(unique)
+ ]
+ interface ISimple : IDispatch
+ {
+ [id(1), helpstring("method func")] HRESULT func( [in] BSTR message);
+ [id(2), helpstring("method func2")] HRESULT func2([in] BSTR message);
+ [id(3), helpstring("method func3")] HRESULT func3([in] BSTR message);
+ [propget, id(4), helpstring("property _implementedInterfaces")] HRESULT _implementedInterfaces([out, retval] SAFEARRAY(BSTR) *pVal);
+ };
+
+
+
+[
+ uuid(180FF553-6F5C-11D4-8330-005004526AB4),
+ version(1.0),
+ helpstring("XCallback_Impl 1.0 Type Library")
+]
+library XCALLBACK_IMPLLib
+{
+ importlib("stdole32.tlb");
+ importlib("stdole2.tlb");
+
+ [
+ uuid(180FF560-6F5C-11D4-8330-005004526AB4),
+ helpstring("Callback Class")
+ ]
+ coclass Callback
+ {
+ [default] interface ICallback;
+ };
+ [
+ uuid(180FF565-6F5C-11D4-8330-005004526AB4),
+ helpstring("Simple Class")
+ ]
+ coclass Simple
+ {
+ [default] interface ISimple;
+ };
+};
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.rc b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.rc
new file mode 100644
index 000000000..1eb9f719e
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.rc
@@ -0,0 +1,197 @@
+/*************************************************************************
+*
+* $RCSfile: XCallback_Impl.rc,v $
+*
+* $Revision: 1.1.1.1 $
+*
+* last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+*
+* The Contents of this file are made available subject to the terms of
+* either of the following licenses
+*
+* - GNU Lesser General Public License Version 2.1
+* - Sun Industry Standards Source License Version 1.1
+*
+* Sun Microsystems Inc., October, 2000
+*
+* GNU Lesser General Public License Version 2.1
+* =============================================
+* Copyright 2000 by Sun Microsystems, Inc.
+* 901 San Antonio Road, Palo Alto, CA 94303, USA
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License version 2.1, as published by the Free Software Foundation.
+*
+* This library 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 for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+* MA 02111-1307 USA
+*
+*
+* Sun Industry Standards Source License Version 1.1
+* =================================================
+* The contents of this file are subject to the Sun Industry Standards
+* Source License Version 1.1 (the "License"); You may not use this file
+* except in compliance with the License. You may obtain a copy of the
+* License at http://www.openoffice.org/license.html.
+*
+* Software provided under this License is provided on an "AS IS" basis,
+* WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+* WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+* See the License for the specific provisions governing your rights and
+* obligations concerning the Software.
+*
+* The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+*
+* Copyright: 2000 by Sun Microsystems, Inc.
+*
+* All Rights Reserved.
+*
+* Contributor(s): _______________________________________
+*
+*
+*
+**************************************************************************/
+
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// German (Germany) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
+#ifdef _WIN32
+LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// REGISTRY
+//
+
+IDR_CALLBACK REGISTRY DISCARDABLE "Callback.rgs"
+IDR_SIMPLE REGISTRY DISCARDABLE "Simple.rgs"
+#endif // German (Germany) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""winres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "1 TYPELIB ""XCallback_Impl.tlb""\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "CompanyName", "\0"
+ VALUE "FileDescription", "XCallback_Impl Module\0"
+ VALUE "FileVersion", "1, 0, 0, 1\0"
+ VALUE "InternalName", "XCallback_Impl\0"
+ VALUE "LegalCopyright", "Copyright 2000\0"
+ VALUE "OriginalFilename", "XCallback_Impl.DLL\0"
+ VALUE "ProductName", "XCallback_Impl Module\0"
+ VALUE "ProductVersion", "1, 0, 0, 1\0"
+ VALUE "OLESelfRegister", "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_PROJNAME "XCallback_Impl"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+1 TYPELIB "XCallback_Impl.tlb"
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/extensions/test/ole/unoTocomCalls/XCallback_Impl/resource.h b/extensions/test/ole/unoTocomCalls/XCallback_Impl/resource.h
new file mode 100644
index 000000000..087847931
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/XCallback_Impl/resource.h
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * $RCSfile: resource.h,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by XCallback_Impl.rc
+//
+#define IDS_PROJNAME 100
+#define IDR_CALLBACK 101
+#define IDR_SIMPLE 102
+#define IDR_SIMPLESTRUCT 103
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 201
+#define _APS_NEXT_COMMAND_VALUE 32768
+#define _APS_NEXT_CONTROL_VALUE 201
+#define _APS_NEXT_SYMED_VALUE 104
+#endif
+#endif
diff --git a/extensions/test/ole/unoTocomCalls/readme.txt b/extensions/test/ole/unoTocomCalls/readme.txt
new file mode 100644
index 000000000..d02b1357a
--- /dev/null
+++ b/extensions/test/ole/unoTocomCalls/readme.txt
@@ -0,0 +1,6 @@
+The directory XCallback_Impl contains a MSDEV project that
+creates a dll containing the ActiveX components
+XCallback_Impl.Simple and XCallback_Impl.Callback
+Callback implements functions defined in oletest.XCallback
+and Simple implements functions defined in oletest.XSimple.
+These interfaces are build in extensions/test/ole/cpnt \ No newline at end of file
diff --git a/extensions/test/pgp/TestPGP.java b/extensions/test/pgp/TestPGP.java
new file mode 100644
index 000000000..7edc4a9cb
--- /dev/null
+++ b/extensions/test/pgp/TestPGP.java
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * $RCSfile: TestPGP.java,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+import java.io.IOException;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.PropertyState;
+
+import com.sun.star.bridge.XBridge;
+
+// import com.sun.star.comp.bootstrap.Bootstrap;
+
+import com.sun.star.connection.XConnector;
+import com.sun.star.connection.XConnection;
+
+import com.sun.star.io.BufferSizeExceededException;
+import com.sun.star.io.NotConnectedException;
+import com.sun.star.io.XInputStream;
+import com.sun.star.io.XOutputStream;
+
+import com.sun.star.frame.XComponentLoader;
+
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+
+import com.sun.star.text.XSimpleText;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextRange;
+
+import com.sun.star.uno.IBridge;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.XNamingService;
+import com.sun.star.container.*;
+import com.sun.star.lang.*;
+
+import com.sun.star.pgp.*;
+
+
+
+public class TestPGP {
+
+
+ static void doSomething(Object r) throws com.sun.star.uno.Exception, IOException, Exception {
+ XNamingService rName = (XNamingService)UnoRuntime.queryInterface(XNamingService.class, r);
+
+ if(rName != null) {
+ System.err.println("got the remote naming service !");
+ Object rXsmgr = rName.getRegisteredObject("StarOffice.ServiceManager");
+
+ XMultiServiceFactory rSmgr = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, rXsmgr);
+ if(rSmgr != null) {
+ System.err.println("got the remote service manager !");
+ }
+
+ XSet set= (XSet)UnoRuntime.queryInterface(XSet.class, rSmgr);
+ if( set == null) {
+ System.err.println(" couldn't get XSet from ServiceFactory");
+ return;
+ }
+// try{
+ SimplePGPMailerFactoryReg mailerReg= new SimplePGPMailerFactoryReg();
+ XSingleServiceFactory factory= mailerReg.getServiceFactory(
+ "com.sun.star.pgp.SimplePGPMailerImpl", rSmgr, null, null);
+
+ if( factory == null) {
+ System.err.println("couldn't create PGP factory !");
+ return;
+ }
+ set.insert(factory );
+ System.err.println("PGP factory inserted into service manager");
+
+// }catch(Exception e ){
+// System.err.println( "exception caught in TestPGP");
+// }
+
+ }
+ }
+
+
+
+ static String neededServices[] = new String[] {
+ "com.sun.star.comp.servicemanager.ServiceManager",
+ "com.sun.star.comp.loader.JavaLoader",
+ "com.sun.star.comp.connections.Connector",
+ "com.sun.star.comp.connections.Acceptor"
+ };
+
+ public static void main(String argv[]) throws Exception {
+ if(argv.length != 1) {
+ System.err.println("usage : testoffice protocol:host:port");
+ System.exit(-1);
+ }
+
+// try {
+ com.sun.star.comp.servicemanager.ServiceManager smgr = new com.sun.star.comp.servicemanager.ServiceManager();
+ smgr.addFactories(neededServices, null);
+
+ XConnector xConnector = (XConnector)smgr.createInstance("com.sun.star.connection.Connector");
+ XConnection xConnection = xConnector.connect(argv[0]);
+
+ String rootOid = "classic_uno";
+ IBridge iBridge = UnoRuntime.getBridgeByName("java", null, "remote", null, new Object[]{"iiop", xConnection, null});
+
+ Object rInitialObject = iBridge.mapInterfaceFrom(rootOid, XInterface.class);
+// Object rInitialObject = xBridge.getInstance("NamingService");
+
+ if(rInitialObject != null) {
+ System.err.println("got the remote object");
+ doSomething(rInitialObject);
+ }
+// }
+// catch (Exception exception) {
+// System.err.println("Exception thrown:" + exception);
+// }
+ }
+}
+
diff --git a/extensions/test/pgp/makefile.mk b/extensions/test/pgp/makefile.mk
new file mode 100644
index 000000000..6c703c502
--- /dev/null
+++ b/extensions/test/pgp/makefile.mk
@@ -0,0 +1,161 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+
+
+PRJ=..$/..
+
+PRJNAME := extensions
+#PACKAGE := com$/sun$/star$/pgp
+PACKAGE :=
+TARGET := test_com_sun_star_pgp
+
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+
+# Files --------------------------------------------------------
+
+
+APPLICATRDB := $(SOLARBINDIR)$/applicat.rdb
+RDB := $(APPLICATRDB)
+
+JARFILES= jurt.jar
+
+GENJAVACLASSFILES= \
+ $(CLASSDIR)$/com$/sun$/star$/beans$/PropertyValue.class \
+ $(CLASSDIR)$/com$/sun$/star$/beans$/PropertyState.class \
+ $(CLASSDIR)$/com$/sun$/star$/container$/XSet.class \
+
+
+#$(CLASSDIR)$/com$/sun$/star$/awt$/FocusEvent.class
+
+# $(CLASSDIR)$/com$/sun$/star$/awt$/InputEvent.class \
+# $(CLASSDIR)$/com$/sun$/star$/awt$/KeyEvent.class \
+# $(CLASSDIR)$/com$/sun$/star$/awt$/MouseEvent.class \
+# $(CLASSDIR)$/com$/sun$/star$/awt$/WindowEvent.class \
+# $(CLASSDIR)$/com$/sun$/star$/awt$/PaintEvent.class \
+# $(CLASSDIR)$/com$/sun$/star$/awt$/Rectangle.class \
+# $(CLASSDIR)$/com$/sun$/star$/awt$/XFocusListener.class \
+# $(CLASSDIR)$/com$/sun$/star$/awt$/XKeyListener.class \
+# $(CLASSDIR)$/com$/sun$/star$/awt$/XMouseListener.class \
+# $(CLASSDIR)$/com$/sun$/star$/awt$/XMouseMotionListener.class \
+# $(CLASSDIR)$/com$/sun$/star$/awt$/XWindow.class \
+# $(CLASSDIR)$/com$/sun$/star$/awt$/XWindowListener.class \
+# $(CLASSDIR)$/com$/sun$/star$/awt$/XPaintListener.class \
+# $(CLASSDIR)$/com$/sun$/star$/bridge$/XBridge.class \
+# $(CLASSDIR)$/com$/sun$/star$/container$/XIndexAccess.class \
+# $(CLASSDIR)$/com$/sun$/star$/frame$/FrameAction.class \
+# $(CLASSDIR)$/com$/sun$/star$/frame$/FrameActionEvent.class \
+# $(CLASSDIR)$/com$/sun$/star$/frame$/XComponentLoader.class \
+# $(CLASSDIR)$/com$/sun$/star$/frame$/XController.class \
+# $(CLASSDIR)$/com$/sun$/star$/frame$/XFrame.class \
+# $(CLASSDIR)$/com$/sun$/star$/frame$/XFrameActionListener.class \
+# $(CLASSDIR)$/com$/sun$/star$/frame$/XFrames.class \
+# $(CLASSDIR)$/com$/sun$/star$/frame$/XFramesSupplier.class \
+# $(CLASSDIR)$/com$/sun$/star$/frame$/XModel.class \
+# $(CLASSDIR)$/com$/sun$/star$/io$/BufferSizeExceededException.class \
+# $(CLASSDIR)$/com$/sun$/star$/io$/NotConnectedException.class \
+# $(CLASSDIR)$/com$/sun$/star$/io$/XInputStream.class \
+# $(CLASSDIR)$/com$/sun$/star$/io$/XOutputStream.class \
+# $(CLASSDIR)$/com$/sun$/star$/lang$/IndexOutOfBoundsException.class \
+# $(CLASSDIR)$/com$/sun$/star$/lang$/XComponent.class \
+# $(CLASSDIR)$/com$/sun$/star$/lang$/XMultiServiceFactory.class \
+# $(CLASSDIR)$/com$/sun$/star$/lang$/XServiceInfo.class \
+# $(CLASSDIR)$/com$/sun$/star$/text$/XSimpleText.class \
+# $(CLASSDIR)$/com$/sun$/star$/text$/XText.class \
+# $(CLASSDIR)$/com$/sun$/star$/text$/XTextContent.class \
+# $(CLASSDIR)$/com$/sun$/star$/text$/XTextCursor.class \
+# $(CLASSDIR)$/com$/sun$/star$/text$/XTextDocument.class \
+# $(CLASSDIR)$/com$/sun$/star$/text$/XTextRange.class \
+# $(CLASSDIR)$/com$/sun$/star$/uno$/XNamingService.class \
+# $(CLASSDIR)$/com$/sun$/star$/uno$/Enum.class
+
+
+JAVACLASSFILES= \
+ $(CLASSDIR)$/$(PACKAGE)$/TestPGP.class
+
+
+TYPES={$(subst,.class, $(subst,$/,. $(subst,$(CLASSDIR)$/,-T $(GENJAVACLASSFILES))))}
+GENJAVAFILES = {$(subst,.class,.java $(subst,$/class, $(GENJAVACLASSFILES)))}
+JAVAFILES= $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES))) $(GENJAVAFILES)
+
+
+# --- Targets ------------------------------------------------------
+
+
+.IF "$(depend)" == ""
+ALL : $(GENJAVAFILES) ALLTAR
+.ELSE
+ALL: ALLDEP
+.ENDIF
+
+.INCLUDE : target.mk
+
+$(GENJAVAFILES) : $(RDB)
+# +javamaker -BUCR -O$(OUT) $(TYPES) $(RDB)
+ +javamaker @$(mktmp -BUCR -O$(OUT) $(TYPES) $(RDB))
+
+$(JAVACLASSFILES) : $(GENJAVAFILES)
diff --git a/extensions/test/pgp/readme.txt b/extensions/test/pgp/readme.txt
new file mode 100644
index 000000000..f6f6a1871
--- /dev/null
+++ b/extensions/test/pgp/readme.txt
@@ -0,0 +1,34 @@
+The program TestPGP instantiates a SimplePGPMailerFactory and adds
+ it to the ServiceManager obtained from a running StarOffice.
+Then PGP can be used from within StarOffice.
+
+Prerequisites:
+StarOffice needs an entry in Office/user/sofficerc under the Common
+ section:
+
+ Port2=socket:hamburg-11070:1111 // old style
+as of 569 m
+Connection=socket,hamburg-11070,port=1111;iiop;
+
+Please note the semicolons!
+
+ hamburg-11070 is the host running the office and 1111 is a
+ freely choosable port number.
+
+
+ For the program to run make sure that the office has access
+ to classes.zip, unoil.jar, jurt.jar, sandbox.jar, pgp.jar
+ and swingall.jar.
+
+ Therefore do the necessary entries in
+ Office/user/config/javarc
+ under SystemClasspath.
+
+There is a bug with jdk1.1.8, therfore use 1.2 instead.
+
+The TestPGP is called without ;iiop; :
+
+java TestPGP "socket,host=localhost,port=1111"
+
+
+
diff --git a/extensions/test/sax/exports.dxp b/extensions/test/sax/exports.dxp
new file mode 100644
index 000000000..e4bc69d23
--- /dev/null
+++ b/extensions/test/sax/exports.dxp
@@ -0,0 +1,2 @@
+exService_writeRegEntry
+exService_getFactory
diff --git a/extensions/test/sax/factory.hxx b/extensions/test/sax/factory.hxx
new file mode 100644
index 000000000..394702df9
--- /dev/null
+++ b/extensions/test/sax/factory.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * $RCSfile: factory.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+XInterfaceRef OSaxWriterTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception));
+UString OSaxWriterTest_getServiceName( ) THROWS( () );
+UString OSaxWriterTest_getImplementationName( ) THROWS( () );
+Sequence<UString> OSaxWriterTest_getSupportedServiceNames( ) THROWS( () );
+
diff --git a/extensions/test/sax/makefile.mk b/extensions/test/sax/makefile.mk
new file mode 100644
index 000000000..d3ec2da75
--- /dev/null
+++ b/extensions/test/sax/makefile.mk
@@ -0,0 +1,102 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=extensions
+TARGET=testsax
+USE_DEFFILE=TRUE
+ENABLE_EXCEPTIONS=TRUE
+# --- Settings -----------------------------------------------------
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+
+
+OBJFILES = $(SLO)$/testsax.obj $(SLO)$/testwriter.obj
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1OBJFILES= $(OBJFILES)
+
+
+SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
+
+SHL1STDLIBS= \
+ $(USRLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(ONELIB) \
+ $(TOOLSLIB)
+
+SHL1LIBS= $(LIB1TARGET)
+SHL1IMPLIB= i$(TARGET)
+SHL1DEPN= makefile.mk $(SHL1LIBS)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1EXPORTFILE= exports.dxp
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
diff --git a/extensions/test/sax/testsax.cxx b/extensions/test/sax/testsax.cxx
new file mode 100644
index 000000000..8b777776a
--- /dev/null
+++ b/extensions/test/sax/testsax.cxx
@@ -0,0 +1,951 @@
+/*************************************************************************
+ *
+ * $RCSfile: testsax.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <smart/com/sun/star/test/XSimpleTest.hxx>
+
+#include <rtl/wstring.hxx>
+#include <osl/time.h>
+//#include <vos/dynload.hxx>
+//#include <vos/diagnose.hxx>
+#include <usr/weak.hxx>
+#include <tools/string.hxx>
+#include <vos/conditn.hxx>
+#include <assert.h>
+
+#include <smart/com/sun/star/io/XOutputStream.hxx>
+#include <smart/com/sun/star/xml/sax/SAXParseException.hxx>
+#include <smart/com/sun/star/xml/sax/XParser.hxx>
+#include <smart/com/sun/star/xml/sax/XExtendedDocumentHandler.hxx>
+
+#include <smart/com/sun/star/lang/XMultiServiceFactory.hxx> // for the multiservice-factories
+#include <usr/factoryhlp.hxx>
+
+#include <usr/reflserv.hxx> // for EXTERN_SERVICE_CALLTYPE
+
+#include "factory.hxx"
+
+#ifdef _USE_NAMESPACE
+using namespace rtl;
+using namespace vos;
+using namespace usr;
+#endif
+
+
+#define BUILD_ERROR(expr, Message)\
+ {\
+ m_seqErrors.realloc( m_seqErrors.getLen() + 1 ); \
+ m_seqExceptions.realloc( m_seqExceptions.getLen() + 1 ); \
+ String str; \
+ str += __FILE__;\
+ str += " "; \
+ str += "(" ; \
+ str += __LINE__ ;\
+ str += ")\n";\
+ str += "[ " ; \
+ str += #expr; \
+ str += " ] : " ; \
+ str += Message; \
+ m_seqErrors.getArray()[ m_seqErrors.getLen()-1] = StringToUString( str , CHARSET_SYSTEM ); \
+ }\
+ ((void)0)
+
+
+#define WARNING_ASSERT(expr, Message) \
+ if( ! (expr) ) { \
+ m_seqWarnings.realloc( m_seqErrors.getLen() +1 ); \
+ String str;\
+ str += __FILE__;\
+ str += " "; \
+ str += "(" ; \
+ str += __LINE__ ;\
+ str += ")\n";\
+ str += "[ " ; \
+ str += #expr; \
+ str += " ] : " ; \
+ str += Message; \
+ m_seqWarnings.getArray()[ m_seqWarnings.getLen()-1] = StringToUString( str , CHARSET_SYSTEM ); \
+ return; \
+ }\
+ ((void)0)
+
+#define ERROR_ASSERT(expr, Message) \
+ if( ! (expr) ) { \
+ BUILD_ERROR(expr, Message );\
+ return; \
+ }\
+ ((void)0)
+
+#define ERROR_EXCEPTION_ASSERT(expr, Message, Exception) \
+ if( !(expr)) { \
+ BUILD_ERROR(expr,Message);\
+ m_seqExceptions.getArray()[ m_seqExceptions.getLen()-1] = UsrAny( Exception );\
+ return; \
+ } \
+ ((void)0)
+
+/****
+* test szenarios :
+*
+*
+*
+****/
+
+
+
+class OSaxParserTest :
+ public XSimpleTest,
+ public OWeakObject
+{
+public:
+ OSaxParserTest( const XMultiServiceFactoryRef & rFactory ) : m_rFactory( rFactory )
+ {
+
+ }
+
+public: // refcounting
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+public:
+ virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject)
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+ virtual INT32 test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+ virtual BOOL testPassed(void) THROWS( ( UsrSystemException) );
+ virtual Sequence< UString > getErrors(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UsrAny > getErrorExceptions(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UString > getWarnings(void) THROWS( (UsrSystemException) );
+
+private:
+ void testSimple( const XParserRef &r );
+ void testNamespaces( const XParserRef &r );
+ void testFile( const XParserRef &r );
+ void testEncoding( const XParserRef &rParser );
+ void testPerformance( const XParserRef &rParser );
+
+private:
+ Sequence<UsrAny> m_seqExceptions;
+ Sequence<UString> m_seqErrors;
+ Sequence<UString> m_seqWarnings;
+ XMultiServiceFactoryRef m_rFactory;
+};
+
+
+
+/**
+* for external binding
+*
+*
+**/
+XInterfaceRef OSaxParserTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception))
+{
+ OSaxParserTest *p = new OSaxParserTest( rSMgr );
+ XInterfaceRef xService = *p;
+ return xService;
+}
+
+
+UString OSaxParserTest_getServiceName( ) THROWS( () )
+{
+ return L"test.com.sun.star.xml.sax.Parser";
+}
+
+UString OSaxParserTest_getImplementationName( ) THROWS( () )
+{
+ return L"test.extensions.xml.sax.Parser";
+}
+
+Sequence<UString> OSaxParserTest_getSupportedServiceNames( ) THROWS( () )
+{
+ Sequence<UString> aRet(1);
+
+ aRet.getArray()[0] = OSaxParserTest_getImplementationName( );
+
+ return aRet;
+}
+
+
+BOOL OSaxParserTest::queryInterface( Uik uik , XInterfaceRef &rOut )
+{
+ if( XSimpleTest::getSmartUik() == uik ) {
+ rOut = (XSimpleTest *) this;
+ }
+ else {
+ return OWeakObject::queryInterface( uik , rOut );
+ }
+ return TRUE;
+}
+
+
+void OSaxParserTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject )
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+ if( L"com.sun.star.xml.sax.Parser" == TestName ) {
+ XParserRef parser( TestObject , USR_QUERY );
+
+ ERROR_ASSERT( parser.is() , "XDataInputStream cannot be queried" );
+ }
+}
+
+
+INT32 OSaxParserTest::test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+ if( L"com.sun.star.xml.sax.Parser" == TestName ) {
+ TRY {
+ if( 0 == hTestHandle ) {
+ testInvariant( TestName , TestObject );
+ }
+ else {
+
+ XParserRef parser( TestObject , USR_QUERY );
+
+ if( 1 == hTestHandle ) {
+ testSimple( parser );
+ }
+ else if( 2 == hTestHandle ) {
+ testNamespaces( parser );
+ }
+ else if( 3 == hTestHandle ) {
+ testEncoding( parser );
+ }
+ else if( 4 == hTestHandle ) {
+ testFile( parser );
+ }
+ else if( 5 == hTestHandle ) {
+ testPerformance( parser );
+ }
+ }
+ }
+ CATCH( Exception , e ) {
+ BUILD_ERROR( 0 , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() );
+ }
+ AND_CATCH_ALL() {
+ BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" );
+ }
+ END_CATCH;
+
+ hTestHandle ++;
+
+ if( hTestHandle >= 6) {
+ // all tests finished.
+ hTestHandle = -1;
+ }
+ }
+ else {
+ BUILD_ERROR( 0 , "service not supported by test." );
+ }
+ return hTestHandle;
+}
+
+
+
+BOOL OSaxParserTest::testPassed(void) THROWS( (UsrSystemException) )
+{
+ return m_seqErrors.getLen() == 0;
+}
+
+
+Sequence< UString > OSaxParserTest::getErrors(void) THROWS( (UsrSystemException) )
+{
+ return m_seqErrors;
+}
+
+
+Sequence< UsrAny > OSaxParserTest::getErrorExceptions(void) THROWS( (UsrSystemException) )
+{
+ return m_seqExceptions;
+}
+
+
+Sequence< UString > OSaxParserTest::getWarnings(void) THROWS( (UsrSystemException) )
+{
+ return m_seqWarnings;
+}
+
+XInputStreamRef createStreamFromSequence( const Sequence<BYTE> seqBytes , XMultiServiceFactoryRef &xSMgr )
+{
+ XInterfaceRef xOutStreamService = xSMgr->createInstance( L"com.sun.star.io.Pipe" );
+ assert( xOutStreamService.is() );
+ XOutputStreamRef rOutStream( xOutStreamService , USR_QUERY );
+ assert( rOutStream.is() );
+
+ XInputStreamRef rInStream( xOutStreamService , USR_QUERY );
+ assert( rInStream.is() );
+
+ rOutStream->writeBytes( seqBytes );
+ rOutStream->flush();
+ rOutStream->closeOutput();
+
+ return rInStream;
+}
+
+XInputStreamRef createStreamFromFile( const char *pcFile , XMultiServiceFactoryRef &xSMgr )
+{
+ FILE *f = fopen( pcFile , "rb" );
+ XInputStreamRef r;
+
+ if( f ) {
+ fseek( f , 0 , SEEK_END );
+ int nLength = ftell( f );
+ fseek( f , 0 , SEEK_SET );
+
+ Sequence<BYTE> seqIn(nLength);
+ fread( seqIn.getArray() , nLength , 1 , f );
+
+ r = createStreamFromSequence( seqIn , xSMgr );
+ fclose( f );
+ }
+ return r;
+}
+
+
+
+
+
+
+
+
+
+#define PCHAR_TO_USTRING(x) StringToUString(String(x),CHARSET_PC_1252)
+#define USTRING_TO_PCHAR(x) UStringToString(x,CHARSET_PC_437).GetStr()
+
+
+
+class TestDocumentHandler :
+ public XExtendedDocumentHandler,
+ public XEntityResolver,
+ public XErrorHandler,
+ public OWeakObject
+{
+public:
+ TestDocumentHandler( XMultiServiceFactoryRef &r , BOOL bPrint )
+ {
+ m_xSMgr = r;
+ m_bPrint = bPrint;
+ }
+
+
+public:
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+
+public: // Error handler
+ virtual void error(const UsrAny& aSAXParseException) THROWS( (SAXException, UsrSystemException) )
+ {
+ printf( "Error !\n" );
+ THROW( SAXException( L"error from error handler" , XInterfaceRef() , aSAXParseException ) );
+ }
+ virtual void fatalError(const UsrAny& aSAXParseException) THROWS( (SAXException, UsrSystemException) )
+ {
+ printf( "Fatal Error !\n" );
+ }
+ virtual void warning(const UsrAny& aSAXParseException) THROWS( (SAXException, UsrSystemException) )
+ {
+ printf( "Warning !\n" );
+ }
+
+
+public: // ExtendedDocumentHandler
+
+ virtual void startDocument(void) THROWS( (SAXException, UsrSystemException) )
+ {
+ m_iLevel = 0;
+ m_iElementCount = 0;
+ m_iAttributeCount = 0;
+ m_iWhitespaceCount =0;
+ m_iCharCount=0;
+ if( m_bPrint ) {
+ printf( "document started\n" );
+ }
+ }
+ virtual void endDocument(void) THROWS( (SAXException, UsrSystemException) )
+ {
+ if( m_bPrint ) {
+ printf( "document finished\n" );
+ printf( "(ElementCount %d),(AttributeCount %d),(WhitespaceCount %d),(CharCount %d)\n",
+ m_iElementCount, m_iAttributeCount, m_iWhitespaceCount , m_iCharCount );
+ }
+ }
+ virtual void startElement(const UString& aName, const XAttributeListRef& xAttribs)
+ THROWS( (SAXException,UsrSystemException) )
+ {
+
+ if( m_rLocator.is() ) {
+ if( m_bPrint )
+ printf( "%s(%d):" , USTRING_TO_PCHAR( m_rLocator->getSystemId() ) ,
+ m_rLocator->getLineNumber() );
+ }
+ if( m_bPrint ) {
+ int i;
+ for( i = 0; i < m_iLevel ; i ++ ) {
+ printf( " " );
+ }
+ printf( "<%s> " , USTRING_TO_PCHAR( aName ) );
+
+ for( i = 0 ; i < xAttribs->getLength() ; i ++ ) {
+ printf( "(%s,%s,'%s')" , USTRING_TO_PCHAR( xAttribs->getNameByIndex( i ) ) ,
+ USTRING_TO_PCHAR( xAttribs->getTypeByIndex( i ) ) ,
+ USTRING_TO_PCHAR( xAttribs->getValueByIndex( i ) ) );
+ }
+ printf( "\n" );
+ }
+ m_iLevel ++;
+ m_iElementCount ++;
+ m_iAttributeCount += xAttribs->getLength();
+ }
+ virtual void endElement(const UString& aName) THROWS( (SAXException,UsrSystemException) )
+ {
+ assert( m_iLevel );
+ m_iLevel --;
+ if( m_bPrint ) {
+ int i;
+ for( i = 0; i < m_iLevel ; i ++ ) {
+ printf( " " );
+ }
+ printf( "</%s>\n" , USTRING_TO_PCHAR( aName ) );
+ }
+ }
+
+ virtual void characters(const UString& aChars) THROWS( (SAXException,UsrSystemException) )
+ {
+ if( m_bPrint ) {
+ int i;
+ for( i = 0; i < m_iLevel ; i ++ ) {
+ printf( " " );
+ }
+ printf( "%s\n" , USTRING_TO_PCHAR( aChars ) );
+ }
+ m_iCharCount += aChars.len();
+ }
+ virtual void ignorableWhitespace(const UString& aWhitespaces) THROWS( (SAXException,UsrSystemException) )
+ {
+ m_iWhitespaceCount += aWhitespaces.len();
+ }
+
+ virtual void processingInstruction(const UString& aTarget, const UString& aData) THROWS( (SAXException,UsrSystemException) )
+ {
+ if( m_bPrint )
+ printf( "PI : %s,%s\n" , USTRING_TO_PCHAR( aTarget ) , USTRING_TO_PCHAR( aData ) );
+ }
+
+ virtual void setDocumentLocator(const XLocatorRef& xLocator) THROWS( (SAXException,UsrSystemException) )
+ {
+ m_rLocator = xLocator;
+ }
+
+ virtual InputSource resolveEntity(const UString& sPublicId, const UString& sSystemId)
+ THROWS( (SAXException,UsrSystemException) )
+ {
+ InputSource source;
+ source.sSystemId = sSystemId;
+ source.sPublicId = sPublicId;
+ source.aInputStream = createStreamFromFile( USTRING_TO_PCHAR( sSystemId ) , m_xSMgr );
+
+ return source;
+ }
+
+ virtual void startCDATA(void) THROWS( (SAXException,UsrSystemException) )
+ {
+ if( m_bPrint ) {
+ printf( "CDataStart :\n" );
+ }
+ }
+ virtual void endCDATA(void) THROWS( (SAXException,UsrSystemException) )
+ {
+ if( m_bPrint ) {
+ printf( "CEndStart :\n" );
+ }
+ }
+ virtual void comment(const UString& sComment) THROWS( (SAXException,UsrSystemException) )
+ {
+ if( m_bPrint ) {
+ printf( "<!--%s-->\n" , USTRING_TO_PCHAR( sComment ) );
+ }
+ }
+ virtual void unknown(const UString& sString) THROWS( (SAXException,UsrSystemException) )
+ {
+ if( m_bPrint ) {
+ printf( "UNKNOWN : {%s}\n" , USTRING_TO_PCHAR( sString ) );
+ }
+ }
+
+ virtual void allowLineBreak( void) THROWS( (SAXException, UsrSystemException ) )
+ {
+
+ }
+
+
+public:
+ int m_iLevel;
+ int m_iElementCount;
+ int m_iAttributeCount;
+ int m_iWhitespaceCount;
+ int m_iCharCount;
+ BOOL m_bPrint;
+
+ XMultiServiceFactoryRef m_xSMgr;
+ XLocatorRef m_rLocator;
+};
+
+BOOL TestDocumentHandler::queryInterface( Uik aUik , XInterfaceRef & rOut )
+{
+ if( aUik == XDocumentHandler::getSmartUik() ) {
+ rOut = (XDocumentHandler * )this;
+ }
+ else if ( aUik == XExtendedDocumentHandler::getSmartUik() ) {
+ rOut = (XExtendedDocumentHandler *) this;
+ }
+ else if ( aUik == XEntityResolver::getSmartUik() ) {
+ rOut = (XEntityResolver *) this;
+ }
+ else if ( aUik == XErrorHandler::getSmartUik() ) {
+ rOut = (XErrorHandler * ) this;
+ }
+ else {
+ return OWeakObject::queryInterface( aUik , rOut );
+ }
+ return TRUE;
+}
+
+
+
+
+void OSaxParserTest::testSimple( const XParserRef &rParser )
+{
+
+ char TestString[] =
+ "<!DOCTYPE personnel [\n"
+ "<!ENTITY testInternal \"internal Test!\">\n"
+ "<!ENTITY test SYSTEM \"external_entity.xml\">\n"
+ "]>\n"
+
+ "<personnel>\n"
+ "<person> fjklsfdklsdfkl\n"
+ "fjklsfdklsdfkl\n"
+ "<?testpi pidata?>\n"
+ "&testInternal;\n"
+ "<HUHU x='5' y='kjfd'> blahuhu\n"
+ "<HI> blahi\n"
+ " <![CDATA[<greeting>Hello, '+1+12world!</greeting>]]>\n"
+ " <!-- huhu <jdk> -->\n"
+ "<?testpi pidata?>\n"
+ "</HI>\n"
+ "aus XMLTest\n"
+ "</HUHU>\n"
+ "</person>\n"
+ "</personnel>\n\n\n";
+
+ Sequence<BYTE> seqBytes( strlen( TestString ) );
+ memcpy( seqBytes.getArray() , TestString , strlen( TestString ) );
+
+
+ XInputStreamRef rInStream;
+ UString sInput;
+ rInStream = createStreamFromSequence( seqBytes , m_rFactory );
+ sInput = UString( L"internal" );
+
+ if( rParser.is() ) {
+ InputSource source;
+
+ source.aInputStream = rInStream;
+ source.sSystemId = sInput;
+
+ TestDocumentHandler *pDocHandler = new TestDocumentHandler( m_rFactory , FALSE );
+ XDocumentHandlerRef rDocHandler( (XDocumentHandler *) pDocHandler , USR_QUERY );
+ XEntityResolverRef rEntityResolver( (XEntityResolver *) pDocHandler , USR_QUERY );
+
+ rParser->setDocumentHandler( rDocHandler );
+ rParser->setEntityResolver( rEntityResolver );
+
+ TRY {
+ rParser->parseStream( source );
+ ERROR_ASSERT( pDocHandler->m_iElementCount == 4 , "wrong element count" );
+ ERROR_ASSERT( pDocHandler->m_iAttributeCount == 2 , "wrong attribut count" );
+ ERROR_ASSERT( pDocHandler->m_iCharCount == 130 , "wrong char count" );
+ ERROR_ASSERT( pDocHandler->m_iWhitespaceCount == 0, "wrong whitespace count" );
+ }
+ CATCH( SAXParseException , e ) {
+ BUILD_ERROR( 1 , USTRING_TO_PCHAR( e.Message ) );
+ }
+ AND_CATCH( SAXException , e ) {
+ BUILD_ERROR( 1 , USTRING_TO_PCHAR( e.Message ) );
+
+ }
+ AND_CATCH( Exception , e ) {
+ BUILD_ERROR( 1 , USTRING_TO_PCHAR( e.Message ) );
+ }
+ AND_CATCH_ALL() {
+ BUILD_ERROR( 1 , "unknown exception" );
+ }
+ END_CATCH;
+
+ }
+
+
+}
+
+void OSaxParserTest::testNamespaces( const XParserRef &rParser )
+{
+
+ char TestString[] =
+ "<?xml version='1.0'?>\n"
+ "<!-- all elements here are explicitly in the HTML namespace -->\n"
+ "<html:html xmlns:html='http://www.w3.org/TR/REC-html40'>\n"
+ "<html:head><html:title>Frobnostication</html:title></html:head>\n"
+ "<html:body><html:p>Moved to \n"
+ "<html:a href='http://frob.com'>here.</html:a></html:p></html:body>\n"
+ "</html:html>\n";
+
+ Sequence<BYTE> seqBytes( strlen( TestString ) );
+ memcpy( seqBytes.getArray() , TestString , strlen( TestString ) );
+
+
+ XInputStreamRef rInStream;
+ UString sInput;
+
+ rInStream = createStreamFromSequence( seqBytes , m_rFactory );
+ sInput = UString( L"internal" );
+
+ if( rParser.is() ) {
+ InputSource source;
+
+ source.aInputStream = rInStream;
+ source.sSystemId = sInput;
+
+ TestDocumentHandler *pDocHandler = new TestDocumentHandler( m_rFactory , FALSE );
+ XDocumentHandlerRef rDocHandler( (XDocumentHandler *) pDocHandler , USR_QUERY );
+ XEntityResolverRef rEntityResolver( (XEntityResolver *) pDocHandler , USR_QUERY );
+
+ rParser->setDocumentHandler( rDocHandler );
+ rParser->setEntityResolver( rEntityResolver );
+
+ TRY {
+ rParser->parseStream( source );
+ ERROR_ASSERT( pDocHandler->m_iElementCount == 6 , "wrong element count" );
+ ERROR_ASSERT( pDocHandler->m_iAttributeCount == 2 , "wrong attribut count" );
+ ERROR_ASSERT( pDocHandler->m_iCharCount == 33, "wrong char count" );
+ ERROR_ASSERT( pDocHandler->m_iWhitespaceCount == 0 , "wrong whitespace count" );
+ }
+ CATCH( SAXParseException , e ) {
+ BUILD_ERROR( 1 , USTRING_TO_PCHAR( e.Message ) );
+ }
+ AND_CATCH( SAXException , e ) {
+ BUILD_ERROR( 1 , USTRING_TO_PCHAR( e.Message ) );
+
+ }
+ AND_CATCH( Exception , e ) {
+ BUILD_ERROR( 1 , USTRING_TO_PCHAR( e.Message ) );
+ }
+ AND_CATCH_ALL() {
+ BUILD_ERROR( 1 , "unknown exception" );
+ }
+ END_CATCH;
+ }
+}
+
+void OSaxParserTest::testEncoding( const XParserRef &rParser )
+{
+ char TestString[] =
+ "<?xml version='1.0' encoding=\"iso-8859-1\"?>\n"
+ "<!-- all elements here are explicitly in the HTML namespace -->\n"
+ "<html:html xmlns:html='http://www.w3.org/TR/REC-html40'>\n"
+ "<html:head><html:title>Frobnostication</html:title></html:head>\n"
+ "<html:body><html:p>Moved to ß\n"
+ "<html:a href='http://frob.com'>here.</html:a></html:p></html:body>\n"
+ "</html:html>\n";
+
+ Sequence<BYTE> seqBytes( strlen( TestString ) );
+ memcpy( seqBytes.getArray() , TestString , strlen( TestString ) );
+
+
+ XInputStreamRef rInStream;
+ UString sInput;
+
+ rInStream = createStreamFromSequence( seqBytes , m_rFactory );
+ sInput = UString( L"internal" );
+
+ if( rParser.is() ) {
+ InputSource source;
+
+ source.aInputStream = rInStream;
+ source.sSystemId = sInput;
+
+ TestDocumentHandler *pDocHandler = new TestDocumentHandler( m_rFactory , FALSE );
+ XDocumentHandlerRef rDocHandler( (XDocumentHandler *) pDocHandler , USR_QUERY );
+ XEntityResolverRef rEntityResolver( (XEntityResolver *) pDocHandler , USR_QUERY );
+
+ rParser->setDocumentHandler( rDocHandler );
+ rParser->setEntityResolver( rEntityResolver );
+ TRY {
+ rParser->parseStream( source );
+ }
+ CATCH( SAXParseException , e ) {
+ BUILD_ERROR( 1 , USTRING_TO_PCHAR( e.Message ) );
+ }
+ AND_CATCH( SAXException , e ) {
+ BUILD_ERROR( 1 , USTRING_TO_PCHAR( e.Message ) );
+
+ }
+ AND_CATCH( Exception , e ) {
+ BUILD_ERROR( 1 , USTRING_TO_PCHAR( e.Message ) );
+ }
+ AND_CATCH_ALL() {
+ BUILD_ERROR( 1 , "unknown exception" );
+ }
+ END_CATCH;
+
+ }
+
+}
+
+void OSaxParserTest::testFile( const XParserRef & rParser )
+{
+
+ XInputStreamRef rInStream = createStreamFromFile( "testsax.xml" , m_rFactory );
+ UString sInput = UString( PCHAR_TO_USTRING( "testsax.xml" ) );
+
+
+ if( rParser.is() && rInStream.is() ) {
+ InputSource source;
+
+ source.aInputStream = rInStream;
+ source.sSystemId = sInput;
+
+ TestDocumentHandler *pDocHandler = new TestDocumentHandler( m_rFactory , TRUE );
+ XDocumentHandlerRef rDocHandler( (XDocumentHandler *) pDocHandler , USR_QUERY );
+ XEntityResolverRef rEntityResolver( (XEntityResolver *) pDocHandler , USR_QUERY );
+ XErrorHandlerRef rErrorHandler( ( XErrorHandler * )pDocHandler , USR_QUERY );
+
+ rParser->setDocumentHandler( rDocHandler );
+ rParser->setEntityResolver( rEntityResolver );
+ rParser->setErrorHandler( rErrorHandler );
+
+ TRY {
+ rParser->parseStream( source );
+ }
+ CATCH( SAXParseException , e ) {
+ UsrAny any;
+ any.set( &e , SAXParseException_getReflection() );
+ while(TRUE) {
+ SAXParseException *pEx;
+ if( any.getReflection() == SAXParseException_getReflection() ) {
+ pEx = ( SAXParseException * ) any.get();
+ printf( "%s\n" , UStringToString( pEx->Message , CHARSET_SYSTEM ).GetStr() );
+ any = pEx->WrappedException;
+ }
+ else {
+ break;
+ }
+ }
+ }
+ AND_CATCH( SAXException , e ) {
+ printf( "%s\n" , UStringToString( e.Message , CHARSET_SYSTEM ).GetStr() );
+
+ }
+ AND_CATCH( Exception , e ) {
+ printf( "normal exception ! %s\n", e.getName() );
+ }
+ AND_CATCH_ALL() {
+ printf( "any exception !!!!\n" );
+ }
+ END_CATCH;
+ }
+}
+
+void OSaxParserTest::testPerformance( const XParserRef & rParser )
+{
+
+ XInputStreamRef rInStream = createStreamFromFile( "testPerformance.xml" , m_rFactory );
+ UString sInput = UString( PCHAR_TO_USTRING( "testperformance.xml" ) );
+
+ if( rParser.is() && rInStream.is() ) {
+ InputSource source;
+
+ source.aInputStream = rInStream;
+ source.sSystemId = sInput;
+
+ TestDocumentHandler *pDocHandler = new TestDocumentHandler( m_rFactory , FALSE );
+ XDocumentHandlerRef rDocHandler( (XDocumentHandler *) pDocHandler , USR_QUERY );
+ XEntityResolverRef rEntityResolver( (XEntityResolver *) pDocHandler , USR_QUERY );
+ XErrorHandlerRef rErrorHandler( ( XErrorHandler * )pDocHandler , USR_QUERY );
+
+ rParser->setDocumentHandler( rDocHandler );
+ rParser->setEntityResolver( rEntityResolver );
+ rParser->setErrorHandler( rErrorHandler );
+
+ TRY {
+ TimeValue aStartTime, aEndTime;
+ osl_getSystemTime( &aStartTime );
+ rParser->parseStream( source );
+ osl_getSystemTime( &aEndTime );
+
+ double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0);
+ double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0);
+
+ printf( "Performance reading : %g s\n" , fEnd - fStart );
+
+ }
+ CATCH( SAXParseException , e ) {
+ UsrAny any;
+ any.set( &e , SAXParseException_getReflection() );
+ while(TRUE) {
+ SAXParseException *pEx;
+ if( any.getReflection() == SAXParseException_getReflection() ) {
+ pEx = ( SAXParseException * ) any.get();
+ printf( "%s\n" , UStringToString( pEx->Message , CHARSET_SYSTEM ).GetStr() );
+ any = pEx->WrappedException;
+ }
+ else {
+ break;
+ }
+ }
+ }
+ AND_CATCH( SAXException , e ) {
+ printf( "%s\n" , UStringToString( e.Message , CHARSET_SYSTEM ).GetStr() );
+
+ }
+ AND_CATCH( Exception , e ) {
+ printf( "normal exception ! %s\n", e.getName() );
+ }
+ AND_CATCH_ALL() {
+ printf( "any exception !!!!\n" );
+ }
+ END_CATCH;
+ }
+
+}
+
+
+extern "C"
+{
+BOOL EXTERN_SERVICE_CALLTYPE exService_writeRegEntry(
+ const UNO_INTERFACE(XRegistryKey)* xUnoKey)
+
+{
+ XRegistryKeyRef xKey;
+ uno2smart(xKey, *xUnoKey);
+
+ UString str = UString( L"/" ) + OSaxParserTest_getImplementationName() + UString( L"/UNO/SERVICES" );
+ XRegistryKeyRef xNewKey = xKey->createKey( str );
+ xNewKey->createKey( OSaxParserTest_getServiceName() );
+
+ str = UString( L"/" ) + OSaxWriterTest_getImplementationName() + UString( L"/UNO/SERVICES" );
+ xNewKey = xKey->createKey( str );
+ xNewKey->createKey( OSaxWriterTest_getServiceName() );
+
+ return TRUE;
+}
+
+
+UNO_INTERFACE(XInterface) EXTERN_SERVICE_CALLTYPE exService_getFactory
+(
+ const wchar_t* implementationName,
+ const UNO_INTERFACE(XMultiServiceFactory)* xUnoFact,
+ const UNO_INTERFACE(XRegistryKey)*
+)
+{
+ UNO_INTERFACE(XInterface) xUnoRet = {0, 0};
+
+ XInterfaceRef xRet;
+ XMultiServiceFactoryRef xSMgr;
+ UString aImplementationName(implementationName);
+
+ uno2smart(xSMgr, *xUnoFact);
+
+ if (aImplementationName == OSaxWriterTest_getImplementationName() )
+ {
+ xRet = createSingleFactory( xSMgr, implementationName,
+ OSaxWriterTest_CreateInstance,
+ OSaxWriterTest_getSupportedServiceNames() );
+ }
+ else if (aImplementationName == OSaxParserTest_getImplementationName() )
+ {
+ xRet = createSingleFactory( xSMgr, implementationName,
+ OSaxParserTest_CreateInstance,
+ OSaxParserTest_getSupportedServiceNames() );
+ }
+ if (xRet.is())
+ {
+ smart2uno(xRet, xUnoRet);
+ }
+
+ return xUnoRet;
+}
+
+}
+
+
diff --git a/extensions/test/sax/testwriter.cxx b/extensions/test/sax/testwriter.cxx
new file mode 100644
index 000000000..bcb9664a8
--- /dev/null
+++ b/extensions/test/sax/testwriter.cxx
@@ -0,0 +1,811 @@
+/*************************************************************************
+ *
+ * $RCSfile: testwriter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//#include <tools/presys.h>
+#include <vector>
+//#include <tools/postsys.h>
+#include <smart/com/sun/star/test/XSimpleTest.hxx>
+#include <smart/com/sun/star/lang/XMultiServiceFactory.hxx> // for the multiservice-factories
+
+#include <stdio.h>
+
+#include <smart/com/sun/star/io/XActiveDataSource.hxx>
+#include <smart/com/sun/star/io/XOutputStream.hxx>
+#include <smart/com/sun/star/xml/sax/SAXParseException.hxx>
+#include <smart/com/sun/star/xml/sax/XParser.hxx>
+#include <smart/com/sun/star/xml/sax/XExtendedDocumentHandler.hxx>
+
+#include <rtl/wstring.hxx>
+#include <osl/time.h>
+#include <usr/weak.hxx>
+#include <tools/string.hxx>
+#include <assert.h>
+
+#include <usr/factoryhlp.hxx>
+
+#include <usr/reflserv.hxx> // for EXTERN_SERVICE_CALLTYPE
+
+
+#ifdef _USE_NAMESPACE
+using namespace std;
+using namespace rtl;
+using namespace vos;
+using namespace usr;
+#endif
+
+
+#define BUILD_ERROR(expr, Message)\
+ {\
+ m_seqErrors.realloc( m_seqErrors.getLen() + 1 ); \
+ m_seqExceptions.realloc( m_seqExceptions.getLen() + 1 ); \
+ String str; \
+ str += __FILE__;\
+ str += " "; \
+ str += "(" ; \
+ str += __LINE__ ;\
+ str += ")\n";\
+ str += "[ " ; \
+ str += #expr; \
+ str += " ] : " ; \
+ str += Message; \
+ m_seqErrors.getArray()[ m_seqErrors.getLen()-1] = StringToUString( str , CHARSET_SYSTEM ); \
+ }\
+ ((void)0)
+
+
+#define WARNING_ASSERT(expr, Message) \
+ if( ! (expr) ) { \
+ m_seqWarnings.realloc( m_seqErrors.getLen() +1 ); \
+ String str;\
+ str += __FILE__;\
+ str += " "; \
+ str += "(" ; \
+ str += __LINE__ ;\
+ str += ")\n";\
+ str += "[ " ; \
+ str += #expr; \
+ str += " ] : " ; \
+ str += Message; \
+ m_seqWarnings.getArray()[ m_seqWarnings.getLen()-1] = StringToUString( str , CHARSET_SYSTEM ); \
+ return; \
+ }\
+ ((void)0)
+
+#define ERROR_ASSERT(expr, Message) \
+ if( ! (expr) ) { \
+ BUILD_ERROR(expr, Message );\
+ return; \
+ }\
+ ((void)0)
+
+#define ERROR_EXCEPTION_ASSERT(expr, Message, Exception) \
+ if( !(expr)) { \
+ BUILD_ERROR(expr,Message);\
+ m_seqExceptions.getArray()[ m_seqExceptions.getLen()-1] = UsrAny( Exception );\
+ return; \
+ } \
+ ((void)0)
+
+/****
+* test szenarios :
+*
+*
+*
+****/
+
+
+class OFileWriter :
+ public XOutputStream,
+ public OWeakObject
+{
+public:
+ OFileWriter( char *pcFile ) { strcpy( m_pcFile , pcFile ); m_f = 0; }
+
+
+public: // refcounting
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut )
+ {
+ if( XOutputStream::getSmartUik() == aUik ) {
+ rOut = (XOutputStream *) this;
+ }
+ else return OWeakObject::queryInterface( aUik , rOut );
+
+ return TRUE;
+ }
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+public:
+ virtual void writeBytes(const Sequence< BYTE >& aData)
+ THROWS( (NotConnectedException, BufferSizeExceededException, UsrSystemException) );
+ virtual void flush(void)
+ THROWS( (NotConnectedException, BufferSizeExceededException, UsrSystemException) );
+ virtual void closeOutput(void)
+ THROWS( (NotConnectedException, BufferSizeExceededException, UsrSystemException) );
+
+
+private:
+ char m_pcFile[256];
+ FILE *m_f;
+};
+
+
+void OFileWriter::writeBytes(const Sequence< BYTE >& aData)
+ THROWS( (NotConnectedException, BufferSizeExceededException, UsrSystemException) )
+{
+ if( ! m_f ) {
+ m_f = fopen( m_pcFile , "w" );
+ }
+
+ fwrite( aData.getConstArray() , 1 , aData.getLen() , m_f );
+
+}
+
+
+void OFileWriter::flush(void)
+ THROWS( (NotConnectedException, BufferSizeExceededException, UsrSystemException) )
+{
+ fflush( m_f );
+}
+
+void OFileWriter::closeOutput(void)
+ THROWS( (NotConnectedException, BufferSizeExceededException, UsrSystemException) )
+{
+ fclose( m_f );
+ m_f = 0;
+}
+
+
+class OSaxWriterTest :
+ public XSimpleTest,
+ public OWeakObject
+{
+public:
+ OSaxWriterTest( const XMultiServiceFactoryRef & rFactory ) : m_rFactory( rFactory )
+ {
+
+ }
+ ~OSaxWriterTest() {}
+
+public: // refcounting
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+public:
+ virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject)
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+ virtual INT32 test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+ virtual BOOL testPassed(void) THROWS( ( UsrSystemException) );
+ virtual Sequence< UString > getErrors(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UsrAny > getErrorExceptions(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UString > getWarnings(void) THROWS( (UsrSystemException) );
+
+private:
+ void testSimple( const XExtendedDocumentHandlerRef &r );
+ void testExceptions( const XExtendedDocumentHandlerRef &r );
+ void testDTD( const XExtendedDocumentHandlerRef &r );
+ void testPerformance( const XExtendedDocumentHandlerRef &r );
+ void writeParagraph( const XExtendedDocumentHandlerRef &r , const UString & s);
+
+private:
+ Sequence<UsrAny> m_seqExceptions;
+ Sequence<UString> m_seqErrors;
+ Sequence<UString> m_seqWarnings;
+ XMultiServiceFactoryRef m_rFactory;
+
+};
+
+
+
+/*----------------------------------------
+*
+* Attributlist implementation
+*
+*----------------------------------------*/
+struct AttributeListImpl_impl;
+class AttributeListImpl :
+ public XAttributeList,
+ public OWeakObject
+{
+public:
+ AttributeListImpl();
+ AttributeListImpl( const AttributeListImpl & );
+ ~AttributeListImpl();
+
+public:
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+public:
+ virtual INT16 getLength(void) THROWS( (UsrSystemException) );
+ virtual UString getNameByIndex(INT16 i) THROWS( (UsrSystemException) );
+ virtual UString getTypeByIndex(INT16 i) THROWS( (UsrSystemException) );
+ virtual UString getTypeByName(const UString& aName) THROWS( (UsrSystemException) );
+ virtual UString getValueByIndex(INT16 i) THROWS( (UsrSystemException) );
+ virtual UString getValueByName(const UString& aName) THROWS( (UsrSystemException) );
+
+public:
+ void addAttribute( const UString &sName , const UString &sType , const UString &sValue );
+ void clear();
+
+private:
+ struct AttributeListImpl_impl *m_pImpl;
+};
+
+
+struct TagAttribute
+{
+ TagAttribute(){}
+ TagAttribute( const UString &sName, const UString &sType , const UString &sValue )
+ {
+ this->sName = sName;
+ this->sType = sType;
+ this->sValue = sValue;
+ }
+
+ UString sName;
+ UString sType;
+ UString sValue;
+};
+
+struct AttributeListImpl_impl
+{
+ AttributeListImpl_impl()
+ {
+ // performance improvement during adding
+ vecAttribute.reserve(20);
+ }
+ vector<struct TagAttribute> vecAttribute;
+};
+
+
+
+INT16 AttributeListImpl::getLength(void) THROWS( (UsrSystemException) )
+{
+ return m_pImpl->vecAttribute.size();
+}
+
+
+AttributeListImpl::AttributeListImpl( const AttributeListImpl &r )
+{
+ m_pImpl = new AttributeListImpl_impl;
+ *m_pImpl = *(r.m_pImpl);
+}
+
+UString AttributeListImpl::getNameByIndex(INT16 i) THROWS( (UsrSystemException) )
+{
+ if( i < m_pImpl->vecAttribute.size() ) {
+ return m_pImpl->vecAttribute[i].sName;
+ }
+ return UString();
+}
+
+
+UString AttributeListImpl::getTypeByIndex(INT16 i) THROWS( (UsrSystemException) )
+{
+ if( i < m_pImpl->vecAttribute.size() ) {
+ return m_pImpl->vecAttribute[i].sType;
+ }
+ return UString();
+}
+
+UString AttributeListImpl::getValueByIndex(INT16 i) THROWS( (UsrSystemException) )
+{
+ if( i < m_pImpl->vecAttribute.size() ) {
+ return m_pImpl->vecAttribute[i].sValue;
+ }
+ return UString();
+
+}
+
+UString AttributeListImpl::getTypeByName( const UString& sName ) THROWS( (UsrSystemException) )
+{
+ vector<struct TagAttribute>::iterator ii = m_pImpl->vecAttribute.begin();
+
+ for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) {
+ if( (*ii).sName == sName ) {
+ return (*ii).sType;
+ }
+ }
+ return UString();
+}
+
+UString AttributeListImpl::getValueByName(const UString& sName) THROWS( (UsrSystemException) )
+{
+ vector<struct TagAttribute>::iterator ii = m_pImpl->vecAttribute.begin();
+
+ for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) {
+ if( (*ii).sName == sName ) {
+ return (*ii).sValue;
+ }
+ }
+ return UString();
+}
+
+
+BOOL AttributeListImpl::queryInterface( Uik aUik, XInterfaceRef & rOut )
+{
+ if( aUik == XAttributeList::getSmartUik() ) {
+ rOut = (XAttributeList * )this;
+ }
+ else {
+ return OWeakObject::queryInterface( aUik , rOut );
+ }
+ return TRUE;
+}
+
+
+AttributeListImpl::AttributeListImpl()
+{
+ m_pImpl = new AttributeListImpl_impl;
+}
+
+
+
+AttributeListImpl::~AttributeListImpl()
+{
+ delete m_pImpl;
+}
+
+
+void AttributeListImpl::addAttribute( const UString &sName ,
+ const UString &sType ,
+ const UString &sValue )
+{
+ m_pImpl->vecAttribute.push_back( TagAttribute( sName , sType , sValue ) );
+}
+
+void AttributeListImpl::clear()
+{
+ vector<struct TagAttribute> dummy;
+ m_pImpl->vecAttribute.swap( dummy );
+
+ assert( ! getLength() );
+}
+
+
+
+
+
+
+
+
+
+
+
+/**
+* for external binding
+*
+*
+**/
+XInterfaceRef OSaxWriterTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception))
+{
+ OSaxWriterTest *p = new OSaxWriterTest( rSMgr );
+ XInterfaceRef xService = *p;
+ return xService;
+}
+
+UString OSaxWriterTest_getServiceName( ) THROWS( () )
+{
+ return L"test.com.sun.star.xml.sax.Writer";
+}
+
+UString OSaxWriterTest_getImplementationName( ) THROWS( () )
+{
+ return L"test.extensions.xml.sax.Writer";
+}
+
+Sequence<UString> OSaxWriterTest_getSupportedServiceNames( ) THROWS( () )
+{
+ Sequence<UString> aRet(1);
+
+ aRet.getArray()[0] = OSaxWriterTest_getImplementationName( );
+
+ return aRet;
+}
+
+
+BOOL OSaxWriterTest::queryInterface( Uik uik , XInterfaceRef &rOut )
+{
+ if( XSimpleTest::getSmartUik() == uik ) {
+ rOut = (XSimpleTest *) this;
+ }
+ else {
+ return OWeakObject::queryInterface( uik , rOut );
+ }
+ return TRUE;
+}
+
+
+void OSaxWriterTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject )
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+ if( L"com.sun.star.xml.sax.Writer" == TestName ) {
+ XDocumentHandlerRef doc( TestObject , USR_QUERY );
+ XExtendedDocumentHandlerRef ext( TestObject , USR_QUERY );
+ XActiveDataSourceRef source( TestObject , USR_QUERY );
+
+ ERROR_ASSERT( doc.is() , "XDocumentHandler cannot be queried" );
+ ERROR_ASSERT( ext.is() , "XExtendedDocumentHandler cannot be queried" );
+ ERROR_ASSERT( source.is() , "XActiveDataSource cannot be queried" );
+ }
+ else {
+ BUILD_ERROR( 0 , "wrong test" );
+ }
+}
+
+
+INT32 OSaxWriterTest::test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+ if( L"com.sun.star.xml.sax.Writer" == TestName ) {
+ TRY {
+ if( 0 == hTestHandle ) {
+ testInvariant( TestName , TestObject );
+ }
+ else {
+
+ XExtendedDocumentHandlerRef writer( TestObject , USR_QUERY );
+
+ if( 1 == hTestHandle ) {
+ testSimple( writer );
+ }
+ else if( 2 == hTestHandle ) {
+ testExceptions( writer );
+ }
+ else if( 3 == hTestHandle ) {
+ testDTD( writer );
+ }
+ else if( 4 == hTestHandle ) {
+ testPerformance( writer );
+ }
+ }
+ }
+ CATCH( Exception , e ) {
+ BUILD_ERROR( 0 , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() );
+ }
+ AND_CATCH_ALL() {
+ BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" );
+ }
+ END_CATCH;
+
+ hTestHandle ++;
+
+ if( hTestHandle >= 5) {
+ // all tests finished.
+ hTestHandle = -1;
+ }
+ }
+ else {
+ BUILD_ERROR( 0 , "service not supported by test." );
+ }
+ return hTestHandle;
+}
+
+
+
+BOOL OSaxWriterTest::testPassed(void) THROWS( (UsrSystemException) )
+{
+ return m_seqErrors.getLen() == 0;
+}
+
+
+Sequence< UString > OSaxWriterTest::getErrors(void) THROWS( (UsrSystemException) )
+{
+ return m_seqErrors;
+}
+
+
+Sequence< UsrAny > OSaxWriterTest::getErrorExceptions(void) THROWS( (UsrSystemException) )
+{
+ return m_seqExceptions;
+}
+
+
+Sequence< UString > OSaxWriterTest::getWarnings(void) THROWS( (UsrSystemException) )
+{
+ return m_seqWarnings;
+}
+
+void OSaxWriterTest::writeParagraph( const XExtendedDocumentHandlerRef &r , const UString & s)
+{
+ int nMax = s.len();
+ int nStart = 0;
+
+ Sequence<UINT16> seq( s.len() );
+ memcpy( seq.getArray() , s.getStr() , s.len() * sizeof( UINT16 ) );
+
+ for( int n = 1 ; n < nMax ; n++ ){
+ if( 32 == seq.getArray()[n] ) {
+ r->allowLineBreak();
+ r->characters( s.copy( nStart , n - nStart ) );
+ nStart = n;
+ }
+ }
+ r->allowLineBreak();
+ r->characters( s.copy( nStart , n - nStart ) );
+
+
+}
+
+
+
+void OSaxWriterTest::testSimple( const XExtendedDocumentHandlerRef &r )
+{
+ UString testParagraph = L"Dies ist ein bloeder Test um zu uberpruefen, ob der SAXWriter "
+ L"wohl Zeilenumbrueche halbwegs richtig macht oder ob er die Zeile "
+ L"bis zum bitteren Ende schreibt.";
+
+ OFileWriter *pw = new OFileWriter("output.xml");
+ AttributeListImpl *pList = new AttributeListImpl;
+
+ XAttributeListRef rList( (XAttributeList *) pList , USR_QUERY );
+ XOutputStreamRef ref( ( XOutputStream * ) pw , USR_QUERY );
+
+ XActiveDataSourceRef source( r , USR_QUERY );
+
+ ERROR_ASSERT( ref.is() , "no output stream" );
+ ERROR_ASSERT( source.is() , "no active data source" );
+
+ source->setOutputStream( ref );
+
+ r->startDocument();
+
+ pList->addAttribute( L"Arg1" , L"CDATA" , L"bla\n u" );
+ pList->addAttribute( L"Arg2" , L"CDATA" , L"blub" );
+
+ r->startElement( L"tag1" , rList );
+ r->ignorableWhitespace( L"" );
+
+ r->characters( L"huhu" );
+ r->ignorableWhitespace( L"" );
+
+ r->startElement( L"hi" , rList );
+ r->ignorableWhitespace( L"" );
+
+ // the enpassant must be converted & -> &amp;
+ r->characters( L"&#252;" );
+
+ // Test added for mib. Tests if errors during conversions occurs
+ r->ignorableWhitespace( UString() );
+ sal_Char array[256];
+ for( sal_Int32 n = 32 ; n < 254 ; n ++ ) {
+ array[n-32] = n;
+ }
+ array[254-32] = 0;
+ r->characters(
+ StringToUString( array , RTL_TEXTENCODING_SYMBOL )
+ );
+ r->ignorableWhitespace( UString() );
+
+ // '>' must not be converted
+ r->startCDATA();
+ r->characters( L">fsfsdf<" );
+ r->endCDATA();
+ r->ignorableWhitespace( UString() );
+
+ writeParagraph( r , testParagraph );
+
+
+ r->ignorableWhitespace( UString() );
+ r->comment( L"Dies ist ein Kommentar !" );
+ r->ignorableWhitespace( UString() );
+
+ r->startElement( L"emptytagtest" , rList );
+ r->endElement( L"emptytagtest" );
+
+ r->endElement( L"hi" );
+ r->ignorableWhitespace( L"" );
+
+ r->endElement( L"tag1" );
+ r->endDocument();
+
+}
+
+void OSaxWriterTest::testExceptions( const XExtendedDocumentHandlerRef & r )
+{
+
+ OFileWriter *pw = new OFileWriter("output2.xml");
+ AttributeListImpl *pList = new AttributeListImpl;
+
+ XAttributeListRef rList( (XAttributeList *) pList , USR_QUERY );
+ XOutputStreamRef ref( ( XOutputStream * ) pw , USR_QUERY );
+
+ XActiveDataSourceRef source( r , USR_QUERY );
+
+ ERROR_ASSERT( ref.is() , "no output stream" );
+ ERROR_ASSERT( source.is() , "no active data source" );
+
+ source->setOutputStream( ref );
+
+ { // startDocument must be called before start element
+ BOOL bException = TRUE;
+ TRY {
+ r->startElement( L"huhu" , rList );
+ bException = FALSE;
+ }
+ CATCH( SAXException ,e ) {
+
+ }
+ END_CATCH;
+ ERROR_ASSERT( bException , "expected exception not thrown !" );
+ }
+
+ r->startDocument();
+
+ r->startElement( L"huhu" , rList );
+ r->startCDATA();
+
+ {
+ BOOL bException = TRUE;
+ TRY{
+ r->startElement( L"huhu" , rList );
+ bException = FALSE;
+ }
+ CATCH( SAXException ,e ) {
+
+ }
+ END_CATCH;
+ ERROR_ASSERT( bException , "expected exception not thrown !" );
+ }
+
+ r->endCDATA();
+ r->endElement( L"hi" );
+
+ r->endDocument();
+}
+
+
+void OSaxWriterTest::testDTD(const XExtendedDocumentHandlerRef &r )
+{
+ OFileWriter *pw = new OFileWriter("outputDTD.xml");
+ AttributeListImpl *pList = new AttributeListImpl;
+
+ XAttributeListRef rList( (XAttributeList *) pList , USR_QUERY );
+ XOutputStreamRef ref( ( XOutputStream * ) pw , USR_QUERY );
+
+ XActiveDataSourceRef source( r , USR_QUERY );
+
+ ERROR_ASSERT( ref.is() , "no output stream" );
+ ERROR_ASSERT( source.is() , "no active data source" );
+
+ source->setOutputStream( ref );
+
+
+ r->startDocument();
+ r->unknown( L"<!DOCTYPE iCalendar >\n" );
+ r->startElement( L"huhu" , rList );
+
+ r->endElement( L"huhu" );
+ r->endDocument();
+}
+
+void OSaxWriterTest::testPerformance(const XExtendedDocumentHandlerRef &r )
+{
+ OFileWriter *pw = new OFileWriter("testPerformance.xml");
+ AttributeListImpl *pList = new AttributeListImpl;
+
+ UString testParagraph = L"Dies ist ein bloeder Test um zu uberpruefen, ob der SAXWriter "
+ L"wohl > Zeilenumbrueche halbwegs richtig macht oder ob er die Zeile "
+ L"bis zum bitteren Ende schreibt.";
+
+
+ XAttributeListRef rList( (XAttributeList *) pList , USR_QUERY );
+ XOutputStreamRef ref( ( XOutputStream * ) pw , USR_QUERY );
+
+ XActiveDataSourceRef source( r , USR_QUERY );
+
+ ERROR_ASSERT( ref.is() , "no output stream" );
+ ERROR_ASSERT( source.is() , "no active data source" );
+
+ source->setOutputStream( ref );
+
+ TimeValue aStartTime, aEndTime;
+ osl_getSystemTime( &aStartTime );
+
+
+ r->startDocument();
+ // just write a bunch of xml tags !
+ // for performance testing
+ sal_Int32 i2;
+ for( i2 = 0 ; i2 < 15 ; i2 ++ )
+ {
+ r->startElement( UString( L"tag" ) + UString::valueOf( i2 ), rList );
+ for( sal_Int32 i = 0 ; i < 450 ; i ++ )
+ {
+ r->ignorableWhitespace( L"");
+ r->startElement( L"huhu" , rList );
+ r->characters( testParagraph );
+// writeParagraph( r , testParagraph );
+
+ r->ignorableWhitespace( L"");
+ r->endElement( L"huhu" );
+ }
+ }
+ for( i2 = 14 ; i2 >= 0 ; i2-- )
+ {
+ r->ignorableWhitespace( L"");
+ r->endElement( UString( L"tag" ) + UString::valueOf( i2 ) );
+ }
+
+ r->endDocument();
+
+ osl_getSystemTime( &aEndTime );
+
+ double fStart = (double)aStartTime.Seconds + ((double)aStartTime.Nanosec / 1000000000.0);
+ double fEnd = (double)aEndTime.Seconds + ((double)aEndTime.Nanosec / 1000000000.0);
+
+ printf( "Performance writing : %g s\n" , fEnd - fStart );
+}
diff --git a/extensions/test/stm/datatest.cxx b/extensions/test/stm/datatest.cxx
new file mode 100644
index 000000000..9cf43c7f7
--- /dev/null
+++ b/extensions/test/stm/datatest.cxx
@@ -0,0 +1,1108 @@
+/*************************************************************************
+ *
+ * $RCSfile: datatest.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <smart/com/sun/star/test/XSimpleTest.hxx>
+#include <smart/com/sun/star/io/XObjectOutputStream.hxx>
+#include <smart/com/sun/star/io/XObjectInputStream.hxx>
+#include <smart/com/sun/star/io/XActiveDataSink.hxx>
+#include <smart/com/sun/star/io/XActiveDataSource.hxx>
+#include <smart/com/sun/star/io/XConnectable.hxx>
+#include <smart/com/sun/star/io/XMarkableStream.hxx>
+
+#include <smart/com/sun/star/lang/XServiceInfo.hxx>
+
+#include <smart/com/sun/star/beans/XPropertySet.hxx>
+
+#include <usr/services.hxx>
+#include <usr/factoryhlp.hxx>
+
+#include <usr/reflserv.hxx> // for EXTERN_SERVICE_CALLTYPE
+#include <usr/weak.hxx> // OWeakObject
+
+#include <vos/conditn.hxx>
+#include <vos/mutex.hxx>
+#include <vos/thread.hxx>
+
+#include <assert.h>
+#include <string.h>
+
+#include "testfactreg.hxx"
+
+#ifndef _VOS_NO_NAMESPACE
+using namespace vos;
+using namespace usr;
+#endif
+
+#define DATASTREAM_TEST_MAX_HANDLE 1
+
+/****
+* The following test class tests XDataInputStream and XDataOutputStream at equal terms,
+* so when errors occur, it may be in either one implementation.
+* The class also uses stardiv.uno.io.pipe. If problems occur, make sure to run also the
+* pipe test routines ( test.com.sun.star.io.pipe ).
+*
+*
+*****/
+
+class ODataStreamTest :
+ public XSimpleTest,
+ public OWeakObject
+{
+public:
+ ODataStreamTest( const XMultiServiceFactoryRef & rFactory ) : m_rFactory( rFactory ){}
+
+public: // refcounting
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+public:
+ virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject)
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+ virtual INT32 test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+ virtual BOOL testPassed(void) THROWS( ( UsrSystemException) );
+ virtual Sequence< UString > getErrors(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UsrAny > getErrorExceptions(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UString > getWarnings(void) THROWS( (UsrSystemException) );
+
+private:
+ void testSimple( const XDataInputStreamRef & , const XDataOutputStreamRef &);
+
+protected:
+ Sequence<UsrAny> m_seqExceptions;
+ Sequence<UString> m_seqErrors;
+ Sequence<UString> m_seqWarnings;
+
+ XMultiServiceFactoryRef m_rFactory;
+};
+
+
+BOOL ODataStreamTest::queryInterface( Uik uik , XInterfaceRef &rOut )
+{
+ if( XSimpleTest::getSmartUik() == uik ) {
+ rOut = (XSimpleTest *) this;
+ }
+ else {
+ return OWeakObject::queryInterface( uik , rOut );
+ }
+ return TRUE;
+}
+
+
+void ODataStreamTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject )
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+ if( L"com.sun.star.io.DataInputStream" == TestName ) {
+ XConnectableRef connect( TestObject , USR_QUERY );
+ XActiveDataSinkRef active( TestObject , USR_QUERY );
+ XInputStreamRef input( TestObject , USR_QUERY );
+ XDataInputStreamRef dataInput( TestObject , USR_QUERY );
+
+ WARNING_ASSERT( connect.is(), "XConnectable cannot be queried" );
+ WARNING_ASSERT( active.is() , "XActiveDataSink cannot be queried" );
+ ERROR_ASSERT( input.is() , "XInputStream cannot be queried" );
+ ERROR_ASSERT( dataInput.is() , "XDataInputStream cannot be queried" );
+
+
+ }
+ else if( L"com.sun.star.io.DataInputStream" == TestName ) {
+ XConnectableRef connect( TestObject , USR_QUERY );
+ XActiveDataSourceRef active( TestObject , USR_QUERY );
+ XOutputStreamRef output( TestObject , USR_QUERY );
+ XDataOutputStreamRef dataOutput( TestObject , USR_QUERY );
+
+ WARNING_ASSERT( connect.is(), "XConnectable cannot be queried" );
+ WARNING_ASSERT( active.is() , "XActiveDataSink cannot be queried" );
+ ERROR_ASSERT( output.is() , "XInputStream cannot be queried" );
+ ERROR_ASSERT( dataOutput.is(), "XDataInputStream cannot be queried" );
+
+ }
+
+ XServiceInfoRef info( TestObject, USR_QUERY );
+ ERROR_ASSERT( info.is() , "XServiceInfo not supported !" );
+ if( info.is() )
+ {
+ ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" );
+ ERROR_ASSERT( ! info->supportsService( L"bla bluzb" ) , "XServiceInfo test failed" );
+ }
+
+}
+
+
+INT32 ODataStreamTest::test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+ if( L"com.sun.star.io.DataInputStream" == TestName ||
+ L"com.sun.star.io.DataOutputStream" == TestName ) {
+
+ TRY {
+ if( 0 == hTestHandle ) {
+ testInvariant( TestName , TestObject );
+ }
+ else {
+ XActiveDataSinkRef rSink( TestObject, USR_QUERY );
+ XActiveDataSourceRef rSource( TestObject , USR_QUERY );
+
+ XDataInputStreamRef rInput( TestObject , USR_QUERY );
+ XDataOutputStreamRef rOutput( TestObject , USR_QUERY );
+
+
+ XInterfaceRef x = m_rFactory->createInstance( L"com.sun.star.io.Pipe");
+
+ XInputStreamRef rPipeInput( x , USR_QUERY );
+ XOutputStreamRef rPipeOutput( x , USR_QUERY );
+
+ if( ! rSink.is() ) {
+ x = m_rFactory->createInstance( L"com.sun.star.io.DataInputStream" );
+ x->queryInterface( XDataInputStream::getSmartUik() , rInput );
+ x->queryInterface( XActiveDataSink::getSmartUik() , rSink );
+ }
+ else if ( !rSource.is() ) {
+
+ x = m_rFactory->createInstance( L"com.sun.star.io.DataOutputStream" );
+ x->queryInterface( XDataOutputStream::getSmartUik() , rOutput );
+ x->queryInterface( XActiveDataSource::getSmartUik() , rSource );
+ }
+
+ assert( rPipeInput.is() );
+ assert( rPipeOutput.is() );
+ rSink->setInputStream( rPipeInput );
+ rSource->setOutputStream( rPipeOutput );
+
+ assert( rSink->getInputStream().is() );
+ assert( rSource->getOutputStream().is() );
+
+ if( 1 == hTestHandle ) {
+ testSimple( rInput , rOutput );
+ }
+ }
+ }
+ CATCH( Exception , e ) {
+ BUILD_ERROR( 0 , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() );
+ }
+ AND_CATCH_ALL() {
+ BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" );
+ }
+ END_CATCH;
+
+ hTestHandle ++;
+
+ if( hTestHandle >= 2) {
+ // all tests finished.
+ hTestHandle = -1;
+ }
+ }
+ else {
+ BUILD_ERROR( 0 , "service not supported by test." );
+ }
+ return hTestHandle;
+}
+
+
+
+BOOL ODataStreamTest::testPassed(void) THROWS( (UsrSystemException) )
+{
+ return m_seqErrors.getLen() == 0;
+}
+
+
+Sequence< UString > ODataStreamTest::getErrors(void) THROWS( (UsrSystemException) )
+{
+ return m_seqErrors;
+}
+
+
+Sequence< UsrAny > ODataStreamTest::getErrorExceptions(void) THROWS( (UsrSystemException) )
+{
+ return m_seqExceptions;
+}
+
+
+Sequence< UString > ODataStreamTest::getWarnings(void) THROWS( (UsrSystemException) )
+{
+ return m_seqWarnings;
+}
+
+void ODataStreamTest::testSimple( const XDataInputStreamRef &rInput,
+ const XDataOutputStreamRef &rOutput )
+{
+ rOutput->writeLong( 0x34ff3c );
+ rOutput->writeLong( 0x34ff3d );
+
+ ERROR_ASSERT( 0x34ff3c == rInput->readLong() , "long read/write mismatch" );
+ ERROR_ASSERT( 0x34ff3d == rInput->readLong() , "long read/write mismatch" );
+
+ rOutput->writeByte( 0x87 );
+ ERROR_ASSERT( 0x87 == rInput->readByte() , "byte read/write mismatch" );
+
+ rOutput->writeBoolean( 25 );
+ ERROR_ASSERT( rInput->readBoolean() , "boolean read/write mismatch" );
+
+ rOutput->writeBoolean( FALSE );
+ ERROR_ASSERT( ! rInput->readBoolean() , "boolean read/write mismatch" );
+
+ rOutput->writeFloat( (float) 42.42 );
+ ERROR_ASSERT( rInput->readFloat() == ((float)42.42) , "float read/write mismatch" );
+
+ rOutput->writeDouble( (double) 42.42 );
+ ERROR_ASSERT( rInput->readDouble() == 42.42 , "double read/write mismatch" );
+
+ rOutput->writeUTF( L"Live long and prosper !" );
+ ERROR_ASSERT( rInput->readUTF() == L"Live long and prosper !" ,
+ "UTF read/write mismatch" );
+
+ Sequence<wchar_t> wc(0x10001);
+ for( int i = 0 ; i < 0x10000 ; i ++ ) {
+ wc.getArray()[i] = L'c';
+ }
+ wc.getArray()[0x10000] = 0;
+ UString str( wc.getArray() , 0x10000 );
+ rOutput->writeUTF( str );
+ ERROR_ASSERT( rInput->readUTF() == str , "error reading 64k block" );
+
+ rOutput->closeOutput();
+ TRY {
+ rInput->readLong();
+ ERROR_ASSERT( 0 , "eof-exception does not occur !" );
+ }
+ CATCH ( IOException ,e ){
+ //ok
+ e.getName();
+ }
+ AND_CATCH_ALL() {
+ ERROR_ASSERT( 0 , "wrong exception after reading beyond eof" );
+ }
+ END_CATCH;
+
+ ERROR_ASSERT( ! rInput->readBytes( Sequence<BYTE> (1) , 1 ),
+ "stream must be on eof !" );
+
+ rInput->closeInput();
+
+ TRY {
+ rOutput->writeByte( 1 );
+ ERROR_ASSERT( 0 , "writing still possible though chain must be interrupted" );
+ }
+ CATCH( IOException , e )
+ {
+ e.getName();
+ // ok
+ }
+ AND_CATCH_ALL() {
+ ERROR_ASSERT( 0 , "IOException expected, but another exception was thrown" );
+ }
+ END_CATCH;
+
+}
+
+
+
+/**
+* for external binding
+*
+*
+**/
+XInterfaceRef ODataStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception))
+{
+ ODataStreamTest *p = new ODataStreamTest( rSMgr );
+ XInterfaceRef xService = *p;
+ return xService;
+}
+
+Sequence<UString> ODataStreamTest_getSupportedServiceNames( int i) THROWS( () )
+{
+ Sequence<UString> aRet(1);
+
+ aRet.getArray()[0] = ODataStreamTest_getImplementationName( i);
+
+
+ return aRet;
+}
+
+UString ODataStreamTest_getServiceName( int i) THROWS( () )
+{
+ if( 1 == i ) {
+ return L"test.com.sun.star.io.DataInputStream";
+ }
+ else {
+ return L"test.com.sun.star.io.DataOutputStream";
+ }
+}
+
+UString ODataStreamTest_getImplementationName( int i) THROWS( () )
+{
+ if( 1 == i ) {
+ return L"test.com.sun.star.comp.extensions.stm.DataInputStream";
+ }
+ else {
+ return L"test.com.sun.star.comp.extensions.stm.DataOutputStream";
+ }
+}
+
+
+/**------------------------------------------------------
+*
+*
+*
+*
+*
+*------------------------------------------------------*/
+class MyPersistObject :
+ public XPersistObject,
+ public XPropertySet,
+ public OWeakObject
+{
+public:
+ MyPersistObject( ) : m_sServiceName( OMyPersistObject_getServiceName() )
+ {}
+ MyPersistObject( const UString & sServiceName ) : m_sServiceName( sServiceName )
+ {}
+ ~MyPersistObject()
+ {}
+
+public:
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+public:
+ virtual UString getServiceName(void) const THROWS( (UsrSystemException) );
+ virtual void write(const XObjectOutputStreamRef& OutStream) THROWS( (IOException, UsrSystemException) );
+ virtual void read(const XObjectInputStreamRef& InStream) THROWS( (IOException, UsrSystemException) );
+
+public:
+
+ virtual XPropertySetInfoRef getPropertySetInfo(void) const THROWS( (UsrSystemException) );
+ virtual void setPropertyValue(const UString& aPropertyName, const UsrAny& aValue)
+ THROWS( ( UnknownPropertyException,
+ PropertyVetoException,
+ IllegalArgumentException,
+ WrappedTargetException,
+ UsrSystemException) );
+ virtual UsrAny getPropertyValue(const UString& PropertyName) const
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
+ UsrSystemException) );
+ virtual void addPropertyChangeListener( const UString& aPropertyName,
+ const XPropertyChangeListenerRef& xListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
+ UsrSystemException) );
+ virtual void removePropertyChangeListener( const UString& aPropertyName,
+ const XPropertyChangeListenerRef& aListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
+ UsrSystemException) );
+ virtual void addVetoableChangeListener( const UString& PropertyName,
+ const XVetoableChangeListenerRef& aListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
+ UsrSystemException) );
+ virtual void removeVetoableChangeListener( const UString& PropertyName,
+ const XVetoableChangeListenerRef& aListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
+ UsrSystemException) );
+
+public:
+ INT32 m_l;
+ float m_f;
+ double m_d;
+ BOOL m_b;
+ BYTE m_byte;
+ wchar_t m_c;
+ UString m_s;
+ XPersistObjectRef m_ref;
+ UString m_sServiceName;
+};
+
+
+
+XPropertySetInfoRef MyPersistObject::getPropertySetInfo(void) const THROWS( (UsrSystemException) )
+{
+ return XPropertySetInfoRef();
+}
+
+void MyPersistObject::setPropertyValue(const UString& aPropertyName, const UsrAny& aValue)
+ THROWS( ( UnknownPropertyException,
+ PropertyVetoException,
+ IllegalArgumentException,
+ WrappedTargetException,
+ UsrSystemException) )
+{
+ if( L"long" == aPropertyName ) {
+ m_l = aValue.getINT32();
+ }
+ else if ( L"float" == aPropertyName ) {
+ m_f = aValue.getFloat();
+ }
+ else if( L"double" == aPropertyName ) {
+ m_d = aValue.getDouble();
+ }
+ else if( L"bool" == aPropertyName ) {
+ m_b = aValue.getBOOL();
+ }
+ else if( L"byte" == aPropertyName ) {
+ m_byte = aValue.getBYTE();
+ }
+ else if( L"char" == aPropertyName ) {
+ m_c = aValue.getChar();
+ }
+ else if( L"string" == aPropertyName ) {
+ m_s = aValue.getString();
+ }
+ else if( L"object" == aPropertyName ) {
+ if( aValue.getReflection() == XPersistObject_getReflection() ) {
+ XPersistObjectRef *pRef = (XPersistObjectRef*) aValue.get();
+ if( pRef ) {
+ m_ref = *pRef;
+ }
+ else {
+ m_ref = 0;
+ }
+ }
+ else
+ {
+ m_ref = 0;
+ }
+ }
+}
+
+
+UsrAny MyPersistObject::getPropertyValue(const UString& aPropertyName) const
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
+ UsrSystemException) )
+{
+ UsrAny aValue;
+ if( L"long" == aPropertyName ) {
+ aValue.setINT32( m_l );
+ }
+ else if ( L"float" == aPropertyName ) {
+ aValue.setFloat( m_f );
+ }
+ else if( L"double" == aPropertyName ) {
+ aValue.setDouble( m_d );
+ }
+ else if( L"bool" == aPropertyName ) {
+ aValue.setBOOL( m_b );
+ }
+ else if( L"byte" == aPropertyName ) {
+ aValue.setBYTE( m_byte );
+ }
+ else if( L"char" == aPropertyName ) {
+ aValue.setChar( m_c );
+ }
+ else if( L"string" == aPropertyName ) {
+ aValue.setString( m_s );
+ }
+ else if( L"object" == aPropertyName ) {
+ aValue.set( &m_ref , XPersistObject_getReflection() );
+ }
+ return aValue;
+}
+
+
+void MyPersistObject::addPropertyChangeListener( const UString& aPropertyName,
+ const XPropertyChangeListenerRef& xListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
+ UsrSystemException) )
+{
+
+}
+
+void MyPersistObject::removePropertyChangeListener( const UString& aPropertyName,
+ const XPropertyChangeListenerRef& aListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
+ UsrSystemException) )
+{
+}
+void MyPersistObject::addVetoableChangeListener(const UString& PropertyName,
+ const XVetoableChangeListenerRef& aListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
+ UsrSystemException) )
+{
+
+}
+
+void MyPersistObject::removeVetoableChangeListener( const UString& PropertyName,
+ const XVetoableChangeListenerRef& aListener)
+ THROWS( ( UnknownPropertyException,
+ WrappedTargetException,
+ UsrSystemException) )
+{
+
+}
+
+
+
+BOOL MyPersistObject::queryInterface( Uik aUik , XInterfaceRef &rOut )
+{
+ if( XPersistObject::getSmartUik() == aUik ) {
+ rOut = ( XPersistObject * ) this;
+ }
+ else if( XPropertySet::getSmartUik() == aUik ) {
+ rOut = ( XPropertySet * ) this;
+ }
+ else
+ return OWeakObject::queryInterface( aUik , rOut );
+
+ return TRUE;
+}
+
+UString MyPersistObject::getServiceName() const THROWS( (UsrSystemException) )
+{
+ return m_sServiceName;
+}
+
+void MyPersistObject::write( const XObjectOutputStreamRef & rOut )
+ THROWS( (IOException,UsrSystemException))
+{
+ rOut->writeLong( m_l);
+ rOut->writeFloat( m_f );
+ rOut->writeDouble( m_d );
+ rOut->writeBoolean( m_b );
+ rOut->writeByte( m_byte );
+ rOut->writeChar( m_c );
+ rOut->writeUTF( m_s );
+ rOut->writeObject( m_ref );
+}
+
+
+void MyPersistObject::read( const XObjectInputStreamRef & rIn )
+ THROWS( (IOException, UsrSystemException) )
+{
+ m_l = rIn->readLong();
+ m_f = rIn->readFloat();
+ m_d = rIn->readDouble();
+ m_b = rIn->readBoolean();
+ m_byte = rIn->readByte();
+ m_c = rIn->readChar();
+ m_s = rIn->readUTF();
+ m_ref = rIn->readObject();
+}
+
+XInterfaceRef OMyPersistObject_CreateInstance( const XMultiServiceFactoryRef & rSMgr )
+ THROWS((Exception))
+{
+ MyPersistObject *p = new MyPersistObject( );
+ XInterfaceRef xService = *p;
+ return xService;
+}
+
+Sequence<UString> OMyPersistObject_getSupportedServiceNames( ) THROWS( () )
+{
+ Sequence<UString> aRet(1);
+ aRet.getArray()[0] = OMyPersistObject_getImplementationName();
+ return aRet;
+}
+
+UString OMyPersistObject_getServiceName( ) THROWS( () )
+{
+ return L"test.com.sun.star.io.PersistTest";
+}
+
+UString OMyPersistObject_getImplementationName( ) THROWS( () )
+{
+ return L"test.com.sun.star.io.PersistTest";
+}
+
+
+// ---------------------------------------------
+// -----------------------------------------------
+class OObjectStreamTest :
+ public ODataStreamTest
+{
+public:
+ OObjectStreamTest( const XMultiServiceFactoryRef &r) : ODataStreamTest(r) {}
+public: // refcounting
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+
+public:
+ virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject)
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+ virtual INT32 test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+
+private:
+ void OObjectStreamTest::testObject( const XObjectOutputStreamRef &rOut,
+ const XObjectInputStreamRef &rIn );
+
+private:
+};
+
+
+
+
+BOOL OObjectStreamTest::queryInterface( Uik uik , XInterfaceRef &rOut )
+{
+ if( XSimpleTest::getSmartUik() == uik ) {
+ rOut = (XSimpleTest *) this;
+ }
+ else {
+ return ODataStreamTest::queryInterface( uik , rOut );
+ }
+ return TRUE;
+}
+
+
+void OObjectStreamTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject )
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+
+
+ if( L"com.sun.star.io.ObjectInputStream" == TestName ) {
+ ODataStreamTest::testInvariant( TestName , TestObject );
+ XObjectInputStreamRef dataInput( TestObject , USR_QUERY );
+ XMarkableStreamRef markable( TestObject , USR_QUERY );
+ ERROR_ASSERT( dataInput.is() , "XObjectInputStream cannot be queried" );
+ ERROR_ASSERT( markable.is() , "XMarkableStream cannot be queried" );
+ }
+ else if( L"com.sun.star.io.ObjectOutputStream" == TestName ) {
+ ODataStreamTest::testInvariant( TestName , TestObject );
+ XMarkableStreamRef markable( TestObject , USR_QUERY );
+ XObjectOutputStreamRef dataOutput( TestObject , USR_QUERY );
+ ERROR_ASSERT( dataOutput.is(), "XObjectOutputStream cannot be queried" );
+ ERROR_ASSERT( markable.is() , "XMarkableStream cannot be queried" );
+ }
+
+ XServiceInfoRef info( TestObject, USR_QUERY );
+ ERROR_ASSERT( info.is() , "XServiceInfo not supported !" );
+ if( info.is() )
+ {
+ ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" );
+ ERROR_ASSERT( ! info->supportsService( L"bla bluzb" ) , "XServiceInfo test failed" );
+ }
+
+}
+
+INT32 OObjectStreamTest::test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+ if( L"com.sun.star.io.ObjectInputStream" == TestName ||
+ L"com.sun.star.io.ObjectOutputStream" == TestName ) {
+
+ TRY {
+ if( 0 == hTestHandle ) {
+ testInvariant( TestName , TestObject );
+ }
+ else if( DATASTREAM_TEST_MAX_HANDLE >= hTestHandle ) {
+ INT32 hOldHandle = hTestHandle;
+ hTestHandle = ODataStreamTest::test( L"com.sun.star.io.DataInputStream" ,
+ TestObject , hTestHandle );
+ if( hTestHandle == -1 ){
+ hTestHandle = hOldHandle;
+ }
+ }
+ else {
+
+ XActiveDataSinkRef rSink( TestObject, USR_QUERY );
+ XActiveDataSourceRef rSource( TestObject , USR_QUERY );
+
+ XObjectInputStreamRef rInput( TestObject , USR_QUERY );
+ XObjectOutputStreamRef rOutput( TestObject , USR_QUERY );
+
+
+ XInterfaceRef x = m_rFactory->createInstance( L"com.sun.star.io.Pipe");
+
+ XInputStreamRef rPipeInput( x , USR_QUERY );
+ XOutputStreamRef rPipeOutput( x , USR_QUERY );
+
+ x = m_rFactory->createInstance( L"com.sun.star.io.MarkableInputStream" );
+ XInputStreamRef markableInput( x , USR_QUERY );
+ XActiveDataSinkRef markableSink( x , USR_QUERY );
+
+ x = m_rFactory->createInstance( L"com.sun.star.io.MarkableOutputStream" );
+ XOutputStreamRef markableOutput( x , USR_QUERY );
+ XActiveDataSourceRef markableSource( x , USR_QUERY );
+
+ assert( markableInput.is() );
+ assert( markableOutput.is() );
+ assert( markableSink.is() );
+ assert( markableSource.is() );
+
+ markableSink->setInputStream( rPipeInput );
+ markableSource->setOutputStream( rPipeOutput );
+
+ if( ! rSink.is() ) {
+ x = m_rFactory->createInstance( L"com.sun.star.io.ObjectInputStream" );
+ x->queryInterface( XObjectInputStream::getSmartUik() , rInput );
+ x->queryInterface( XActiveDataSink::getSmartUik() , rSink );
+ }
+ else if ( !rSource.is() ) {
+ x = m_rFactory->createInstance( L"com.sun.star.io.ObjectOutputStream" );
+ x->queryInterface( XObjectOutputStream::getSmartUik() , rOutput );
+ x->queryInterface( XActiveDataSource::getSmartUik() , rSource );
+ }
+
+ assert( rPipeInput.is() );
+ assert( rPipeOutput.is() );
+
+ rSink->setInputStream( markableInput );
+ rSource->setOutputStream( markableOutput );
+
+ assert( rSink->getInputStream().is() );
+ assert( rSource->getOutputStream().is() );
+
+ if( 1 + DATASTREAM_TEST_MAX_HANDLE == hTestHandle ) {
+ testObject( rOutput , rInput);
+ }
+ rInput->closeInput();
+ rOutput->closeOutput();
+
+ }
+ }
+ CATCH( Exception , e ) {
+ BUILD_ERROR( 0 , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() );
+ }
+ AND_CATCH_ALL() {
+ BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" );
+ }
+ END_CATCH;
+
+ hTestHandle ++;
+
+ if( hTestHandle > 1 +DATASTREAM_TEST_MAX_HANDLE ) {
+ // all tests finished.
+ hTestHandle = -1;
+ }
+ }
+ else {
+ BUILD_ERROR( 0 , "service not supported by test." );
+ }
+ return hTestHandle;
+}
+
+
+BOOL compareMyPropertySet( XPropertySetRef &r1 , XPropertySetRef &r2 )
+{
+ BOOL b = TRUE;
+
+ if( r1->getPropertyValue( L"long" ).getReflection() == Void_getReflection() ||
+ r2->getPropertyValue( L"long" ).getReflection() == Void_getReflection() ) {
+
+ // one of the objects is not the correct propertyset !
+ return FALSE;
+ }
+
+ b = b && ( r1->getPropertyValue( L"long" ).getINT32() ==
+ r2->getPropertyValue( L"long" ).getINT32() );
+
+ b = b && ( r1->getPropertyValue( L"float" ).getFloat() ==
+ r2->getPropertyValue( L"float" ).getFloat() );
+
+ b = b && ( r1->getPropertyValue( L"double" ).getDouble() ==
+ r2->getPropertyValue( L"double" ).getDouble() );
+
+ b = b && ( r1->getPropertyValue( L"bool" ).getBOOL() ==
+ r2->getPropertyValue( L"bool" ).getBOOL() );
+
+ b = b && ( r1->getPropertyValue( L"byte" ).getBYTE() ==
+ r2->getPropertyValue( L"byte" ).getBYTE() );
+
+ b = b && ( r1->getPropertyValue( L"char" ).getChar() ==
+ r2->getPropertyValue( L"char" ).getChar() );
+
+ b = b && ( r1->getPropertyValue( L"string" ).getString() ==
+ r2->getPropertyValue( L"string" ).getString() );
+
+ UsrAny o1 = r1->getPropertyValue( L"object" );
+ UsrAny o2 = r2->getPropertyValue( L"object" );
+
+ if( o1.getReflection() == XPersistObject_getReflection() ) {
+
+ if( o2.getReflection() == XPersistObject_getReflection() ) {
+ XPersistObjectRef rPersist1 = *((XPersistObjectRef*) o1.get());
+ XPersistObjectRef rPersist2 = *((XPersistObjectRef*) o2.get());
+ XPropertySetRef rProp1( rPersist1 , USR_QUERY );
+ XPropertySetRef rProp2( rPersist2 , USR_QUERY );
+
+ if( rProp1.is() && rProp2.is() && ! ( rProp1 == rProp2 )
+ &&( rProp1 != r1 )) {
+ compareMyPropertySet( rProp1 , rProp2 );
+ }
+ }
+ else {
+ b = FALSE;
+ }
+ }
+ else {
+ if( o2.getReflection() == XPersistObject_getReflection() ) {
+ b = FALSE;
+ }
+ }
+
+ return b;
+}
+
+void OObjectStreamTest::testObject( const XObjectOutputStreamRef &rOut,
+ const XObjectInputStreamRef &rIn )
+{
+ ERROR_ASSERT( rOut.is() , "no objectOutputStream" );
+ ERROR_ASSERT( rIn.is() , "no objectInputStream" );
+
+ XMultiServiceFactoryRef xProv = getProcessServiceManager();
+ ERROR_ASSERT( xProv.is() , "no global service manager" );
+
+
+ // tests, if saving an object with an unknown service name allows
+ // reading the data behind the object !
+ {
+ XInterfaceRef x = * new MyPersistObject( L"bla blubs" );
+
+ XPersistObjectRef persistRef( x , USR_QUERY );
+ ERROR_ASSERT( persistRef.is() , "couldn't instantiate PersistTest object" );
+
+ rOut->writeObject( persistRef );
+ rOut->writeLong( (INT32) 0xdeadbeef );
+
+ ERROR_ASSERT( 0 != rIn->available() , "no data arrived at input" );
+
+ TRY
+ {
+ XPersistObjectRef xReadPersistRef = rIn->readObject();
+ ERROR_ASSERT( 0 , "expected exception not thrown" );
+ }
+ CATCH( IOException , e )
+ {
+ // all is ok
+ }
+
+ ERROR_ASSERT( (INT32) 0xdeadbeef == rIn->readLong() ,
+ "wrong data after object with unknown service name." );
+ }
+
+ {
+ XInterfaceRef x = xProv->createInstance(L"test.com.sun.star.io.PersistTest");
+ XPersistObjectRef persistRef( x , USR_QUERY );
+
+ ERROR_ASSERT( persistRef.is() , "couldn't instantiate PersistTest object" );
+
+ XPropertySetRef rProp( persistRef , USR_QUERY );
+ ERROR_ASSERT( rProp.is() , "test object is no property set " );
+
+ UsrAny any;
+ any.setINT32( 0x83482 );
+ rProp->setPropertyValue( L"long" , any );
+
+ any.setFloat( 42.23 );
+ rProp->setPropertyValue( L"float" , any );
+
+ any.setDouble( 233.321412 );
+ rProp->setPropertyValue( L"double" , any );
+
+ any.setBOOL( TRUE );
+ rProp->setPropertyValue( L"bool" , any );
+
+ any.setBYTE( 130 );
+ rProp->setPropertyValue( L"byte" , any );
+
+ any.setChar( 'h' );
+ rProp->setPropertyValue( L"char" , any );
+
+ any.setString( L"hi du !" );
+ rProp->setPropertyValue( L"string" , any );
+
+ any.set( &persistRef, XPersistObject_getReflection() ); // try a self reference
+ rProp->setPropertyValue( L"object" , any );
+
+ // do read and write
+ rOut->writeObject( persistRef );
+ ERROR_ASSERT( 0 != rIn->available() , "no data arrived at input" );
+ XPersistObjectRef xReadPersistRef = rIn->readObject( );
+
+ XPropertySetRef rPropRead( xReadPersistRef , USR_QUERY );
+ ERROR_ASSERT( compareMyPropertySet( rProp , rPropRead ) , "objects has not been read properly !" );
+
+ // destroy selfreferences
+ rProp->setPropertyValue( L"object", UsrAny() );
+ rPropRead->setPropertyValue( L"object", UsrAny() );
+ }
+
+ {
+ XMarkableStreamRef markableOut( rOut , USR_QUERY );
+ ERROR_ASSERT( markableOut.is() , "markable stream cannot be queried" );
+
+ // do the same thing multiple times to check if
+ // buffering and marks work correctly
+ for( int i = 0 ; i < 2000 ; i ++ ) {
+
+ XInterfaceRef x = xProv->createInstance(L"test.com.sun.star.io.PersistTest");
+ XPersistObjectRef persistRef( x , USR_QUERY );
+
+ XPropertySetRef rProp( persistRef , USR_QUERY );
+ ERROR_ASSERT( rProp.is() , "test object is no property set " );
+
+ UsrAny any;
+ any.setINT32( 0x83482 );
+ rProp->setPropertyValue( L"long" , any );
+
+ any.setFloat( 42.23 );
+ rProp->setPropertyValue( L"float" , any );
+
+ any.setDouble( 233.321412 );
+ rProp->setPropertyValue( L"double" , any );
+
+ any.setBOOL( TRUE );
+ rProp->setPropertyValue( L"bool" , any );
+
+ any.setBYTE( 130 );
+ rProp->setPropertyValue( L"byte" , any );
+
+ any.setChar( 'h' );
+ rProp->setPropertyValue( L"char" , any );
+
+ any.setString( L"hi du !" );
+ rProp->setPropertyValue( L"string" , any );
+
+
+ x = xProv->createInstance(L"test.com.sun.star.io.PersistTest");
+ XPersistObjectRef persist2ndRef( x , USR_QUERY );
+
+
+ // Note : persist2ndRef contains coincident values, but also coincident values must be
+ // saved properly !
+ any.set( &persist2ndRef, XPersistObject_getReflection() ); // try a self reference
+ rProp->setPropertyValue( L"object" , any );
+
+ // simply test, if markable operations and object operations do not interfere
+ INT32 nMark = markableOut->createMark();
+
+ // do read and write
+ rOut->writeObject( persistRef );
+
+ // further markable tests !
+ INT32 nOffset = markableOut->offsetToMark( nMark );
+ markableOut->jumpToMark( nMark );
+ markableOut->deleteMark( nMark );
+ markableOut->jumpToFurthest();
+
+
+
+
+
+ ERROR_ASSERT( 0 != rIn->available() , "no data arrived at input" );
+ XPersistObjectRef xReadPersistRef = rIn->readObject( );
+
+ XPropertySetRef rProp1( persistRef , USR_QUERY );
+ XPropertySetRef rProp2( xReadPersistRef , USR_QUERY );
+ ERROR_ASSERT( compareMyPropertySet( rProp1, rProp2) , "objects has not been read properly !" );
+ }
+ }
+}
+
+
+XInterfaceRef OObjectStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception))
+{
+ OObjectStreamTest *p = new OObjectStreamTest( rSMgr );
+ XInterfaceRef xService = *p;
+ return xService;
+}
+
+Sequence<UString> OObjectStreamTest_getSupportedServiceNames( int i) THROWS( () )
+{
+ Sequence<UString> aRet(1);
+ aRet.getArray()[0] = OObjectStreamTest_getImplementationName( i);
+ return aRet;
+}
+
+UString OObjectStreamTest_getServiceName( int i) THROWS( () )
+{
+ if( 1 == i ) {
+ return L"test.com.sun.star.io.ObjectInputStream";
+ }
+ else {
+ return L"test.com.sun.star.io.ObjectOutputStream";
+ }
+}
+
+UString OObjectStreamTest_getImplementationName( int i) THROWS( () )
+{
+ if( 1 == i ) {
+ return L"test.com.sun.star.comp.extensions.stm.ObjectInputStream";
+ }
+ else {
+ return L"test.com.sun.star.comp.extensions.stm.ObjectOutputStream";
+ }
+}
+
+
diff --git a/extensions/test/stm/exports.dxp b/extensions/test/stm/exports.dxp
new file mode 100644
index 000000000..e4bc69d23
--- /dev/null
+++ b/extensions/test/stm/exports.dxp
@@ -0,0 +1,2 @@
+exService_writeRegEntry
+exService_getFactory
diff --git a/extensions/test/stm/makefile.mk b/extensions/test/stm/makefile.mk
new file mode 100644
index 000000000..f2781bca5
--- /dev/null
+++ b/extensions/test/stm/makefile.mk
@@ -0,0 +1,99 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=extensions
+TARGET=teststm
+USE_DEFFILE=TRUE
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+OBJFILES= $(SLO)$/pipetest.obj $(SLO)$/testfactreg.obj $(SLO)$/datatest.obj \
+ $(SLO)$/marktest.obj
+CXXFILES = pipetest.cxx testfactreg.cxx datatest.cxx marktest.cxx
+
+SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+
+SHL1STDLIBS= \
+ $(USRLIB) \
+ $(VOSLIB) \
+ $(SALLIB) \
+ $(TOOLSLIB)
+
+LIB1OBJFILES= $(OBJFILES)
+SHL1LIBS= $(LIB1TARGET)
+SHL1IMPLIB= i$(TARGET)
+SHL1DEPN= makefile.mk $(SHL1LIBS)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME= $(SHL1TARGET)
+DEF1EXPORTFILE= exports.dxp
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
diff --git a/extensions/test/stm/marktest.cxx b/extensions/test/stm/marktest.cxx
new file mode 100644
index 000000000..34569f20b
--- /dev/null
+++ b/extensions/test/stm/marktest.cxx
@@ -0,0 +1,718 @@
+/*************************************************************************
+ *
+ * $RCSfile: marktest.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <smart/com/sun/star/test/XSimpleTest.hxx>
+#include <smart/com/sun/star/io/XMarkableStream.hxx>
+#include <smart/com/sun/star/io/XActiveDataSink.hxx>
+#include <smart/com/sun/star/io/XActiveDataSource.hxx>
+#include <smart/com/sun/star/io/XConnectable.hxx>
+
+#include <smart/com/sun/star/lang/XServiceInfo.hxx>
+
+
+#include <usr/factoryhlp.hxx>
+
+#include <usr/reflserv.hxx> // for EXTERN_SERVICE_CALLTYPE
+#include <usr/weak.hxx> // OWeakObject
+
+#include <vos/conditn.hxx>
+#include <vos/mutex.hxx>
+#include <vos/thread.hxx>
+
+#include <assert.h>
+#include <string.h>
+
+#include "testfactreg.hxx"
+
+
+#ifndef _VOS_NO_NAMESPACE
+using namespace vos;
+using namespace usr;
+#endif
+
+
+
+class OMarkableOutputStreamTest :
+ public XSimpleTest,
+ public OWeakObject
+{
+public:
+ OMarkableOutputStreamTest( const XMultiServiceFactoryRef & rFactory );
+ ~OMarkableOutputStreamTest();
+
+public: // refcounting
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+public: // implementation names
+ static Sequence< UString > getSupportedServiceNames_Static(void) THROWS( () );
+ static UString getImplementationName_Static() THROWS( () );
+
+public:
+ virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject)
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+ virtual INT32 test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+ virtual BOOL testPassed(void) THROWS( ( UsrSystemException) );
+ virtual Sequence< UString > getErrors(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UsrAny > getErrorExceptions(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UString > getWarnings(void) THROWS( (UsrSystemException) );
+
+private:
+ void testSimple( const XOutputStreamRef &r, const XInputStreamRef &rInput );
+
+private:
+ Sequence<UsrAny> m_seqExceptions;
+ Sequence<UString> m_seqErrors;
+ Sequence<UString> m_seqWarnings;
+ XMultiServiceFactoryRef m_rFactory;
+
+};
+
+OMarkableOutputStreamTest::OMarkableOutputStreamTest( const XMultiServiceFactoryRef &rFactory )
+ : m_rFactory( rFactory )
+{
+
+}
+
+OMarkableOutputStreamTest::~OMarkableOutputStreamTest()
+{
+
+}
+
+
+BOOL OMarkableOutputStreamTest::queryInterface( Uik uik , XInterfaceRef &rOut )
+{
+ if( XSimpleTest::getSmartUik() == uik ) {
+ rOut = (XSimpleTest *) this;
+ }
+ else {
+ return OWeakObject::queryInterface( uik , rOut );
+ }
+ return TRUE;
+}
+
+
+void OMarkableOutputStreamTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject )
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+ XServiceInfoRef info( TestObject, USR_QUERY );
+ ERROR_ASSERT( info.is() , "XServiceInfo not supported !" );
+ if( info.is() )
+ {
+ ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" );
+ ERROR_ASSERT( ! info->supportsService( L"bla bluzb" ) , "XServiceInfo test failed" );
+ }
+}
+
+
+INT32 OMarkableOutputStreamTest::test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+ if( L"com.sun.star.io.MarkableOutputStream" == TestName ) {
+ TRY {
+ if( 0 == hTestHandle ) {
+ testInvariant( TestName , TestObject );
+ }
+ else {
+ XInterfaceRef x = m_rFactory->createInstance( L"com.sun.star.io.Pipe");
+ XOutputStreamRef rPipeOutput( x , USR_QUERY );
+ XInputStreamRef rPipeInput( x , USR_QUERY );
+
+ XActiveDataSourceRef source( TestObject , USR_QUERY );
+ source->setOutputStream( rPipeOutput );
+
+ XOutputStreamRef rOutput( TestObject , USR_QUERY );
+
+ assert( rPipeInput.is() );
+ assert( rOutput.is() );
+ if( 1 == hTestHandle ) {
+ // checks usual streaming
+ testSimple( rOutput , rPipeInput );
+ }
+ }
+
+ }
+ CATCH( Exception , e ) {
+ BUILD_ERROR( 0 , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() );
+ }
+ AND_CATCH_ALL() {
+ BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" );
+ }
+ END_CATCH;
+
+ hTestHandle ++;
+
+ if( 2 == hTestHandle ) {
+ // all tests finished.
+ hTestHandle = -1;
+ }
+ }
+ else {
+ THROW( IllegalArgumentException() );
+ }
+ return hTestHandle;
+}
+
+
+
+BOOL OMarkableOutputStreamTest::testPassed(void) THROWS( (UsrSystemException) )
+{
+ return m_seqErrors.getLen() == 0;
+}
+
+
+Sequence< UString > OMarkableOutputStreamTest::getErrors(void) THROWS( (UsrSystemException) )
+{
+ return m_seqErrors;
+}
+
+
+Sequence< UsrAny > OMarkableOutputStreamTest::getErrorExceptions(void) THROWS( (UsrSystemException) )
+{
+ return m_seqExceptions;
+}
+
+
+Sequence< UString > OMarkableOutputStreamTest::getWarnings(void) THROWS( (UsrSystemException) )
+{
+ return m_seqWarnings;
+}
+
+
+void OMarkableOutputStreamTest::testSimple( const XOutputStreamRef &rOutput ,
+ const XInputStreamRef &rInput )
+{
+ XMarkableStreamRef rMarkable( rOutput , USR_QUERY );
+
+ ERROR_ASSERT( rMarkable.is() , "no MarkableStream implemented" );
+
+ // first check normal input/output facility
+ char pcStr[] = "Live long and prosper !";
+
+ Sequence<BYTE> seqWrite( strlen( pcStr )+1 );
+ memcpy( seqWrite.getArray() , pcStr , seqWrite.getLen() );
+
+ Sequence<BYTE> seqRead( seqWrite.getLen() );
+
+ int nMax = 10,i;
+
+ for( i = 0 ; i < nMax ; i ++ ) {
+ rOutput->writeBytes( seqWrite );
+ rInput->readBytes( seqRead , rInput->available() );
+ ERROR_ASSERT( ! strcmp( (char *) seqWrite.getArray() , (char * )seqRead.getArray() ) ,
+ "error during read/write/skip" );
+ }
+
+ // Check buffer resizing
+ nMax = 3000;
+ for( i = 0 ; i < nMax ; i ++ ) {
+ rOutput->writeBytes( seqWrite );
+ }
+
+ for( i = 0 ; i < nMax ; i ++ ) {
+ rInput->readBytes( seqRead , seqWrite.getLen() );
+ ERROR_ASSERT( ! strcmp( (char *) seqWrite.getArray() , (char * )seqRead.getArray() ) ,
+ "error during read/write" );
+ }
+
+ // Check creating marks !
+ INT32 nMark = rMarkable->createMark();
+
+ for( i = 0 ; i < nMax ; i ++ ) {
+ rOutput->writeBytes( seqWrite );
+ }
+
+ ERROR_ASSERT( 0 == rInput->available() , "bytes available though mark is holded" );
+
+ ERROR_ASSERT( nMax*seqWrite.getLen() == rMarkable->offsetToMark( nMark ) ,
+ "offsetToMark failure" );
+
+ rMarkable->deleteMark( nMark );
+ ERROR_ASSERT( nMax*seqWrite.getLen() == rInput->available(),"bytes are not available though mark has been deleted" );
+
+ rInput->skipBytes( nMax*seqWrite.getLen() );
+ ERROR_ASSERT( 0 == rInput->available(), "skip bytes failure" );
+
+ TRY {
+ rMarkable->jumpToMark( nMark );
+ ERROR_ASSERT( 0 , "jump to non existing mark possible !" );
+ }
+ CATCH ( IllegalArgumentException , e )
+ {
+ e;// ok, exception was thrown
+ }
+ END_CATCH;
+
+ // test putting marks not at the end of the stream!
+ ERROR_ASSERT( 0 == rInput->available(), "stream isn't clean" );
+ {
+ Sequence< BYTE > aByte(256);
+
+ for( i = 0 ; i < 256 ; i ++ )
+ {
+ aByte.getArray()[i] = i;
+ }
+ INT32 nMark1 = rMarkable->createMark();
+
+ rOutput->writeBytes( aByte );
+ rMarkable->jumpToMark( nMark1 );
+ aByte.realloc( 10 );
+ rOutput->writeBytes( aByte );
+
+ INT32 nMark2 = rMarkable->createMark( );
+
+ for( i = 0 ; i < 10 ; i ++ )
+ {
+ aByte.getArray()[i] = i+10;
+ }
+
+ rOutput->writeBytes( aByte );
+
+ // allow the bytes to be written !
+ rMarkable->jumpToFurthest();
+ rMarkable->deleteMark( nMark1 );
+ rMarkable->deleteMark( nMark2 );
+
+ ERROR_ASSERT( 256 == rInput->available(), "in between mark failure" );
+ rInput->readBytes( aByte ,256);
+ for( i = 0 ; i < 256 ; i ++ )
+ {
+ ERROR_ASSERT( i == aByte.getArray()[i] , "in between mark failure" );
+ }
+ }
+
+ {
+ // now a more extensive mark test !
+ Sequence<BYTE> as[4];
+ INT32 an[4];
+
+ for( i = 0 ; i < 4 ; i ++ ) {
+ as[i].realloc(1);
+ as[i].getArray()[0] = i;
+ an[i] = rMarkable->createMark();
+ rOutput->writeBytes( as[i] );
+ }
+
+ // check offset to mark
+ for( i = 0 ; i < 4 ; i ++ ) {
+ ERROR_ASSERT( rMarkable->offsetToMark( an[i] ) == 4-i , "offsetToMark failure" );
+ }
+
+ rMarkable->jumpToMark( an[1] );
+ ERROR_ASSERT( rMarkable->offsetToMark( an[3] ) == -2 , "offsetToMark failure" );
+
+ rMarkable->jumpToFurthest( );
+ ERROR_ASSERT( rMarkable->offsetToMark( an[0] ) == 4 , "offsetToMark failure" );
+
+ // now do a rewrite !
+ for( i = 0 ; i < 4 ; i ++ ) {
+ rMarkable->jumpToMark( an[3-i] );
+ rOutput->writeBytes( as[i] );
+ }
+ // NOTE : CursorPos 1
+
+ // now delete the marks !
+ for( i = 0 ; i < 4 ; i ++ ) {
+ rMarkable->deleteMark( an[i] );
+ }
+ ERROR_ASSERT( rInput->available() == 1 , "wrong number of bytes flushed" );
+
+ rMarkable->jumpToFurthest();
+
+ ERROR_ASSERT( rInput->available() == 4 , "wrong number of bytes flushed" );
+
+ rInput->readBytes( seqRead , 4 );
+
+ ERROR_ASSERT( 3 == seqRead.getArray()[0] , "rewrite didn't work" );
+ ERROR_ASSERT( 2 == seqRead.getArray()[1] , "rewrite didn't work" );
+ ERROR_ASSERT( 1 == seqRead.getArray()[2] , "rewrite didn't work" );
+ ERROR_ASSERT( 0 == seqRead.getArray()[3] , "rewrite didn't work" );
+
+ rOutput->closeOutput();
+ rInput->closeInput();
+ }
+
+}
+
+/***
+* the test methods
+*
+****/
+
+
+
+
+
+/**
+* for external binding
+*
+*
+**/
+XInterfaceRef OMarkableOutputStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception))
+{
+ OMarkableOutputStreamTest *p = new OMarkableOutputStreamTest( rSMgr );
+ XInterfaceRef xService = *p;
+ return xService;
+}
+
+
+
+Sequence<UString> OMarkableOutputStreamTest_getSupportedServiceNames(void) THROWS( () )
+{
+ Sequence<UString> aRet(1);
+ aRet.getArray()[0] = OMarkableOutputStreamTest_getImplementationName();
+
+ return aRet;
+}
+
+UString OMarkableOutputStreamTest_getServiceName() THROWS( () )
+{
+ return L"test.com.sun.star.io.MarkableOutputStream";
+}
+
+UString OMarkableOutputStreamTest_getImplementationName() THROWS( () )
+{
+ return L"test.com.sun.starextensions.stm.MarkableOutputStream";
+}
+
+
+
+
+
+
+
+//-----------------------------------------------------
+// Input stream
+
+
+class OMarkableInputStreamTest :
+ public XSimpleTest,
+ public OWeakObject
+{
+public:
+ OMarkableInputStreamTest( const XMultiServiceFactoryRef & rFactory );
+ ~OMarkableInputStreamTest();
+
+public: // refcounting
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+public: // implementation names
+ static Sequence< UString > getSupportedServiceNames_Static(void) THROWS( () );
+ static UString getImplementationName_Static() THROWS( () );
+
+public:
+ virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject)
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+ virtual INT32 test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+ virtual BOOL testPassed(void) THROWS( ( UsrSystemException) );
+ virtual Sequence< UString > getErrors(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UsrAny > getErrorExceptions(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UString > getWarnings(void) THROWS( (UsrSystemException) );
+
+private:
+ void testSimple( const XOutputStreamRef &r, const XInputStreamRef &rInput );
+
+private:
+ Sequence<UsrAny> m_seqExceptions;
+ Sequence<UString> m_seqErrors;
+ Sequence<UString> m_seqWarnings;
+ XMultiServiceFactoryRef m_rFactory;
+
+};
+
+OMarkableInputStreamTest::OMarkableInputStreamTest( const XMultiServiceFactoryRef &rFactory )
+ : m_rFactory( rFactory )
+{
+
+}
+
+OMarkableInputStreamTest::~OMarkableInputStreamTest()
+{
+
+}
+
+
+BOOL OMarkableInputStreamTest::queryInterface( Uik uik , XInterfaceRef &rOut )
+{
+ if( XSimpleTest::getSmartUik() == uik ) {
+ rOut = (XSimpleTest *) this;
+ }
+ else {
+ return OWeakObject::queryInterface( uik , rOut );
+ }
+ return TRUE;
+}
+
+
+void OMarkableInputStreamTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject )
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+ if( L"com.sun.star.io.MarkableInputStream" == TestName ) {
+ XServiceInfoRef info( TestObject, USR_QUERY );
+ ERROR_ASSERT( info.is() , "XServiceInfo not supported !" );
+ if( info.is() )
+ {
+ ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" );
+ ERROR_ASSERT( ! info->supportsService( L"bla bluzb" ) , "XServiceInfo test failed" );
+ }
+ }
+ else {
+ THROW( IllegalArgumentException() );
+ }
+}
+
+
+INT32 OMarkableInputStreamTest::test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+ if( L"com.sun.star.io.MarkableInputStream" == TestName ) {
+ TRY {
+ if( 0 == hTestHandle ) {
+ testInvariant( TestName , TestObject );
+ }
+ else {
+ XInterfaceRef x = m_rFactory->createInstance( L"com.sun.star.io.Pipe");
+ XOutputStreamRef rPipeOutput( x , USR_QUERY );
+ XInputStreamRef rPipeInput( x , USR_QUERY );
+
+ XActiveDataSinkRef sink( TestObject , USR_QUERY );
+ sink->setInputStream( rPipeInput );
+
+ XInputStreamRef rInput( TestObject , USR_QUERY );
+
+ assert( rPipeOutput.is() );
+ assert( rInput.is() );
+ if( 1 == hTestHandle ) {
+ // checks usual streaming
+ testSimple( rPipeOutput , rInput );
+ }
+ }
+
+ }
+ CATCH( Exception , e ) {
+ BUILD_ERROR( 0 , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() );
+ }
+ AND_CATCH_ALL() {
+ BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" );
+ }
+ END_CATCH;
+
+ hTestHandle ++;
+
+ if( 2 == hTestHandle ) {
+ // all tests finished.
+ hTestHandle = -1;
+ }
+ }
+ else {
+ THROW( IllegalArgumentException() );
+ }
+ return hTestHandle;
+}
+
+
+
+BOOL OMarkableInputStreamTest::testPassed(void) THROWS( (UsrSystemException) )
+{
+ return m_seqErrors.getLen() == 0;
+}
+
+
+Sequence< UString > OMarkableInputStreamTest::getErrors(void) THROWS( (UsrSystemException) )
+{
+ return m_seqErrors;
+}
+
+
+Sequence< UsrAny > OMarkableInputStreamTest::getErrorExceptions(void) THROWS( (UsrSystemException) )
+{
+ return m_seqExceptions;
+}
+
+
+Sequence< UString > OMarkableInputStreamTest::getWarnings(void) THROWS( (UsrSystemException) )
+{
+ return m_seqWarnings;
+}
+
+
+void OMarkableInputStreamTest::testSimple( const XOutputStreamRef &rOutput ,
+ const XInputStreamRef &rInput )
+{
+ XMarkableStreamRef rMarkable( rInput , USR_QUERY );
+
+ Sequence<BYTE> seqWrite( 256 );
+ Sequence<BYTE> seqRead(10);
+
+ for( int i = 0 ; i < 256 ; i ++ )
+ {
+ seqWrite.getArray()[i] = i;
+ }
+
+ rOutput->writeBytes( seqWrite );
+ ERROR_ASSERT( 256 == rInput->available() , "basic read/write failure" );
+
+ rInput->readBytes( seqRead , 10 );
+ ERROR_ASSERT( 9 == seqRead.getArray()[9] , "basic read/write failure" );
+
+ INT32 nMark = rMarkable->createMark();
+
+ rInput->skipBytes( 50 );
+ ERROR_ASSERT( 256-10-50 == rInput->available() , "marking error" );
+ ERROR_ASSERT( 50 == rMarkable->offsetToMark( nMark ) , "marking error" );
+
+ rMarkable->jumpToMark( nMark );
+ ERROR_ASSERT( 256-10 == rInput->available() , "marking error" );
+
+ rInput->readBytes( seqRead , 10 );
+ ERROR_ASSERT( 10 == seqRead.getArray()[0] , "marking error" );
+
+ // pos 20
+ {
+ INT32 nInBetweenMark = rMarkable->createMark( );
+ rMarkable->jumpToMark( nMark );
+ rMarkable->jumpToMark( nInBetweenMark );
+
+ rInput->readBytes( seqRead , 10 );
+ ERROR_ASSERT( 20 == seqRead.getArray()[0] , "Inbetween mark failed!\n" );
+
+ rMarkable->deleteMark( nMark );
+
+ // Check if releasing the first bytes works correct.
+ rMarkable->jumpToMark( nInBetweenMark);
+ rInput->readBytes( seqRead , 10 );
+ ERROR_ASSERT( 20 == seqRead.getArray()[0] , "Inbetween mark failed!\n" );
+
+ rMarkable->deleteMark( nInBetweenMark );
+ }
+
+ rMarkable->jumpToFurthest();
+ ERROR_ASSERT( 256-10-50 == rInput->available() , "marking error" );
+
+
+ ERROR_ASSERT( 100 == rInput->readSomeBytes( seqRead , 100 ) , "wrong results using readSomeBytes" );
+ ERROR_ASSERT( 96 == rInput->readSomeBytes( seqRead , 1000) , "wrong results using readSomeBytes" );
+ rOutput->closeOutput();
+ rInput->closeInput();
+}
+
+/***
+* the test methods
+*
+****/
+
+
+
+
+
+/**
+* for external binding
+*
+*
+**/
+XInterfaceRef OMarkableInputStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception))
+{
+ OMarkableInputStreamTest *p = new OMarkableInputStreamTest( rSMgr );
+ XInterfaceRef xService = *p;
+ return xService;
+}
+
+
+
+Sequence<UString> OMarkableInputStreamTest_getSupportedServiceNames(void) THROWS( () )
+{
+ Sequence<UString> aRet(1);
+ aRet.getArray()[0] = OMarkableInputStreamTest_getImplementationName();
+
+ return aRet;
+}
+
+UString OMarkableInputStreamTest_getServiceName() THROWS( () )
+{
+ return L"test.com.sun.star.io.MarkableInputStream";
+}
+
+UString OMarkableInputStreamTest_getImplementationName() THROWS( () )
+{
+ return L"test.com.sun.star.extensions.stm.MarkableInputStream";
+}
diff --git a/extensions/test/stm/pipetest.cxx b/extensions/test/stm/pipetest.cxx
new file mode 100644
index 000000000..7b65813ed
--- /dev/null
+++ b/extensions/test/stm/pipetest.cxx
@@ -0,0 +1,483 @@
+/*************************************************************************
+ *
+ * $RCSfile: pipetest.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <smart/com/sun/star/test/XSimpleTest.hxx>
+#include <smart/com/sun/star/io/XOutputStream.hxx>
+#include <smart/com/sun/star/io/XInputStream.hxx>
+
+#include <smart/com/sun/star/lang/XServiceInfo.hxx>
+
+#include <usr/factoryhlp.hxx>
+
+#include <usr/reflserv.hxx> // for EXTERN_SERVICE_CALLTYPE
+#include <usr/weak.hxx> // OWeakObject
+
+#include <vos/conditn.hxx>
+#include <vos/mutex.hxx>
+#include <vos/thread.hxx>
+
+#include <assert.h>
+#include <string.h>
+
+#include "testfactreg.hxx"
+#define IMPLEMENTATION_NAME L"test.com.sun.star.comp.extensions.stm.Pipe"
+#define SERVICE_NAME L"test.com.sun.star.io.Pipe"
+
+#ifndef _VOS_NO_NAMESPACE
+using namespace vos;
+using namespace usr;
+#endif
+
+class WriteToStreamThread :
+ public OThread
+{
+
+public:
+
+ WriteToStreamThread( XOutputStreamRef xOutput , int iMax )
+ {
+ m_output = xOutput;
+ m_iMax = iMax;
+ }
+
+ virtual ~WriteToStreamThread() {}
+
+
+protected:
+
+ /// Working method which should be overridden.
+ virtual void run() {
+ for( int i = 0 ; i < m_iMax ; i ++ ) {
+ m_output->writeBytes( createIntSeq(i) );
+ }
+ m_output->closeOutput();
+ }
+
+ /** Called when run() is done.
+ * You might want to override it to do some cleanup.
+ */
+ virtual void onTerminated()
+ {
+ delete this;
+ }
+
+
+private:
+
+ XOutputStreamRef m_output;
+ int m_iMax;
+};
+
+
+
+class OPipeTest :
+ public XSimpleTest,
+ public OWeakObject
+{
+public:
+ OPipeTest( const XMultiServiceFactoryRef & rFactory );
+ ~OPipeTest();
+
+public: // refcounting
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+public: // implementation names
+ static Sequence< UString > getSupportedServiceNames_Static(void) THROWS( () );
+ static UString getImplementationName_Static() THROWS( () );
+
+public:
+ virtual void testInvariant(const UString& TestName, const XInterfaceRef& TestObject)
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+ virtual INT32 test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) );
+
+ virtual BOOL testPassed(void) THROWS( ( UsrSystemException) );
+ virtual Sequence< UString > getErrors(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UsrAny > getErrorExceptions(void) THROWS( (UsrSystemException) );
+ virtual Sequence< UString > getWarnings(void) THROWS( (UsrSystemException) );
+
+private:
+ void testSimple( const XInterfaceRef & );
+ void testBufferResizing( const XInterfaceRef & );
+ void testMultithreading( const XInterfaceRef & );
+
+private:
+ Sequence<UsrAny> m_seqExceptions;
+ Sequence<UString> m_seqErrors;
+ Sequence<UString> m_seqWarnings;
+
+};
+
+
+
+OPipeTest::OPipeTest( const XMultiServiceFactoryRef &rFactory )
+{
+
+}
+
+OPipeTest::~OPipeTest()
+{
+
+}
+
+
+BOOL OPipeTest::queryInterface( Uik uik , XInterfaceRef &rOut )
+{
+ if( XSimpleTest::getSmartUik() == uik ) {
+ rOut = (XSimpleTest *) this;
+ }
+ else {
+ return OWeakObject::queryInterface( uik , rOut );
+ }
+ return TRUE;
+}
+
+
+void OPipeTest::testInvariant( const UString& TestName, const XInterfaceRef& TestObject )
+ THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+ XServiceInfoRef info( TestObject, USR_QUERY );
+ ERROR_ASSERT( info.is() , "XServiceInfo not supported !" );
+ if( info.is() )
+ {
+ ERROR_ASSERT( info->supportsService( TestName ), "XServiceInfo test failed" );
+ ERROR_ASSERT( ! info->supportsService( L"bla bluzb" ) , "XServiceInfo test failed" );
+ }
+
+}
+
+
+INT32 OPipeTest::test( const UString& TestName,
+ const XInterfaceRef& TestObject,
+ INT32 hTestHandle) THROWS( ( IllegalArgumentException,
+ UsrSystemException) )
+{
+ if( L"com.sun.star.io.Pipe" == TestName ) {
+ TRY {
+ if( 0 == hTestHandle ) {
+ testInvariant( TestName , TestObject );
+ }
+ else if( 1 == hTestHandle ) {
+ testSimple( TestObject );
+ }
+ else if( 2 == hTestHandle ) {
+ testBufferResizing( TestObject );
+ }
+ else if( 3 == hTestHandle ) {
+ testMultithreading( TestObject );
+ }
+ }
+ CATCH( Exception , e ) {
+ BUILD_ERROR( 0 , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() );
+ }
+ AND_CATCH_ALL() {
+ BUILD_ERROR( 0 , "unknown exception (Exception is not base class)" );
+ }
+ END_CATCH;
+
+ hTestHandle ++;
+
+ if( 4 == hTestHandle ) {
+ // all tests finished.
+ hTestHandle = -1;
+ }
+ }
+ else {
+ THROW( IllegalArgumentException() );
+ }
+ return hTestHandle;
+}
+
+
+
+BOOL OPipeTest::testPassed(void) THROWS( (UsrSystemException) )
+{
+ return m_seqErrors.getLen() == 0;
+}
+
+
+Sequence< UString > OPipeTest::getErrors(void) THROWS( (UsrSystemException) )
+{
+ return m_seqErrors;
+}
+
+
+Sequence< UsrAny > OPipeTest::getErrorExceptions(void) THROWS( (UsrSystemException) )
+{
+ return m_seqExceptions;
+}
+
+
+Sequence< UString > OPipeTest::getWarnings(void) THROWS( (UsrSystemException) )
+{
+ return m_seqWarnings;
+}
+
+
+/***
+* the test methods
+*
+****/
+
+
+void OPipeTest::testSimple( const XInterfaceRef &r )
+{
+
+ XInputStreamRef input( r , USR_QUERY );
+ XOutputStreamRef output( r , USR_QUERY );
+
+ ERROR_ASSERT( input.is() , "queryInterface on XInputStream failed" );
+ ERROR_ASSERT( output.is() , "queryInterface onXOutputStream failed" );
+
+ // basic read/write
+ Sequence<BYTE> seqWrite = createSeq( "Hallo, du Ei !" );
+
+ Sequence<BYTE> seqRead;
+ for( int i = 0 ; i < 5000 ; i ++ ) {
+ output->writeBytes( seqWrite );
+ input->readBytes( seqRead , input->available() );
+
+ ERROR_ASSERT( ! strcmp( (char *) seqWrite.getArray() , (char * )seqRead.getArray() ) ,
+ "error during read/write/skip" );
+ ERROR_ASSERT( 0 == input->available() ,
+ "error during read/write/skip" );
+
+ // available shouldn't return a negative value
+ input->skipBytes( seqWrite.getLen() - 5 );
+ ERROR_ASSERT( 0 == input->available() , "wrong available after skip" );
+
+ // 5 bytes should be available
+ output->writeBytes( seqWrite );
+ ERROR_ASSERT( 5 == input->available() , "wrong available after skip/write " );
+
+ input->readBytes( seqRead , 5 );
+ ERROR_ASSERT( ! strcmp( (char*) seqRead.getArray() ,
+ (char*) &( seqWrite.getArray()[seqWrite.getLen()-5] ) ),
+ "write/read mismatich" );
+
+ }
+
+ output->writeBytes( seqWrite );
+ ERROR_ASSERT( seqWrite.getLen() == input->available(), "wrong available() after write" );
+
+ ERROR_ASSERT( 10 == input->readSomeBytes( seqRead , 10 ) , "maximal number of bytes ignored" );
+ ERROR_ASSERT( seqWrite.getLen() -10 == input->readSomeBytes( seqRead , 100 ) ,
+ "something wrong with readSomeBytes" );
+
+
+ output->closeOutput();
+ TRY {
+ output->writeBytes( Sequence<BYTE> (100) );
+ ERROR_ASSERT( 0 , "writing on a closed stream does not cause an exception" );
+ }
+ CATCH (IOException , e ) {
+ e; // just to suppress warning during compile
+ }
+ END_CATCH;
+
+ ERROR_ASSERT(! input->readBytes( seqRead , 1 ), "eof not found !" );
+
+ input->closeInput();
+ TRY {
+ input->readBytes( seqRead , 1 );
+ ERROR_ASSERT( 0 , "reading from a closed stream does not cause an exception" );
+ }
+ CATCH( IOException , e ) {
+ e; // just to suppress warning during compile
+ }
+ END_CATCH;
+
+}
+
+void OPipeTest::testBufferResizing( const XInterfaceRef &r )
+{
+
+ int iMax = 20000;
+ XInputStreamRef input( r , USR_QUERY );
+ XOutputStreamRef output( r , USR_QUERY );
+
+ ERROR_ASSERT( input.is() , "queryInterface on XInputStream failed" );
+ ERROR_ASSERT( output.is() , "queryInterface on XOutputStream failed" );
+
+ Sequence<BYTE> seqRead;
+
+ // this is just to better check the
+ // internal buffers
+ output->writeBytes( Sequence<BYTE>(100) );
+ input->readBytes( Sequence<BYTE>() , 100);
+
+ for( int i = 0 ; i < iMax ; i ++ ) {
+ output->writeBytes( createIntSeq( i ) );
+ }
+
+ for( i = 0 ; i < iMax ; i ++ ) {
+ input->readBytes( seqRead, createIntSeq(i).getLen() );
+ ERROR_ASSERT( ! strcmp( (char*) seqRead.getArray() ,
+ (char*) createIntSeq(i).getArray() ) ,
+ "written/read mismatch\n" );
+ }
+
+ output->closeOutput();
+ ERROR_ASSERT( ! input->readBytes( seqRead , 1 ) , "eof not reached !" );
+ input->closeInput();
+}
+
+
+
+void OPipeTest::testMultithreading( const XInterfaceRef &r )
+{
+
+
+ int iMax = 30000;
+
+ XInputStreamRef input( r , USR_QUERY );
+ XOutputStreamRef output( r , USR_QUERY );
+
+ ERROR_ASSERT( input.is() , "queryInterface on XInputStream failed" );
+ ERROR_ASSERT( output.is() , "queryInterface on XOutputStream failed" );
+
+ Sequence<BYTE> seqRead;
+
+ // deletes itself
+ OThread *p = new WriteToStreamThread( output, iMax );
+
+ ERROR_ASSERT( p , "couldn't create thread for testing !\n" );
+
+ p->create();
+
+ for(int i = 0 ; TRUE ; i ++ ) {
+ if( 0 == input->readBytes( seqRead, createIntSeq(i).getLen() ) ) {
+ // eof reached !
+ break;
+ }
+
+ ERROR_ASSERT( ! strcmp( (char*) seqRead.getArray() ,
+ (char*) createIntSeq(i).getArray() ) ,
+ "written/read mismatch\n" );
+ }
+
+ ERROR_ASSERT( i == iMax , "less elements read than written !");
+ input->closeInput();
+}
+
+/* {
+ TRY {
+ XInterfaceRef x = xSMgr->createInstance( strService );
+
+ XInputStreamRef input( x , USR_QUERY );
+ XOutputStreamRef output( x , USR_QUERY );
+
+ assert( output.is() );
+ while( TRUE ) {
+ // basic read/write
+ Sequence<BYTE> seqWrite( 500 );
+ output->writeBytes( seqWrite );
+
+ }
+ }
+ CATCH( IOException , e ) {
+ printf( "%s %s\n" , UStringToString( e.getName() , CHARSET_SYSTEM ).GetCharStr() ,
+ UStringToString( e.Message , CHARSET_SYSTEM ).GetCharStr() );
+ }
+ }
+*/
+
+
+
+
+/**
+* for external binding
+*
+*
+**/
+XInterfaceRef OPipeTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception))
+{
+ OPipeTest *p = new OPipeTest( rSMgr );
+ XInterfaceRef xService = *p;
+ return xService;
+}
+
+
+
+Sequence<UString> OPipeTest_getSupportedServiceNames(void) THROWS( () )
+{
+ Sequence<UString> aRet(1);
+ aRet.getArray()[0] = OPipeTest_getImplementationName();
+
+ return aRet;
+}
+
+UString OPipeTest_getServiceName() THROWS( () )
+{
+ return SERVICE_NAME;
+}
+
+UString OPipeTest_getImplementationName() THROWS( () )
+{
+ return IMPLEMENTATION_NAME;
+}
diff --git a/extensions/test/stm/testfactreg.cxx b/extensions/test/stm/testfactreg.cxx
new file mode 100644
index 000000000..69ab2a723
--- /dev/null
+++ b/extensions/test/stm/testfactreg.cxx
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * $RCSfile: testfactreg.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <string.h>
+
+#include <usr/reflserv.hxx> // for EXTERN_SERVICE_CALLTYPE
+
+#include <usr/factoryhlp.hxx>
+#include "testfactreg.hxx"
+
+
+#ifndef _VOS_NO_NAMESPACE
+using namespace vos;
+using namespace usr;
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+BOOL EXTERN_SERVICE_CALLTYPE exService_writeRegEntry(
+ const UNO_INTERFACE(XRegistryKey)* xUnoKey)
+
+{
+ XRegistryKeyRef xKey;
+ uno2smart(xKey, *xUnoKey);
+
+ UString str = UString( L"/" ) + OPipeTest_getImplementationName() + UString( L"/UNO/SERVICES" );
+ XRegistryKeyRef xNewKey = xKey->createKey( str );
+ xNewKey->createKey( OPipeTest_getServiceName() );
+
+ str = UString( L"/" ) + ODataStreamTest_getImplementationName(1) + UString( L"/UNO/SERVICES" );
+ xNewKey = xKey->createKey( str );
+ xNewKey->createKey( ODataStreamTest_getServiceName(1) );
+
+ str = UString( L"/" ) + ODataStreamTest_getImplementationName(2) + UString( L"/UNO/SERVICES" );
+ xNewKey = xKey->createKey( str );
+ xNewKey->createKey( ODataStreamTest_getServiceName(2) );
+
+ str = UString( L"/" ) + OObjectStreamTest_getImplementationName(1) + UString( L"/UNO/SERVICES" );
+ xNewKey = xKey->createKey( str );
+ xNewKey->createKey( OObjectStreamTest_getServiceName(1) );
+
+ str = UString( L"/" ) + OObjectStreamTest_getImplementationName(2) + UString( L"/UNO/SERVICES" );
+ xNewKey = xKey->createKey( str );
+ xNewKey->createKey( OObjectStreamTest_getServiceName(2) );
+
+ str = UString( L"/" ) + OMarkableOutputStreamTest_getImplementationName() + UString( L"/UNO/SERVICES" );
+ xNewKey = xKey->createKey( str );
+ xNewKey->createKey( OMarkableOutputStreamTest_getServiceName() );
+
+ str = UString( L"/" ) + OMarkableInputStreamTest_getImplementationName() + UString( L"/UNO/SERVICES" );
+ xNewKey = xKey->createKey( str );
+ xNewKey->createKey( OMarkableInputStreamTest_getServiceName() );
+
+ str = UString( L"/" ) + OMyPersistObject_getImplementationName() + UString( L"/UNO/SERVICES" );
+ xNewKey = xKey->createKey( str );
+ xNewKey->createKey( OMyPersistObject_getServiceName() );
+
+ return TRUE;
+}
+
+
+UNO_INTERFACE(XInterface) EXTERN_SERVICE_CALLTYPE exService_getFactory
+(
+ const wchar_t* implementationName,
+ const UNO_INTERFACE(XMultiServiceFactory)* xUnoFact,
+ const UNO_INTERFACE(XRegistryKey)*
+)
+{
+ UNO_INTERFACE(XInterface) xUnoRet = {0, 0};
+
+ XInterfaceRef xRet;
+ XMultiServiceFactoryRef xSMgr;
+ UString aImplementationName(implementationName);
+
+ uno2smart(xSMgr, *xUnoFact);
+
+ if (aImplementationName == OPipeTest_getImplementationName() )
+ {
+ xRet = createSingleFactory( xSMgr, implementationName,
+ OPipeTest_CreateInstance,
+ OPipeTest_getSupportedServiceNames() );
+ }
+ else if( aImplementationName == ODataStreamTest_getImplementationName(1) ) {
+ xRet = createSingleFactory( xSMgr , implementationName,
+ ODataStreamTest_CreateInstance,
+ ODataStreamTest_getSupportedServiceNames(1) );
+ }
+ else if( aImplementationName == ODataStreamTest_getImplementationName(2) ) {
+ xRet = createSingleFactory( xSMgr , implementationName,
+ ODataStreamTest_CreateInstance,
+ ODataStreamTest_getSupportedServiceNames(2) );
+ }
+ else if( aImplementationName == OObjectStreamTest_getImplementationName(1) ) {
+ xRet = createSingleFactory( xSMgr , implementationName,
+ OObjectStreamTest_CreateInstance,
+ OObjectStreamTest_getSupportedServiceNames(1) );
+ }
+ else if( aImplementationName == OObjectStreamTest_getImplementationName(2) ) {
+ xRet = createSingleFactory( xSMgr , implementationName,
+ OObjectStreamTest_CreateInstance,
+ OObjectStreamTest_getSupportedServiceNames(2) );
+ }
+ else if( aImplementationName == OMarkableOutputStreamTest_getImplementationName() ) {
+ xRet = createSingleFactory( xSMgr , implementationName,
+ OMarkableOutputStreamTest_CreateInstance,
+ OMarkableOutputStreamTest_getSupportedServiceNames() );
+ }
+ else if( aImplementationName == OMarkableInputStreamTest_getImplementationName() ) {
+ xRet = createSingleFactory( xSMgr , implementationName,
+ OMarkableInputStreamTest_CreateInstance,
+ OMarkableInputStreamTest_getSupportedServiceNames() );
+ }
+ else if( aImplementationName == OMyPersistObject_getImplementationName() ) {
+ xRet = createSingleFactory( xSMgr , implementationName,
+ OMyPersistObject_CreateInstance,
+ OMyPersistObject_getSupportedServiceNames() );
+ }
+ if (xRet.is())
+ {
+ smart2uno(xRet, xUnoRet);
+ }
+
+ return xUnoRet;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+Sequence<BYTE> createSeq( char * p )
+{
+ Sequence<BYTE> seq( strlen( p )+1 );
+ strcpy( (char * ) seq.getArray() , p );
+ return seq;
+}
+
+Sequence<BYTE> createIntSeq( INT32 i )
+{
+ char pcCount[20];
+ sprintf( pcCount , "%d" , i );
+ return createSeq( pcCount );
+}
+
diff --git a/extensions/test/stm/testfactreg.hxx b/extensions/test/stm/testfactreg.hxx
new file mode 100644
index 000000000..57f81b50f
--- /dev/null
+++ b/extensions/test/stm/testfactreg.hxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * $RCSfile: testfactreg.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+XInterfaceRef OPipeTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception));
+Sequence<UString> OPipeTest_getSupportedServiceNames(void) THROWS( () );
+UString OPipeTest_getServiceName() THROWS( () );
+UString OPipeTest_getImplementationName() THROWS( () );
+
+XInterfaceRef ODataStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception));
+Sequence<UString> ODataStreamTest_getSupportedServiceNames( int i) THROWS( () );
+UString ODataStreamTest_getServiceName( int i) THROWS( ( ) );
+UString ODataStreamTest_getImplementationName( int i) THROWS( () );
+
+XInterfaceRef OMarkableOutputStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception));
+Sequence<UString> OMarkableOutputStreamTest_getSupportedServiceNames(void) THROWS( () );
+UString OMarkableOutputStreamTest_getServiceName() THROWS( () );
+UString OMarkableOutputStreamTest_getImplementationName() THROWS( () );
+
+XInterfaceRef OMarkableInputStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception));
+Sequence<UString> OMarkableInputStreamTest_getSupportedServiceNames(void) THROWS( () );
+UString OMarkableInputStreamTest_getServiceName() THROWS( () );
+UString OMarkableInputStreamTest_getImplementationName() THROWS( () );
+
+XInterfaceRef OObjectStreamTest_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception));
+Sequence<UString> OObjectStreamTest_getSupportedServiceNames( int i) THROWS( () );
+UString OObjectStreamTest_getServiceName( int i) THROWS( () );
+UString OObjectStreamTest_getImplementationName( int i) THROWS( () );
+
+XInterfaceRef OMyPersistObject_CreateInstance( const XMultiServiceFactoryRef & rSMgr ) THROWS((Exception));
+Sequence<UString> OMyPersistObject_getSupportedServiceNames( ) THROWS( () );
+UString OMyPersistObject_getServiceName( ) THROWS( () );
+UString OMyPersistObject_getImplementationName( ) THROWS( () );
+
+Sequence<BYTE> createSeq( char * p );
+Sequence<BYTE> createIntSeq( INT32 i );
+
+#define BUILD_ERROR(expr, Message)\
+ {\
+ m_seqErrors.realloc( m_seqErrors.getLen() + 1 ); \
+ m_seqExceptions.realloc( m_seqExceptions.getLen() + 1 ); \
+ String str; \
+ str += __FILE__;\
+ str += " "; \
+ str += "(" ; \
+ str += __LINE__ ;\
+ str += ")\n";\
+ str += "[ " ; \
+ str += #expr; \
+ str += " ] : " ; \
+ str += Message; \
+ m_seqErrors.getArray()[ m_seqErrors.getLen()-1] = StringToOUString( str , CHARSET_SYSTEM ); \
+ }\
+ ((void)0)
+
+
+#define WARNING_ASSERT(expr, Message) \
+ if( ! (expr) ) { \
+ m_seqWarnings.realloc( m_seqErrors.getLen() +1 ); \
+ String str;\
+ str += __FILE__;\
+ str += " "; \
+ str += "(" ; \
+ str += __LINE__ ;\
+ str += ")\n";\
+ str += "[ " ; \
+ str += #expr; \
+ str += " ] : " ; \
+ str += Message; \
+ m_seqWarnings.getArray()[ m_seqWarnings.getLen()-1] = StringToOUString( str , CHARSET_SYSTEM ); \
+ return; \
+ }\
+ ((void)0)
+
+#define ERROR_ASSERT(expr, Message) \
+ if( ! (expr) ) { \
+ BUILD_ERROR(expr, Message );\
+ return; \
+ }\
+ ((void)0)
+
+#define ERROR_EXCEPTION_ASSERT(expr, Message, Exception) \
+ if( !(expr)) { \
+ BUILD_ERROR(expr,Message);\
+ m_seqExceptions.getArray()[ m_seqExceptions.getLen()-1] = UsrAny( Exception );\
+ return; \
+ } \
+ ((void)0)
diff --git a/extensions/util/makefile.pmk b/extensions/util/makefile.pmk
new file mode 100644
index 000000000..530e406a6
--- /dev/null
+++ b/extensions/util/makefile.pmk
@@ -0,0 +1,85 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.pmk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=extensionspch
+PROJECTPCHSOURCE=$(PRJ)$/util$/extensionspch
+PDBTARGET=extensions
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.IF "$(GUI)" != "MAC"
+CFLAGS+=-I..$/..$/idl
+.ELSE
+CFLAGS+=-I ..$/..$/idl
+.ENDIF
+
+.IF "$(GUI)"=="UNX"
+PATH_SEPERATOR=":"
+.ELSE
+PATH_SEPERATOR=";"
+.ENDIF
+
+JARFILES = uno.jar
+
+
diff --git a/extensions/util/target.pmk b/extensions/util/target.pmk
new file mode 100644
index 000000000..6bee4897f
--- /dev/null
+++ b/extensions/util/target.pmk
@@ -0,0 +1,70 @@
+#*************************************************************************
+#
+# $RCSfile: target.pmk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+ALLSLO: $(SLOFILES)
+
+SOSHL: $(SHL1TARGETN)
+
+WHOLEPRJ:
+ cd $(PRJ)$/prj
+ make debug linkinc prjpch compinc
+ @echo "READY"
+
diff --git a/extensions/workben/makefile.mk b/extensions/workben/makefile.mk
new file mode 100644
index 000000000..66fd82861
--- /dev/null
+++ b/extensions/workben/makefile.mk
@@ -0,0 +1,247 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=extensions
+TARGET=workben
+LIBTARGET=NO
+
+TESTAPP=testpgp
+#TESTAPP=testcomponent
+#TESTAPP=pythontest
+#TESTAPP=pythonautotest
+#TESTAPP=testresource
+#TESTAPP=testframecontrol
+
+.IF "$(TESTAPP)" == "testresource" || "$(TESTAPP)" == "testframecontrol"
+TARGETTYPE=GUI
+.ELSE
+TARGETTYPE=CUI
+.ENDIF
+
+JVM_TARGET=jvmtest
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+UNOUCRDEP=$(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB=$(SOLARBINDIR)$/applicat.rdb
+UNOUCROUT=$(OUT)$/inc$/$(PRJNAME)$/$(TARGET)
+INCPRE+=$(UNOUCROUT)
+
+# --- Files --------------------------------------------------------
+
+#
+# testpgp.
+#
+.IF "$(TESTAPP)" == "testpgp"
+
+UNOTYPES= \
+ com.sun.star.lang.XMultiServiceFactory \
+ com.sun.star.io.XInputStream \
+ com.sun.star.io.XOutputStream \
+ com.sun.star.pgp.RecipientsEvent \
+ com.sun.star.pgp.SignatureEvent \
+ com.sun.star.pgp.XPGPDecoder \
+ com.sun.star.pgp.XPGPDecoderListener \
+ com.sun.star.pgp.XPGPEncoder \
+ com.sun.star.pgp.XPGPPreferences \
+ com.sun.star.uno.TypeClass \
+ com.sun.star.uno.XInterface \
+ com.sun.star.uno.XWeak
+
+CXXFILES= testpgp.cxx
+OBJFILES= $(OBJ)$/testpgp.obj
+
+APP1TARGET= testpgp
+APP1OBJS= $(OBJFILES)
+APP1STDLIBS=$(USRLIB) \
+ $(CPPUHELPERLIB)\
+ $(CPPULIB) \
+ $(VOSLIB) \
+ $(SALLIB)
+
+APP1DEPN= $(L)$/usr.lib
+APP1DEF= $(MISC)$/$(APP1TARGET).def
+
+.ENDIF # testpgp
+
+#
+# std testcomponent
+#
+.IF "$(TESTAPP)" == "testcomponent"
+
+CXXFILES= testcomponent.cxx
+OBJFILES= $(OBJ)$/testcomponent.obj
+
+APP2TARGET = testcomponent
+APP2OBJS = $(OBJ)$/testcomponent.obj
+APP2STDLIBS = $(UNOLIB) \
+ $(VOSLIB) \
+ $(USRLIB) \
+ $(TOOLSLIB) \
+ $(SALLIB) \
+ $(RTLLIB) \
+ $(ONELIB)
+
+.ENDIF # testcomponent
+
+#
+# test python.
+#
+.IF "$(TESTAPP)" == "phytontest"
+
+CXXFILES= phytontest.cxx
+OBJFILES= $(OBJ)$/pythontest.obj
+
+#APP4TARGET= pythontest
+#APP4OBJS= $(OBJ)$/pythontest.obj
+#APP4STDLIBS=$(TOOLSLIB) \
+# $(USRLIB) \
+# $(UNOLIB) \
+# $(VOSLIB) \
+# $(RTLLIB)
+
+#APP1DEPN= $(LB)$/one.lib
+#APP4DEF= $(MISC)$/$(APP4TARGET).def
+
+.ENDIF # phytontest
+
+#
+# python auto test
+#
+.IF "$(TESTAPP)" == "phytonautotest"
+
+CXXFILES= phytonautotest.cxx
+OBJFILES= $(OBJ)$/pythonautotest.obj
+
+#APP5TARGET= pythonautotest
+#APP5OBJS = $(OBJ)$/pythonautotest.obj
+#APP5STDLIBS=$(TOOLSLIB) \
+# $(USRLIB) \
+# $(UNOLIB) \
+# $(VOSLIB) \
+# $(RTLLIB)
+#APP5DEF= $(MISC)$/$(APP5TARGET).def
+
+.ENDIF # phytonautotest
+
+#
+# testresource.
+#
+.IF "$(TESTAPP)" == "testresource"
+
+CXXFILES= testresource.cxx
+OBJFILES= $(OBJ)$/testresource.obj
+
+SRS2NAME = testresource
+SRC2FILES= testresource.src
+RESLIB2SRSFILES= $(SRS)$/testresource.srs
+RESLIB2NAME= testresource
+
+APP2TARGET= testresource
+APP2OBJS= $(OBJ)$/testresource.obj
+APP2STDLIBS=$(TOOLSLIB) \
+ $(VCLLIB) \
+ $(ONELIB) \
+ $(USRLIB) \
+ $(UNOLIB) \
+ $(SALLIB) \
+ $(RTLLIB)
+
+APP2DEF= $(MISC)$/$(APP3TARGET).def
+
+.ENDIF # testresource
+
+#
+# testframecontrol.
+#
+.IF "$(TESTAPP)" == "testframecontrol"
+
+CXXFILES= testframecontrol.cxx
+OBJFILES= $(OBJ)$/testframecontrol.obj
+
+APP3TARGET= testframecontrol
+APP3OBJS= $(OBJ)$/testframecontrol.obj
+APP3STDLIBS=$(TOOLSLIB) \
+ $(ONELIB) \
+ $(USRLIB) \
+ $(UNOLIB) \
+ $(VOSLIB) \
+ $(OSLLIB) \
+ $(RTLLIB) \
+ $(SVTOOLLIB) \
+ $(VCLLIB)
+
+APP3DEF= $(MISC)$/$(APP3TARGET).def
+
+.ENDIF # testframecontrol
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/extensions/workben/pythonautotest.cxx b/extensions/workben/pythonautotest.cxx
new file mode 100644
index 000000000..ced00a83b
--- /dev/null
+++ b/extensions/workben/pythonautotest.cxx
@@ -0,0 +1,657 @@
+/*************************************************************************
+ *
+ * $RCSfile: pythonautotest.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <stdio.h>
+#include <stardiv/uno/repos/implementationregistration.hxx>
+#include <stardiv/uno/script/script.hxx>
+#include <stardiv/uno/beans/exactname.hxx>
+
+#include <rtl/ustring.hxx>
+#include <vos/dynload.hxx>
+#include <vos/diagnose.hxx>
+#include <usr/services.hxx>
+#include <vcl/svapp.hxx>
+#include <usr/ustring.hxx>
+#include <usr/weak.hxx>
+#include <tools/string.hxx>
+#include <vos/conditn.hxx>
+#include <assert.h>
+
+#ifdef _USE_NAMESPACE
+using namespace rtl;
+using namespace vos;
+using namespace usr;
+#endif
+
+#define PCHAR_TO_USTRING(x) StringToOUString(String(x),CHARSET_SYSTEM)
+#define USTRING_TO_PCHAR(x) OUStringToString(x , CHARSET_DONTKNOW ).GetCharStr()
+
+
+
+
+
+/*****
+*
+* A Test root object !
+*
+*****/
+class MyPythonRoot :
+ public XInvokation,
+ public OWeakObject
+{
+public:
+ MyPythonRoot() { m_iTestValue = 15; }
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+public:
+ XIntrospectionAccessRef getIntrospection(void) const THROWS( (UsrSystemException) )
+ { return XIntrospectionAccessRef(); }
+
+ UsrAny invoke( const UString& FunctionName,
+ const Sequence< UsrAny >& Params,
+ Sequence< INT16 >& OutParamIndex,
+ Sequence< UsrAny >& OutParam)
+ THROWS( ( IllegalArgumentException,
+ CannotConvertException,
+ InvocationTargetException,
+ UsrSystemException) );
+ void setValue(const UString& PropertyName, const UsrAny& Value)
+ THROWS( ( UnknownPropertyException,
+ CannotConvertException,
+ InvocationTargetException,
+ UsrSystemException) );
+
+ UsrAny getValue(const UString& PropertyName)
+ THROWS( ( UnknownPropertyException,
+ UsrSystemException) );
+ BOOL hasMethod(const UString& Name) const THROWS( (UsrSystemException) );
+ BOOL hasProperty(const UString& Name) const THROWS( (UsrSystemException) );
+
+
+ void getTestValueViaInout( int &inout )
+ { inout = m_iTestValue; }
+
+ INT32 getTestValue() const
+ { return m_iTestValue; }
+
+ void setTestValue( INT32 i )
+ { m_iTestValue = i; }
+
+ void printTestValue()
+ { fprintf( stderr, "TestValue : %d\n" , getTestValue() ); }
+
+ void addTestValue( INT32 i )
+ { m_iTestValue += i; }
+
+private:
+
+ INT32 m_iTestValue;
+};
+
+BOOL MyPythonRoot::queryInterface( Uik aUik, XInterfaceRef &rOut )
+{
+ if( aUik == XInvokation::getSmartUik() ) {
+ rOut = ( XInvokation * ) this;
+ }
+ else {
+ return OWeakObject::queryInterface( aUik , rOut );
+ }
+ return TRUE;
+
+}
+
+UsrAny MyPythonRoot::invoke( const UString& FunctionName,
+ const Sequence< UsrAny >& Params,
+ Sequence< INT16 >& OutParamIndex,
+ Sequence< UsrAny >& OutParam)
+ THROWS( ( IllegalArgumentException,
+ CannotConvertException,
+ InvocationTargetException,
+ UsrSystemException) )
+{
+ if( L"printTestValue" == FunctionName ) {
+ printTestValue();
+ }
+ else if( L"addTestValue" == FunctionName ) {
+ addTestValue( Params.getConstArray()[0].getINT32() );
+ }
+ else if( L"getTestValueViaInout" == FunctionName ) {
+ int i = Params.getConstArray()[0].getINT32();
+ getTestValueViaInout( i );
+ OutParam.getArray()[0].setINT32( i );
+ }
+ else {
+ THROW( InvocationTargetException() );
+ }
+
+ return UsrAny();
+}
+
+void MyPythonRoot::setValue(const UString& PropertyName, const UsrAny& Value)
+ THROWS( ( UnknownPropertyException,
+ CannotConvertException,
+ InvocationTargetException,
+ UsrSystemException) )
+{
+ if( L"TestValue" == PropertyName ) {
+ setTestValue( Value.getINT32() );
+ }
+ else {
+ THROW( UnknownPropertyException() );
+ }
+}
+
+UsrAny MyPythonRoot::getValue(const UString& PropertyName)
+ THROWS( ( UnknownPropertyException,
+ UsrSystemException) )
+{
+ UsrAny aRet;
+
+ if( L"TestValue" == PropertyName ) {
+ aRet.setINT32( getTestValue() );
+ }
+ else {
+ THROW( UnknownPropertyException() );
+ }
+
+ return aRet;
+}
+
+
+BOOL MyPythonRoot::hasMethod(const UString& Name) const THROWS( (UsrSystemException) )
+{
+ if( L"printTestValue" == Name ) {
+ return TRUE;
+ }
+ else if( L"addTestValue" == Name ) {
+ return TRUE;
+ }
+ else if( L"getTestValueViaInout" == Name ) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+BOOL MyPythonRoot::hasProperty(const UString& Name) const THROWS( (UsrSystemException) )
+{
+ if( L"TestValue" == Name ) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+/*****
+*
+* A test engine listener to check the debug interface
+*
+*****/
+class TestListener :
+ public XEngineListener,
+ public OWeakObject
+{
+public:
+
+ TestListener()
+ {
+ m_pDebuggingRef = 0;
+ }
+
+
+ TestListener( XDebuggingRef *p )
+ {
+ attach( p );
+ }
+
+ ~TestListener()
+ {
+ if( m_pDebuggingRef ) {
+ detach();
+ }
+ }
+
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+
+ void attach( XDebuggingRef *p )
+ {
+ m_pDebuggingRef = p;
+ }
+
+ void detach( );
+
+
+ virtual void disposing( const EventObject &o )
+ {
+ if( m_pDebuggingRef ) {
+ detach();
+ }
+ }
+ virtual void interrupt(const InterruptEngineEvent& Evt) THROWS( (UsrSystemException) )
+ {
+ }
+
+ virtual void running(const EventObject& Evt) THROWS( (UsrSystemException) )
+ {
+ (*m_pDebuggingRef)->stop();
+
+ m_aDebugCondition.set();
+ }
+
+ virtual void finished(const FinishEngineEvent& Evt) THROWS( (UsrSystemException) )
+ {
+ m_aDebugCondition.set();
+ }
+
+
+ void cmdLine();
+protected:
+
+ OCondition m_aDebugCondition;
+ XDebuggingRef *m_pDebuggingRef;
+};
+
+
+
+void TestListener::cmdLine()
+{
+ // Condition is set by running listener
+ m_aDebugCondition.wait();
+ m_aDebugCondition.reset();
+ (*m_pDebuggingRef)->doContinue();
+ m_aDebugCondition.wait();
+}
+
+void TestListener::detach()
+{
+ assert( m_pDebuggingRef );
+
+ m_pDebuggingRef = 0;
+}
+
+BOOL TestListener::queryInterface( Uik aUik, XInterfaceRef & rOut )
+{
+ if( aUik == XEngineListener::getSmartUik() )
+ rOut = (XEngineListener*)this;
+ else
+ return OWeakObject::queryInterface( aUik, rOut );
+ return TRUE;
+}
+
+
+void checkInvokation( const XInvokationRef &xInvoke )
+{
+ UsrAny anyList;
+
+ // check exporting an object as an invokation
+ assert( xInvoke->hasProperty( L"list" ) );
+ anyList = xInvoke->getValue( L"list" );
+
+ assert( anyList.getReflection() == XInvokation_getReflection() );
+ XInvokationRef *pRef = ( XInvokationRef * ) anyList.get();
+ assert( (*pRef).is() );
+
+ assert( (*pRef)->hasMethod( L"append" ) );
+ assert( (*pRef)->hasMethod( L"count" ) );
+
+ Sequence<UsrAny> seq(1);
+ UsrAny any( (INT32) 1);
+ (seq.getArray())[0] = any;
+
+ any = (*pRef)->invoke( L"count" , seq , Sequence<INT16>(), Sequence<UsrAny>() );
+ int nOldSize = any.getINT32();
+
+ any = (*pRef)->invoke( L"append" , seq , Sequence<INT16>(), Sequence<UsrAny>() );
+ any = (*pRef)->invoke( L"count" , seq , Sequence<INT16>(), Sequence<UsrAny>() );
+
+ assert( nOldSize + 1 == any.getINT32() );
+}
+
+// just for testing !
+class PythonCodeLibrary :
+ public XLibraryAccess,
+ public OWeakObject
+{
+
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+
+ virtual BOOL isFunction(const UString& FunctionName) THROWS( (UsrSystemException) )
+ {
+ return FALSE;
+ }
+
+ virtual BOOL isValidPath(const UString& PathName) THROWS( (UsrSystemException) )
+ {
+ return FALSE;
+ }
+
+ virtual Sequence< UString > getModuleNames(void) THROWS( (UsrSystemException) )
+ {
+ return Sequence<UString> ();
+ }
+
+ virtual UString getModuleSource(const UString& ModulName) THROWS( (UsrSystemException) )
+ {
+ if( ModulName == L"testmodul" ) {
+ return UString( L"def testmethod():\n"
+ L" return 42\n");
+ }
+ return UString();
+ }
+
+ virtual Sequence< BYTE > getModuleCode(const UString& ModuleName) THROWS( (UsrSystemException) )
+ {
+ return Sequence< BYTE > ();
+ }
+
+ virtual UString getFunctionSource(const UString& FunctionName) THROWS( (UsrSystemException) )
+ {
+ return UString();
+ }
+ virtual Sequence< BYTE > getFunctionCode(const UString& FunctionName) THROWS( (UsrSystemException) )
+ {
+ return Sequence< BYTE > ();
+ }
+};
+
+BOOL PythonCodeLibrary::queryInterface( Uik aUik, XInterfaceRef & rOut )
+{
+ if( XLibraryAccess::getSmartUik() == aUik ) {
+ rOut = (XLibraryAccess* ) this;
+ }
+ else {
+ return OWeakObject::queryInterface( aUik , rOut );
+ }
+
+ return TRUE;
+}
+
+
+
+/*
+ * main.
+ */
+int __LOADONCALLAPI main (int argc, char **argv)
+{
+ // necessary startup code
+ XMultiServiceFactoryRef xSMgr = createRegistryServiceManager();
+ registerUsrServices( xSMgr );
+ setProcessServiceManager( xSMgr );
+
+ XInterfaceRef x = xSMgr->createInstance( L"stardiv.uno.repos.ImplementationRegistration" );
+ XImplementationRegistrationRef xReg( x, USR_QUERY );
+ sal_Char szBuf[1024];
+
+ ORealDynamicLoader::computeModuleName( "pythonengine", szBuf, 1024 );
+ UString aDllName( StringToOUString( szBuf, CHARSET_SYSTEM ) );
+ xReg->registerImplementation( L"stardiv.loader.SharedLibrary", aDllName, XSimpleRegistryRef() );
+
+ x = xSMgr->createInstance( L"stardiv.script.Python" );
+ XEngineRef xEngine( x, USR_QUERY );
+ XInvokationRef xInvoke( x, USR_QUERY );
+ XDebuggingRef xDebug( x , USR_QUERY );
+
+ XInterfaceRef rRoot( (XInvokation * )new MyPythonRoot , USR_QUERY );
+ xEngine->setRoot( rRoot );
+
+
+ // execute a simple script
+ xEngine->run( L"nIntTest = 5\n"
+ L"list = [2,3,4]\n" , XInterfaceRef(), Sequence<UsrAny> () );
+
+ /****
+ *
+ * Xinvokation - Test
+ *
+ *****/
+ // get/set an int !
+ {
+ assert( xInvoke->hasProperty( L"nIntTest" ) );
+ UsrAny any = xInvoke->getValue( L"nIntTest" );
+
+ assert( any.getReflection()->getTypeClass() == TypeClass_LONG );
+ assert( any.getINT32() == 5 );
+
+ // simple test: set an int !
+ xInvoke->setValue( L"nIntTest" , UsrAny( (INT32) 10 ) );
+ any = xInvoke->getValue( L"nIntTest" );
+
+ assert( any.getReflection()->getTypeClass() == TypeClass_LONG );
+ assert( any.getINT32() == 10 );
+ }
+
+ // call a python method !
+ {
+ xEngine->run( L"def foo():\n"
+ L" return 'this is foo'\n" , XInterfaceRef() , Sequence<UsrAny> () );
+ assert( xInvoke->hasMethod( L"foo" ) );
+ UsrAny any = xInvoke->invoke( L"foo" ,
+ Sequence<UsrAny>(),
+ Sequence<INT16>() ,
+ Sequence<UsrAny> () );
+ assert( any.getString() == L"this is foo" );
+ }
+
+
+ // check exception handling !
+ {
+ TRY {
+ xInvoke->invoke( L"foo" , Sequence<UsrAny>(1) , Sequence<INT16>(), Sequence<UsrAny> () );
+ // wrong number of arguments
+ assert( 0 );
+ }
+ CATCH ( IllegalArgumentException , e ) {
+ }
+ CATCH ( InvocationTargetException , e ) {
+ }
+ CATCH ( CannotConvertException , e ) {
+ // empty any cannot be converted
+ }
+ }
+
+ // check InOut-Parameter
+ checkInvokation( xInvoke );
+
+ /*******
+ *
+ * Check Introspection Access
+ *
+ *******/
+ {
+ XIntrospectionAccessRef xIntrospection = xInvoke->getIntrospection();
+ assert( xIntrospection.is() );
+
+ // no further test, simply call them
+ xIntrospection->getMethods(0);
+ xIntrospection->getProperties(0);
+
+ assert( xIntrospection->getSuppliedMethodConcepts() == 0 );
+ assert( xIntrospection->getSuppliedPropertyConcepts() == 0 );
+
+ Property prop = xIntrospection->getProperty( L"nIntTest" ,0 );
+ assert( prop.Name == L"nIntTest" );
+ assert( prop.Type->getTypeClass() == TypeClass_LONG );
+
+ XIdlMethodRef method = xIntrospection->getMethod( L"foo" , 0 );
+ assert( method->getName() == L"foo" );
+ }
+
+
+ /******
+ *
+ * Multithreading test
+ *
+ *******/
+
+ /******
+ *
+ * XDebuggingTest
+ *
+ ******/
+ // stop/doContinue + runAsync listener
+ {
+ // test hangs, if something is wrong
+
+ TestListener *pListener = new TestListener( &xDebug );
+ XEngineListenerRef ref( (XEngineListener * ) pListener , USR_QUERY );
+
+ // single listener check !
+ xEngine->runAsync( L"pass\n"
+ , XInterfaceRef() , Sequence<UsrAny> () , ref );
+ pListener->cmdLine();
+ }
+
+ // ListenerAdministration check !
+ {
+ // test hangs, if something is wrong
+
+ TestListener *pListener = new TestListener( &xDebug );
+ XEngineListenerRef ref( (XEngineListener * ) pListener , USR_QUERY );
+
+ // engine listener check !
+ xEngine->addEngineListener( ref );
+ xEngine->runAsync( L"pass\n"
+ , XInterfaceRef() , Sequence<UsrAny> () , XEngineListenerRef() );
+ pListener->cmdLine();
+ xEngine->removeEngineListener( ref);
+
+ }
+
+ // check the import mechanism
+ {
+ XLibraryAccessRef xLibrary( ( XLibraryAccess * ) new PythonCodeLibrary , USR_QUERY );
+ xEngine->setLibraryAccess( xLibrary );
+
+ xEngine->run( L"import testmodul\n"
+ L"x = testmodul.testmethod()\n" , XInterfaceRef() , Sequence<UsrAny>() );
+ UsrAny any = xInvoke->getValue( L"x" );
+ assert( any.getReflection()->getTypeClass() == TypeClass_LONG );
+ assert( any.getINT32() == 42 );
+ }
+
+ // check other imports
+ {
+ // Check, if the libraries are available at run time
+ xEngine->run( L"import math\n"
+ L"dMathTest = math.exp(0)\n" , XInterfaceRef() , Sequence<UsrAny> () );
+
+ assert( xInvoke->hasProperty( L"dMathTest" ) );
+ UsrAny any = xInvoke->getValue( L"dMathTest" );
+
+ assert( any.getReflection()->getTypeClass() == TypeClass_DOUBLE );
+ assert( any.getDouble() == 1. );
+ }
+
+ // Test connection to root object !
+ {
+ xEngine->run( L"x = stardiv.root.TestValue\n"
+ L"y = stardiv.inout(5)\n"
+ L"stardiv.root.getTestValueViaInout(y)\n"
+ L"z = y.value\n" , XInterfaceRef() , Sequence<UsrAny> () );
+
+ UsrAny any = xInvoke->getValue( L"x" );
+ assert( any.getReflection()->getTypeClass() == TypeClass_LONG );
+ assert( any.getINT32() == 15 );
+
+ any = xInvoke->getValue( L"z" );
+ assert( any.getReflection()->getTypeClass() == TypeClass_LONG );
+ assert( any.getINT32() == 15 );
+ }
+
+ // Test exactName interface
+ {
+ UsrAny any = xInvoke->getValue( L"__builtins__" );
+ assert( any.getReflection()->getTypeClass() == TypeClass_INTERFACE );
+
+ XInvokationRef rInv( *((XInterfaceRef *) any.get() ), USR_QUERY );
+ assert( rInv.is() );
+
+ XExactNameRef rName( *((XInterfaceRef*) any.get() ), USR_QUERY );
+ assert( rName.is() );
+
+ UString str = rName->getExactName( L"SYNTAXERROR" );
+ assert( str.len() );
+ }
+
+
+ // Test exactName interface of the engine itself
+ {
+ XExactNameRef rName( xInvoke , USR_QUERY );
+ assert( rName.is() );
+ UString str = rName->getExactName( L"STARDIV" );
+ assert( str.len() );
+ }
+
+
+ return 0;
+}
+
diff --git a/extensions/workben/pythontest.cxx b/extensions/workben/pythontest.cxx
new file mode 100644
index 000000000..4223a92d1
--- /dev/null
+++ b/extensions/workben/pythontest.cxx
@@ -0,0 +1,591 @@
+/*************************************************************************
+ *
+ * $RCSfile: pythontest.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <stardiv/uno/repos/implementationregistration.hxx>
+#include <stardiv/uno/script/script.hxx>
+#include <stardiv/uno/beans/exactname.hxx>
+
+#include <rtl/ustring.hxx>
+#include <vos/dynload.hxx>
+#include <vos/diagnose.hxx>
+#include <usr/services.hxx>
+#include <vcl/svapp.hxx>
+#include <usr/ustring.hxx>
+#include <usr/weak.hxx>
+#include <tools/string.hxx>
+#include <vos/conditn.hxx>
+#include <assert.h>
+
+#ifdef _USE_NAMESPACE
+using namespace rtl;
+using namespace vos;
+using namespace usr;
+#endif
+
+#define PCHAR_TO_USTRING(x) StringToOUString(String(x),CHARSET_SYSTEM)
+
+
+
+class NullEngineListenerRef : public XEngineListenerRef
+{
+ virtual void interrupt(const InterruptEngineEvent& Evt) THROWS( (UsrSystemException) ) {}
+ virtual void running(const EventObject& Evt) THROWS( (UsrSystemException) ) {}
+ virtual void finished(const FinishEngineEvent& Evt) THROWS( (UsrSystemException) ) {}
+};
+
+#define USTRING_TO_PCHAR(x) OUStringToString(x , CHARSET_DONTKNOW ).GetCharStr()
+
+class CmdDebugger :
+ public XEngineListener,
+ public OWeakObject
+{
+public:
+
+ CmdDebugger()
+ {
+ m_pDebuggingRef = 0;
+ m_pEngineRef = 0;
+ m_bIsTerminating = FALSE;
+ m_bIsRunning = FALSE;
+ }
+
+
+ CmdDebugger( XDebuggingRef *p, XEngineRef *pEngine , XInvokationRef *pInvokation)
+ {
+ attach( p , pEngine , pInvokation );
+ }
+
+ ~CmdDebugger()
+ {
+ if( m_pDebuggingRef ) {
+ detach();
+ }
+ }
+
+ BOOL queryInterface( Uik aUik, XInterfaceRef & rOut );
+ void acquire() { OWeakObject::acquire(); }
+ void release() { OWeakObject::release(); }
+ void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
+
+
+ void attach( XDebuggingRef *p , XEngineRef *pEngine , XInvokationRef *pInvokation )
+ {
+ m_pDebuggingRef = p;
+ m_pEngineRef = pEngine;
+ m_pInvokationRef = pInvokation;
+ m_bIsRunning = FALSE;
+ m_bIsTerminating = FALSE;
+ }
+
+ void detach( );
+
+
+ virtual void disposing( const EventObject &o )
+ {
+ if( m_pDebuggingRef ) {
+ detach();
+ }
+ }
+ virtual void interrupt(const InterruptEngineEvent& Evt) THROWS( (UsrSystemException) )
+ {
+ if( m_pDebuggingRef && ! m_bIsTerminating ) {
+ (*m_pDebuggingRef)->stop();
+ fprintf( stderr, "%s\n" , USTRING_TO_PCHAR(Evt.ErrorMessage ) );
+ fprintf( stderr, "%s.%s (%d)\n", USTRING_TO_PCHAR(Evt.SourceCode),
+ USTRING_TO_PCHAR(Evt.Name ),
+ Evt.StartLine );
+ m_aDebugCondition.set();
+ m_bIsRunning = TRUE;
+ }
+ }
+
+ virtual void running(const EventObject& Evt) THROWS( (UsrSystemException) )
+ {
+ if( m_pDebuggingRef && ! m_bIsTerminating ) {
+ (*m_pDebuggingRef)->stop();
+
+ m_aDebugCondition.set();
+ m_bIsRunning = TRUE;
+ fprintf( stderr, "%s\n" , "Script starts\n" );
+ }
+ }
+
+ virtual void finished(const FinishEngineEvent& Evt) THROWS( (UsrSystemException) )
+ {
+ if( m_pDebuggingRef && ! m_bIsTerminating ) {
+ m_aDebugCondition.set();
+ m_bIsRunning = FALSE;
+ fprintf( stderr , "%s\n", USTRING_TO_PCHAR( Evt.ErrorMessage ) );
+ }
+ }
+
+ void dumpIntrospectionToStream( const XIntrospectionAccessRef &, FILE *f );
+ void dumpVarToStream( const char *pcName, const UsrAny &any, FILE *f );
+
+
+ void cmdLine();
+protected:
+
+ OCondition m_aDebugCondition;
+ XDebuggingRef *m_pDebuggingRef;
+ XEngineRef *m_pEngineRef;
+ XInvokationRef *m_pInvokationRef;
+ int m_bIsRunning;
+ int m_bIsTerminating; // The listeners ignore everything when set
+};
+
+
+
+void CmdDebugger::cmdLine()
+{
+ char pcLine[80];
+ fprintf( stderr, "entering debugger\n" );
+ while( TRUE ) {
+
+ m_aDebugCondition.wait();
+
+ fprintf( stderr , "(debug %d) : " , m_bIsRunning );
+ fflush( stderr);
+ fgets( pcLine , 79 , stdin );
+
+ if( strlen( pcLine) ) pcLine[strlen(pcLine)-1] =0;
+ String sLine( pcLine );
+
+ if( ! strcmp( pcLine , "g" ) ) {
+ if( m_bIsRunning ) {
+ m_aDebugCondition.reset();
+ (*m_pDebuggingRef)->doContinue();
+ }
+ else fprintf( stderr,"no script running !\n" );
+ }
+ else if( ! strcmp( pcLine , "s" ) ) {
+ if( m_bIsRunning ) {
+ m_aDebugCondition.reset();
+ (*m_pDebuggingRef)->stepOver();
+ }
+ else fprintf(stderr, "no script running !\n" );
+ }
+ else if( ! strcmp( pcLine , "so" ) ) {
+ if( m_bIsRunning ) {
+ m_aDebugCondition.reset();
+ (*m_pDebuggingRef)->stepOut();
+ }
+ else fprintf(stderr, "no script running !\n" );
+ }
+ else if( ! strcmp( pcLine , "si" ) ) {
+ if( m_bIsRunning ) {
+ m_aDebugCondition.reset();
+ (*m_pDebuggingRef)->stepIn();
+ }
+ else fprintf(stderr, "no script running !\n" );
+ }
+ else if( ! strncmp( pcLine , "sbp" , 3 ) ){
+ if( m_bIsRunning ) {
+ (*m_pDebuggingRef)->setBreakPoint( UString( L"<string>" ),
+ atoi(&pcLine[3]) , TRUE );
+ }
+ }
+ else if( ! strncmp( pcLine , "rbp" , 3 ) ){
+ if( m_bIsRunning ) {
+ (*m_pDebuggingRef)->setBreakPoint( UString( L"<string>" ),
+ atoi(&pcLine[3]) , FALSE );
+ }
+ }
+ else if( ! strncmp( pcLine , "dv " , 3 ) ) {
+ if( m_bIsRunning ) {
+ int nCallstack = 0;
+ if( sLine.GetQuotedTokenCount( String("''"),' ' ) == 3 ) {
+ nCallstack = atoi( sLine.GetQuotedToken( 3 , String("''"), ' ' ).GetCharStr() );
+ }
+
+ UString str = (*m_pDebuggingRef)->dumpVariable(
+ PCHAR_TO_USTRING( &pcLine[3]),nCallstack);
+ fprintf( stderr, "%s\n" , USTRING_TO_PCHAR( str ) );
+ }
+ }
+ else if( ! strncmp( pcLine , "sv " , 3 ) ) {
+ int nCallstack = 0;
+ if( sLine.GetQuotedTokenCount( String("''"),' ' ) == 3 ) {
+ nCallstack = atoi( sLine.GetQuotedToken( 3 , String("''"), ' ' ).GetCharStr() );
+ }
+ (*m_pDebuggingRef)->setVariable(
+ StringToOUString( sLine.GetQuotedToken( 1 , String("''"), ' ' ), CHARSET_SYSTEM ),
+ StringToOUString( sLine.GetQuotedToken( 2 , String("''"), ' ' ), CHARSET_SYSTEM ),
+ nCallstack );
+
+ }
+ else if( ! strncmp( pcLine , "ci" ,2 ) ) {
+ if( m_bIsRunning ) {
+ UString *aUString ;
+ ContextInformation ci = (*m_pDebuggingRef)->getContextInformation(atoi(&pcLine[2]));
+ int i,iMax;
+
+ fprintf( stderr, "File %s (%d)\n", USTRING_TO_PCHAR(ci.Name),
+ ci.StartLine );
+ fprintf( stderr, "Available variables : \n" );
+ aUString = ci.LocalVariableNames.getArray();
+ iMax = ci.LocalVariableNames.getLen();
+
+ for( i = 0 ; i < iMax ; i++ ) {
+ fprintf( stderr, " %s\n" , USTRING_TO_PCHAR( aUString[i]) );
+ }
+ }
+ }
+ else if ( !strcmp( pcLine , "d" ) ) {
+ if( m_bIsRunning ) {
+ UString * aUString ;
+ Sequence<UString> seq = (*m_pDebuggingRef)->getStackTrace();
+
+ aUString = seq.getArray();
+ int iMax = seq.getLen();
+ for( int i = 0; i < iMax ; i++ ) {
+ fprintf( stderr , "%s\n" , USTRING_TO_PCHAR( aUString[i] ) );
+ }
+ }
+ }
+ else if( !strcmp( pcLine , "c" ) ) {
+ if( m_bIsRunning ) {
+ (*m_pEngineRef)->cancel();
+ m_aDebugCondition.reset();
+ }
+ else fprintf( stderr,"no script running !\n" );
+ }
+ else if( !strcmp( pcLine , "q" ) ) {
+ if( m_bIsRunning ) {
+ m_aDebugCondition.reset();
+ (*m_pEngineRef)->cancel();
+ }
+ else {
+ m_bIsTerminating = TRUE;
+ fprintf(stderr, "Debugger terminates\n" );
+ break;
+ }
+ }
+ else if( ! strcmp( pcLine , "id" ) ) {
+
+ XIntrospectionAccessRef ref = (*m_pInvokationRef)->getIntrospection();
+
+ dumpIntrospectionToStream( ref , stderr );
+
+
+ }
+ else if( ! strncmp( pcLine , "idv" , 3) ) {
+ TRY {
+ UsrAny any = (*m_pInvokationRef)->getValue( PCHAR_TO_USTRING( &(pcLine[4]) ) );
+ dumpVarToStream( &(pcLine[4]) , any , stderr );
+ }
+ CATCH(UnknownPropertyException,e) {
+ fprintf( stderr, "UnknownPropertyException\n" );
+ }
+ CATCH(IllegalArgumentException,e) {
+ fprintf( stderr, "IllegalArgumentException\n" );
+ }
+ }
+ else if( !strcmp( pcLine , "t" ) ) {
+ }
+ else if( !strcmp( pcLine , "h" ) ) {
+ fprintf( stderr , "\nvalid commands :\n"
+ "Go : g\n"
+ "StepOver : s\n"
+ "StepIn : si\n"
+ "StepOut : so\n"
+ "Set BreakPoint : sbp Line [ModuleName]\n"
+ "Remove BreakPoint : rbp [Line] [ModuleName]\n"
+ "via XDebugging Interface :\n"
+ " dump Variable : dv varname [CallStack]\n"
+ " set Variable : sv varname value [CallStack]\n"
+ "globals via XInvokation Interface :\n"
+ " dump Global vars : id\n"
+ " dump Variable : idv varname\n"
+ " set Variable : isv varname value\n"
+ "ContextInformation : ci\n"
+ "Dump callstack : d\n"
+ "Cancel : c (stops actual script)\n"
+ "Quit : q (exits debugger)\n"
+ );
+ }
+ else if( ! strlen( pcLine ) ) {
+ }
+ else {
+ fprintf( stderr , "unknown command %s\n" , pcLine );
+ }
+ }
+}
+
+void CmdDebugger::dumpIntrospectionToStream( const XIntrospectionAccessRef &ref, FILE *f )
+{
+ int i,iMax;
+ fprintf( stderr, "Callable Attributes (Methods) :\n" );
+ Sequence<XIdlMethodRef> seq = ref->getMethods( 0 );
+ iMax = seq.getLen();
+ XIdlMethodRef *aRef = seq.getArray();
+ for( i = 0; i < iMax ; i++ ) {
+ fprintf( f, " %s\n" , USTRING_TO_PCHAR( aRef[i]->getName( ) ) );
+ }
+
+ fprintf( stderr, "Other attributes\n" );
+ Sequence<Property> seqProp = ref->getProperties( 0 );
+ iMax = seqProp.getLen();
+ Property *aProp = seqProp.getArray();
+ for( i = 0; i < iMax ; i ++ ) {
+ fprintf( f, " %s %s\n" , USTRING_TO_PCHAR( aProp[i].Type->getName() ),
+ USTRING_TO_PCHAR( aProp[i].Name ) );
+ }
+
+}
+
+void CmdDebugger::dumpVarToStream( const char *pc , const UsrAny &aValue, FILE *f )
+{
+ TypeClass type = aValue.getReflection()->getTypeClass();
+
+ if( TypeClass_INT == type ) {
+ fprintf( f, "INT32 %s : %d\n" , pc , aValue.getINT32() );
+ }
+ else if( TypeClass_ENUM == type ) {
+ fprintf( f, "ENUM %s : %d\n", pc , aValue.getEnumAsINT32() );
+ }
+ else if( TypeClass_STRING == type ) {
+ fprintf( f, "STRING %s : %s\n" , pc , USTRING_TO_PCHAR( aValue.getString()) );
+ }
+ else if( TypeClass_BOOLEAN == type ) {
+ fprintf( f, "BOOL %s : %d\n", pc , aValue.getBOOL() );
+ }
+ else if( TypeClass_CHAR == type ) {
+ fprintf( f, "char %s : %d\n", pc , ( INT32) aValue.getChar() );
+ }
+ else if( TypeClass_SHORT == type ) {
+ fprintf( f, "INT16 %s : %d\n", pc , (INT32) aValue.getINT16());
+ }
+ else if( TypeClass_LONG == type ) {
+ fprintf( f, "LONG %s : %d\n", pc , (INT32) aValue.getINT32());
+ }
+ else if( TypeClass_UNSIGNED_SHORT == type ) {
+ fprintf( f, "UINT16 %s : %d\n", pc , (INT32) aValue.getUINT16() );
+ }
+ else if( TypeClass_UNSIGNED_BYTE == type ) {
+ fprintf( f, "Byte %s : %d\n", pc , (INT32) aValue.getBYTE() );
+ }
+ else if( TypeClass_UNSIGNED_INT == type ) {
+ fprintf( f, "UINT32 %s : %d\n", pc , aValue.getUINT32() );
+ }
+ else if( TypeClass_FLOAT == type ) {
+ fprintf( f, "float %s : %f\n" , pc , aValue.getFloat() );
+ }
+ else if( TypeClass_DOUBLE == type ) {
+ fprintf( f, "double %s : %f\n" , pc , aValue.getDouble() );
+ }
+ else if( TypeClass_VOID == type ) {
+ fprintf( f, "void %s :\n" , pc );
+ }
+ else if( TypeClass_INTERFACE == type ) {
+ // Check, what has been put in
+ if( aValue.getReflection() == XPropertySet_getReflection() ) {
+ // XPropertySet !
+ XPropertySetRef *pRef = ( XPropertySetRef * ) aValue.get();
+ XPropertySetInfoRef refInfo = (*pRef)->getPropertySetInfo();
+ Sequence< Property > seq = refInfo->getProperties();
+ int i,iMax = seq.getLen();
+
+ Property *pArray;
+ pArray = seq.getArray();
+ fprintf( stderr, "Property List :\n" );
+ for( i = 0; i < iMax ; i ++ ) {
+ fprintf( f, "%s\t %s\n" , USTRING_TO_PCHAR(pArray[i].Type->getName()),
+ USTRING_TO_PCHAR( pArray[i].Name ) );
+ }
+ }
+ else if( aValue.getReflection() == XInvokation_getReflection() ) {
+ XInvokationRef *pRef = ( XInvokationRef * ) aValue.get();
+ XIntrospectionAccessRef refIntro = (*pRef)->getIntrospection();
+
+ dumpIntrospectionToStream( refIntro, stderr );
+ }
+ }
+ else if( TypeClass_SEQUENCE == type ) {
+ fprintf( f , "%s Sequence \n" , pc );
+ String s( " " );
+ s += pc;
+ SequenceReflection *pSeqRefl = ( SequenceReflection * ) aValue.getReflection();
+
+ int i,iMax = pSeqRefl->getLen( aValue );
+
+ for( i = 0 ; i < iMax ; i ++ ) {
+ dumpVarToStream( s.GetCharStr() , pSeqRefl->get( aValue , i ) , stderr );
+ }
+ }
+ else {
+ fprintf( f, "%s : unknown %d\n" , pc , type );
+ }
+
+}
+
+void CmdDebugger::detach()
+{
+ assert( m_pDebuggingRef );
+
+ m_bIsRunning = FALSE;
+ m_pDebuggingRef = 0;
+ m_pEngineRef = 0;
+ m_pInvokationRef = 0;
+}
+
+// Methoden von XInterface
+BOOL CmdDebugger::queryInterface( Uik aUik, XInterfaceRef & rOut )
+{
+ if( aUik == XEngineListener::getSmartUik() )
+ rOut = (XEngineListener*)this;
+ else
+ return OWeakObject::queryInterface( aUik, rOut );
+ return TRUE;
+}
+
+
+
+
+
+
+/*
+ * main.
+ */
+int __LOADONCALLAPI main (int argc, char **argv)
+{
+ XMultiServiceFactoryRef xSMgr = createRegistryServiceManager();
+ registerUsrServices( xSMgr );
+ setProcessServiceManager( xSMgr );
+
+ XInterfaceRef x = xSMgr->createInstance( L"stardiv.uno.repos.ImplementationRegistration" );
+ XImplementationRegistrationRef xReg( x, USR_QUERY );
+ sal_Char szBuf[1024];
+
+ ORealDynamicLoader::computeModuleName( "pythonengine", szBuf, 1024 );
+ UString aDllName( StringToOUString( szBuf, CHARSET_SYSTEM ) );
+ xReg->registerImplementation( L"stardiv.loader.SharedLibrary", aDllName, XSimpleRegistryRef() );
+
+ ORealDynamicLoader::computeModuleName( "aps", szBuf, 1024 );
+ aDllName = UString( StringToOUString( szBuf, CHARSET_SYSTEM ) );
+ xReg->registerImplementation( L"stardiv.loader.SharedLibrary", aDllName, XSimpleRegistryRef() );
+
+ XInterfaceRef y = xSMgr->createInstance( L"stardiv.script.Python" );
+ XEngineRef yEngine( y, USR_QUERY );
+
+ x = xSMgr->createInstance( L"stardiv.script.Python" );
+ XEngineRef xEngine( x, USR_QUERY );
+
+
+ UString Script;
+
+ Sequence<UsrAny> args(3);
+ UsrAny *pArray = args.getArray();
+ pArray[0].setString( L"Arg_0" );
+ pArray[1].setString( L"Arg_1" );
+ pArray[2].setString( L"Arg_2" );
+
+ if( argc > 2) {
+ Script = StringToOUString( String( argv[2] ) , CHARSET_DONTKNOW );
+ }
+
+ XInvokationRef xInvokation( x , USR_QUERY );
+ XDebuggingRef xDebug( x , USR_QUERY );
+
+ CmdDebugger *pDbg = new CmdDebugger( &xDebug , &xEngine , &xInvokation );
+
+ XEngineListenerRef xDebugRef( (XEngineListener *) pDbg , USR_QUERY);
+ xEngine->addEngineListener( xDebugRef );
+
+
+ if( argc >1 && ! strcmp( argv[1] , "1" ) ) {
+ fprintf( stderr, "one thread only\n" );
+ Script = UString( L"print 'Hello World'\n" );
+ xEngine->runAsync( Script , XInterfaceRef(), args , XEngineListenerRef() );
+ }
+ else if( argc >1 && ! strcmp( argv[1] , "2" ) ) {
+
+ xEngine->runAsync( UString( L"x=1\nprint 1\n") , XInterfaceRef(), args , XEngineListenerRef() );
+ xEngine->runAsync( UString( L"x=x+1\nprint 2\n") , XInterfaceRef(), args , XEngineListenerRef() );
+ xEngine->runAsync( UString( L"x=x+1\nprint 3\n") , XInterfaceRef(), args , XEngineListenerRef());
+ xEngine->runAsync( UString( L"x=x+1\nprint 4\n") , XInterfaceRef(), args , XEngineListenerRef() );
+
+
+
+ }
+ else if( argc >1 && ! strcmp( argv[1] , "3" ) ) {
+
+ fprintf( stderr , "1st thread in engine y, next 5 threads in engine x\n" );
+ yEngine->runAsync( UString( L"print 1\n") , XInterfaceRef(), args , XEngineListenerRef() );
+ xEngine->runAsync( UString( L"print 2\n") , XInterfaceRef(), args , XEngineListenerRef() );
+ xEngine->runAsync( UString( L"print 3\n") , XInterfaceRef(), args , XEngineListenerRef() );
+ xEngine->runAsync( UString( L"print 4\n") , XInterfaceRef(), args , XEngineListenerRef());
+ xEngine->runAsync( UString( L"print 5\n") , XInterfaceRef(), args , XEngineListenerRef());
+ xEngine->runAsync( UString( L"print 6\n") , XInterfaceRef(), args , XEngineListenerRef());
+
+
+ }
+ pDbg->cmdLine();
+
+ xEngine->removeEngineListener( xDebugRef );
+
+ xReg->revokeImplementation( aDllName, XSimpleRegistryRef() );
+
+ fprintf( stderr, "main terminates\n" );
+ return 0;
+}
+
diff --git a/extensions/workben/testcomponent.cxx b/extensions/workben/testcomponent.cxx
new file mode 100644
index 000000000..1fd474a83
--- /dev/null
+++ b/extensions/workben/testcomponent.cxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * $RCSfile: testcomponent.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//------------------------------------------------------
+// testcomponent - Loads a service and its testcomponent from dlls performs a test.
+// Expands the dll-names depending on the actual environment.
+// Example : testcomponent stardiv.uno.io.Pipe stm
+//
+// Therefor the testcode must exist in teststm and the testservice must be named test.stardiv.uno.io.Pipe
+//
+
+#include <stdio.h>
+#include <smart/com/sun/star/registry/XImplementationRegistration.hxx>
+#include <smart/com/sun/star/lang/XComponent.hxx>
+//#include <com/sun/star/registry/ stardiv/uno/repos/simplreg.hxx>
+
+#include <vos/dynload.hxx>
+#include <vos/diagnose.hxx>
+#include <usr/services.hxx>
+#include <vcl/svapp.hxx>
+#include <usr/ustring.hxx>
+#include <tools/string.hxx>
+#include <vos/conditn.hxx>
+
+#include <assert.h>
+
+#include <smart/com/sun/star/test/XSimpleTest.hxx>
+
+#ifdef _USE_NAMESPACE
+using namespace rtl;
+using namespace vos;
+using namespace usr;
+#endif
+
+
+// Needed to switch on solaris threads
+#ifdef SOLARIS
+extern "C" void ChangeGlobalInit();
+#endif
+
+int __LOADONCALLAPI main (int argc, char **argv)
+{
+
+ if( argc < 3) {
+ printf( "usage : testcomponent service dll [additional dlls]\n" );
+ exit( 0 );
+ }
+#ifdef SOLARIS
+ // switch on threads in solaris
+ ChangeGlobalInit();
+#endif
+
+ // create service manager
+// XMultiServiceFactoryRef xSMgr = getProcessServiceManager();
+ XMultiServiceFactoryRef xSMgr = createRegistryServiceManager();
+ assert( xSMgr.is() );
+ registerUsrServices( xSMgr );
+ setProcessServiceManager( xSMgr );
+
+ XImplementationRegistrationRef xReg;
+ XSimpleRegistryRef xSimpleReg;
+
+ TRY {
+ // Create registration service
+ XInterfaceRef x = xSMgr->createInstance(
+ UString::createFromAscii( "com.sun.star.registry.ImplementationRegistration" ) );
+ x->queryInterface( XImplementationRegistration::getSmartUik() , xReg );
+
+/* x = xSMgr->createInstance( L"stardiv.uno.repos.SimpleRegistry" );
+ assert( x.is() );
+ x->queryInterface( XSimpleRegistry::getSmartUik() , xSimpleReg );
+ assert( xSimpleReg.is() );
+ xSimpleReg->open( L"testcomp.rdb" , FALSE , TRUE );
+*/ }
+ CATCH( Exception ,e ) {
+ printf( "%s\n" , OWStringToOString( e.getName() , CHARSET_SYSTEM ).getStr() );
+ exit(1);
+ }
+ END_CATCH;
+
+ sal_Char szBuf[1024];
+ OString sTestName;
+
+ TRY {
+ // Load dll for the tested component
+ for( int n = 2 ; n <argc ; n ++ ) {
+ ORealDynamicLoader::computeModuleName( argv[n] , szBuf, 1024 );
+ UString aDllName( OStringToOWString( szBuf, CHARSET_SYSTEM ) );
+
+ xReg->registerImplementation(
+ UString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),
+ aDllName,
+ xSimpleReg );
+ }
+ }
+ CATCH( Exception, e ) {
+ printf( "Couldn't reach dll %s\n" , szBuf );
+ printf( "%s\n" , OWStringToOString( e.getName() , CHARSET_SYSTEM ).getStr() );
+
+ exit(1);
+ }
+ END_CATCH;
+
+
+ TRY {
+ // Load dll for the test component
+ sTestName = "test";
+ sTestName += argv[2];
+
+ ORealDynamicLoader::computeModuleName( sTestName.getStr() , szBuf, 1024 );
+ UString aDllName = OStringToOWString( szBuf, CHARSET_SYSTEM );
+ xReg->registerImplementation(
+ UString::createFromAscii( "com.sun.star.loader.SharedLibrary" ) ,
+ aDllName,
+ xSimpleReg );
+ }
+ CATCH( Exception , e ) {
+ printf( "Couldn't reach dll %s\n" , szBuf );
+ printf( "%s\n" , OWStringToOString( e.getName() , CHARSET_SYSTEM ).getStr() );
+ exit(1);
+ }
+ END_CATCH;
+
+
+ // Instantiate test service
+ sTestName = "test.";
+ sTestName += argv[1];
+
+ XInterfaceRef xIntTest = xSMgr->createInstance( OStringToOWString( sTestName , CHARSET_SYSTEM ) );
+ XSimpleTestRef xTest( xIntTest , USR_QUERY );
+
+ if( ! xTest.is() ) {
+ printf( "Couldn't instantiate test service \n" );
+ exit( 1 );
+ }
+
+
+ INT32 nHandle = 0;
+ INT32 nNewHandle;
+ INT32 nErrorCount = 0;
+ INT32 nWarningCount = 0;
+
+ // loop until all test are performed
+ while( nHandle != -1 ) {
+
+ // Instantiate serivce
+ XInterfaceRef x = xSMgr->createInstance( OStringToOWString( argv[1] , CHARSET_SYSTEM ) );
+ if( ! x.is() ) {
+ printf( "Couldn't instantiate service !\n" );
+ exit( 1 );
+ }
+
+ // do the test
+ TRY {
+ nNewHandle = xTest->test( OStringToOWString( argv[1] , CHARSET_SYSTEM ) , x , nHandle );
+ }
+ CATCH ( Exception , e ) {
+ printf( "testcomponent : uncaught exception %s\n" ,
+ OWStringToOString( e.getName(), CHARSET_SYSTEM ).getStr() );
+ exit(1);
+ }
+ AND_CATCH_ALL() {
+ printf( "testcomponent : uncaught unknown exception\n" );
+ exit(1);
+ }
+ END_CATCH;
+
+
+ // print errors and warning
+ Sequence<UString> seqErrors = xTest->getErrors();
+ Sequence<UString> seqWarnings = xTest->getWarnings();
+ if( seqWarnings.getLen() > nWarningCount ) {
+ printf( "Warnings during test %d!\n" , nHandle );
+ for( ; nWarningCount < seqWarnings.getLen() ; nWarningCount ++ ) {
+ printf( "Warning\n%s\n---------\n" ,
+ OWStringToOString( seqWarnings.getArray()[nWarningCount], CHARSET_SYSTEM ).getStr() );
+ }
+ }
+
+
+ if( seqErrors.getLen() > nErrorCount ) {
+ printf( "Errors during test %d!\n" , nHandle );
+ for( ; nErrorCount < seqErrors.getLen() ; nErrorCount ++ ) {
+ printf( "%s\n" ,
+ OWStringToOString(
+ seqErrors.getArray()[nErrorCount], CHARSET_SYSTEM ).getStr() );
+ }
+ }
+
+ nHandle = nNewHandle;
+ }
+
+ if( xTest->testPassed() ) {
+ printf( "Test passed !\n" );
+ }
+ else {
+ printf( "Test failed !\n" );
+ }
+
+ XComponentRef rComp( xSMgr , USR_QUERY );
+ rComp->dispose();
+ return 0;
+}
diff --git a/extensions/workben/testframecontrol.cxx b/extensions/workben/testframecontrol.cxx
new file mode 100644
index 000000000..b1f933de3
--- /dev/null
+++ b/extensions/workben/testframecontrol.cxx
@@ -0,0 +1,355 @@
+/*************************************************************************
+ *
+ * $RCSfile: testframecontrol.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#pragma hdrstop
+//#include <vos/mutex.hxx>
+#include <vos/dynload.hxx>
+
+#include <vcl/wrkwin.hxx>
+#include <vcl/svapp.hxx>
+
+#include <stardiv/uno/repos/implementationregistration.hxx>
+#include <stardiv/uno/repos/serinfo.hxx>
+#include <stardiv/uno/awt/vcllstnr.hxx>
+#include <stardiv/uno/awt/device.hxx>
+#include <stardiv/uno/awt/graphics.hxx>
+#include <stardiv/uno/awt/vclwin.hxx>
+
+#include <usr/services.hxx>
+
+#include <svtools/unoiface.hxx>
+
+#ifdef _USE_NAMESPACE
+using namespace vos;
+using namespace usr;
+#endif
+
+//==================================================================================================
+class Listener_Impl
+ : public UsrObject
+ , public XMouseListener
+ , public XMouseMotionListener
+ , public XKeyListener
+ , public XWindowListener
+ , public XFocusListener
+ , public XPaintListener
+{
+public:
+ SMART_UNO_DECLARATION( Listener_Impl, UsrObject );
+
+ virtual BOOL queryInterface( Uik aUik, XInterfaceRef& rOut );
+
+ // XMouseListener
+ virtual void mousePressed( const VclMouseEvent& evt );
+ virtual void mouseReleased( const VclMouseEvent& evt );
+ virtual void mouseEntered( const VclMouseEvent& evt );
+ virtual void mouseExited( const VclMouseEvent& evt );
+
+ // XMouseMotionListener
+ virtual void mouseDragged( const VclMouseEvent& evt );
+ virtual void mouseMoved( const VclMouseEvent& evt );
+
+ // XKeyListener
+ virtual void keyPressed( const VclKeyEvent& evt );
+ virtual void keyReleased( const VclKeyEvent& evt );
+
+ // XFocusListener
+ virtual void focusGained( const FocusEvent& evt );
+ virtual void focusLost( const FocusEvent& evt );
+
+ // XWindowListener
+ virtual void windowResized( const WindowEvent& evt );
+ virtual void windowMoved( const WindowEvent& evt );
+ virtual void windowShown( const EventObject& evt );
+ virtual void windowHidden( const EventObject& evt );
+
+ // XPaintListener
+ virtual void windowPaint( const PaintEvent& evt );
+
+ // XEventListener
+ virtual void disposing( const EventObject& evt );
+
+public:
+ void addAllListeners( const XControlRef& xControl );
+ void removeAllListeners( const XControlRef& xControl );
+};
+
+//--------------------------------------------------------------------------------------------------
+void Listener_Impl::addAllListeners( const XControlRef& xControl )
+{
+ XWindowRef xWindow( xControl, USR_QUERY );
+
+ xWindow->addMouseListener( (XMouseListener*)this );
+ xWindow->addMouseMotionListener( (XMouseMotionListener*)this );
+ xWindow->addKeyListener( (XKeyListener*)this );
+ xWindow->addFocusListener( (XFocusListener*)this );
+ xWindow->addWindowListener( (XWindowListener*)this );
+ xWindow->addPaintListener( (XPaintListener*)this );
+ // cast due to ambiguities
+ xControl->addEventListener( (XEventListener*)(XPaintListener*)this );
+}
+
+//--------------------------------------------------------------------------------------------------
+void Listener_Impl::removeAllListeners( const XControlRef& xControl )
+{
+ XWindowRef xWindow( xControl, USR_QUERY );
+
+ xWindow->removeMouseListener( (XMouseListener*)this );
+ xWindow->removeMouseMotionListener( (XMouseMotionListener*)this );
+ xWindow->removeKeyListener( (XKeyListener*)this );
+ xWindow->removeFocusListener( (XFocusListener*)this );
+ xWindow->removeWindowListener( (XWindowListener*)this );
+ xWindow->removePaintListener( (XPaintListener*)this );
+ // cast due to ambiguities
+ xControl->removeEventListener( (XEventListener*)(XPaintListener*)this );
+}
+
+//--------------------------------------------------------------------------------------------------
+SMART_UNO_IMPLEMENTATION( Listener_Impl, UsrObject );
+
+//--------------------------------------------------------------------------------------------------
+BOOL Listener_Impl::queryInterface( Uik aUik, XInterfaceRef& rOut )
+{
+ if (aUik == XMouseListener::getSmartUik())
+ rOut = (XMouseListener*)this;
+ else if (aUik == XMouseMotionListener::getSmartUik())
+ rOut = (XMouseMotionListener*)this;
+ else if (aUik == XWindowListener::getSmartUik())
+ rOut = (XWindowListener*)this;
+ else if (aUik == XFocusListener::getSmartUik())
+ rOut = (XFocusListener*)this;
+ else if (aUik == XKeyListener::getSmartUik())
+ rOut = (XKeyListener*)this;
+ else if (aUik == XPaintListener::getSmartUik())
+ rOut = (XPaintListener*)this;
+ else if (aUik == ((XEventListener*)NULL)->getSmartUik())
+ rOut = (XEventListener*)(XMouseListener*)this;
+ else
+ return UsrObject::queryInterface( aUik, rOut );
+
+ return TRUE;
+}
+
+//--------------------------------------------------------------------------------------------------
+// XMouseListener
+void Listener_Impl::mousePressed( const VclMouseEvent& evt ) {}
+void Listener_Impl::mouseReleased( const VclMouseEvent& evt ) {}
+void Listener_Impl::mouseEntered( const VclMouseEvent& evt ) {}
+void Listener_Impl::mouseExited( const VclMouseEvent& evt ) {}
+
+// XMouseMotionListener
+void Listener_Impl::mouseDragged( const VclMouseEvent& evt ) {}
+void Listener_Impl::mouseMoved( const VclMouseEvent& evt ) {}
+
+// XKeyListener
+void Listener_Impl::keyPressed( const VclKeyEvent& evt ) {}
+void Listener_Impl::keyReleased( const VclKeyEvent& evt ) {}
+
+// XFocusListener
+void Listener_Impl::focusGained( const FocusEvent& evt ) {}
+void Listener_Impl::focusLost( const FocusEvent& evt ) {}
+
+// XWindowListener
+void Listener_Impl::windowResized( const WindowEvent& evt ) {}
+void Listener_Impl::windowMoved( const WindowEvent& evt ) {}
+void Listener_Impl::windowShown( const EventObject& evt ) {}
+void Listener_Impl::windowHidden( const EventObject& evt ) {}
+
+// XPaintListener
+void Listener_Impl::windowPaint( const PaintEvent& evt )
+{
+ if (evt.Source.is())
+ {
+ XControlRef xControl( evt.Source, USR_QUERY );
+ if (xControl.is())
+ {
+ XDeviceRef xDev( xControl->getPeer(), USR_QUERY );
+ XGraphicsRef xGraphics = xDev->createGraphics();
+ xGraphics->drawLine( 0, 0, 200, 200 );
+ xGraphics->drawLine( 200, 0, 0, 200 );
+ }
+ }
+}
+
+// XEventListener
+void Listener_Impl::disposing( const EventObject& evt ) {}
+
+
+//==================================================================================================
+class FrameControlApplication
+ : public Application
+{
+public:
+ virtual void Main();
+ virtual void ShowStatusText( const XubString& rText );
+
+public:
+ FrameControlApplication() {}
+
+private:
+ void init();
+ void deinit();
+
+private:
+ Listener_Impl* _pListener;
+ XControlRef _xControl;
+
+ WorkWindow* _pWorkWin;
+};
+
+FrameControlApplication g_App;
+
+#ifdef __MWERKS__
+Application* pApp = &g_App;
+#endif
+
+
+//--------------------------------------------------------------------------------------------------
+void FrameControlApplication::init()
+{
+ XMultiServiceFactoryRef xMgr = createRegistryServiceManager( L"test.rdb" );
+ registerUsrServices( xMgr );
+ setProcessServiceManager( xMgr );
+ InitExtVclToolkit();
+ Application::RegisterUnoServices();
+
+ XServiceRegistryRef xRegMgr(xMgr, USR_QUERY);
+
+ XImplementationRegistrationRef xIR( xMgr->createInstance(L"stardiv.uno.repos.ImplementationRegistration"), USR_QUERY );
+ TRY
+ {
+ char szDllName[_MAX_PATH]="";
+
+ ORealDynamicLoader::computeModuleName("fc", szDllName, _MAX_PATH);
+ UString aFCDllName = StringToOUString(szDllName, CHARSET_SYSTEM);
+ xIR->registerImplementation(L"stardiv.loader.SharedLibrary", aFCDllName, XSimpleRegistryRef() );
+ }
+ CATCH( CannotRegisterImplementationException, e )
+ {
+ }
+ END_CATCH;
+
+
+
+ // ...
+
+ XInterfaceRef xInst = xMgr->createInstance( L"stardiv.one.frame.FrameControl" );
+ if (xInst->queryInterface( XControl::getSmartUik(), _xControl ))
+ {
+ _pWorkWin = new WorkWindow( NULL, WB_APP | WB_STDWORK );
+ _pWorkWin->Show();
+ XWindowPeerRef xParent( _pWorkWin->GetComponentInterface() );
+
+ XToolkitRef xToolkit( xMgr->createInstance( L"stardiv.vcl.VclToolkit" ), USR_QUERY );
+ //xToolkit = XToolkitRef( xMgr->createInstance( L"stardiv.uno.awt.Toolkit" ), USR_QUERY );
+ _xControl->createPeer( xToolkit, xParent );
+ XWindowRef xWin( _xControl, USR_QUERY );
+ xWin->setPosSize( 50, 50, 400, 400, PosSize_POSSIZE );
+ xWin->setVisible( TRUE );
+
+ _pListener = new Listener_Impl();
+ _pListener->acquire();
+ _pListener->addAllListeners( _xControl );
+ // ... on paint a cross should be drawn
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+void FrameControlApplication::deinit()
+{
+ if (_pListener)
+ {
+
+ _pListener->removeAllListeners( _xControl );
+ _xControl->dispose(); // disposing event should occur
+ _pListener->release();
+ _pListener = NULL;
+
+ _xControl = XControlRef();
+ }
+
+ _pWorkWin->Hide();
+ delete _pWorkWin;
+}
+
+
+//--------------------------------------------------------------------------------------------------
+void FrameControlApplication::Main()
+{
+// void TestErrcodes();
+// TestErrcodes();
+
+ EnterMultiThread();
+ SetAppName( "RadioActiveControl-Demo" );
+ EnableSVLook();
+
+ init();
+
+ Execute();
+
+ deinit();
+}
+
+//--------------------------------------------------------------------------------------------------
+void FrameControlApplication::ShowStatusText( const XubString& rStatus )
+{
+ Application::GetAppWindow()->SetText( rStatus );
+}
diff --git a/extensions/workben/testpgp.cxx b/extensions/workben/testpgp.cxx
new file mode 100644
index 000000000..73a37506e
--- /dev/null
+++ b/extensions/workben/testpgp.cxx
@@ -0,0 +1,918 @@
+/*************************************************************************
+ *
+ * $RCSfile: testpgp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+#ifndef _RTL_MEMORY_H_
+#include <rtl/memory.h>
+#endif
+#ifndef _RTL_WSTRING_
+#include <rtl/wstring>
+#endif
+
+#ifndef _VOS_MACROS_HXX_
+#include <vos/macros.hxx>
+#endif
+
+#ifndef _USR_SMARTSERVICES_HXX_
+#include <usr/smartservices.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XOutputStream.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_PGP_RECIPIENTSEVENT_HPP_
+#include <com/sun/star/pgp/RecipientsEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PGP_SIGNATUREEVENT_HPP_
+#include <com/sun/star/pgp/SignatureEvent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PGP_XPGPDECODER_HPP_
+#include <com/sun/star/pgp/XPGPDecoder.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PGP_XPGPDECODERLISTENER_HPP_
+#include <com/sun/star/pgp/XPGPDecoderListener.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PGP_XPGPENCODER_HPP_
+#include <com/sun/star/pgp/XPGPEncoder.hpp>
+#endif
+#ifndef _COM_SUN_STAR_PGP_XPGPPREFERENCES_HPP_
+#include <com/sun/star/pgp/XPGPPreferences.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_
+#include <com/sun/star/uno/XInterface.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_H_
+#include <com/sun/star/uno/Any.h>
+#endif
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+
+#ifndef _CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <fcntl.h>
+#include <io.h>
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::io;
+using namespace com::sun::star::pgp;
+using namespace com::sun::star::uno;
+
+/*========================================================================
+ *
+ * DataSource_Impl interface.
+ *
+ *======================================================================*/
+class DataSource_Impl :
+ public OWeakObject,
+ public XInputStream
+{
+ Sequence<sal_Int8> m_buffer;
+ sal_Int32 m_position;
+ int m_fd;
+
+public:
+ DataSource_Impl (int fd = 0);
+ virtual ~DataSource_Impl (void);
+
+ void setBuffer (const Sequence<sal_Int8> &rBuffer);
+
+ /** XInterface.
+ */
+ virtual sal_Bool SAL_CALL queryInterface (
+ const Uik &rUik, Any &rIfc) throw(RuntimeException);
+
+ virtual void SAL_CALL acquire (void) throw(RuntimeException);
+
+ virtual void SAL_CALL release (void) throw(RuntimeException);
+
+ /** XInputStream.
+ */
+ virtual sal_Int32 SAL_CALL readBytes (
+ Sequence<sal_Int8> &rData, sal_Int32 nBytesToRead)
+ throw (NotConnectedException,
+ BufferSizeExceededException,
+ IOException);
+
+ virtual sal_Int32 SAL_CALL readSomeBytes (
+ Sequence<sal_Int8> &rData, sal_Int32 nMaxBytesToRead)
+ throw (NotConnectedException,
+ BufferSizeExceededException,
+ IOException);
+
+ virtual void SAL_CALL skipBytes (sal_Int32 nBytesToSkip)
+ throw (NotConnectedException,
+ BufferSizeExceededException,
+ IOException);
+
+ virtual sal_Int32 SAL_CALL available (void)
+ throw (NotConnectedException, IOException);
+
+ virtual void SAL_CALL closeInput (void)
+ throw (NotConnectedException, IOException);
+};
+
+/*========================================================================
+ *
+ * DataSink_Impl interface.
+ *
+ *======================================================================*/
+class DataSink_Impl :
+ public OWeakObject,
+ public XOutputStream
+{
+ Sequence<sal_Int8> m_buffer;
+
+public:
+ DataSink_Impl (void);
+ virtual ~DataSink_Impl (void);
+
+ const Sequence<sal_Int8>& getBuffer (void) const { return m_buffer; }
+
+ /** XInterface.
+ */
+ virtual sal_Bool SAL_CALL queryInterface (
+ const Uik &rUik, Any &rIfc) throw(RuntimeException);
+
+ virtual void SAL_CALL acquire (void) throw(RuntimeException);
+ virtual void SAL_CALL release (void) throw(RuntimeException);
+
+ /** XOutputStream.
+ */
+ virtual void SAL_CALL writeBytes (
+ const Sequence<sal_Int8> &rBuffer)
+ throw (NotConnectedException,
+ BufferSizeExceededException,
+ IOException);
+
+ virtual void SAL_CALL flush (void)
+ throw (NotConnectedException,
+ BufferSizeExceededException,
+ IOException);
+
+ virtual void SAL_CALL closeOutput (void)
+ throw (NotConnectedException,
+ BufferSizeExceededException,
+ IOException);
+};
+
+/*========================================================================
+ *
+ * DecoderListener_Impl interface.
+ *
+ *======================================================================*/
+class DecoderListener_Impl :
+ public OWeakObject,
+ public XPGPDecoderListener
+{
+public:
+ DecoderListener_Impl (void);
+ virtual ~DecoderListener_Impl (void);
+
+ /** XInterface.
+ */
+ virtual sal_Bool SAL_CALL queryInterface (
+ const Uik &rUik, Any &rIfc) throw(RuntimeException);
+
+ virtual void SAL_CALL acquire (void) throw(RuntimeException);
+
+ virtual void SAL_CALL release (void) throw(RuntimeException);
+
+ /** XEventListener.
+ */
+ virtual void SAL_CALL disposing (const EventObject &rSource);
+
+ /** XPGPDecoderListener.
+ */
+ virtual void SAL_CALL decrypted (const RecipientsEvent &rEvent);
+ virtual void SAL_CALL verified (const SignatureEvent &rEvent);
+};
+
+/*========================================================================
+ *
+ * DataSource_Impl implementation.
+ *
+ *======================================================================*/
+/*
+ * DataSource_Impl.
+ */
+DataSource_Impl::DataSource_Impl (int fd)
+ : m_fd (fd), m_position (0)
+{
+}
+
+/*
+ * ~DataSource_Impl.
+ */
+DataSource_Impl::~DataSource_Impl (void)
+{
+}
+
+/*
+ * DataSource_Impl: setBuffer.
+ */
+void DataSource_Impl::setBuffer (const Sequence<sal_Int8> &rBuffer)
+{
+ m_buffer = rBuffer;
+ if (!m_buffer.getLength())
+ {
+ // Fill buffer from file descriptor.
+ char buffer[1024];
+ rtl_zeroMemory (buffer, sizeof(buffer));
+
+ int k = read (m_fd, buffer, sizeof(buffer));
+ while (k > 0)
+ {
+ sal_Int32 n = m_buffer.getLength();
+ m_buffer.realloc (n + k);
+
+ rtl_copyMemory (m_buffer.getArray() + n, buffer, k);
+ n += k;
+
+ rtl_zeroMemory (buffer, k);
+ k = read (m_fd, buffer, sizeof(buffer));
+ }
+ }
+ m_position = 0;
+}
+
+/*
+ * XInterface: queryInterface.
+ */
+sal_Bool SAL_CALL DataSource_Impl::queryInterface (
+ const Uik &rUik, Any &rIfc) throw(RuntimeException)
+{
+ if (com::sun::star::uno::queryInterface (
+ rUik, rIfc,
+ SAL_STATIC_CAST (XInputStream*, this)))
+ return sal_True;
+ else
+ return OWeakObject::queryInterface (rUik, rIfc);
+}
+
+/*
+ * XInterface: acquire.
+ */
+void SAL_CALL DataSource_Impl::acquire (void) throw(RuntimeException)
+{
+ OWeakObject::acquire();
+}
+
+/*
+ * XInterface: release.
+ */
+void SAL_CALL DataSource_Impl::release (void) throw(RuntimeException)
+{
+ OWeakObject::release();
+}
+
+/*
+ * XInputStream: readBytes.
+ */
+sal_Int32 SAL_CALL DataSource_Impl::readBytes (
+ Sequence<sal_Int8> &rData, sal_Int32 nBytesToRead)
+ throw (NotConnectedException, BufferSizeExceededException, IOException)
+{
+ if (nBytesToRead < 0)
+ throw IOException();
+
+ sal_Int32 k = m_buffer.getLength() - m_position;
+ k = VOS_BOUND(k, 0, nBytesToRead);
+ if (k > 0)
+ {
+ rData.realloc(k);
+ rtl_copyMemory (
+ rData.getArray(), m_buffer.getConstArray() + m_position, k);
+ m_position += k;
+ }
+ return k;
+}
+
+/*
+ * XInputStream: readSomeBytes.
+ */
+sal_Int32 SAL_CALL DataSource_Impl::readSomeBytes (
+ Sequence<sal_Int8> &rData, sal_Int32 nMaxBytesToRead)
+ throw (NotConnectedException, BufferSizeExceededException, IOException)
+{
+ return readBytes (rData, nMaxBytesToRead);
+}
+
+/*
+ * XInputStream: skipBytes.
+ */
+void SAL_CALL DataSource_Impl::skipBytes (sal_Int32 nBytesToSkip)
+ throw (NotConnectedException, BufferSizeExceededException, IOException)
+{
+ if (nBytesToSkip < 0)
+ throw IOException();
+
+ m_position += nBytesToSkip;
+}
+
+/*
+ * XInputStream: available.
+ */
+sal_Int32 SAL_CALL DataSource_Impl::available (void)
+ throw (NotConnectedException, IOException)
+{
+ sal_Int32 k = m_buffer.getLength() - m_position;
+ return ((k > 0) ? k : 0);
+}
+
+/*
+ * XInputStream: closeInput.
+ */
+void SAL_CALL DataSource_Impl::closeInput (void)
+ throw (NotConnectedException, IOException)
+{
+}
+
+/*========================================================================
+ *
+ * DataSink_Impl implementation.
+ *
+ *======================================================================*/
+/*
+ * DataSink_Impl.
+ */
+DataSink_Impl::DataSink_Impl (void)
+{
+}
+
+/*
+ * ~DataSink_Impl.
+ */
+DataSink_Impl::~DataSink_Impl (void)
+{
+}
+
+/*
+ * XInterface: queryInterface.
+ */
+sal_Bool SAL_CALL DataSink_Impl::queryInterface (
+ const Uik &rUik, Any &rIfc) throw(RuntimeException)
+{
+ if (com::sun::star::uno::queryInterface (
+ rUik, rIfc,
+ SAL_STATIC_CAST (XOutputStream*, this)))
+ return sal_True;
+ else
+ return OWeakObject::queryInterface (rUik, rIfc);
+}
+
+/*
+ * XInterface: acquire.
+ */
+void SAL_CALL DataSink_Impl::acquire (void) throw(RuntimeException)
+{
+ OWeakObject::acquire();
+}
+
+/*
+ * XInterface: release.
+ */
+void SAL_CALL DataSink_Impl::release (void) throw(RuntimeException)
+{
+ OWeakObject::release();
+}
+
+/*
+ * XOutputStream: writeBytes.
+ */
+void SAL_CALL DataSink_Impl::writeBytes (const Sequence<sal_Int8> &rBuffer)
+ throw (NotConnectedException, BufferSizeExceededException, IOException)
+{
+ if (rBuffer.getLength())
+ {
+ sal_Int32 n = m_buffer.getLength();
+ m_buffer.realloc (n + rBuffer.getLength());
+
+ rtl_copyMemory (
+ m_buffer.getArray() + n,
+ rBuffer.getConstArray(),
+ rBuffer.getLength());
+ }
+}
+
+/*
+ * XOutputStream: flush.
+ */
+void SAL_CALL DataSink_Impl::flush (void)
+ throw (NotConnectedException, BufferSizeExceededException, IOException)
+{
+ if (m_buffer.getLength())
+ {
+ // Write data to stdout.
+ const sal_Int8 *pData = m_buffer.getConstArray();
+ sal_Int32 nData = m_buffer.getLength();
+
+ int prev = ::setmode (1, O_BINARY);
+ if (!(prev < 0))
+ {
+ int k = ::write (1, pData, nData);
+ if (k > 0)
+ ::write (1, "\n", 1);
+ ::setmode (1, prev);
+ }
+ }
+}
+
+/*
+ * XOutputStream: closeOutput.
+ */
+void SAL_CALL DataSink_Impl::closeOutput (void)
+ throw (NotConnectedException, BufferSizeExceededException, IOException)
+{
+ flush();
+}
+
+/*========================================================================
+ *
+ * DecoderListener_Impl implementation.
+ *
+ *======================================================================*/
+/*
+ * DecoderListener_Impl.
+ */
+DecoderListener_Impl::DecoderListener_Impl (void)
+{
+}
+
+/*
+ * ~DecoderListener_Impl.
+ */
+DecoderListener_Impl::~DecoderListener_Impl (void)
+{
+}
+
+/*
+ * XInterface: queryInterface.
+ */
+sal_Bool SAL_CALL DecoderListener_Impl::queryInterface (
+ const Uik &rUik, Any &rIfc) throw(RuntimeException)
+{
+ if (com::sun::star::uno::queryInterface (
+ rUik, rIfc,
+ SAL_STATIC_CAST (XEventListener*, this),
+ SAL_STATIC_CAST (XPGPDecoderListener*, this)))
+ return sal_True;
+ else
+ return OWeakObject::queryInterface (rUik, rIfc);
+}
+
+/*
+ * XInterface: acquire.
+ */
+void SAL_CALL DecoderListener_Impl::acquire (void) throw(RuntimeException)
+{
+ OWeakObject::acquire();
+}
+
+/*
+ * XInterface: release.
+ */
+void SAL_CALL DecoderListener_Impl::release (void) throw(RuntimeException)
+{
+ OWeakObject::release();
+}
+
+/*
+ * XEventListener: disposing.
+ */
+void SAL_CALL DecoderListener_Impl::disposing (const EventObject &rSource)
+{
+}
+
+/*
+ * XPGPDecoderListener: decrypted.
+ */
+void SAL_CALL DecoderListener_Impl::decrypted (const RecipientsEvent &rEvent)
+{
+}
+
+/*
+ * XPGPDecoderListener: verified.
+ */
+void SAL_CALL DecoderListener_Impl::verified (const SignatureEvent &rEvent)
+{
+}
+
+/*========================================================================
+ *
+ * Main.
+ *
+ *======================================================================*/
+inline rtl::OWString S2U (const sal_Char *ascii)
+{
+ return rtl::OWString::createFromAscii (ascii);
+}
+
+#if 0 /* OLD */
+
+/*
+ * queryModuleActivator.
+ */
+BOOL queryModuleActivator (
+ const XServiceManagerRef &rxManager,
+ XServiceActivatorRef &rxActivator)
+{
+ XServiceProviderRef xProv;
+ XInterfaceRef xProvInst;
+
+ xProv = rxManager->queryServiceProvider (
+ L"stardiv.uno.ServiceActivator.module");
+ if (!xProv.is())
+ {
+ printf ("Error: no ServiceActivator service.\n");
+ return FALSE;
+ }
+
+ xProvInst = xProv->createInstance();
+ if (!xProvInst.is())
+ {
+ printf ("Error: no ServiceActivator instance.\n");
+ return FALSE;
+ }
+
+ return xProvInst->queryInterface (
+ XServiceActivator::getSmartUik(), rxActivator);
+}
+
+/*
+ * install.
+ */
+BOOL install (
+ const XServiceActivatorRef &rxActivator,
+ const char *prefix)
+{
+ String aModule ("module://");
+ char pBuffer[1024];
+
+ NAMESPACE_VOS(ORealDynamicLoader)::computeModuleName (
+ prefix, pBuffer, sizeof(pBuffer));
+ aModule += pBuffer;
+
+ return rxActivator->install (
+ StringToUString (aModule, CHARSET_SYSTEM));
+}
+
+/*
+ * uninstall.
+ */
+BOOL uninstall (
+ const XServiceActivatorRef &rxActivator,
+ const char *prefix)
+{
+ String aModule ("module://");
+ char pBuffer[1024];
+
+ NAMESPACE_VOS(ORealDynamicLoader)::computeModuleName (
+ prefix, pBuffer, sizeof(pBuffer));
+ aModule += pBuffer;
+
+ return rxActivator->deinstall (
+ StringToUString (aModule, CHARSET_SYSTEM));
+}
+
+#endif /* OLD */
+
+/*
+ * main.
+ */
+int SAL_CALL main (int argc, char **argv)
+{
+ enum Option
+ {
+ OPTION_INSTALL = 0x01,
+ OPTION_UNINSTALL = 0x02,
+
+ OPTION_DECRYPT = 0x04,
+ OPTION_ENCRYPT = 0x08,
+ OPTION_SIGN = 0x10,
+
+ OPTION_FILE = 0x20,
+ OPTION_HELP = 0x40
+ };
+
+ int fd = 0;
+ unsigned long nOptions = 0;
+
+ for (int i = 1; i < argc; i++)
+ {
+ const char *opt = argv[i];
+ if (opt[0] == '-')
+ {
+ switch (opt[1])
+ {
+ case 'i':
+ nOptions |= OPTION_INSTALL;
+ break;
+
+ case 'u':
+ nOptions |= OPTION_UNINSTALL;
+ break;
+
+ case 'd':
+ nOptions |= OPTION_DECRYPT;
+ break;
+
+ case 'e':
+ nOptions |= OPTION_ENCRYPT;
+ break;
+
+ case 's':
+ nOptions |= OPTION_SIGN;
+ break;
+
+ case 'f':
+ nOptions |= OPTION_FILE;
+ break;
+
+ case 'h':
+ default:
+ nOptions |= OPTION_HELP;
+ break;
+ }
+ }
+ else
+ {
+ if (nOptions & OPTION_FILE)
+ {
+ if ((fd = open (argv[i], O_RDONLY | O_BINARY)) < 0)
+ {
+ printf ("Error: can't open file: %s\n", argv[i]);
+ exit (0);
+ }
+ }
+ }
+ }
+
+ if ((nOptions == 0) || (nOptions & OPTION_HELP))
+ {
+ printf ("Options:\n");
+ printf ("-i\tinstall module\n");
+ printf ("-u\tuninstall module\n");
+ printf ("-d\tdecrypt and verify\n");
+ printf ("-e\tencrypt test pattern\n");
+ printf ("-s\tsign test pattern\n");
+ printf ("-h\thelp\n");
+ exit (0);
+ }
+
+ Reference<XMultiServiceFactory> xManager (
+ usr::createDefaultSmartRegistryServiceFactory());
+ if (!xManager.is())
+ {
+ printf ("Error: no ProcessServiceManager.\n");
+ exit (1);
+ }
+ usr::setProcessServiceFactory (xManager);
+
+ if (nOptions & OPTION_INSTALL)
+ {
+#if 0 /* OLD */
+ XServiceActivatorRef xActivator;
+ if (queryModuleActivator (xManager, xActivator))
+ {
+ if (install (xActivator, "pgp"))
+ printf ("Module PGP installed.\n");
+ else
+ printf ("Error: module PGP not installed.\n");
+ }
+ nOptions &= ~OPTION_INSTALL;
+#endif /* OLD */
+ }
+
+ if (nOptions & (OPTION_DECRYPT | OPTION_ENCRYPT | OPTION_SIGN))
+ {
+ Reference<XMultiServiceFactory> xProv (
+ xManager->createInstance (
+ S2U("com.sun.star.pgp.PGPFactory")),
+ UNO_QUERY);
+ if (!xProv.is())
+ {
+ printf ("Error: no PGPFactory service.\n");
+ exit (1);
+ }
+
+ Reference<XInterface> xProvInst (
+ xProv->createInstance (
+ S2U("com.sun.star.pgp.SimplePGPMailer")));
+ if (!xProvInst.is())
+ {
+ printf ("Error: no SimplePGPMailer service.\n");
+ exit (2);
+ }
+
+ Reference<XPGPPreferences> xPrefs (xProvInst, UNO_QUERY);
+ if (xPrefs.is())
+ {
+ unsigned long nDefaults = 0;
+
+ if (xPrefs->getEncryptByDefault())
+ nDefaults |= OPTION_ENCRYPT;
+ if (xPrefs->getSignByDefault())
+ nDefaults |= OPTION_SIGN;
+ if (xPrefs->getAutoDecrypt())
+ nDefaults |= OPTION_DECRYPT;
+
+ if (nDefaults)
+ {
+ }
+ }
+
+ static const sal_Int8 pData[] = "" /* "Hello PGP World." */;
+ Sequence<sal_Int8> buffer (pData, sizeof (pData) - 1);
+
+ if (nOptions & (OPTION_ENCRYPT | OPTION_SIGN))
+ {
+ Reference<XPGPEncoder> xEncoder (xProvInst, UNO_QUERY);
+ if (!xEncoder.is())
+ {
+ printf ("Error: no PGPEncoder interface.\n");
+ exit (4);
+ }
+
+ DataSource_Impl *source = new DataSource_Impl (fd);
+ source->setBuffer (buffer);
+
+ DataSink_Impl *sink = new DataSink_Impl;
+
+ Reference<XInputStream> xPlainText (source);
+ Reference<XOutputStream> xCipherText (sink);
+
+ if (nOptions & OPTION_ENCRYPT)
+ {
+ rtl::OWString aRecipients[] =
+ {
+ S2U("er@stardiv.de"),
+ // L"mhu@stardivision.de",
+ S2U("mhu@rabbit")
+ };
+
+ sal_Int32 nRecipients =
+ sizeof(aRecipients) / sizeof(aRecipients[0]);
+
+ if (nOptions & OPTION_SIGN)
+ {
+ xEncoder->encryptAndSign (
+ Sequence<rtl::OWString>(aRecipients, nRecipients),
+ xPlainText,
+ xCipherText);
+ nOptions &= ~OPTION_SIGN;
+ }
+ else
+ {
+ xEncoder->encrypt (
+ Sequence<rtl::OWString>(aRecipients, nRecipients),
+ xPlainText,
+ xCipherText);
+ }
+ nOptions &= ~OPTION_ENCRYPT;
+ }
+
+ if (nOptions & OPTION_SIGN)
+ {
+ sal_Bool bDataIsAscii = (fd == 0); // stdin.
+
+ xEncoder->sign (
+ bDataIsAscii,
+ xPlainText,
+ xCipherText);
+ nOptions &= ~OPTION_SIGN;
+ }
+
+ buffer = sink->getBuffer();
+ }
+
+ if (nOptions & OPTION_DECRYPT)
+ {
+ Reference<XPGPDecoder> xDecoder (xProvInst, UNO_QUERY);
+ if (!xDecoder.is())
+ {
+ printf ("Error: no PGPDecoder interface.\n");
+ exit (5);
+ }
+
+ DataSource_Impl *source = new DataSource_Impl;
+ source->setBuffer (buffer);
+
+ DataSink_Impl *sink = new DataSink_Impl;
+
+ Reference<XInputStream> xCipherText (source);
+ Reference<XOutputStream> xPlainText (sink);
+
+ Reference<XPGPDecoderListener> xListener (
+ new DecoderListener_Impl);
+ xDecoder->addDecoderListener (xListener);
+
+ xDecoder->decryptAndVerify (
+ xCipherText,
+ xPlainText);
+ nOptions &= ~OPTION_DECRYPT;
+
+ xDecoder->removeDecoderListener (xListener);
+
+ buffer = sink->getBuffer();
+ }
+ }
+
+ if (nOptions & OPTION_UNINSTALL)
+ {
+#if 0 /* OLD */
+ XServiceActivatorRef xActivator;
+ if (queryModuleActivator (xManager, xActivator))
+ {
+ if (uninstall (xActivator, "pgp"))
+ printf ("Module PGP uninstalled.\n");
+ else
+ printf ("Error: module PGP not uninstalled.\n");
+ }
+ nOptions &= ~OPTION_UNINSTALL;
+#endif /* OLD */
+ }
+
+ return 0;
+}
+
diff --git a/extensions/workben/testresource.cxx b/extensions/workben/testresource.cxx
new file mode 100644
index 000000000..3769e5853
--- /dev/null
+++ b/extensions/workben/testresource.cxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * $RCSfile: testresource.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <smart/com/sun/star/registry/XImplementationRegistration.hxx>
+#include <smart/com/sun/star/script/XInvocation.hxx>
+
+#include <rtl/ustring.hxx>
+#include <vos/dynload.hxx>
+#include <vos/diagnose.hxx>
+#include <usr/services.hxx>
+#include <vcl/svapp.hxx>
+
+#ifdef _USE_NAMESPACE
+using namespace rtl;
+using namespace vos;
+using namespace usr;
+#endif
+
+class MyApp : public Application
+{
+public:
+ void Main();
+};
+
+MyApp aMyApp;
+
+// -----------------------------------------------------------------------
+
+void MyApp::Main()
+{
+ XMultiServiceFactoryRef xSMgr = createRegistryServiceManager();
+ registerUsrServices( xSMgr );
+ setProcessServiceManager( xSMgr );
+
+ XInterfaceRef x = xSMgr->createInstance( L"com.sun.star.registry.ImplementationRegistration" );
+ XImplementationRegistrationRef xReg( x, USR_QUERY );
+ sal_Char szBuf[1024];
+ ORealDynamicLoader::computeModuleName( "res", szBuf, 1024 );
+ UString aDllName( StringToOUString( szBuf, CHARSET_SYSTEM ) );
+ xReg->registerImplementation( L"com.sun.star.loader.SharedLibrary", aDllName, XSimpleRegistryRef() );
+
+ x = xSMgr->createInstance( L"com.sun.star.resource.VclStringResourceLoader" );
+ XInvocationRef xResLoader( x, USR_QUERY );
+ XIntrospectionAccessRef xIntrospection = xResLoader->getIntrospection();
+ UString aFileName( L"TestResource" );
+ UsrAny aVal;
+ aVal.setString( aFileName );
+ xResLoader->setValue( L"FileName", aVal );
+
+ Sequence< UsrAny > Args( 1 );
+ Sequence< INT16 > OutPos;
+ Sequence< UsrAny > OutArgs;
+ Args.getArray()[0].setINT32( 1000 );
+
+ BOOL b = xResLoader->invoke( L"hasString", Args, OutPos, OutArgs ).getBOOL();
+ VOS_ENSHURE( b, "hasString" );
+
+ UString aStr = xResLoader->invoke( L"getString", Args, OutPos, OutArgs ).getString();
+ VOS_ENSHURE( aStr == L"Hello", "getString" );
+
+ Args.getArray()[0].setINT32( 1001 );
+ b = xResLoader->invoke( L"hasString", Args, OutPos, OutArgs ).getBOOL();
+ VOS_ENSHURE( !b, "!hasString" );
+
+ xReg->revokeImplementation( aDllName, XSimpleRegistryRef() );
+}
+
diff --git a/extensions/workben/testresource.src b/extensions/workben/testresource.src
new file mode 100644
index 000000000..b6a0e8ff4
--- /dev/null
+++ b/extensions/workben/testresource.src
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * $RCSfile: testresource.src,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:16:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+String 1000
+{
+ Text = "Hello";
+};