diff options
Diffstat (limited to 'toolkit/source/helper')
-rw-r--r-- | toolkit/source/helper/accessibilityclient.cxx | 280 | ||||
-rw-r--r-- | toolkit/source/helper/externallock.cxx | 48 | ||||
-rw-r--r-- | toolkit/source/helper/fixedhyperbase.cxx | 74 | ||||
-rw-r--r-- | toolkit/source/helper/formpdfexport.cxx | 628 | ||||
-rw-r--r-- | toolkit/source/helper/imagealign.cxx | 138 | ||||
-rw-r--r-- | toolkit/source/helper/listenermultiplexer.cxx | 235 | ||||
-rw-r--r-- | toolkit/source/helper/property.cxx | 415 | ||||
-rw-r--r-- | toolkit/source/helper/registerservices.cxx | 342 | ||||
-rw-r--r-- | toolkit/source/helper/servicenames.cxx | 123 | ||||
-rw-r--r-- | toolkit/source/helper/tkresmgr.cxx | 131 | ||||
-rw-r--r-- | toolkit/source/helper/unomemorystream.cxx | 110 | ||||
-rw-r--r-- | toolkit/source/helper/unopropertyarrayhelper.cxx | 162 | ||||
-rw-r--r-- | toolkit/source/helper/unowrapper.cxx | 346 | ||||
-rw-r--r-- | toolkit/source/helper/vclunohelper.cxx | 804 |
14 files changed, 0 insertions, 3836 deletions
diff --git a/toolkit/source/helper/accessibilityclient.cxx b/toolkit/source/helper/accessibilityclient.cxx deleted file mode 100644 index c926ec25d8..0000000000 --- a/toolkit/source/helper/accessibilityclient.cxx +++ /dev/null @@ -1,280 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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_CONSTASCII_USTRINGPARAM( - SVLIBRARY( "acc" )) - ); - s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 ); - if ( s_hAccessibleImplementationModule != NULL ) - { - const ::rtl::OUString sFactoryCreationFunc = - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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 -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/externallock.cxx b/toolkit/source/helper/externallock.cxx deleted file mode 100644 index 33be3e7e5c..0000000000 --- a/toolkit/source/helper/externallock.cxx +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 <osl/mutex.hxx> -#include <vcl/svapp.hxx> - -// ----------------------------------------------------------------------------- -// class VCLExternalSolarLock -// ----------------------------------------------------------------------------- -void VCLExternalSolarLock::acquire() -{ - Application::GetSolarMutex().acquire(); -} -// ----------------------------------------------------------------------------- -void VCLExternalSolarLock::release() -{ - Application::GetSolarMutex().release(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/fixedhyperbase.cxx b/toolkit/source/helper/fixedhyperbase.cxx deleted file mode 100644 index b9ce25f40f..0000000000 --- a/toolkit/source/helper/fixedhyperbase.cxx +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx deleted file mode 100644 index 5cd82c0985..0000000000 --- a/toolkit/source/helper/formpdfexport.cxx +++ /dev/null @@ -1,628 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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/formpdfexport.hxx> - -/** === begin UNO includes === **/ -#include <com/sun/star/container/XIndexAccess.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/form/XForm.hpp> -#include <com/sun/star/container/XChild.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/form/FormComponentType.hpp> -#include <com/sun/star/awt/TextAlign.hpp> -#include <com/sun/star/style/VerticalAlignment.hpp> -#include <com/sun/star/form/FormButtonType.hpp> -#include <com/sun/star/form/FormSubmitMethod.hpp> -/** === end UNO includes === **/ - -#include <toolkit/helper/vclunohelper.hxx> -#include <vcl/pdfextoutdevdata.hxx> -#include <vcl/outdev.hxx> - -#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; - - static const ::rtl::OUString FM_PROP_NAME(RTL_CONSTASCII_USTRINGPARAM("Name")); - - namespace - { - //-------------------------------------------------------------------- - /** determines the FormComponentType of a form control - */ - sal_Int16 classifyFormControl( const Reference< XPropertySet >& _rxModel ) SAL_THROW(( Exception )) - { - static const ::rtl::OUString FM_PROP_CLASSID(RTL_CONSTASCII_USTRINGPARAM("ClassId")); - 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_FAIL( "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_FAIL( "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 ) - { - static const ::rtl::OUString FM_PROP_STRINGITEMLIST(RTL_CONSTASCII_USTRINGPARAM("StringItemList")); - 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, ::vcl::PDFExtOutDevData& i_pdfExportData ) 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 ); - static const ::rtl::OUString FM_PROP_HELPTEXT(RTL_CONSTASCII_USTRINGPARAM("HelpText")); - OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_HELPTEXT ) >>= _rpDescriptor->Description ); - Any aText; - static const ::rtl::OUString FM_PROP_TEXT(RTL_CONSTASCII_USTRINGPARAM("Text")); - static const ::rtl::OUString FM_PROP_LABEL(RTL_CONSTASCII_USTRINGPARAM("Label")); - 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 - static const ::rtl::OUString FM_PROP_READONLY(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); - if ( xPSI->hasPropertyByName( FM_PROP_READONLY ) ) - OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_READONLY ) >>= _rpDescriptor->ReadOnly ); - - // -------------------------------- - // border - { - static const ::rtl::OUString FM_PROP_BORDER(RTL_CONSTASCII_USTRINGPARAM("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 - static const ::rtl::OUString FM_PROP_BACKGROUNDCOLOR(RTL_CONSTASCII_USTRINGPARAM("BackgroundColor")); - 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 - static const ::rtl::OUString FM_PROP_TEXTCOLOR(RTL_CONSTASCII_USTRINGPARAM("TextColor")); - 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 - static const ::rtl::OUString FM_PROP_MULTILINE(RTL_CONSTASCII_USTRINGPARAM("MultiLine")); - 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 - static const ::rtl::OUString FM_PROP_ALIGN(RTL_CONSTASCII_USTRINGPARAM("Align")); - 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_FAIL( "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_FAIL( "describePDFControl: invalid vertical text align!" ); - } - } - } - - // font - static const ::rtl::OUString FM_PROP_FONT(RTL_CONSTASCII_USTRINGPARAM("FontDescriptor")); - 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 - static const ::rtl::OUString FM_SUN_COMPONENT_FILECONTROL(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FileControl")); - if ( xSI->supportsService( FM_SUN_COMPONENT_FILECONTROL ) ) - pEditWidget->FileSelect = true; - // ............................ - // maximum text length - static const ::rtl::OUString FM_PROP_MAXTEXTLEN(RTL_CONSTASCII_USTRINGPARAM("MaxTextLen")); - 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 ); - static const ::rtl::OUString FM_PROP_TARGET_URL(RTL_CONSTASCII_USTRINGPARAM("TargetURL")); - 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 ) - { - ::rtl::OUString sURL; - OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= sURL ); - const bool bDocumentLocalTarget = ( sURL.getLength() > 0 ) && ( sURL.getStr()[0] == '#' ); - if ( bDocumentLocalTarget ) - { - const ::rtl::OUString sDestinationName( sURL.copy(1) ); - // Register the destination for for future handling ... - pButtonWidget->Dest = i_pdfExportData.RegisterDest(); - - // and put it into the bookmarks, to ensure the future handling really happens - ::std::vector< ::vcl::PDFExtOutDevBookmarkEntry >& rBookmarks( i_pdfExportData.GetBookmarks() ); - ::vcl::PDFExtOutDevBookmarkEntry aBookmark; - aBookmark.nDestId = pButtonWidget->Dest; - aBookmark.aBookmark = sURL; - rBookmarks.push_back( aBookmark ); - } - else - pButtonWidget->URL = sURL; - - 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 - static const ::rtl::OUString FM_PROP_STATE(RTL_CONSTASCII_USTRINGPARAM("State")); - 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 - { - static const ::rtl::OUString FM_PROP_REFVALUE(RTL_CONSTASCII_USTRINGPARAM("RefValue")); - 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 - static const ::rtl::OUString FM_PROP_DROPDOWN(RTL_CONSTASCII_USTRINGPARAM("Dropdown")); - 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_FAIL( "describePDFControl: caught an exception!" ); - } - } - -//........................................................................ -} // namespace toolkitform -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/imagealign.cxx b/toolkit/source/helper/imagealign.cxx deleted file mode 100644 index e95d104561..0000000000 --- a/toolkit/source/helper/imagealign.cxx +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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_FAIL( "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_FAIL( "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_FAIL( "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_FAIL( "getExtendedImagePosition: unknown ImageAlign value!" ); - } - return nReturn; - } - -//........................................................................ -} // namespace toolkit -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx deleted file mode 100644 index 4ca367b79e..0000000000 --- a/toolkit/source/helper/listenermultiplexer.cxx +++ /dev/null @@ -1,235 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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/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 TabListenerMultiplexer -// ---------------------------------------------------- -IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener ) -void TabListenerMultiplexer::inserted( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException) -IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, inserted, ::sal_Int32 ) -void TabListenerMultiplexer::removed( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException) -IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, removed, ::sal_Int32 ) -void TabListenerMultiplexer::changed( sal_Int32 evt, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& evt2 ) throw(::com::sun::star::uno::RuntimeException) -IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_2PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, changed, ::sal_Int32, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > ) -void TabListenerMultiplexer::activated( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException) -IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, activated, ::sal_Int32 ) -void TabListenerMultiplexer::deactivated( sal_Int32 evt ) throw(::com::sun::star::uno::RuntimeException) -IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer, ::com::sun::star::awt::XTabListener, deactivated, ::sal_Int32 ) - -// ---------------------------------------------------- -// 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 ) - -// ---------------------------------------------------- -// class SelectionListenerMultiplexer -// ---------------------------------------------------- -IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener ) -IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener, tabPageActivated, ::com::sun::star::awt::tab::TabPageActivatedEvent ) -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx deleted file mode 100644 index a7ff7832d7..0000000000 --- a/toolkit/source/helper/property.cxx +++ /dev/null @@ -1,415 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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/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 <com/sun/star/container/XNameContainer.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; -using ::com::sun::star::graphic::XGraphic; - -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 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< XGraphic >, BOUND, TRANSIENT ), - DECL_PROP_2 ( "GroupName", GROUPNAME, ::rtl::OUString, BOUND, MAYBEDEFAULT ), - 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 ( "AutoRepeat", AUTO_REPEAT, sal_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", ROW_HEIGHT, 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 ( "RowHeaderWidth", ROW_HEADER_WIDTH, sal_Int32, BOUND, MAYBEDEFAULT ), - DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ), - DECL_PROP_3 ( "ColumnHeaderHeight", COLUMN_HEADER_HEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_1 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND ), - DECL_PROP_1 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND ), - 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 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_3 ( "HeaderTextColor", GRID_HEADER_TEXT_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_3 ( "GridLineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_3 ( "RowBackgroundColors", GRID_ROW_BACKGROUND_COLORS, Sequence< sal_Int32 >, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_2 ( "UseGridLines", USE_GRID_LINES, sal_Bool, BOUND, MAYBEDEFAULT ), - DECL_DEP_PROP_3 ( "MultiPageValue", MULTIPAGEVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_3 ( "AllDialogChildren", USERFORMCONTAINEES, Reference< ::com::sun::star::container::XNameContainer >, 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 ); -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx deleted file mode 100644 index 2e5b3eb390..0000000000 --- a/toolkit/source/helper/registerservices.cxx +++ /dev/null @@ -1,342 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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/dialogcontrol.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/animatedimages.hxx> -#include <toolkit/controls/spinningprogress.hxx> -#include <toolkit/controls/dialogcontrol.hxx> -#include <toolkit/controls/tabpagemodel.hxx> -#include <toolkit/controls/tabpagecontainer.hxx> -#include "toolkit/dllapi.h" -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> - -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 >& i_factory ) \ - { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName( i_factory ) ); } - -::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 >& i_factory ) -{ - return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlDialogModel>( i_factory ) ); -} - -#define GET_FACTORY_WITH_IMPL_PREFIX( ClassName, ImplNamePrefix, ServiceName1, ServiceName2 ) \ - pRet = tryCreateFactory( sImplementationName, ImplNamePrefix "." #ClassName, \ - ServiceName1, ServiceName2, \ - ClassName##_CreateInstance, xServiceFactory \ - ); \ - if ( pRet ) \ - return pRet; \ - -#define GET_FACTORY( ImplName, ServiceName1, ServiceName2 ) \ - GET_FACTORY_WITH_IMPL_PREFIX( ImplName, "stardiv.Toolkit", ServiceName1, ServiceName2 ) - -using namespace toolkit; - -IMPL_CREATEINSTANCE2( VCLXToolkit ) -IMPL_CREATEINSTANCE( StdTabController ) -IMPL_CREATEINSTANCE( StdTabControllerModel ) -IMPL_CREATEINSTANCE2( UnoButtonControl ) -IMPL_CREATEINSTANCE2( UnoCheckBoxControl ) -IMPL_CREATEINSTANCE2( UnoComboBoxControl ) -IMPL_CREATEINSTANCE2( UnoControlButtonModel ) -IMPL_CREATEINSTANCE2( UnoControlCheckBoxModel ) -IMPL_CREATEINSTANCE2( UnoControlComboBoxModel ) -IMPL_CREATEINSTANCE2( UnoControlContainer ) -IMPL_CREATEINSTANCE2( UnoControlContainerModel ) -IMPL_CREATEINSTANCE2( UnoControlCurrencyFieldModel ) -IMPL_CREATEINSTANCE2( UnoControlDateFieldModel ) -IMPL_CREATEINSTANCE2( UnoControlEditModel ) -IMPL_CREATEINSTANCE2( UnoControlFileControlModel ) -IMPL_CREATEINSTANCE2( UnoControlFixedHyperlinkModel ) -IMPL_CREATEINSTANCE2( UnoControlFixedTextModel ) -IMPL_CREATEINSTANCE2( UnoControlFormattedFieldModel ) -IMPL_CREATEINSTANCE2( UnoControlGroupBoxModel ) -IMPL_CREATEINSTANCE2( UnoControlImageControlModel ) -IMPL_CREATEINSTANCE2( UnoControlListBoxModel ) -IMPL_CREATEINSTANCE2( UnoControlNumericFieldModel ) -IMPL_CREATEINSTANCE2( UnoControlPatternFieldModel ) -IMPL_CREATEINSTANCE2( UnoControlRadioButtonModel ) -IMPL_CREATEINSTANCE2( UnoControlTimeFieldModel ) -IMPL_CREATEINSTANCE2( UnoControlProgressBarModel ) -IMPL_CREATEINSTANCE2( UnoControlScrollBarModel ) -IMPL_CREATEINSTANCE2( UnoSpinButtonModel ) -IMPL_CREATEINSTANCE2( UnoMultiPageModel ) -IMPL_CREATEINSTANCE2( UnoPageModel ) -IMPL_CREATEINSTANCE2( UnoFrameModel ) -IMPL_CREATEINSTANCE2( UnoControlFixedLineModel ) -IMPL_CREATEINSTANCE2( UnoCurrencyFieldControl ) -IMPL_CREATEINSTANCE2( UnoDateFieldControl ) -IMPL_CREATEINSTANCE2( UnoDialogControl ) -IMPL_CREATEINSTANCE2( UnoEditControl ) -IMPL_CREATEINSTANCE2( UnoFileControl ) -IMPL_CREATEINSTANCE2( UnoFixedHyperlinkControl ) -IMPL_CREATEINSTANCE2( UnoFixedTextControl ) -IMPL_CREATEINSTANCE2( UnoFormattedFieldControl ) -IMPL_CREATEINSTANCE2( UnoGroupBoxControl ) -IMPL_CREATEINSTANCE2( UnoImageControlControl ) -IMPL_CREATEINSTANCE2( UnoListBoxControl ) -IMPL_CREATEINSTANCE2( UnoNumericFieldControl ) -IMPL_CREATEINSTANCE2( UnoPatternFieldControl ) -IMPL_CREATEINSTANCE2( UnoRadioButtonControl ) -IMPL_CREATEINSTANCE2( UnoTimeFieldControl ) -IMPL_CREATEINSTANCE2( UnoProgressBarControl ) -IMPL_CREATEINSTANCE2( UnoScrollBarControl ) -IMPL_CREATEINSTANCE2( UnoSpinButtonControl ) -IMPL_CREATEINSTANCE2( UnoFixedLineControl ) -IMPL_CREATEINSTANCE2( UnoMultiPageControl ) -IMPL_CREATEINSTANCE2( UnoPageControl ) -IMPL_CREATEINSTANCE2( UnoFrameControl ) -IMPL_CREATEINSTANCE( VCLXMenuBar ) -IMPL_CREATEINSTANCE( VCLXPointer ) -IMPL_CREATEINSTANCE( VCLXPopupMenu ) -IMPL_CREATEINSTANCE( VCLXPrinterServer ) -IMPL_CREATEINSTANCE2( UnoRoadmapControl ) -IMPL_CREATEINSTANCE2( UnoControlRoadmapModel ) -IMPL_CREATEINSTANCE2( UnoSimpleAnimationControl ) -IMPL_CREATEINSTANCE2( UnoSimpleAnimationControlModel ) -IMPL_CREATEINSTANCE2( UnoThrobberControl ) -IMPL_CREATEINSTANCE2( UnoThrobberControlModel ) -IMPL_CREATEINSTANCE2( UnoControlTabPage ) -IMPL_CREATEINSTANCE2( UnoControlTabPageModel ) -IMPL_CREATEINSTANCE2( UnoControlTabPageContainer ) -IMPL_CREATEINSTANCE2( UnoControlTabPageContainerModel ) -IMPL_CREATEINSTANCE2( AnimatedImagesControl ) -IMPL_CREATEINSTANCE2( AnimatedImagesControlModel ) -IMPL_CREATEINSTANCE2( SpinningProgressControlModel ) - -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 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SortableGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); - -extern void * SAL_CALL comp_AsyncCallback_component_getFactory( const char * implName, 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 tk_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 ); - GET_FACTORY( VCLXToolkit, szServiceName_Toolkit, szServiceName2_Toolkit ) - GET_FACTORY( VCLXPopupMenu, szServiceName_PopupMenu, szServiceName2_PopupMenu ) - GET_FACTORY( VCLXMenuBar, szServiceName_MenuBar, szServiceName2_MenuBar ) - GET_FACTORY( VCLXPointer, szServiceName_Pointer, szServiceName2_Pointer ) - GET_FACTORY( UnoControlContainer, szServiceName_UnoControlContainer, szServiceName2_UnoControlContainer ) - GET_FACTORY( UnoControlContainerModel, szServiceName_UnoControlContainerModel, szServiceName2_UnoControlContainerModel ) - GET_FACTORY( StdTabController, szServiceName_TabController, szServiceName2_TabController ) - GET_FACTORY( StdTabControllerModel, szServiceName_TabControllerModel, szServiceName2_TabControllerModel ) - GET_FACTORY( UnoDialogControl, szServiceName_UnoControlDialog, szServiceName2_UnoControlDialog ) - GET_FACTORY( UnoControlDialogModel, szServiceName_UnoControlDialogModel, szServiceName2_UnoControlDialogModel ) - GET_FACTORY( UnoEditControl, szServiceName_UnoControlEdit, szServiceName2_UnoControlEdit ) - GET_FACTORY( UnoControlEditModel, szServiceName_UnoControlEditModel, szServiceName2_UnoControlEditModel ) - GET_FACTORY( UnoDateFieldControl, szServiceName_UnoControlDateField, szServiceName2_UnoControlDateField ) - GET_FACTORY( UnoControlDateFieldModel, szServiceName_UnoControlDateFieldModel, szServiceName2_UnoControlDateFieldModel ) - GET_FACTORY( UnoTimeFieldControl, szServiceName_UnoControlTimeField, szServiceName2_UnoControlTimeField ) - GET_FACTORY( UnoControlTimeFieldModel, szServiceName_UnoControlTimeFieldModel, szServiceName2_UnoControlTimeFieldModel ) - GET_FACTORY( UnoNumericFieldControl, szServiceName_UnoControlNumericField, szServiceName2_UnoControlNumericField ) - GET_FACTORY( UnoControlNumericFieldModel, szServiceName_UnoControlNumericFieldModel, szServiceName2_UnoControlNumericFieldModel ) - GET_FACTORY( UnoCurrencyFieldControl, szServiceName_UnoControlCurrencyField, szServiceName2_UnoControlCurrencyField ) - GET_FACTORY( UnoControlCurrencyFieldModel, szServiceName_UnoControlCurrencyFieldModel, szServiceName2_UnoControlCurrencyFieldModel ) - GET_FACTORY( UnoPatternFieldControl, szServiceName_UnoControlPatternField, szServiceName2_UnoControlPatternField ) - GET_FACTORY( UnoControlPatternFieldModel, szServiceName_UnoControlPatternFieldModel, szServiceName2_UnoControlPatternFieldModel ) - GET_FACTORY( UnoFormattedFieldControl, szServiceName_UnoControlFormattedField, szServiceName2_UnoControlFormattedField ) - GET_FACTORY( UnoControlFormattedFieldModel, szServiceName_UnoControlFormattedFieldModel, szServiceName2_UnoControlFormattedFieldModel ) - GET_FACTORY( UnoFileControl, szServiceName_UnoControlFileControl, szServiceName2_UnoControlFileControl ) - GET_FACTORY( UnoControlFileControlModel, szServiceName_UnoControlFileControlModel, szServiceName2_UnoControlFileControlModel ) - GET_FACTORY( UnoButtonControl, szServiceName_UnoControlButton, szServiceName2_UnoControlButton ) - GET_FACTORY( UnoControlButtonModel, szServiceName_UnoControlButtonModel, szServiceName2_UnoControlButtonModel ) - GET_FACTORY( UnoImageControlControl, szServiceName_UnoControlImageButton, szServiceName2_UnoControlImageButton ) - GET_FACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageButtonModel, szServiceName2_UnoControlImageButtonModel ) - GET_FACTORY( UnoImageControlControl, szServiceName_UnoControlImageControl, szServiceName2_UnoControlImageControl ) - GET_FACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageControlModel, szServiceName2_UnoControlImageControlModel ) - GET_FACTORY( UnoRadioButtonControl, szServiceName_UnoControlRadioButton, szServiceName2_UnoControlRadioButton ) - GET_FACTORY( UnoControlRadioButtonModel, szServiceName_UnoControlRadioButtonModel, szServiceName2_UnoControlRadioButtonModel ) - GET_FACTORY( UnoCheckBoxControl, szServiceName_UnoControlCheckBox, szServiceName2_UnoControlCheckBox ) - GET_FACTORY( UnoControlCheckBoxModel, szServiceName_UnoControlCheckBoxModel, szServiceName2_UnoControlCheckBoxModel ) - GET_FACTORY( UnoListBoxControl, szServiceName_UnoControlListBox, szServiceName2_UnoControlListBox ) - GET_FACTORY( UnoControlListBoxModel, szServiceName_UnoControlListBoxModel, szServiceName2_UnoControlListBoxModel ) - GET_FACTORY( UnoComboBoxControl, szServiceName_UnoControlComboBox, szServiceName2_UnoControlComboBox ) - GET_FACTORY( UnoControlComboBoxModel, szServiceName_UnoControlComboBoxModel, szServiceName2_UnoControlComboBoxModel ) - GET_FACTORY( UnoFixedTextControl, szServiceName_UnoControlFixedText, szServiceName2_UnoControlFixedText ) - GET_FACTORY( UnoControlFixedTextModel, szServiceName_UnoControlFixedTextModel, szServiceName2_UnoControlFixedTextModel ) - GET_FACTORY( UnoGroupBoxControl, szServiceName_UnoControlGroupBox, szServiceName2_UnoControlGroupBox ) - GET_FACTORY( UnoControlGroupBoxModel, szServiceName_UnoControlGroupBoxModel, szServiceName2_UnoControlGroupBoxModel ) - GET_FACTORY( UnoProgressBarControl, szServiceName_UnoControlProgressBar, szServiceName2_UnoControlProgressBar ) - GET_FACTORY( UnoControlProgressBarModel, szServiceName_UnoControlProgressBarModel, szServiceName2_UnoControlProgressBarModel ) - GET_FACTORY( UnoScrollBarControl, szServiceName_UnoControlScrollBar, szServiceName2_UnoControlScrollBar ) - GET_FACTORY( UnoControlScrollBarModel, szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel ) - GET_FACTORY( UnoFixedLineControl, szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine ) - GET_FACTORY( UnoControlFixedLineModel, szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel ) - GET_FACTORY( VCLXPrinterServer, szServiceName_PrinterServer, szServiceName2_PrinterServer ) - GET_FACTORY( UnoRoadmapControl, szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap ) - GET_FACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel ) - GET_FACTORY( UnoMultiPageModel, szServiceName_UnoMultiPageModel, NULL ) - GET_FACTORY( UnoMultiPageControl, szServiceName_UnoMultiPageControl, NULL ) - GET_FACTORY( UnoPageModel, szServiceName_UnoPageModel, NULL ) - GET_FACTORY( UnoPageControl, szServiceName_UnoPageControl, NULL ) - GET_FACTORY( UnoFrameModel, szServiceName_UnoFrameModel, NULL ) - GET_FACTORY( UnoFrameControl, szServiceName_UnoFrameControl, NULL ) - GET_FACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL ) - GET_FACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL ) - GET_FACTORY( TreeControl, szServiceName_TreeControl, NULL ) - GET_FACTORY( TreeControlModel, szServiceName_TreeControlModel, NULL ) - GET_FACTORY( MutableTreeDataModel, szServiceName_MutableTreeDataModel, NULL ) - GET_FACTORY( UnoSimpleAnimationControlModel, szServiceName_UnoSimpleAnimationControlModel, szServiceName2_UnoSimpleAnimationControlModel ) - GET_FACTORY( UnoSimpleAnimationControl, szServiceName_UnoSimpleAnimationControl, szServiceName2_UnoSimpleAnimationControl ) - GET_FACTORY( UnoThrobberControlModel, szServiceName_UnoThrobberControlModel, szServiceName2_UnoThrobberControlModel ) - GET_FACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl ) - GET_FACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL ) - GET_FACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL ) - GET_FACTORY( GridControl, szServiceName_GridControl, NULL ); - GET_FACTORY( GridControlModel, szServiceName_GridControlModel, NULL ); - GET_FACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL ); - GET_FACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL ); - GET_FACTORY_WITH_IMPL_PREFIX( GridColumn, "org.openoffice.comp.toolkit", szServiceName_GridColumn, NULL ); - GET_FACTORY_WITH_IMPL_PREFIX( SortableGridDataModel, "org.openoffice.comp.toolkit", szServiceName_SortableGridDataModel, NULL ); - GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControl, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControl, NULL ) - GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControlModel, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControlModel, NULL ) - GET_FACTORY_WITH_IMPL_PREFIX( SpinningProgressControlModel, "org.openoffice.comp.toolkit", szServiceName_SpinningProgressControlModel, NULL ) - GET_FACTORY( UnoControlTabPageModel, szServiceName_UnoControlTabPageModel, NULL ) - GET_FACTORY( UnoControlTabPage, szServiceName_UnoControlTabPage, NULL ) - GET_FACTORY( UnoControlTabPageContainerModel, szServiceName_UnoControlTabPageContainerModel, NULL ) - GET_FACTORY( UnoControlTabPageContainer, szServiceName_UnoControlTabPageContainer, 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; -} -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx deleted file mode 100644 index 0fb3a29dd2..0000000000 --- a/toolkit/source/helper/servicenames.cxx +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 szServiceName_Toolkit[] = "stardiv.vcl.VclToolkit", szServiceName2_Toolkit[] = "com.sun.star.awt.Toolkit"; -const sal_Char szServiceName_PopupMenu[] = "stardiv.vcl.PopupMenu", szServiceName2_PopupMenu[] = "com.sun.star.awt.PopupMenu"; -const sal_Char szServiceName_MenuBar[] = "stardiv.vcl.MenuBar", szServiceName2_MenuBar[] = "com.sun.star.awt.MenuBar"; -const sal_Char szServiceName_Pointer[] = "stardiv.vcl.Pointer", szServiceName2_Pointer[] = "com.sun.star.awt.Pointer"; -const sal_Char szServiceName_UnoControlContainer[] = "stardiv.vcl.control.ControlContainer", szServiceName2_UnoControlContainer[] = "com.sun.star.awt.UnoControlContainer"; - - -const sal_Char szServiceName_UnoControlContainerModel[] = "stardiv.vcl.controlmodel.ControlContainer", szServiceName2_UnoControlContainerModel[] = "com.sun.star.awt.UnoControlContainerModel"; -const sal_Char szServiceName_TabController[] = "stardiv.vcl.control.TabController", szServiceName2_TabController[] = "com.sun.star.awt.TabController"; -const sal_Char szServiceName_TabControllerModel[] = "stardiv.vcl.controlmodel.TabController", szServiceName2_TabControllerModel[] = "com.sun.star.awt.TabControllerModel"; -const sal_Char szServiceName_UnoControlDialog[] = "stardiv.vcl.control.Dialog", szServiceName2_UnoControlDialog[] = "com.sun.star.awt.UnoControlDialog"; -const sal_Char szServiceName_UnoControlDialogModel[] = "stardiv.vcl.controlmodel.Dialog", szServiceName2_UnoControlDialogModel[] = "com.sun.star.awt.UnoControlDialogModel"; -const sal_Char szServiceName_UnoControlEdit[] = "stardiv.vcl.control.Edit", szServiceName2_UnoControlEdit[] = "com.sun.star.awt.UnoControlEdit"; -const sal_Char szServiceName_UnoControlEditModel[] = "stardiv.vcl.controlmodel.Edit", szServiceName2_UnoControlEditModel[] = "com.sun.star.awt.UnoControlEditModel"; -const sal_Char szServiceName_UnoControlFileControl[] = "stardiv.vcl.control.FileControl", szServiceName2_UnoControlFileControl[] = "com.sun.star.awt.UnoControlFileControl"; -const sal_Char szServiceName_UnoControlFileControlModel[] = "stardiv.vcl.controlmodel.FileControl", szServiceName2_UnoControlFileControlModel[] = "com.sun.star.awt.UnoControlFileControlModel"; -const sal_Char szServiceName_UnoControlButton[] = "stardiv.vcl.control.Button", szServiceName2_UnoControlButton[] = "com.sun.star.awt.UnoControlButton"; -const sal_Char szServiceName_UnoControlButtonModel[] = "stardiv.vcl.controlmodel.Button", szServiceName2_UnoControlButtonModel[] = "com.sun.star.awt.UnoControlButtonModel"; -const sal_Char szServiceName_UnoControlImageButton[] = "stardiv.vcl.control.ImageButton", szServiceName2_UnoControlImageButton[] = "com.sun.star.awt.UnoControlImageButton"; -const sal_Char szServiceName_UnoControlImageButtonModel[] = "stardiv.vcl.controlmodel.ImageButton", szServiceName2_UnoControlImageButtonModel[] = "com.sun.star.awt.UnoControlImageButtonModel"; -const sal_Char szServiceName_UnoControlImageControl[] = "stardiv.vcl.control.ImageControl", szServiceName2_UnoControlImageControl[] = "com.sun.star.awt.UnoControlImageControl"; -const sal_Char szServiceName_UnoControlImageControlModel[] = "stardiv.vcl.controlmodel.ImageControl", szServiceName2_UnoControlImageControlModel[] = "com.sun.star.awt.UnoControlImageControlModel"; -const sal_Char szServiceName_UnoControlRadioButton[] = "stardiv.vcl.control.RadioButton", szServiceName2_UnoControlRadioButton[] = "com.sun.star.awt.UnoControlRadioButton"; -const sal_Char szServiceName_UnoControlRadioButtonModel[] = "stardiv.vcl.controlmodel.RadioButton", szServiceName2_UnoControlRadioButtonModel[] = "com.sun.star.awt.UnoControlRadioButtonModel"; -const sal_Char szServiceName_UnoControlCheckBox[] = "stardiv.vcl.control.CheckBox", szServiceName2_UnoControlCheckBox[] = "com.sun.star.awt.UnoControlCheckBox"; -const sal_Char szServiceName_UnoControlCheckBoxModel[] = "stardiv.vcl.controlmodel.CheckBox", szServiceName2_UnoControlCheckBoxModel[] = "com.sun.star.awt.UnoControlCheckBoxModel"; -const sal_Char szServiceName_UnoControlListBox[] = "stardiv.vcl.control.ListBox", szServiceName2_UnoControlListBox[] = "com.sun.star.awt.UnoControlListBox"; -const sal_Char szServiceName_UnoControlListBoxModel[] = "stardiv.vcl.controlmodel.ListBox", szServiceName2_UnoControlListBoxModel[] = "com.sun.star.awt.UnoControlListBoxModel"; -const sal_Char szServiceName_UnoControlComboBox[] = "stardiv.vcl.control.ComboBox", szServiceName2_UnoControlComboBox[] = "com.sun.star.awt.UnoControlComboBox"; -const sal_Char szServiceName_UnoControlComboBoxModel[] = "stardiv.vcl.controlmodel.ComboBox", szServiceName2_UnoControlComboBoxModel[] = "com.sun.star.awt.UnoControlComboBoxModel"; -const sal_Char szServiceName_UnoControlFixedText[] = "stardiv.vcl.control.FixedText", szServiceName2_UnoControlFixedText[] = "com.sun.star.awt.UnoControlFixedText"; -const sal_Char szServiceName_UnoControlFixedTextModel[] = "stardiv.vcl.controlmodel.FixedText", szServiceName2_UnoControlFixedTextModel[] = "com.sun.star.awt.UnoControlFixedTextModel"; -const sal_Char szServiceName_UnoControlGroupBox[] = "stardiv.vcl.control.GroupBox", szServiceName2_UnoControlGroupBox[] = "com.sun.star.awt.UnoControlGroupBox"; -const sal_Char szServiceName_UnoControlGroupBoxModel[] = "stardiv.vcl.controlmodel.GroupBox", szServiceName2_UnoControlGroupBoxModel[] = "com.sun.star.awt.UnoControlGroupBoxModel"; -const sal_Char szServiceName_UnoControlDateField[] = "stardiv.vcl.control.DateField", szServiceName2_UnoControlDateField[] = "com.sun.star.awt.UnoControlDateField"; -const sal_Char szServiceName_UnoControlDateFieldModel[] = "stardiv.vcl.controlmodel.DateField", szServiceName2_UnoControlDateFieldModel[] = "com.sun.star.awt.UnoControlDateFieldModel"; -const sal_Char szServiceName_UnoControlTimeField[] = "stardiv.vcl.control.TimeField", szServiceName2_UnoControlTimeField[] = "com.sun.star.awt.UnoControlTimeField"; -const sal_Char szServiceName_UnoControlTimeFieldModel[] = "stardiv.vcl.controlmodel.TimeField", szServiceName2_UnoControlTimeFieldModel[] = "com.sun.star.awt.UnoControlTimeFieldModel"; -const sal_Char szServiceName_UnoControlNumericField[] = "stardiv.vcl.control.NumericField", szServiceName2_UnoControlNumericField[] = "com.sun.star.awt.UnoControlNumericField"; -const sal_Char szServiceName_UnoControlNumericFieldModel[] = "stardiv.vcl.controlmodel.NumericField", szServiceName2_UnoControlNumericFieldModel[] = "com.sun.star.awt.UnoControlNumericFieldModel"; -const sal_Char szServiceName_UnoControlCurrencyField[] = "stardiv.vcl.control.CurrencyField", szServiceName2_UnoControlCurrencyField[] = "com.sun.star.awt.UnoControlCurrencyField"; -const sal_Char szServiceName_UnoControlCurrencyFieldModel[] = "stardiv.vcl.controlmodel.CurrencyField", szServiceName2_UnoControlCurrencyFieldModel[] = "com.sun.star.awt.UnoControlCurrencyFieldModel"; -const sal_Char szServiceName_UnoControlPatternField[] = "stardiv.vcl.control.PatternField", szServiceName2_UnoControlPatternField[] = "com.sun.star.awt.UnoControlPatternField"; -const sal_Char szServiceName_UnoControlPatternFieldModel[] = "stardiv.vcl.controlmodel.PatternField", szServiceName2_UnoControlPatternFieldModel[] = "com.sun.star.awt.UnoControlPatternFieldModel"; -const sal_Char szServiceName_UnoControlFormattedField[] = "stardiv.vcl.control.FormattedField", szServiceName2_UnoControlFormattedField[] = "com.sun.star.awt.UnoControlFormattedField"; -const sal_Char szServiceName_UnoControlFormattedFieldModel[] = "stardiv.vcl.controlmodel.FormattedField", szServiceName2_UnoControlFormattedFieldModel[] = "com.sun.star.awt.UnoControlFormattedFieldModel"; -const sal_Char szServiceName_MVCIntrospection[] = "stardiv.vcl.MVCIntrospection", szServiceName2_MVCIntrospection[] = "com.sun.star.awt.MVCIntrospection"; -const sal_Char szServiceName_PrinterServer[] = "stardiv.vcl.PrinterServer", szServiceName2_PrinterServer[] = "com.sun.star.awt.PrinterServer"; -const sal_Char szServiceName_UnoControlProgressBar[] = "stardiv.vcl.control.ProgressBar", szServiceName2_UnoControlProgressBar[] = "com.sun.star.awt.UnoControlProgressBar"; -const sal_Char szServiceName_UnoControlProgressBarModel[] = "stardiv.vcl.controlmodel.ProgressBar", szServiceName2_UnoControlProgressBarModel[] = "com.sun.star.awt.UnoControlProgressBarModel"; -const sal_Char szServiceName_UnoControlScrollBar[] = "stardiv.vcl.control.ScrollBar", szServiceName2_UnoControlScrollBar[] = "com.sun.star.awt.UnoControlScrollBar"; -const sal_Char szServiceName_UnoControlScrollBarModel[] = "stardiv.vcl.controlmodel.ScrollBar", szServiceName2_UnoControlScrollBarModel[] = "com.sun.star.awt.UnoControlScrollBarModel"; -const sal_Char szServiceName_UnoControlFixedLine[] = "stardiv.vcl.control.FixedLine", szServiceName2_UnoControlFixedLine[] = "com.sun.star.awt.UnoControlFixedLine"; -const sal_Char szServiceName_UnoControlFixedLineModel[] = "stardiv.vcl.controlmodel.FixedLine", szServiceName2_UnoControlFixedLineModel[] = "com.sun.star.awt.UnoControlFixedLineModel"; -const sal_Char szServiceName_UnoControlRoadmap[] = "stardiv.vcl.control.Roadmap", szServiceName2_UnoControlRoadmap[] = "com.sun.star.awt.UnoControlRoadmap"; -const sal_Char szServiceName_UnoControlRoadmapModel[] = "stardiv.vcl.controlmodel.Roadmap", szServiceName2_UnoControlRoadmapModel[] = "com.sun.star.awt.UnoControlRoadmapModel"; -const sal_Char szServiceName_UnoSpinButtonControl[] = "com.sun.star.awt.UnoControlSpinButton"; -const sal_Char szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt.UnoControlSpinButtonModel"; -const sal_Char szServiceName_UnoMultiPageControl[] = "com.sun.star.awt.UnoControlMultiPage"; -const sal_Char szServiceName_UnoMultiPageModel[] = "com.sun.star.awt.UnoMultiPageModel"; -const sal_Char szServiceName_UnoPageControl[] = "com.sun.star.awt.UnoControlPage"; -const sal_Char szServiceName_UnoPageModel[] = "com.sun.star.awt.UnoPageModel"; -const sal_Char szServiceName_UnoFrameControl[] = "com.sun.star.awt.UnoControlFrame"; -const sal_Char szServiceName_AnimatedImagesControl[] = "com.sun.star.awt.AnimatedImagesControl"; -const sal_Char szServiceName_AnimatedImagesControlModel[] = "com.sun.star.awt.AnimatedImagesControlModel"; -const sal_Char szServiceName_SpinningProgressControlModel[] = "com.sun.star.awt.SpinningProgressControlModel"; -const sal_Char szServiceName_UnoFrameModel[] = "com.sun.star.awt.UnoFrameModel"; -const sal_Char szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl"; -const sal_Char szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel"; -const sal_Char szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel"; -const sal_Char szServiceName_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoSimpleAnimationControlModel", szServiceName2_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoControlSimpleAnimationModel"; -const sal_Char szServiceName_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoSimpleAnimationControl", szServiceName2_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoControlSimpleAnimation"; -const sal_Char szServiceName_UnoThrobberControlModel[] = "com.sun.star.awt.UnoThrobberControlModel", szServiceName2_UnoThrobberControlModel[] = "com.sun.star.awt.UnoControlThrobberModel"; -const sal_Char szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl", szServiceName2_UnoThrobberControl[] = "com.sun.star.awt.UnoControlThrobber"; -const sal_Char szServiceName_UnoControlFixedHyperlink[] = "com.sun.star.awt.UnoControlFixedHyperlink"; -const sal_Char szServiceName_UnoControlFixedHyperlinkModel[] = "com.sun.star.awt.UnoControlFixedHyperlinkModel"; -const sal_Char szServiceName_GridControl[] = "com.sun.star.awt.grid.UnoControlGrid"; -const sal_Char szServiceName_GridControlModel[] = "com.sun.star.awt.grid.UnoControlGridModel"; -const sal_Char szServiceName_DefaultGridDataModel[] = "com.sun.star.awt.grid.DefaultGridDataModel"; -const sal_Char szServiceName_DefaultGridColumnModel[] = "com.sun.star.awt.grid.DefaultGridColumnModel"; -const sal_Char szServiceName_GridColumn[] = "com.sun.star.awt.grid.GridColumn"; -const sal_Char szServiceName_UnoControlTabPage[] = "com.sun.star.awt.tab.UnoControlTabPage"; -const sal_Char szServiceName_UnoControlTabPageModel[] = "com.sun.star.awt.tab.UnoControlTabPageModel"; -const sal_Char szServiceName_UnoControlTabPageContainerModel[] = "com.sun.star.awt.tab.UnoControlTabPageContainerModel"; -const sal_Char szServiceName_UnoControlTabPageContainer[] = "com.sun.star.awt.tab.UnoControlTabPageContainer"; -const sal_Char szServiceName_SortableGridDataModel[] = "com.sun.star.awt.grid.SortableGridDataModel"; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/tkresmgr.cxx b/toolkit/source/helper/tkresmgr.cxx deleted file mode 100644 index a0a99128b6..0000000000 --- a/toolkit/source/helper/tkresmgr.cxx +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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> -#include <comphelper/processfactory.hxx> -#include <comphelper/componentcontext.hxx> -#include <comphelper/namedvaluecollection.hxx> -#include <com/sun/star/graphic/XGraphicProvider.hpp> -#include <tools/resmgr.hxx> -#include <tools/diagnose_ex.h> - -#include <vcl/svapp.hxx> - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::graphic::XGraphic; -using ::com::sun::star::graphic::XGraphicProvider; -using namespace ::com::sun::star; -// ----------------------------------------------------------------------------- -// 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; -} - -// ----------------------------------------------------------------------------- -Image TkResMgr::getImageFromURL( const ::rtl::OUString& i_rImageURL ) -{ - if ( !i_rImageURL.getLength() ) - return Image(); - - try - { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference< XGraphicProvider > xProvider; - if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) ) - { - ::comphelper::NamedValueCollection aMediaProperties; - aMediaProperties.put( "URL", i_rImageURL ); - Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() ); - return Image( xGraphic ); - } - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return Image(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/unomemorystream.cxx b/toolkit/source/helper/unomemorystream.cxx deleted file mode 100644 index 3105da5414..0000000000 --- a/toolkit/source/helper/unomemorystream.cxx +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 -} - - - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/unopropertyarrayhelper.cxx b/toolkit/source/helper/unopropertyarrayhelper.cxx deleted file mode 100644 index 0893413a7f..0000000000 --- a/toolkit/source/helper/unopropertyarrayhelper.cxx +++ /dev/null @@ -1,162 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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_uIntPtr)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_uIntPtr)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_uLong)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; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx deleted file mode 100644 index e613cfaa83..0000000000 --- a/toolkit/source/helper/unowrapper.cxx +++ /dev/null @@ -1,346 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 <awt/vclxtabcontrol.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; - // #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_TABCONTROL: return new VCLXMultiPage; - - // 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, sal_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 ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer(); - if( xPeer.is() ) - { - bool bSameInstance( pVCLXWindow == dynamic_cast< VCLXWindow* >( xPeer.get() )); - DBG_ASSERT( bSameInstance, "UnoWrapper::SetWindowInterface: there already *is* a WindowInterface for this window!" ); - if ( bSameInstance ) - return; - } - 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 ) -{ - VCLXGraphicsList_impl* pLst = pOutDev->GetUnoGraphicsList(); - if ( pLst ) - { - for ( size_t n = 0; n < pLst->size(); n++ ) - { - VCLXGraphics* pGrf = (*pLst)[ 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( sal_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( sal_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( sal_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 ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx deleted file mode 100644 index e0ea77c74c..0000000000 --- a/toolkit/source/helper/vclunohelper.cxx +++ /dev/null @@ -1,804 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 <sal/macros.h> -#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 ) -{ - const uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - UnoControlContainer* pContainer = new UnoControlContainer( xFactory, pWindow->GetComponentInterface( sal_True ) ); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > x = pContainer; - - UnoControlModel* pContainerModel = new UnoControlContainerModel( xFactory ); - 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; - - OSL_FAIL( "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; - - OSL_FAIL( "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; - - OSL_FAIL( "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; - - OSL_FAIL( "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_FAIL( "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_FAIL( "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 < SAL_N_ELEMENTS( aUnits ); ++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(RTL_CONSTASCII_USTRINGPARAM("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(RTL_CONSTASCII_USTRINGPARAM("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; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |