summaryrefslogtreecommitdiff
path: root/toolkit/source/helper
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/source/helper')
-rw-r--r--toolkit/source/helper/accessibilityclient.cxx277
-rw-r--r--toolkit/source/helper/externallock.cxx46
-rw-r--r--toolkit/source/helper/fixedhyperbase.cxx72
-rw-r--r--toolkit/source/helper/formpdfexport.cxx639
-rw-r--r--toolkit/source/helper/imagealign.cxx135
-rw-r--r--toolkit/source/helper/listenermultiplexer.cxx213
-rw-r--r--toolkit/source/helper/makefile.mk64
-rw-r--r--toolkit/source/helper/property.cxx405
-rw-r--r--toolkit/source/helper/registerservices.cxx399
-rw-r--r--toolkit/source/helper/servicenames.cxx104
-rw-r--r--toolkit/source/helper/throbberimpl.cxx138
-rw-r--r--toolkit/source/helper/tkresmgr.cxx100
-rw-r--r--toolkit/source/helper/unomemorystream.cxx108
-rw-r--r--toolkit/source/helper/unopropertyarrayhelper.cxx160
-rw-r--r--toolkit/source/helper/unowrapper.cxx340
-rw-r--r--toolkit/source/helper/vclunohelper.cxx799
16 files changed, 3999 insertions, 0 deletions
diff --git a/toolkit/source/helper/accessibilityclient.cxx b/toolkit/source/helper/accessibilityclient.cxx
new file mode 100644
index 000000000000..ba466ac6959d
--- /dev/null
+++ b/toolkit/source/helper/accessibilityclient.cxx
@@ -0,0 +1,277 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <toolkit/helper/accessibilityclient.hxx>
+#include <toolkit/helper/accessiblefactory.hxx>
+#include <osl/module.h>
+#include <osl/diagnose.h>
+#include <tools/solar.h>
+
+// #define UNLOAD_ON_LAST_CLIENT_DYING
+ // this is not recommended currently. If enabled, the implementation will log
+ // the number of active clients, and unload the acc library when the last client
+ // goes away.
+ // Sounds like a good idea, unfortunately, there's no guarantee that all objects
+ // implemented in this library are already dead.
+ // Iow, just because an object implementing an XAccessible (implemented in this lib
+ // here) died, it's not said that everybody released all references to the
+ // XAccessibleContext used by this component, and implemented in the acc lib.
+ // So we cannot really unload the lib.
+ //
+ // Alternatively, if the lib would us own "usage counting", i.e. every component
+ // implemented therein would affect a static ref count, the acc lib could care
+ // for unloading itself.
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::accessibility;
+
+ namespace
+ {
+#ifdef UNLOAD_ON_LAST_CLIENT_DYING
+ static oslInterlockedCount s_nAccessibilityClients = 0;
+#endif // UNLOAD_ON_LAST_CLIENT_DYING
+ static oslModule s_hAccessibleImplementationModule = NULL;
+ static GetStandardAccComponentFactory s_pAccessibleFactoryFunc = NULL;
+ static ::rtl::Reference< IAccessibleFactory > s_pFactory;
+ }
+
+ //====================================================================
+ //= AccessibleDummyFactory
+ //====================================================================
+ class AccessibleDummyFactory : public IAccessibleFactory
+ {
+ public:
+ AccessibleDummyFactory();
+
+ protected:
+ virtual ~AccessibleDummyFactory();
+
+ private:
+ AccessibleDummyFactory( const AccessibleDummyFactory& ); // never implemented
+ AccessibleDummyFactory& operator=( const AccessibleDummyFactory& ); // never implemented
+
+ oslInterlockedCount m_refCount;
+
+ public:
+ // IReference
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+ // IAccessibleFactory
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXButton* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXCheckBox* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXRadioButton* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXListBox* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXFixedHyperlink* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXFixedText* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXScrollBar* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXEdit* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXComboBox* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXToolBox* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXWindow* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessible( Menu* /*_pMenu*/, sal_Bool /*_bIsMenuBar*/ )
+ {
+ return NULL;
+ }
+ };
+
+ //--------------------------------------------------------------------
+ AccessibleDummyFactory::AccessibleDummyFactory()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ AccessibleDummyFactory::~AccessibleDummyFactory()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL AccessibleDummyFactory::acquire()
+ {
+ return osl_incrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL AccessibleDummyFactory::release()
+ {
+ if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
+ {
+ delete this;
+ return 0;
+ }
+ return m_refCount;
+ }
+
+ //====================================================================
+ //= AccessibilityClient
+ //====================================================================
+ //--------------------------------------------------------------------
+ AccessibilityClient::AccessibilityClient()
+ :m_bInitialized( false )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ extern "C" { static void SAL_CALL thisModule() {} }
+
+ void AccessibilityClient::ensureInitialized()
+ {
+ if ( m_bInitialized )
+ return;
+
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+
+#ifdef UNLOAD_ON_LAST_CLIENT_DYING
+ if ( 1 == osl_incrementInterlockedCount( &s_nAccessibilityClients ) )
+ { // the first client
+#endif // UNLOAD_ON_LAST_CLIENT_DYING
+ // load the library implementing the factory
+ if ( !s_pFactory.get() )
+ {
+ const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii(
+ SVLIBRARY( "acc" )
+ );
+ s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
+ if ( s_hAccessibleImplementationModule != NULL )
+ {
+ const ::rtl::OUString sFactoryCreationFunc =
+ ::rtl::OUString::createFromAscii( "getStandardAccessibleFactory" );
+ s_pAccessibleFactoryFunc = (GetStandardAccComponentFactory)
+ osl_getFunctionSymbol( s_hAccessibleImplementationModule, sFactoryCreationFunc.pData );
+
+ }
+ OSL_ENSURE( s_pAccessibleFactoryFunc, "AccessibilityClient::ensureInitialized: could not load the library, or not retrieve the needed symbol!" );
+
+ // get a factory instance
+ if ( s_pAccessibleFactoryFunc )
+ {
+ IAccessibleFactory* pFactory = static_cast< IAccessibleFactory* >( (*s_pAccessibleFactoryFunc)() );
+ OSL_ENSURE( pFactory, "AccessibilityClient::ensureInitialized: no factory provided by the A11Y lib!" );
+ if ( pFactory )
+ {
+ s_pFactory = pFactory;
+ pFactory->release();
+ }
+ }
+ }
+
+ if ( !s_pFactory.get() )
+ // the attempt to load the lib, or to create the factory, failed
+ // -> fall back to a dummy factory
+ s_pFactory = new AccessibleDummyFactory;
+#ifdef UNLOAD_ON_LAST_CLIENT_DYING
+ }
+#endif
+
+ m_bInitialized = true;
+ }
+
+ //--------------------------------------------------------------------
+ AccessibilityClient::~AccessibilityClient()
+ {
+ if ( m_bInitialized )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+
+#ifdef UNLOAD_ON_LAST_CLIENT_DYING
+ if( 0 == osl_decrementInterlockedCount( &s_nAccessibilityClients ) )
+ {
+ s_pFactory = NULL;
+ s_pAccessibleFactoryFunc = NULL;
+ if ( s_hAccessibleImplementationModule )
+ {
+ osl_unloadModule( s_hAccessibleImplementationModule );
+ s_hAccessibleImplementationModule = NULL;
+ }
+ }
+#endif // UNLOAD_ON_LAST_CLIENT_DYING
+ }
+ }
+
+ //--------------------------------------------------------------------
+ IAccessibleFactory& AccessibilityClient::getFactory()
+ {
+ ensureInitialized();
+ OSL_ENSURE( s_pFactory.is(), "AccessibilityClient::getFactory: at least a dummy factory should have been created!" );
+ return *s_pFactory;
+ }
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
diff --git a/toolkit/source/helper/externallock.cxx b/toolkit/source/helper/externallock.cxx
new file mode 100644
index 000000000000..c0eb2427936f
--- /dev/null
+++ b/toolkit/source/helper/externallock.cxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <toolkit/helper/externallock.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+// -----------------------------------------------------------------------------
+// class VCLExternalSolarLock
+// -----------------------------------------------------------------------------
+void VCLExternalSolarLock::acquire()
+{
+ Application::GetSolarMutex().acquire();
+}
+// -----------------------------------------------------------------------------
+void VCLExternalSolarLock::release()
+{
+ Application::GetSolarMutex().release();
+}
+
diff --git a/toolkit/source/helper/fixedhyperbase.cxx b/toolkit/source/helper/fixedhyperbase.cxx
new file mode 100644
index 000000000000..d6c22e936116
--- /dev/null
+++ b/toolkit/source/helper/fixedhyperbase.cxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/helper/fixedhyperbase.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+// ----------------------------------------------------
+// class FixedHyperlinkBase
+// ----------------------------------------------------
+
+FixedHyperlinkBase::FixedHyperlinkBase( Window* pParent, const ResId& rId ) :
+ FixedText( pParent, rId )
+{
+}
+
+FixedHyperlinkBase::FixedHyperlinkBase( Window* pParent, WinBits nWinStyle ) :
+ FixedText( pParent, nWinStyle )
+{
+}
+
+FixedHyperlinkBase::~FixedHyperlinkBase()
+{
+}
+
+void FixedHyperlinkBase::SetURL( const String& )
+{
+}
+
+String FixedHyperlinkBase::GetURL() const
+{
+ return String::EmptyString();
+}
+
+void FixedHyperlinkBase::SetDescription( const String& )
+{
+}
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx
new file mode 100644
index 000000000000..bff2d6008d10
--- /dev/null
+++ b/toolkit/source/helper/formpdfexport.cxx
@@ -0,0 +1,639 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#ifndef _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX
+#include <toolkit/helper/formpdfexport.hxx>
+#endif
+
+/** === begin UNO includes === **/
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
+#include <com/sun/star/container/XIndexAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_
+#include <com/sun/star/form/XForm.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
+#include <com/sun/star/container/XChild.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_
+#include <com/sun/star/form/FormComponentType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_
+#include <com/sun/star/awt/TextAlign.hpp>
+#endif
+#ifndef _COM_SUN_STAR_STYLE_VERTICALALIGNMENT_HPP_
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_FORMBUTTONTYPE_HPP_
+#include <com/sun/star/form/FormButtonType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_SUBMITMETHOD_HPP_
+#include <com/sun/star/form/FormSubmitMethod.hpp>
+#endif
+/** === end UNO includes === **/
+
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/helper/vclunohelper.hxx>
+#endif
+#ifndef _VCL_PDFEXTOUTDEVDATA_HXX
+#include <vcl/pdfextoutdevdata.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <vcl/outdev.hxx>
+#endif
+
+#include <functional>
+#include <algorithm>
+
+//........................................................................
+namespace toolkitform
+{
+//........................................................................
+
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::style;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::form;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::container;
+
+ // used strings
+ static const ::rtl::OUString FM_PROP_CLASSID(RTL_CONSTASCII_USTRINGPARAM("ClassId"));
+ static const ::rtl::OUString FM_PROP_NAME(RTL_CONSTASCII_USTRINGPARAM("Name"));
+ static const ::rtl::OUString FM_PROP_STRINGITEMLIST(RTL_CONSTASCII_USTRINGPARAM("StringItemList"));
+ static const ::rtl::OUString FM_PROP_HELPTEXT(RTL_CONSTASCII_USTRINGPARAM("HelpText"));
+ static const ::rtl::OUString FM_PROP_TEXT(RTL_CONSTASCII_USTRINGPARAM("Text"));
+ static const ::rtl::OUString FM_PROP_LABEL(RTL_CONSTASCII_USTRINGPARAM("Label"));
+ static const ::rtl::OUString FM_PROP_READONLY(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
+ static const ::rtl::OUString FM_PROP_BORDER(RTL_CONSTASCII_USTRINGPARAM("Border"));
+ static const ::rtl::OUString FM_PROP_BACKGROUNDCOLOR(RTL_CONSTASCII_USTRINGPARAM("BackgroundColor"));
+ static const ::rtl::OUString FM_PROP_TEXTCOLOR(RTL_CONSTASCII_USTRINGPARAM("TextColor"));
+ static const ::rtl::OUString FM_PROP_MULTILINE(RTL_CONSTASCII_USTRINGPARAM("MultiLine"));
+ static const ::rtl::OUString FM_PROP_ALIGN(RTL_CONSTASCII_USTRINGPARAM("Align"));
+ static const ::rtl::OUString FM_PROP_FONT(RTL_CONSTASCII_USTRINGPARAM("FontDescriptor"));
+ static const ::rtl::OUString FM_PROP_MAXTEXTLEN(RTL_CONSTASCII_USTRINGPARAM("MaxTextLen"));
+ static const ::rtl::OUString FM_PROP_TARGET_URL(RTL_CONSTASCII_USTRINGPARAM("TargetURL"));
+ static const ::rtl::OUString FM_PROP_STATE(RTL_CONSTASCII_USTRINGPARAM("State"));
+ static const ::rtl::OUString FM_PROP_REFVALUE(RTL_CONSTASCII_USTRINGPARAM("RefValue"));
+ static const ::rtl::OUString FM_PROP_DROPDOWN(RTL_CONSTASCII_USTRINGPARAM("Dropdown"));
+ static const ::rtl::OUString FM_SUN_COMPONENT_FILECONTROL(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FileControl"));
+
+ namespace
+ {
+ //--------------------------------------------------------------------
+ /** determines the FormComponentType of a form control
+ */
+ sal_Int16 classifyFormControl( const Reference< XPropertySet >& _rxModel ) SAL_THROW(( Exception ))
+ {
+ sal_Int16 nControlType = FormComponentType::CONTROL;
+
+ Reference< XPropertySetInfo > xPSI;
+ if ( _rxModel.is() )
+ xPSI = _rxModel->getPropertySetInfo();
+ if ( xPSI.is() && xPSI->hasPropertyByName( FM_PROP_CLASSID ) )
+ {
+ OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_CLASSID ) >>= nControlType );
+ }
+
+ return nControlType;
+ }
+
+ //--------------------------------------------------------------------
+ /** (default-)creates a PDF widget according to a given FormComponentType
+ */
+ ::vcl::PDFWriter::AnyWidget* createDefaultWidget( sal_Int16 _nFormComponentType )
+ {
+ switch ( _nFormComponentType )
+ {
+ case FormComponentType::COMMANDBUTTON:
+ return new ::vcl::PDFWriter::PushButtonWidget;
+ case FormComponentType::CHECKBOX:
+ return new ::vcl::PDFWriter::CheckBoxWidget;
+ case FormComponentType::RADIOBUTTON:
+ return new ::vcl::PDFWriter::RadioButtonWidget;
+ case FormComponentType::LISTBOX:
+ return new ::vcl::PDFWriter::ListBoxWidget;
+ case FormComponentType::COMBOBOX:
+ return new ::vcl::PDFWriter::ComboBoxWidget;
+
+ case FormComponentType::TEXTFIELD:
+ case FormComponentType::FILECONTROL:
+ case FormComponentType::DATEFIELD:
+ case FormComponentType::TIMEFIELD:
+ case FormComponentType::NUMERICFIELD:
+ case FormComponentType::CURRENCYFIELD:
+ case FormComponentType::PATTERNFIELD:
+ return new ::vcl::PDFWriter::EditWidget;
+ }
+ return NULL;
+ }
+
+ //--------------------------------------------------------------------
+ /** determines a unique number for the radio group which the given radio
+ button model belongs to
+
+ The number is guaranteed to be
+ <ul><li>unique within the document in which the button lives</li>
+ <li>the same for subsequent calls with other radio button models,
+ which live in the same document, and belong to the same group</li>
+ </ul>
+
+ @precond
+ the model must be part of the form component hierarchy in a document
+ */
+ sal_Int32 determineRadioGroupId( const Reference< XPropertySet >& _rxRadioModel ) SAL_THROW((Exception))
+ {
+ OSL_ENSURE( classifyFormControl( _rxRadioModel ) == FormComponentType::RADIOBUTTON,
+ "determineRadioGroupId: this *is* no radio button model!" );
+ // The fact that radio button groups need to be unique within the complete
+ // host document makes it somewhat difficult ...
+ // Problem is that two form radio buttons belong to the same group if
+ // - they have the same parent
+ // - AND they have the same name
+ // This implies that we need some knowledge about (potentially) *all* radio button
+ // groups in the document.
+
+ // get the root-level container
+ Reference< XChild > xChild( _rxRadioModel, UNO_QUERY );
+ Reference< XForm > xParentForm( xChild.is() ? xChild->getParent() : Reference< XInterface >(), UNO_QUERY );
+ OSL_ENSURE( xParentForm.is(), "determineRadioGroupId: no parent form -> group id!" );
+ if ( !xParentForm.is() )
+ return -1;
+
+ while ( xParentForm.is() )
+ {
+ xChild = xParentForm.get();
+ xParentForm = xParentForm.query( xChild->getParent() );
+ }
+ Reference< XIndexAccess > xRoot( xChild->getParent(), UNO_QUERY );
+ OSL_ENSURE( xRoot.is(), "determineRadioGroupId: unable to determine the root of the form component hierarchy!" );
+ if ( !xRoot.is() )
+ return -1;
+
+ // count the leafs in the hierarchy, until we encounter radio button
+ ::std::vector< Reference< XIndexAccess > > aAncestors;
+ ::std::vector< sal_Int32 > aPath;
+
+ Reference< XInterface > xNormalizedLookup( _rxRadioModel, UNO_QUERY );
+ ::rtl::OUString sRadioGroupName;
+ OSL_VERIFY( _rxRadioModel->getPropertyValue( FM_PROP_NAME ) >>= sRadioGroupName );
+
+ Reference< XIndexAccess > xCurrentContainer( xRoot );
+ sal_Int32 nStartWithChild = 0;
+ sal_Int32 nGroupsEncountered = 0;
+ do
+ {
+ Reference< XNameAccess > xElementNameAccess( xCurrentContainer, UNO_QUERY );
+ OSL_ENSURE( xElementNameAccess.is(), "determineRadioGroupId: no name container?" );
+ if ( !xElementNameAccess.is() )
+ return -1;
+
+ if ( nStartWithChild == 0 )
+ { // we encounter this container the first time. In particular, we did not
+ // just step up
+ nGroupsEncountered += xElementNameAccess->getElementNames().getLength();
+ // this is way too much: Not all of the elements in the current container
+ // may form groups, especially if they're forms. But anyway, this number is
+ // sufficient for our purpose. Finally, the container contains *at most*
+ // that much groups
+ }
+
+ sal_Int32 nCount = xCurrentContainer->getCount();
+ sal_Int32 i;
+ for ( i = nStartWithChild; i < nCount; ++i )
+ {
+ Reference< XInterface > xElement( xCurrentContainer->getByIndex( i ), UNO_QUERY );
+ if ( !xElement.is() )
+ {
+ OSL_ENSURE( sal_False, "determineRadioGroupId: very suspicious!" );
+ continue;
+ }
+
+ Reference< XIndexAccess > xNewContainer( xElement, UNO_QUERY );
+ if ( xNewContainer.is() )
+ {
+ // step down the hierarchy
+ aAncestors.push_back( xCurrentContainer );
+ xCurrentContainer = xNewContainer;
+ aPath.push_back( i );
+ nStartWithChild = 0;
+ break;
+ // out of the inner loop, but continue with the outer loop
+ }
+
+ if ( xElement.get() == xNormalizedLookup.get() )
+ {
+ // look up the name of the radio group in the list of all element names
+ Sequence< ::rtl::OUString > aElementNames( xElementNameAccess->getElementNames() );
+ const ::rtl::OUString* pElementNames = aElementNames.getConstArray();
+ const ::rtl::OUString* pElementNamesEnd = pElementNames + aElementNames.getLength();
+ while ( pElementNames != pElementNamesEnd )
+ {
+ if ( *pElementNames == sRadioGroupName )
+ {
+ sal_Int32 nLocalGroupIndex = pElementNames - aElementNames.getConstArray();
+ OSL_ENSURE( nLocalGroupIndex < xElementNameAccess->getElementNames().getLength(),
+ "determineRadioGroupId: inconsistency!" );
+
+ sal_Int32 nGlobalGroupId = nGroupsEncountered - xElementNameAccess->getElementNames().getLength() + nLocalGroupIndex;
+ return nGlobalGroupId;
+ }
+ ++pElementNames;
+ }
+ OSL_ENSURE( sal_False, "determineRadioGroupId: did not find the radios element name!" );
+ }
+ }
+
+ if ( !( i < nCount ) )
+ {
+ // the loop terminated because there were no more elements
+ // -> step up, if possible
+ if ( aAncestors.empty() )
+ break;
+
+ xCurrentContainer = aAncestors.back(); aAncestors.pop_back();
+ nStartWithChild = aPath.back() + 1; aPath.pop_back();
+ }
+ }
+ while ( true );
+ return -1;
+ }
+
+ //--------------------------------------------------------------------
+ /** copies a StringItemList to a PDF widget's list
+ */
+ void getStringItemVector( const Reference< XPropertySet >& _rxModel, ::std::vector< ::rtl::OUString >& _rVector )
+ {
+ Sequence< ::rtl::OUString > aListEntries;
+ OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_STRINGITEMLIST ) >>= aListEntries );
+ ::std::copy( aListEntries.getConstArray(), aListEntries.getConstArray() + aListEntries.getLength(),
+ ::std::back_insert_iterator< ::std::vector< ::rtl::OUString > >( _rVector ) );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ /** creates a PDF compatible control descriptor for the given control
+ */
+ void TOOLKIT_DLLPUBLIC describePDFControl( const Reference< XControl >& _rxControl, ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor ) SAL_THROW(())
+ {
+ _rpDescriptor.reset( NULL );
+ OSL_ENSURE( _rxControl.is(), "describePDFControl: invalid (NULL) control!" );
+ if ( !_rxControl.is() )
+ return;
+
+ try
+ {
+ Reference< XPropertySet > xModelProps( _rxControl->getModel(), UNO_QUERY );
+ sal_Int16 nControlType = classifyFormControl( xModelProps );
+ _rpDescriptor.reset( createDefaultWidget( nControlType ) );
+ if ( !_rpDescriptor.get() )
+ // no PDF widget available for this
+ return;
+
+ Reference< XPropertySetInfo > xPSI( xModelProps->getPropertySetInfo() );
+ Reference< XServiceInfo > xSI( xModelProps, UNO_QUERY );
+ OSL_ENSURE( xSI.is(), "describePDFControl: no service info!" );
+ // if we survived classifyFormControl, then it's a real form control, and they all have
+ // service infos
+
+ // ================================
+ // set the common widget properties
+
+ // --------------------------------
+ // Name, Description, Text
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_NAME ) >>= _rpDescriptor->Name );
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_HELPTEXT ) >>= _rpDescriptor->Description );
+ Any aText;
+ if ( xPSI->hasPropertyByName( FM_PROP_TEXT ) )
+ aText = xModelProps->getPropertyValue( FM_PROP_TEXT );
+ else if ( xPSI->hasPropertyByName( FM_PROP_LABEL ) )
+ aText = xModelProps->getPropertyValue( FM_PROP_LABEL );
+ if ( aText.hasValue() )
+ OSL_VERIFY( aText >>= _rpDescriptor->Text );
+
+ // --------------------------------
+ // readonly
+ if ( xPSI->hasPropertyByName( FM_PROP_READONLY ) )
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_READONLY ) >>= _rpDescriptor->ReadOnly );
+
+ // --------------------------------
+ // border
+ {
+ if ( xPSI->hasPropertyByName( FM_PROP_BORDER ) )
+ {
+ sal_Int16 nBorderType = 0;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_BORDER ) >>= nBorderType );
+ _rpDescriptor->Border = ( nBorderType != 0 );
+
+ ::rtl::OUString sBorderColorPropertyName( RTL_CONSTASCII_USTRINGPARAM( "BorderColor" ) );
+ if ( xPSI->hasPropertyByName( sBorderColorPropertyName ) )
+ {
+ sal_Int32 nBoderColor = COL_TRANSPARENT;
+ if ( xModelProps->getPropertyValue( sBorderColorPropertyName ) >>= nBoderColor )
+ _rpDescriptor->BorderColor = Color( nBoderColor );
+ else
+ _rpDescriptor->BorderColor = Color( COL_BLACK );
+ }
+ }
+ }
+
+ // --------------------------------
+ // background color
+ if ( xPSI->hasPropertyByName( FM_PROP_BACKGROUNDCOLOR ) )
+ {
+ sal_Int32 nBackColor = COL_TRANSPARENT;
+ xModelProps->getPropertyValue( FM_PROP_BACKGROUNDCOLOR ) >>= nBackColor;
+ _rpDescriptor->Background = true;
+ _rpDescriptor->BackgroundColor = Color( nBackColor );
+ }
+
+ // --------------------------------
+ // text color
+ if ( xPSI->hasPropertyByName( FM_PROP_TEXTCOLOR ) )
+ {
+ sal_Int32 nTextColor = COL_TRANSPARENT;
+ xModelProps->getPropertyValue( FM_PROP_TEXTCOLOR ) >>= nTextColor;
+ _rpDescriptor->TextColor = Color( nTextColor );
+ }
+
+ // --------------------------------
+ // text style
+ _rpDescriptor->TextStyle = 0;
+ // ............................
+ // multi line and word break
+ // The MultiLine property of the control is mapped to both the "MULTILINE" and
+ // "WORDBREAK" style flags
+ if ( xPSI->hasPropertyByName( FM_PROP_MULTILINE ) )
+ {
+ sal_Bool bMultiLine = sal_False;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_MULTILINE ) >>= bMultiLine );
+ if ( bMultiLine )
+ _rpDescriptor->TextStyle |= TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK;
+ }
+ // ............................
+ // horizontal alignment
+ if ( xPSI->hasPropertyByName( FM_PROP_ALIGN ) )
+ {
+ sal_Int16 nAlign = awt::TextAlign::LEFT;
+ xModelProps->getPropertyValue( FM_PROP_ALIGN ) >>= nAlign;
+ // TODO: when the property is VOID - are there situations/UIs where this
+ // means something else than LEFT?
+ switch ( nAlign )
+ {
+ case awt::TextAlign::LEFT: _rpDescriptor->TextStyle |= TEXT_DRAW_LEFT; break;
+ case awt::TextAlign::CENTER: _rpDescriptor->TextStyle |= TEXT_DRAW_CENTER; break;
+ case awt::TextAlign::RIGHT: _rpDescriptor->TextStyle |= TEXT_DRAW_RIGHT; break;
+ default:
+ OSL_ENSURE( sal_False, "describePDFControl: invalid text align!" );
+ }
+ }
+ // ............................
+ // vertical alignment
+ {
+ ::rtl::OUString sVertAlignPropertyName( RTL_CONSTASCII_USTRINGPARAM( "VerticalAlign" ) );
+ if ( xPSI->hasPropertyByName( sVertAlignPropertyName ) )
+ {
+ sal_Int16 nAlign = VerticalAlignment_MIDDLE;
+ xModelProps->getPropertyValue( sVertAlignPropertyName ) >>= nAlign;
+ switch ( nAlign )
+ {
+ case VerticalAlignment_TOP: _rpDescriptor->TextStyle |= TEXT_DRAW_TOP; break;
+ case VerticalAlignment_MIDDLE: _rpDescriptor->TextStyle |= TEXT_DRAW_VCENTER; break;
+ case VerticalAlignment_BOTTOM: _rpDescriptor->TextStyle |= TEXT_DRAW_BOTTOM; break;
+ default:
+ OSL_ENSURE( sal_False, "describePDFControl: invalid vertical text align!" );
+ }
+ }
+ }
+
+ // font
+ if ( xPSI->hasPropertyByName( FM_PROP_FONT ) )
+ {
+ FontDescriptor aUNOFont;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_FONT ) >>= aUNOFont );
+ _rpDescriptor->TextFont = VCLUnoHelper::CreateFont( aUNOFont, Font() );
+ }
+
+ // tab order
+ rtl::OUString aTabIndexString( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) );
+ if ( xPSI->hasPropertyByName( aTabIndexString ) )
+ {
+ sal_Int16 nIndex = -1;
+ OSL_VERIFY( xModelProps->getPropertyValue( aTabIndexString ) >>= nIndex );
+ _rpDescriptor->TabOrder = nIndex;
+ }
+
+ // ================================
+ // special widget properties
+ // --------------------------------
+ // edits
+ if ( _rpDescriptor->getType() == ::vcl::PDFWriter::Edit )
+ {
+ ::vcl::PDFWriter::EditWidget* pEditWidget = static_cast< ::vcl::PDFWriter::EditWidget* >( _rpDescriptor.get() );
+ // ............................
+ // multiline (already flagged in the TextStyle)
+ pEditWidget->MultiLine = ( _rpDescriptor->TextStyle & TEXT_DRAW_MULTILINE ) != 0;
+ // ............................
+ // password input
+ ::rtl::OUString sEchoCharPropName( RTL_CONSTASCII_USTRINGPARAM( "EchoChar" ) );
+ if ( xPSI->hasPropertyByName( sEchoCharPropName ) )
+ {
+ sal_Int16 nEchoChar = 0;
+ if ( ( xModelProps->getPropertyValue( sEchoCharPropName ) >>= nEchoChar ) && ( nEchoChar != 0 ) )
+ pEditWidget->Password = true;
+ }
+ // ............................
+ // file select
+ if ( xSI->supportsService( FM_SUN_COMPONENT_FILECONTROL ) )
+ pEditWidget->FileSelect = true;
+ // ............................
+ // maximum text length
+ if ( xPSI->hasPropertyByName( FM_PROP_MAXTEXTLEN ) )
+ {
+ sal_Int16 nMaxTextLength = 0;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_MAXTEXTLEN ) >>= nMaxTextLength );
+ if ( nMaxTextLength <= 0 )
+ // "-1" has a special meaning for database-bound controls
+ nMaxTextLength = 0;
+ pEditWidget->MaxLen = nMaxTextLength;
+ }
+ }
+
+ // --------------------------------
+ // buttons
+ if ( _rpDescriptor->getType() == ::vcl::PDFWriter::PushButton )
+ {
+ ::vcl::PDFWriter::PushButtonWidget* pButtonWidget = static_cast< ::vcl::PDFWriter::PushButtonWidget* >( _rpDescriptor.get() );
+ FormButtonType eButtonType = FormButtonType_PUSH;
+ OSL_VERIFY( xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) ) ) >>= eButtonType );
+ if ( eButtonType == FormButtonType_SUBMIT )
+ {
+ // if a button is a submit button, then it uses the URL at it's parent form
+ Reference< XChild > xChild( xModelProps, UNO_QUERY );
+ Reference < XPropertySet > xParentProps;
+ if ( xChild.is() )
+ xParentProps = xParentProps.query( xChild->getParent() );
+ if ( xParentProps.is() )
+ {
+ Reference< XServiceInfo > xParentSI( xParentProps, UNO_QUERY );
+ if ( xParentSI.is() && xParentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.HTMLForm" ) ) ) )
+ {
+ OSL_VERIFY( xParentProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= pButtonWidget->URL );
+ pButtonWidget->Submit = true;
+ FormSubmitMethod eMethod = FormSubmitMethod_POST;
+ OSL_VERIFY( xParentProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SubmitMethod" ) ) ) >>= eMethod );
+ pButtonWidget->SubmitGet = (eMethod == FormSubmitMethod_GET);
+ }
+ }
+ }
+ else if ( eButtonType == FormButtonType_URL )
+ {
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= pButtonWidget->URL);
+ pButtonWidget->Submit = false;
+ }
+
+ // TODO:
+ // In PDF files, buttons are either reset, url or submit buttons. So if we have a simple PUSH button
+ // in a document, then this means that we do not export a SubmitToURL, which means that in PDF,
+ // the button is used as reset button.
+ // Is this desired? If no, we would have to reset _rpDescriptor to NULL here, in case eButtonType
+ // != FormButtonType_SUBMIT && != FormButtonType_RESET
+
+ // the PDF exporter defaults the text style, if 0. To prevent this, we have to transfer the UNO
+ // defaults to the PDF widget
+ if ( !pButtonWidget->TextStyle )
+ pButtonWidget->TextStyle = TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER;
+ }
+
+ // --------------------------------
+ // check boxes
+ if ( _rpDescriptor->getType() == ::vcl::PDFWriter::CheckBox )
+ {
+ ::vcl::PDFWriter::CheckBoxWidget* pCheckBoxWidget = static_cast< ::vcl::PDFWriter::CheckBoxWidget* >( _rpDescriptor.get() );
+ sal_Int16 nState = 0;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_STATE ) >>= nState );
+ pCheckBoxWidget->Checked = ( nState != 0 );
+ }
+
+ // --------------------------------
+ // radio buttons
+ if ( _rpDescriptor->getType() == ::vcl::PDFWriter::RadioButton )
+ {
+ ::vcl::PDFWriter::RadioButtonWidget* pRadioWidget = static_cast< ::vcl::PDFWriter::RadioButtonWidget* >( _rpDescriptor.get() );
+ sal_Int16 nState = 0;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_STATE ) >>= nState );
+ pRadioWidget->Selected = ( nState != 0 );
+ pRadioWidget->RadioGroup = determineRadioGroupId( xModelProps );
+ try
+ {
+ xModelProps->getPropertyValue( FM_PROP_REFVALUE ) >>= pRadioWidget->OnValue;
+ }
+ catch(...)
+ {
+ pRadioWidget->OnValue = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "On" ) );
+ }
+ }
+
+ // --------------------------------
+ // list boxes
+ if ( _rpDescriptor->getType() == ::vcl::PDFWriter::ListBox )
+ {
+ ::vcl::PDFWriter::ListBoxWidget* pListWidget = static_cast< ::vcl::PDFWriter::ListBoxWidget* >( _rpDescriptor.get() );
+ // ............................
+ // drop down
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_DROPDOWN ) >>= pListWidget->DropDown );
+ // ............................
+ // multi selection
+ OSL_VERIFY( xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ) ) >>= pListWidget->MultiSelect );
+ // ............................
+ // entries
+ getStringItemVector( xModelProps, pListWidget->Entries );
+ // since we explicitly list the entries in the order in which they appear, they should not be
+ // resorted by the PDF viewer
+ pListWidget->Sort = false;
+
+ // get selected items
+ Sequence< sal_Int16 > aSelectIndices;
+ OSL_VERIFY( xModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= aSelectIndices );
+ if( aSelectIndices.getLength() > 0 )
+ {
+ pListWidget->SelectedEntries.resize( 0 );
+ for( sal_Int32 i = 0; i < aSelectIndices.getLength(); i++ )
+ {
+ sal_Int16 nIndex = aSelectIndices.getConstArray()[i];
+ if( nIndex >= 0 && nIndex < (sal_Int16)pListWidget->Entries.size() )
+ pListWidget->SelectedEntries.push_back( nIndex );
+ }
+ }
+ }
+
+ // --------------------------------
+ // combo boxes
+ if ( _rpDescriptor->getType() == ::vcl::PDFWriter::ComboBox )
+ {
+ ::vcl::PDFWriter::ComboBoxWidget* pComboWidget = static_cast< ::vcl::PDFWriter::ComboBoxWidget* >( _rpDescriptor.get() );
+ // ............................
+ // entries
+ getStringItemVector( xModelProps, pComboWidget->Entries );
+ // same reasoning as above
+ pComboWidget->Sort = false;
+ }
+
+ // ================================
+ // some post-processing
+ // --------------------------------
+ // text line ends
+ // some controls may (always or dependent on other settings) return UNIX line ends
+ String aConverter( _rpDescriptor->Text );
+ _rpDescriptor->Text = aConverter.ConvertLineEnd( LINEEND_CRLF );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "describePDFControl: caught an exception!" );
+ }
+ }
+
+//........................................................................
+} // namespace toolkitform
+//........................................................................
diff --git a/toolkit/source/helper/imagealign.cxx b/toolkit/source/helper/imagealign.cxx
new file mode 100644
index 000000000000..c5e8781d478b
--- /dev/null
+++ b/toolkit/source/helper/imagealign.cxx
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <toolkit/helper/imagealign.hxx>
+#include <com/sun/star/awt/ImagePosition.hpp>
+#include <com/sun/star/awt/ImageAlign.hpp>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using namespace ::com::sun::star::awt::ImagePosition;
+ using namespace ::com::sun::star::awt::ImageAlign;
+
+ sal_Int16 translateImagePosition( ImageAlign _eVCLAlign )
+ {
+ sal_Int16 nReturn = AboveCenter;
+ switch ( _eVCLAlign )
+ {
+ case IMAGEALIGN_LEFT: nReturn = LeftCenter; break;
+ case IMAGEALIGN_TOP: nReturn = AboveCenter; break;
+ case IMAGEALIGN_RIGHT: nReturn = RightCenter; break;
+ case IMAGEALIGN_BOTTOM: nReturn = BelowCenter; break;
+ case IMAGEALIGN_LEFT_TOP: nReturn = LeftTop; break;
+ case IMAGEALIGN_LEFT_BOTTOM: nReturn = LeftBottom; break;
+ case IMAGEALIGN_TOP_LEFT: nReturn = AboveLeft; break;
+ case IMAGEALIGN_TOP_RIGHT: nReturn = AboveRight; break;
+ case IMAGEALIGN_RIGHT_TOP: nReturn = RightTop; break;
+ case IMAGEALIGN_RIGHT_BOTTOM: nReturn = RightBottom; break;
+ case IMAGEALIGN_BOTTOM_LEFT: nReturn = BelowLeft; break;
+ case IMAGEALIGN_BOTTOM_RIGHT: nReturn = BelowRight; break;
+ case IMAGEALIGN_CENTER: nReturn = Centered; break;
+ default:
+ OSL_ENSURE( sal_False, "translateImagePosition: unknown IMAGEALIGN value!" );
+ }
+ return nReturn;
+ }
+
+ ImageAlign translateImagePosition( sal_Int16 _eUNOAlign )
+ {
+ ImageAlign nReturn = IMAGEALIGN_TOP;
+ switch ( _eUNOAlign )
+ {
+ case LeftCenter: nReturn = IMAGEALIGN_LEFT; break;
+ case AboveCenter: nReturn = IMAGEALIGN_TOP; break;
+ case RightCenter: nReturn = IMAGEALIGN_RIGHT; break;
+ case BelowCenter: nReturn = IMAGEALIGN_BOTTOM; break;
+ case LeftTop: nReturn = IMAGEALIGN_LEFT_TOP; break;
+ case LeftBottom: nReturn = IMAGEALIGN_LEFT_BOTTOM; break;
+ case AboveLeft: nReturn = IMAGEALIGN_TOP_LEFT; break;
+ case AboveRight: nReturn = IMAGEALIGN_TOP_RIGHT; break;
+ case RightTop: nReturn = IMAGEALIGN_RIGHT_TOP; break;
+ case RightBottom: nReturn = IMAGEALIGN_RIGHT_BOTTOM; break;
+ case BelowLeft: nReturn = IMAGEALIGN_BOTTOM_LEFT; break;
+ case BelowRight: nReturn = IMAGEALIGN_BOTTOM_RIGHT; break;
+ case Centered: nReturn = IMAGEALIGN_CENTER; break;
+ default:
+ OSL_ENSURE( sal_False, "translateImagePosition: unknown css.awt.ImagePosition value!" );
+ }
+ return nReturn;
+ }
+
+ sal_Int16 getCompatibleImageAlign( ImageAlign _eAlign )
+ {
+ sal_Int16 nReturn = TOP;
+ switch ( _eAlign )
+ {
+ case IMAGEALIGN_LEFT_TOP:
+ case IMAGEALIGN_LEFT:
+ case IMAGEALIGN_LEFT_BOTTOM: nReturn = LEFT; break;
+
+ case IMAGEALIGN_TOP_LEFT:
+ case IMAGEALIGN_TOP:
+ case IMAGEALIGN_TOP_RIGHT: nReturn = TOP; break;
+
+ case IMAGEALIGN_RIGHT_TOP:
+ case IMAGEALIGN_RIGHT:
+ case IMAGEALIGN_RIGHT_BOTTOM: nReturn = RIGHT; break;
+
+ case IMAGEALIGN_BOTTOM_LEFT:
+ case IMAGEALIGN_BOTTOM:
+ case IMAGEALIGN_BOTTOM_RIGHT: nReturn = BOTTOM; break;
+
+ case IMAGEALIGN_CENTER: nReturn = TOP; break;
+ default:
+ OSL_ENSURE( sal_False, "getCompatibleImageAlign: unknown IMAGEALIGN value!" );
+ }
+ return nReturn;
+ }
+
+ sal_Int16 getExtendedImagePosition( sal_Int16 _nImageAlign )
+ {
+ sal_Int16 nReturn = AboveCenter;
+ switch ( _nImageAlign )
+ {
+ case LEFT: nReturn = LeftCenter; break;
+ case TOP: nReturn = AboveCenter; break;
+ case RIGHT: nReturn = RightCenter; break;
+ case BOTTOM: nReturn = BelowCenter; break;
+ default:
+ OSL_ENSURE( sal_False, "getExtendedImagePosition: unknown ImageAlign value!" );
+ }
+ return nReturn;
+ }
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx
new file mode 100644
index 000000000000..9b8df60521ae
--- /dev/null
+++ b/toolkit/source/helper/listenermultiplexer.cxx
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+//#include "precompiled_toolkit.hxx"
+#include "precompiled_toolkit.hxx"
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <com/sun/star/lang/DisposedException.hpp>
+
+// ----------------------------------------------------
+// class ListenerMultiplexerBase
+// ----------------------------------------------------
+ListenerMultiplexerBase::ListenerMultiplexerBase( ::cppu::OWeakObject& rSource )
+ : ::cppu::OInterfaceContainerHelper( GetMutex() ), mrContext( rSource )
+{
+}
+
+ListenerMultiplexerBase::~ListenerMultiplexerBase()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any ListenerMultiplexerBase::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::cppu::queryInterface( rType, SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, this ) );
+}
+
+
+// ----------------------------------------------------
+// class EventListenerMultiplexer
+// ----------------------------------------------------
+EventListenerMultiplexer::EventListenerMultiplexer( ::cppu::OWeakObject& rSource )
+ : ListenerMultiplexerBase( rSource )
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any EventListenerMultiplexer::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, this ) );
+ return (aRet.hasValue() ? aRet : ListenerMultiplexerBase::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XEventListener
+void EventListenerMultiplexer::disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException)
+{
+}
+
+// ----------------------------------------------------
+// class FocusListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener, focusGained, ::com::sun::star::awt::FocusEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener, focusLost, ::com::sun::star::awt::FocusEvent )
+
+// ----------------------------------------------------
+// class WindowListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowResized, ::com::sun::star::awt::WindowEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowMoved, ::com::sun::star::awt::WindowEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowShown, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowHidden, ::com::sun::star::lang::EventObject )
+
+// ----------------------------------------------------
+// class VclContainerListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener, windowAdded, ::com::sun::star::awt::VclContainerEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener, windowRemoved, ::com::sun::star::awt::VclContainerEvent )
+
+// ----------------------------------------------------
+// class KeyListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener, keyPressed, ::com::sun::star::awt::KeyEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener, keyReleased, ::com::sun::star::awt::KeyEvent )
+
+// ----------------------------------------------------
+// class MouseListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mousePressed, ::com::sun::star::awt::MouseEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseReleased, ::com::sun::star::awt::MouseEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseEntered, ::com::sun::star::awt::MouseEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseExited, ::com::sun::star::awt::MouseEvent )
+
+// ----------------------------------------------------
+// class MouseMotionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener, mouseDragged, ::com::sun::star::awt::MouseEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener, mouseMoved, ::com::sun::star::awt::MouseEvent )
+
+// ----------------------------------------------------
+// class PaintListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener, windowPaint, ::com::sun::star::awt::PaintEvent )
+
+// ----------------------------------------------------
+// class TopWindowListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowOpened, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowClosing, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowClosed, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowMinimized, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowNormalized, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowActivated, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowDeactivated, ::com::sun::star::lang::EventObject )
+
+// ----------------------------------------------------
+// class TextListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener, textChanged, ::com::sun::star::awt::TextEvent )
+
+// ----------------------------------------------------
+// class ActionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener, actionPerformed, ::com::sun::star::awt::ActionEvent )
+
+// ----------------------------------------------------
+// class ItemListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener, itemStateChanged, ::com::sun::star::awt::ItemEvent )
+
+// ----------------------------------------------------
+// class ContainerListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementInserted, ::com::sun::star::container::ContainerEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementRemoved, ::com::sun::star::container::ContainerEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementReplaced, ::com::sun::star::container::ContainerEvent )
+
+// ----------------------------------------------------
+// class SpinListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, up, ::com::sun::star::awt::SpinEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, down, ::com::sun::star::awt::SpinEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, first, ::com::sun::star::awt::SpinEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, last, ::com::sun::star::awt::SpinEvent )
+
+// ----------------------------------------------------
+// class AdjustmentListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener, adjustmentValueChanged, ::com::sun::star::awt::AdjustmentEvent )
+
+// ----------------------------------------------------
+// class MenuListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, highlight, ::com::sun::star::awt::MenuEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, select, ::com::sun::star::awt::MenuEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, activate, ::com::sun::star::awt::MenuEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, deactivate, ::com::sun::star::awt::MenuEvent )
+
+// ----------------------------------------------------
+// class TreeSelectionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeSelectionListenerMultiplexer, ::com::sun::star::view::XSelectionChangeListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeSelectionListenerMultiplexer, ::com::sun::star::view::XSelectionChangeListener, selectionChanged, ::com::sun::star::lang::EventObject )
+
+// ----------------------------------------------------
+// class TreeSelectionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, requestChildNodes, ::com::sun::star::awt::tree::TreeExpansionEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, treeExpanding, ::com::sun::star::awt::tree::TreeExpansionEvent, ::com::sun::star::awt::tree::ExpandVetoException )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, treeCollapsing, ::com::sun::star::awt::tree::TreeExpansionEvent, ::com::sun::star::awt::tree::ExpandVetoException )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, treeExpanded, ::com::sun::star::awt::tree::TreeExpansionEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, treeCollapsed, ::com::sun::star::awt::tree::TreeExpansionEvent )
+
+// ----------------------------------------------------
+// class TreeEditListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeEditListenerMultiplexer, ::com::sun::star::awt::tree::XTreeEditListener )
+
+// ----------------------------------------------------
+// class SelectionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener, selectionChanged, ::com::sun::star::awt::grid::GridSelectionEvent )
diff --git a/toolkit/source/helper/makefile.mk b/toolkit/source/helper/makefile.mk
new file mode 100644
index 000000000000..bf10b0aa0178
--- /dev/null
+++ b/toolkit/source/helper/makefile.mk
@@ -0,0 +1,64 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=toolkit
+TARGET=helper
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/listenermultiplexer.obj \
+ $(SLO)$/property.obj \
+ $(SLO)$/registerservices.obj \
+ $(SLO)$/servicenames.obj \
+ $(SLO)$/tkresmgr.obj \
+ $(SLO)$/unomemorystream.obj \
+ $(SLO)$/unopropertyarrayhelper.obj \
+ $(SLO)$/unowrapper.obj \
+ $(SLO)$/vclunohelper.obj \
+ $(SLO)$/externallock.obj \
+ $(SLO)$/imagealign.obj \
+ $(SLO)$/throbberimpl.obj \
+ $(SLO)$/formpdfexport.obj \
+ $(SLO)$/accessibilityclient.obj \
+ $(SLO)$/fixedhyperbase.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
new file mode 100644
index 000000000000..3a83465a3218
--- /dev/null
+++ b/toolkit/source/helper/property.cxx
@@ -0,0 +1,405 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <osl/mutex.hxx>
+
+#include <stdlib.h> // qsort/bsearch
+#include <tools/debug.hxx>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/CharSet.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/awt/FontWidth.hpp>
+#include <com/sun/star/awt/FontType.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/awt/FontPitch.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/awt/tree/XTreeDataModel.hpp>
+#include <com/sun/star/awt/grid/XGridDataModel.hpp>
+#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
+#include <com/sun/star/awt/grid/ScrollBarMode.hpp>
+#include <com/sun/star/view/SelectionType.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <comphelper/types.hxx>
+#include <functional>
+#include <algorithm>
+#include <toolkit/helper/property.hxx>
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::awt::XDevice;
+using ::com::sun::star::awt::FontDescriptor;
+using ::com::sun::star::style::VerticalAlignment;
+
+struct ImplPropertyInfo
+{
+ ::rtl::OUString aName;
+ sal_uInt16 nPropId;
+ ::com::sun::star::uno::Type aType;
+ sal_Int16 nAttribs;
+ sal_Bool bDependsOnOthers; // eg. VALUE depends on MIN/MAX and must be set after MIN/MAX.
+
+ ImplPropertyInfo()
+ {
+ nPropId = 0;
+ nAttribs = 0;
+ bDependsOnOthers = sal_False;
+ }
+
+ ImplPropertyInfo( const sal_Unicode* pName, sal_uInt16 nId, const ::com::sun::star::uno::Type& rType,
+ sal_Int16 nAttrs, sal_Bool bDepends = sal_False )
+ : aName( pName )
+ {
+ nPropId = nId;
+ aType = rType;
+ nAttribs = nAttrs;
+ bDependsOnOthers = bDepends;
+ }
+
+};
+
+#define DECL_PROP_1( asciiname, id, type, attrib1 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 )
+#define DECL_PROP_2( asciiname, id, type, attrib1, attrib2 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 )
+#define DECL_PROP_3( asciiname, id, type, attrib1, attrib2, attrib3 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3 )
+#define DECL_PROP_4( asciiname, id, type, attrib1, attrib2, attrib3, attrib4 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3 | ::com::sun::star::beans::PropertyAttribute::attrib4 )
+
+#define DECL_DEP_PROP_1( asciiname, id, type, attrib1 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1, sal_True )
+#define DECL_DEP_PROP_2( asciiname, id, type, attrib1, attrib2 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2, sal_True )
+#define DECL_DEP_PROP_3( asciiname, id, type, attrib1, attrib2, attrib3 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3, sal_True )
+
+ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
+{
+ static ImplPropertyInfo* pPropertyInfos = NULL;
+ static sal_uInt16 nElements = 0;
+ if( !pPropertyInfos )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pPropertyInfos )
+ {
+ static ImplPropertyInfo __FAR_DATA aImplPropertyInfos [] =
+ {
+ DECL_PROP_2 ( "AccessibleName", ACCESSIBLENAME, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "Align", ALIGN, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "Autocomplete", AUTOCOMPLETE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "AutoHScroll", AUTOHSCROLL, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_1 ( "AutoMnemonics", AUTOMNEMONICS, bool, BOUND ),
+ DECL_PROP_2 ( "AutoToggle", AUTOTOGGLE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "AutoVScroll", AUTOVSCROLL, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "BackgroundColor", BACKGROUNDCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_DEP_PROP_2 ( "BlockIncrement", BLOCKINCREMENT, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "Border", BORDER, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_DEP_PROP_3 ( "BorderColor", BORDERCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "Closeable", CLOSEABLE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "CurrencySymbol", CURRENCYSYMBOL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "CustomUnitText", CUSTOMUNITTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_3 ( "Date", DATE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "DateFormat", EXTDATEFORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DateMax", DATEMAX, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DateMin", DATEMIN, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "DateShowCentury", DATESHOWCENTURY, bool, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "DecimalAccuracy", DECIMALACCURACY, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DefaultButton", DEFAULTBUTTON, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DefaultControl", DEFAULTCONTROL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DesktopAsParent", DESKTOP_AS_PARENT, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DisplayBackgroundColor", DISPLAYBACKGROUNDCOLOR, sal_Int32, BOUND, MAYBEVOID ),
+ DECL_PROP_2 ( "Dropdown", DROPDOWN, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "EchoChar", ECHOCHAR, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "EditMask", EDITMASK, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "EffectiveDefault", EFFECTIVE_DEFAULT, Any, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "EffectiveMax", EFFECTIVE_MAX, double, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "EffectiveMin", EFFECTIVE_MIN, double, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_DEP_PROP_3 ( "EffectiveValue", EFFECTIVE_VALUE, Any, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "Enabled", ENABLED, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "EnforceFormat", ENFORCE_FORMAT, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "FillColor", FILLCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "FocusOnClick", FOCUSONCLICK, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontRelief", FONTRELIEF, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontEmphasisMark", FONTEMPHASISMARK, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontDescriptor", FONTDESCRIPTOR, FontDescriptor, BOUND, MAYBEDEFAULT ),
+
+ // Teile des ::com::sun::star::awt::FontDescriptor
+ DECL_PROP_2 ( "FontName", FONTDESCRIPTORPART_NAME, ::rtl::OUString,BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontStyleName", FONTDESCRIPTORPART_STYLENAME, ::rtl::OUString,BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontFamily", FONTDESCRIPTORPART_FAMILY, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontCharset", FONTDESCRIPTORPART_CHARSET, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontHeight", FONTDESCRIPTORPART_HEIGHT, float, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontWidth", FONTDESCRIPTORPART_WIDTH, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontPitch", FONTDESCRIPTORPART_PITCH, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontWeight", FONTDESCRIPTORPART_WEIGHT, float, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontCharWidth", FONTDESCRIPTORPART_CHARWIDTH, float, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontOrientation", FONTDESCRIPTORPART_ORIENTATION, float, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontSlant", FONTDESCRIPTORPART_SLANT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontUnderline", FONTDESCRIPTORPART_UNDERLINE, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontStrikeout", FONTDESCRIPTORPART_STRIKEOUT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontKerning", FONTDESCRIPTORPART_KERNING, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontWordLineMode", FONTDESCRIPTORPART_WORDLINEMODE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontType", FONTDESCRIPTORPART_TYPE, sal_Int16, BOUND, MAYBEDEFAULT ),
+
+ DECL_PROP_3 ( "FormatKey", FORMATKEY, sal_Int32, BOUND, MAYBEVOID, TRANSIENT ),
+ DECL_PROP_3 ( "FormatsSupplier", FORMATSSUPPLIER, Reference< ::com::sun::star::util::XNumberFormatsSupplier >, BOUND, MAYBEVOID, TRANSIENT ),
+
+ DECL_PROP_2 ( "Graphic", GRAPHIC, Reference< ::com::sun::star::graphic::XGraphic >, BOUND, TRANSIENT ),
+ DECL_PROP_2 ( "HelpText", HELPTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "HelpURL", HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "HideInactiveSelection", HIDEINACTIVESELECTION, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "HighContrastMode", HIGHCONTRASTMODE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "HScroll", HSCROLL, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "HardLineBreaks", HARDLINEBREAKS, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ImageAlign", IMAGEALIGN, sal_Int16, BOUND, MAYBEDEFAULT),
+ DECL_PROP_2 ( "ImagePosition", IMAGEPOSITION, sal_Int16, BOUND, MAYBEDEFAULT),
+ DECL_PROP_2 ( "ImageURL", IMAGEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "ItemSeparatorPos", ITEM_SEPARATOR_POS, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "Label", LABEL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "LineColor", LINECOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "LineCount", LINECOUNT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "LineEndFormat", LINE_END_FORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_2 ( "LineIncrement", LINEINCREMENT, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "LiteralMask", LITERALMASK, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "LiveScroll", LIVE_SCROLL, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "MaxTextLen", MAXTEXTLEN, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Moveable", MOVEABLE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_1 ( "MouseTransparent", MOUSETRANSPARENT, bool, BOUND ),
+ DECL_PROP_2 ( "MultiLine", MULTILINE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "MultiSelection", MULTISELECTION, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "MultiSelectionSimpleMode", MULTISELECTION_SIMPLEMODE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "NativeWidgetLook", NATIVE_WIDGET_LOOK, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "NoLabel", NOLABEL, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Orientation", ORIENTATION, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "PaintTransparent", PAINTTRANSPARENT, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "PluginParent", PLUGINPARENT, sal_Int64, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "PrependCurrencySymbol", CURSYM_POSITION, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Printable", PRINTABLE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_3 ( "ProgressValue", PROGRESSVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "ProgressValueMax", PROGRESSVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ProgressValueMin", PROGRESSVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "PushButtonType", PUSHBUTTONTYPE, sal_Int16, BOUND, MAYBEDEFAULT),
+ DECL_PROP_2 ( "ReadOnly", READONLY, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Repeat", REPEAT, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "RepeatDelay", REPEAT_DELAY, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ScaleImage", SCALEIMAGE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ScaleMode", IMAGE_SCALE_MODE, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_3 ( "ScrollValue", SCROLLVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "ScrollValueMax", SCROLLVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ScrollValueMin", SCROLLVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_2 ( "SelectedItems", SELECTEDITEMS, Sequence<sal_Int16>, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ShowThousandsSeparator", NUMSHOWTHOUSANDSEP, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Sizeable", SIZEABLE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Spin", SPIN, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "SpinIncrement", SPININCREMENT, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_2 ( "SpinValue", SPINVALUE, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "SpinValueMax", SPINVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "SpinValueMin", SPINVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_2 ( "State", STATE, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "StrictFormat", STRICTFORMAT, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "StringItemList", STRINGITEMLIST, Sequence< ::rtl::OUString >, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "VisualEffect", VISUALEFFECT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "SymbolColor", SYMBOL_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "Tabstop", TABSTOP, bool, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "Text", TEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "TextColor", TEXTCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "TextLineColor", TEXTLINECOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_DEP_PROP_3 ( "Time", TIME, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "TimeFormat", EXTTIMEFORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "TimeMax", TIMEMAX, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "TimeMin", TIMEMIN, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Title", TITLE, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Toggle", TOGGLE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "TreatAsNumber", TREATASNUMBER, bool, BOUND, MAYBEDEFAULT,TRANSIENT ),
+ DECL_PROP_2 ( "TriState", TRISTATE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Unit", UNIT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "VScroll", VSCROLL, bool, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_3 ( "Value", VALUE_DOUBLE, double, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "ValueMax", VALUEMAX_DOUBLE, double, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ValueMin", VALUEMIN_DOUBLE, double, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ValueStep", VALUESTEP_DOUBLE, double, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "VerticalAlign", VERTICALALIGN, VerticalAlignment, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_DEP_PROP_3 ( "VisibleSize", VISIBLESIZE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "Activated", ACTIVATED, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Complete", COMPLETE, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "CurrentItemID", CURRENTITEMID, sal_Int16, BOUND, MAYBEDEFAULT ),
+
+ DECL_PROP_2 ( "MouseWheelBehavior", MOUSE_WHEEL_BEHAVIOUR, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "StepTime", STEP_TIME, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Decoration", DECORATION, sal_Bool, BOUND, MAYBEDEFAULT ),
+
+ DECL_PROP_2 ( "SelectionType", TREE_SELECTIONTYPE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Editable", TREE_EDITABLE, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "DataModel", TREE_DATAMODEL, Reference< ::com::sun::star::awt::tree::XTreeDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "RootDisplayed", TREE_ROOTDISPLAYED, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ShowsHandles", TREE_SHOWSHANDLES, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ShowsRootHandles", TREE_SHOWSROOTHANDLES, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "RowHeight", TREE_ROWHEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "InvokesStopNodeEditing", TREE_INVOKESSTOPNODEEDITING, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DialogSourceURL", DIALOGSOURCEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "WritingMode", WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "ContextWritingMode", CONTEXT_WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT, TRANSIENT ),
+ DECL_PROP_2 ( "ShowRowHeader", GRID_SHOWROWHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ),
+ DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "GridLineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "RowBackgroundColor", GRID_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID )
+ };
+ pPropertyInfos = aImplPropertyInfos;
+ nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
+ }
+ }
+ rElementCount = nElements;
+ return pPropertyInfos;
+}
+
+
+struct ImplPropertyInfoCompareFunctor : ::std::binary_function<ImplPropertyInfo,::rtl::OUString,bool>
+{
+ inline bool operator()(const ImplPropertyInfo& lhs,const ImplPropertyInfo& rhs) const
+ {
+ return lhs.aName.compareTo(rhs.aName) < 0;
+ }
+ inline bool operator()(const ImplPropertyInfo& lhs,const ::rtl::OUString& rhs) const
+ {
+ return lhs.aName.compareTo(rhs) < 0;
+ }
+ inline bool operator()(const ::rtl::OUString& lhs,const ImplPropertyInfo& rhs) const
+ {
+ return lhs.compareTo(rhs.aName) < 0;
+ }
+};
+
+void ImplAssertValidPropertyArray()
+{
+ static sal_Bool bSorted = sal_False;
+ if( !bSorted )
+ {
+ sal_uInt16 nElements;
+ ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
+ ::std::sort(pInfos, pInfos+nElements,ImplPropertyInfoCompareFunctor());
+ bSorted = sal_True;
+ }
+}
+
+sal_uInt16 GetPropertyId( const ::rtl::OUString& rPropertyName )
+{
+ ImplAssertValidPropertyArray();
+
+ sal_uInt16 nElements;
+ ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
+ ImplPropertyInfo* pInf = ::std::lower_bound(pInfos,pInfos+nElements,rPropertyName,ImplPropertyInfoCompareFunctor());
+/*
+ (ImplPropertyInfo*)
+ bsearch( &aSearch, pInfos, nElements, sizeof( ImplPropertyInfo ), ImplPropertyInfoCompare );
+*/
+
+ return ( pInf && pInf != (pInfos+nElements) && pInf->aName == rPropertyName) ? pInf->nPropId: 0;
+}
+
+const ImplPropertyInfo* ImplGetImplPropertyInfo( sal_uInt16 nPropertyId )
+{
+ ImplAssertValidPropertyArray();
+
+ sal_uInt16 nElements;
+ ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
+ sal_uInt16 n;
+ for ( n = 0; n < nElements && pInfos[n].nPropId != nPropertyId; ++n)
+ ;
+
+ return (n < nElements) ? &pInfos[n] : NULL;
+}
+
+sal_uInt16 GetPropertyOrderNr( sal_uInt16 nPropertyId )
+{
+ ImplAssertValidPropertyArray();
+
+ sal_uInt16 nElements;
+ ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
+ for ( sal_uInt16 n = nElements; n; )
+ {
+ if ( pInfos[--n].nPropId == nPropertyId )
+ return n;
+ }
+ return 0xFFFF;
+}
+
+const ::rtl::OUString& GetPropertyName( sal_uInt16 nPropertyId )
+{
+ const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
+ DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
+ return pImplPropertyInfo->aName;
+}
+
+const ::com::sun::star::uno::Type* GetPropertyType( sal_uInt16 nPropertyId )
+{
+ const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
+ DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
+ return pImplPropertyInfo ? &pImplPropertyInfo->aType : NULL;
+}
+
+sal_Int16 GetPropertyAttribs( sal_uInt16 nPropertyId )
+{
+ const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
+ DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
+ return pImplPropertyInfo ? pImplPropertyInfo->nAttribs : 0;
+}
+
+sal_Bool DoesDependOnOthers( sal_uInt16 nPropertyId )
+{
+ const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
+ DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
+ return pImplPropertyInfo ? pImplPropertyInfo->bDependsOnOthers : sal_False;
+}
+
+sal_Bool CompareProperties( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 )
+{
+ return ::comphelper::compare( r1, r2 );
+}
+
+
+
diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx
new file mode 100644
index 000000000000..aedf4024f2b9
--- /dev/null
+++ b/toolkit/source/helper/registerservices.cxx
@@ -0,0 +1,399 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <toolkit/controls/geometrycontrolmodel.hxx>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/weak.hxx>
+#include <osl/mutex.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/awt/vclxtoolkit.hxx>
+#include <toolkit/awt/vclxmenu.hxx>
+#include <toolkit/awt/vclxpointer.hxx>
+#include <toolkit/awt/vclxprinter.hxx>
+#include <toolkit/controls/unocontrols.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <toolkit/controls/unocontrolcontainermodel.hxx>
+#include <toolkit/controls/stdtabcontroller.hxx>
+#include <toolkit/controls/stdtabcontrollermodel.hxx>
+#include <toolkit/controls/formattedcontrol.hxx>
+#include <toolkit/controls/roadmapcontrol.hxx>
+#include <toolkit/controls/tkscrollbar.hxx>
+#include "toolkit/controls/tkspinbutton.hxx"
+#include <toolkit/controls/tksimpleanimation.hxx>
+#include <toolkit/controls/tkthrobber.hxx>
+#include <toolkit/controls/dialogcontrol.hxx>
+#include "toolkit/dllapi.h"
+
+namespace toolkit
+{
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::registry;
+
+ //.........................................................................
+ Reference< XRegistryKey > registerServices( const Reference< XRegistryKey >& _rxParentKey,
+ const sal_Char* _pAsciiImplName, const sal_Char* _pAsciiServiceName )
+ {
+ ::rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM( "/stardiv.Toolkit." ) );
+ sImplName += ::rtl::OUString::createFromAscii( _pAsciiImplName );
+ sImplName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES" ) );
+
+ Reference< XRegistryKey > xNewKey = _rxParentKey->createKey( sImplName );
+ xNewKey->createKey( ::rtl::OUString::createFromAscii( _pAsciiServiceName ) );
+
+ return xNewKey;
+ }
+
+ //.........................................................................
+ Reference< XRegistryKey > registerServices( const Reference< XRegistryKey >& _rxParentKey,
+ const sal_Char* _pAsciiImplName, const sal_Char* _pAsciiServiceName1, const sal_Char* _pAsciiServiceName2 )
+ {
+ Reference< XRegistryKey > xComponentServicesKey = registerServices( _rxParentKey, _pAsciiImplName, _pAsciiServiceName1 );
+ xComponentServicesKey->createKey( ::rtl::OUString::createFromAscii( _pAsciiServiceName2 ) );
+ return xComponentServicesKey;
+ }
+
+ //.........................................................................
+ void* tryCreateFactory( const sal_Char* _pRequiredImplName, const sal_Char* _pComponentImplName,
+ const sal_Char* _pAsciiServiceName1, const sal_Char* _pAsciiServiceName2,
+ ::cppu::ComponentInstantiation _pInstantiation, const Reference< XMultiServiceFactory >& _rxServiceFactory )
+ {
+ void* pReturn = NULL;
+
+ if ( rtl_str_compare( _pRequiredImplName, _pComponentImplName ) == 0 )
+ {
+ Sequence< ::rtl::OUString > aServiceNames( _pAsciiServiceName2 ? 2 : 1 );
+ aServiceNames.getArray()[ 0 ] = ::rtl::OUString::createFromAscii( _pAsciiServiceName1 );
+ if ( _pAsciiServiceName2 )
+ aServiceNames.getArray()[ 1 ] = ::rtl::OUString::createFromAscii( _pAsciiServiceName2 );
+ Reference< XSingleServiceFactory > xFactory( ::cppu::createSingleFactory(
+ _rxServiceFactory, ::rtl::OUString::createFromAscii( _pComponentImplName ),
+ _pInstantiation, aServiceNames
+ ) );
+
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pReturn = xFactory.get();
+ }
+ }
+
+ return pReturn;
+ }
+
+
+}
+
+#define IMPL_CREATEINSTANCE( ImplName ) \
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) \
+ { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName ); }
+
+#define IMPL_CREATEINSTANCE2( ImplName ) \
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr) \
+ { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName( rSMgr ) ); }
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlDialogModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& )
+{
+ return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlDialogModel> );
+}
+
+#define CHECKANDCREATEFACTORY( ImplName, ServiceName1, ServiceName2 ) \
+ pRet = tryCreateFactory( sImplementationName, "stardiv.Toolkit." #ImplName, \
+ ServiceName1, ServiceName2, \
+ ImplName##_CreateInstance, xServiceFactory \
+ ); \
+ if ( pRet ) \
+ return pRet; \
+
+using namespace toolkit;
+
+IMPL_CREATEINSTANCE2( VCLXToolkit )
+IMPL_CREATEINSTANCE( StdTabController )
+IMPL_CREATEINSTANCE( StdTabControllerModel )
+IMPL_CREATEINSTANCE( UnoButtonControl )
+IMPL_CREATEINSTANCE( UnoCheckBoxControl )
+IMPL_CREATEINSTANCE( UnoComboBoxControl )
+IMPL_CREATEINSTANCE( UnoControlButtonModel )
+IMPL_CREATEINSTANCE( UnoControlCheckBoxModel )
+IMPL_CREATEINSTANCE( UnoControlComboBoxModel )
+IMPL_CREATEINSTANCE( UnoControlContainer )
+IMPL_CREATEINSTANCE( UnoControlContainerModel )
+IMPL_CREATEINSTANCE( UnoControlCurrencyFieldModel )
+IMPL_CREATEINSTANCE( UnoControlDateFieldModel )
+IMPL_CREATEINSTANCE( UnoControlEditModel )
+IMPL_CREATEINSTANCE( UnoControlFileControlModel )
+IMPL_CREATEINSTANCE( UnoControlFixedHyperlinkModel )
+IMPL_CREATEINSTANCE( UnoControlFixedTextModel )
+IMPL_CREATEINSTANCE( UnoControlFormattedFieldModel )
+IMPL_CREATEINSTANCE( UnoControlGroupBoxModel )
+IMPL_CREATEINSTANCE( UnoControlImageControlModel )
+IMPL_CREATEINSTANCE( UnoControlListBoxModel )
+IMPL_CREATEINSTANCE( UnoControlNumericFieldModel )
+IMPL_CREATEINSTANCE( UnoControlPatternFieldModel )
+IMPL_CREATEINSTANCE( UnoControlRadioButtonModel )
+IMPL_CREATEINSTANCE( UnoControlTimeFieldModel )
+IMPL_CREATEINSTANCE( UnoControlProgressBarModel )
+IMPL_CREATEINSTANCE( UnoControlScrollBarModel )
+IMPL_CREATEINSTANCE( UnoSpinButtonModel )
+IMPL_CREATEINSTANCE( UnoControlFixedLineModel )
+IMPL_CREATEINSTANCE( UnoCurrencyFieldControl )
+IMPL_CREATEINSTANCE( UnoDateFieldControl )
+IMPL_CREATEINSTANCE( UnoDialogControl )
+IMPL_CREATEINSTANCE( UnoEditControl )
+IMPL_CREATEINSTANCE( UnoFileControl )
+IMPL_CREATEINSTANCE( UnoFixedHyperlinkControl )
+IMPL_CREATEINSTANCE( UnoFixedTextControl )
+IMPL_CREATEINSTANCE( UnoFormattedFieldControl )
+IMPL_CREATEINSTANCE( UnoGroupBoxControl )
+IMPL_CREATEINSTANCE( UnoImageControlControl )
+IMPL_CREATEINSTANCE( UnoListBoxControl )
+IMPL_CREATEINSTANCE( UnoNumericFieldControl )
+IMPL_CREATEINSTANCE( UnoPatternFieldControl )
+IMPL_CREATEINSTANCE( UnoRadioButtonControl )
+IMPL_CREATEINSTANCE( UnoTimeFieldControl )
+IMPL_CREATEINSTANCE( UnoProgressBarControl )
+IMPL_CREATEINSTANCE( UnoScrollBarControl )
+IMPL_CREATEINSTANCE( UnoSpinButtonControl )
+IMPL_CREATEINSTANCE( UnoFixedLineControl )
+IMPL_CREATEINSTANCE( VCLXMenuBar )
+IMPL_CREATEINSTANCE( VCLXPointer )
+IMPL_CREATEINSTANCE( VCLXPopupMenu )
+IMPL_CREATEINSTANCE( VCLXPrinterServer )
+IMPL_CREATEINSTANCE( UnoRoadmapControl )
+IMPL_CREATEINSTANCE( UnoControlRoadmapModel )
+IMPL_CREATEINSTANCE( UnoSimpleAnimationControl )
+IMPL_CREATEINSTANCE( UnoSimpleAnimationControlModel )
+IMPL_CREATEINSTANCE( UnoThrobberControl )
+IMPL_CREATEINSTANCE( UnoThrobberControlModel )
+
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MutableTreeDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridColumn_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+
+extern sal_Bool SAL_CALL comp_AsyncCallback_component_writeInfo( void * serviceManager, void * registryKey );
+extern void * SAL_CALL comp_AsyncCallback_component_getFactory( const char * implName, void * serviceManager, void * registryKey );
+
+extern sal_Bool SAL_CALL comp_Layout_component_writeInfo( void * serviceManager, void * registryKey );
+extern void * SAL_CALL comp_Layout_component_getFactory( const char * implName, void * serviceManager, void * registryKey );
+
+extern "C"
+{
+
+TOOLKIT_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager, void* _pRegistryKey )
+{
+ if (_pRegistryKey)
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xRegistryKey =
+ static_cast< ::com::sun::star::registry::XRegistryKey* >( _pRegistryKey );
+
+ registerServices( xRegistryKey, "VCLXToolkit", szServiceName_Toolkit, szServiceName2_Toolkit );
+ registerServices( xRegistryKey, "VCLXPopupMenu", szServiceName_PopupMenu, szServiceName2_PopupMenu );
+ registerServices( xRegistryKey, "VCLXMenuBar", szServiceName_MenuBar, szServiceName2_MenuBar );
+ registerServices( xRegistryKey, "VCLXPointer", szServiceName_Pointer, szServiceName2_Pointer );
+ registerServices( xRegistryKey, "UnoControlContainer", szServiceName_UnoControlContainer, szServiceName2_UnoControlContainer );
+ registerServices( xRegistryKey, "UnoControlContainerModel", szServiceName_UnoControlContainerModel, szServiceName2_UnoControlContainerModel );
+ registerServices( xRegistryKey, "StdTabController", szServiceName_TabController, szServiceName2_TabController );
+ registerServices( xRegistryKey, "StdTabControllerModel", szServiceName_TabControllerModel, szServiceName2_TabControllerModel );
+ registerServices( xRegistryKey, "UnoDialogControl", szServiceName_UnoControlDialog, szServiceName2_UnoControlDialog );
+ registerServices( xRegistryKey, "UnoControlDialogModel", szServiceName_UnoControlDialogModel, szServiceName2_UnoControlDialogModel );
+ registerServices( xRegistryKey, "UnoEditControl", szServiceName_UnoControlEdit, szServiceName2_UnoControlEdit );
+ registerServices( xRegistryKey, "UnoControlEditModel", szServiceName_UnoControlEditModel, szServiceName2_UnoControlEditModel );
+ registerServices( xRegistryKey, "UnoDateFieldControl", szServiceName_UnoControlDateField, szServiceName2_UnoControlDateField );
+ registerServices( xRegistryKey, "UnoControlDateFieldModel", szServiceName_UnoControlDateFieldModel, szServiceName2_UnoControlDateFieldModel );
+ registerServices( xRegistryKey, "UnoTimeFieldControl", szServiceName_UnoControlTimeField, szServiceName2_UnoControlTimeField );
+ registerServices( xRegistryKey, "UnoControlTimeFieldModel", szServiceName_UnoControlTimeFieldModel, szServiceName2_UnoControlTimeFieldModel );
+ registerServices( xRegistryKey, "UnoNumericFieldControl", szServiceName_UnoControlNumericField, szServiceName2_UnoControlNumericField );
+ registerServices( xRegistryKey, "UnoControlNumericFieldModel", szServiceName_UnoControlNumericFieldModel, szServiceName2_UnoControlNumericFieldModel );
+ registerServices( xRegistryKey, "UnoCurrencyFieldControl", szServiceName_UnoControlCurrencyField, szServiceName2_UnoControlCurrencyField );
+ registerServices( xRegistryKey, "UnoControlCurrencyFieldModel", szServiceName_UnoControlCurrencyFieldModel, szServiceName2_UnoControlCurrencyFieldModel );
+ registerServices( xRegistryKey, "UnoPatternFieldControl", szServiceName_UnoControlPatternField, szServiceName2_UnoControlPatternField );
+ registerServices( xRegistryKey, "UnoControlPatternFieldModel", szServiceName_UnoControlPatternFieldModel, szServiceName2_UnoControlPatternFieldModel );
+ registerServices( xRegistryKey, "UnoFormattedFieldControl", szServiceName_UnoControlFormattedField, szServiceName2_UnoControlFormattedField );
+ registerServices( xRegistryKey, "UnoControlFormattedFieldModel", szServiceName_UnoControlFormattedFieldModel, szServiceName2_UnoControlFormattedFieldModel );
+ registerServices( xRegistryKey, "UnoFileControl", szServiceName_UnoControlFileControl, szServiceName2_UnoControlFileControl );
+ registerServices( xRegistryKey, "UnoControlFileControlModel", szServiceName_UnoControlFileControlModel, szServiceName2_UnoControlFileControlModel );
+ registerServices( xRegistryKey, "UnoButtonControl", szServiceName_UnoControlButton, szServiceName2_UnoControlButton );
+ registerServices( xRegistryKey, "UnoControlButtonModel", szServiceName_UnoControlButtonModel, szServiceName2_UnoControlButtonModel );
+ registerServices( xRegistryKey, "UnoImageControlControl", szServiceName_UnoControlImageButton, szServiceName2_UnoControlImageButton );
+ registerServices( xRegistryKey, "UnoControlImageControlModel", szServiceName_UnoControlImageButtonModel, szServiceName2_UnoControlImageButtonModel );
+ registerServices( xRegistryKey, "UnoImageControlControl", szServiceName_UnoControlImageControl, szServiceName2_UnoControlImageControl );
+ registerServices( xRegistryKey, "UnoControlImageControlModel", szServiceName_UnoControlImageControlModel, szServiceName2_UnoControlImageControlModel );
+ registerServices( xRegistryKey, "UnoRadioButtonControl", szServiceName_UnoControlRadioButton, szServiceName2_UnoControlRadioButton );
+ registerServices( xRegistryKey, "UnoControlRadioButtonModel", szServiceName_UnoControlRadioButtonModel, szServiceName2_UnoControlRadioButtonModel );
+ registerServices( xRegistryKey, "UnoCheckBoxControl", szServiceName_UnoControlCheckBox, szServiceName2_UnoControlCheckBox );
+ registerServices( xRegistryKey, "UnoControlCheckBoxModel", szServiceName_UnoControlCheckBoxModel, szServiceName2_UnoControlCheckBoxModel );
+ registerServices( xRegistryKey, "UnoListBoxControl", szServiceName_UnoControlListBox, szServiceName2_UnoControlListBox );
+ registerServices( xRegistryKey, "UnoControlListBoxModel", szServiceName_UnoControlListBoxModel, szServiceName2_UnoControlListBoxModel );
+ registerServices( xRegistryKey, "UnoComboBoxControl", szServiceName_UnoControlComboBox, szServiceName2_UnoControlComboBox );
+ registerServices( xRegistryKey, "UnoControlComboBoxModel", szServiceName_UnoControlComboBoxModel, szServiceName2_UnoControlComboBoxModel );
+ registerServices( xRegistryKey, "UnoFixedTextControl", szServiceName_UnoControlFixedText, szServiceName2_UnoControlFixedText );
+ registerServices( xRegistryKey, "UnoControlFixedTextModel", szServiceName_UnoControlFixedTextModel, szServiceName2_UnoControlFixedTextModel );
+ registerServices( xRegistryKey, "UnoGroupBoxControl", szServiceName_UnoControlGroupBox, szServiceName2_UnoControlGroupBox );
+ registerServices( xRegistryKey, "UnoControlGroupBoxModel", szServiceName_UnoControlGroupBoxModel, szServiceName2_UnoControlGroupBoxModel );
+ registerServices( xRegistryKey, "UnoProgressBarControl", szServiceName_UnoControlProgressBar, szServiceName2_UnoControlProgressBar );
+ registerServices( xRegistryKey, "UnoControlProgressBarModel", szServiceName_UnoControlProgressBarModel, szServiceName2_UnoControlProgressBarModel );
+ registerServices( xRegistryKey, "UnoScrollBarControl", szServiceName_UnoControlScrollBar, szServiceName2_UnoControlScrollBar );
+ registerServices( xRegistryKey, "UnoControlScrollBarModel", szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel );
+ registerServices( xRegistryKey, "UnoSpinButtonModel", szServiceName_UnoSpinButtonModel );
+ registerServices( xRegistryKey, "UnoSpinButtonControl", szServiceName_UnoSpinButtonControl );
+ registerServices( xRegistryKey, "UnoFixedLineControl", szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine );
+ registerServices( xRegistryKey, "UnoControlFixedLineModel", szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel );
+ registerServices( xRegistryKey, "VCLXPrinterServer", szServiceName_PrinterServer, szServiceName2_PrinterServer );
+ registerServices( xRegistryKey, "UnoRoadmapControl", szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap );
+ registerServices( xRegistryKey, "UnoControlRoadmapModel", szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel );
+ registerServices( xRegistryKey, "TreeControl", szServiceName_TreeControl );
+ registerServices( xRegistryKey, "TreeControlModel", szServiceName_TreeControlModel );
+ registerServices( xRegistryKey, "MutableTreeDataModel", szServiceName_MutableTreeDataModel );
+ registerServices( xRegistryKey, "UnoSimpleAnimationControlModel", szServiceName_UnoSimpleAnimationControlModel, szServiceName2_UnoSimpleAnimationControlModel );
+ registerServices( xRegistryKey, "UnoSimpleAnimationControl", szServiceName_UnoSimpleAnimationControl, szServiceName2_UnoSimpleAnimationControl );
+ registerServices( xRegistryKey, "UnoThrobberControlModel", szServiceName_UnoThrobberControlModel, szServiceName2_UnoThrobberControlModel );
+ registerServices( xRegistryKey, "UnoThrobberControl", szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl );
+ registerServices( xRegistryKey, "UnoFixedHyperlinkControl", szServiceName_UnoControlFixedHyperlink );
+ registerServices( xRegistryKey, "UnoControlFixedHyperlinkModel", szServiceName_UnoControlFixedHyperlinkModel );
+ registerServices( xRegistryKey, "GridControl", szServiceName_GridControl );
+ registerServices( xRegistryKey, "GridControlModel", szServiceName_GridControlModel );
+ registerServices( xRegistryKey, "DefaultGridDataModel", szServiceName_DefaultGridDataModel );
+ registerServices( xRegistryKey, "DefaultGridColumnModel", szServiceName_DefaultGridColumnModel );
+ registerServices( xRegistryKey, "GridColumn", szServiceName_GridColumn );
+
+ comp_AsyncCallback_component_writeInfo( _pServiceManager, _pRegistryKey );
+ comp_Layout_component_writeInfo( _pServiceManager, _pRegistryKey );
+
+ return sal_True;
+ }
+ return sal_False;
+}
+
+TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* _pRegistryKey )
+{
+ void* pRet = NULL;
+
+ if ( _pServiceManager )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory =
+ static_cast< ::com::sun::star::lang::XMultiServiceFactory* >( _pServiceManager );
+
+ CHECKANDCREATEFACTORY( VCLXToolkit, szServiceName_Toolkit, szServiceName2_Toolkit )
+ CHECKANDCREATEFACTORY( VCLXPopupMenu, szServiceName_PopupMenu, szServiceName2_PopupMenu )
+ CHECKANDCREATEFACTORY( VCLXMenuBar, szServiceName_MenuBar, szServiceName2_MenuBar )
+ CHECKANDCREATEFACTORY( VCLXPointer, szServiceName_Pointer, szServiceName2_Pointer )
+ CHECKANDCREATEFACTORY( UnoControlContainer, szServiceName_UnoControlContainer, szServiceName2_UnoControlContainer )
+ CHECKANDCREATEFACTORY( UnoControlContainerModel, szServiceName_UnoControlContainerModel, szServiceName2_UnoControlContainerModel )
+ CHECKANDCREATEFACTORY( StdTabController, szServiceName_TabController, szServiceName2_TabController )
+ CHECKANDCREATEFACTORY( StdTabControllerModel, szServiceName_TabControllerModel, szServiceName2_TabControllerModel )
+ CHECKANDCREATEFACTORY( UnoDialogControl, szServiceName_UnoControlDialog, szServiceName2_UnoControlDialog )
+ CHECKANDCREATEFACTORY( UnoControlDialogModel, szServiceName_UnoControlDialogModel, szServiceName2_UnoControlDialogModel )
+ CHECKANDCREATEFACTORY( UnoEditControl, szServiceName_UnoControlEdit, szServiceName2_UnoControlEdit )
+ CHECKANDCREATEFACTORY( UnoControlEditModel, szServiceName_UnoControlEditModel, szServiceName2_UnoControlEditModel )
+ CHECKANDCREATEFACTORY( UnoDateFieldControl, szServiceName_UnoControlDateField, szServiceName2_UnoControlDateField )
+ CHECKANDCREATEFACTORY( UnoControlDateFieldModel, szServiceName_UnoControlDateFieldModel, szServiceName2_UnoControlDateFieldModel )
+ CHECKANDCREATEFACTORY( UnoTimeFieldControl, szServiceName_UnoControlTimeField, szServiceName2_UnoControlTimeField )
+ CHECKANDCREATEFACTORY( UnoControlTimeFieldModel, szServiceName_UnoControlTimeFieldModel, szServiceName2_UnoControlTimeFieldModel )
+ CHECKANDCREATEFACTORY( UnoNumericFieldControl, szServiceName_UnoControlNumericField, szServiceName2_UnoControlNumericField )
+ CHECKANDCREATEFACTORY( UnoControlNumericFieldModel, szServiceName_UnoControlNumericFieldModel, szServiceName2_UnoControlNumericFieldModel )
+ CHECKANDCREATEFACTORY( UnoCurrencyFieldControl, szServiceName_UnoControlCurrencyField, szServiceName2_UnoControlCurrencyField )
+ CHECKANDCREATEFACTORY( UnoControlCurrencyFieldModel, szServiceName_UnoControlCurrencyFieldModel, szServiceName2_UnoControlCurrencyFieldModel )
+ CHECKANDCREATEFACTORY( UnoPatternFieldControl, szServiceName_UnoControlPatternField, szServiceName2_UnoControlPatternField )
+ CHECKANDCREATEFACTORY( UnoControlPatternFieldModel, szServiceName_UnoControlPatternFieldModel, szServiceName2_UnoControlPatternFieldModel )
+ CHECKANDCREATEFACTORY( UnoFormattedFieldControl, szServiceName_UnoControlFormattedField, szServiceName2_UnoControlFormattedField )
+ CHECKANDCREATEFACTORY( UnoControlFormattedFieldModel, szServiceName_UnoControlFormattedFieldModel, szServiceName2_UnoControlFormattedFieldModel )
+ CHECKANDCREATEFACTORY( UnoFileControl, szServiceName_UnoControlFileControl, szServiceName2_UnoControlFileControl )
+ CHECKANDCREATEFACTORY( UnoControlFileControlModel, szServiceName_UnoControlFileControlModel, szServiceName2_UnoControlFileControlModel )
+ CHECKANDCREATEFACTORY( UnoButtonControl, szServiceName_UnoControlButton, szServiceName2_UnoControlButton )
+ CHECKANDCREATEFACTORY( UnoControlButtonModel, szServiceName_UnoControlButtonModel, szServiceName2_UnoControlButtonModel )
+ CHECKANDCREATEFACTORY( UnoImageControlControl, szServiceName_UnoControlImageButton, szServiceName2_UnoControlImageButton )
+ CHECKANDCREATEFACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageButtonModel, szServiceName2_UnoControlImageButtonModel )
+ CHECKANDCREATEFACTORY( UnoImageControlControl, szServiceName_UnoControlImageControl, szServiceName2_UnoControlImageControl )
+ CHECKANDCREATEFACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageControlModel, szServiceName2_UnoControlImageControlModel )
+ CHECKANDCREATEFACTORY( UnoRadioButtonControl, szServiceName_UnoControlRadioButton, szServiceName2_UnoControlRadioButton )
+ CHECKANDCREATEFACTORY( UnoControlRadioButtonModel, szServiceName_UnoControlRadioButtonModel, szServiceName2_UnoControlRadioButtonModel )
+ CHECKANDCREATEFACTORY( UnoCheckBoxControl, szServiceName_UnoControlCheckBox, szServiceName2_UnoControlCheckBox )
+ CHECKANDCREATEFACTORY( UnoControlCheckBoxModel, szServiceName_UnoControlCheckBoxModel, szServiceName2_UnoControlCheckBoxModel )
+ CHECKANDCREATEFACTORY( UnoListBoxControl, szServiceName_UnoControlListBox, szServiceName2_UnoControlListBox )
+ CHECKANDCREATEFACTORY( UnoControlListBoxModel, szServiceName_UnoControlListBoxModel, szServiceName2_UnoControlListBoxModel )
+ CHECKANDCREATEFACTORY( UnoComboBoxControl, szServiceName_UnoControlComboBox, szServiceName2_UnoControlComboBox )
+ CHECKANDCREATEFACTORY( UnoControlComboBoxModel, szServiceName_UnoControlComboBoxModel, szServiceName2_UnoControlComboBoxModel )
+ CHECKANDCREATEFACTORY( UnoFixedTextControl, szServiceName_UnoControlFixedText, szServiceName2_UnoControlFixedText )
+ CHECKANDCREATEFACTORY( UnoControlFixedTextModel, szServiceName_UnoControlFixedTextModel, szServiceName2_UnoControlFixedTextModel )
+ CHECKANDCREATEFACTORY( UnoGroupBoxControl, szServiceName_UnoControlGroupBox, szServiceName2_UnoControlGroupBox )
+ CHECKANDCREATEFACTORY( UnoControlGroupBoxModel, szServiceName_UnoControlGroupBoxModel, szServiceName2_UnoControlGroupBoxModel )
+ CHECKANDCREATEFACTORY( UnoProgressBarControl, szServiceName_UnoControlProgressBar, szServiceName2_UnoControlProgressBar )
+ CHECKANDCREATEFACTORY( UnoControlProgressBarModel, szServiceName_UnoControlProgressBarModel, szServiceName2_UnoControlProgressBarModel )
+ CHECKANDCREATEFACTORY( UnoScrollBarControl, szServiceName_UnoControlScrollBar, szServiceName2_UnoControlScrollBar )
+ CHECKANDCREATEFACTORY( UnoControlScrollBarModel, szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel )
+ CHECKANDCREATEFACTORY( UnoFixedLineControl, szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine )
+ CHECKANDCREATEFACTORY( UnoControlFixedLineModel, szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel )
+ CHECKANDCREATEFACTORY( VCLXPrinterServer, szServiceName_PrinterServer, szServiceName2_PrinterServer )
+ CHECKANDCREATEFACTORY( UnoRoadmapControl, szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap )
+ CHECKANDCREATEFACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel )
+ CHECKANDCREATEFACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL )
+ CHECKANDCREATEFACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL )
+ CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL )
+ CHECKANDCREATEFACTORY( TreeControlModel, szServiceName_TreeControlModel, NULL )
+ CHECKANDCREATEFACTORY( MutableTreeDataModel, szServiceName_MutableTreeDataModel, NULL )
+ CHECKANDCREATEFACTORY( UnoSimpleAnimationControlModel, szServiceName_UnoSimpleAnimationControlModel, szServiceName2_UnoSimpleAnimationControlModel )
+ CHECKANDCREATEFACTORY( UnoSimpleAnimationControl, szServiceName_UnoSimpleAnimationControl, szServiceName2_UnoSimpleAnimationControl )
+ CHECKANDCREATEFACTORY( UnoThrobberControlModel, szServiceName_UnoThrobberControlModel, szServiceName2_UnoThrobberControlModel )
+ CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl )
+ CHECKANDCREATEFACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL )
+ CHECKANDCREATEFACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL )
+ CHECKANDCREATEFACTORY( GridControl, szServiceName_GridControl, NULL );
+ CHECKANDCREATEFACTORY( GridControlModel, szServiceName_GridControlModel, NULL );
+ CHECKANDCREATEFACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL );
+ CHECKANDCREATEFACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL );
+ CHECKANDCREATEFACTORY( GridColumn, szServiceName_GridColumn, NULL );
+
+
+ if ( rtl_str_compare( sImplementationName, "com.sun.star.awt.comp.AsyncCallback" ) == 0 )
+ return comp_AsyncCallback_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
+
+
+ if( pRet == 0 )
+ pRet = comp_Layout_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
+ }
+ return pRet;
+}
+}
+
+
+
diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx
new file mode 100644
index 000000000000..f57f52f13e57
--- /dev/null
+++ b/toolkit/source/helper/servicenames.cxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <sal/types.h>
+#include <tools/solar.h>
+
+#include <toolkit/helper/servicenames.hxx>
+
+const sal_Char __FAR_DATA szServiceName_Toolkit[] = "stardiv.vcl.VclToolkit", szServiceName2_Toolkit[] = "com.sun.star.awt.Toolkit";
+const sal_Char __FAR_DATA szServiceName_PopupMenu[] = "stardiv.vcl.PopupMenu", szServiceName2_PopupMenu[] = "com.sun.star.awt.PopupMenu";
+const sal_Char __FAR_DATA szServiceName_MenuBar[] = "stardiv.vcl.MenuBar", szServiceName2_MenuBar[] = "com.sun.star.awt.MenuBar";
+const sal_Char __FAR_DATA szServiceName_Pointer[] = "stardiv.vcl.Pointer", szServiceName2_Pointer[] = "com.sun.star.awt.Pointer";
+const sal_Char __FAR_DATA szServiceName_UnoControlContainer[] = "stardiv.vcl.control.ControlContainer", szServiceName2_UnoControlContainer[] = "com.sun.star.awt.UnoControlContainer";
+const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[] = "stardiv.vcl.controlmodel.ControlContainer", szServiceName2_UnoControlContainerModel[] = "com.sun.star.awt.UnoControlContainerModel";
+const sal_Char __FAR_DATA szServiceName_TabController[] = "stardiv.vcl.control.TabController", szServiceName2_TabController[] = "com.sun.star.awt.TabController";
+const sal_Char __FAR_DATA szServiceName_TabControllerModel[] = "stardiv.vcl.controlmodel.TabController", szServiceName2_TabControllerModel[] = "com.sun.star.awt.TabControllerModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlDialog[] = "stardiv.vcl.control.Dialog", szServiceName2_UnoControlDialog[] = "com.sun.star.awt.UnoControlDialog";
+const sal_Char __FAR_DATA szServiceName_UnoControlDialogModel[] = "stardiv.vcl.controlmodel.Dialog", szServiceName2_UnoControlDialogModel[] = "com.sun.star.awt.UnoControlDialogModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlEdit[] = "stardiv.vcl.control.Edit", szServiceName2_UnoControlEdit[] = "com.sun.star.awt.UnoControlEdit";
+const sal_Char __FAR_DATA szServiceName_UnoControlEditModel[] = "stardiv.vcl.controlmodel.Edit", szServiceName2_UnoControlEditModel[] = "com.sun.star.awt.UnoControlEditModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlFileControl[] = "stardiv.vcl.control.FileControl", szServiceName2_UnoControlFileControl[] = "com.sun.star.awt.UnoControlFileControl";
+const sal_Char __FAR_DATA szServiceName_UnoControlFileControlModel[] = "stardiv.vcl.controlmodel.FileControl", szServiceName2_UnoControlFileControlModel[] = "com.sun.star.awt.UnoControlFileControlModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlButton[] = "stardiv.vcl.control.Button", szServiceName2_UnoControlButton[] = "com.sun.star.awt.UnoControlButton";
+const sal_Char __FAR_DATA szServiceName_UnoControlButtonModel[] = "stardiv.vcl.controlmodel.Button", szServiceName2_UnoControlButtonModel[] = "com.sun.star.awt.UnoControlButtonModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlImageButton[] = "stardiv.vcl.control.ImageButton", szServiceName2_UnoControlImageButton[] = "com.sun.star.awt.UnoControlImageButton";
+const sal_Char __FAR_DATA szServiceName_UnoControlImageButtonModel[] = "stardiv.vcl.controlmodel.ImageButton", szServiceName2_UnoControlImageButtonModel[] = "com.sun.star.awt.UnoControlImageButtonModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlImageControl[] = "stardiv.vcl.control.ImageControl", szServiceName2_UnoControlImageControl[] = "com.sun.star.awt.UnoControlImageControl";
+const sal_Char __FAR_DATA szServiceName_UnoControlImageControlModel[] = "stardiv.vcl.controlmodel.ImageControl", szServiceName2_UnoControlImageControlModel[] = "com.sun.star.awt.UnoControlImageControlModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlRadioButton[] = "stardiv.vcl.control.RadioButton", szServiceName2_UnoControlRadioButton[] = "com.sun.star.awt.UnoControlRadioButton";
+const sal_Char __FAR_DATA szServiceName_UnoControlRadioButtonModel[] = "stardiv.vcl.controlmodel.RadioButton", szServiceName2_UnoControlRadioButtonModel[] = "com.sun.star.awt.UnoControlRadioButtonModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlCheckBox[] = "stardiv.vcl.control.CheckBox", szServiceName2_UnoControlCheckBox[] = "com.sun.star.awt.UnoControlCheckBox";
+const sal_Char __FAR_DATA szServiceName_UnoControlCheckBoxModel[] = "stardiv.vcl.controlmodel.CheckBox", szServiceName2_UnoControlCheckBoxModel[] = "com.sun.star.awt.UnoControlCheckBoxModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlListBox[] = "stardiv.vcl.control.ListBox", szServiceName2_UnoControlListBox[] = "com.sun.star.awt.UnoControlListBox";
+const sal_Char __FAR_DATA szServiceName_UnoControlListBoxModel[] = "stardiv.vcl.controlmodel.ListBox", szServiceName2_UnoControlListBoxModel[] = "com.sun.star.awt.UnoControlListBoxModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlComboBox[] = "stardiv.vcl.control.ComboBox", szServiceName2_UnoControlComboBox[] = "com.sun.star.awt.UnoControlComboBox";
+const sal_Char __FAR_DATA szServiceName_UnoControlComboBoxModel[] = "stardiv.vcl.controlmodel.ComboBox", szServiceName2_UnoControlComboBoxModel[] = "com.sun.star.awt.UnoControlComboBoxModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedText[] = "stardiv.vcl.control.FixedText", szServiceName2_UnoControlFixedText[] = "com.sun.star.awt.UnoControlFixedText";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedTextModel[] = "stardiv.vcl.controlmodel.FixedText", szServiceName2_UnoControlFixedTextModel[] = "com.sun.star.awt.UnoControlFixedTextModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlGroupBox[] = "stardiv.vcl.control.GroupBox", szServiceName2_UnoControlGroupBox[] = "com.sun.star.awt.UnoControlGroupBox";
+const sal_Char __FAR_DATA szServiceName_UnoControlGroupBoxModel[] = "stardiv.vcl.controlmodel.GroupBox", szServiceName2_UnoControlGroupBoxModel[] = "com.sun.star.awt.UnoControlGroupBoxModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlDateField[] = "stardiv.vcl.control.DateField", szServiceName2_UnoControlDateField[] = "com.sun.star.awt.UnoControlDateField";
+const sal_Char __FAR_DATA szServiceName_UnoControlDateFieldModel[] = "stardiv.vcl.controlmodel.DateField", szServiceName2_UnoControlDateFieldModel[] = "com.sun.star.awt.UnoControlDateFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlTimeField[] = "stardiv.vcl.control.TimeField", szServiceName2_UnoControlTimeField[] = "com.sun.star.awt.UnoControlTimeField";
+const sal_Char __FAR_DATA szServiceName_UnoControlTimeFieldModel[] = "stardiv.vcl.controlmodel.TimeField", szServiceName2_UnoControlTimeFieldModel[] = "com.sun.star.awt.UnoControlTimeFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlNumericField[] = "stardiv.vcl.control.NumericField", szServiceName2_UnoControlNumericField[] = "com.sun.star.awt.UnoControlNumericField";
+const sal_Char __FAR_DATA szServiceName_UnoControlNumericFieldModel[] = "stardiv.vcl.controlmodel.NumericField", szServiceName2_UnoControlNumericFieldModel[] = "com.sun.star.awt.UnoControlNumericFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyField[] = "stardiv.vcl.control.CurrencyField", szServiceName2_UnoControlCurrencyField[] = "com.sun.star.awt.UnoControlCurrencyField";
+const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyFieldModel[] = "stardiv.vcl.controlmodel.CurrencyField", szServiceName2_UnoControlCurrencyFieldModel[] = "com.sun.star.awt.UnoControlCurrencyFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlPatternField[] = "stardiv.vcl.control.PatternField", szServiceName2_UnoControlPatternField[] = "com.sun.star.awt.UnoControlPatternField";
+const sal_Char __FAR_DATA szServiceName_UnoControlPatternFieldModel[] = "stardiv.vcl.controlmodel.PatternField", szServiceName2_UnoControlPatternFieldModel[] = "com.sun.star.awt.UnoControlPatternFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlFormattedField[] = "stardiv.vcl.control.FormattedField", szServiceName2_UnoControlFormattedField[] = "com.sun.star.awt.UnoControlFormattedField";
+const sal_Char __FAR_DATA szServiceName_UnoControlFormattedFieldModel[] = "stardiv.vcl.controlmodel.FormattedField", szServiceName2_UnoControlFormattedFieldModel[] = "com.sun.star.awt.UnoControlFormattedFieldModel";
+const sal_Char __FAR_DATA szServiceName_MVCIntrospection[] = "stardiv.vcl.MVCIntrospection", szServiceName2_MVCIntrospection[] = "com.sun.star.awt.MVCIntrospection";
+const sal_Char __FAR_DATA szServiceName_PrinterServer[] = "stardiv.vcl.PrinterServer", szServiceName2_PrinterServer[] = "com.sun.star.awt.PrinterServer";
+const sal_Char __FAR_DATA szServiceName_UnoControlProgressBar[] = "stardiv.vcl.control.ProgressBar", szServiceName2_UnoControlProgressBar[] = "com.sun.star.awt.UnoControlProgressBar";
+const sal_Char __FAR_DATA szServiceName_UnoControlProgressBarModel[] = "stardiv.vcl.controlmodel.ProgressBar", szServiceName2_UnoControlProgressBarModel[] = "com.sun.star.awt.UnoControlProgressBarModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlScrollBar[] = "stardiv.vcl.control.ScrollBar", szServiceName2_UnoControlScrollBar[] = "com.sun.star.awt.UnoControlScrollBar";
+const sal_Char __FAR_DATA szServiceName_UnoControlScrollBarModel[] = "stardiv.vcl.controlmodel.ScrollBar", szServiceName2_UnoControlScrollBarModel[] = "com.sun.star.awt.UnoControlScrollBarModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedLine[] = "stardiv.vcl.control.FixedLine", szServiceName2_UnoControlFixedLine[] = "com.sun.star.awt.UnoControlFixedLine";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedLineModel[] = "stardiv.vcl.controlmodel.FixedLine", szServiceName2_UnoControlFixedLineModel[] = "com.sun.star.awt.UnoControlFixedLineModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlRoadmap[] = "stardiv.vcl.control.Roadmap", szServiceName2_UnoControlRoadmap[] = "com.sun.star.awt.UnoControlRoadmap";
+const sal_Char __FAR_DATA szServiceName_UnoControlRoadmapModel[] = "stardiv.vcl.controlmodel.Roadmap", szServiceName2_UnoControlRoadmapModel[] = "com.sun.star.awt.UnoControlRoadmapModel";
+const sal_Char __FAR_DATA szServiceName_UnoSpinButtonControl[] = "com.sun.star.awt.UnoControlSpinButton";
+const sal_Char __FAR_DATA szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt.UnoControlSpinButtonModel";
+const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl";
+const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel";
+const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel";
+const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoSimpleAnimationControlModel", szServiceName2_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoControlSimpleAnimationModel";
+const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoSimpleAnimationControl", szServiceName2_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoControlSimpleAnimation";
+const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[] = "com.sun.star.awt.UnoThrobberControlModel", szServiceName2_UnoThrobberControlModel[] = "com.sun.star.awt.UnoControlThrobberModel";
+const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl", szServiceName2_UnoThrobberControl[] = "com.sun.star.awt.UnoControlThrobber";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[] = "com.sun.star.awt.UnoControlFixedHyperlink";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlinkModel[] = "com.sun.star.awt.UnoControlFixedHyperlinkModel";
+const sal_Char __FAR_DATA szServiceName_GridControl[] = "com.sun.star.awt.grid.UnoControlGrid";
+const sal_Char __FAR_DATA szServiceName_GridControlModel[] = "com.sun.star.awt.grid.UnoControlGridModel";
+const sal_Char __FAR_DATA szServiceName_DefaultGridDataModel[] = "com.sun.star.awt.grid.DefaultGridDataModel";
+const sal_Char __FAR_DATA szServiceName_DefaultGridColumnModel[] = "com.sun.star.awt.grid.DefaultGridColumnModel";
+const sal_Char __FAR_DATA szServiceName_GridColumn[] = "com.sun.star.awt.grid.GridColumn";
diff --git a/toolkit/source/helper/throbberimpl.cxx b/toolkit/source/helper/throbberimpl.cxx
new file mode 100644
index 000000000000..7a8e260ab4b8
--- /dev/null
+++ b/toolkit/source/helper/throbberimpl.cxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "precompiled_toolkit.hxx"
+#include <toolkit/helper/throbberimpl.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/fixed.hxx>
+
+//........................................................................
+namespace toolkit
+//........................................................................
+{
+ using namespace ::com::sun::star;
+
+ //--------------------------------------------------------------------
+ Throbber_Impl::Throbber_Impl( uno::Reference< VCLXWindow > xParent,
+ sal_Int32 nStepTime,
+ sal_Bool bRepeat )
+ :mrMutex( Application::GetSolarMutex() )
+ {
+ mxParent = xParent;
+ mbRepeat = bRepeat;
+ mnStepTime = nStepTime;
+ maWaitTimer.SetTimeout( mnStepTime );
+ maWaitTimer.SetTimeoutHdl( LINK( this, Throbber_Impl, TimeOutHdl ) );
+ }
+
+ //--------------------------------------------------------------------
+ Throbber_Impl::~Throbber_Impl()
+ {
+ maWaitTimer.Stop();
+ mxParent = NULL;
+ }
+
+ //--------------------------------------------------------------------
+ void Throbber_Impl::start() throw ( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ mnCurStep = 0;
+ maWaitTimer.Start();
+ }
+
+ //--------------------------------------------------------------------
+ void Throbber_Impl::stop() throw ( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maWaitTimer.Stop();
+ }
+
+ //--------------------------------------------------------------------
+ void Throbber_Impl::setImageList( const uno::Sequence< uno::Reference< graphic::XGraphic > >& rImageList )
+ throw ( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageList = rImageList;
+
+ mnStepCount = maImageList.getLength();
+ FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() );
+ if ( pImage )
+ {
+ if ( mnStepCount )
+ pImage->SetImage( maImageList[ 0 ] );
+ else
+ pImage->SetImage( Image() );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void Throbber_Impl::initImage()
+ throw ( uno::RuntimeException )
+ {
+ FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() );
+ if ( pImage && maImageList.getLength() )
+ pImage->SetImage( maImageList[ 0 ] );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool Throbber_Impl::isHCMode()
+ throw ( uno::RuntimeException )
+ {
+ FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() );
+ if ( pImage )
+ return pImage->GetSettings().GetStyleSettings().GetHighContrastMode();
+ else
+ return Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+ }
+
+ // -----------------------------------------------------------------------
+ IMPL_LINK( Throbber_Impl, TimeOutHdl, Throbber_Impl*, EMPTYARG )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() );
+
+ if ( !pImage || !maImageList.getLength() )
+ return 0;
+
+ if ( mnCurStep < mnStepCount - 1 )
+ mnCurStep += 1;
+ else
+ mnCurStep = 0;
+
+ pImage->SetImage( maImageList[ mnCurStep ] );
+
+ return 0;
+ }
+
+//........................................................................
+} // namespacetoolkit
+//........................................................................
+
diff --git a/toolkit/source/helper/tkresmgr.cxx b/toolkit/source/helper/tkresmgr.cxx
new file mode 100644
index 000000000000..4e1e4153daf1
--- /dev/null
+++ b/toolkit/source/helper/tkresmgr.cxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <toolkit/helper/tkresmgr.hxx>
+#include <tools/simplerm.hxx>
+#ifndef _TOOLS_RESMGR_HXX_
+#include <tools/resmgr.hxx>
+#endif
+
+
+#include <vcl/svapp.hxx>
+
+
+// -----------------------------------------------------------------------------
+// TkResMgr
+// -----------------------------------------------------------------------------
+
+SimpleResMgr* TkResMgr::m_pSimpleResMgr = NULL;
+ResMgr* TkResMgr::m_pResMgr = NULL;
+
+// -----------------------------------------------------------------------------
+
+TkResMgr::EnsureDelete::~EnsureDelete()
+{
+ delete TkResMgr::m_pSimpleResMgr;
+// delete TkResMgr::m_pResMgr;
+}
+
+// -----------------------------------------------------------------------------
+
+void TkResMgr::ensureImplExists()
+{
+ if (m_pSimpleResMgr)
+ return;
+
+ ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
+
+ ByteString sResMgrName( "tk" );
+
+ m_pSimpleResMgr = SimpleResMgr::Create( sResMgrName.GetBuffer(), aLocale );
+ m_pResMgr = ResMgr::CreateResMgr( sResMgrName.GetBuffer() );
+
+ if (m_pSimpleResMgr)
+ {
+ // now that we have a impl class, make sure it's deleted on unloading the library
+ static TkResMgr::EnsureDelete s_aDeleteTheImplClass;
+ }
+}
+
+// -----------------------------------------------------------------------------
+::rtl::OUString TkResMgr::loadString( sal_uInt16 nResId )
+{
+ ::rtl::OUString sReturn;
+
+ ensureImplExists();
+ if ( m_pSimpleResMgr )
+ sReturn = m_pSimpleResMgr->ReadString( nResId );
+
+ return sReturn;
+}
+
+// -----------------------------------------------------------------------------
+Image TkResMgr::loadImage( sal_uInt16 nResId )
+{
+ Image aReturn;
+
+ ensureImplExists();
+ if ( m_pResMgr )
+ aReturn = Image( ResId( nResId, *m_pResMgr ) );
+
+ return aReturn;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/toolkit/source/helper/unomemorystream.cxx b/toolkit/source/helper/unomemorystream.cxx
new file mode 100644
index 000000000000..b07cee100406
--- /dev/null
+++ b/toolkit/source/helper/unomemorystream.cxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+
+#include <toolkit/helper/unomemorystream.hxx>
+#include <algorithm>
+
+// ----------------------------------------------------
+// class UnoMemoryStream
+// ----------------------------------------------------
+UnoMemoryStream::UnoMemoryStream( sal_uInt32 nInitSize, sal_uInt32 nInitResize )
+ : SvMemoryStream( nInitSize, nInitResize )
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoMemoryStream::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::io::XInputStream*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+
+// ::com::sun::star::io::XInputStream
+sal_Int32 UnoMemoryStream::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nRead = available();
+ if ( nRead > nBytesToRead )
+ nRead = nBytesToRead;
+
+ rData = ::com::sun::star::uno::Sequence< sal_Int8 >( nRead );
+ Read( rData.getArray(), nRead );
+
+ return nRead;
+}
+
+sal_Int32 UnoMemoryStream::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nAvailable = available();
+ if( nAvailable )
+ {
+ return readBytes( rData, std::min( nMaxBytesToRead , nAvailable ) );
+ }
+ else
+ {
+ // Not the most effective method, but it sticks to the specification
+ return readBytes( rData, 1 );
+ }
+}
+
+void UnoMemoryStream::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ SeekRel( nBytesToSkip );
+}
+
+sal_Int32 UnoMemoryStream::available() throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nStreamPos = Tell();
+ sal_uInt32 nEnd = Seek( STREAM_SEEK_TO_END );
+ Seek( nStreamPos );
+ return nEnd - nStreamPos;
+}
+
+void UnoMemoryStream::closeInput() throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ // nothing to do
+}
+
+
+
+
+
diff --git a/toolkit/source/helper/unopropertyarrayhelper.cxx b/toolkit/source/helper/unopropertyarrayhelper.cxx
new file mode 100644
index 000000000000..da946ffdc08a
--- /dev/null
+++ b/toolkit/source/helper/unopropertyarrayhelper.cxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/property.hxx>
+
+// ----------------------------------------------------
+// class UnoPropertyArrayHelper
+// ----------------------------------------------------
+
+UnoPropertyArrayHelper::UnoPropertyArrayHelper( const ::com::sun::star::uno::Sequence<sal_Int32>& rIDs )
+{
+ sal_Int32 nIDs = rIDs.getLength();
+ const sal_Int32* pIDs = rIDs.getConstArray();
+ for ( sal_Int32 n = 0; n < nIDs; n++ )
+ maIDs.Insert( pIDs[n], (void*)1L );
+}
+
+UnoPropertyArrayHelper::UnoPropertyArrayHelper( const std::list< sal_uInt16 > &rIDs )
+{
+ std::list< sal_uInt16 >::const_iterator iter;
+ for( iter = rIDs.begin(); iter != rIDs.end(); iter++)
+ maIDs.Insert( *iter, (void*)1L);
+}
+
+sal_Bool UnoPropertyArrayHelper::ImplHasProperty( sal_uInt16 nPropId ) const
+{
+ if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
+ nPropId = BASEPROPERTY_FONTDESCRIPTOR;
+
+ return maIDs.Get( nPropId ) ? sal_True : sal_False;
+}
+
+// ::cppu::IPropertyArrayHelper
+sal_Bool UnoPropertyArrayHelper::fillPropertyMembersByHandle( ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nPropId )
+{
+ sal_uInt16 id = sal::static_int_cast< sal_uInt16 >(nPropId);
+ sal_Bool bValid = ImplHasProperty( id );
+ if ( bValid )
+ {
+ if ( pPropName )
+ *pPropName = GetPropertyName( id );
+ if ( pAttributes )
+ *pAttributes = GetPropertyAttribs( id );
+ }
+ return bValid;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > UnoPropertyArrayHelper::getProperties()
+{
+ // Sortiert nach Namen...
+
+ Table aSortedPropsIds;
+ sal_uInt32 nProps = maIDs.Count();
+ for ( sal_uInt32 s = 0; s < nProps; s++ )
+ {
+ sal_uInt16 nId = sal::static_int_cast< sal_uInt16 >(
+ maIDs.GetObjectKey( s ));
+ aSortedPropsIds.Insert( 1+GetPropertyOrderNr( nId ), (void*)(sal_uInt32)nId );
+
+ if ( nId == BASEPROPERTY_FONTDESCRIPTOR )
+ {
+ // Einzelproperties...
+ for ( sal_uInt16 i = BASEPROPERTY_FONTDESCRIPTORPART_START; i <= BASEPROPERTY_FONTDESCRIPTORPART_END; i++ )
+ aSortedPropsIds.Insert( 1+GetPropertyOrderNr( i ), (void*)(sal_uInt32)i );
+ }
+ }
+
+ nProps = aSortedPropsIds.Count(); // koennen jetzt mehr sein
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> aProps( nProps );
+ ::com::sun::star::beans::Property* pProps = aProps.getArray();
+
+ for ( sal_uInt32 n = 0; n < nProps; n++ )
+ {
+ sal_uInt16 nId = (sal_uInt16)(sal_uIntPtr)aSortedPropsIds.GetObject( n );
+ pProps[n].Name = GetPropertyName( nId );
+ pProps[n].Handle = nId;
+ pProps[n].Type = *GetPropertyType( nId );
+ pProps[n].Attributes = GetPropertyAttribs( nId );
+ }
+
+ return aProps;
+}
+
+::com::sun::star::beans::Property UnoPropertyArrayHelper::getPropertyByName(const ::rtl::OUString& rPropertyName) throw (::com::sun::star::beans::UnknownPropertyException)
+{
+ ::com::sun::star::beans::Property aProp;
+ sal_uInt16 nId = GetPropertyId( rPropertyName );
+ if ( ImplHasProperty( nId ) )
+ {
+ aProp.Name = rPropertyName;
+ aProp.Handle = -1;
+ aProp.Type = *GetPropertyType( nId );
+ aProp.Attributes = GetPropertyAttribs( nId );
+ }
+
+ return aProp;
+}
+
+sal_Bool UnoPropertyArrayHelper::hasPropertyByName(const ::rtl::OUString& rPropertyName)
+{
+ return ImplHasProperty( GetPropertyId( rPropertyName ) );
+}
+
+sal_Int32 UnoPropertyArrayHelper::getHandleByName( const ::rtl::OUString & rPropertyName )
+{
+ sal_Int32 nId = (sal_Int32 ) GetPropertyId( rPropertyName );
+ return nId ? nId : (-1);
+}
+
+sal_Int32 UnoPropertyArrayHelper::fillHandles( sal_Int32* pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames )
+{
+ const ::rtl::OUString* pNames = rPropNames.getConstArray();
+ sal_Int32 nValues = rPropNames.getLength();
+ sal_Int32 nValidHandles = 0;
+
+ for ( sal_Int32 n = 0; n < nValues; n++ )
+ {
+ sal_uInt16 nPropId = GetPropertyId( pNames[n] );
+ if ( nPropId && ImplHasProperty( nPropId ) )
+ {
+ pHandles[n] = nPropId;
+ nValidHandles++;
+ }
+ else
+ {
+ pHandles[n] = -1;
+ }
+ }
+ return nValidHandles;
+}
+
+
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
new file mode 100644
index 000000000000..c36ae29d4531
--- /dev/null
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -0,0 +1,340 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <com/sun/star/awt/WindowEvent.hpp>
+#include <comphelper/processfactory.hxx>
+
+#include <toolkit/helper/unowrapper.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/awt/vclxwindows.hxx>
+#include <toolkit/awt/vclxcontainer.hxx>
+#include <toolkit/awt/vclxtopwindow.hxx>
+#include <toolkit/awt/vclxgraphics.hxx>
+
+#include "toolkit/dllapi.h"
+#include <vcl/svapp.hxx>
+#include <vcl/syswin.hxx>
+#include <vcl/menu.hxx>
+
+#include <tools/debug.hxx>
+
+using namespace ::com::sun::star;
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > CreateXWindow( Window* pWindow )
+{
+ switch ( pWindow->GetType() )
+ {
+ case WINDOW_IMAGERADIOBUTTON:
+ case WINDOW_IMAGEBUTTON:
+ case WINDOW_SPINBUTTON:
+ case WINDOW_MENUBUTTON:
+ case WINDOW_MOREBUTTON:
+ case WINDOW_PUSHBUTTON:
+ case WINDOW_HELPBUTTON:
+ case WINDOW_OKBUTTON:
+ case WINDOW_CANCELBUTTON: return new VCLXButton;
+ case WINDOW_CHECKBOX: return new VCLXCheckBox;
+ // --> OD 2009-06-29 #i95042#
+ // A Window of type <MetricBox> is inherited from type <ComboBox>.
+ // Thus, it does make more sense to return a <VCLXComboBox> instance
+ // instead of only a <VCLXWindow> instance, especially regarding its
+ // corresponding accessibility API.
+ case WINDOW_METRICBOX:
+ // <--
+ case WINDOW_COMBOBOX: return new VCLXComboBox;
+ case WINDOW_SPINFIELD:
+ case WINDOW_NUMERICFIELD:
+ case WINDOW_CURRENCYFIELD: return new VCLXNumericField;
+ case WINDOW_DATEFIELD: return new VCLXDateField;
+ case WINDOW_MULTILINEEDIT:
+ case WINDOW_EDIT: return new VCLXEdit;
+ case WINDOW_METRICFIELD: return new VCLXSpinField;
+ case WINDOW_MESSBOX:
+ case WINDOW_INFOBOX:
+ case WINDOW_WARNINGBOX:
+ case WINDOW_QUERYBOX:
+ case WINDOW_ERRORBOX: return new VCLXMessageBox;
+ case WINDOW_FIXEDIMAGE: return new VCLXImageControl;
+ case WINDOW_FIXEDTEXT: return new VCLXFixedText;
+ case WINDOW_MULTILISTBOX:
+ case WINDOW_LISTBOX: return new VCLXListBox;
+ case WINDOW_LONGCURRENCYFIELD: return new VCLXCurrencyField;
+ case WINDOW_DIALOG:
+ case WINDOW_MODALDIALOG:
+ case WINDOW_TABDIALOG:
+ case WINDOW_BUTTONDIALOG:
+ case WINDOW_MODELESSDIALOG: return new VCLXDialog;
+ case WINDOW_PATTERNFIELD: return new VCLXPatternField;
+ case WINDOW_RADIOBUTTON: return new VCLXRadioButton;
+ case WINDOW_SCROLLBAR: return new VCLXScrollBar;
+ case WINDOW_TIMEFIELD: return new VCLXTimeField;
+
+ case WINDOW_SYSWINDOW:
+ case WINDOW_WORKWINDOW:
+ case WINDOW_DOCKINGWINDOW:
+ case WINDOW_FLOATINGWINDOW:
+ case WINDOW_HELPTEXTWINDOW: return new VCLXTopWindow;
+
+ case WINDOW_WINDOW:
+ case WINDOW_TABPAGE: return new VCLXContainer;
+
+ case WINDOW_TOOLBOX: return new VCLXToolBox;
+
+ // case WINDOW_FIXEDLINE:
+ // case WINDOW_FIXEDBITMAP:
+ // case WINDOW_DATEBOX:
+ // case WINDOW_GROUPBOX:
+ // case WINDOW_LONGCURRENCYBOX:
+ // case WINDOW_SPLITTER:
+ // case WINDOW_STATUSBAR:
+ // case WINDOW_TABCONTROL:
+ // case WINDOW_NUMERICBOX:
+ // case WINDOW_TRISTATEBOX:
+ // case WINDOW_TIMEBOX:
+ // case WINDOW_SPLITWINDOW:
+ // case WINDOW_SCROLLBARBOX:
+ // case WINDOW_PATTERNBOX:
+ // case WINDOW_CURRENCYBOX:
+ default: return new VCLXWindow( true );
+ }
+}
+
+// ----------------------------------------------------
+// class UnoWrapper
+// ----------------------------------------------------
+
+extern "C" {
+
+TOOLKIT_DLLPUBLIC UnoWrapperBase* CreateUnoWrapper()
+{
+ return new UnoWrapper( NULL );
+}
+
+} // extern "C"
+
+
+UnoWrapper::UnoWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>& rxToolkit )
+{
+ mxToolkit = rxToolkit;
+}
+
+void UnoWrapper::Destroy()
+{
+ delete this;
+}
+
+UnoWrapper::~UnoWrapper()
+{
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> UnoWrapper::GetVCLToolkit()
+{
+ if ( !mxToolkit.is() )
+ mxToolkit = VCLUnoHelper::CreateToolkit();
+ return mxToolkit.get();
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> UnoWrapper::GetWindowInterface( Window* pWindow, BOOL bCreate )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
+ if ( !xPeer.is() && bCreate )
+ {
+ xPeer = CreateXWindow( pWindow );
+ SetWindowInterface( pWindow, xPeer );
+ }
+ return xPeer;
+}
+
+void UnoWrapper::SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xIFace )
+{
+ VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( xIFace );
+
+ DBG_ASSERT( pVCLXWindow, "SetComponentInterface - unsupported type" );
+ if ( pVCLXWindow )
+ {
+ if( pWindow->GetWindowPeer() )
+ {
+ int i = 0;
+ i++;
+ // DBG_ERROR( "UnoWrapper::SetWindowInterface: there already *is* a WindowInterface for this window!" );
+ }
+ pVCLXWindow->SetWindow( pWindow );
+ pWindow->SetWindowPeer( xIFace, pVCLXWindow );
+ }
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> UnoWrapper::CreateGraphics( OutputDevice* pOutDev )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> xGrf;
+ VCLXGraphics* pGrf = new VCLXGraphics;
+ xGrf = pGrf;
+ pGrf->Init( pOutDev );
+ return xGrf;
+}
+
+void UnoWrapper::ReleaseAllGraphics( OutputDevice* pOutDev )
+{
+ List* pLst = pOutDev->GetUnoGraphicsList();
+ if ( pLst )
+ {
+ for ( sal_uInt32 n = 0; n < pLst->Count(); n++ )
+ {
+ VCLXGraphics* pGrf = (VCLXGraphics*)pLst->GetObject( n );
+ pGrf->SetOutputDevice( NULL );
+ }
+ }
+
+}
+
+// MT: Wurde im Window-CTOR gerufen, damit Container-Listener
+// vom Parent reagieren, aber hat sowieso nicht richtig funktioniert,
+// weil im Window-CTOR das Interface noch nicht da ist!
+// => Nur Listener rufen, wenn ueber das ::com::sun::star::awt::Toolkit erzeugt
+
+/*
+void ImplSmartWindowCreated( Window* pNewWindow )
+{
+ UNOWindowData* pParentUNOData = pNewWindow->GetParent() ?
+ pNewWindow->GetParent()->GetUNOData() : NULL;
+
+ if ( pParentUNOData && pParentUNOData->GetListeners( EL_CONTAINER ) )
+ {
+ UNOWindowData* pUNOData = pNewWindow->GetUNOData();
+ if ( !pUNOData )
+ pUNOData = ImplSmartCreateUNOData( pNewWindow );
+
+ ::com::sun::star::awt::VclContainerEvent aEvent;
+ aEvent.Source = (UsrObject*)pParentUNOData->GetWindowPeer();
+ aEvent.Id = VCLCOMPONENT_ADDED;
+ aEvent.Child = (UsrObject*)pUNOData->GetWindowPeer();
+
+ EventList* pLst = pParentUNOData->GetListeners( EL_CONTAINER );
+ for ( sal_uInt32 n = 0; n < pLst->Count(); n++ )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > * pRef = pLst->GetObject( n );
+ ((::com::sun::star::awt::XVclContainerListener*)(::com::sun::star::lang::XEventListener*)*pRef)->windowAdded( aEvent );
+ }
+ }
+}
+*/
+
+sal_Bool lcl_ImplIsParent( Window* pParentWindow, Window* pPossibleChild )
+{
+ Window* pWindow = ( pPossibleChild != pParentWindow ) ? pPossibleChild : NULL;
+ while ( pWindow && ( pWindow != pParentWindow ) )
+ pWindow = pWindow->GetParent();
+
+ return pWindow ? sal_True : sal_False;
+}
+
+void UnoWrapper::WindowDestroyed( Window* pWindow )
+{
+ // ggf. existieren noch von ::com::sun::star::loader::Java erzeugte Childs, die sonst erst
+ // im Garbage-Collector zerstoert werden...
+ Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ while ( pChild )
+ {
+ Window* pNextChild = pChild->GetWindow( WINDOW_NEXT );
+
+ Window* pClient = pChild->GetWindow( WINDOW_CLIENT );
+ if ( pClient->GetWindowPeer() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( FALSE ), ::com::sun::star::uno::UNO_QUERY );
+ xComp->dispose();
+ }
+
+ pChild = pNextChild;
+ }
+
+ // ::com::sun::star::chaos::System-Windows suchen...
+ Window* pOverlap = pWindow->GetWindow( WINDOW_OVERLAP );
+ pOverlap = pOverlap->GetWindow( WINDOW_FIRSTOVERLAP );
+ while ( pOverlap )
+ {
+ Window* pNextOverlap = pOverlap->GetWindow( WINDOW_NEXT );
+ Window* pClient = pOverlap->GetWindow( WINDOW_CLIENT );
+
+ if ( pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( FALSE ), ::com::sun::star::uno::UNO_QUERY );
+ xComp->dispose();
+ }
+
+ pOverlap = pNextOverlap;
+ }
+
+ Window* pParent = pWindow->GetParent();
+ if ( pParent && pParent->GetWindowPeer() )
+ pParent->GetWindowPeer()->notifyWindowRemoved( *pWindow );
+
+ VCLXWindow* pWindowPeer = pWindow->GetWindowPeer();
+ uno::Reference< lang::XComponent > xWindowPeerComp( pWindow->GetComponentInterface( FALSE ), uno::UNO_QUERY );
+ OSL_ENSURE( ( pWindowPeer != NULL ) == ( xWindowPeerComp.is() == sal_True ),
+ "UnoWrapper::WindowDestroyed: inconsistency in the window's peers!" );
+ if ( pWindowPeer )
+ {
+ pWindowPeer->SetWindow( NULL );
+ pWindow->SetWindowPeer( NULL, NULL );
+ }
+ if ( xWindowPeerComp.is() )
+ xWindowPeerComp->dispose();
+
+ // #102132# Iterate over frames after setting Window peer to NULL,
+ // because while destroying other frames, we get get into the method again and try
+ // to destroy this window again...
+ // #i42462#/#116855# no, don't loop: Instead, just ensure that all our top-window-children
+ // are disposed, too (which should also be a valid fix for #102132#, but doesn't have the extreme
+ // performance penalties)
+ if ( pWindow )
+ {
+ Window* pTopWindowChild = pWindow->GetWindow( WINDOW_FIRSTTOPWINDOWCHILD );
+ while ( pTopWindowChild )
+ {
+ OSL_ENSURE( pTopWindowChild->GetParent() == pWindow,
+ "UnoWrapper::WindowDestroyed: inconsistency in the SystemWindow relationship!" );
+
+ Window* pNextTopChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING );
+
+ //the window still could be on the stack, so we have to
+ // use lazy delete ( it will automatically
+ // disconnect from the currently destroyed parent window )
+ pTopWindowChild->doLazyDelete();
+
+ pTopWindowChild = pNextTopChild;
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > UnoWrapper::CreateAccessible( Menu* pMenu, sal_Bool bIsMenuBar )
+{
+ return maAccessibleFactoryAccess.getFactory().createAccessible( pMenu, bIsMenuBar );
+}
diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx
new file mode 100644
index 000000000000..da91945c0b0e
--- /dev/null
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -0,0 +1,799 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/window.hxx>
+#include <com/sun/star/util/MeasureUnit.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/awt/XPointer.hpp>
+#include <com/sun/star/awt/SimpleFontMetric.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontWidth.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/awt/MouseButton.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/embed/EmbedMapUnits.hpp>
+
+#include <com/sun/star/graphic/XGraphic.hpp>
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <toolkit/awt/vclxbitmap.hxx>
+#include <toolkit/awt/vclxregion.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/awt/vclxgraphics.hxx>
+#include <toolkit/awt/vclxpointer.hxx>
+#include <toolkit/awt/vclxfont.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <toolkit/controls/unocontrolcontainermodel.hxx>
+
+#include <vcl/graph.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/Point.hpp>
+
+using namespace ::com::sun::star;
+
+// ----------------------------------------------------
+// class VCLUnoHelper
+// ----------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> VCLUnoHelper::CreateToolkit()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> xToolkit;
+ if ( xI.is() )
+ xToolkit = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>( xI, ::com::sun::star::uno::UNO_QUERY );
+
+ return xToolkit;
+}
+
+BitmapEx VCLUnoHelper::GetBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>& rxBitmap )
+{
+ BitmapEx aBmp;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > xGraphic( rxBitmap, ::com::sun::star::uno::UNO_QUERY );
+ if( xGraphic.is() )
+ {
+ Graphic aGraphic( xGraphic );
+ aBmp = aGraphic.GetBitmapEx();
+ }
+ else if ( rxBitmap.is() )
+ {
+ VCLXBitmap* pVCLBitmap = VCLXBitmap::GetImplementation( rxBitmap );
+ if ( pVCLBitmap )
+ aBmp = pVCLBitmap->GetBitmap();
+ else
+ {
+ Bitmap aDIB, aMask;
+ {
+ ::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getDIB();
+ SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ );
+ aMem >> aDIB;
+ }
+ {
+ ::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getMaskDIB();
+ SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ );
+ aMem >> aMask;
+ }
+ aBmp = BitmapEx( aDIB, aMask );
+ }
+ }
+ return aBmp;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> VCLUnoHelper::CreateBitmap( const BitmapEx& rBitmap )
+{
+ Graphic aGraphic( rBitmap );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> xBmp( aGraphic.GetXGraphic(), ::com::sun::star::uno::UNO_QUERY );
+ return xBmp;
+}
+
+Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow )
+{
+ VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+}
+
+Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow )
+{
+ VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+}
+
+Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindow )
+{
+ VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+}
+
+Region VCLUnoHelper::GetRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion )
+{
+ Region aRegion;
+ VCLXRegion* pVCLRegion = VCLXRegion::GetImplementation( rxRegion );
+ if ( pVCLRegion )
+ aRegion = pVCLRegion->GetRegion();
+ else
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > aRects = rxRegion->getRectangles();
+ sal_Int32 nRects = aRects.getLength();
+ for ( sal_Int32 n = 0; n < nRects; n++ )
+ aRegion.Union( VCLRectangle( aRects.getArray()[n] ) );
+ }
+ return aRegion;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> VCLUnoHelper::GetInterface( Window* pWindow )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWin;
+ if ( pWindow )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetComponentInterface();
+ xWin = xWin.query( xPeer );
+ }
+ return xWin;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> VCLUnoHelper::CreatePointer()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> xPointer = new VCLXPointer;
+ return xPointer;
+}
+
+OutputDevice* VCLUnoHelper::GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice>& rxDevice )
+{
+ OutputDevice* pOutDev = NULL;
+ VCLXDevice* pDev = VCLXDevice::GetImplementation( rxDevice );
+ if ( pDev )
+ pOutDev = pDev->GetOutputDevice();
+ return pOutDev;
+}
+
+OutputDevice* VCLUnoHelper::GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>& rxGraphics )
+{
+ OutputDevice* pOutDev = NULL;
+ VCLXGraphics* pGrf = VCLXGraphics::GetImplementation( rxGraphics );
+ if ( pGrf )
+ pOutDev = pGrf->GetOutputDevice();
+ return pOutDev;
+}
+
+Polygon VCLUnoHelper::CreatePolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY )
+{
+ sal_uInt32 nLen = DataX.getLength();
+ const sal_Int32* pDataX = DataX.getConstArray();
+ const sal_Int32* pDataY = DataY.getConstArray();
+ Polygon aPoly( (sal_uInt16) nLen );
+ for ( sal_uInt16 n = 0; n < nLen; n++ )
+ {
+ Point aPnt;
+ aPnt.X() = pDataX[n];
+ aPnt.Y() = pDataY[n];
+ aPoly[n] = aPnt;
+ }
+ return aPoly;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> VCLUnoHelper::CreateControlContainer( Window* pWindow )
+{
+ UnoControlContainer* pContainer = new UnoControlContainer( pWindow->GetComponentInterface( sal_True ) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > x = pContainer;
+
+ UnoControlModel* pContainerModel = new UnoControlContainerModel;
+ pContainer->setModel( (::com::sun::star::awt::XControlModel*)pContainerModel );
+
+ return x;
+}
+
+float VCLUnoHelper::ConvertFontWidth( FontWidth eWidth )
+{
+ if( eWidth == WIDTH_DONTKNOW )
+ return ::com::sun::star::awt::FontWidth::DONTKNOW;
+ else if( eWidth == WIDTH_ULTRA_CONDENSED )
+ return ::com::sun::star::awt::FontWidth::ULTRACONDENSED;
+ else if( eWidth == WIDTH_EXTRA_CONDENSED )
+ return ::com::sun::star::awt::FontWidth::EXTRACONDENSED;
+ else if( eWidth == WIDTH_CONDENSED )
+ return ::com::sun::star::awt::FontWidth::CONDENSED;
+ else if( eWidth == WIDTH_SEMI_CONDENSED )
+ return ::com::sun::star::awt::FontWidth::SEMICONDENSED;
+ else if( eWidth == WIDTH_NORMAL )
+ return ::com::sun::star::awt::FontWidth::NORMAL;
+ else if( eWidth == WIDTH_SEMI_EXPANDED )
+ return ::com::sun::star::awt::FontWidth::SEMIEXPANDED;
+ else if( eWidth == WIDTH_EXPANDED )
+ return ::com::sun::star::awt::FontWidth::EXPANDED;
+ else if( eWidth == WIDTH_EXTRA_EXPANDED )
+ return ::com::sun::star::awt::FontWidth::EXTRAEXPANDED;
+ else if( eWidth == WIDTH_ULTRA_EXPANDED )
+ return ::com::sun::star::awt::FontWidth::ULTRAEXPANDED;
+
+ DBG_ERROR( "Unknown FontWidth" );
+ return ::com::sun::star::awt::FontWidth::DONTKNOW;
+}
+
+FontWidth VCLUnoHelper::ConvertFontWidth( float f )
+{
+ if( f <= ::com::sun::star::awt::FontWidth::DONTKNOW )
+ return WIDTH_DONTKNOW;
+ else if( f <= ::com::sun::star::awt::FontWidth::ULTRACONDENSED )
+ return WIDTH_ULTRA_CONDENSED;
+ else if( f <= ::com::sun::star::awt::FontWidth::EXTRACONDENSED )
+ return WIDTH_EXTRA_CONDENSED;
+ else if( f <= ::com::sun::star::awt::FontWidth::CONDENSED )
+ return WIDTH_CONDENSED;
+ else if( f <= ::com::sun::star::awt::FontWidth::SEMICONDENSED )
+ return WIDTH_SEMI_CONDENSED;
+ else if( f <= ::com::sun::star::awt::FontWidth::NORMAL )
+ return WIDTH_NORMAL;
+ else if( f <= ::com::sun::star::awt::FontWidth::SEMIEXPANDED )
+ return WIDTH_SEMI_EXPANDED;
+ else if( f <= ::com::sun::star::awt::FontWidth::EXPANDED )
+ return WIDTH_EXPANDED;
+ else if( f <= ::com::sun::star::awt::FontWidth::EXTRAEXPANDED )
+ return WIDTH_EXTRA_EXPANDED;
+ else if( f <= ::com::sun::star::awt::FontWidth::ULTRAEXPANDED )
+ return WIDTH_ULTRA_EXPANDED;
+
+ DBG_ERROR( "Unknown FontWidth" );
+ return WIDTH_DONTKNOW;
+}
+
+float VCLUnoHelper::ConvertFontWeight( FontWeight eWeight )
+{
+ if( eWeight == WEIGHT_DONTKNOW )
+ return ::com::sun::star::awt::FontWeight::DONTKNOW;
+ else if( eWeight == WEIGHT_THIN )
+ return ::com::sun::star::awt::FontWeight::THIN;
+ else if( eWeight == WEIGHT_ULTRALIGHT )
+ return ::com::sun::star::awt::FontWeight::ULTRALIGHT;
+ else if( eWeight == WEIGHT_LIGHT )
+ return ::com::sun::star::awt::FontWeight::LIGHT;
+ else if( eWeight == WEIGHT_SEMILIGHT )
+ return ::com::sun::star::awt::FontWeight::SEMILIGHT;
+ else if( ( eWeight == WEIGHT_NORMAL ) || ( eWeight == WEIGHT_MEDIUM ) )
+ return ::com::sun::star::awt::FontWeight::NORMAL;
+ else if( eWeight == WEIGHT_SEMIBOLD )
+ return ::com::sun::star::awt::FontWeight::SEMIBOLD;
+ else if( eWeight == WEIGHT_BOLD )
+ return ::com::sun::star::awt::FontWeight::BOLD;
+ else if( eWeight == WEIGHT_ULTRABOLD )
+ return ::com::sun::star::awt::FontWeight::ULTRABOLD;
+ else if( eWeight == WEIGHT_BLACK )
+ return ::com::sun::star::awt::FontWeight::BLACK;
+
+ DBG_ERROR( "Unknown FontWeigth" );
+ return ::com::sun::star::awt::FontWeight::DONTKNOW;
+}
+
+FontWeight VCLUnoHelper::ConvertFontWeight( float f )
+{
+ if( f <= ::com::sun::star::awt::FontWeight::DONTKNOW )
+ return WEIGHT_DONTKNOW;
+ else if( f <= ::com::sun::star::awt::FontWeight::THIN )
+ return WEIGHT_THIN;
+ else if( f <= ::com::sun::star::awt::FontWeight::ULTRALIGHT )
+ return WEIGHT_ULTRALIGHT;
+ else if( f <= ::com::sun::star::awt::FontWeight::LIGHT )
+ return WEIGHT_LIGHT;
+ else if( f <= ::com::sun::star::awt::FontWeight::SEMILIGHT )
+ return WEIGHT_SEMILIGHT;
+ else if( f <= ::com::sun::star::awt::FontWeight::NORMAL )
+ return WEIGHT_NORMAL;
+ else if( f <= ::com::sun::star::awt::FontWeight::SEMIBOLD )
+ return WEIGHT_SEMIBOLD;
+ else if( f <= ::com::sun::star::awt::FontWeight::BOLD )
+ return WEIGHT_BOLD;
+ else if( f <= ::com::sun::star::awt::FontWeight::ULTRABOLD )
+ return WEIGHT_ULTRABOLD;
+ else if( f <= ::com::sun::star::awt::FontWeight::BLACK )
+ return WEIGHT_BLACK;
+
+ DBG_ERROR( "Unknown FontWeigth" );
+ return WEIGHT_DONTKNOW;
+}
+
+
+::com::sun::star::awt::FontDescriptor VCLUnoHelper::CreateFontDescriptor( const Font& rFont )
+{
+ ::com::sun::star::awt::FontDescriptor aFD;
+ aFD.Name = rFont.GetName();
+ aFD.StyleName = rFont.GetStyleName();
+ aFD.Height = (sal_Int16)rFont.GetSize().Height();
+ aFD.Width = (sal_Int16)rFont.GetSize().Width();
+ aFD.Family = sal::static_int_cast< sal_Int16 >(rFont.GetFamily());
+ aFD.CharSet = rFont.GetCharSet();
+ aFD.Pitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch());
+ aFD.CharacterWidth = VCLUnoHelper::ConvertFontWidth( rFont.GetWidthType() );
+ aFD.Weight= VCLUnoHelper::ConvertFontWeight( rFont.GetWeight() );
+ aFD.Slant = (::com::sun::star::awt::FontSlant)rFont.GetItalic();
+ aFD.Underline = sal::static_int_cast< sal_Int16 >(rFont.GetUnderline());
+ aFD.Strikeout = sal::static_int_cast< sal_Int16 >(rFont.GetStrikeout());
+ aFD.Orientation = rFont.GetOrientation();
+ aFD.Kerning = rFont.IsKerning();
+ aFD.WordLineMode = rFont.IsWordLineMode();
+ aFD.Type = 0; // ??? => Nur an Metric...
+ return aFD;
+}
+
+Font VCLUnoHelper::CreateFont( const ::com::sun::star::awt::FontDescriptor& rDescr, const Font& rInitFont )
+{
+ Font aFont( rInitFont );
+ if ( rDescr.Name.getLength() )
+ aFont.SetName( rDescr.Name );
+ if ( rDescr.StyleName.getLength() )
+ aFont.SetStyleName( rDescr.StyleName );
+ if ( rDescr.Height )
+ aFont.SetSize( Size( rDescr.Width, rDescr.Height ) );
+ if ( (FontFamily)rDescr.Family != FAMILY_DONTKNOW )
+ aFont.SetFamily( (FontFamily)rDescr.Family );
+ if ( (CharSet)rDescr.CharSet != RTL_TEXTENCODING_DONTKNOW )
+ aFont.SetCharSet( (CharSet)rDescr.CharSet );
+ if ( (FontPitch)rDescr.Pitch != PITCH_DONTKNOW )
+ aFont.SetPitch( (FontPitch)rDescr.Pitch );
+ if ( rDescr.CharacterWidth )
+ aFont.SetWidthType( VCLUnoHelper::ConvertFontWidth( rDescr.CharacterWidth ) );
+ if ( rDescr.Weight )
+ aFont.SetWeight( VCLUnoHelper::ConvertFontWeight( rDescr.Weight ) );
+ if ( (FontItalic)rDescr.Slant != ITALIC_DONTKNOW )
+ aFont.SetItalic( (FontItalic)rDescr.Slant );
+ if ( (FontUnderline)rDescr.Underline != UNDERLINE_DONTKNOW )
+ aFont.SetUnderline( (FontUnderline)rDescr.Underline );
+ if ( (FontStrikeout)rDescr.Strikeout != STRIKEOUT_DONTKNOW )
+ aFont.SetStrikeout( (FontStrikeout)rDescr.Strikeout );
+
+ // Kein DONTKNOW
+ aFont.SetOrientation( (short)rDescr.Orientation );
+ aFont.SetKerning( rDescr.Kerning );
+ aFont.SetWordLineMode( rDescr.WordLineMode );
+
+ return aFont;
+}
+
+Font VCLUnoHelper::CreateFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont )
+{
+ Font aFont;
+ VCLXFont* pVCLXFont = VCLXFont::GetImplementation( rxFont );
+ if ( pVCLXFont )
+ aFont = pVCLXFont->GetFont();
+ return aFont;
+}
+
+
+::com::sun::star::awt::SimpleFontMetric VCLUnoHelper::CreateFontMetric( const FontMetric& rFontMetric )
+{
+ ::com::sun::star::awt::SimpleFontMetric aFM;
+ aFM.Ascent = (sal_Int16)rFontMetric.GetAscent();
+ aFM.Descent = (sal_Int16)rFontMetric.GetDescent();
+ aFM.Leading = (sal_Int16)rFontMetric.GetIntLeading();
+ aFM.Slant = (sal_Int16)rFontMetric.GetSlant();
+ aFM.FirstChar = 0x0020;
+ aFM.LastChar = 0xFFFD;
+ return aFM;
+}
+
+sal_Bool VCLUnoHelper::IsZero( ::com::sun::star::awt::Rectangle rRect )
+{
+ return ( !rRect.X && !rRect.Y && !rRect.Width && !rRect.Height );
+}
+
+MapUnit VCLUnoHelper::UnoEmbed2VCLMapUnit( sal_Int32 nUnoEmbedMapUnit )
+{
+ switch( nUnoEmbedMapUnit )
+ {
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_MM:
+ return MAP_100TH_MM;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_MM:
+ return MAP_10TH_MM;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_MM:
+ return MAP_MM;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_CM:
+ return MAP_CM;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_1000TH_INCH:
+ return MAP_1000TH_INCH;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_INCH:
+ return MAP_100TH_INCH;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_INCH:
+ return MAP_10TH_INCH;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_INCH:
+ return MAP_INCH;
+ case ::com::sun::star::embed::EmbedMapUnits::POINT:
+ return MAP_POINT;
+ case ::com::sun::star::embed::EmbedMapUnits::TWIP:
+ return MAP_TWIP;
+ case ::com::sun::star::embed::EmbedMapUnits::PIXEL:
+ return MAP_PIXEL;
+ }
+
+ OSL_ENSURE( sal_False, "Unexpected UNO map mode is provided!\n" );
+ return MAP_LASTENUMDUMMY;
+}
+
+sal_Int32 VCLUnoHelper::VCL2UnoEmbedMapUnit( MapUnit nVCLMapUnit )
+{
+ switch( nVCLMapUnit )
+ {
+ case MAP_100TH_MM:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_MM;
+ case MAP_10TH_MM:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_MM;
+ case MAP_MM:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_MM;
+ case MAP_CM:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_CM;
+ case MAP_1000TH_INCH:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_1000TH_INCH;
+ case MAP_100TH_INCH:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_INCH;
+ case MAP_10TH_INCH:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_INCH;
+ case MAP_INCH:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_INCH;
+ case MAP_POINT:
+ return ::com::sun::star::embed::EmbedMapUnits::POINT;
+ case MAP_TWIP:
+ return ::com::sun::star::embed::EmbedMapUnits::TWIP;
+ case MAP_PIXEL:
+ return ::com::sun::star::embed::EmbedMapUnits::PIXEL;
+ default: ; // avoid compiler warning
+ }
+
+ OSL_ENSURE( sal_False, "Unexpected VCL map mode is provided!\n" );
+ return -1;
+}
+
+using namespace ::com::sun::star::util;
+
+//====================================================================
+//= file-local helpers
+//====================================================================
+namespace
+{
+ enum UnitConversionDirection
+ {
+ FieldUnitToMeasurementUnit,
+ MeasurementUnitToFieldUnit
+ };
+
+ sal_Int16 convertMeasurementUnit( sal_Int16 _nUnit, UnitConversionDirection eDirection, sal_Int16& _rFieldToUNOValueFactor )
+ {
+ static struct _unit_table
+ {
+ FieldUnit eFieldUnit;
+ sal_Int16 nMeasurementUnit;
+ sal_Int16 nFieldToMeasureFactor;
+ } aUnits[] = {
+ { FUNIT_NONE, -1 , -1},
+ { FUNIT_MM, MeasureUnit::MM, 1 }, // must precede MM_10TH
+ { FUNIT_MM, MeasureUnit::MM_10TH, 10 },
+ { FUNIT_100TH_MM, MeasureUnit::MM_100TH, 1 },
+ { FUNIT_CM, MeasureUnit::CM, 1 },
+ { FUNIT_M, MeasureUnit::M, 1 },
+ { FUNIT_KM, MeasureUnit::KM, 1 },
+ { FUNIT_TWIP, MeasureUnit::TWIP, 1 },
+ { FUNIT_POINT, MeasureUnit::POINT, 1 },
+ { FUNIT_PICA, MeasureUnit::PICA, 1 },
+ { FUNIT_INCH, MeasureUnit::INCH, 1 }, // must precede INCH_*TH
+ { FUNIT_INCH, MeasureUnit::INCH_10TH, 10 },
+ { FUNIT_INCH, MeasureUnit::INCH_100TH, 100 },
+ { FUNIT_INCH, MeasureUnit::INCH_1000TH, 1000 },
+ { FUNIT_FOOT, MeasureUnit::FOOT, 1 },
+ { FUNIT_MILE, MeasureUnit::MILE, 1 },
+ };
+ for ( size_t i = 0; i < sizeof( aUnits ) / sizeof( aUnits[0] ); ++i )
+ {
+ if ( eDirection == FieldUnitToMeasurementUnit )
+ {
+ if ( ( aUnits[ i ].eFieldUnit == (FieldUnit)_nUnit ) && ( aUnits[ i ].nFieldToMeasureFactor == _rFieldToUNOValueFactor ) )
+ return aUnits[ i ].nMeasurementUnit;
+ }
+ else
+ {
+ if ( aUnits[ i ].nMeasurementUnit == _nUnit )
+ {
+ _rFieldToUNOValueFactor = aUnits[ i ].nFieldToMeasureFactor;
+ return (sal_Int16)aUnits[ i ].eFieldUnit;
+ }
+ }
+ }
+ if ( eDirection == FieldUnitToMeasurementUnit )
+ return -1;
+
+ _rFieldToUNOValueFactor = 1;
+ return (sal_Int16)FUNIT_NONE;
+ }
+}
+//========================================================================
+//= MeasurementUnitConversion
+//========================================================================
+//------------------------------------------------------------------------
+sal_Int16 VCLUnoHelper::ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int16 _nUNOToFieldValueFactor )
+{
+ return convertMeasurementUnit( (sal_Int16)_nFieldUnit, FieldUnitToMeasurementUnit, _nUNOToFieldValueFactor );
+}
+
+//------------------------------------------------------------------------
+FieldUnit VCLUnoHelper::ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor )
+{
+ return (FieldUnit)convertMeasurementUnit( _nMeasurementUnit, MeasurementUnitToFieldUnit, _rFieldToUNOValueFactor );
+}
+
+
+MapUnit /* MapModeUnit */ VCLUnoHelper::ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit) throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ MapUnit eMode;
+ switch(_nMeasureUnit)
+ {
+ case com::sun::star::util::MeasureUnit::MM_100TH:
+ eMode = MAP_100TH_MM;
+ break;
+
+
+ case com::sun::star::util::MeasureUnit::MM_10TH:
+ eMode = MAP_10TH_MM;
+ break;
+
+ case com::sun::star::util::MeasureUnit::MM:
+ eMode = MAP_MM;
+ break;
+
+ case com::sun::star::util::MeasureUnit::CM:
+ eMode = MAP_CM;
+ break;
+
+ case com::sun::star::util::MeasureUnit::INCH_1000TH:
+ eMode = MAP_1000TH_INCH;
+ break;
+
+ case com::sun::star::util::MeasureUnit::INCH_100TH:
+ eMode = MAP_100TH_INCH;
+ break;
+
+ case com::sun::star::util::MeasureUnit::INCH_10TH:
+ eMode = MAP_10TH_INCH;
+ break;
+
+ case com::sun::star::util::MeasureUnit::INCH:
+ eMode = MAP_INCH;
+ break;
+
+ case com::sun::star::util::MeasureUnit::POINT:
+ eMode = MAP_POINT;
+ break;
+
+ case com::sun::star::util::MeasureUnit::TWIP:
+ eMode = MAP_TWIP;
+ break;
+
+ case com::sun::star::util::MeasureUnit::PIXEL:
+ eMode = MAP_PIXEL;
+ break;
+
+/*
+ case com::sun::star::util::MeasureUnit::M:
+ break;
+ case com::sun::star::util::MeasureUnit::KM:
+ break;
+ case com::sun::star::util::MeasureUnit::PICA:
+ break;
+ case com::sun::star::util::MeasureUnit::FOOT:
+ break;
+ case com::sun::star::util::MeasureUnit::MILE:
+ break;
+ case com::sun::star::util::MeasureUnit::PERCENT:
+ break;
+*/
+ case com::sun::star::util::MeasureUnit::APPFONT:
+ eMode = MAP_APPFONT;
+ break;
+
+ case com::sun::star::util::MeasureUnit::SYSFONT:
+ eMode = MAP_SYSFONT;
+ break;
+
+/*
+ case com::sun::star::util::MeasureUnit::RELATIVE:
+ eMode = MAP_RELATIVE;
+ break;
+ case com::sun::star::util::MeasureUnit::REALAPPFONT:
+ eMode = MAP_REALAPPFONT;
+ break;
+*/
+
+ default:
+ throw ::com::sun::star::lang::IllegalArgumentException(::rtl::OUString::createFromAscii("Unsupported measure unit."), NULL, 1 );
+ }
+ return eMode;
+}
+
+sal_Int16 /* com.sun.star.util.MeasureUnit.* */ VCLUnoHelper::ConvertToMeasurementUnit(MapUnit /* MapModeUnit */ _eMapModeUnit) throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ sal_Int16 nMeasureUnit = 0;
+ switch (_eMapModeUnit)
+ {
+ case MAP_100TH_MM:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::MM_100TH;
+ break;
+
+ case MAP_10TH_MM:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::MM_10TH;
+ break;
+
+ case MAP_MM:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::MM;
+ break;
+
+ case MAP_CM:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::CM;
+ break;
+
+ case MAP_1000TH_INCH:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::INCH_1000TH;
+ break;
+
+ case MAP_100TH_INCH:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::INCH_100TH;
+ break;
+
+ case MAP_10TH_INCH:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::INCH_10TH;
+ break;
+
+ case MAP_INCH:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::INCH;
+ break;
+
+ case MAP_POINT:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::POINT;
+ break;
+
+ case MAP_TWIP:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::TWIP;
+ break;
+
+ case MAP_PIXEL:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::PIXEL;
+ break;
+
+ case MAP_APPFONT:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::APPFONT;
+ break;
+
+ case MAP_SYSFONT:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::SYSFONT;
+ break;
+
+/*
+ case MAP_RELATIVE:
+ break;
+
+ case MAP_REALAPPFONT:
+ break;
+*/
+ default:
+ throw ::com::sun::star::lang::IllegalArgumentException(::rtl::OUString::createFromAscii("Unsupported MapMode unit."), NULL, 1 );
+ }
+ return nMeasureUnit;
+}
+
+::Size VCLUnoHelper::ConvertToVCLSize(com::sun::star::awt::Size const& _aSize)
+{
+ ::Size aVCLSize(_aSize.Width, _aSize.Height);
+ return aVCLSize;
+}
+
+com::sun::star::awt::Size VCLUnoHelper::ConvertToAWTSize(::Size /* VCLSize */ const& _aSize)
+{
+ com::sun::star::awt::Size aAWTSize(_aSize.Width(), _aSize.Height());
+ return aAWTSize;
+}
+
+
+::Point VCLUnoHelper::ConvertToVCLPoint(com::sun::star::awt::Point const& _aPoint)
+{
+ ::Point aVCLPoint(_aPoint.X, _aPoint.Y);
+ return aVCLPoint;
+}
+
+com::sun::star::awt::Point VCLUnoHelper::ConvertToAWTPoint(::Point /* VCLPoint */ const& _aPoint)
+{
+ com::sun::star::awt::Point aAWTPoint(_aPoint.X(), _aPoint.Y());
+ return aAWTPoint;
+}
+
+::Rectangle VCLUnoHelper::ConvertToVCLRect( ::com::sun::star::awt::Rectangle const & _rRect )
+{
+ return ::Rectangle( _rRect.X, _rRect.Y, _rRect.X + _rRect.Width - 1, _rRect.Y + _rRect.Height - 1 );
+}
+
+::com::sun::star::awt::Rectangle VCLUnoHelper::ConvertToAWTRect( ::Rectangle const & _rRect )
+{
+ return ::com::sun::star::awt::Rectangle( _rRect.Left(), _rRect.Top(), _rRect.GetWidth(), _rRect.GetHeight() );
+}
+
+awt::MouseEvent VCLUnoHelper::createMouseEvent( const ::MouseEvent& _rVclEvent, const uno::Reference< uno::XInterface >& _rxContext )
+{
+ awt::MouseEvent aMouseEvent;
+ aMouseEvent.Source = _rxContext;
+
+ aMouseEvent.Modifiers = 0;
+ if ( _rVclEvent.IsShift() )
+ aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT;
+ if ( _rVclEvent.IsMod1() )
+ aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1;
+ if ( _rVclEvent.IsMod2() )
+ aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2;
+
+ aMouseEvent.Buttons = 0;
+ if ( _rVclEvent.IsLeft() )
+ aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::LEFT;
+ if ( _rVclEvent.IsRight() )
+ aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::RIGHT;
+ if ( _rVclEvent.IsMiddle() )
+ aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::MIDDLE;
+
+ aMouseEvent.X = _rVclEvent.GetPosPixel().X();
+ aMouseEvent.Y = _rVclEvent.GetPosPixel().Y();
+ aMouseEvent.ClickCount = _rVclEvent.GetClicks();
+ aMouseEvent.PopupTrigger = sal_False;
+
+ return aMouseEvent;
+}
+
+awt::KeyEvent VCLUnoHelper::createKeyEvent( const ::KeyEvent& _rVclEvent, const uno::Reference< uno::XInterface >& _rxContext )
+{
+ awt::KeyEvent aKeyEvent;
+ aKeyEvent.Source = _rxContext;
+
+ aKeyEvent.Modifiers = 0;
+ if ( _rVclEvent.GetKeyCode().IsShift() )
+ aKeyEvent.Modifiers |= awt::KeyModifier::SHIFT;
+ if ( _rVclEvent.GetKeyCode().IsMod1() )
+ aKeyEvent.Modifiers |= awt::KeyModifier::MOD1;
+ if ( _rVclEvent.GetKeyCode().IsMod2() )
+ aKeyEvent.Modifiers |= awt::KeyModifier::MOD2;
+ if ( _rVclEvent.GetKeyCode().IsMod3() )
+ aKeyEvent.Modifiers |= awt::KeyModifier::MOD3;
+
+ aKeyEvent.KeyCode = _rVclEvent.GetKeyCode().GetCode();
+ aKeyEvent.KeyChar = _rVclEvent.GetCharCode();
+ aKeyEvent.KeyFunc = ::sal::static_int_cast< sal_Int16 >( _rVclEvent.GetKeyCode().GetFunction());
+
+ return aKeyEvent;
+}